:root {
  --primary: #3a6d51;
  --primary-light: #5e8c73;
  --accent: #162c1e;
  --bg: #f9fbf9;
  --surface: #ffffff;
  --surface-variant: #f4f6f4;
  --text: #162c1e;
  --text-muted: #4a6355;
  --border: #e2e8e4;
  --radius: 16px;
  --max-width: 1120px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1f15;
    --surface: #1a3824;
    --surface-variant: #1f4429;
    --text: #f2f0f7;
    --text-muted: #a9c2b3;
    --border: #2a4a35;
  }
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Pretendard", "Noto Sans KR", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
}

a {
  color: var(--primary);
}

@media (prefers-color-scheme: dark) {
  a {
    color: var(--primary-light);
  }
}

img {
  max-width: 100%;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* header */
.site-header {
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  font-size: 18px;
}

.brand img {
  width: 32px;
  height: 32px;
  border-radius: 8px;
}

.site-nav {
  display: flex;
  gap: 20px;
  font-size: 14px;
}

.site-nav a {
  text-decoration: none;
  color: var(--text-muted);
}

.site-nav a:hover {
  color: var(--primary);
}

/* hero */
.hero {
  text-align: center;
  padding: 64px 0 48px;
}

.hero .icon {
  width: 96px;
  height: 96px;
  border-radius: 22px;
  box-shadow: 0 8px 24px rgba(22, 44, 30, 0.18);
  margin-bottom: 20px;
}

.hero h1 {
  font-size: 34px;
  margin: 0 0 12px;
}

.hero p.tagline {
  font-size: 18px;
  color: var(--text-muted);
  max-width: 560px;
  margin: 0 auto 28px;
}

.cta-row {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 600;
  font-size: 15px;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-secondary {
  background: var(--surface-variant);
  color: var(--text);
  border: 1px solid var(--border);
}

/* sections */
section {
  padding: 40px 0;
}

section h2 {
  font-size: 24px;
  margin-bottom: 24px;
  text-align: center;
}

.page-title {
  font-size: 30px;
  text-align: center;
  margin: 0 0 32px;
}

.perspective-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

/* flow diagram */
.flow-diagram-wrap {
  max-width: 980px;
  margin: 0 auto;
}

.flow-diagram {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
}

.flow-diagram rect {
  fill: var(--surface);
  stroke: var(--border);
  stroke-width: 1.5;
}

.flow-diagram rect.hub {
  fill: var(--primary);
  stroke: var(--primary);
}

.flow-diagram text {
  fill: var(--text);
  font-size: 15px;
  font-weight: 600;
  text-anchor: middle;
  dominant-baseline: middle;
}

.flow-diagram text.hub-text {
  fill: #fff;
}

.flow-diagram text.sub {
  fill: var(--text-muted);
  font-size: 11px;
  font-weight: 400;
}

.flow-diagram path.link {
  fill: none;
  stroke: var(--text-muted);
  stroke-width: 1.5;
  marker-end: url(#flow-arrow);
}

.flow-diagram marker path {
  fill: var(--text-muted);
}

.perspective-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.perspective-card h3 {
  margin: 0 0 6px;
  font-size: 16px;
}

.perspective-card p {
  margin: 0;
  font-size: 14px;
  color: var(--text-muted);
}

.perspective-card .badge {
  display: inline-block;
  margin-top: 10px;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-variant);
  color: var(--text-muted);
}

.feature-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 14px;
}

.feature-list li {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
}

.feature-list strong {
  display: block;
  margin-bottom: 4px;
}

.feature-list span {
  color: var(--text-muted);
  font-size: 14px;
}

/* FAQ (details/summary) */
.faq-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px 20px;
  margin-bottom: 12px;
}

.faq-item summary {
  cursor: pointer;
  font-weight: 600;
  padding: 16px 0;
  list-style: none;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: "+";
  float: right;
  color: var(--text-muted);
}

.faq-item[open] summary::after {
  content: "\2212";
}

.faq-item p {
  margin: 0 0 16px;
  color: var(--text-muted);
}

/* contact card */
.contact-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  text-align: center;
}

.contact-card-form {
  text-align: left;
}

.support-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-top: 8px;
}

.support-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
}

.support-form select,
.support-form input,
.support-form textarea {
  width: 100%;
  font: inherit;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-variant);
  color: var(--text);
  font-weight: 400;
}

.support-form textarea {
  resize: vertical;
}

.support-form button {
  align-self: flex-start;
  font: inherit;
  padding: 12px 22px;
  border-radius: 999px;
  border: none;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
}

.support-form button:hover {
  filter: brightness(1.08);
}

.support-form button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

#form-status {
  font-size: 13px;
  min-height: 1.2em;
  margin: 0;
}

#form-status[data-state="ok"] {
  color: var(--primary);
}

#form-status[data-state="error"] {
  color: #c0453a;
}

