/* ============================================================
   AWAKENING — shared design tokens & components
   Used by index.html, teacher.html, student.html
   ============================================================ */

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --ink: #0A0A0C;
  --ink-deep: #050507;
  --panel: #101015;
  --panel2: #15151B;
  --bone: #EDEAE0;
  --ash: #8B8780;
  --faint: #4A4845;
  --ember: #FF5722;
  --ember-glow: rgba(255,87,34,0.45);
  --phosphor: #4ADE80;
  --amber: #FBBF24;
  --azure: #38BDF8;
  --hairline: rgba(237,234,224,0.08);
  --hairline-strong: rgba(237,234,224,0.16);
}

html, body {
  min-height: 100%;
  background: var(--ink-deep);
  color: var(--bone);
  font-family: '"Noto Sans TC"', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}
body {
  background: radial-gradient(ellipse at center, #0A0A0F 0%, #050507 90%);
  min-height: 100vh;
}

/* ───────── Type utility ───────── */
.display    { font-family: '"Noto Sans TC"', sans-serif; font-weight: 900; letter-spacing: -0.01em; line-height: 1; }
.en-display { font-family: '"Big Shoulders Display"', '"Noto Sans TC"', Impact, sans-serif; font-weight: 900; letter-spacing: 0.02em; }
.mono       { font-family: '"JetBrains Mono"', monospace; }

.glow-ember { text-shadow: 0 0 24px rgba(255,87,34,0.55), 0 0 60px rgba(255,87,34,0.25); }
.glow-bone  { text-shadow: 0 0 18px rgba(237,234,224,0.35); }

/* ───────── Frame (outer container) ───────── */
.frame {
  background: var(--ink);
  border: 1px solid var(--hairline);
  box-shadow:
    0 30px 120px -20px rgba(0,0,0,0.9),
    0 0 0 1px rgba(237,234,224,0.04);
  position: relative;
  overflow: hidden;
  background-image:
    radial-gradient(ellipse 70% 50% at 80% 10%, rgba(255,87,34,0.06), transparent 60%),
    radial-gradient(ellipse 50% 40% at 10% 95%, rgba(74,222,128,0.04), transparent 60%),
    linear-gradient(rgba(237,234,224,0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(237,234,224,0.045) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 64px 64px, 64px 64px;
}
.frame::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(to bottom, transparent 0px, rgba(237,234,224,0.018) 1px, transparent 2px, transparent 3px);
  background-size: 100% 3px;
  mix-blend-mode: overlay;
  z-index: 1;
}
.frame > * { position: relative; z-index: 2; }

/* ───────── Titlebar / Statusbar ───────── */
.titlebar {
  height: 40px;
  border-bottom: 1px solid var(--hairline);
  background: rgba(16,16,21,0.5);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  font-family: '"JetBrains Mono"', monospace;
  font-size: 11px;
  letter-spacing: 0.22em;
  color: var(--ash);
  z-index: 5;
}
.dots { display: flex; gap: 6px; }
.dot { width: 10px; height: 10px; border-radius: 50%; }
.dot-r { background: rgba(255,87,34,0.8); }
.dot-y { background: rgba(251,191,36,0.6); }
.dot-g { background: rgba(74,222,128,0.7); }
.path .em { color: var(--ember); }
.path .dim { color: rgba(237,234,224,0.3); }

.statusbar {
  height: 32px;
  border-top: 1px solid var(--hairline);
  background: rgba(16,16,21,0.5);
  backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px;
  font-family: '"JetBrains Mono"', monospace;
  font-size: 10px; letter-spacing: 0.22em;
  color: var(--ash);
  z-index: 5;
}

/* ───────── Boot log ───────── */
.bootlog {
  font-family: '"JetBrains Mono"', monospace;
  font-size: clamp(11px, 1vw, 13px);
  line-height: 2;
  color: rgba(237,234,224,0.55);
  letter-spacing: 0.04em;
}
.bootlog .ok  { color: var(--phosphor); }
.bootlog .em  { color: var(--ember); }
.bootlog .dim { color: rgba(237,234,224,0.3); }

/* ───────── Pulse / Blink ───────── */
.pulse {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--phosphor); box-shadow: 0 0 10px rgba(74,222,128,0.7);
  animation: pulse 1.6s ease-in-out infinite;
  margin-right: 6px; vertical-align: middle;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.5; transform: scale(0.8); }
}
.blink::after {
  content: '▍'; display: inline-block; margin-left: 4px;
  color: var(--ember);
  animation: blink 1.05s steps(1) infinite;
  text-shadow: 0 0 12px var(--ember-glow);
}
@keyframes blink { 50% { opacity: 0; } }

