:root {
  color-scheme: light;
  --bg: #f3f0e8;
  --bg-deep: #ebe6db;
  --panel: rgba(255, 254, 250, .78);
  --panel-solid: #fffefa;
  --text: #132019;
  --text-soft: #34463c;
  --muted: #636e66;
  --line: rgba(19, 32, 25, .13);
  --line-strong: rgba(19, 32, 25, .22);
  --accent: #1e6043;
  --accent-soft: #dce9df;
  --button-text: #fffef9;
  --danger: #9a403d;
  --shadow: 0 28px 80px rgba(35, 47, 39, .11);
  --focus: rgba(30, 96, 67, .18);
  font-family: Pretendard, "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  background: var(--bg);
  color: var(--text);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0c121c;
  --bg-deep: #101824;
  --panel: rgba(20, 29, 43, .88);
  --panel-solid: #182334;
  --text: #f2eee8;
  --text-soft: #d5dbe5;
  --muted: #a8b1c0;
  --line: #303a4a;
  --line-strong: #3b4759;
  --accent: #dc936d;
  --accent-soft: #30211f;
  --button-text: #1b120e;
  --danger: #efa9a3;
  --shadow: 0 34px 90px rgba(0, 0, 0, .34);
  --focus: rgba(220, 147, 109, .2);
}

* { box-sizing: border-box; }
html { min-width: 320px; height: 100%; min-height: 100%; background: var(--bg); scroll-behavior: smooth; }
body {
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: 100vh;
  height: 100svh;
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 8%, color-mix(in srgb, var(--accent) 9%, transparent) 0, transparent 35rem),
    linear-gradient(160deg, var(--bg) 0%, var(--bg-deep) 100%);
  color: var(--text);
  transition: background-color .25s ease, color .25s ease;
}
body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 72px 72px;
  content: "";
  opacity: .16;
  mask-image: linear-gradient(to bottom, black, transparent 72%);
  pointer-events: none;
}
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

.site-header {
  display: flex;
  width: min(calc(100% - 3rem), 1180px);
  min-height: 72px;
  margin: 0 auto;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: .65rem; color: var(--text); font-size: .98rem; font-weight: 800; letter-spacing: -.035em; text-decoration: none; }
