/* CHEREV VAULT BREAK — Roblox-flavored neon brick aesthetic */

:root {
  --bg: #0e1116;
  --bg-2: #161b22;
  --panel: #1c2230;
  --panel-2: #232b3d;
  --ink: #e6edf3;
  --ink-dim: #9aa6b2;
  --brick: #00c800;        /* Roblox classic green */
  --brick-glow: #2ee62e;
  --robux: #00b06f;
  --warn: #ff5757;
  --gold: #ffd23f;
  --pink: #ff4fa1;
  --purple: #a16bff;
  --shadow: 0 6px 0 #000a;
  --stud: radial-gradient(circle at 50% 38%, #ffffff55 0 22%, #00000000 24% 100%);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background:
    radial-gradient(1200px 700px at 80% -10%, #1b2a4a 0%, transparent 60%),
    radial-gradient(900px 600px at -10% 110%, #1a3322 0%, transparent 55%),
    var(--bg);
  color: var(--ink);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
  letter-spacing: 0.01em;
}

a { color: var(--brick-glow); }

button { font-family: inherit; cursor: pointer; }

/* Subtle stud-grid background */
body::before {
  content: "";
  position: fixed; inset: 0;
  background-image:
    radial-gradient(circle at 50% 50%, #ffffff08 1.6px, transparent 2px);
  background-size: 26px 26px;
  pointer-events: none;
  z-index: 0;
}

main, header, footer { position: relative; z-index: 1; }

/* ---- Top bar ---- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px;
  background: linear-gradient(180deg, #0c0f15 0%, #0c0f15dd 100%);
  border-bottom: 2px solid #000;
  box-shadow: 0 4px 0 #000a;
}

.brand {
  display: flex; align-items: center; gap: 12px;
  font-family: "Press Start 2P", monospace;
  font-size: 16px;
  letter-spacing: 1px;
}
.brand .title em {
  color: var(--brick-glow);
  font-style: normal;
  text-shadow: 0 0 10px #2ee62e88;
}
.stud {
  width: 28px; height: 28px;
  background: var(--brick);
  background-image: var(--stud);
  border: 2px solid #000;
  box-shadow: var(--shadow);
  border-radius: 4px;
}

.topnav { display: flex; gap: 8px; }
.nav-btn {
  background: var(--panel);
  color: var(--ink);
  border: 2px solid #000;
  border-bottom-width: 4px;
  padding: 8px 14px;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 1px;
  border-radius: 4px;
  text-transform: uppercase;
}
.nav-btn:hover { background: var(--panel-2); transform: translateY(-1px); }
.nav-btn:active { border-bottom-width: 2px; transform: translateY(2px); }
.nav-btn.danger { color: var(--warn); }
.nav-btn.small { padding: 6px 10px; font-size: 11px; }

/* ---- Screens ---- */
.screen {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 22px 60px;
}

/* ---- Hero ---- */
.hero { text-align: center; margin-bottom: 28px; }
.hero h1 {
  font-family: "Press Start 2P", monospace;
  font-size: clamp(20px, 4vw, 34px);
  line-height: 1.4;
  margin: 8px 0 12px;
  text-shadow: 0 4px 0 #000;
}
.hero-sub {
  color: var(--gold);
  text-shadow: 0 4px 0 #000, 0 0 14px #ffd23f44;
}
.hero-blurb {
  max-width: 640px;
  margin: 0 auto;
  color: var(--ink-dim);
  font-size: 15px;
}
.hero-credit {
  margin: 12px auto 0;
  font-size: 12px;
  color: var(--ink-dim);
  letter-spacing: 1.5px;
  text-transform: uppercase;
}
.hero-credit a { color: var(--brick-glow); text-decoration: none; font-weight: 700; }
.hero-credit a:hover { text-decoration: underline; }
.progress {
  margin: 22px auto 0;
  max-width: 520px;
  height: 22px;
  background: #0a0d12;
  border: 2px solid #000;
  border-bottom-width: 4px;
  border-radius: 4px;
  position: relative;
  overflow: hidden;
}
.progress-fill {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--brick), var(--brick-glow));
  transition: width 300ms ease;
}
.progress-text {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800; letter-spacing: 2px;
  color: #fff; text-shadow: 0 2px 0 #000;
}

/* ---- Level grid ---- */
.level-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}
.level-card {
  background: var(--panel);
  border: 2px solid #000;
  border-bottom-width: 5px;
  border-radius: 6px;
  padding: 14px 12px 12px;
  text-align: left;
  color: var(--ink);
  position: relative;
  transition: transform 120ms ease, background 120ms ease;
  font: inherit;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 150px;
}
.level-card:hover:not(.locked) { background: var(--panel-2); transform: translateY(-2px); }
.level-card .num {
  font-family: "Press Start 2P", monospace;
  font-size: 11px;
  color: var(--ink-dim);
  letter-spacing: 1px;
}
.level-card .av { font-size: 30px; line-height: 1; }
.level-card .nm {
  font-weight: 800;
  font-size: 16px;
  margin-top: 2px;
}
.level-card .blurb {
  font-size: 12px;
  color: var(--ink-dim);
  flex: 1;
}
.level-card .stars {
  font-size: 12px;
  letter-spacing: 1px;
  color: var(--gold);
}
.level-card.locked {
  filter: grayscale(0.6) brightness(0.6);
  cursor: not-allowed;
}
.level-card.locked::after {
  content: "🔒";
  position: absolute; top: 8px; right: 10px;
  font-size: 16px;
}
.level-card.cracked {
  background: linear-gradient(180deg, #112418, #1a3322);
  border-color: #003c14;
}
.level-card.cracked::after {
  content: "✓";
  position: absolute; top: 6px; right: 10px;
  color: var(--brick-glow);
  font-weight: 900;
  font-size: 18px;
  text-shadow: 0 0 8px #2ee62e;
}

/* ---- Level head ---- */
.back-btn {
  background: transparent;
  color: var(--ink-dim);
  border: none;
  font-weight: 700;
  letter-spacing: 1px;
  font-size: 12px;
  padding: 4px 0 16px;
}
.back-btn:hover { color: var(--brick-glow); }

.level-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 16px;
  align-items: center;
  background: var(--panel);
  border: 2px solid #000;
  border-bottom-width: 5px;
  border-radius: 6px;
  padding: 16px 18px;
  margin-bottom: 14px;
}
.avatar {
  width: 72px; height: 72px;
  background: var(--brick);
  background-image: var(--stud);
  border: 2px solid #000;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 38px;
  box-shadow: var(--shadow);
}
.level-tag {
  font-family: "Press Start 2P", monospace;
  font-size: 10px;
  color: var(--ink-dim);
  letter-spacing: 1.5px;
  margin-bottom: 4px;
}
.level-meta h2 { margin: 0 0 4px; font-size: 22px; }
.level-meta .stars { color: var(--gold); font-size: 13px; letter-spacing: 1.5px; }
.level-meta .blurb { color: var(--ink-dim); margin: 6px 0 0; font-size: 14px; }

.status {
  font-family: "Press Start 2P", monospace;
  font-size: 11px;
  padding: 8px 12px;
  border: 2px solid #000;
  border-radius: 4px;
  background: #2a1414;
  color: var(--warn);
  letter-spacing: 1.5px;
}
.status.unlocked {
  background: #102818;
  color: var(--brick-glow);
  text-shadow: 0 0 10px #2ee62e88;
}

/* ---- Chat ---- */
.chat {
  background: var(--bg-2);
  border: 2px solid #000;
  border-bottom-width: 4px;
  border-radius: 6px;
  padding: 14px;
  height: 380px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.msg {
  max-width: 78%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 2px solid #000;
  line-height: 1.4;
  font-size: 14px;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.msg.ai {
  align-self: flex-start;
  background: var(--panel-2);
  border-bottom-left-radius: 2px;
}
.msg.user {
  align-self: flex-end;
  background: linear-gradient(180deg, #1a4a2a, #103820);
  border-bottom-right-radius: 2px;
  color: #eafcef;
}
.msg.sys {
  align-self: center;
  background: #2c1f0a;
  border-color: #4a3010;
  color: var(--gold);
  font-size: 12px;
  letter-spacing: 1px;
  font-weight: 700;
  text-transform: uppercase;
}
.msg.win {
  align-self: center;
  background: #0a2c14;
  border-color: var(--brick);
  color: var(--brick-glow);
  font-family: "Press Start 2P", monospace;
  font-size: 12px;
  text-shadow: 0 0 10px #2ee62e88;
}
.msg .who {
  font-size: 10px;
  opacity: 0.6;
  letter-spacing: 1px;
  margin-bottom: 4px;
  text-transform: uppercase;
}
.typing {
  align-self: flex-start;
  font-size: 12px;
  color: var(--ink-dim);
  padding: 4px 8px;
}
.typing::after {
  content: "▍";
  animation: blink 0.9s infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ---- Forms ---- */
.chat-form {
  display: flex; gap: 8px;
  margin-top: 12px;
}
.chat-form input {
  flex: 1;
  background: #0a0d12;
  color: var(--ink);
  border: 2px solid #000;
  border-bottom-width: 4px;
  border-radius: 4px;
  padding: 12px 14px;
  font-size: 14px;
  font-family: inherit;
}
.chat-form input:focus {
  outline: none;
  border-color: var(--brick);
  box-shadow: 0 0 0 2px #00c80044;
}
.chat-form button, .guess-form button {
  background: var(--brick);
  color: #001a00;
  border: 2px solid #000;
  border-bottom-width: 4px;
  border-radius: 4px;
  padding: 12px 18px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.chat-form button:hover, .guess-form button:hover { background: var(--brick-glow); }
.chat-form button:disabled { opacity: 0.5; cursor: wait; }

.guess-row {
  margin-top: 14px;
  background: var(--panel);
  border: 2px solid #000;
  border-bottom-width: 5px;
  border-radius: 6px;
  padding: 14px;
}
.guess-form {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
}
.guess-form label {
  font-family: "Press Start 2P", monospace;
  font-size: 10px;
  color: var(--gold);
  letter-spacing: 1.5px;
}
.guess-form input {
  background: #0a0d12;
  color: var(--ink);
  border: 2px solid #000;
  border-bottom-width: 4px;
  border-radius: 4px;
  padding: 10px 12px;
  font-family: "Press Start 2P", monospace;
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}
.guess-form input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 2px #ffd23f44;
}
.guess-form button { background: var(--gold); color: #2a1c00; }
.guess-form button:hover { background: #ffe066; }

.guess-result {
  margin-top: 8px;
  font-size: 13px;
  font-weight: 700;
  min-height: 18px;
}
.guess-result.ok { color: var(--brick-glow); }
.guess-result.no { color: var(--warn); }

.level-foot {
  display: flex; justify-content: space-between;
  margin-top: 18px;
}

/* ---- Help ---- */
.help {
  background: var(--panel);
  border: 2px solid #000;
  border-bottom-width: 5px;
  border-radius: 6px;
  padding: 22px 26px;
  line-height: 1.6;
}
.help h2 {
  font-family: "Press Start 2P", monospace;
  font-size: 16px;
  color: var(--brick-glow);
  margin-top: 0;
}
.help h3 {
  font-family: "Press Start 2P", monospace;
  font-size: 12px;
  color: var(--gold);
  margin-top: 22px;
}
.help li { margin: 6px 0; }
.help code {
  background: #0a0d12;
  padding: 2px 6px;
  border-radius: 3px;
  border: 1px solid #000;
  font-size: 13px;
}

/* ---- Connection hint ---- */
.conn-hint {
  margin-top: 24px;
  padding: 14px 16px;
  background: #2a1414;
  border: 2px solid #000;
  border-left: 6px solid var(--warn);
  border-radius: 4px;
  color: #ffd0d0;
  font-size: 14px;
}
.conn-hint code {
  background: #0a0d12;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 13px;
}

/* ---- Footer ---- */
.foot {
  text-align: center;
  padding: 20px;
  color: var(--ink-dim);
  font-size: 12px;
  letter-spacing: 1px;
}
.foot-line { margin: 4px 0; }
.foot a { color: var(--brick-glow); text-decoration: none; font-weight: 700; }
.foot a:hover { text-decoration: underline; }

/* ---- Access gate ---- */
body.locked > header,
body.locked > main,
body.locked > footer { display: none !important; }
body:not(.locked) > #screen-gate { display: none; }

.gate-screen {
  position: fixed; inset: 0;
  z-index: 9999;
  display: flex;
  align-items: safe center;     /* center when it fits, top-align when it overflows */
  justify-content: center;
  background:
    radial-gradient(800px 500px at 50% 50%, #1c2230 0%, #0a0d12 70%),
    var(--bg);
  padding: 24px 20px;
  overflow-y: auto;
}
.gate-wrap {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 18px;
  max-width: 720px;
  width: 100%;
}
@media (max-width: 760px) {
  .gate-wrap { flex-direction: column; align-items: center; gap: 8px; }
}

/* Aaron-Roblox character (small side accent, not the focal point) */
.aaron-stage {
  position: relative;
  width: 140px;
  flex-shrink: 0;
  padding-top: 78px;        /* room for the speech bubble above */
  padding-bottom: 14px;     /* room for the stud platform */
  margin-bottom: 4px;
  animation: char-bob 2.4s ease-in-out infinite;
}
.aaron-char {
  width: 100%;
  height: auto;
  display: block;
  filter: drop-shadow(0 4px 0 #0006);
}
.aaron-platform {
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 130px;
  height: 16px;
  margin-left: -65px;
  background: var(--brick);
  background-image: var(--stud);
  background-size: 22px 16px;
  border: 2px solid #000;
  border-bottom-width: 4px;
  border-radius: 4px;
  z-index: -1;
}
@keyframes char-bob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-7px); }
}
.aaron-char .arm-right {
  transform-origin: 165px 158px;
  animation: arm-wave 3.8s ease-in-out infinite;
}
@keyframes arm-wave {
  0%, 55%, 100% { transform: rotate(0deg); }
  62% { transform: rotate(-22deg); }
  72% { transform: rotate(-12deg); }
  82% { transform: rotate(-22deg); }
  92% { transform: rotate(0deg); }
}
.aaron-char .eye {
  transform-origin: center;
  transform-box: fill-box;
  animation: blink 4.7s linear infinite;
}
@keyframes blink {
  0%, 91%, 95%, 100% { transform: scaleY(1); }
  93%                { transform: scaleY(0.08); }
}
@media (prefers-reduced-motion: reduce) {
  .aaron-stage,
  .aaron-char .arm-right,
  .aaron-char .eye,
  .aaron-bubble .bubble { animation: none !important; }
}

/* Speech bubble — sits in the reserved top area of the stage, centered */
.aaron-bubble {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 240px;
  max-width: calc(100vw - 56px);
  height: 70px;
  z-index: 2;
  font-family: "Press Start 2P", monospace;
  font-size: 10px;
  line-height: 1.5;
  letter-spacing: 0.5px;
  pointer-events: none;
}
.aaron-bubble .bubble {
  position: absolute;
  left: 50%;
  bottom: 12px;
  background: #fff;
  color: #0e1116;
  border: 2px solid #000;
  border-radius: 10px;
  padding: 9px 12px;
  text-align: center;
  white-space: normal;
  opacity: 0;
  transform: translateX(-50%) scale(0.7);
  box-shadow: 4px 4px 0 #0008;
  width: max-content;
  max-width: 100%;
  box-sizing: border-box;
}
.aaron-bubble .bubble::after {
  content: "";
  position: absolute;
  bottom: -8px;
  left: 50%;
  margin-left: -6px;
  width: 12px; height: 12px;
  background: #fff;
  border-right: 2px solid #000;
  border-bottom: 2px solid #000;
  transform: rotate(45deg);
}
.aaron-bubble .bubble-1 { animation: bubble-cycle 7s linear infinite; }
.aaron-bubble .bubble-2 { animation: bubble-cycle 7s linear -3.5s infinite; }
@keyframes bubble-cycle {
  0%   { opacity: 0; transform: translateX(-50%) scale(0.7); }
  5%   { opacity: 1; transform: translateX(-50%) scale(1); }
  45%  { opacity: 1; transform: translateX(-50%) scale(1); }
  50%  { opacity: 0; transform: translateX(-50%) scale(0.7); }
  100% { opacity: 0; transform: translateX(-50%) scale(0.7); }
}

.gate-box {
  width: 100%;
  max-width: 460px;
  background: var(--panel);
  border: 2px solid #000;
  border-bottom-width: 6px;
  border-radius: 6px;
  padding: 32px 28px;
  text-align: center;
  box-shadow: 0 0 60px #2ee62e22;
}
.gate-credit {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 2px dashed #0006;
  font-size: 11px;
  color: var(--ink-dim);
  letter-spacing: 1px;
}
.gate-credit a { color: var(--brick-glow); text-decoration: none; font-weight: 700; }
.gate-credit a:hover { text-decoration: underline; }

.gate-emoji { font-size: 48px; margin-bottom: 8px; }
.gate-box h1 {
  font-family: "Press Start 2P", monospace;
  font-size: 18px;
  color: var(--brick-glow);
  text-shadow: 0 0 12px #2ee62e88, 0 4px 0 #000;
  margin: 0 0 12px;
  letter-spacing: 2px;
}
.gate-sub { color: var(--ink-dim); margin: 0 0 22px; font-size: 14px; }
.gate-form {
  display: flex; gap: 8px;
  margin-bottom: 12px;
}
.gate-form input {
  flex: 1;
  background: #0a0d12;
  color: var(--ink);
  border: 2px solid #000;
  border-bottom-width: 4px;
  border-radius: 4px;
  padding: 12px 14px;
  font-family: "Press Start 2P", monospace;
  font-size: 12px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  text-align: center;
  min-height: 44px;
}
.gate-form input:focus {
  outline: none;
  border-color: var(--brick);
  box-shadow: 0 0 0 2px #00c80044;
}
.gate-form button {
  background: var(--brick);
  color: #001a00;
  border: 2px solid #000;
  border-bottom-width: 4px;
  border-radius: 4px;
  padding: 12px 18px;
  font-family: "Press Start 2P", monospace;
  font-size: 11px;
  letter-spacing: 1.5px;
  cursor: pointer;
  min-height: 44px;
}
.gate-form button:hover { background: var(--brick-glow); }
.gate-form button:disabled { opacity: 0.5; cursor: wait; }
.gate-status {
  font-weight: 700;
  letter-spacing: 1px;
  min-height: 22px;
  margin: 8px 0 4px;
  font-size: 13px;
}
.gate-status.ok  { color: var(--brick-glow); text-shadow: 0 0 10px #2ee62e88; }
.gate-status.err { color: var(--warn); }
.gate-hint { color: var(--ink-dim); font-size: 12px; margin: 12px 0 0; }
.gate-screen.expired .gate-form { display: none; }
.gate-screen.expired .gate-emoji { filter: grayscale(0.5); }

@media (max-width: 480px) {
  .gate-box { padding: 24px 18px; }
  .gate-box h1 { font-size: 14px; }
  .gate-form { flex-direction: column; }
  .gate-form input,
  .gate-form button { width: 100%; font-size: 13px; }
  .aaron-stage {
    width: 120px;
    padding-top: 68px;
    padding-bottom: 10px;
  }
  .aaron-platform { width: 110px; height: 14px; margin-left: -55px; }
  .aaron-bubble { font-size: 9px; height: 60px; width: 200px; }
  .aaron-bubble .bubble { padding: 7px 10px; }
}

/* ---- Mini Aaron (desktop-only corner mascot) ---- */
.aaron-mini {
  position: fixed;
  right: 14px;
  bottom: 14px;
  width: 110px;
  z-index: 50;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
}
body.locked .aaron-mini { display: none; }

.aaron-mini-bubble {
  position: relative;
  background: #fff;
  color: #0e1116;
  border: 2px solid #000;
  border-radius: 8px;
  padding: 7px 10px;
  font-family: "Press Start 2P", monospace;
  font-size: 9px;
  line-height: 1.5;
  margin-bottom: 8px;
  text-align: center;
  max-width: 180px;
  white-space: normal;
  box-shadow: 3px 3px 0 #0008;
  opacity: 0;
  transform: translateY(4px) scale(0.9);
  transition: opacity 0.35s ease, transform 0.35s ease;
}
.aaron-mini-bubble.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}
.aaron-mini-bubble::after {
  content: "";
  position: absolute;
  bottom: -8px;
  left: 50%;
  margin-left: -6px;
  width: 12px; height: 12px;
  background: #fff;
  border-right: 2px solid #000;
  border-bottom: 2px solid #000;
  transform: rotate(45deg);
}

.aaron-mini-stage {
  position: relative;
  width: 100%;
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  pointer-events: auto;
  animation: char-bob 2.4s ease-in-out infinite;
  filter: drop-shadow(0 3px 0 #0006);
}
.aaron-mini-stage:hover { transform: scale(1.04); }
.aaron-mini-stage svg {
  width: 100%;
  height: auto;
  display: block;
}

/* Hide on phones — keeps level chat + score form clean */
@media (max-width: 760px) {
  .aaron-mini { display: none !important; }
}

/* ---- Timer ---- */
.timer-wrap {
  display: flex; align-items: center; gap: 8px;
  background: #0a0d12;
  border: 2px solid #000;
  border-bottom-width: 4px;
  border-radius: 4px;
  padding: 6px 14px;
  font-family: "Press Start 2P", monospace;
  font-size: 13px;
  color: var(--brick-glow);
  text-shadow: 0 0 8px #2ee62e88;
  letter-spacing: 1.5px;
}
.timer-wrap.done { color: var(--gold); text-shadow: 0 0 8px #ffd23f88; }
.timer-label { font-size: 14px; }

/* ---- Hint button row ---- */
.hint-row {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 10px;
}
.hint-btn {
  background: var(--gold);
  color: #2a1c00;
  border: 2px solid #000;
  border-bottom-width: 4px;
  border-radius: 4px;
  padding: 8px 14px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  font-size: 12px;
}
.hint-btn:hover { background: #ffe066; transform: translateY(-1px); }
.hint-btn:active { border-bottom-width: 2px; transform: translateY(2px); }
.hint-btn.used { background: var(--panel); color: var(--ink-dim); }
.hint-status { font-size: 12px; color: var(--ink-dim); letter-spacing: 1px; }
.msg.hint {
  align-self: stretch;
  background: #2c1f0a;
  border-color: #4a3010;
  color: var(--gold);
  font-size: 13px;
}
.msg.hint .who { color: var(--gold); }

/* ---- Results screen ---- */
.results { background: var(--panel); border: 2px solid #000; border-bottom-width: 5px; border-radius: 6px; padding: 24px 26px; }
.results h1 {
  font-family: "Press Start 2P", monospace;
  font-size: clamp(18px, 3vw, 26px);
  text-align: center;
  color: var(--brick-glow);
  text-shadow: 0 0 14px #2ee62e88, 0 4px 0 #000;
  margin: 0 0 8px;
}
.results h2 {
  font-family: "Press Start 2P", monospace;
  font-size: 14px;
  color: var(--gold);
  border-top: 2px dashed #000;
  padding-top: 18px;
  margin-top: 28px;
}
.results-subtitle { text-align: center; color: var(--ink-dim); margin: 0 0 24px; }

.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 8px;
}
.stat {
  background: #0a0d12;
  border: 2px solid #000;
  border-bottom-width: 4px;
  border-radius: 4px;
  padding: 14px 12px;
  text-align: center;
}
.stat-label {
  font-family: "Press Start 2P", monospace;
  font-size: 9px;
  color: var(--ink-dim);
  letter-spacing: 1.5px;
  margin-bottom: 8px;
}
.stat-value {
  font-family: "Press Start 2P", monospace;
  font-size: 18px;
  color: var(--brick-glow);
  text-shadow: 0 0 8px #2ee62e66;
}

.skills-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
.skill {
  background: #0a0d12;
  border: 2px solid #000;
  border-bottom-width: 4px;
  border-left-width: 6px;
  border-radius: 4px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.skill .row {
  display: flex; justify-content: space-between; align-items: center;
  gap: 8px;
}
.skill .icon {
  font-family: "Press Start 2P", monospace;
  font-size: 10px;
  letter-spacing: 1px;
}
.skill .nm { font-weight: 800; font-size: 14px; }
.skill .desc { font-size: 12px; color: var(--ink-dim); line-height: 1.4; }
.skill.mastered { border-left-color: var(--brick-glow); }
.skill.mastered .icon { color: var(--brick-glow); }
.skill.assisted { border-left-color: var(--gold); }
.skill.assisted .icon { color: var(--gold); }
.skill.missed   { border-left-color: var(--warn); opacity: 0.7; }
.skill.missed   .icon { color: var(--warn); }

/* ---- Score form ---- */
.form-intro { color: var(--ink-dim); margin: -8px 0 16px; font-size: 14px; }
.score-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 14px;
}
.auto-summary {
  grid-column: 1 / -1;
  background: #0a0d12;
  border: 2px solid #000;
  border-bottom-width: 4px;
  border-left: 6px solid var(--brick-glow);
  border-radius: 4px;
  padding: 12px 14px;
  user-select: none;
}
.auto-summary-label {
  font-family: "Press Start 2P", monospace;
  font-size: 9px;
  color: var(--brick-glow);
  letter-spacing: 1.5px;
  margin-bottom: 10px;
  text-shadow: 0 0 10px #2ee62e66;
}
.auto-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px 10px;
}
.auto-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.auto-cell .k {
  font-family: "Press Start 2P", monospace;
  font-size: 8px;
  color: var(--ink-dim);
  letter-spacing: 1.5px;
}
.auto-cell .v {
  font-family: "Press Start 2P", monospace;
  font-size: 13px;
  color: var(--ink);
  text-shadow: 0 0 6px #2ee62e44;
  letter-spacing: 1px;
  word-break: break-word;
}
@media (max-width: 760px) {
  .auto-summary-grid { grid-template-columns: repeat(2, 1fr); }
  .auto-cell .v { font-size: 11px; }
}
.score-form .field { display: flex; flex-direction: column; gap: 4px; }
.score-form .field.full { grid-column: 1 / -1; }
.score-form label {
  font-family: "Press Start 2P", monospace;
  font-size: 9px;
  letter-spacing: 1.5px;
  color: var(--gold);
}
.score-form input,
.score-form select {
  background: #0a0d12;
  color: var(--ink);
  border: 2px solid #000;
  border-bottom-width: 4px;
  border-radius: 4px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
}
.score-form input:focus,
.score-form select:focus {
  outline: none;
  border-color: var(--brick);
  box-shadow: 0 0 0 2px #00c80044;
}
.submit-btn {
  grid-column: 1 / -1;
  background: var(--brick);
  color: #001a00;
  border: 2px solid #000;
  border-bottom-width: 5px;
  border-radius: 4px;
  padding: 14px 18px;
  font-family: "Press Start 2P", monospace;
  font-size: 13px;
  letter-spacing: 2px;
  margin-top: 8px;
  cursor: pointer;
}
.submit-btn:hover { background: var(--brick-glow); }
.submit-btn:disabled { opacity: 0.5; cursor: wait; }

.form-status {
  margin-top: 14px;
  text-align: center;
  font-weight: 700;
  letter-spacing: 1px;
  min-height: 24px;
}
.form-status.ok { color: var(--brick-glow); }
.form-status.err { color: var(--warn); }

/* ---- Mobile (tablet & phone) ---- */
@media (max-width: 760px) {
  /* Top bar reflows: brand+timer on row 1, nav buttons on row 2 */
  .topbar {
    padding: 10px 12px 8px;
    flex-wrap: wrap;
    gap: 8px;
    row-gap: 8px;
  }
  .brand { font-size: 11px; gap: 8px; flex: 1 1 auto; }
  .stud { width: 22px; height: 22px; }
  .timer-wrap { padding: 4px 10px; font-size: 11px; order: 2; }
  .topnav { order: 3; flex: 1 1 100%; justify-content: space-between; }
  .nav-btn { padding: 8px 10px; font-size: 10px; flex: 1; min-height: 36px; }

  .screen { padding: 18px 12px 60px; }
  .hero h1 { font-size: 18px; line-height: 1.5; }
  .hero-blurb { font-size: 14px; }

  /* Level grid: smaller cards, more per row on small screens */
  .level-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
  }
  .level-card { min-height: 130px; padding: 12px 10px 10px; }
  .level-card .nm { font-size: 14px; }
  .level-card .blurb { font-size: 11px; }

  /* Level header collapses */
  .level-head { grid-template-columns: auto 1fr; padding: 12px; gap: 12px; }
  .level-head .status { grid-column: 1 / -1; text-align: center; }
  .avatar { width: 52px; height: 52px; font-size: 28px; }
  .level-meta h2 { font-size: 18px; }

  /* Hint row */
  .hint-row { flex-wrap: wrap; gap: 8px; }
  .hint-status { font-size: 11px; flex: 1 1 100%; }
  .hint-btn { min-height: 40px; }

  /* Chat */
  .chat { height: 50vh; min-height: 280px; padding: 10px; }
  .msg { max-width: 88%; font-size: 14px; padding: 9px 11px; }

  /* Inputs: 16px font-size prevents iOS Safari from zooming on focus */
  .chat-form input,
  .guess-form input,
  .score-form input,
  .score-form select {
    font-size: 16px;
    min-height: 44px;
  }
  .chat-form button,
  .guess-form button { min-height: 44px; padding: 10px 14px; }

  /* Guess form stacks */
  .guess-form { grid-template-columns: 1fr; gap: 8px; }
  .guess-form label { text-align: left; }

  /* Foot nav buttons */
  .level-foot .nav-btn { min-height: 40px; padding: 8px 14px; }

  /* Stats + skills + results */
  .stats-row { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .stat { padding: 10px 8px; }
  .stat-value { font-size: 14px; }
  .stat-label { font-size: 8px; }
  .results { padding: 18px 14px; }
  .results h1 { font-size: 18px; line-height: 1.5; }
  .results h2 { font-size: 12px; }
  .skills-list { grid-template-columns: 1fr; }

  /* Score form stacks */
  .score-form { grid-template-columns: 1fr; gap: 10px; }
  .submit-btn { min-height: 48px; font-size: 12px; }

  /* Help screen tighter */
  .help { padding: 16px 14px; }
  .help h2 { font-size: 14px; }
  .help h3 { font-size: 11px; }
}

/* ---- Very small phones (<400px) ---- */
@media (max-width: 400px) {
  .brand .title { font-size: 10px; }
  .timer-wrap { font-size: 10px; padding: 4px 8px; }
  .nav-btn { font-size: 9px; padding: 8px 6px; }
  .level-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
  .level-card { min-height: 120px; }
  .level-card .av { font-size: 24px; }
  .level-card .nm { font-size: 13px; }
  .hero h1 { font-size: 16px; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  .msg { max-width: 92%; font-size: 13px; }
}

/* Always: prevent horizontal scroll surprises */
html, body { overflow-x: hidden; max-width: 100%; }
img, video { max-width: 100%; }
