/* Iris — minimal futuristic UI ------------------------------------------------ */
:root {
  --bg: #05070e;
  --ink: #eaf1ff;
  --muted: #7e8cab;
  --line: rgba(120, 160, 255, 0.10);
  --line2: rgba(120, 170, 255, 0.22);
  --panel: rgba(255, 255, 255, 0.028);
  --accent: #4fd6ff;
  --accent2: #46e6a6;
  --warn: #ffcf6b;
  --bad: #ff7a8a;
  --grad: linear-gradient(135deg, #4fd6ff, #46e6a6);
  --r: 18px;
  --r-lg: 26px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; overscroll-behavior: none; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.6 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Inter, Roboto, sans-serif;
  letter-spacing: .1px;
  min-height: 100svh;
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
  -webkit-font-smoothing: antialiased;
}
.bg { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -2; opacity: .25; }
body::before { /* soft aurora glow */
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(60vw 40vh at 50% -8%, rgba(79, 214, 255, .12), transparent 70%),
    radial-gradient(50vw 40vh at 90% 110%, rgba(70, 230, 166, .10), transparent 70%);
}
.hidden { display: none !important; }

/* top bar — slim */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; padding-top: calc(14px + env(safe-area-inset-top));
  position: sticky; top: 0; z-index: 20;
  background: linear-gradient(180deg, rgba(5, 7, 14, .8), rgba(5, 7, 14, 0));
  backdrop-filter: blur(10px);
}
.brand { display: flex; gap: 11px; align-items: center; }
.logo { font-size: 24px; filter: drop-shadow(0 0 10px #4fd6ff66); }
.topbar h1 { font-size: 19px; margin: 0; font-weight: 600; letter-spacing: 3px;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.tag { margin: 1px 0 0; font-size: 11px; color: var(--muted); letter-spacing: .2px; }
.tag em { color: var(--accent); font-style: normal; }
.topbar-actions { display: flex; gap: 8px; align-items: center; }

main { max-width: 640px; margin: 0 auto; padding: 20px 18px; }

/* cards */
.card { border: 1px solid var(--line); border-radius: var(--r-lg); padding: 26px; margin-bottom: 16px; }
.glass { background: var(--panel); backdrop-filter: blur(16px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04), 0 24px 60px rgba(0, 0, 0, .45); }
.screen { display: none; }
.screen.active { display: block; animation: rise .35s cubic-bezier(.2, .7, .15, 1); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
h2 { margin: 0 0 14px; font-weight: 600; font-size: 24px; letter-spacing: .2px; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); } .small { font-size: 13px; } .statusline { margin-top: 10px; min-height: 18px; }
a { color: var(--accent); text-decoration: none; border-bottom: 1px solid var(--line2); }
.kicker { display: inline-block; font-size: 10.5px; letter-spacing: 3px; text-transform: uppercase;
  color: var(--accent); margin-bottom: 12px; opacity: .9; }

/* buttons — pill, minimal */
button { font: inherit; cursor: pointer; border-radius: 999px; border: 1px solid var(--line2);
  padding: 13px 22px; background: rgba(255, 255, 255, .03); color: var(--ink);
  transition: transform .12s ease, box-shadow .2s, border-color .2s, background .2s; }
button:hover { border-color: var(--accent); }
button:active { transform: scale(.97); }
button:disabled { opacity: .4; cursor: not-allowed; }
.primary { background: var(--grad); border: none; color: #04121a; font-weight: 700;
  box-shadow: 0 6px 24px rgba(79, 214, 255, .25); }
.primary:hover { box-shadow: 0 8px 32px rgba(79, 214, 255, .42); }
.secondary { background: rgba(120, 170, 255, .08); }
.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.ghost:hover { color: var(--ink); border-color: var(--line2); }
.ghost.small, .small { padding: 8px 14px; font-size: 13px; }
.big { width: 100%; padding: 17px; font-size: 17px; margin-top: 6px; }

.privacy { background: rgba(70, 230, 166, .06); border: 1px solid rgba(70, 230, 166, .22);
  color: #b9f3da; border-radius: var(--r); padding: 13px 15px; font-size: 13.5px; margin: 16px 0; }
.consent { display: flex; gap: 11px; align-items: flex-start; margin: 16px 0; font-size: 13.5px; color: var(--muted); }
.consent input { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--accent); }

/* source pick — camera primary, sim minimal */
.sourcepick { display: grid; gap: 12px; margin: 18px 0; }
.choice { display: flex; flex-direction: column; gap: 3px; align-items: flex-start; padding: 18px 20px;
  text-align: left; border-radius: var(--r); }
.choice small { color: var(--muted); font-weight: 400; font-size: 12.5px; }
.choice.active { outline: 1px solid var(--accent2); }
#useSim { background: transparent; border-style: dashed; }

/* mode badge */
.mode-badge { font-family: ui-monospace, monospace; font-size: 10.5px; font-weight: 700; letter-spacing: .5px;
  padding: 2px 9px; border-radius: 999px; border: 1px solid currentColor; }
.mode-badge.live { color: var(--accent2); } .mode-badge.sim { color: var(--warn); }
.mode-badge:empty { display: none; }

/* camera source — kept off-screen but rendering so frames keep decoding */
.cam-src { position: fixed; top: -9999px; left: -9999px; width: 160px; height: 120px; opacity: 0; pointer-events: none; }

/* floating dual-eye scope — two tight, separately-tracked eyes, unobtrusive top-right */
.eye-scope { position: fixed; z-index: 30; top: calc(12px + env(safe-area-inset-top)); right: 12px;
  display: flex; flex-direction: column; gap: 7px; padding: 8px;
  border-radius: 16px; background: rgba(7, 11, 22, .5); backdrop-filter: blur(16px);
  border: 1px solid var(--line2); box-shadow: 0 14px 44px rgba(0, 0, 0, .5);
  animation: rise .4s ease; transition: transform .3s; }
.scopes { display: flex; gap: 7px; }
.scope { width: 100px; height: 72px; display: block; border-radius: 12px; background: #000; }
.scope-readout { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 2px; }
#lockStatus { font-family: ui-monospace, monospace; font-size: 9px; letter-spacing: .6px; color: var(--accent2); }
.scope-signals { display: flex; flex-direction: column; gap: 4px; }
.bar { position: relative; height: 4px; background: rgba(255, 255, 255, .06); border-radius: 4px; overflow: hidden; }
.bar.gaze { overflow: visible; }
.bar .mid { position: absolute; left: 50%; top: -1px; bottom: -1px; width: 1px; background: var(--line2); z-index: 1; }
.dot { position: absolute; top: 50%; left: 50%; width: 7px; height: 7px; margin: -3.5px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 10px var(--accent); transition: left .07s linear; z-index: 2; }
.fill { height: 100%; width: 50%; background: var(--grad); transition: width .1s; border-radius: 4px; }
.fill.alt { background: linear-gradient(90deg, #8a7bff, #4fd6ff); }
.scope-zoom { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.scope-zoom #zoomVal { font-family: ui-monospace, monospace; font-size: 10px; color: var(--muted); }
.zbtn { width: 26px; height: 26px; padding: 0; border-radius: 8px; font-size: 16px; line-height: 1;
  display: flex; align-items: center; justify-content: center; background: rgba(120, 170, 255, .08); }
/* shrink the scope when not actively in an experiment */
body[data-screen="menu"] .eye-scope, body[data-screen="welcome"] .eye-scope { opacity: .9; }
body[data-screen="welcome"] .eye-scope { display: none; }

/* full-screen immersive stage during experiments */
.stage-back { position: fixed; top: calc(12px + env(safe-area-inset-top)); left: 12px; z-index: 35;
  width: 42px; height: 42px; padding: 0; border-radius: 50%; display: none; font-size: 17px;
  align-items: center; justify-content: center; background: rgba(7, 11, 22, .55); backdrop-filter: blur(10px); }
body[data-screen="stage"] .stage-back { display: flex; }
body[data-screen="stage"] .topbar, body[data-screen="stage"] footer { display: none; }
body[data-screen="stage"] main { max-width: none; margin: 0; padding: 0; }
body[data-screen="stage"] #stage.active {
  position: fixed; inset: 0; z-index: 25; margin: 0; border: none; border-radius: 0;
  min-height: 100svh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: clamp(20px, 5vh, 56px) 20px; gap: 6px; backdrop-filter: none;
  background: radial-gradient(80vw 70vh at 50% 26%, rgba(18, 26, 46, .55), var(--bg) 78%);
  animation: fadein .35s ease; }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
body[data-screen="stage"] #stage h2 { text-align: center; }
body[data-screen="stage"] #stage .instruction { text-align: center; }
body[data-screen="stage"] #stage .instruction,
body[data-screen="stage"] #stage .stimulus,
body[data-screen="stage"] #stage .controls,
body[data-screen="stage"] #stage .feedback { max-width: 580px; width: 100%; }
body[data-screen="stage"] .reso-stage { max-width: min(80vmin, 440px); }

/* modes */
.modes { display: grid; grid-template-columns: 1fr; gap: 12px; }
.mode { border: 1px solid var(--line); border-radius: var(--r); padding: 18px 20px; transition: border-color .2s, transform .2s; }
.mode:hover { border-color: var(--line2); }
.mode h3 { margin: 0 0 4px; font-size: 17px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.mode p { color: var(--muted); font-size: 13.5px; margin: 0 0 10px; }
.mode.flagship { border-color: var(--line2); background: linear-gradient(180deg, rgba(79, 214, 255, .05), transparent); }
.exp { font-size: 9.5px; color: var(--muted); border: 1px solid var(--line2); border-radius: 6px; padding: 1px 6px; letter-spacing: 1px; }
.exp.sota { color: var(--accent); border-color: var(--accent); }
.moderow { display: flex; gap: 8px; }
.moderow button { flex: 1; padding: 11px; }
.modestat { font-size: 11.5px; color: var(--muted); min-height: 30px; line-height: 1.5; }
.modestat .acc { color: var(--accent2); font-weight: 700; font-size: 14px; }
.menu-foot { margin-top: 14px; text-align: center; }

/* stage */
.instruction { font-size: 17px; min-height: 26px; line-height: 1.5; }
.stimulus { min-height: 250px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; margin: 14px 0; }
.controls { display: flex; gap: 10px; flex-wrap: wrap; }
.controls button { flex: 1; min-width: 130px; }
.feedback { min-height: 26px; font-size: 14.5px; color: var(--muted); }
.feedback.good { color: var(--accent2); } .feedback.bad { color: var(--bad); }

/* duel */
.duel { display: flex; gap: 22px; width: 100%; justify-content: center; }
.duelcard { flex: 1; max-width: 200px; aspect-ratio: 3 / 4; border-radius: var(--r); border: 1px solid var(--line2);
  background: rgba(255, 255, 255, .02); display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 20px; gap: 10px; transition: .25s; }
.duelcard .emoji { font-size: 50px; filter: drop-shadow(0 0 12px #4fd6ff55); }
.duelcard.hot { border-color: var(--accent2); box-shadow: 0 0 30px #46e6a644; }
.duelcard.pick { animation: breathe 2.4s infinite; }
.duelcard.guess { border-color: var(--accent); box-shadow: 0 0 40px #4fd6ff77; transform: scale(1.04); }
@keyframes breathe { 0%, 100% { border-color: var(--line2); } 50% { border-color: var(--accent); } }

/* words */
.wordlist { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.wordchip { padding: 11px 18px; border-radius: 999px; border: 1px solid var(--line2); background: rgba(255, 255, 255, .02);
  font-size: 17px; letter-spacing: 2px; transition: .2s; }
.wordchip.secret { border-color: var(--accent2); color: var(--accent2); box-shadow: 0 0 16px #46e6a644; }
.wordchip.guess { border-color: var(--accent); color: var(--accent); box-shadow: 0 0 20px #4fd6ff77; transform: scale(1.06); }
.flashword { font-size: 58px; font-weight: 800; letter-spacing: 4px; color: #fff; text-shadow: 0 0 40px #4fd6ff77; animation: pop .16s ease; }
@keyframes pop { from { transform: scale(.85); opacity: .3; } to { transform: scale(1); opacity: 1; } }
.fixation { font-size: 44px; color: var(--accent2); text-shadow: 0 0 18px #46e6a655; }
.fixation.think { animation: ping 1.6s ease-in-out infinite; }
.countdown { font-size: 80px; font-weight: 800; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; animation: pop .2s ease; }

/* confidence ring */
.ring { --p: 0; width: 128px; height: 128px; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(closest-side, var(--bg) 79%, transparent 80%),
              conic-gradient(var(--accent2) calc(var(--p) * 1%), rgba(120, 170, 255, .12) 0); }
.ring span { font-size: 30px; font-weight: 800; } .ring small { display: block; font-size: 10px; color: var(--muted); letter-spacing: 1px; }

/* pupil resonance */
.reso-stage { position: relative; width: 100%; max-width: 380px; aspect-ratio: 1; margin: 0 auto;
  background: #7f7f7f; border-radius: var(--r-lg); overflow: hidden; }
.reso-fix { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); font-size: 38px; color: #111; z-index: 3; font-weight: 700; }
.reso-disk { position: absolute; width: 26%; height: 26%; transform: translate(-50%, -50%); border-radius: 50%;
  background: #808080; display: grid; place-items: center; box-shadow: 0 0 18px #0005; }
.reso-disk span { font-size: 11px; font-weight: 700; color: #0009; letter-spacing: 1px; mix-blend-mode: difference; }
.reso-disk.attend { outline: 4px solid var(--accent2); outline-offset: 3px; box-shadow: 0 0 36px var(--accent2); }
.post-bars { display: flex; gap: 10px; justify-content: center; align-items: flex-end; height: 64px; margin-top: 18px; }
.pb { width: 38px; height: 100%; position: relative; background: rgba(255, 255, 255, .04); border-radius: 8px; display: flex; flex-direction: column; justify-content: flex-end; }
.pbfill { width: 100%; height: 25%; background: var(--grad); border-radius: 0 0 7px 7px; transition: height .3s; }
.pb label { position: absolute; bottom: -18px; left: 0; right: 0; text-align: center; font-size: 9.5px; color: var(--muted); }

/* mind type — scanning speller */
.speller { width: 100%; max-width: 640px; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.sp-text { width: 100%; min-height: 64px; padding: 16px 20px; border-radius: var(--r);
  background: rgba(255, 255, 255, .03); border: 1px solid var(--line2); font-size: 26px; letter-spacing: 1px;
  display: flex; align-items: center; gap: 2px; word-break: break-word; }
#spOut:empty::before { content: "your words appear here…"; color: var(--muted); font-size: 18px; letter-spacing: .3px; }
.sp-caret { width: 2px; height: 28px; background: var(--accent); animation: blinkcaret 1s steps(2) infinite; }
@keyframes blinkcaret { 50% { opacity: 0; } }
.sp-list { width: 100%; display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.sp-tile { flex: 1 1 auto; min-width: 110px; min-height: 64px; padding: 14px 18px; border-radius: var(--r);
  border: 1px solid var(--line2); background: rgba(255, 255, 255, .02); display: grid; place-items: center;
  font-size: clamp(18px, 4.5vmin, 26px); font-weight: 600; letter-spacing: 1px; cursor: pointer;
  transition: transform .12s, box-shadow .12s, border-color .12s, background .12s; }
.sp-tile.pred { color: var(--accent2); border-color: rgba(70, 230, 166, .35); flex-basis: 30%; }
.sp-tile.act { color: var(--muted); font-size: clamp(14px, 3.4vmin, 18px); }
.sp-tile.let { min-width: 72px; }
/* the auto-scanning highlight — big, obvious, can't-miss */
.sp-tile.scan { border-color: var(--accent); background: rgba(79, 214, 255, .16);
  box-shadow: 0 0 0 3px var(--accent), 0 0 30px rgba(79, 214, 255, .5); transform: scale(1.06); color: #fff; }
.sp-hint { font-size: 13px; color: var(--muted); letter-spacing: .3px; text-align: center; min-height: 18px; }
.sp-scanctl { display: flex; gap: 10px; align-items: center; width: 100%; max-width: 420px; }
.sp-scanctl .primary { flex: 1; padding: 16px; font-size: 17px; }
.sp-scanctl .zbtn { width: auto; height: auto; padding: 12px 14px; border-radius: 999px; font-size: 13px; }

/* validation */
.valbox { background: rgba(255, 255, 255, .02); border: 1px solid var(--line2); border-radius: var(--r); padding: 14px 18px; margin: 8px 0; width: 100%; }
.valrow { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line); }
.valrow:last-child { border-bottom: none; }
.valrow strong.ok { color: var(--accent2); } .valrow strong.no { color: var(--warn); }

/* calibration overlay */
.cal-overlay { position: fixed; inset: 0; z-index: 50; background: rgba(3, 5, 11, .97); backdrop-filter: blur(6px); }
.cal-text { position: absolute; top: 16%; left: 0; right: 0; text-align: center; font-size: 19px; padding: 0 24px; }
.cal-dot { position: absolute; width: 26px; height: 26px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 26px var(--accent), 0 0 64px #4fd6ff55; transition: left .5s cubic-bezier(.2, .8, .2, 1), top .5s;
  transform: translate(-50%, -50%); left: 50%; top: 50%; }
.cal-dot::after { content: ""; position: absolute; inset: 8px; border-radius: 50%; background: #fff; animation: ping 1.1s infinite; }
@keyframes ping { 0%, 100% { transform: scale(.9); opacity: 1; } 50% { transform: scale(1.25); opacity: .6; } }

/* iOS hint */
.ios-hint { position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 60;
  background: var(--panel); backdrop-filter: blur(16px); border: 1px solid var(--line2); border-radius: var(--r);
  padding: 12px 14px; font-size: 13.5px; display: flex; gap: 10px; align-items: center; }
.ios-hint button { margin-left: auto; }

footer { text-align: center; color: var(--muted); font-size: 11px; padding: 26px; opacity: .7; }

@media (max-width: 600px) {
  .scope { width: 78px; height: 58px; }
  .eye-scope { gap: 5px; padding: 6px; }
  main { padding: 16px 14px; }
  .stimulus { min-height: 220px; }
}
@media (prefers-reduced-motion: reduce) { *, *::after { animation: none !important; transition: none !important; } }