.brand-mark { width: .7rem; height: .7rem; border: 2px solid var(--accent); border-radius: 50%; box-shadow: inset 0 0 0 2px var(--bg); background: var(--accent); }
.header-actions { display: flex; align-items: center; gap: .25rem; }
.text-button, .theme-button { min-height: 42px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font-size: .84rem; font-weight: 700; }
.text-button { padding: .6rem .8rem; }
.theme-button { display: inline-grid; width: 42px; height: 42px; padding: 0; border: 1px solid var(--line-strong); align-items: center; justify-content: center; background: var(--panel); box-shadow: inset 0 1px 0 color-mix(in srgb, white 8%, transparent); }
.theme-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.text-button:hover { background: var(--panel); color: var(--text); }
.theme-button:hover { border-color: var(--accent); background: var(--panel-solid); color: var(--accent); }
.theme-icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.theme-icon-moon { display: none; }
:root[data-theme="dark"] .theme-icon-sun { display: none; }
:root[data-theme="dark"] .theme-icon-moon { display: block; }
:root[data-theme="dark"] .theme-button { border-color: #303a4a; background: #151e2c; color: #f2eee8; }
:root[data-theme="dark"] .theme-button:hover { border-color: #dc936d; background: #182334; color: #dc936d; }

main { display: grid; width: min(calc(100% - 3rem), 980px); height: 100%; min-height: 0; margin: 0 auto; overflow: hidden; place-items: center; }
.screen { width: 100%; height: 100%; max-height: 100%; padding: clamp(1.5rem, 4.5vh, 3.75rem) 0; overflow: hidden; animation: reveal .42s cubic-bezier(.2,.7,.2,1) both; }
.screen[hidden] { display: none; }
@keyframes reveal { from { opacity: 0; transform: translateY(10px); } }

.hero { display: grid; height: 100%; min-height: 0; text-align: center; place-items: center; }
.hero-inner { width: 100%; }
.eyebrow, .step { margin: 0 0 clamp(1rem, 2.2vh, 1.4rem); color: var(--accent); font-size: .7rem; font-weight: 850; letter-spacing: .2em; text-transform: uppercase; }
.eyebrow { display: flex; align-items: center; justify-content: center; gap: .65rem; }
.eyebrow span { width: 4px; height: 4px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 12%, transparent); }
h1, h2 { margin: 0; font-weight: 760; letter-spacing: -.06em; line-height: 1.08; word-break: keep-all; text-wrap: balance; }
h1 { font-size: clamp(2.85rem, 7.2vw, 6.6rem); }
h1 em { color: var(--accent); font-style: normal; }
h2 { font-size: clamp(2.15rem, 5.5vw, 4.35rem); }
.hero-copy, .privacy-copy { margin: clamp(1.2rem, 2.8vh, 1.8rem) auto clamp(1.4rem, 3.2vh, 2.1rem); color: var(--muted); font-size: clamp(.94rem, 1.45vw, 1.08rem); line-height: 1.8; }

.primary-button, .secondary-button, .danger-button {
  min-height: 52px;
  padding: .86rem 1.35rem;
  border-radius: 999px;
  font-weight: 780;
  letter-spacing: -.015em;
  transition: transform .2s ease, border-color .2s ease, background .2s ease, box-shadow .2s ease;
}
.primary-button { border: 1px solid var(--accent); background: var(--accent); box-shadow: 0 10px 30px color-mix(in srgb, var(--accent) 20%, transparent); color: var(--button-text); }
.primary-button span { display: inline-block; margin-left: .35rem; transition: transform .2s ease; }
.primary-button:hover { transform: translateY(-2px); box-shadow: 0 14px 34px color-mix(in srgb, var(--accent) 26%, transparent); }
.primary-button:hover span { transform: translateX(3px); }
.secondary-button { border: 1px solid var(--line-strong); background: var(--panel); color: var(--text); }
.danger-button { border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent); background: transparent; color: var(--danger); }
.secondary-button:hover, .danger-button:hover { transform: translateY(-2px); border-color: var(--accent); }
.primary-button:disabled { cursor: wait; opacity: .55; transform: none; }
.hero-button { min-width: min(100%, 225px); }

.trust-row { display: flex; margin-top: clamp(1.2rem, 3vh, 1.8rem); gap: .45rem; justify-content: center; flex-wrap: wrap; }
.trust-row span { position: relative; padding: .4rem .65rem .4rem 1.25rem; color: var(--muted); font-size: .73rem; font-weight: 650; }
.trust-row span::before { position: absolute; left: .55rem; top: 50%; width: 4px; height: 4px; border-radius: 50%; background: var(--accent); content: ""; transform: translateY(-50%); }

.form-screen, .result-screen, .history-screen { max-width: 820px; align-content: center; }
.form-screen, .result-screen, .share-screen, .history-screen { display: flex; min-height: 0; flex-direction: column; justify-content: center; }
.form-screen form { display: grid; margin-top: 2.2rem; gap: 1.15rem; }
.field { display: grid; gap: .65rem; }
.field > span { color: var(--text); font-weight: 730; }
.field em { color: var(--muted); font-size: .76rem; font-style: normal; font-weight: 550; }
.field input, .field textarea {
  width: 100%; border: 1px solid var(--line-strong); border-radius: 16px; outline: none;
  background: var(--panel); color: var(--text); padding: 1rem 1.05rem; box-shadow: inset 0 1px 0 color-mix(in srgb, white 35%, transparent);
}
.field input::placeholder, .field textarea::placeholder { color: color-mix(in srgb, var(--muted) 80%, transparent); }
.field textarea { min-height: 118px; max-height: 40vh; resize: vertical; line-height: 1.7; }
.field input:focus, .field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--focus); }
.field small { color: var(--muted); text-align: right; }
.consent-row { display: flex; padding: .1rem 0; gap: .7rem; align-items: flex-start; color: var(--muted); font-size: .83rem; line-height: 1.55; }
.consent-row input { flex: 0 0 auto; width: 17px; height: 17px; margin-top: .15rem; accent-color: var(--accent); }

