/* ByteMan – Estilo Tech Formula Race / Labirinto Digital */
:root {
  --tfr-cyan: #00f0ff;
  --tfr-magenta: #ff00d4;
  --tfr-yellow: #ffe600;
  --tfr-green: #19ff8a;
  --bg-dark: #05010f;
  --bg-panel: rgba(10, 6, 30, 0.72);
  --border-glow: rgba(0, 240, 255, 0.35);
  --text-dim: #8fa9c9;
}

* { box-sizing: border-box; }

button,
a,
.logo-line,
.logo-sub,
.brand-logo,
.neon-btn,
.btn-tfr-primary,
.btn-tfr-ghost,
label,
h1, h2, h3, p, span, strong {
  text-decoration: none !important;
}

body {
  margin: 0;
  padding: 0;
  background: var(--bg-dark);
  color: #e7f7ff;
  font-family: 'Segoe UI', system-ui, sans-serif;
  overflow: hidden;
  min-height: 100vh;
  min-height: 100dvh;
  height: 100dvh;
  user-select: none;
}

#bg-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

.scanlines {
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.06) 2px,
    rgba(0, 0, 0, 0.06) 4px
  );
  pointer-events: none;
  z-index: 1;
}

#screen-game .scanlines-game {
  position: absolute;
  inset: 0;
  z-index: 4;
  opacity: 0.5;
  pointer-events: none;
}

#app {
  width: 100%;
  height: 100vh;
  height: 100dvh;
  position: relative;
  z-index: 2;
  overflow: hidden;
}

.screen {
  display: none;
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
}

.screen.active {
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-y: auto;
}

#screen-menu.active,
#screen-gameover.active,
#screen-levelcomplete.active {
  justify-content: center;
  padding: 24px 16px;
  overflow-y: auto;
}

#screen-game.active {
  justify-content: flex-start;
  align-items: stretch;
  overflow: hidden;
}

/* LPP branding */
.lpp-logo {
  display: inline-block;
  height: clamp(40px, 10vw, 56px);
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 0 12px rgba(0, 229, 255, 0.35));
}

.lpp-logo-small {
  height: clamp(24px, 6vw, 32px);
}

.footer-logo {
  display: inline-block;
  height: clamp(36px, 9vw, 52px);
  width: auto;
  object-fit: contain;
  opacity: 0.95;
  filter: drop-shadow(0 0 8px rgba(0, 229, 255, 0.2));
}

.lpp-header, .lpp-footer {
  width: 100%;
  text-align: center;
  flex-shrink: 0;
}

.lpp-header { padding: 1rem 1rem 0; }
.lpp-footer {
  padding: 1rem;
  color: var(--text-dim);
  font-size: 0.85rem;
  margin-top: auto;
}

.code-tag {
  font-family: 'Consolas', 'Courier New', monospace;
  color: var(--tfr-magenta);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  margin: 0 0 0.5rem;
}

.code-tag.small { font-size: 0.65rem; }

/* Menu — padrão Tech Formula Race */
.start-inner {
  position: relative;
  z-index: 3;
  width: min(720px, 100%);
  background: var(--bg-panel);
  border: 1px solid var(--border-glow);
  border-radius: 18px;
  padding: 30px 28px;
  backdrop-filter: blur(8px);
  box-shadow: 0 0 40px rgba(0, 240, 255, 0.18), inset 0 0 30px rgba(255, 0, 212, 0.06);
  text-align: center;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0 32px;
}

.start-footer { grid-column: 1 / -1; }

@media (min-width: 980px) and (orientation: landscape) {
  #screen-menu.active { padding: 24px 32px; }
  .start-inner {
    width: min(1240px, 96%);
    grid-template-columns: minmax(360px, 460px) 1fr;
    align-items: start;
    padding: 30px 38px;
  }
  .start-info { text-align: left; }
  .start-info .instructions { margin-top: 0; }
  .start-info .top5 { margin-top: 16px; }
  .instructions-grid { grid-template-columns: 1fr 1fr; }
  .instructions-grid .ctrl-block:last-child { grid-column: 1 / -1; }
  .logo-line { font-size: clamp(38px, 5vw, 64px); }
}

