:root {
  --bg: #080d1a;
  --panel: #101725;
  --panel-2: #141c2b;
  --ink: #f4f6f8;
  --muted: #969aa6;
  --line: #293243;
  --cyan: #69b8da;
  --cyan-soft: rgba(105, 184, 218, .12);
  --review: #f2b800;
  --sepia: #cf946b;
  --sepia-soft: rgba(207, 148, 107, .12);
  --chartreuse: #c9dd45;
  --chartreuse-soft: rgba(201, 221, 69, .11);
  --garbage: #ef4b55;
  --garbage-soft: rgba(239, 75, 85, .10);
  --mono: "Space Mono", "SFMono-Regular", Consolas, monospace;
  --shadow: 0 24px 70px rgba(0, 0, 0, .28);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: radial-gradient(circle at 12% 4%, rgba(105,184,218,.07), transparent 28rem), radial-gradient(circle at 88% 34%, rgba(105,184,218,.04), transparent 34rem), var(--bg);
  font-family: var(--mono);
  letter-spacing: .01em;
}

button { font: inherit; }
code { color: var(--cyan); font-family: inherit; }

.site-header {
  width: 100%; min-height: 100px; padding: 20px clamp(24px, 4vw, 72px);
  border-bottom: 1px solid #1d2533; display: flex; align-items: center;
  justify-content: space-between; gap: 24px;
}
.brand { display: flex; align-items: center; gap: 15px; color: var(--ink); text-decoration: none; }
.brand-mark { width: 29px; height: 50px; object-fit: contain; }
.brand strong, .brand small { display: block; line-height: 1; }
.brand strong { font-size: clamp(20px, 2vw, 27px); font-weight: 600; letter-spacing: .04em; }
.brand small { margin-top: 8px; color: var(--cyan); font-size: 9px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; }