/* ───────── Tag (badge) ───────── */
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; border: 1px solid; font-size: 10px;
  font-family: '"JetBrains Mono"', monospace;
  letter-spacing: 0.2em; text-transform: uppercase;
  white-space: nowrap;
}
.tag.ember    { border-color: rgba(255,87,34,0.5); color: var(--ember); background: rgba(255,87,34,0.1); }
.tag.phosphor { border-color: rgba(74,222,128,0.4); color: var(--phosphor); background: rgba(74,222,128,0.1); }
.tag.amber    { border-color: rgba(251,191,36,0.4); color: var(--amber); background: rgba(251,191,36,0.1); }
.tag.bone     { border-color: rgba(237,234,224,0.2); color: rgba(237,234,224,0.7); background: rgba(237,234,224,0.05); }

/* ───────── Corner brackets (decorative) ───────── */
.brackets { position: relative; }
.brackets::before, .brackets::after {
  content: ''; position: absolute; width: 14px; height: 14px;
  border: 1px solid var(--ember);
}
.brackets::before { top: -1px; left: -1px; border-right: 0; border-bottom: 0; }
.brackets::after  { bottom: -1px; right: -1px; border-left: 0; border-top: 0; }

/* ───────── Hero block (used by handouts) ───────── */
.hero {
  padding: clamp(40px, 5vw, 72px) clamp(28px, 5vw, 80px);
  border-bottom: 1px solid var(--hairline);
  position: relative;
  overflow: hidden;
}
.hero h1 {
  font-family: '"Noto Sans TC"', sans-serif;
  font-weight: 900;
  letter-spacing: -0.01em;
  line-height: 0.98;
  font-size: clamp(40px, 5vw, 84px);
  color: var(--bone);
  margin-top: clamp(20px, 2.5vw, 32px);
}
.hero h1 .em { color: var(--ember); text-shadow: 0 0 24px rgba(255,87,34,0.55), 0 0 60px rgba(255,87,34,0.25); }
.hero .role-tag {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px;
  border: 1px solid;
  font-family: '"JetBrains Mono"', monospace;
  font-size: 11px; letter-spacing: 0.22em;
  margin-top: clamp(20px, 3vw, 36px);
}
.hero .role-tag.coach   { color: var(--ember); border-color: rgba(255,87,34,0.5); background: rgba(255,87,34,0.06); }
.hero .role-tag.student { color: var(--phosphor); border-color: rgba(74,222,128,0.4); background: rgba(74,222,128,0.06); }
.hero .meta {
  margin-top: clamp(20px, 3vw, 32px);
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  font-family: '"JetBrains Mono"', monospace;
  font-size: 10px; letter-spacing: 0.22em;
  color: rgba(237,234,224,0.55);
}
.hero .meta .label { color: rgba(237,234,224,0.35); display: block; margin-bottom: 4px; }
.hero .meta .value { color: var(--bone); font-size: 13px; }
.hero .meta .value.em { color: var(--ember); }

/* ───────── Sticky stage nav ───────── */
.stage-nav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(10,10,12,0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--hairline);
  padding: 14px clamp(28px, 5vw, 80px);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-family: '"JetBrains Mono"', monospace;
  font-size: 11px;
  letter-spacing: 0.18em;
}
.stage-nav .label { color: rgba(237,234,224,0.4); margin-right: 8px; }
.stage-nav a {
  color: rgba(237,234,224,0.55);
  text-decoration: none;
  padding: 4px 10px;
  border: 1px solid transparent;
  transition: all 0.18s ease;
}
.stage-nav a:hover {
  color: var(--ember);
  border-color: rgba(255,87,34,0.4);
  background: rgba(255,87,34,0.06);
}

