/* Indent — design direction C: light, soft, rounded, Apple-style press */

:root {
  --bg: #F6F7FB;
  --card: #FFFFFF;
  --ink: #1A1C26;
  --ink-2: #3F4454;
  --muted: #6B6F82;
  --faint: #9AA0B2;
  --line: #E8EAF2;
  --line-2: #F0F2F7;

  --mint: #A8DBC6;
  --mint-deep: #2E7D5B;
  --mint-soft: #E2F1E9;
  --lilac: #DCD8F2;
  --lilac-deep: #574CA8;
  --lilac-soft: #EEECF9;
  --amber: #FBE8D4;
  --amber-deep: #B8763A;
  --amber-soft: #FBF6EC;
  --amber-ink: #6B5637;
  --blue: #DDEEF7;
  --blue-deep: #3A7EA1;
  --rose: #F6DFD8;
  --rose-deep: #B0523A;

  --r-card: 22px;
  --r-btn: 14px;
  --r-soft: 16px;
  --ease: cubic-bezier(.22, 1, .36, 1);

  --shadow-1: 0 1px 2px rgba(26,28,38,.05), 0 6px 20px rgba(26,28,38,.05);
  --shadow-2: 0 4px 8px rgba(26,28,38,.06), 0 18px 40px rgba(26,28,38,.1);

  --sans: "Manrope", -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--lilac-deep); text-decoration: none; }
a:hover { color: #453B8F; }

.mono { font-family: var(--mono); }
.hidden { display: none !important; }

/* ---------- layout ---------- */

.shell { max-width: 1180px; margin: 0 auto; padding: 0 24px 64px; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px 0; gap: 24px;
}
.brand {
  display: flex; align-items: center; gap: 9px;
  font-size: 19px; font-weight: 700; letter-spacing: -.02em;
  color: var(--ink); cursor: pointer; background: none; border: 0; font-family: inherit;
}
.brand-mark {
  width: 26px; height: 26px; border-radius: 9px; background: var(--mint);
  display: flex; align-items: center; justify-content: center;
}
.topnav { display: flex; gap: 6px; }
.topnav button {
  border: 0; background: none; font-family: inherit; font-size: 14.5px; font-weight: 600;
  color: var(--muted); cursor: pointer; padding: 8px 14px; border-radius: 11px;
  transition: color .16s ease, background-color .18s ease;
}
.topnav button:hover { color: var(--ink); background: rgba(26,28,38,.04); }
.topnav button[aria-current="page"] { color: var(--ink); background: var(--lilac-soft); }

.xp-pill {
  display: flex; align-items: center; gap: 8px; background: var(--card);
  border-radius: 999px; padding: 9px 16px; font-size: 13.5px; font-weight: 700;
  box-shadow: 0 1px 2px rgba(26,28,38,.05); font-variant-numeric: tabular-nums;
}
.avatar {
  width: 36px; height: 36px; border-radius: 999px; background: var(--lilac);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: var(--lilac-deep);
}

/* ---------- type ---------- */

h1.page-title { font-size: 34px; font-weight: 800; letter-spacing: -.03em; margin: 0 0 6px; }
.page-sub { font-size: 16px; color: var(--muted); margin: 0; }
.eyebrow {
  font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--faint); font-weight: 700;
}
.prose { font-size: 16px; line-height: 1.65; color: var(--ink-2); text-wrap: pretty; margin: 0; }
.prose + .prose { margin-top: 14px; }
.prose code, .inline-code {
  font-family: var(--mono); font-size: .86em; background: var(--bg);
  padding: 2px 6px; border-radius: 6px; color: var(--ink-2);
}
.prose strong { font-weight: 700; color: var(--ink); }

/* ---------- cards ---------- */

.card {
  background: var(--card); border-radius: var(--r-card); box-shadow: var(--shadow-1);
  padding: 26px 30px;
}
.card-tap {
  cursor: pointer; text-align: left; border: 0; font-family: inherit; width: 100%;
  transition: transform .28s var(--ease), box-shadow .28s var(--ease);
}
.card-tap:hover { transform: translateY(-3px); box-shadow: var(--shadow-2); }
.card-tap:active { transform: scale(.99); transition-duration: .09s; }

/* ---------- buttons ---------- */

.btn {
  border: 0; cursor: pointer; font-family: inherit; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  height: 48px; padding: 0 26px; border-radius: var(--r-btn); font-size: 15.5px;
  letter-spacing: -.008em;
  transition: transform .26s var(--ease), box-shadow .26s var(--ease), background-color .18s ease;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: scale(.955); transition-duration: .08s; }
.btn:focus-visible { outline: 2.5px solid var(--lilac-deep); outline-offset: 3px; }