.progress { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.progress-dot { width: 18px; height: 3px; border-radius: 2px; background: #303746; }
.progress-dot.active { background: var(--cyan); box-shadow: 0 0 12px rgba(105,184,218,.35); }
#progress-label { margin-left: 8px; }

main { max-width: 1120px; margin: 0 auto; padding: 68px 28px 100px; }
.view { animation: rise .45s ease both; }
.hidden { display: none !important; }
.hero { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 38px; margin-bottom: 64px; }
.eyebrow { margin: 0 0 15px; color: var(--cyan); font-size: 11px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
h1 { max-width: 850px; margin: 0; font-size: clamp(39px, 5.8vw, 67px); font-weight: 400; line-height: 1.08; letter-spacing: .03em; }
h2 { font-size: 24px; font-weight: 500; line-height: 1.24; letter-spacing: .01em; }
h3 { font-size: 17px; font-weight: 600; letter-spacing: .01em; }
.lede { max-width: 790px; margin: 24px 0 0; color: var(--muted); font-size: 17px; line-height: 1.75; }
.centered { margin-left: auto; margin-right: auto; text-align: center; }
.time-pill { white-space: nowrap; padding: 11px 15px; border: 1px solid var(--line); border-radius: 999px; background: rgba(20,28,43,.72); color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .08em; }

.notice { display: flex; gap: 13px; align-items: center; margin: -30px 0 34px; padding: 15px 18px; border: 1px solid rgba(105,184,218,.38); border-radius: 12px; background: var(--cyan-soft); color: #bde7f7; }
.notice > span { display: grid; place-items: center; flex: 0 0 28px; height: 28px; border: 1px solid var(--cyan); border-radius: 8px; color: var(--cyan); }
.review-heading { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 21px; }
.review-heading h2 { margin: 0; }
.folder-chip { display: inline-block; margin-right: 7px; padding: 5px 9px; border: 1px solid rgba(242,184,0,.45); border-radius: 7px; background: rgba(242,184,0,.09); color: var(--review); font-size: 13px; font-weight: 700; vertical-align: middle; }
.text-button { padding: 7px 0; border: 0; border-bottom: 1px solid var(--cyan); background: transparent; color: var(--cyan); cursor: pointer; font-size: 13px; font-weight: 700; }

.how-panel { display: grid; grid-template-columns: 230px 1fr; gap: 28px; align-items: center; margin-bottom: 23px; padding: 24px; border: 1px solid var(--line); border-radius: 13px; background: var(--panel); }
.how-panel h3 { margin-top: 0; }
.how-panel ol { margin-bottom: 0; padding-left: 21px; color: var(--muted); line-height: 1.7; }
.motion-demo { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 98px; border: 1px dashed #303a4c; border-radius: 10px; background: #0b111e; overflow: hidden; }
.mini-message { padding: 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel-2); box-shadow: 0 4px 12px rgba(0,0,0,.25); animation: nudge 2.6s ease-in-out infinite; font-size: 11px; font-weight: 700; }
.motion-arrow { color: var(--cyan); font-size: 22px; }
.mini-folder { padding: 10px; border: 1px solid var(--cyan); border-radius: 7px; color: var(--cyan); font-size: 11px; font-weight: 700; }

.message-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 22px; }
.message-card { position: relative; overflow: hidden; padding: 27px; border: 1px solid var(--line); border-radius: 14px; background: linear-gradient(150deg, rgba(20,28,43,.96), rgba(13,19,31,.96)); box-shadow: var(--shadow); transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease; }
.message-card:hover { transform: translateY(-3px); border-color: #3a465b; }
.message-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; opacity: .9; }
.message-card.sepia::before { background: var(--sepia); }
.message-card.chartreuse::before { background: var(--chartreuse); }
.message-card.selected-inbox { border-color: var(--cyan); box-shadow: 0 0 0 1px rgba(105,184,218,.2), var(--shadow); }
.message-card.selected-garbage { border-color: var(--garbage); box-shadow: 0 0 0 1px rgba(239,75,85,.14), var(--shadow); }
.message-topline { display: flex; justify-content: space-between; align-items: center; margin-bottom: 22px; }
.practice-label { color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .13em; }
.sepia .practice-label { color: var(--sepia); }
.chartreuse .practice-label { color: var(--chartreuse); }
.unread-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 11px rgba(105,184,218,.5); }
.sender-row { display: flex; align-items: center; gap: 13px; }
.sender-row small { display: block; margin-top: 5px; color: var(--muted); font-size: 11px; }
.avatar { display: grid; place-items: center; width: 43px; height: 43px; border: 1px solid currentColor; border-radius: 9px; font-size: 18px; font-weight: 700; }
.sepia .avatar { background: var(--sepia-soft); color: var(--sepia); }
.chartreuse .avatar { background: var(--chartreuse-soft); color: var(--chartreuse); }
.message-card h3 { margin: 25px 0 10px; font-size: 21px; font-weight: 500; line-height: 1.32; }
.message-card p { min-height: 52px; color: var(--muted); font-size: 14px; line-height: 1.65; }
.choice-group { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 25px; }
.choice-button { display: flex; align-items: center; justify-content: center; gap: 7px; padding: 12px; border: 1px solid var(--line); border-radius: 9px; background: #0d1421; color: var(--ink); cursor: pointer; font-size: 13px; font-weight: 700; transition: .16s ease; }
.choice-button:hover { border-color: var(--cyan); color: var(--cyan); }
.choice-button.active.inbox { border-color: var(--cyan); background: var(--cyan); color: #07101b; }
.choice-button.active.garbage { border-color: var(--garbage); background: var(--garbage); color: #fff; }

.choice-help { margin: 20px 0 0; text-align: center; color: var(--muted); font-size: 12px; }
.choice-help.error { color: #ff7f87; font-weight: 700; }
.action-row { display: flex; justify-content: flex-end; gap: 12px; margin-top: 31px; }
.primary-button, .secondary-button { padding: 13px 20px; border-radius: 10px; cursor: pointer; font-size: 13px; font-weight: 700; letter-spacing: .02em; }
.primary-button { border: 1px solid var(--cyan); background: var(--cyan); color: #07101b; box-shadow: 0 8px 25px rgba(105,184,218,.17); }
.primary-button:hover { background: #82c7e3; }
.primary-button:disabled { border-color: #394252; background: #303746; color: #6f7480; box-shadow: none; cursor: not-allowed; }
.secondary-button { border: 1px solid var(--line); background: var(--panel); color: var(--ink); }
.secondary-button:hover { border-color: var(--cyan); color: var(--cyan); }

#learning-view, #result-view { max-width: 900px; margin: 0 auto; text-align: center; }
.celebration { display: grid; place-items: center; width: 62px; height: 62px; margin: 0 auto 27px; border: 1px solid var(--cyan); border-radius: 12px; background: var(--cyan-soft); color: var(--cyan); font-size: 28px; box-shadow: 0 0 28px rgba(105,184,218,.12); }
#learning-view h1, #result-view h1 { margin-left: auto; margin-right: auto; }
.saved-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 40px 0 20px; }
.summary-item { padding: 19px; border: 1px solid var(--line); border-radius: 11px; background: var(--panel); text-align: left; }
.summary-item small { display: block; margin-bottom: 8px; color: var(--muted); font-size: 11px; font-weight: 700; }
.route-chip { display: inline-block; padding: 5px 9px; border: 1px solid currentColor; border-radius: 6px; font-size: 11px; font-weight: 700; text-transform: uppercase; }
.route-chip.inbox { background: var(--cyan-soft); color: var(--cyan); }
.route-chip.garbage { background: var(--garbage-soft); color: #ff7078; }
.learning-card, .explanation-card { display: flex; align-items: center; gap: 24px; margin: 20px 0; padding: 25px; border: 1px solid rgba(105,184,218,.35); border-radius: 13px; background: var(--cyan-soft); text-align: left; }
.learning-card h2, .explanation-card h2 { margin: 0 0 9px; font-size: 21px; }
.learning-card p, .explanation-card p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.65; }
.pulse-orbit { display: grid; place-items: center; flex: 0 0 54px; height: 54px; border: 1px solid var(--cyan); border-radius: 50%; animation: pulse 2s ease-in-out infinite; }
.pulse-orbit span { width: 14px; height: 14px; border-radius: 50%; background: var(--cyan); }
.learning-status { margin: 20px 0; padding: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); list-style: none; text-align: left; }
.learning-status li { display: flex; gap: 16px; align-items: center; padding: 18px 20px; border-bottom: 1px solid var(--line); color: #626a78; }
.learning-status li:last-child { border-bottom: 0; }
.learning-status li > span { display: grid; place-items: center; flex: 0 0 34px; height: 34px; border: 1px solid #374154; border-radius: 7px; font-size: 11px; }
.learning-status strong, .learning-status small { display: block; }
.learning-status small { margin-top: 5px; font-size: 11px; }
.learning-status .done { color: var(--cyan); }
.learning-status .current { color: var(--ink); }
.learning-status .current > span { border-color: var(--review); color: var(--review); box-shadow: 0 0 16px rgba(242,184,0,.1); }
.next-note { margin: 22px 0; padding: 21px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); text-align: left; }
.next-note p { margin-bottom: 0; color: var(--muted); font-size: 14px; line-height: 1.6; }
.centered-actions { justify-content: center; }
.prototype-note { max-width: 700px; margin: 17px auto 0; color: #777d89; font-size: 10px; line-height: 1.6; letter-spacing: .06em; }

.result-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin: 38px 0 20px; text-align: left; }
.result-card { padding: 22px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.result-card h3 { margin: 11px 0; font-size: 19px; font-weight: 500; line-height: 1.35; }
.result-card p { color: var(--muted); font-size: 13px; line-height: 1.6; }
.result-route { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 19px; padding-top: 15px; border-top: 1px solid var(--line); font-size: 12px; }
.match { color: var(--cyan); font-size: 9px; font-weight: 700; letter-spacing: .08em; }
.explanation-icon { display: grid; place-items: center; flex: 0 0 48px; height: 48px; border: 1px solid var(--cyan); border-radius: 10px; color: var(--cyan); font-size: 25px; }
.correction-panel { margin: 20px 0; padding: 25px; border: 1px solid rgba(242,184,0,.35); border-radius: 13px; background: rgba(242,184,0,.06); text-align: left; }
.correction-panel h2 { margin-top: 0; }
.correction-panel p { color: var(--muted); line-height: 1.6; }
.correction-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 0; border-top: 1px solid rgba(242,184,0,.18); }
.correction-actions { display: flex; gap: 7px; }
.correction-actions button { padding: 8px 11px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel); color: var(--ink); cursor: pointer; font-size: 12px; font-weight: 700; }
.lesson-finish { display: flex; gap: 19px; align-items: center; margin-top: 31px; padding: 27px; border: 1px solid var(--line); border-radius: 13px; background: linear-gradient(135deg, #111a29, #0c121e); text-align: left; }
.lesson-finish h2 { margin: 0 0 7px; color: var(--ink); }
.lesson-finish p { margin-bottom: 0; color: var(--muted); font-size: 14px; }
.lesson-finish .eyebrow { color: var(--cyan); }
.finish-mark { font-size: 37px; color: var(--cyan); }

footer { max-width: 1120px; margin: 0 auto; padding: 24px 28px 36px; border-top: 1px solid #1d2533; display: flex; justify-content: space-between; gap: 20px; color: #626875; font-size: 10px; letter-spacing: .07em; text-transform: uppercase; }

@keyframes rise { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: translateY(0); } }
@keyframes nudge { 0%, 25%, 100% { transform: translateX(0); } 55%, 70% { transform: translateX(16px); } }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(105,184,218,.2); } 50% { box-shadow: 0 0 0 11px rgba(105,184,218,0); } }

@media (max-width: 760px) {
  .site-header { min-height: 86px; align-items: flex-start; padding: 18px 20px; }
  .brand-mark { width: 24px; height: 41px; }
  .brand strong { font-size: 18px; }
  .progress { max-width: 145px; flex-wrap: wrap; justify-content: flex-end; }
  #progress-label { width: 100%; margin: 2px 0 0; text-align: right; }
  main { padding: 43px 20px 75px; }
  .hero { grid-template-columns: 1fr; margin-bottom: 43px; }
  .time-pill { justify-self: start; }
  .message-grid, .saved-summary, .result-grid { grid-template-columns: 1fr; }
  .how-panel { grid-template-columns: 1fr; }
  .review-heading { align-items: flex-start; flex-direction: column; }
  .action-row { flex-direction: column-reverse; }
  .action-row button { width: 100%; }
  .learning-card, .explanation-card { align-items: flex-start; }
  .result-route { align-items: flex-start; flex-direction: column; }
  footer { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}