.form-note {
  font-size: 13px;
  color: var(--text-muted);
  margin: 20px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.contact-card .email {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
  display: inline-block;
  margin-top: 8px;
}

/* legal doc */
.legal h1 {
  font-size: 28px;
  margin-bottom: 4px;
}

.legal .meta {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 32px;
}

.legal h2 {
  font-size: 19px;
  text-align: left;
  margin: 32px 0 12px;
}

.legal h3 {
  font-size: 16px;
  margin: 20px 0 8px;
}

.legal p,
.legal li {
  font-size: 15px;
  color: var(--text);
}

.legal table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 14px;
}

.legal th,
.legal td {
  border: 1px solid var(--border);
  padding: 8px 10px;
  text-align: left;
}

.legal th {
  background: var(--surface-variant);
}

/* footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 28px 0;
  margin-top: 40px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
}

.site-footer a {
  color: var(--text-muted);
  margin: 0 8px;
}

/* chat (web try experience) — Flutter 앱의 SageChatBubble/SageActionCircleButton 스타일 그대로 이식 */
:root {
  --bubble-user-bg: #162c1e;
  --bubble-user-text: #ffffff;
  --bubble-ai-bg: #e4ebe4;
  --bubble-ai-text: #162c1e;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bubble-user-bg: #1f4429;
    --bubble-ai-bg: #1a3824;
    --bubble-ai-text: #f2f0f7;
  }
}

:root[data-theme="dark"] {
  --bubble-user-bg: #1f4429;
  --bubble-ai-bg: #1a3824;
  --bubble-ai-text: #f2f0f7;
}

:root[data-theme="light"] {
  --bubble-user-bg: #162c1e;
  --bubble-ai-bg: #e4ebe4;
  --bubble-ai-text: #162c1e;
}

.chat-section {
  padding-top: 24px;
}

.chat-container {
  display: flex;
  flex-direction: column;
  max-width: 720px;
}

.chat-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 20px;
}

.chat-page-title {
  margin: 0;
}

.chat-log {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 320px;
  padding-bottom: 20px;
}

.chat-row {
  display: flex;
}

.chat-row.user {
  justify-content: flex-end;
}

.chat-row.ai {
  justify-content: flex-start;
}

.chat-bubble {
  max-width: 80%;
  padding: 12px 16px;
  font-size: 15px;
  line-height: 1.65;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.chat-bubble.user {
  background: var(--bubble-user-bg);
  color: var(--bubble-user-text);
  border-radius: 20px 20px 4px 20px;
}

.chat-bubble.ai {
  background: var(--bubble-ai-bg);
  color: var(--bubble-ai-text);
  border-radius: 4px 20px 20px 20px;
}

.chat-bubble-error {
  background: rgba(192, 69, 58, 0.12);
  color: #c0453a;
}

.chat-typing {
  display: flex;
  gap: 4px;
  padding: 4px 0;
}

.chat-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.5;
  animation: chat-typing-bounce 1.1s infinite ease-in-out;
}

.chat-typing span:nth-child(2) { animation-delay: 0.15s; }
.chat-typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes chat-typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 0.9; }
}

@media (prefers-reduced-motion: reduce) {
  .chat-typing span { animation: none; }
}

.chat-perspectives {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 4px 0;
}

.chat-perspective-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
}

.chat-perspective-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 13px;
}

.chat-dir {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--surface-variant);
  color: var(--text-muted);
}

.chat-dir-go { color: #fff; background: var(--primary); }
.chat-dir-stop { color: #fff; background: #c0453a; }
.chat-dir-wait { color: var(--text-muted); background: var(--surface-variant); }
.chat-dir-prep { color: var(--text); background: var(--surface-variant); }
.chat-dir-shift { color: #fff; background: var(--primary-light); }

.chat-perspective-reading {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0 0 6px;
}

.chat-perspective-core {
  font-size: 13px;
  margin: 0;
}

.chat-synthesis-text {
  margin: 4px 0 0;
  white-space: pre-wrap;
}

.chat-input-bar {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  background: var(--surface-variant);
  border-radius: 24px;
  padding: 8px 8px 8px 20px;
  position: sticky;
  bottom: 16px;
  border: 1px solid var(--border);
}

.chat-input-bar textarea {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 15px;
  resize: none;
  max-height: 120px;
  padding: 10px 0;
  outline: none;
}

.chat-send-btn {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: none;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.chat-send-btn:disabled {
  background: var(--border);
  color: var(--text-muted);
  cursor: not-allowed;
}

.app-cta {
  margin-top: 4px;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
}

.app-cta p {
  margin: 0 0 16px;
  font-size: 15px;
  color: var(--text);
}

.app-cta-links {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.app-cta-links a {
  display: inline-flex;
  align-items: center;
  padding: 10px 22px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 14px;
}