/* ───────── Stages ───────── */
.stages { padding: clamp(40px, 5vw, 72px) clamp(28px, 5vw, 80px); }
.stage {
  border: 1px solid var(--hairline);
  background: rgba(16,16,21,0.55);
  margin-bottom: clamp(28px, 4vw, 48px);
  position: relative;
}
.stage::before, .stage::after {
  content: ''; position: absolute; width: 16px; height: 16px;
  border: 1px solid var(--ember);
}
.stage::before { top: -1px; left: -1px; border-right: 0; border-bottom: 0; }
.stage::after  { bottom: -1px; right: -1px; border-left: 0; border-top: 0; }

.stage-head {
  padding: clamp(24px, 3vw, 36px) clamp(24px, 3vw, 36px) clamp(16px, 2vw, 24px);
  border-bottom: 1px solid var(--hairline);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: end;
}
.stage-head .marker {
  font-family: '"JetBrains Mono"', monospace;
  font-size: 11px;
  letter-spacing: 0.22em;
  color: var(--ember);
  margin-bottom: 6px;
}
.stage-head h2 {
  font-family: '"Noto Sans TC"', sans-serif;
  font-weight: 900;
  font-size: clamp(28px, 3.5vw, 48px);
  line-height: 1.1;
  letter-spacing: -0.01em;
  color: var(--bone);
}
.stage-head h2 .en {
  color: var(--ember);
  margin-left: 12px;
  font-family: '"Big Shoulders Display"', sans-serif;
  font-weight: 900;
  letter-spacing: 0.04em;
  font-size: 0.7em;
}
.stage-head .stage-tag {
  font-family: '"Noto Sans TC"', sans-serif;
  color: rgba(237,234,224,0.6);
  font-size: 14px;
  margin-top: 8px;
}
.stage-head .meta {
  display: flex; flex-direction: column; align-items: flex-end; gap: 6px;
}

.stage-body {
  padding: clamp(24px, 3vw, 36px);
  display: grid;
  gap: clamp(20px, 2.5vw, 32px);
}

/* ───────── Block (sub-section in stage) ───────── */
.block {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: clamp(16px, 2vw, 28px);
  align-items: start;
}
.block .label {
  font-family: '"JetBrains Mono"', monospace;
  font-size: 10px;
  letter-spacing: 0.22em;
  color: var(--ember);
  padding-top: 4px;
}
.block .label.muted { color: rgba(237,234,224,0.5); }
.block .label.amber { color: var(--amber); }
.block .label.phosphor { color: var(--phosphor); }
.block .label.azure { color: var(--azure); }
.block .body {
  font-family: '"Noto Sans TC"', sans-serif;
  font-size: clamp(14px, 1.15vw, 16px);
  line-height: 1.75;
  color: rgba(237,234,224,0.85);
}
.block .body strong { color: var(--bone); font-weight: 700; }
.block .body em { color: var(--ember); font-style: normal; font-weight: 500; }
/* Inside callouts: callout already supplies its own theme via border + head color,
   so em in callout body should be italic emphasis only — not a second orange that
   competes with action prompts / copy buttons. */
.block .body .callout em {
  color: inherit;
  font-style: italic;
  font-weight: 500;
  opacity: 0.92;
}

/* ───────── Prompt code block ───────── */
.prompt {
  position: relative;
  display: block;
  background: rgba(5,5,7,0.65);
  border: 1px solid var(--hairline);
  border-left: 3px solid var(--ember);
  padding: 16px 56px 16px 18px;
  font-family: '"JetBrains Mono"', monospace;
  font-size: clamp(13px, 1.05vw, 15px);
  line-height: 1.7;
  color: var(--bone);
  white-space: pre-wrap;
  margin: 8px 0;
}
.prompt::before {
  content: '$ ';
  color: var(--ember);
  font-weight: 600;
  margin-right: 4px;
}
.prompt.no-prefix::before { content: ''; margin-right: 0; }
.prompt .copy {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(255,87,34,0.1);
  border: 1px solid rgba(255,87,34,0.3);
  color: var(--ember);
  font-family: '"JetBrains Mono"', monospace;
  font-size: 9px;
  letter-spacing: 0.2em;
  padding: 4px 8px;
  cursor: pointer;
  transition: all 0.18s ease;
}
.prompt .copy:hover { background: rgba(255,87,34,0.2); border-color: var(--ember); }
.prompt .copy.copied { color: var(--phosphor); border-color: var(--phosphor); background: rgba(74,222,128,0.1); }