.notice { min-height: 1.5rem; margin: 1.35rem 0; color: var(--muted); font-size: .9rem; }
.reflection-card, .share-card { border: 1px solid var(--line); border-radius: 26px; background: linear-gradient(145deg, var(--panel-solid), var(--panel)); box-shadow: var(--shadow); }
.reflection-card { padding: clamp(1rem, 2.5vh, 1.7rem); overflow: hidden; }
.card-label { margin: 0 0 .9rem; color: var(--accent); font-size: .72rem; font-weight: 850; letter-spacing: .13em; }
#reflectionText { color: var(--text-soft); line-height: 1.85; white-space: pre-wrap; }
#reflectionText.is-long { font-size: .9rem; line-height: 1.65; }
#reflectionText.is-very-long { font-size: .78rem; line-height: 1.5; }
.understanding-field { min-height: 0; margin-top: 1.1rem; }
.understanding-field textarea { height: clamp(72px, 12vh, 110px); min-height: 64px; }
.button-row { display: flex; margin-top: 1.4rem; gap: .65rem; flex-wrap: wrap; }

.share-screen { text-align: center; }
.share-card { width: min(100%, 650px); margin: 1.1rem auto 0; padding: clamp(1.15rem, 3.2vh, 2.5rem); overflow: hidden; text-align: left; }
.share-brand { color: var(--accent); font-size: .76rem; font-weight: 850; letter-spacing: .13em; }
.share-card > p:not(.share-brand) { margin: 2rem 0 1.2rem; color: var(--muted); line-height: 1.75; }
.share-card strong { display: block; font-size: clamp(1.15rem, 3vw, 1.5rem); }
.share-card blockquote { margin: 1.35rem 0 2.2rem; color: var(--text); font-size: clamp(1.35rem, 4vw, 2.15rem); font-weight: 760; letter-spacing: -.04em; line-height: 1.5; }
.share-card blockquote.is-long { font-size: clamp(1rem, 2.6vw, 1.35rem); line-height: 1.42; }
.share-card blockquote.is-very-long { font-size: clamp(.78rem, 2vw, 1rem); line-height: 1.35; }
.share-card footer { padding-top: 1.25rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .84rem; line-height: 1.7; }
.share-screen .button-row { justify-content: center; }

.history-list { display: grid; min-height: 70px; margin: .75rem 0; gap: .55rem; overflow: hidden; flex: 1 1 auto; align-content: center; }
.history-item { padding: 1.1rem; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); }
.history-item time { color: var(--muted); font-size: .72rem; }
.history-item p { margin: .45rem 0 0; line-height: 1.65; }
.history-item p.is-long { font-size: .84rem; line-height: 1.5; }
.history-item p.is-very-long { font-size: .75rem; line-height: 1.4; }
.empty { padding: 1.8rem; border: 1px dashed var(--line-strong); border-radius: 16px; color: var(--muted); text-align: center; }
.history-pager { display: flex; min-height: 32px; align-items: center; justify-content: center; gap: .8rem; color: var(--muted); font-size: .72rem; }
.history-pager[hidden] { display: none; }
.pager-button { min-width: 48px; min-height: 30px; padding: .25rem .55rem; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--text); font-size: .7rem; font-weight: 750; }
.pager-button:disabled { cursor: default; opacity: .35; }

.site-footer { width: min(calc(100% - 3rem), 1180px); margin: 0 auto; padding: 1rem 0 max(1.1rem, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); color: var(--muted); font-size: .7rem; line-height: 1.5; }
.site-footer p { margin: .16rem 0; }

@media (max-width: 700px) {
  .site-header, main, .site-footer { width: min(calc(100% - 2rem), 100%); }
  .site-header { min-height: 60px; }
  .theme-button { width: 40px; height: 40px; justify-content: center; }
  .screen { padding: clamp(1rem, 3vh, 2rem) 0; }
  h1 { font-size: clamp(2.35rem, 12vw, 3.7rem); line-height: 1.1; }
  h2 { font-size: clamp(2rem, 10vw, 3.2rem); }
  .hero-copy br, h2 br { display: none; }
  .hero-copy { max-width: 33rem; }
  .button-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .button-row > button { width: auto; min-height: 46px; padding: .7rem .75rem; font-size: .82rem; }
  .share-screen .button-row .primary-button { grid-column: 1 / -1; }
  .reflection-card, .share-card { border-radius: 22px; }
}