@media (min-width: 1500px) and (orientation: landscape) {
  .start-inner { width: min(1480px, 94%); }
  .instructions-grid { grid-template-columns: repeat(3, 1fr); }
  .instructions-grid .ctrl-block:last-child { grid-column: auto; }
}

.brand-logo {
  height: clamp(64px, 14vw, 96px);
  margin: 0 auto 14px;
  display: block;
  padding: 8px 16px;
  background: rgba(245, 250, 255, 0.95);
  border: 1px solid var(--border-glow);
  border-radius: 12px;
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.35);
  object-fit: contain;
}

.logo {
  line-height: 0.92;
  margin-bottom: 12px;
  letter-spacing: 4px;
  font-weight: 800;
}

.logo-line {
  display: block;
  font-size: clamp(38px, 9vw, 72px);
  color: #fff;
  text-shadow: 0 0 8px var(--tfr-cyan), 0 0 24px var(--tfr-cyan);
}

.logo-line.accent {
  color: var(--tfr-magenta);
  text-shadow: 0 0 10px var(--tfr-magenta), 0 0 30px var(--tfr-magenta);
}

.logo-sub {
  display: block;
  margin-top: 12px;
  font-size: clamp(11px, 2.4vw, 14px);
  letter-spacing: 6px;
  color: var(--tfr-green);
  text-shadow: 0 0 8px var(--tfr-green);
  animation: scan 3s linear infinite;
}

@keyframes flicker {
  0%, 18%, 22%, 25%, 53%, 57%, 100% { opacity: 1; }
  20%, 24%, 55% { opacity: 0.55; }
}

@keyframes scan {
  0% { opacity: 0.4; }
  50% { opacity: 1; }
  100% { opacity: 0.4; }
}

.menu-panel {
  width: min(560px, 94vw);
  padding: 1rem 1.25rem 2rem;
  text-align: center;
}

.game-title {
  font-size: clamp(2.2rem, 9vw, 3.5rem);
  font-weight: 900;
  letter-spacing: 0.12em;
  margin: 0;
  color: #fff;
  text-shadow: 0 0 24px rgba(0, 229, 255, 0.5);
}

.game-title span { color: var(--tfr-cyan); }

.game-subtitle {
  color: var(--text-dim);
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin: 0 0 1.25rem;
}

.start-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 18px auto 20px;
  max-width: 420px;
}

.start-form.narrow { max-width: 320px; margin: 1rem auto; }

.start-form label {
  font-size: 13px;
  color: var(--tfr-cyan);
  text-transform: uppercase;
  letter-spacing: 2px;
  text-align: left;
}

.tfr-input {
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--border-glow);
  color: #fff;
  padding: 14px 16px;
  border-radius: 10px;
  font-size: 18px;
  outline: none;
  transition: box-shadow 0.2s, border-color 0.2s;
}

.tfr-input:focus {
  border-color: var(--tfr-cyan);
  box-shadow: 0 0 16px rgba(0, 240, 255, 0.5);
}

.btn-tfr-primary,
.neon-btn {
  cursor: pointer;
  padding: 15px 22px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 3px;
  color: #021018;
  background: linear-gradient(135deg, var(--tfr-cyan), var(--tfr-green));
  border: none;
  border-radius: 10px;
  text-transform: uppercase;
  transition: transform 0.12s, box-shadow 0.2s;
  box-shadow: 0 0 18px rgba(0, 240, 255, 0.55);
}

.btn-tfr-primary:hover,
.neon-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 28px rgba(0, 240, 255, 0.85);
  color: #021018;
}

.btn-tfr-ghost,
.ghost-btn {
  cursor: pointer;
  padding: 13px 20px;
  font-size: 14px;
  letter-spacing: 2px;
  background: transparent;
  color: var(--tfr-magenta);
  border: 1px solid var(--tfr-magenta);
  border-radius: 10px;
  transition: background 0.2s;
}

.btn-tfr-ghost:hover,
.ghost-btn:hover {
  background: rgba(255, 0, 212, 0.12);
  color: var(--tfr-magenta);
  border-color: var(--tfr-magenta);
}

.menu-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.controls-card {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  text-align: left;
  margin-bottom: 0;
}