.btn-primary { background: var(--ink); color: #fff; box-shadow: 0 2px 4px rgba(26,28,38,.16), 0 8px 22px rgba(26,28,38,.18); }
.btn-primary:hover { background: #262936; box-shadow: 0 4px 8px rgba(26,28,38,.14), 0 16px 34px rgba(26,28,38,.22); }
.btn-primary:active { box-shadow: 0 1px 3px rgba(26,28,38,.2); }

.btn-mint { background: var(--mint); color: var(--ink); box-shadow: 0 2px 4px rgba(46,125,91,.16), 0 8px 20px rgba(46,125,91,.18); }
.btn-mint:hover { background: #9BD3BC; box-shadow: 0 4px 8px rgba(46,125,91,.16), 0 14px 30px rgba(46,125,91,.22); }

.btn-soft { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px rgba(26,28,38,.06), 0 4px 12px rgba(26,28,38,.05); }
.btn-soft:hover { box-shadow: 0 3px 6px rgba(26,28,38,.07), 0 12px 28px rgba(26,28,38,.09); }

.btn-sm { height: 40px; padding: 0 18px; font-size: 14px; border-radius: 13px; }

.btn:disabled, .btn-off {
  background: #EDEFF5; color: #A8AEBE; cursor: default; box-shadow: none;
}
.btn:disabled:hover, .btn-off:hover { transform: none; box-shadow: none; }
.btn:disabled:active, .btn-off:active { transform: none; }

.iconbtn {
  width: 40px; height: 40px; border-radius: 12px; background: var(--card); border: 0;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 1px 2px rgba(26,28,38,.06); flex-shrink: 0;
  transition: transform .24s var(--ease), box-shadow .24s var(--ease);
}
.iconbtn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(26,28,38,.1); }
.iconbtn:active { transform: scale(.94); transition-duration: .08s; }

/* ---------- path ---------- */

.part { margin-top: 26px; }
.part-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.track { display: flex; align-items: flex-start; }
.track-seg { display: flex; align-items: flex-start; }
.track-line { flex-grow: 1; height: 4px; border-radius: 999px; margin-top: 25px; background: var(--line); min-width: 18px; }
.track-line.done { background: var(--mint); }
.node-cell {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  width: 128px; flex-shrink: 0; border: 0; background: none; cursor: pointer;
  font-family: inherit; padding: 0;
}
.node {
  width: 54px; height: 54px; border-radius: 999px; display: flex;
  align-items: center; justify-content: center; flex-shrink: 0;
  transition: transform .24s var(--ease), box-shadow .24s var(--ease), width .2s var(--ease), height .2s var(--ease);
}
.node-cell:hover .node { transform: scale(1.07); }
.node-cell:active .node { transform: scale(.97); transition-duration: .08s; }
.node.done { background: var(--mint); }
.node.next { background: var(--lilac); }
.node.locked { background: #EDEFF5; }
.node.sel { width: 62px; height: 62px; margin-top: -4px; }
.node.sel.done { box-shadow: 0 0 0 6px var(--mint-soft); }
.node.sel.next { box-shadow: 0 0 0 6px var(--lilac-soft); }
.node.sel.locked { box-shadow: 0 0 0 6px #F0F2F7; }
.node-label { font-size: 13px; text-align: center; line-height: 1.35; font-weight: 600; color: var(--ink); }
.node-label.locked { color: var(--faint); }
.node-label.sel { font-weight: 700; }

.next-card { display: flex; align-items: center; gap: 30px; margin-top: 20px; }
.code-preview {
  width: 320px; flex-shrink: 0; background: var(--bg); border-radius: var(--r-soft);
  padding: 20px; font-family: var(--mono); font-size: 12.5px; line-height: 1.9; color: var(--ink-2);
  white-space: pre; overflow-x: auto;
}

.tiles { display: flex; gap: 20px; margin-top: 20px; }
.tile { flex: 1 1 0; padding: 24px 26px; }
.tile-icon {
  width: 38px; height: 38px; border-radius: 12px; display: flex;
  align-items: center; justify-content: center; margin-bottom: 14px;
}
.tile h3 { margin: 0 0 6px; font-size: 16.5px; font-weight: 700; letter-spacing: -.014em; }
.tile p { margin: 0; font-size: 14px; line-height: 1.5; color: var(--muted); }

/* ---------- lesson ---------- */

.lesson-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 0; gap: 20px; }
.lesson-head-left { display: flex; align-items: center; gap: 16px; min-width: 0; }
.lesson-title { font-size: 16px; font-weight: 700; letter-spacing: -.02em; margin-top: 2px; }
.pips { display: flex; align-items: center; gap: 7px; }
.pip { width: 26px; height: 6px; border-radius: 999px; background: var(--line); transition: background-color .2s ease, width .2s var(--ease); }
.pip.done { background: var(--mint); }
.pip.now { background: var(--lilac-deep); width: 34px; }

.lesson-body { display: flex; flex-direction: column; gap: 20px; max-width: 780px; margin: 0 auto; }
.note {
  background: var(--amber-soft); border-radius: var(--r-soft); padding: 16px 18px;
  font-size: 14.5px; line-height: 1.55; color: var(--amber-ink);
}
.note strong { font-weight: 700; }

/* ---------- code blocks & editor ---------- */

.codeblock {
  background: var(--bg); border-radius: var(--r-soft); padding: 18px 20px;
  font-family: var(--mono); font-size: 13.5px; line-height: 1.85; color: var(--ink-2);
  overflow-x: auto; white-space: pre; tab-size: 4;
}
.code-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 12px; }
.filechip {
  font-family: var(--mono); font-size: 12.5px; color: var(--muted);
  background: var(--bg); padding: 6px 12px; border-radius: 9px;
}

.editor { position: relative; background: var(--bg); border-radius: var(--r-soft); }
.editor-view,
.editor textarea {
  margin: 0; padding: 18px 20px; border: 0; tab-size: 4;
  font-family: var(--mono); font-size: 13.5px; line-height: 1.85;
  white-space: pre; overflow-wrap: normal; word-break: normal;
}
.editor-view {
  position: absolute; inset: 0; overflow: hidden; pointer-events: none;
  color: var(--ink-2); border-radius: var(--r-soft);
}
.editor textarea {
  position: relative; display: block; width: 100%; resize: vertical; outline: 0;
  background: transparent; color: transparent; caret-color: var(--lilac-deep);
  overflow: auto; border-radius: var(--r-soft);
}
.editor textarea::selection { background: rgba(87, 76, 168, .22); }
.editor:focus-within { box-shadow: inset 0 0 0 2px var(--lilac); border-radius: var(--r-soft); }

.console {
  background: var(--bg); border-radius: var(--r-soft); padding: 16px 20px;
  font-family: var(--mono); font-size: 13px; line-height: 1.8; color: var(--ink-2);
  white-space: pre-wrap; word-break: break-word; min-height: 56px;
}
.console.empty { color: var(--faint); font-family: var(--sans); font-size: 13.5px; }
.console .err { color: var(--rose-deep); }

.tests { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.test-row { display: flex; align-items: center; gap: 11px; font-size: 13px; }
.test-dot { width: 9px; height: 9px; border-radius: 999px; flex-shrink: 0; background: var(--line); }
.test-dot.pass { background: var(--mint-deep); }
.test-dot.fail { background: var(--rose-deep); }
.test-name { font-family: var(--mono); font-size: 12.5px; color: var(--ink-2); }
.test-got { margin-left: auto; font-family: var(--mono); font-size: 12px; color: var(--faint); }

/* ---------- exercises ---------- */

.slot {
  min-height: 68px; background: var(--bg); border-radius: var(--r-soft);
  padding: 12px 16px; display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  transition: box-shadow .24s var(--ease);
}
.slot.right { box-shadow: inset 0 0 0 2px var(--mint); }
.slot.wrong { box-shadow: inset 0 0 0 2px var(--amber); }
.slot-hint { font-size: 14px; color: #A8AEBE; }
.bank { display: flex; flex-wrap: wrap; gap: 10px; }

.chip {
  border: 0; font-family: var(--mono); font-size: 13.5px; height: 44px;
  padding: 0 16px; border-radius: 13px; cursor: pointer;
  transition: transform .24s var(--ease), box-shadow .24s var(--ease), opacity .2s ease;
}
.chip:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(26,28,38,.12); }
.chip:active { transform: scale(.94); transition-duration: .07s; }
.chip:disabled { opacity: .35; cursor: default; }
.chip:disabled:hover { transform: none; box-shadow: none; }
.chip-kw { background: var(--lilac); color: #453B8F; }
.chip-expr { background: var(--amber); color: #8A5A26; }
.chip-var { background: var(--line-2); color: var(--ink-2); }

.options { display: flex; flex-direction: column; gap: 10px; }
.option {
  display: flex; align-items: center; gap: 14px; padding: 16px 18px; border: 0;
  background: var(--bg); border-radius: var(--r-soft); cursor: pointer; width: 100%;
  font-family: var(--mono); font-size: 13.5px; color: var(--ink-2); text-align: left;
  transition: transform .24s var(--ease), box-shadow .24s var(--ease), background-color .18s ease;
}
.option:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(26,28,38,.09); }
.option:active { transform: scale(.985); transition-duration: .08s; }
.option[data-state="right"] { background: var(--mint-soft); box-shadow: inset 0 0 0 2px var(--mint); }
.option[data-state="wrong"] { background: var(--amber-soft); box-shadow: inset 0 0 0 2px var(--amber); }
.option-key {
  width: 26px; height: 26px; border-radius: 8px; background: var(--card); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--sans); font-size: 12px; font-weight: 700; color: var(--muted);
}

.feedback { border-radius: var(--r-card); padding: 24px 28px; display: flex; align-items: flex-start; gap: 18px; }
.feedback.right { background: var(--mint-soft); }
.feedback.wrong { background: var(--amber-soft); }
.feedback-mark {
  width: 42px; height: 42px; border-radius: 999px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.feedback.right .feedback-mark { background: var(--mint); }
.feedback.wrong .feedback-mark { background: #F3E2C7; }
.feedback h3 { margin: 0 0 8px; font-size: 18px; font-weight: 700; letter-spacing: -.018em; }
.feedback p { margin: 0; font-size: 14.5px; line-height: 1.55; text-wrap: pretty; }
.feedback.right, .feedback.right p { color: #3F5A4E; }
.feedback.right h3 { color: var(--ink); }
.feedback.wrong, .feedback.wrong p { color: var(--amber-ink); }

.xp-tag { font-size: 13.5px; font-weight: 700; color: var(--mint-deep); }

/* ---------- misc ---------- */

.banner {
  display: flex; align-items: center; gap: 12px; background: var(--lilac-soft);
  border-radius: var(--r-soft); padding: 14px 18px; font-size: 14px; color: #453B8F;
}
.spinner {
  width: 16px; height: 16px; border-radius: 999px; flex-shrink: 0;
  border: 2.5px solid rgba(87,76,168,.25); border-top-color: var(--lilac-deep);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty-state { text-align: center; padding: 60px 20px; color: var(--faint); }

.footer-nav { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.footer-nav .spacer { flex-grow: 1; }

.tabbar { display: none; }

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* ---------- phone ---------- */

@media (max-width: 760px) {
  .shell { padding: 0 16px 100px; }
  .topbar { padding: 16px 0 8px; }
  .topnav { display: none; }
  h1.page-title { font-size: 25px; }
  .card { padding: 20px; border-radius: 20px; }
  .next-card { flex-direction: column; align-items: stretch; gap: 18px; }
  .code-preview { width: 100%; }
  .tiles { flex-direction: column; }
  .track { flex-direction: column; align-items: stretch; }
  .track-seg { flex-direction: column; }
  .track-line { display: none; }
  .node-cell { flex-direction: row; width: 100%; gap: 14px; padding: 10px 0; }
  .node-label { text-align: left; }
  .node.sel { margin-top: 0; }
  .lesson-body { max-width: none; }
  .btn { width: 100%; }
  .footer-nav { flex-direction: column-reverse; align-items: stretch; }
  .footer-nav .spacer { display: none; }

  .tabbar {
    display: flex; gap: 4px; position: fixed; left: 0; right: 0; bottom: 0;
    background: var(--card); padding: 8px 12px calc(14px + env(safe-area-inset-bottom));
    box-shadow: 0 -1px 0 var(--line-2); z-index: 20;
  }
  .tabbar button {
    flex-grow: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 5px; height: 60px; border: 0; background: none; border-radius: 14px; cursor: pointer;
    font-family: inherit; font-size: 11px; font-weight: 700; color: #A8AEBE;
    transition: background-color .2s ease, transform .24s var(--ease);
  }
  .tabbar button:active { transform: scale(.94); transition-duration: .08s; }
  .tabbar button[aria-current="page"] { background: var(--lilac-soft); color: var(--lilac-deep); }
}

/* ---------- syntax ---------- */
.t-kw { color: var(--lilac-deep); }
.t-str { color: var(--mint-deep); }
.t-num { color: var(--mint-deep); }
.t-fn { color: var(--amber-deep); }
.t-comment { color: var(--faint); font-style: italic; }

/* ---------- run / stop ---------- */
.btn-stop { background: var(--rose); color: var(--rose-deep); box-shadow: 0 2px 4px rgba(176,82,58,.14), 0 8px 20px rgba(176,82,58,.16); }
.btn-stop:hover { background: #F2D5CC; box-shadow: 0 4px 8px rgba(176,82,58,.14), 0 14px 30px rgba(176,82,58,.2); }
.stop-square { width: 10px; height: 10px; border-radius: 2px; background: currentColor; flex-shrink: 0; }

/* ---------- review ---------- */
.tile h3 { display: flex; align-items: center; gap: 9px; }
.badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px;
  background: var(--amber-deep); color: #fff;
  font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums;
}

/* ---------- solution reveal ---------- */
.reveal {
  background: var(--lilac-soft); border-radius: var(--r-soft); padding: 18px 20px;
  display: flex; flex-direction: column; gap: 12px;
}
.reveal .codeblock { background: rgba(255, 255, 255, .7); }
