:root {
  --paper: #F3F3F1;
  --paper-2: #E8E8E5;
  --ink: #0D0D0E;
  --ink-2: #4A4A4F;
  --ink-3: #66666B;
  --line: #CFCFCB;
  --accent: #FF5A1F;
  --accent-ink: #0D0D0E;
  --accent-text: #C93A08;
  --danger: #C2290E;

  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-in: cubic-bezier(.7, 0, .84, 0);
  --gutter: clamp(16px, 4vw, 56px);
  --trace-w: clamp(220px, 26vw, 340px);
  --font: "Gothic A1", system-ui, -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0D0D0E;
    --paper-2: #1A1A1C;
    --ink: #EDEDEA;
    --ink-2: #B4B4AF;
    --ink-3: #85858A;
    --line: #2E2E31;
    --accent: #FF5A1F;
    --accent-ink: #0D0D0E;
    --accent-text: #FF7A47;
    --danger: #FF6B4D;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0D0D0E;
  --paper-2: #1A1A1C;
  --ink: #EDEDEA;
  --ink-2: #B4B4AF;
  --ink-3: #85858A;
  --line: #2E2E31;
  --accent: #FF5A1F;
  --accent-ink: #0D0D0E;
  --accent-text: #FF7A47;
  --danger: #FF6B4D;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.6;
  word-break: keep-all;
  overflow-wrap: anywhere;
  -webkit-font-smoothing: antialiased;
  caret-color: var(--accent);
  transition: background-color .4s var(--ease-out);
}
::selection { background: var(--accent); color: var(--accent-ink); }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 4px; border-radius: 2px; }
html { scrollbar-color: var(--line) transparent; scrollbar-width: thin; }
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 8px; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.noscript { padding: var(--gutter); font-size: 1.25rem; }

/* ---------- Shell ---------- */

.app {
  display: grid;
  grid-template-columns: var(--trace-w) minmax(0, 1fr);
  grid-template-rows: 1fr auto;
  grid-template-areas: "trace stage" "trace controls";
  min-height: 100dvh;
}

/* ---------- Trace ---------- */

.trace {
  grid-area: trace;
  position: sticky;
  top: 0;
  height: 100dvh;
  padding: clamp(32px, 6vh, 64px) 0 clamp(32px, 6vh, 64px) var(--gutter);
  display: flex;
  flex-direction: column;
  gap: clamp(24px, 5vh, 48px);
}
.trace__count {
  margin: 0;
  font-size: 15px;
  font-weight: 500;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
}
.trace__now { color: var(--ink); font-weight: 800; }
.trace__sep { margin: 0 .35em; }
.trace__body { position: relative; flex: 1; min-height: 0; }
.trace__list {
  position: relative;
  list-style: none;
  margin: 0;
  padding: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.trace__rail {
  position: absolute;
  left: 5px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: var(--line);
}
.trace__fill {
  position: absolute;
  inset: 0;
  background: var(--ink);
  transform-origin: top;
  transform: scaleY(var(--progress, 0));
  transition: transform .9s var(--ease-out);
}
.app[data-phase="done"] .trace__fill { background: var(--accent); }

.node { position: relative; display: block; min-height: 12px; }
.node__btn {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr);
  column-gap: 16px;
  align-items: start;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
  cursor: default;
}
.node[data-state="done"] .node__btn { cursor: pointer; }
.node__dot {
  position: relative;
  display: block;
  width: 12px;
  height: 12px;
  margin-top: 2px;
  border-radius: 50%;
  background: var(--paper);
  box-shadow: inset 0 0 0 2px var(--line);
  transition: background-color .4s var(--ease-out), box-shadow .4s var(--ease-out), transform .4s var(--ease-out);
}
.node[data-state="done"] .node__dot { background: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); }
.node[data-state="current"] .node__dot {
  background: var(--accent);
  box-shadow: inset 0 0 0 2px var(--accent);
  transform: scale(1.25);
}
.node[data-state="current"] .node__dot::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 1.5px solid var(--accent);
  opacity: 0;
  animation: ping 2.4s var(--ease-out) .4s 2;
}
@keyframes ping {
  0% { transform: scale(.6); opacity: .9; }
  70%, 100% { transform: scale(1.6); opacity: 0; }
}
.node__text { display: grid; min-width: 0; line-height: 1.3; }
.node__label {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-3);
  transition: color .3s var(--ease-out);
}
.node[data-state="current"] .node__label { color: var(--ink); font-weight: 700; }
.node[data-state="done"] .node__label { color: var(--ink-2); }
.node__token {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-height: 1.3em;
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity .5s var(--ease-out) .15s, transform .5s var(--ease-out) .15s;
}
.node[data-state="done"] .node__token { opacity: 1; transform: none; }
.node[data-state="done"] .node__btn:hover .node__token { color: var(--accent-text); }