.instructions h2,
.controls-card h2 {
  font-size: 16px;
  letter-spacing: 3px;
  color: var(--tfr-yellow);
  text-transform: uppercase;
  margin-bottom: 12px;
  text-align: center;
}

.instructions-grid,
.controls-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
}

.ctrl-block {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(0, 240, 255, 0.2);
  border-radius: 12px;
  padding: 14px;
}

.ctrl-block h3,
.controls-card h3 {
  font-size: 14px;
  color: var(--tfr-cyan);
  margin-bottom: 8px;
  letter-spacing: 2px;
}

.ctrl-block ul,
.controls-card ul {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 14px;
  line-height: 1.9;
  color: var(--text-dim);
}

kbd {
  display: inline-block;
  min-width: 24px;
  text-align: center;
  padding: 2px 7px;
  margin-right: 4px;
  background: #111;
  border: 1px solid var(--tfr-cyan);
  border-radius: 6px;
  color: var(--tfr-cyan);
  font-size: 13px;
  font-family: inherit;
}

.controls-card li { margin-bottom: 0; }

.quiz-hint,
.tip {
  margin-top: 14px;
  font-size: 13px;
  color: var(--tfr-green);
  text-align: center;
  line-height: 1.5;
}

.quiz-hint strong { color: var(--tfr-yellow); }

.ranking-preview,
.top5 {
  text-align: left;
  margin-top: 18px;
  background: transparent;
  border: none;
  padding: 0;
}

.ranking-preview h2,
.top5 h2 {
  font-size: 15px;
  letter-spacing: 3px;
  color: var(--tfr-yellow);
  margin-bottom: 10px;
  text-transform: uppercase;
  text-align: center;
}

.ranking-preview ol,
.top5 ol {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: rank;
  font-size: 14px;
  color: var(--text-dim);
}

.ranking-preview ol li,
.top5 ol li {
  counter-increment: rank;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  margin-bottom: 5px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(0, 240, 255, 0.18);
  border-radius: 10px;
}

.ranking-preview ol li::before,
.top5 ol li::before {
  content: counter(rank) "º";
  width: 32px;
  color: var(--tfr-cyan);
  font-weight: 800;
  flex-shrink: 0;
}

.ranking-status {
  text-align: center;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.65);
  margin: 0.75rem 0 0;
}

.ranking-status.in-top5 {
  color: var(--tfr-yellow);
  text-shadow: 0 0 8px rgba(255, 230, 0, 0.35);
}

.go-top5 {
  margin-top: 0.75rem;
  margin-bottom: 0.25rem;
}

.go-top5 ol li {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
}

.go-top5 ol li.me {
  color: var(--tfr-yellow);
  border-color: rgba(255, 230, 0, 0.45);
  background: rgba(255, 230, 0, 0.08);
}

.go-top5 .r-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.go-top5 .r-score {
  color: var(--tfr-cyan);
  font-variant-numeric: tabular-nums;
}

.audio-hint {
  margin-top: 14px;
  font-size: 12px;
  color: var(--text-dim);
  text-align: center;
}

.start-footer .lpp-footer {
  margin-top: 12px;
  padding: 0;
}

/* Game top bar + HUD */
.game-top-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.4rem 0.75rem;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border-glow);
  flex-shrink: 0;
  flex-wrap: wrap;
}

.player-tag {
  margin-left: auto;
  font-size: 0.8rem;
  color: var(--text-dim);
}