/* inline copyable folder/identifier name */
.folder-name {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 3px 6px 3px 10px;
  background: rgba(255,87,34,0.08);
  border: 1px solid rgba(255,87,34,0.3);
  border-left: 2px solid var(--ember);
  color: var(--bone);
  font-family: '"JetBrains Mono"', monospace;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.04em;
  white-space: nowrap;
  vertical-align: middle;
}
.folder-name .copy {
  background: rgba(255,87,34,0.12);
  border: 1px solid rgba(255,87,34,0.4);
  color: var(--ember);
  font-family: '"JetBrains Mono"', monospace;
  font-size: 9px;
  letter-spacing: 0.2em;
  padding: 2px 6px;
  cursor: pointer;
  transition: all 0.18s ease;
}
.folder-name .copy:hover { background: rgba(255,87,34,0.22); border-color: var(--ember); }
.folder-name .copy.copied { color: var(--phosphor); border-color: var(--phosphor); background: rgba(74,222,128,0.1); }

/* ───────── Callout boxes ───────── */
.callout {
  border-left: 3px solid;
  padding: 16px 20px;
  background: rgba(16,16,21,0.6);
  font-family: '"Noto Sans TC"', sans-serif;
  line-height: 1.7;
}
/* muted = neutral hint / methodology — orange is reserved for action prompts */
.callout.muted    { border-color: rgba(237,234,224,0.28); background: rgba(237,234,224,0.025); }
.callout.amber    { border-color: var(--amber); background: rgba(251,191,36,0.05); }
.callout.phosphor { border-color: var(--phosphor); background: rgba(74,222,128,0.05); }
.callout.azure    { border-color: var(--azure); background: rgba(56,189,248,0.05); }
.callout .head {
  font-family: '"JetBrains Mono"', monospace;
  font-size: 10px;
  letter-spacing: 0.22em;
  margin-bottom: 8px;
  display: flex; align-items: center; gap: 8px;
}
.callout.muted    .head { color: rgba(237,234,224,0.55); }
.callout.amber    .head { color: var(--amber); }
.callout.phosphor .head { color: var(--phosphor); }
.callout.azure    .head { color: var(--azure); }
.callout .body {
  font-size: clamp(13px, 1.1vw, 16px);
  color: rgba(237,234,224,0.85);
}

/* ───────── Checkpoints ───────── */
.checkpoint {
  display: flex;
  gap: 14px;
  padding: 12px 16px;
  background: rgba(74,222,128,0.04);
  border: 1px solid rgba(74,222,128,0.2);
  font-family: '"Noto Sans TC"', sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: rgba(237,234,224,0.85);
  align-items: flex-start;
}
.checkpoint .icon {
  flex-shrink: 0;
  width: 22px; height: 22px;
  border: 1.5px solid var(--phosphor);
  color: var(--phosphor);
  display: inline-flex; align-items: center; justify-content: center;
  font-family: '"JetBrains Mono"', monospace;
  font-size: 11px;
  font-weight: 700;
  margin-top: 1px;
  background: transparent;
  transition: all 0.18s ease;
}

/* interactive (student handout) */
.checkpoint.todo {
  cursor: pointer;
  user-select: none;
  transition: background 0.18s ease, border-color 0.18s ease, opacity 0.25s ease;
  position: relative;
}
.checkpoint.todo:hover {
  background: rgba(74,222,128,0.09);
  border-color: rgba(74,222,128,0.5);
}
.checkpoint.todo:hover .icon {
  border-color: var(--phosphor);
  box-shadow: 0 0 8px rgba(74,222,128,0.4);
}
.checkpoint.todo .icon {
  color: transparent;
  background: transparent;
}
.checkpoint.todo.done {
  opacity: 0.55;
  background: rgba(74,222,128,0.12);
  border-color: rgba(74,222,128,0.45);
}
.checkpoint.todo.done .icon {
  background: var(--phosphor);
  border-color: var(--phosphor);
  color: var(--ink);
  box-shadow: 0 0 14px rgba(74,222,128,0.55);
}
.checkpoint.todo.done .icon::before {
  content: '✓';
  font-weight: 800;
}
.checkpoint.todo.done > span:not(.icon) {
  text-decoration: line-through;
  text-decoration-color: rgba(74,222,128,0.45);
  text-decoration-thickness: 1.5px;
}