/* ---------- Stage ---------- */

.stage {
  grid-area: stage;
  position: relative;
  padding: clamp(48px, 16vh, 168px) var(--gutter) 32px clamp(24px, 5vw, 96px);
  min-width: 0;
}
.screen { max-width: 52rem; margin: 0; }
.screen.is-leaving {
  opacity: 0;
  transform: translateY(-20px);
  filter: blur(6px);
  transition: opacity .28s var(--ease-in), transform .28s var(--ease-in), filter .28s var(--ease-in);
}

.title {
  margin: 0;
  font-weight: 800;
  font-size: clamp(2rem, 1.1rem + 3.4vw, 4.25rem);
  line-height: 1.14;
  letter-spacing: -0.03em;
  text-wrap: balance;
}
.title--hero { font-size: clamp(2.75rem, 1rem + 6.2vw, 6rem); line-height: 1.06; letter-spacing: -0.035em; }
.title:focus-visible { outline: none; }
.title .line { display: block; }
.title .w { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: .08em; margin-bottom: -.08em; }
.title .w > span { display: inline-block; transform: translateY(105%); animation: rise .9s var(--ease-out) forwards; animation-delay: calc(var(--i) * 45ms + 60ms); }
@keyframes rise { to { transform: none; } }

.hint {
  margin: 20px 0 0;
  max-width: 38rem;
  color: var(--ink-2);
  font-size: clamp(16px, .95rem + .2vw, 18px);
}
.fade { opacity: 0; transform: translateY(10px); animation: fadeUp .8s var(--ease-out) forwards; animation-delay: var(--d, .35s); }
@keyframes fadeUp { to { opacity: 1; transform: none; } }

.field-area { margin-top: clamp(32px, 6vh, 56px); max-width: 40rem; }

/* Intro */
.lead { margin: clamp(24px, 4vh, 40px) 0 0; max-width: 34rem; font-size: clamp(17px, 1rem + .3vw, 20px); color: var(--ink-2); }
.facts { list-style: none; margin: clamp(28px, 5vh, 48px) 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px 28px; }
.facts li { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; }
.facts li::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--ink); }

/* Text inputs */
.input {
  display: block;
  width: 100%;
  padding: 10px 0 14px;
  border: 0;
  border-bottom: 2px solid var(--ink);
  border-radius: 0;
  background: transparent;
  font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.25rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  transition: border-color .3s var(--ease-out);
}
.input::placeholder { color: var(--ink-3); opacity: 1; font-weight: 500; }
.input:focus { border-color: var(--accent); }
.input:focus-visible { outline: none; }
.input--sm { font-size: clamp(1.15rem, 1rem + .6vw, 1.5rem); }
textarea.input { resize: none; min-height: 7.5em; line-height: 1.45; font-size: clamp(1.15rem, 1rem + .6vw, 1.45rem); font-weight: 500; }
.sub { display: grid; gap: 6px; margin-bottom: 32px; }
.sub:last-child { margin-bottom: 0; }
.sub__label { font-size: 14px; font-weight: 700; color: var(--ink-2); }
.sub__label em { font-style: normal; font-weight: 500; color: var(--ink-3); margin-left: 6px; }
.counter { margin-top: 8px; font-size: 13px; color: var(--ink-3); text-align: right; font-variant-numeric: tabular-nums; }

/* Choices */
.choices { display: grid; border-top: 1px solid var(--line); }
.choice {
  position: relative;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 24px;
  align-items: center;
  gap: 16px;
  min-height: 64px;
  padding: 12px 8px 12px 4px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  isolation: isolate;
  transition: color .25s var(--ease-out);
}
.choice::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--ink);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .45s var(--ease-out);
}
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice__key {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  box-shadow: inset 0 0 0 1.5px var(--line);
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-3);
  transition: background-color .25s var(--ease-out), color .25s var(--ease-out), box-shadow .25s var(--ease-out);
}
.choice__text { font-size: clamp(17px, 1rem + .4vw, 21px); font-weight: 700; line-height: 1.35; }
.choice__check { opacity: 0; transform: scale(.6); transition: opacity .3s var(--ease-out), transform .3s var(--ease-out); color: var(--accent); }
.choice__check svg { width: 22px; height: 22px; stroke-width: 2.5; }
@media (hover: hover) {
  .choice:hover .choice__key { box-shadow: inset 0 0 0 1.5px var(--ink); color: var(--ink); }
}
.choice:has(input:checked) { color: var(--paper); }
.choice:has(input:checked)::before { transform: scaleX(1); }
.choice:has(input:checked) .choice__key { background: var(--accent); box-shadow: none; color: var(--accent-ink); }
.choice:has(input:checked) .choice__check { opacity: 1; transform: none; }
.choice:has(input:focus-visible) { outline: 2px solid var(--accent-text); outline-offset: 2px; }
.other { margin-top: 16px; }
.other[hidden] { display: none; }
.notice { margin: 16px 0 0; display: flex; gap: 10px; align-items: flex-start; font-size: 16px; font-weight: 700; color: var(--ink); }
.notice svg { width: 20px; height: 20px; flex: none; margin-top: 2px; }
.notice[hidden] { display: none; }