.player-tag strong { color: #fff; }

.hud-retro-wrap {
  display: flex;
  width: 100%;
  min-height: 76px;
  background: #000;
  flex-shrink: 0;
  border-bottom: 1px solid #1a1a1a;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.6);
}

.hud-frame-cap {
  width: clamp(52px, 9vw, 78px);
  flex-shrink: 0;
  background: url('../assets/images/hud-bar.png') no-repeat;
  background-size: auto 100%;
}

.hud-frame-left { background-position: left center; }
.hud-frame-right { background-position: right center; }

.hud-board {
  display: flex;
  flex: 1;
  flex-wrap: nowrap;
  gap: 0;
  padding: 0.45rem 0.25rem;
  background: #000;
  min-width: 0;
  align-items: stretch;
}

.hud-board .hud-cell {
  flex: 1 1 0;
  min-width: 0;
  background: transparent;
  border: none;
  border-right: 2px solid rgba(57, 255, 20, 0.45);
  box-shadow: 1px 0 8px rgba(57, 255, 20, 0.15);
  border-radius: 0;
  padding: 0.2rem 0.35rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.hud-board .hud-cell:last-child {
  border-right: none;
  box-shadow: none;
}

.hud-board .hud-cell span {
  display: block;
  font-size: clamp(0.45rem, 1.8vw, 0.58rem);
  color: #39ff14;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-family: 'Segoe UI', system-ui, sans-serif;
  font-weight: 600;
  text-shadow: 0 0 6px rgba(57, 255, 20, 0.6);
  margin-bottom: 0.15rem;
}

.hud-board .hud-cell strong {
  font-size: clamp(0.85rem, 3.2vw, 1.35rem);
  font-weight: 400;
  font-family: 'Share Tech Mono', 'Consolas', monospace;
  color: #39ff14;
  text-shadow:
    0 0 6px rgba(57, 255, 20, 0.9),
    0 0 14px rgba(57, 255, 20, 0.45);
  line-height: 1.1;
}

.hud-turbo span {
  color: #ffd54a !important;
  text-shadow: 0 0 6px rgba(255, 213, 74, 0.7) !important;
}

.hud-turbo strong {
  color: #ffd54a !important;
  text-shadow:
    0 0 6px rgba(255, 213, 74, 0.95),
    0 0 14px rgba(255, 180, 0, 0.5) !important;
}

.hud-lives-icons {
  display: inline-flex;
  gap: 5px;
  justify-content: center;
  align-items: flex-end;
  min-height: 1.5rem;
}

.hud-life-pc {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  opacity: 1;
  transition: opacity 0.2s, filter 0.2s;
}

.hud-life-pc.lost {
  opacity: 0.22;
  filter: grayscale(1);
}

.hud-life-screen {
  width: clamp(16px, 4vw, 22px);
  height: clamp(12px, 3vw, 16px);
  background: linear-gradient(180deg, #1a3a5a 0%, #0d2038 100%);
  border: 1px solid #b0b0b0;
  border-radius: 1px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(6px, 1.6vw, 8px);
  color: #00e5ff;
  box-shadow: 0 0 6px rgba(0, 229, 255, 0.45);
  line-height: 1;
}

.hud-life-base {
  width: 55%;
  height: 3px;
  background: #6a6a6a;
  margin-top: 1px;
  border-radius: 0 0 1px 1px;
}

.hud-life-key {
  width: 70%;
  height: 2px;
  background: #4a4a4a;
  margin-top: 1px;
}

.hud-turbo.turbo-active strong {
  animation: turbo-hud-blink 0.55s ease-in-out infinite;
}

@keyframes turbo-hud-blink {
  50% { opacity: 0.55; }
}
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.4rem 0.5rem;
  background: rgba(6, 10, 18, 0.95);
  border-bottom: 1px solid var(--border-glow);
  flex-shrink: 0;
}

.hud-cell {
  flex: 1 1 70px;
  min-width: 60px;
  background: rgba(0, 229, 255, 0.06);
  border: 1px solid rgba(0, 229, 255, 0.2);
  border-radius: 4px;
  padding: 0.25rem 0.5rem;
  text-align: center;
}

.hud-cell span {
  display: block;
  font-size: 0.6rem;
  color: var(--tfr-cyan);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.hud-cell strong {
  font-size: 0.95rem;
  font-weight: 700;
}

.turbo-cell strong { color: var(--tfr-yellow); animation: turbo-blink 0.6s infinite; }

@keyframes turbo-blink { 50% { opacity: 0.5; } }

#game-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 0;
  overflow: hidden;
  position: relative;
}

#canvas-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  position: relative;
  min-height: 0;
  overflow: hidden;
  padding: 6px;
}

#game-canvas {
  display: block;
  border: 2px solid rgba(201, 162, 39, 0.5);
  border-radius: 4px;
  box-shadow: 0 0 28px rgba(255, 213, 74, 0.15), inset 0 0 40px rgba(0, 0, 0, 0.3);
  touch-action: none;
  image-rendering: auto;
  background: #0a2218;
}