@media (max-width: 390px) {
  .brand { font-size: .9rem; }
  .text-button { padding-inline: .55rem; font-size: .78rem; }
  .eyebrow { font-size: .6rem; letter-spacing: .15em; }
  h1 { font-size: clamp(2.15rem, 10.5vw, 2.55rem); }
  .trust-row { gap: .05rem; }
  .trust-row span { padding-inline: 1rem .4rem; font-size: .68rem; }
  .trust-row span::before { left: .4rem; }
}

@media (max-height: 720px) and (max-width: 700px) {
  .screen.hero { padding-block: 1.4rem; }
  .eyebrow { margin-bottom: .7rem; }
  .hero-copy { margin-block: .8rem 1rem; line-height: 1.6; }
  .trust-row { margin-top: .75rem; }
  .site-footer { padding-block: .65rem max(.7rem, env(safe-area-inset-bottom)); }
  .site-footer p:last-child { display: none; }
}

@media (max-height: 820px) {
  .site-header { min-height: 58px; }
  .screen { padding-block: clamp(.75rem, 2.5vh, 1.4rem); }
  .step { margin-bottom: .55rem; }
  h2 { font-size: clamp(1.8rem, 5vh, 3rem); }
  .form-screen form { margin-top: 1rem; gap: .7rem; }
  .field { gap: .4rem; }
  .field input, .field textarea { padding: .72rem .85rem; border-radius: 13px; }
  .field textarea { min-height: 78px; }
  #situationInput { height: clamp(78px, 16vh, 120px); }
  .consent-row { font-size: .76rem; line-height: 1.4; }
  .primary-button, .secondary-button, .danger-button { min-height: 46px; padding-block: .68rem; }
  .notice { margin: .6rem 0; font-size: .8rem; }
  .reflection-card { padding: .9rem; }
  .understanding-field { margin-top: .65rem; }
  .understanding-field textarea { height: clamp(64px, 10vh, 82px); }
  .button-row { margin-top: .7rem; }
  .share-card { margin-top: .65rem; padding: 1.1rem; }
  .share-card > p:not(.share-brand) { margin: 1rem 0 .7rem; }
  .share-card blockquote { margin: .8rem 0 1.1rem; }
  .privacy-copy { margin-block: .65rem; font-size: .85rem; line-height: 1.5; }
  .history-list { margin-block: .65rem; }
  .site-footer { padding-block: .55rem max(.65rem, env(safe-area-inset-bottom)); }
}

@media (max-height: 650px) and (max-width: 700px) {
  .site-header { min-height: 52px; }
  .screen { padding-block: .55rem; }
  .step { margin-bottom: .35rem; font-size: .58rem; }
  h2 { font-size: clamp(1.55rem, 7.5vw, 2rem); }
  .form-screen form { margin-top: .65rem; gap: .45rem; }
  .field > span { font-size: .78rem; }
  .field small { font-size: .68rem; }
  #situationInput { height: 72px; min-height: 72px; }
  .consent-row { font-size: .68rem; }
  .notice { min-height: 1rem; margin-block: .35rem; font-size: .7rem; }
  .reflection-card { padding: .65rem; }
  .card-label { margin-bottom: .4rem; }
  #reflectionText { font-size: .78rem; line-height: 1.55; }
  .understanding-field textarea { height: 58px; min-height: 58px; }
  .understanding-field small { display: none; }
  .share-card { padding: .75rem; }
  .share-card > p:not(.share-brand) { margin: .65rem 0 .45rem; font-size: .76rem; }
  .share-card strong { font-size: .9rem; }
  .share-card blockquote { margin: .55rem 0 .7rem; font-size: 1rem; }
  .share-card footer { padding-top: .65rem; font-size: .7rem; }
  .privacy-copy { margin-block: .4rem; font-size: .72rem; }
  .history-list { margin-block: .4rem; }
  .site-footer { font-size: .62rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}