/* Chips (schedule) */
.group-label { display: block; margin: 0 0 12px; font-size: 14px; font-weight: 700; color: var(--ink-2); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 32px; }
.chip { position: relative; cursor: pointer; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span {
  display: grid;
  place-items: center;
  min-width: 56px;
  height: 56px;
  padding: 0 20px;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1.5px var(--line);
  font-size: 18px;
  font-weight: 700;
  transition: background-color .25s var(--ease-out), color .25s var(--ease-out), box-shadow .25s var(--ease-out);
}
.chips--days .chip span { width: 64px; height: 64px; padding: 0; font-size: 19px; }
.group-label em { font-style: normal; font-weight: 500; color: var(--ink-3); margin-left: 8px; }
.chips--course { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; max-width: 34rem; margin-bottom: 0; }
.chips--course .chip span { height: 76px; font-size: 22px; font-weight: 800; }
.chips--starts .chip span { min-width: 84px; padding: 0 16px; font-variant-numeric: tabular-nums; font-size: 17px; }
.chips--days, .chips--starts { gap: 10px; margin-bottom: 40px; }
.price { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 18px; margin: clamp(36px, 6vh, 56px) 0 0; padding-top: clamp(24px, 4vh, 32px); border-top: 1px solid var(--line); max-width: 34rem; }
.price[hidden] { display: none; }
.price__num { font-size: clamp(2.5rem, 1.6rem + 3vw, 3.5rem); font-weight: 800; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; line-height: 1; }
.price__note { font-size: 14px; font-weight: 800; padding: 7px 14px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); }
.price.is-new .price__num { animation: fadeUp .5s var(--ease-out); }
@media (hover: hover) { .chip:hover span { box-shadow: inset 0 0 0 1.5px var(--ink); } }
.chip input:checked + span { background: var(--ink); color: var(--paper); box-shadow: inset 0 0 0 1.5px var(--ink); }
.chip input:focus-visible + span { outline: 2px solid var(--accent-text); outline-offset: 3px; }

/* Consent */
.terms { list-style: none; margin: 0 0 28px; padding: 0; border-top: 1px solid var(--line); }
.terms li { padding: 14px 0; border-bottom: 1px solid var(--line); color: var(--ink-2); font-size: 16px; }
.terms li:last-child { color: var(--ink); font-weight: 700; display: flex; gap: 10px; align-items: center; }
.terms li:last-child svg { width: 18px; height: 18px; flex: none; color: var(--ink); }
.agree { display: inline-flex; align-items: center; gap: 14px; cursor: pointer; font-size: 19px; font-weight: 700; }
.agree input { position: absolute; opacity: 0; pointer-events: none; }
.agree__box {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px;
  box-shadow: inset 0 0 0 2px var(--ink);
  transition: background-color .25s var(--ease-out), box-shadow .25s var(--ease-out);
}
.agree__box svg { width: 20px; height: 20px; stroke-width: 3; color: var(--accent-ink); opacity: 0; transform: scale(.5); transition: opacity .3s var(--ease-out), transform .3s var(--ease-out); }
.agree input:checked + .agree__box { background: var(--accent); box-shadow: inset 0 0 0 2px var(--accent); }
.agree input:checked + .agree__box svg { opacity: 1; transform: none; }
.agree input:focus-visible + .agree__box { outline: 2px solid var(--accent-text); outline-offset: 3px; }

/* Review */
.review { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); max-width: 44rem; }
.review li { border-bottom: 1px solid var(--line); }
.review button {
  display: grid;
  grid-template-columns: minmax(96px, 9rem) minmax(0, 1fr) 20px;
  gap: 16px;
  align-items: baseline;
  width: 100%;
  padding: 16px 4px;
  border: 0;
  background: none;
  text-align: left;
}
.review__k { font-size: 14px; font-weight: 700; color: var(--ink-3); }
.review__v { font-size: 17px; font-weight: 700; white-space: pre-line; }
.review svg { width: 18px; height: 18px; color: var(--ink-3); align-self: center; transition: transform .3s var(--ease-out), color .3s; }
@media (hover: hover) {
  .review button:hover .review__v { color: var(--accent-text); }
  .review button:hover svg { color: var(--accent-text); transform: translateX(3px); }
}