.pause-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
}

.pause-panel {
  background: var(--bg-panel);
  border: 1px solid var(--border-glow);
  border-radius: 8px;
  padding: 1.5rem;
  text-align: center;
  min-width: 240px;
}

.pause-panel h2 {
  margin: 0 0 1rem;
  letter-spacing: 0.2em;
}

.pause-panel .btn-tfr-primary,
.pause-panel .btn-tfr-ghost {
  display: block;
  width: 100%;
  margin-bottom: 0.5rem;
}

.game-toolbar {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.35rem;
  flex-shrink: 0;
}

.tool-btn {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  border: 1px solid var(--border-glow);
  background: rgba(0, 229, 255, 0.1);
  color: var(--tfr-cyan);
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.15s;
}

.tool-btn:hover, .tool-btn.active {
  background: rgba(0, 229, 255, 0.3);
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.3);
}

.tool-btn.muted { opacity: 0.45; }

/* Mobile controls */
#mobile-controls {
  position: relative;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 0.5rem;
  padding: 0.25rem 0.5rem 0.5rem;
  flex-shrink: 0;
  pointer-events: none;
}

#mobile-controls > * { pointer-events: auto; }

.joystick-base {
  width: clamp(90px, 22vw, 120px);
  height: clamp(90px, 22vw, 120px);
  border-radius: 50%;
  background: rgba(0, 229, 255, 0.08);
  border: 2px solid rgba(0, 229, 255, 0.35);
  position: relative;
  touch-action: none;
  user-select: none;
}

.joystick-knob {
  width: 40%;
  height: 40%;
  border-radius: 50%;
  background: rgba(0, 229, 255, 0.35);
  border: 2px solid var(--tfr-cyan);
  position: absolute;
  top: 50%;
  left: 50%;
  margin: -20% 0 0 -20%;
  box-shadow: 0 0 12px rgba(0, 229, 255, 0.4);
  pointer-events: none;
}

.dpad-cluster {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.ctrl-row { display: flex; gap: 4px; }

.ctrl-btn {
  width: clamp(40px, 11vw, 52px);
  height: clamp(40px, 11vw, 52px);
  background: rgba(0, 229, 255, 0.15);
  border: 1px solid var(--tfr-cyan);
  border-radius: 8px;
  color: var(--tfr-cyan);
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
}

.ctrl-btn:active { background: rgba(0, 229, 255, 0.45); }

/* End screens */
.end-panel {
  width: min(480px, 94vw);
  padding: 2rem 1.25rem;
  text-align: center;
}

.end-panel.start-inner {
  width: min(560px, 94vw);
  display: block;
}

.end-title {
  font-size: clamp(1.2rem, 5vw, 1.6rem);
  letter-spacing: 0.08em;
  margin: 0.5rem 0 1.25rem;
  color: #fff;
  text-shadow: 0 0 12px var(--tfr-cyan);
}

.text-success-glow { color: var(--tfr-green); text-shadow: 0 0 16px rgba(57, 255, 20, 0.5); }

.end-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 1rem;
  text-align: left;
}

.end-stats > div {
  background: var(--bg-panel);
  border: 1px solid var(--border-glow);
  border-radius: 6px;
  padding: 0.6rem 0.75rem;
}

.end-stats span {
  display: block;
  font-size: 0.7rem;
  color: var(--tfr-cyan);
  text-transform: uppercase;
}

.end-stats strong { font-size: 1.1rem; }

.bonus-text { color: var(--tfr-yellow); margin-bottom: 1rem; }

/* Audio unlock */
.audio-unlock {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  padding: 0.75rem;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.9));
  text-align: center;
  transition: opacity 0.4s, transform 0.4s;
}

.audio-unlock.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(100%);
}

.audio-unlock button {
  background: rgba(0, 229, 255, 0.15);
  border: 1px solid var(--tfr-cyan);
  color: var(--tfr-cyan);
  padding: 0.65rem 1.25rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
}

/* Modals */
.modal-tfr {
  background: var(--bg-panel);
  border: 1px solid var(--border-glow);
  color: #e8f0ff;
  box-shadow: 0 0 40px rgba(0, 229, 255, 0.2);
}

