/* Deep Crew — one visual system for phone, stage, and host. Single dark theme, chunky flat UI. */
@import url('https://fonts.googleapis.com/css2?family=Lilita+One&family=Nunito:wght@500;700;900&family=Share+Tech+Mono&display=swap');

:root {
  --space: #0B1026; --space-2: #070B1A; --panel: #1E2A4A; --panel-2: #16203B; --panel-3: #2A3861; --ink: #05070F;
  --text: #F4F6FF; --muted: #B9C3DE; --alarm: #E5383B; --go: #6BE35B; --warn: #F7D23E; --cool: #38D6F0;
  --c0: #38D6F0; --c1: #F7D23E; --c2: #F58A2B; --c3: #9B5DE5; --c4: #F25FA8; --c5: #B8F04A;
  --display: 'Lilita One', 'Arial Black', sans-serif; --body: 'Nunito', system-ui, sans-serif; --mono: 'Share Tech Mono', ui-monospace, monospace;
  --line: 4px; --r: 18px; --shadow: 0 6px 0 var(--ink);
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--space); color: var(--text); font-family: var(--body); font-size: 16px; line-height: 1.4; -webkit-text-size-adjust: 100%; }
body { min-height: 100vh; padding: 0 16px; padding-block: 0; }
h1, h2, h3 { font-family: var(--display); font-weight: 400; letter-spacing: .01em; line-height: 1.05; margin: 0; text-wrap: balance; }
h1 { font-size: 2rem; } h2 { font-size: 1.5rem; } h3 { font-size: 1.15rem; }
p { margin: 0; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.label { font-family: var(--mono); font-size: .75rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.tabular { font-variant-numeric: tabular-nums; }
button, input, textarea, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--warn); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* Stars */
.stars { position: fixed; inset: 0; z-index: -1; background: radial-gradient(ellipse at 30% 20%, #16204a 0%, var(--space) 45%, var(--space-2) 100%); }
.stars canvas { width: 100%; height: 100%; display: block; }

/* Chunky components */
.card { background: var(--panel); border: var(--line) solid var(--ink); border-radius: var(--r); box-shadow: var(--shadow); padding: 16px; }
.card--flat { box-shadow: none; }
.card--alarm { background: #4a1a1e; border-color: var(--alarm); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 52px; padding: 10px 18px; border: var(--line) solid var(--ink); border-radius: 999px; background: var(--panel-3); color: var(--text); font-weight: 900; font-size: 1rem; box-shadow: var(--shadow); cursor: pointer; text-align: center; transition: transform .08s; }
.btn:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--ink); }
.btn--go { background: var(--go); color: var(--ink); }
.btn--alarm { background: var(--alarm); color: #fff; }
.btn--warn { background: var(--warn); color: var(--ink); }
.btn--ghost { background: transparent; box-shadow: none; border-color: var(--panel-3); }
.btn--sm { min-height: 48px; font-size: .9rem; padding: 6px 14px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; }
.btn--picked { outline: 4px solid var(--go); outline-offset: -2px; }
.chip { display: inline-block; padding: 4px 12px; border-radius: 999px; border: 3px solid var(--ink); background: var(--panel-3); font-family: var(--mono); font-size: .9rem; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; }
.chip--go { background: var(--go); color: var(--ink); } .chip--alarm { background: var(--alarm); color: #fff; } .chip--warn { background: var(--warn); color: var(--ink); }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.tight { gap: 6px; }

/* Task bar (acts) */
.taskbar { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; padding: 10px 0; }
.taskbar__seg { height: 14px; border: 3px solid var(--ink); border-radius: 999px; background: var(--panel-2); position: relative; overflow: hidden; }
.taskbar__seg::after { content: ""; position: absolute; inset: 0; width: var(--fill, 0%); background: var(--go); transition: width .4s; }
.taskbar__seg--live::after { background: var(--warn); }
.taskbar__names { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; font-family: var(--mono); font-size: .9rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); text-align: center; }

/* Meters */
.meter { display: grid; grid-template-columns: 7.5em 1fr 2.6em; align-items: center; gap: 8px; font-size: .95rem; }
.meter__bar { display: grid; grid-template-columns: repeat(10, 1fr); gap: 2px; height: 14px; border: 3px solid var(--ink); border-radius: 6px; background: var(--panel-2); padding: 1px; }
.meter__cell { border-radius: 2px; background: transparent; }
.meter__cell--on { background: var(--go); }
.meter--low .meter__cell--on { background: var(--warn); }
.meter--crit .meter__cell--on { background: var(--alarm); }
.meter__n { font-family: var(--mono); text-align: right; }

/* Timer */
.timer { font-family: var(--mono); font-size: 2.4rem; letter-spacing: .06em; text-align: center; }
.timer--urgent { color: var(--alarm); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: .35; } }

/* Text inputs */
.input { width: 100%; padding: 12px 14px; border: var(--line) solid var(--ink); border-radius: 14px; background: var(--panel-2); color: var(--text); font-weight: 700; }
textarea.input { min-height: 90px; resize: vertical; }
select.input { appearance: none; }

/* Option lists */
.opt { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; text-align: left; border-radius: 14px; }
.opt--rec { border-color: var(--cool); }
.lantern { display: grid; grid-template-columns: 44px 1fr; gap: 10px; align-items: start; background: #10233a; border: 3px solid var(--cool); border-radius: 14px; padding: 10px; }
.lantern__eye { width: 44px; height: 44px; border-radius: 50%; background: radial-gradient(circle at 40% 40%, #dffbff, var(--cool) 55%, #0d3b4a 100%); border: 3px solid var(--ink); box-shadow: 0 0 18px var(--cool); animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 6px var(--cool); } }
.lantern__conf { font-family: var(--mono); color: var(--cool); }

/* Alert */
.alert { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: rgba(70, 8, 12, .92); text-align: center; padding: 24px; animation: strobe .5s steps(2) 6; }
@keyframes strobe { 50% { background: rgba(229, 56, 59, .55); } }
.alert h1 { font-size: clamp(2.4rem, 9vw, 7rem); color: #fff; text-shadow: 0 6px 0 var(--ink); }
.shake { animation: shake .5s linear 2; }
@keyframes shake { 0%,100% { transform: translate(0,0);} 20% { transform: translate(-6px, 3px);} 40% { transform: translate(6px,-3px);} 60% { transform: translate(-4px,2px);} 80% { transform: translate(4px,-2px);} }

/* Phone layout */
.phone { max-width: 520px; margin: 0 auto; padding-block: 8px 90px; }
.phone__head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; }
.phone__band { height: 10px; border-radius: 999px; border: 3px solid var(--ink); background: var(--crew, var(--panel-3)); }
.phone__foot { position: fixed; left: 0; right: 0; bottom: 0; padding: 8px 16px 14px; background: linear-gradient(180deg, transparent, var(--space) 40%); }
.phone__foot .timer { font-size: 1.6rem; }

/* Stage layout */
.stage { min-height: 100vh; display: grid; grid-template-rows: auto 1fr; gap: 10px; padding-block: 10px; }
.stage__head { display: grid; grid-template-columns: auto 1fr auto; gap: 18px; align-items: center; }
.stage__body { display: grid; grid-template-columns: 250px 1fr; gap: 14px; min-height: 0; }
.rail { display: flex; flex-direction: column; gap: 8px; overflow: auto; min-height: 0; }
.mini { display: grid; grid-template-columns: 64px 1fr; gap: 8px; align-items: center; text-align: left; padding: 8px; border: 3px solid var(--ink); border-left: 8px solid var(--crew); border-radius: 12px; background: var(--panel); color: var(--text); cursor: pointer; }
.mini svg { width: 64px; height: 38px; }
.mini__body { display: grid; gap: 4px; min-width: 0; }
.mini__name { font-family: var(--display); font-size: 1.05rem; line-height: 1.05; }
.mini .chip { font-size: .7rem; padding: 2px 8px; }
.controls { position: fixed; right: 18px; bottom: 18px; z-index: 60; display: flex; gap: 10px; }
.controls .btn { font-size: 1.05rem; padding-inline: 20px; }
.term .big { font-size: 1.35rem; line-height: 1.3; }
.term .lesson__title { font-size: 2.2rem; }
.term .finding { font-size: 1.5rem; }
.term .lesson__q { font-size: 1.3rem; }
.term .muted { font-size: 1.05rem; }
.term .bar { grid-template-columns: minmax(16em, 30em) 1fr 9em; font-size: 1.05rem; }
.term .bar > span:first-child { line-height: 1.2; white-space: normal; }
.term .term__body { gap: 10px; }
.term p { max-width: 90ch; }
.lesson__concept { font-family: var(--display); color: var(--cool); font-size: 1.2rem; letter-spacing: .02em; }
.term .lesson__concept { font-size: 1.6rem; }
.opt > .row { grid-column: 1 / -1; }
.bar--bad .bar__track { border-color: var(--alarm); }
.stage .mini .chip { font-size: .9rem; }
.stage .taskbar__names { font-size: 1rem; }
.ship__meters::before { content: "Ship meters · 0–10 · higher is safer"; font-family: var(--mono); font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
details.kase summary { cursor: pointer; font-family: var(--mono); font-size: .75rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.sticky { position: sticky; top: 0; z-index: 5; background: var(--space); padding: 6px 0; }
.kase { border-left: 6px solid var(--cool); padding: 6px 0 6px 14px; }
.kase p { font-size: 1.25rem; line-height: 1.45; }
.brief { margin: 0; padding-left: 22px; font-size: 1.25rem; font-weight: 700; line-height: 1.4; }
.brief li { margin-bottom: 6px; }
.build--big { padding: 0; gap: 6px; }
.build--big::before { content: none; }
.build--big .build__item { font-size: 1.1rem; }
.build--big .build__v { white-space: normal; }
.fleet { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); grid-auto-rows: 1fr; gap: 10px; min-height: 0; }
@media (min-width: 901px) { .fleet { grid-template-columns: repeat(3, 1fr); } }
.stage .label { font-size: 1rem; }
.ship { display: grid; grid-template-rows: auto auto 1fr auto; gap: 8px; padding: 10px; border-color: var(--ink); position: relative; overflow: hidden; --crew: var(--panel-3); min-height: 0; }
.ship .meter { font-size: 1rem; line-height: 1.1; grid-template-columns: 7.5em 1fr 2.8em; gap: 6px; }
.ship .meter__bar { height: 16px; }
.meter__n::after { content: "/10"; color: var(--muted); font-size: .8em; }
.ship__meters { gap: 3px; align-content: start; }
.ship::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 10px; background: var(--crew); }
.ship__head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding-left: 8px; }
.ship__name { font-family: var(--display); font-size: 1.35rem; line-height: 1.05; }
.ship__head svg { width: 80px; height: 46px; display: block; flex: none; }
.build { display: grid; grid-template-columns: 1fr; gap: 2px; padding-left: 8px; }
.build::before { content: "How it was built"; grid-column: 1 / -1; font-family: var(--mono); font-size: .9rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.build__item { display: flex; gap: 8px; align-items: baseline; font-size: 1rem; line-height: 1.2; min-width: 0; }
.build__item--bad .build__v { color: var(--alarm); }
.build__item:not(.build__item--on) .build__v { color: var(--muted); }
.build__item::before { content: ""; flex: none; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--ink); background: var(--panel-3); align-self: center; }
.build__item--on::before { background: var(--go); }
.build__item--bad::before { background: var(--alarm); }
.build__k { color: var(--muted); font-family: var(--mono); font-size: .9rem; letter-spacing: .06em; text-transform: uppercase; flex: none; width: 5em; }
.build__v { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ship__meters { display: grid; gap: 4px; padding-left: 8px; }
.ship__foot { display: flex; justify-content: space-between; align-items: center; padding-left: 8px; font-family: var(--mono); font-size: .95rem; color: var(--muted); }
.ship--hit { animation: shake .5s linear 2; }
.term { display: grid; grid-template-rows: auto 1fr; gap: 10px; min-height: 0; background: var(--panel-2); font-family: var(--body); }
.term__head { display: flex; justify-content: space-between; align-items: center; font-family: var(--mono); font-size: 1rem; letter-spacing: .1em; text-transform: uppercase; color: var(--cool); }
.term__body { overflow: auto; display: flex; flex-direction: column; gap: 12px; }
.term .timer { font-size: 3.2rem; }
.bars { display: grid; gap: 6px; }
.bar { display: grid; grid-template-columns: 9em 1fr 3em; gap: 8px; align-items: center; font-size: 1rem; }
.bar > span:first-child { white-space: normal; overflow-wrap: anywhere; }
.bar__track { height: 22px; border: 3px solid var(--ink); border-radius: 999px; background: var(--panel); overflow: hidden; }
.bar__fill { height: 100%; background: var(--go); width: var(--w, 0%); transition: width .5s; }
.bar--bad .bar__fill { background: var(--alarm); }
.bar__n { font-family: var(--mono); text-align: right; }
.finding { font-size: 1.15rem; font-weight: 900; }
.lesson__title { font-size: 1.6rem; }
.lesson__q { border-left: 6px solid var(--warn); padding-left: 12px; font-weight: 900; }
.fullscreen { position: fixed; inset: 0; z-index: 30; background: rgba(7, 11, 26, .96); padding: 28px; overflow: auto; display: grid; grid-template-rows: auto 1fr; gap: 16px; }
.grid2x2 { position: relative; width: min(68vh, 100%); margin-bottom: 2.2em; aspect-ratio: 1; margin: 0 auto; border: var(--line) solid var(--ink); border-radius: var(--r); background: var(--panel-2); display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.grid2x2--primer { width: 100%; aspect-ratio: auto; margin: 0 0 2.4em 1.8em; }
.grid2x2--primer > .q { font-size: 1.25rem; padding: 10px 12px; }
.grid2x2--small { width: min(40vh, 100%); flex: none; margin: 0 2em 2.4em 1.8em; }
.grid2x2--small > .q { font-size: .95rem; }
.grid2x2 > .q { border: 2px dashed var(--panel-3); padding: 10px; font-family: var(--mono); font-size: 1.25rem; color: var(--text); }
.axis { position: absolute; font-family: var(--mono); font-size: 1.4rem; color: var(--warn); letter-spacing: .06em; }
.axis--y { left: -1.6em; top: 50%; transform: rotate(-90deg) translate(-50%, 0); transform-origin: left top; white-space: nowrap; }
.axis--x { left: 50%; bottom: -1.7em; transform: translateX(-50%); white-space: nowrap; }
.dot { position: absolute; width: 24px; height: 24px; border-radius: 50%; border: 3px solid var(--ink); background: var(--crew); transform: translate(-50%, -50%); transition: left .6s, top .6s; }
.dot--lock { width: 34px; height: 34px; border-width: 4px; box-shadow: var(--shadow); z-index: 2; }
.wall { columns: 3 280px; column-gap: 14px; }
.wall .card { break-inside: avoid; margin-bottom: 14px; font-size: 1.15rem; }
.qr { background: #fff; border: var(--line) solid var(--ink); border-radius: var(--r); padding: 10px; display: inline-block; }
.qr svg { display: block; width: min(34vh, 100%); height: auto; }
.big { font-size: clamp(1.4rem, 3vw, 2.2rem); }
.huge { font-size: clamp(2rem, 6vw, 5rem); }
.trace { display: grid; grid-template-columns: 1fr; gap: 8px; }
.trace__row { display: grid; grid-template-columns: 8em 1fr 11em 10em; gap: 10px; align-items: center; padding: 8px 12px; border: 3px solid var(--ink); border-radius: 12px; background: var(--panel); font-size: 1.2rem; }
.trace__row--hit { border-color: var(--alarm); }

/* Host */
.host { max-width: 520px; margin: 0 auto; padding-block: 10px 30px; }
.host .btn { min-height: 60px; }
.host__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

@media (max-width: 900px) { .stage { height: auto; overflow: visible; } .stage__body { grid-template-columns: 1fr; } .rail { flex-direction: row; flex-wrap: wrap; } .term { min-height: 40vh; } }
@media (max-width: 480px) { .taskbar__names { display: none; } }
