/* =========================================================
   Feed Lab · Grade 7 "Shape the Feed" (v2)
   Look: lab-notebook paper, ink outlines, hard offset shadows,
   tangerine / teal / sunflower. Pretend app inside: "Swirl".
   ========================================================= */

:root {
  --paper: #FFF7EA;
  --paper-2: #FBEBD2;
  --card: #FFFFFF;
  --ink: #1E1A2B;
  --ink-2: #4A4458;
  --muted: #6E6779;
  --line: #1E1A2B;

  --tang: #FF6A3D;
  --tang-d: #E0501F;
  --tang-soft: #FFE1D4;
  --teal: #11A39C;
  --teal-d: #0B7C76;
  --teal-soft: #D2F1EE;
  --sun: #FFC93C;
  --sun-soft: #FFF1C7;
  --sky: #3D7BE8;
  --sky-soft: #DCE7FC;
  --rose: #E5487A;
  --rose-soft: #FCDDE7;

  --ok: #0B7C76;
  --no: #C2410C;

  --r-lg: 22px;
  --r-md: 14px;
  --r-sm: 10px;
  --shadow: 5px 5px 0 var(--ink);
  --shadow-sm: 3px 3px 0 var(--ink);

  --f-head: "Bricolage Grotesque", "Trebuchet MS", system-ui, sans-serif;
  --f-body: "Atkinson Hyperlegible", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--f-body);
  font-size: 17px;
  line-height: 1.5;
  color: var(--ink);
  background-color: var(--paper);
  background-image: radial-gradient(rgba(30, 26, 43, .09) 1.2px, transparent 1.4px);
  background-size: 22px 22px;
  padding-bottom: 84px;
  min-height: 100vh;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--sky); outline-offset: 3px; }
h1, h2, h3 { font-family: var(--f-head); line-height: 1.15; margin: 0; }
p { margin: 0; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: #fff; padding: 8px 12px; border-radius: 8px; z-index: 50; }
.skip:focus { left: 8px; }
.noscript { padding: 24px; text-align: center; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Top bar ---------- */
.lab-top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 20px;
  background: var(--paper);
  border-bottom: 2.5px solid var(--ink);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 40px; height: 40px; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font-family: var(--f-head); font-weight: 800; font-size: 22px; letter-spacing: -.01em; }
.brand-sub { font-size: 13px; color: var(--muted); font-weight: 700; }
.top-actions { display: flex; gap: 8px; }
.pill-btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 2px solid var(--ink); background: var(--card); border-radius: 999px;
  padding: 6px 14px; font-weight: 700; font-size: 14px; box-shadow: 2px 2px 0 var(--ink);
}
.pill-btn:hover { background: var(--sun-soft); }
.pill-btn:active { transform: translate(2px, 2px); box-shadow: none; }
.pill-btn[aria-pressed="true"] { background: var(--sun); }