.modal-tfr .modal-title { color: var(--tfr-cyan); }

.table-tfr th { color: var(--tfr-cyan); border-color: rgba(0, 229, 255, 0.2); }
.table-tfr td { border-color: rgba(0, 229, 255, 0.1); }

.quiz-question { font-size: 1.1rem; line-height: 1.5; }

.quiz-option {
  text-align: left;
  padding: 0.75rem 1rem;
  background: rgba(0, 229, 255, 0.08);
  border: 1px solid rgba(0, 229, 255, 0.3);
  color: #e8f0ff;
  border-radius: 6px;
  transition: all 0.15s;
  cursor: pointer;
}

.quiz-option:hover { background: rgba(0, 229, 255, 0.2); border-color: var(--tfr-cyan); }
.quiz-option.selected {
  background: rgba(255, 230, 0, 0.12);
  border-color: var(--tfr-yellow);
  box-shadow: 0 0 14px rgba(255, 230, 0, 0.35);
}
.quiz-option.correct { background: rgba(57, 255, 20, 0.2); border-color: var(--tfr-green); }
.quiz-option.wrong { background: rgba(255, 0, 0, 0.2); border-color: #ff4444; }

.quiz-controls-hint {
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.55);
  text-align: center;
  letter-spacing: 0.04em;
}

body.quiz-open #mobile-controls {
  z-index: 1065;
  position: fixed;
  bottom: 0.5rem;
  left: 0;
  right: 0;
  padding-bottom: env(safe-area-inset-bottom, 0.5rem);
}

body.quiz-open .joystick-base {
  border-color: var(--tfr-yellow);
  box-shadow: 0 0 18px rgba(255, 230, 0, 0.25);
}

body.quiz-open .joystick-knob {
  background: rgba(255, 230, 0, 0.4);
  border-color: var(--tfr-yellow);
}

.howto-text ul { padding-left: 1.2rem; }
.howto-text li { margin-bottom: 0.5rem; }

@media (min-width: 992px) {
  #mobile-controls { display: none !important; }

  #screen-game.active {
    display: grid;
    grid-template-columns: minmax(200px, 228px) minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-areas:
      "top top"
      "hud game";
    align-items: stretch;
    overflow: hidden;
  }

  #screen-game .game-top-bar {
    grid-area: top;
    flex-shrink: 0;
  }

  #screen-game .hud-retro-wrap {
    grid-area: hud;
    flex-direction: column;
    width: 100%;
    min-height: 0;
    height: 100%;
    border-bottom: none;
    border-right: 1px solid #1a1a1a;
  }

  #screen-game .hud-frame-cap { display: none; }

  #screen-game .hud-board {
    flex-direction: column;
    justify-content: space-evenly;
    padding: 0.75rem 0.5rem;
    height: 100%;
  }

  #screen-game .hud-board .hud-cell {
    flex: 0 0 auto;
    border-right: none;
    border-bottom: 2px solid rgba(57, 255, 20, 0.35);
    box-shadow: none;
    padding: 0.55rem 0.35rem;
  }

  #screen-game .hud-board .hud-cell:last-child {
    border-bottom: none;
  }

  #screen-game .hud-board .hud-cell span {
    font-size: 0.52rem;
    margin-bottom: 0.25rem;
  }

  #screen-game .hud-board .hud-cell strong {
    font-size: 1.15rem;
  }

  #screen-game #game-area {
    grid-area: game;
    min-width: 0;
    min-height: 0;
  }

  #screen-game #canvas-wrapper {
    padding: 8px 16px;
  }

  #screen-game #game-canvas {
    max-width: 100%;
    max-height: 100%;
  }
}

@media (max-width: 991px) {
  .hud-cell { min-width: 52px; }
  .game-top-bar .code-tag { display: none; }
}

@media (max-width: 576px) {
  .hud-retro-wrap { min-height: 64px; }
  .hud-frame-cap { width: 36px; }
  .hud-board .hud-cell { padding: 0.15rem 0.2rem; }
  .hud-board .hud-cell span { letter-spacing: 0.06em; }
}