/* Errors */
.error {
  margin: 16px 0 0;
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--danger);
  font-size: 15px;
  font-weight: 700;
}
.error:empty { display: none; }
.error svg { width: 18px; height: 18px; flex: none; }
.shake { animation: shake .4s var(--ease-out); }
@keyframes shake { 20% { transform: translateX(-6px); } 40% { transform: translateX(5px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(2px); } }

/* ---------- Controls ---------- */

.controls {
  grid-area: controls;
  display: flex;
  align-items: center;
  gap: 16px;
  justify-self: start;
  width: min(100%, calc(clamp(24px, 5vw, 96px) + 40rem));
  padding: 24px 0 clamp(32px, 6vh, 56px) clamp(24px, 5vw, 96px);
}
.controls__hint { margin: 0 0 0 auto; font-size: 13px; color: var(--ink-3); white-space: nowrap; }
.controls__hint kbd {
  font: inherit; font-weight: 700; color: var(--ink-2);
  padding: 2px 7px; border-radius: 5px; box-shadow: inset 0 0 0 1px var(--line);
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 56px;
  padding: 0 26px;
  border: 0;
  border-radius: 999px;
  font-size: 17px;
  font-weight: 800;
  transition: transform .2s var(--ease-out), background-color .25s var(--ease-out), color .25s, opacity .25s;
}
.btn svg { width: 20px; height: 20px; stroke-width: 2.25; transition: transform .3s var(--ease-out); }
.btn--primary { background: var(--accent); color: var(--accent-ink); }
.btn--primary:hover svg { transform: translateX(4px); }
.btn--primary:active { transform: scale(.97); }
.btn--primary[aria-busy="true"] { pointer-events: none; }
.btn--primary[aria-busy="true"] svg { animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.btn--ghost { padding: 0 18px 0 12px; background: transparent; color: var(--ink-2); }
.btn--ghost:hover { color: var(--ink); background: var(--paper-2); }
.btn--ghost:hover svg { transform: translateX(-3px); }
.btn[hidden] { display: none; }
.app[data-phase="intro"] .btn--ghost { visibility: hidden; }
.app[data-phase="done"] .controls { display: none; }


/* ---------- Mobile ---------- */

@media (max-width: 860px) {
  body { font-size: 16px; }
  .app {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto 1fr auto;
    grid-template-areas: "trace" "stage" "controls";
  }
  .trace {
    height: auto;
    z-index: 5;
    flex-direction: row;
    align-items: center;
    gap: 16px;
    padding: max(14px, env(safe-area-inset-top)) var(--gutter) 14px;
    background: color-mix(in srgb, var(--paper) 88%, transparent);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }
  .trace__count { order: 2; font-size: 14px; }
  .trace__body { flex: 1; height: 12px; }
  .trace__list { flex-direction: row; align-items: center; height: 12px; }
  .trace__rail { left: 6px; right: 6px; top: 5px; bottom: auto; width: auto; height: 2px; }
  .trace__fill { transform-origin: left; transform: scaleX(var(--progress, 0)); }
  .node { min-height: 0; }
  .node__btn { display: block; width: auto; }
  .node__dot { margin: 0; width: 10px; height: 10px; }
  .node__text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .stage { padding: clamp(28px, 7vh, 72px) var(--gutter) 24px; }
  .controls {
    position: sticky;
    bottom: 0;
    padding: 12px var(--gutter) max(16px, env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--paper) 88%, transparent);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }
  .controls__hint { display: none; }
  .controls { width: auto; justify-self: stretch; }
  .app[data-phase="intro"] .stage { display: flex; flex-direction: column; }
  .app[data-phase="intro"] .screen { flex: 1; display: flex; flex-direction: column; }
  .app[data-phase="intro"] .title { margin-top: auto; }
  .app[data-phase="intro"] .lead { margin-top: 32px; }
  .title--hero { font-size: clamp(3.1rem, 1.2rem + 8vw, 4rem); }
  .title--hero .line { display: inline; }
  .btn--primary { margin-left: auto; flex: 0 1 auto; justify-content: center; min-width: 9.5rem; }
  .review button { grid-template-columns: minmax(0, 1fr) 20px; gap: 4px 12px; }
  .review__k { grid-column: 1; }
  .review__v { grid-column: 1; }
  .review svg { grid-column: 2; grid-row: 1 / span 2; }
  .chip span { height: 52px; min-width: 52px; font-size: 17px; }
  .chips--days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
  .chips--days .chip span { width: 100%; padding: 0; aspect-ratio: 1; height: auto; min-width: 0; }
  .chips--starts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .chips--starts .chip span { min-width: 0; padding: 0; height: 56px; }
  .chips--course { gap: 8px; }
  .chips--course .chip span { height: 68px; font-size: 19px; }
  .choice { min-height: 60px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; transition-delay: 0ms !important; }
  .title .w > span, .fade { transform: none; opacity: 1; }
  .node[data-state="current"] .node__dot::after { display: none; }
}