/* ---------- Station track ---------- */
.track {
  display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; overflow-x: auto;
  padding: 10px 20px; background: var(--paper-2); border-bottom: 2.5px solid var(--ink);
  scrollbar-width: none;
}
.track::-webkit-scrollbar { display: none; }
.station {
  display: flex; align-items: center; gap: 8px; flex: none;
  border: 2px solid var(--ink); border-radius: 999px; background: var(--card);
  padding: 4px 12px 4px 4px; font-weight: 700; font-size: 14px;
}
.station[disabled] { opacity: .55; cursor: default; }
.station .num {
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  border: 2px solid var(--ink); background: var(--paper); font-size: 13px;
}
.station.done .num { background: var(--teal); color: #fff; }
.station.cur { background: var(--tang); color: #fff; box-shadow: var(--shadow-sm); }
.station.cur .num { background: #fff; color: var(--ink); }
.station .dots { display: inline-flex; gap: 3px; margin-left: 2px; }
.station .dots i { width: 7px; height: 7px; border-radius: 50%; border: 1.5px solid currentColor; opacity: .7; }
.station .dots i.on { background: currentColor; opacity: 1; }
.track-sep { flex: none; width: 18px; height: 2.5px; background: var(--ink); border-radius: 2px; opacity: .5; }

/* ---------- Stage ---------- */
#stage { max-width: 1180px; margin: 0 auto; padding: 22px 20px 12px; outline: none; }
.screen.enter { animation: rise .35s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.scr-head { margin-bottom: 16px; }
.kicker {
  display: inline-block; font-weight: 700; font-size: 13px; letter-spacing: .06em; text-transform: uppercase;
  background: var(--ink); color: var(--paper); padding: 3px 10px; border-radius: 6px; margin-bottom: 8px;
}
.scr-head h1 { font-size: clamp(26px, 3.2vw, 38px); font-weight: 800; letter-spacing: -.015em; }
.scr-head h1:focus { outline: none; }
.scr-head .sub { margin-top: 6px; font-size: 18px; color: var(--ink-2); max-width: 70ch; }


/* ---------- Layout helpers ---------- */
.split { display: grid; grid-template-columns: 318px minmax(0, 1fr); gap: 28px; align-items: start; }
.split.wide-left { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.col-phone { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.col-notes { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.cap { font-size: 14px; color: var(--muted); text-align: center; max-width: 300px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.mt { margin-top: 12px; }
.center { text-align: center; }

/* ---------- Cards ---------- */
.card {
  background: var(--card); border: 2.5px solid var(--ink); border-radius: var(--r-lg);
  box-shadow: var(--shadow); padding: 18px 20px;
}
.card h2 { font-size: 21px; font-weight: 800; margin-bottom: 10px; }
.card h3 { font-size: 17px; font-weight: 800; margin-bottom: 6px; }
.card.tint-tang { background: var(--tang-soft); }
.card.tint-teal { background: var(--teal-soft); }
.card.tint-sun { background: var(--sun-soft); }
.card.tint-sky { background: var(--sky-soft); }
.card.tint-rose { background: var(--rose-soft); }
.card.ink { background: var(--ink); color: var(--paper); }
.card.flat { box-shadow: none; }
.q-num { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--tang-d); margin-bottom: 4px; }
.lead { font-size: 18px; }
.small { font-size: 14px; color: var(--muted); }
.big-quote { font-family: var(--f-head); font-weight: 800; font-size: clamp(22px, 2.6vw, 30px); line-height: 1.2; }

.def {
  border: 2.5px solid var(--ink); border-radius: var(--r-md); padding: 14px 16px; background: var(--paper);
  position: relative;
}
.def .term {
  position: absolute; top: -14px; left: 14px; background: var(--tang); color: #fff; border: 2px solid var(--ink);
  border-radius: 999px; padding: 1px 12px; font-weight: 700; font-size: 13px; letter-spacing: .05em; text-transform: uppercase;
}
.def p { margin-top: 6px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 2.5px solid var(--ink); border-radius: 14px; padding: 10px 18px;
  font-weight: 700; font-size: 16px; background: var(--card); box-shadow: var(--shadow-sm);
  transition: transform .08s, box-shadow .08s, background .15s;
}
.btn:hover { background: var(--sun-soft); }
.btn:active { transform: translate(3px, 3px); box-shadow: none; }
.btn.primary { background: var(--tang); color: #fff; }
.btn.primary:hover { background: var(--tang-d); }
.btn.teal { background: var(--teal); color: #fff; }
.btn.teal:hover { background: var(--teal-d); }
.btn.ghost { background: transparent; box-shadow: none; }
.btn.ghost:hover { background: var(--card); }
.btn.sm { padding: 6px 12px; font-size: 14px; border-radius: 10px; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }

.choices { display: flex; flex-direction: column; gap: 8px; }
.choices.inline { flex-direction: row; flex-wrap: wrap; }
.choice {
  text-align: left; border: 2px solid var(--ink); border-radius: 12px; background: var(--card);
  padding: 10px 14px; font-weight: 700; display: flex; gap: 10px; align-items: center;
}
.choice:hover { background: var(--paper); }
.choice.sel { background: var(--sky-soft); box-shadow: inset 0 0 0 2px var(--sky); }
.choice.right { background: var(--teal-soft); box-shadow: inset 0 0 0 2px var(--teal); }
.choice.wrong { background: var(--tang-soft); box-shadow: inset 0 0 0 2px var(--tang); }
.choice .mark { margin-left: auto; font-size: 18px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 2px solid var(--ink); border-radius: 999px; background: var(--card);
  padding: 6px 14px; font-weight: 700; font-size: 15px;
}
.chip:hover { background: var(--paper); }
.chip.sel { background: var(--sky); color: #fff; }
.chip.sel.yes { background: var(--teal); }
.chip.sel.nope { background: var(--tang); }

.fb { margin-top: 10px; padding: 10px 14px; border-radius: 12px; border: 2px solid var(--ink); font-size: 16px; animation: pop .25s ease both; }
.fb.good { background: var(--teal-soft); }
.fb.bad { background: var(--tang-soft); }
.fb.neutral { background: var(--sun-soft); }
@keyframes pop { from { transform: scale(.96); opacity: 0; } to { transform: none; opacity: 1; } }
.shake { animation: shake .4s ease; }
@keyframes shake { 0%,100% { transform: none; } 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(4px); } }

/* ---------- Swirl phone ---------- */
.phone {
  width: 300px; max-width: 100%;
  border: 9px solid var(--ink); border-radius: 38px; background: #FFFDF8;
  box-shadow: 8px 8px 0 rgba(30, 26, 43, .25);
  overflow: hidden; position: relative;
}
.phone-speaker { width: 70px; height: 6px; border-radius: 6px; background: var(--ink); margin: 6px auto 2px; opacity: .85; }
.swirl-top { display: flex; align-items: center; gap: 7px; padding: 6px 14px 4px; }
.swirl-top svg { width: 26px; height: 26px; }
.swirl-top b { font-family: var(--f-head); font-weight: 800; font-size: 20px; letter-spacing: -.02em; }
.swirl-for { margin-left: auto; font-size: 12px; font-weight: 700; background: var(--ink); color: #fff; border-radius: 999px; padding: 2px 9px; }
.swirl-tabs { display: flex; gap: 14px; padding: 2px 14px 6px; font-size: 12.5px; font-weight: 700; color: var(--muted); border-bottom: 1.5px solid #EADFCC; }
.swirl-tabs .on { color: var(--ink); border-bottom: 3px solid var(--tang); padding-bottom: 2px; }
.swirl-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 9px; }
.vcard {
  position: relative; display: flex; flex-direction: column; text-align: left;
  border: 2px solid var(--ink); border-radius: 12px; background: #fff; padding: 0; overflow: hidden; min-width: 0;
}
button.vcard:hover { transform: translateY(-2px); box-shadow: 0 3px 0 var(--ink); }
button.vcard:active { transform: none; box-shadow: none; }
.vthumb {
  position: relative; aspect-ratio: 16 / 9.5; background: var(--tc, #ddd);
  display: grid; place-items: center; border-bottom: 2px solid var(--ink);
  background-image: radial-gradient(circle at 25% 20%, rgba(255,255,255,.55) 0 18%, transparent 19%), radial-gradient(circle at 85% 90%, rgba(255,255,255,.3) 0 22%, transparent 23%);
}
.vemoji { font-size: 34px; line-height: 1; filter: drop-shadow(0 2px 0 rgba(0,0,0,.15)); }
.ve2 { position: absolute; left: 6px; top: 5px; font-size: 15px; background: #fff; border: 1.5px solid var(--ink); border-radius: 999px; padding: 0 4px; line-height: 1.35; }
.vdur { position: absolute; right: 5px; bottom: 5px; font-size: 10.5px; font-weight: 700; background: rgba(30,26,43,.85); color: #fff; border-radius: 5px; padding: 0 5px; }
.vtxt { padding: 5px 7px 7px; }
.vtitle { font-size: 12.5px; font-weight: 700; line-height: 1.22; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.44em; }
.vwho { font-size: 11px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vcard.pop { animation: cardIn .45s cubic-bezier(.2, 1.4, .4, 1) both; }
@keyframes cardIn { from { transform: scale(.7) rotate(-3deg); opacity: 0; } to { transform: none; opacity: 1; } }
.vwatch { position: absolute; inset: 0; background: rgba(30,26,43,.78); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 14px; z-index: 2; }
.vwatch i { position: absolute; left: 10px; right: 10px; bottom: 10px; height: 5px; background: rgba(255,255,255,.3); border-radius: 4px; overflow: hidden; }
.vwatch i::after { content: ""; position: absolute; inset: 0; background: var(--tang); transform-origin: left; animation: fill .65s linear both; }
@keyframes fill { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.vcard.marked { box-shadow: 0 0 0 3px var(--sun), 0 0 0 5px var(--ink); }
.vbadge { position: absolute; top: 4px; right: 4px; z-index: 2; background: var(--sun); border: 1.5px solid var(--ink); border-radius: 999px; font-size: 11px; font-weight: 700; padding: 0 6px; }
.vacts { display: flex; border-top: 2px solid var(--ink); }
.vacts button { flex: 1; border: 0; background: #fff; font-size: 10.5px; font-weight: 700; padding: 5px 1px; white-space: nowrap; }
.vacts button + button { flex: 1.45; }
.vacts button + button { border-left: 2px solid var(--ink); }
.vacts button:hover:not([disabled]) { background: var(--sun-soft); }
.vacts button[disabled] { opacity: .4; cursor: not-allowed; }
.phone-foot { padding: 0 10px 10px; }

/* mini feed (emoji tiles) */
.mini { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.mini i {
  font-style: normal; width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center;
  border: 2px solid var(--ink); background: var(--tc, #eee); font-size: 19px;
}
.mini.sm i { width: 28px; height: 28px; font-size: 16px; border-radius: 7px; }
.mini.lg i { width: 44px; height: 44px; font-size: 24px; border-radius: 11px; }
.mini i.diff { box-shadow: 0 0 0 2px var(--sun); }

/* film strip */
.film { list-style: none; margin: 0; padding: 12px; background: var(--ink); border-radius: var(--r-md); display: flex; flex-direction: column; gap: 6px; position: relative; }
.film::before, .film::after {
  content: ""; position: absolute; top: 8px; bottom: 8px; width: 6px;
  background-image: linear-gradient(var(--paper) 0 8px, transparent 8px 16px); background-size: 6px 16px; opacity: .55;
}
.film::before { left: 4px; } .film::after { right: 4px; }
.frame { display: flex; align-items: center; gap: 10px; background: #2E2940; border-radius: 9px; padding: 6px 10px; color: var(--paper); margin: 0 8px; }
.frame .flabel { font-size: 13px; font-weight: 700; min-width: 92px; }
.frame.newest { background: #3E3757; animation: slideIn .4s ease both; }
@keyframes slideIn { from { transform: translateX(-14px); opacity: 0; } to { transform: none; opacity: 1; } }
.film-title { font-family: var(--f-head); font-weight: 800; font-size: 16px; margin-bottom: 6px; display: flex; gap: 8px; align-items: center; }

/* pips */
.pips { display: flex; gap: 8px; align-items: center; }
.pips span { width: 34px; height: 34px; border-radius: 50%; border: 2.5px solid var(--ink); display: grid; place-items: center; font-weight: 800; background: var(--card); font-size: 16px; }
.pips span.on { background: var(--teal); color: #fff; }
.pips span.cur { background: var(--sun); }

/* share bars */
.bars { display: flex; flex-direction: column; gap: 6px; }
.bar { display: grid; grid-template-columns: 30px 1fr 52px; gap: 8px; align-items: center; font-size: 14px; font-weight: 700; }
.bar .track-b { height: 16px; border: 2px solid var(--ink); border-radius: 999px; background: #fff; overflow: hidden; }
.bar .fill { height: 100%; background: var(--tc, var(--tang)); transition: width .5s ease; border-right: 2px solid var(--ink); }
.bar .fill.zero { border-right: 0; }

/* ---------- Sort (rule vs prediction) ---------- */
.contrast { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: stretch; }
.contrast .vs { align-self: center; font-family: var(--f-head); font-weight: 800; font-size: 20px; }
.sort-list { display: flex; flex-direction: column; gap: 10px; }
.sort-item { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; border: 2px solid var(--ink); border-radius: 14px; padding: 10px 12px; background: #fff; }
.sort-item .em { font-size: 26px; }
.sort-item .btns { display: flex; gap: 6px; }
.sort-item.done-rule { background: var(--sun-soft); }
.sort-item.done-pred { background: var(--teal-soft); }
.sort-item .res { font-size: 14px; color: var(--ink-2); grid-column: 2 / 4; }
.tag { display: inline-block; border: 2px solid var(--ink); border-radius: 8px; padding: 1px 8px; font-weight: 700; font-size: 13px; }
.tag.rule { background: var(--sun); }
.tag.pred { background: var(--teal); color: #fff; }

/* ---------- Hidden AI hunt phone ---------- */
.home { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 10px; background: linear-gradient(180deg, #FFE9D9, #E3F4F2); }
.hs {
  position: relative; border: 2px solid var(--ink); border-radius: 14px; background: #fff; padding: 8px 9px;
  text-align: left; font-size: 12.5px; line-height: 1.3; min-height: 64px;
}
.hs:hover { background: #FFFBEF; }
.hs.span2 { grid-column: span 2; }
.hs .hl { font-weight: 700; display: block; font-size: 12px; color: var(--muted); }
.hs .hv { font-weight: 700; font-size: 14px; }
.hs .sugg { display: block; margin-top: 4px; font-size: 11.5px; color: var(--ink-2); }
.hs .kb { display: flex; gap: 4px; margin-top: 5px; }
.hs .kb span { flex: 1; text-align: center; background: #EFE8DB; border-radius: 6px; font-size: 11.5px; padding: 2px 0; font-weight: 700; }
.hs.found-ai { background: var(--teal-soft); }
.hs.found-rule { background: var(--sun-soft); }
.stamp {
  position: absolute; right: -6px; top: -9px; z-index: 2; border: 2px solid var(--ink); border-radius: 8px; padding: 0 6px;
  font-size: 11px; font-weight: 800; transform: rotate(6deg); animation: pop .25s ease both;
}
.stamp.ai { background: var(--teal); color: #fff; }
.stamp.rule { background: var(--sun); }
.counter { display: flex; gap: 12px; flex-wrap: wrap; }
.counter .cbox { border: 2.5px solid var(--ink); border-radius: 14px; padding: 8px 14px; background: #fff; font-weight: 700; }
.counter .cbox b { font-family: var(--f-head); font-size: 26px; margin-right: 4px; }

/* ---------- Evidence meter ---------- */
.evidence { display: flex; gap: 8px; align-items: center; }
.evidence span { width: 46px; height: 46px; border-radius: 12px; border: 2.5px dashed var(--ink); display: grid; place-items: center; font-size: 24px; background: #fff; }
.evidence span.on { border-style: solid; background: var(--tang-soft); animation: pop .3s ease both; }
.ev-label { font-weight: 700; }

/* ---------- Ring (loops) ---------- */
.ring { position: relative; width: 100%; max-width: 460px; aspect-ratio: 1; margin: 0 auto; }
.ring-svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.ring-svg .orbit { fill: none; stroke: var(--ink); stroke-width: .7; stroke-dasharray: 2 2; opacity: .5; }
.ring-svg .arrow { fill: #CFC6B6; stroke: var(--ink); stroke-width: .4; transition: fill .3s; }
.ring-svg .arrow.on { fill: var(--tang); }
.rnode {
  position: absolute; transform: translate(-50%, -50%); width: 36%;
  border: 2.5px solid var(--ink); border-radius: 16px; background: #fff; padding: 8px 10px;
  text-align: center; font-weight: 700; font-size: 14.5px; line-height: 1.25; opacity: .45; transition: opacity .3s, background .3s;
}
.rnode .rnum { display: block; font-family: var(--f-head); font-size: 12px; color: var(--muted); }
.rnode .rex { display: block; font-weight: 400; font-size: 12.5px; color: var(--ink-2); margin-top: 3px; }
.rnode.lit { opacity: 1; box-shadow: var(--shadow-sm); }
.rnode.cur { background: var(--sun); animation: pop .3s ease both; }
.ring.complete .rnode { background: var(--teal-soft); }
.ring-center {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  font-family: var(--f-head); font-weight: 800; font-size: 15px; text-align: center; width: 26%; line-height: 1.2;
}
.ring-center .spin { display: block; font-size: 34px; }
.ring.complete .ring-center .spin { animation: spin 3s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Players (part 2) ---------- */
.players { display: flex; flex-direction: column; gap: 12px; }
.player { display: grid; grid-template-columns: 70px 1fr minmax(180px, 230px); gap: 12px; align-items: center; border: 2.5px solid var(--ink); border-radius: 16px; background: #fff; padding: 10px 12px; }
.player .who { font-family: var(--f-head); font-weight: 800; font-size: 18px; }
.player select { width: 100%; border: 2px solid var(--ink); border-radius: 10px; padding: 7px 8px; background: var(--paper); font-weight: 700; font-size: 15px; }
.player.ok { background: var(--teal-soft); }
.player.miss { background: var(--tang-soft); }
.seq { font-size: 18px; letter-spacing: 2px; }

/* timer */
.timer { display: flex; align-items: center; gap: 16px; }
.timer svg { width: 92px; height: 92px; flex: none; }
.timer .tbg { fill: none; stroke: #EADFCC; stroke-width: 9; }
.timer .tfg { fill: none; stroke: var(--tang); stroke-width: 9; stroke-linecap: round; transform: rotate(-90deg); transform-origin: 50% 50%; transition: stroke-dashoffset 1s linear; }
.timer .tval { font-family: var(--f-head); font-weight: 800; font-size: 34px; }
.banner {
  font-family: var(--f-head); font-weight: 800; font-size: clamp(18px, 2.4vw, 26px); text-transform: uppercase; letter-spacing: .02em;
  background: var(--tang); color: #fff; border: 2.5px solid var(--ink); border-radius: var(--r-lg); padding: 12px 18px; box-shadow: var(--shadow); text-align: center;
}
.checks { display: flex; flex-direction: column; gap: 8px; }
.check { display: flex; gap: 10px; align-items: center; border: 2px solid var(--ink); border-radius: 12px; padding: 8px 12px; background: #fff; font-weight: 700; text-align: left; }
.check .box { width: 24px; height: 24px; border: 2px solid var(--ink); border-radius: 6px; display: grid; place-items: center; flex: none; background: #fff; }
.check.on { background: var(--teal-soft); }
.check.on .box { background: var(--teal); color: #fff; }

/* pause */
.pause {
  display: flex; gap: 12px; align-items: center; border: 2.5px solid var(--ink); border-radius: var(--r-lg);
  background: repeating-linear-gradient(-45deg, var(--sun) 0 14px, #FFD970 14px 28px); padding: 12px 16px; font-weight: 800; font-family: var(--f-head); font-size: 20px;
}
.pause .pi { width: 42px; height: 42px; border-radius: 50%; background: var(--ink); color: var(--sun); display: grid; place-items: center; font-size: 20px; flex: none; }
.vsbox { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.vsbox > div { border: 2px solid var(--ink); border-radius: 14px; padding: 10px 12px; background: #fff; }
.vsbox .x { text-decoration: line-through; text-decoration-thickness: 2px; opacity: .7; }

/* ---------- Locker ---------- */
.locker-wrap { display: flex; justify-content: center; }
.locker { position: relative; width: 300px; max-width: 100%; height: 440px; border: 3px solid var(--ink); border-radius: 12px; background: #3C5A8A; box-shadow: var(--shadow); perspective: 1200px; }
.locker-in { position: absolute; inset: 10px; background: #26344F; border-radius: 6px; padding: 10px; display: grid; grid-template-columns: 1fr 1fr; grid-auto-rows: 1fr; gap: 8px; }
.litem { border: 2px solid var(--ink); border-radius: 10px; background: #FFF7EA; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 4px; text-align: center; font-size: 12.5px; font-weight: 700; line-height: 1.15; }
.litem .le { font-size: 28px; }
.litem.seen { background: var(--sun-soft); }
.litem.seen.zero { background: var(--tang-soft); }
.litem .lc { font-size: 11px; font-weight: 700; background: var(--ink); color: #fff; border-radius: 999px; padding: 0 6px; }
.litem.wide { grid-column: span 2; }
.locker-door {
  position: absolute; inset: 0; border: 0; border-radius: 9px; transform-origin: left center;
  background:
    repeating-linear-gradient(180deg, transparent 0 9px, rgba(0,0,0,.28) 9px 13px) 50% 34px / 55% 64px no-repeat,
    repeating-linear-gradient(180deg, transparent 0 9px, rgba(0,0,0,.28) 9px 13px) 50% 342px / 55% 64px no-repeat,
    linear-gradient(135deg, #5B82C2, #3F6AAE);
  transition: transform .8s cubic-bezier(.3, .9, .3, 1); z-index: 3; color: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; font-weight: 800;
}
.locker-door .tagname { background: #fff; color: var(--ink); border: 2px solid var(--ink); border-radius: 6px; padding: 2px 12px; font-family: var(--f-head); letter-spacing: .1em; }
.locker-door .handle { position: absolute; right: 18px; top: 50%; width: 12px; height: 54px; background: #C9D3E3; border: 2px solid var(--ink); border-radius: 6px; transform: translateY(-50%); }
.locker-door .open-hint { background: var(--sun); color: var(--ink); border: 2px solid var(--ink); border-radius: 999px; padding: 4px 12px; font-size: 14px; animation: bob 1.4s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-4px); } }
.locker.open .locker-door { transform: rotateY(-108deg); pointer-events: none; }
.compare2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.compare2 > div { border: 2px solid var(--ink); border-radius: 14px; padding: 10px 12px; background: #fff; }
.compare2 h3 { font-size: 15px; }

/* ---------- Build the loop ---------- */
.pool { display: flex; flex-wrap: wrap; gap: 10px; }
.pool .piece { border: 2.5px solid var(--ink); border-radius: 14px; background: var(--card); padding: 10px 14px; font-weight: 700; box-shadow: var(--shadow-sm); }
.pool .piece:hover { background: var(--sun-soft); }
.pool .piece.used { visibility: hidden; }

/* ---------- Wheel ---------- */
.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mode { border: 2.5px solid var(--ink); border-radius: 16px; background: #fff; padding: 12px; text-align: left; box-shadow: var(--shadow-sm); }
.mode b { display: block; font-family: var(--f-head); font-size: 17px; }
.mode span { font-size: 14px; color: var(--ink-2); }
.mode.sel { background: var(--sun); }
.searchbar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.searchbar .slabel { font-weight: 700; font-size: 14px; margin-right: 2px; }
.sbtn { border: 2px solid var(--ink); border-radius: 10px; background: #fff; padding: 3px 9px; font-size: 18px; }
.sbtn:hover:not([disabled]) { background: var(--sun-soft); }
.sbtn[disabled] { opacity: .4; cursor: not-allowed; }
.deltas { display: flex; flex-wrap: wrap; gap: 8px; }
.delta { border: 2px solid var(--ink); border-radius: 10px; padding: 3px 10px; font-weight: 700; background: #fff; }
.delta.up { background: var(--teal-soft); }
.delta.down { background: var(--tang-soft); }

/* ---------- Taylor ---------- */
.not-game { display: inline-flex; gap: 8px; align-items: center; background: var(--sky); color: #fff; border: 2.5px solid var(--ink); border-radius: 999px; padding: 4px 14px; font-weight: 800; font-size: 14px; letter-spacing: .04em; text-transform: uppercase; }
.days { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.day { border: 2.5px solid var(--ink); border-radius: 16px; background: #fff; overflow: hidden; }
.day h3 { background: var(--ink); color: var(--paper); font-size: 15px; padding: 6px 12px; margin: 0; }
.day ol { list-style: none; margin: 0; padding: 8px; display: flex; flex-direction: column; gap: 5px; }
.day li { display: flex; gap: 8px; align-items: center; font-size: 13.5px; border-radius: 8px; padding: 4px 6px; background: #F4EFE6; }
.day li .art { width: 26px; height: 26px; border-radius: 6px; display: grid; place-items: center; border: 1.5px solid var(--ink); flex: none; font-size: 14px; background: #fff; }
.day li.star { background: var(--sky-soft); }
.day li.sim { background: #E9F3FF; }
.day li .who2 { display: block; font-size: 11.5px; color: var(--muted); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 14px; }
.legend span { display: inline-flex; gap: 6px; align-items: center; }
.legend i { width: 14px; height: 14px; border-radius: 4px; border: 1.5px solid var(--ink); display: inline-block; }

/* SPOT → THINK → NOTICE → CHOOSE step bar: always one row of four, never wraps */
.tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 14px; }
.tab {
  display: flex; align-items: center; justify-content: center; gap: 6px; min-width: 0;
  border: 2.5px solid var(--ink); border-radius: 14px; background: var(--card);
  padding: 9px 6px; font-family: var(--f-head); font-weight: 800; font-size: 16px; box-shadow: var(--shadow-sm);
}
.tab:hover { background: var(--sun-soft); }
.tab .tn { width: 24px; height: 24px; flex: none; border-radius: 50%; border: 2px solid var(--ink); display: grid; place-items: center; font-size: 12px; background: var(--paper); }
.tab.done .tn { background: var(--teal); color: #fff; }
.tab.on { background: var(--tang); color: #fff; }
.tab.on .tn { background: #fff; color: var(--ink); }
.tabpanel { border: 2.5px solid var(--ink); border-radius: var(--r-lg); background: #fff; padding: 18px; box-shadow: var(--shadow); min-width: 0; }
.routine-q { font-family: var(--f-head); font-weight: 800; font-size: 20px; margin-bottom: 10px; }
.routine-q .w { color: var(--tang-d); }
.tunewell { width: 300px; max-width: 100%; border: 9px solid var(--ink); border-radius: 34px; background: #FBFAFF; overflow: hidden; box-shadow: 8px 8px 0 rgba(30,26,43,.25); }
.tw-top { display: flex; align-items: center; gap: 6px; padding: 10px 14px 6px; font-family: var(--f-head); font-weight: 800; font-size: 18px; }
.tw-body { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; padding: 6px 10px 12px; }
.tw-body .hs { min-height: 0; }
.tw-body .stamp { right: 4px; top: -9px; transform: rotate(3deg); }
.opt-list { display: flex; flex-direction: column; gap: 8px; }

/* ---------- Closure ---------- */
.loop4 { display: flex; flex-direction: column; align-items: stretch; gap: 0; max-width: 560px; }
.loop4 .ln { border: 2.5px solid var(--ink); border-radius: 14px; background: #fff; padding: 10px 14px; font-weight: 700; font-size: 18px; box-shadow: var(--shadow-sm); animation: rise .45s ease both; }
.loop4 .ar { text-align: center; font-size: 22px; line-height: 1.3; font-weight: 800; animation: rise .45s ease both; }
.loop4 .ln.back { background: var(--teal-soft); }
.myth-card { border: 2.5px solid var(--ink); border-radius: var(--r-lg); background: #fff; box-shadow: var(--shadow); padding: 22px; max-width: 640px; }
.myth-card .stmt { font-family: var(--f-head); font-weight: 800; font-size: clamp(20px, 2.4vw, 26px); margin: 6px 0 16px; }
.mf-btns { display: flex; gap: 12px; }
.mf-btns .btn { flex: 1; font-size: 18px; padding: 12px; }
.mdots { display: flex; gap: 6px; margin-bottom: 8px; }
.mdots i { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--ink); background: #fff; }
.mdots i.ok { background: var(--teal); }
.mdots i.cur { background: var(--sun); }
/* Routine cards: one normal box per card (no stacked 3D faces), so text can never collapse */
.flips { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; align-items: stretch; }
.flip {
  display: flex; flex-direction: column; gap: 8px; text-align: left; min-height: 190px; min-width: 0;
  border: 2.5px solid var(--ink); border-radius: var(--r-lg); padding: 16px; box-shadow: var(--shadow-sm);
  background: #fff; font-size: 16px; line-height: 1.35;
}
.flip:nth-child(1) { background: var(--tang-soft); }
.flip:nth-child(2) { background: var(--sun-soft); }
.flip:nth-child(3) { background: var(--sky-soft); }
.flip:nth-child(4) { background: var(--rose-soft); }
.flip.on { background: var(--teal-soft); }
.flip-w { font-family: var(--f-head); font-weight: 800; font-size: 24px; line-height: 1.1; }
.flip-tag { font-weight: 700; font-size: 12.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--teal-d); }
.flip-hint { margin-top: auto; font-size: 13px; color: var(--muted); }
.flip:hover { border-color: var(--tang-d); }

.finale { background: var(--ink); color: var(--paper); border: 2.5px solid var(--ink); border-radius: var(--r-lg); padding: 24px 22px 20px; text-align: center; box-shadow: 6px 6px 0 var(--tang); }
.fin-big { font-family: var(--f-head); font-weight: 800; font-size: clamp(30px, 4.4vw, 52px); line-height: 1.08; letter-spacing: -.02em; }
.fin-big .p { color: var(--sun); }
.fin-big .d { color: #7FE0D7; white-space: nowrap; }
.fin-recap { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 18px; }
.fin-recap > div { background: #2E2940; border-radius: 14px; padding: 10px 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; }
.fr-l { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: #CFC6E0; }
.fr-v { font-family: var(--f-head); font-weight: 800; font-size: 22px; line-height: 1.2; }
.finale .mini i { border-color: var(--paper); }
.exit-card { margin-top: 22px; }
.think-list { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }
.think { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 12px; align-items: start; border: 2px solid var(--ink); border-radius: 16px; padding: 12px 14px; background: var(--paper); }
.think.on { background: var(--teal-soft); }
.think-body { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; min-width: 0; }
.ff-n { width: 32px; height: 32px; border-radius: 50%; border: 2.5px solid var(--ink); background: var(--sun); display: grid; place-items: center; font-family: var(--f-head); font-weight: 800; }
.ff-t { font-weight: 700; font-size: 17px; padding-top: 3px; }
.think-ex { font-size: 16px; }
.think-tag { display: block; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--teal-d); margin-bottom: 2px; }
.think .btn { white-space: normal; text-align: left; }

/* ---------- Footer / nav ---------- */
.lab-foot { max-width: 1180px; margin: 6px auto 0; padding: 0 20px 18px; }
.model-note { font-size: 13.5px; color: var(--ink-2); border-top: 2px dashed rgba(30,26,43,.3); padding-top: 10px; }
.navbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 10px 20px; background: var(--paper); border-top: 2.5px solid var(--ink);
}
.nav-mid { display: flex; flex-direction: column; align-items: center; font-weight: 700; font-size: 14px; text-align: center; min-width: 0; flex: 1; }
.nav-hint { font-weight: 400; color: var(--muted); font-size: 13px; line-height: 1.25; }
.navbar .btn { min-width: 112px; flex: none; white-space: nowrap; }

.modal { position: fixed; inset: 0; background: rgba(30,26,43,.55); display: grid; place-items: center; z-index: 60; padding: 16px; }
.modal[hidden] { display: none; }
.modal-card { background: var(--paper); border: 2.5px solid var(--ink); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 22px; max-width: 420px; }
.modal-card h2 { font-size: 24px; margin-bottom: 8px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }
.toast { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 12px; font-weight: 700; z-index: 40; display: flex; gap: 12px; align-items: center; box-shadow: 4px 4px 0 var(--tang); max-width: calc(100% - 32px); }
.toast[hidden] { display: none; }
.toast button { background: var(--paper); color: var(--ink); border: 0; border-radius: 8px; padding: 3px 10px; font-weight: 700; }

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .flips { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 860px) {
  .split, .split.wide-left { grid-template-columns: minmax(0, 1fr); }
  .col-phone { min-width: 0; }
  .grid3, .days { grid-template-columns: 1fr; }
  .player { grid-template-columns: 60px 1fr; }
  .player select { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  #stage { padding: 16px 16px 8px; }
  .lab-top, .track, .navbar { padding-left: 16px; padding-right: 16px; }
  .brand-sub { display: none; }
  .pill-btn .lbl { display: none; }
  .station .lbl, .station .dots { display: none; }
  .station.cur .lbl { display: inline; }
  .grid2, .contrast, .modes, .compare2, .vsbox { grid-template-columns: 1fr; }
  .contrast .vs { justify-self: center; }
  .sort-item { grid-template-columns: 30px 1fr; }
  .sort-item .btns { grid-column: 1 / -1; }
  .ring { aspect-ratio: auto; display: flex; flex-direction: column; gap: 8px; }
  .ring-svg { display: none; }
  .rnode { position: static; transform: none; width: 100%; }
  .ring-center { position: static; transform: none; width: 100%; }
  .flips { grid-template-columns: 1fr; }
  .navbar .btn { min-width: 0; padding: 10px 12px; font-size: 15px; }
  .navbar { gap: 8px; }
  .nav-hint { font-size: 12px; }
  .tabs { gap: 5px; }
  .tab { flex-direction: column; gap: 2px; padding: 7px 2px; font-size: 13px; }
  .tabpanel { padding: 14px; }
  .routine-q { font-size: 18px; }
  .frame .flabel { min-width: 70px; }
  .mf-btns { flex-direction: column; }
  .fin-recap { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- Teacher view (teacher/index.html) ---------- */
.t-badge {
  display: inline-flex; align-items: center; gap: 6px; background: var(--sun); border: 2px solid var(--ink);
  border-radius: 999px; padding: 5px 12px; font-weight: 800; font-size: 14px;
}
.ts-toggle { display: none; }
.t-layout { display: grid; grid-template-columns: 272px minmax(0, 1fr); align-items: start; }
.t-main { min-width: 0; }
.tside {
  position: sticky; top: 0; max-height: calc(100vh - 66px); overflow-y: auto;
  display: flex; flex-direction: column; gap: 3px;
  background: var(--paper-2); border-right: 2.5px solid var(--ink); padding: 12px 10px 16px;
}
.ts-head { display: flex; flex-direction: column; padding: 4px 8px 8px; border-bottom: 2px dashed rgba(30,26,43,.3); margin-bottom: 4px; }
.ts-head b { font-family: var(--f-head); font-size: 17px; }
.ts-head span { font-size: 13px; color: var(--ink-2); }
.ts-group { font-family: var(--f-head); font-weight: 800; font-size: 12.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); margin: 10px 8px 2px; }
.ts-item {
  display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 9px; align-items: center; text-align: left;
  border: 2px solid transparent; border-radius: 12px; background: transparent; padding: 6px 8px; font-size: 14px;
}
.ts-item:hover { background: var(--card); border-color: var(--ink); }
.ts-item.cur { background: var(--tang); color: #fff; border-color: var(--ink); box-shadow: var(--shadow-sm); }
.ts-n { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--ink); display: grid; place-items: center; font-size: 12px; font-weight: 800; background: var(--card); color: var(--ink); }
.ts-item.done .ts-n { background: var(--teal); color: #fff; }
.ts-t { font-weight: 700; line-height: 1.2; }
.ts-t small { display: block; font-weight: 400; font-size: 12px; opacity: .85; margin-top: 1px; }
.ts-exit { margin-top: 14px; padding: 8px; font-weight: 700; font-size: 14px; color: var(--ink); }
.gate { z-index: 80; background: rgba(30,26,43,.75); }
.gate .modal-card { width: min(400px, 100%); }
.gate-label { display: block; font-weight: 700; margin-top: 14px; }
.gate-input { width: 100%; margin-top: 6px; border: 2.5px solid var(--ink); border-radius: 12px; padding: 10px 12px; font-size: 18px; background: #fff; }
.gate-err { margin-top: 8px; color: var(--no); font-weight: 700; }
.gate .modal-actions a.btn { text-decoration: none; color: var(--ink); }
@media (max-width: 900px) {
  .ts-toggle { display: inline-flex; margin-right: 4px; }
  .t-layout { grid-template-columns: 1fr; }
  .tside {
    position: fixed; left: 0; top: 0; bottom: 0; max-height: none; width: min(300px, 86vw); z-index: 55;
    transform: translateX(-105%); transition: transform .25s ease; box-shadow: 6px 0 0 rgba(30,26,43,.2);
  }
  body.ts-open .tside { transform: none; }
}