/* progress pill (auto-injected per stage) */
.progress-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border: 1px solid rgba(237,234,224,0.2);
  background: rgba(237,234,224,0.05);
  color: rgba(237,234,224,0.7);
  font-family: '"JetBrains Mono"', monospace;
  font-size: 11px;
  letter-spacing: 0.16em;
  white-space: nowrap;
  transition: all 0.25s ease;
}
.progress-pill.partial {
  border-color: rgba(251,191,36,0.5);
  color: var(--amber);
  background: rgba(251,191,36,0.1);
}
.progress-pill.complete {
  border-color: var(--phosphor);
  color: var(--phosphor);
  background: rgba(74,222,128,0.12);
  box-shadow: 0 0 12px rgba(74,222,128,0.25);
}

/* tool open link (per-stage first action) */
.tool-link {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px 12px 14px;
  background: rgba(255,87,34,0.08);
  border: 1px solid rgba(255,87,34,0.4);
  border-left: 3px solid var(--ember);
  color: var(--bone);
  text-decoration: none;
  font-family: '"JetBrains Mono"', monospace;
  font-size: 13px;
  letter-spacing: 0.04em;
  transition: all 0.2s ease;
  position: relative;
}
.tool-link:hover {
  background: rgba(255,87,34,0.16);
  border-color: var(--ember);
  transform: translateX(2px);
  box-shadow: 0 4px 24px rgba(255,87,34,0.2);
}
.tool-link .arrow {
  display: inline-flex;
  align-items: center; justify-content: center;
  width: 24px; height: 24px;
  background: var(--ember);
  color: var(--ink);
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}
.tool-link .name {
  font-weight: 700;
  color: var(--bone);
  font-size: 15px;
  letter-spacing: 0.01em;
}
.tool-link .url {
  color: rgba(237,234,224,0.5);
  font-size: 11px;
  letter-spacing: 0.06em;
}
.tool-link .ext {
  margin-left: 6px;
  color: var(--ember);
  font-size: 12px;
}

/* tip note */
.tip-note {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 8px 12px;
  border: 1px dashed rgba(74,222,128,0.4);
  background: rgba(74,222,128,0.05);
  font-family: '"JetBrains Mono"', monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--phosphor);
}

/* reset button */
.reset-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid rgba(237,234,224,0.2);
  background: transparent;
  color: rgba(237,234,224,0.55);
  font-family: '"JetBrains Mono"', monospace;
  font-size: 10px;
  letter-spacing: 0.18em;
  cursor: pointer;
  transition: all 0.18s ease;
}
.reset-btn:hover {
  color: var(--ember);
  border-color: rgba(255,87,34,0.5);
  background: rgba(255,87,34,0.06);
}

/* ───────── Footer ───────── */
.foot {
  padding: clamp(28px, 4vw, 48px) clamp(28px, 5vw, 80px);
  border-top: 1px solid var(--hairline);
  display: flex; justify-content: space-between; align-items: center;
  font-family: '"JetBrains Mono"', monospace;
  font-size: 10px; letter-spacing: 0.22em;
  color: rgba(237,234,224,0.5);
  flex-wrap: wrap; gap: 16px;
}
.foot a { color: var(--ember); text-decoration: none; }
.foot a:hover { text-decoration: underline; }

/* ───────── Responsive ───────── */
@media (max-width: 720px) {
  .stage-head { grid-template-columns: 1fr; }
  .stage-head .meta { flex-direction: row; align-items: center; }
  .block { grid-template-columns: 1fr; gap: 8px; }
  .block .label { padding-top: 0; }
}
