/* --- 1. CORE VARIABLES --- */
:root {
  --bg: #050505;
  --accent: #ffffff;
  --accent-dim: rgba(255, 255, 255, 0.2);
  --accent-glow: rgba(255, 255, 255, 0.6);
  --scanline-opacity: 0.5;
  --common: #b0b0b0;
  --rare: #00ccff;
  --epic: #d000ff;
  --leg: #ffd700;
  --font-main: "Press Start 2P", monospace;
  --font-type: "Roboto Mono", monospace;
}

/* RAINBOW MODE */
@keyframes rgbLoop {
  0% {
    --accent: #ff0000;
  }
  20% {
    --accent: #ffff00;
  }
  40% {
    --accent: #00ff00;
  }
  60% {
    --accent: #00ffff;
  }
  80% {
    --accent: #0000ff;
  }
  100% {
    --accent: #ff00ff;
  }
}
body.rainbow-mode {
  animation: rgbLoop 5s linear infinite;
  --accent-dim: rgba(255, 255, 255, 0.2);
  --accent-glow: rgba(255, 255, 255, 0.5);
  will-change: color, text-shadow;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  cursor: default;
  user-select: none;
}
button,
input,
.bj-card,
.ttt-cell,
.chat-input {
  cursor: pointer;
}

html,
body {
  height: 100%;
  margin: 0;
  background-color: var(--bg);
  font-family: var(--font-main);
  overflow-x: hidden;
  color: var(--accent);
  touch-action: auto;
  text-shadow: 0 0 10px var(--accent);
  transition:
    color 0.5s,
    text-shadow 0.5s;
}

/* --- 2. VISUAL EFFECTS --- */
/* Matrix rain canvas sits beneath the UI and toggles via .active. */
#matrixCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  opacity: 0.8;
  pointer-events: none;
  display: none;
  border: none;
  box-shadow: none;
  margin: 0;
  max-width: none;
  max-height: none;
}
#matrixCanvas.active {
  display: block;
}

/* Boot/hack overlay used during "root access" animation. */
#hackOverlay {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 99999;
  display: none;
  flex-direction: column;
  justify-content: flex-end;
  padding: 20px;
  font-family: var(--font-type);
  color: #0f0;
  font-size: 12px;
  pointer-events: none;
}
#hackOverlay.active {
  display: flex;
}

/* CRT scanline overlay (global). */
body::before {
  content: " ";
  display: block;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  background:
    linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%),
    linear-gradient(
      90deg,
      rgba(255, 0, 0, 0.06),
      rgba(0, 255, 0, 0.02),
      rgba(0, 0, 255, 0.06)
    );
  z-index: 99999;
  background-size:
    100% 2px,
    3px 100%;
  pointer-events: none;
  opacity: var(--scanline-opacity);
  will-change: opacity, transform;
  transform: translateZ(0);
}
/* Subtle flicker vignette when flicker mode is enabled. */
.flicker-on::after {
  content: " ";
  display: block;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  background: radial-gradient(
    circle,
    rgba(0, 0, 0, 0) 60%,
    rgba(0, 0, 0, 0.4) 100%
  );
  z-index: 99999;
  pointer-events: none;
  animation: flicker 0.15s infinite;
}
@keyframes flicker {
  0% {
    opacity: 0.95;
  }
  50% {
    opacity: 0.85;
  }
  100% {
    opacity: 0.98;
  }
}

/* --- 3. LAYOUT & UI --- */
/* Central landing layout. */
.wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  position: relative;
  z-index: 10;
  padding: 90px 20px 260px;
  width: 100%;
  gap: 12px;
}

/* Sticky top navigation bar with system status. */
.top-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 50px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
  z-index: 2000;
  background: rgba(0, 0, 0, 0.9);
  border-bottom: 1px solid var(--accent);
}
.menu-btn {
  background: transparent;
  color: var(--accent);
  padding: 8px 12px;
  font-family: inherit;
  font-size: 10px;
  border: 1px solid var(--accent);
  text-transform: uppercase;
  transition: 0.2s;
}
.menu-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}
.menu-btn:hover {
  background: var(--accent);
  color: #000;
  box-shadow: 0 0 10px var(--accent);
}
.sys-info {
  display: flex;
  gap: 15px;
  font-size: 8px;
  color: var(--accent);
  opacity: 0.8;
}

/* Games dropdown menu anchored to the top bar. */
.dropdown-content {
  display: none !important;
  position: absolute;
  right: 20px;
  top: 50px;
  background-color: #000;
  min-width: 200px;
  border: 1px solid var(--accent);
  border-top: none;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.8);
  z-index: 2001;
}
.dropdown-content.show {
  display: block;
}
.dropdown-content button {
  background: transparent;
  color: var(--accent);
  padding: 15px;
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  border-bottom: 1px solid var(--accent-dim);
  font-family: inherit;
  font-size: 10px;
  transition: 0.2s;
}
.dropdown-content button:hover {
  background-color: var(--accent-dim);
  padding-left: 20px;
}

/* --- 4. CHAT --- */
/* Global chat dock on the home screen. */
#globalChat {
  position: fixed;
  bottom: 20px;
  left: 20px;
  width: 300px;
  height: 200px;
  background: rgba(0, 0, 0, 0.8);
  border: 1px solid var(--accent);
  z-index: 60;
  display: flex;
  flex-direction: column;
  font-size: 10px;
  box-shadow: 0 0 18px var(--accent-dim);
  pointer-events: auto;
  touch-action: auto;
}
.home-chat {
  z-index: 50;
}
.chat-header {
  padding: 8px 10px;
  border-bottom: 1px solid var(--accent-dim);
  font-size: 9px;
  letter-spacing: 1px;
  text-align: center;
  color: #fff;
}
#chatHistory {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  color: #fff;
  text-shadow: none;
  user-select: text;
}
.chat-msg {
  margin-bottom: 5px;
  word-wrap: break-word;
}
.chat-user {
  color: var(--accent);
  font-weight: bold;
}
#chatInput {
  background: #000;
  border: none;
  border-top: 1px solid var(--accent);
  color: var(--accent);
  padding: 10px;
  font-family: inherit;
  outline: none;
  cursor: text;
  user-select: text;
  touch-action: auto;
}
.chat-box {
  max-width: 760px;
  width: min(90vw, 760px);
}

/* --- 5. MAIN LOGO --- */
.gooner-btn {
  font-size: clamp(30px, 10vw, 80px);
  color: var(--accent);
  cursor: pointer;
  padding: 40px 60px;
  border: 4px solid var(--accent);
  background: rgba(0, 0, 0, 0.8);
  box-shadow:
    0 0 20px var(--accent-dim),
    inset 0 0 30px var(--accent-dim);
  text-shadow: 0 0 15px var(--accent);
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
  margin-bottom: 40px;
  text-transform: uppercase;
  z-index: 20;
  letter-spacing: 5px;
}
.gooner-btn:hover {
  transform: scale(1.05);
  box-shadow:
    0 0 50px var(--accent-glow),
    inset 0 0 50px var(--accent-glow);
  background: var(--accent);
  color: #000;
  text-shadow: none;
}
.subtitle {
  color: var(--accent);
  font-size: 10px;
  opacity: 0.7;
  margin-top: -20px;
  text-transform: uppercase;
  letter-spacing: 4px;
  text-align: center;
}

.trending-games {
  margin-top: 24px;
  width: min(90vw, 680px);
  border: 1px solid var(--accent-dim);
  background: rgba(0, 0, 0, 0.75);
  padding: 14px 16px;
  box-shadow: 0 0 16px rgba(0, 255, 136, 0.12);
  text-align: left;
}

.trending-games h2 {
  margin: 0 0 8px;
  font-size: 11px;
  letter-spacing: 2px;
  color: #fff;
}

.trending-meta {
  font-size: 8px;
  color: var(--accent);
  opacity: 0.9;
  margin-bottom: 10px;
}

.trending-games-list {
  display: grid;
  gap: 8px;
}

.trending-game-btn {
  width: 100%;
  border: 1px solid var(--accent-dim);
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 9px;
  letter-spacing: 1px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  text-transform: uppercase;
  transition: 0.18s ease;
}

.trending-game-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 12px rgba(0, 255, 136, 0.2);
}

.trending-rank {
  color: var(--accent);
}

.trending-count {
  opacity: 0.86;
}

.trending-empty {
  border: 1px dashed var(--accent-dim);
  padding: 10px;
  font-size: 9px;
  opacity: 0.75;
}

.update-log {
  margin-top: 24px;
  width: min(90vw, 680px);
  border: 1px solid var(--accent-dim);
  background: rgba(0, 0, 0, 0.75);
  padding: 14px 16px;
  box-shadow: 0 0 16px rgba(0, 255, 136, 0.12);
  text-align: left;
}

.update-log h2 {
  margin: 0 0 10px;
  font-size: 11px;
  letter-spacing: 2px;
  color: #fff;
}

.update-log ul {
  margin: 0;
  padding-left: 16px;
  display: grid;
  gap: 8px;
  font-size: 9px;
  line-height: 1.5;
}

.update-log li span {
  color: var(--accent);
}

.live-ops {
  margin-top: 14px;
  width: min(90vw, 680px);
  border: 1px solid var(--accent-dim);
  background: rgba(0, 0, 0, 0.75);
  padding: 14px 16px;
  text-align: left;
}

.live-ops h2 {
  margin: 0 0 8px;
  font-size: 11px;
  letter-spacing: 2px;
  color: #fff;
}

.live-ops-line {
  font-size: 9px;
  margin-bottom: 10px;
  color: var(--accent);
}

.live-ops-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.live-ops-grid div {
  border: 1px solid var(--accent-dim);
  padding: 8px;
  display: grid;
  gap: 4px;
}

.live-ops-grid span {
  font-size: 8px;
  opacity: 0.8;
}

.live-ops-grid strong {
  font-size: 9px;
  color: #fff;
}

.season-mission-done {
  color: #0f0;
}

.season-tab-block {
  width: 100%;
  margin: 10px 0;
}

.season-subtabs {
  margin-top: 8px;
}

.season-board-title {
  margin: 10px 0 6px;
  text-align: center;
  font-size: 10px;
  letter-spacing: 1px;
}

.crew-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

/* --- 6. OVERLAYS & MODALS --- */
/* Overlay container for modals and game screens. */
.overlay {
  position: fixed;
  inset: 0;
  background: #000;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  z-index: 1000;
  overflow-y: auto;
  padding: 20px;
}
.overlay.active {
  display: flex !important;
}
.menu-box {
  background: rgba(0, 0, 0, 0.9);
  border: 2px solid var(--accent);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 15px;
  text-align: center;
  min-width: 300px;
  box-shadow: 0 0 15px var(--accent-dim);
}

/* LOGIN */
#overlayLogin {
  background: rgba(0, 0, 0, 0.98);
  z-index: 9000;
}
.login-box {
  border: 2px solid var(--accent);
  padding: 40px;
  text-align: center;
  box-shadow: 0 0 30px var(--accent-dim);
  background: #050505;
  width: 400px;
}

/* INPUTS */
.term-input {
  background: transparent;
  border: 2px solid var(--accent);
  color: var(--accent);
  padding: 15px;
  font-family: inherit;
  text-align: center;
  font-size: 20px;
  outline: none;
  margin-bottom: 20px;
  width: 100%;
}
.term-btn {
  background: var(--accent);
  color: #000;
  border: none;
  padding: 15px;
  font-family: inherit;
  font-weight: bold;
  cursor: pointer;
  transition: 0.2s;
  width: 100%;
}
.term-btn:hover {
  opacity: 0.8;
}


.admin-actions {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.admin-section {
  border: 1px solid var(--accent-dim);
  padding: 10px;
  display: grid;
  gap: 8px;
}

.admin-section-danger {
  border-color: rgba(255, 0, 0, 0.5);
}

.admin-section-title {
  margin: 0;
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--accent);
  text-align: left;
}

/* --- 7. GAMES --- */
canvas {
  border: 4px solid var(--accent);
  background: #000;
  box-shadow: 0 0 20px var(--accent-dim);
  width: auto;
  height: auto;
  max-width: 95vw;
  max-height: calc(100vh - 230px);
  image-rendering: pixelated;
  margin-bottom: 10px;
}

.embedded-game-frame {
  width: min(95vw, calc((100vh - 210px) * 1.7143), 1200px);
  aspect-ratio: 1200 / 700;
  height: auto;
  max-height: calc(100vh - 210px);
  border: 3px solid var(--accent);
  background: #000;
  box-shadow: 0 0 20px var(--accent-dim);
}

.fullscreen-btn-fixed {
  position: sticky;
  bottom: 82px;
  margin: 0 0 10px;
  width: 200px;
  border: 2px solid var(--accent);
  background: #000;
  color: var(--accent);
  padding: 12px;
  font-family: inherit;
  text-transform: uppercase;
  cursor: pointer;
  transition: 0.2s;
  z-index: 1001;
}

.fullscreen-btn-fixed:hover {
  background: var(--accent);
  color: #000;
}

.exit-btn-fixed {
  position: sticky;
  bottom: 20px;
  left: auto;
  transform: none;
  margin: 16px 0 10px;
  width: 200px;
  border: 2px solid var(--accent);
  background: #000;
  color: var(--accent);
  padding: 15px;
  font-family: inherit;
  text-transform: uppercase;
  cursor: pointer;
  transition: 0.2s;
  z-index: 1001;
}

.games-grid {
  width: min(1200px, 95vw);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.games-toolbar {
  width: min(1200px, 95vw);
  display: grid;
  grid-template-columns: minmax(220px, 1fr) repeat(2, minmax(180px, 240px)) auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
}

.games-search,
.games-select {
  width: 100%;
}

.games-clear {
  white-space: nowrap;
  min-height: 38px;
}

.games-results-meta {
  width: min(1200px, 95vw);
  margin: 4px 0 12px;
  font-size: 9px;
  color: #ddd;
  opacity: 0.9;
}

.game-card {
  border: 1px solid var(--accent);
  background: rgba(0, 0, 0, 0.7);
  color: var(--accent);
  text-align: left;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-family: inherit;
  position: relative;
}

.game-card.is-favorite {
  border-color: #ffd700;
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.25);
}

.game-card::after {
  content: attr(data-badge);
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 8px;
  color: #ffd700;
}

.game-card span {
  font-size: 18px;
}

.game-card strong {
  font-size: 10px;
}

.game-card small {
  font-size: 9px;
  color: #ddd;
  line-height: 1.4;
}

.game-card:hover {
  background: var(--accent-dim);
  box-shadow: 0 0 10px var(--accent-dim);
}

@media (max-width: 980px) {
  .games-toolbar {
    grid-template-columns: 1fr 1fr;
  }
}
.exit-btn-fixed:hover {
  background: var(--accent);
  color: #000;
}

.touch-controls {
  display: none;
  margin-top: 10px;
  gap: 10px;
}
.touch-controls.active {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}
.touch-btn {
  width: 50px;
  height: 50px;
  border: 1px solid var(--accent);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  background: rgba(255, 0, 0, 0.1);
}
.touch-btn:active {
  background: var(--accent);
  color: #000;
}
@media (pointer: coarse) {
  .touch-controls.active {
    display: grid;
  }
}

/* --- TYPE RUNNER --- */
#typeGameArea {
  width: 90%;
  max-width: 900px;
  text-align: left;
  margin-bottom: 50px;
  position: relative;
}
#typeTextBox {
  font-family: var(--font-type);
  font-size: 24px;
  line-height: 1.6;
  color: #555;
  user-select: none;
  position: relative;
  word-break: break-all;
  min-height: 150px;
  max-height: 300px;
  overflow: hidden;
}
.letter {
  position: relative;
  transition: color 0.1s;
}
.letter.correct {
  color: var(--accent);
  text-shadow: 0 0 5px var(--accent-dim);
}
.letter.incorrect {
  color: #ff0000;
  text-decoration: underline;
}
.letter.active::before {
  content: "|";
  position: absolute;
  left: -2px;
  color: var(--accent);
  animation: blink 1s infinite;
  opacity: 0.8;
}
@keyframes blink {
  50% {
    opacity: 0;
  }
}
#typeHiddenInput {
  position: absolute;
  opacity: 0;
  top: 0;
  left: 0;
  pointer-events: none;
}
.type-stats {
  display: flex;
  gap: 20px;
  font-size: 20px;
  margin-bottom: 20px;
  color: var(--accent);
  font-family: var(--font-type);
}

/* --- BLACKJACK --- */
.bj-table {
  width: 100%;
  max-width: 600px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.bj-pot-display {
  font-size: 24px;
  color: #ffd700;
  text-shadow: 0 0 10px #b8860b;
  padding: 10px;
  margin-bottom: 15px;
  border-bottom: 2px solid #ffd700;
  width: 100%;
  text-align: center;
  display: none;
}
.bj-area {
  width: 100%;
  border: 1px dashed var(--accent-dim);
  padding: 10px;
  position: relative;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.bj-label {
  position: absolute;
  top: -8px;
  background: #000;
  padding: 0 5px;
  font-size: 8px;
  color: var(--accent);
  left: 10px;
}
.bj-hand {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 10px;
  flex-wrap: wrap;
}

.bj-card {
  width: 50px;
  height: 70px;
  border: 2px solid var(--accent);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 4px;
  font-size: 12px;
  background: #000;
  box-shadow: 2px 2px 0px var(--accent-dim);
  user-select: none;
  position: relative;
  color: var(--accent);
}
.bj-card.mini {
  width: 30px;
  height: 42px;
  font-size: 8px;
  border: 1px solid var(--accent);
}
.bj-card.hidden {
  background: repeating-linear-gradient(
    45deg,
    #000,
    #000 5px,
    var(--accent-dim) 5px,
    var(--accent-dim) 10px
  );
  color: transparent;
}
.bj-card.hidden > div {
  display: none;
}

.bj-deck-container {
  width: 60px;
  height: 84px;
  border: 2px dashed var(--accent-dim);
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  margin: 5px;
  position: relative;
  transition: transform 0.1s;
}
.bj-deck-container:active {
  transform: scale(0.95);
}
.bj-deck-card {
  position: absolute;
  width: 45px;
  height: 63px;
  background: repeating-linear-gradient(
    45deg,
    #000,
    #000 5px,
    var(--accent) 5px,
    var(--accent) 6px
  );
  border: 2px solid var(--accent);
  box-shadow: -2px 2px 0px var(--accent-dim);
  top: 8px;
  left: 6px;
}

.bj-side-table {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
  width: 100%;
  margin-top: 10px;
}
.bj-small-seat {
  border: 1px dotted var(--accent-dim);
  padding: 5px;
  min-height: 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.bj-small-hand {
  display: flex;
  gap: 2px;
  flex-wrap: wrap;
  justify-content: center;
}
.active-seat {
  box-shadow: 0 0 10px var(--accent);
  border-color: var(--accent);
}

.bj-chip-rack {
  display: flex;
  gap: 10px;
  margin-top: 10px;
  justify-content: center;
  flex-wrap: wrap;
}
.bj-chip {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  background: #000;
  color: var(--accent);
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 9px;
  cursor: pointer;
  box-shadow:
    0 0 10px var(--accent-dim),
    inset 0 0 5px rgba(0, 0, 0, 0.5);
  font-weight: bold;
  transition: transform 0.1s;
}
.bj-chip:hover {
  background: var(--accent);
  color: #000;
  transform: translateY(-5px);
}
.bj-all-in {
  border-color: #ffcc00;
  color: #ffcc00;
  width: auto;
  padding: 0 10px;
}

/* Leaderboard */
.score-box {
  width: min(96vw, 920px);
  border: 2px solid var(--accent);
  background: #000;
  padding: clamp(12px, 2.5vw, 24px);
}
.score-tabs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
  margin-bottom: 14px;
  max-height: 220px;
  overflow-y: auto;
}
.score-tab {
  padding: 10px 8px;
  border: 1px solid var(--accent);
  cursor: pointer;
  font-size: clamp(9px, 1.8vw, 12px);
  text-align: center;
  line-height: 1.3;
}
.score-tab.active {
  background: var(--accent);
  color: #000;
}
.score-list {
  max-height: min(50vh, 420px);
  overflow-y: auto;
  text-align: left;
}
.score-item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 8px;
  border-bottom: 1px dashed var(--accent-dim);
  font-size: clamp(10px, 2vw, 13px);
  word-break: break-word;
  align-items: center;
}
.score-actions {
  margin-left: auto;
}
.admin-remove-btn {
  padding: 6px 10px;
  font-size: 10px;
  min-width: 64px;
}


.jobs-note {
  text-align: center;
  font-size: 10px;
  margin-bottom: 12px;
  opacity: 0.9;
}
.jobs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
}
.job-card {
  border: 1px solid var(--accent-dim);
  padding: 12px;
  background: rgba(0, 0, 0, 0.45);
}
.job-head {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  margin-bottom: 8px;
}
.job-desc {
  font-family: var(--font-type);
  font-size: 11px;
  margin-bottom: 10px;
  opacity: 0.85;
}
.job-prompt {
  min-height: 18px;
  font-size: 10px;
  color: #fff;
  margin-bottom: 8px;
}
.job-input {
  margin: 0 0 8px;
  width: 100%;
}
.job-actions {
  display: flex;
  gap: 8px;
}
.job-actions .term-btn {
  flex: 1;
}
.jobs-msg {
  text-align: center;
  min-height: 16px;
  margin-top: 12px;
  font-size: 10px;
}


.job-board {
  position: relative;
  width: 100%;
  height: 230px;
  border: 1px dashed var(--accent-dim);
  background: rgba(0, 0, 0, 0.45);
  overflow: hidden;
}
.job-board-cashier { background: linear-gradient(160deg, rgba(34,34,34,0.9), rgba(0,0,0,0.8)); }
.job-board-frontdesk { background: linear-gradient(160deg, rgba(15,30,55,0.8), rgba(0,0,0,0.85)); }
.job-board-delivery { background: linear-gradient(160deg, rgba(35,35,35,0.9), rgba(10,10,10,0.9)); }
.job-board-stocker { background: linear-gradient(160deg, rgba(32,24,8,0.8), rgba(0,0,0,0.9)); }
.job-board-janitor { background: linear-gradient(160deg, rgba(14,26,20,0.85), rgba(0,0,0,0.9)); }
.job-board-barista { background: linear-gradient(160deg, rgba(42,20,10,0.85), rgba(0,0,0,0.9)); }
.job-board-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  opacity: 0.75;
}
.job-target {
  position: absolute;
  transform: translate(-50%, -50%);
  border: 1px solid var(--accent-dim);
  border-radius: 12px;
  background: rgba(10, 10, 10, 0.88);
  color: #fff;
  font-size: 11px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 2px;
}
.job-target.good { box-shadow: 0 0 10px rgba(46, 204, 113, 0.3); }
.job-target.bad { box-shadow: 0 0 10px rgba(255, 107, 107, 0.22); }
.job-target:hover { transform: translate(-50%, -50%) scale(1.08); }
.job-target.delivery { border-radius: 50%; }
.job-target.frontdesk, .job-target.stocker, .job-target.cashier { font-size: 10px; letter-spacing: 0.4px; }


.job-meter {
  width: 100%;
  height: 16px;
  border: 1px solid var(--accent-dim);
  background: rgba(255, 255, 255, 0.05);
  margin-bottom: 6px;
}
.job-meter-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #45b6fe, #ffd93d);
  transition: width 0.2s ease;
}
.job-meter-fill.ok {
  background: linear-gradient(90deg, #2ecc71, #9be15d);
}
.job-meter-fill.bad {
  background: linear-gradient(90deg, #ff6b6b, #ffb347);
}
.job-temp {
  text-align: center;
  font-size: 16px;
  letter-spacing: 1px;
  margin-bottom: 8px;
  color: var(--accent);
}

.profile-summary {
  margin-top: 14px;
  border: 1px solid var(--accent-dim);
  padding: 10px;
  background: rgba(0, 0, 0, 0.35);
}
.profile-summary-rank {
  text-align: center;
  color: #fff;
  margin-bottom: 8px;
  font-size: 11px;
}

.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin: 0 4px;
  border-radius: 4px;
  font-size: 12px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.08);
}

.rank-badge.inline {
  margin-right: 6px;
}

.rank-iron { color: #9aa0a6; }
.rank-bronze { color: #cd7f32; }
.rank-silver { color: #d4d7dd; }
.rank-gold { color: #ffd447; }
.rank-platinum { color: #6ce4df; }
.rank-diamond { color: #7aa6ff; }
.rank-ascendant { color: #7b5cff; }
.rank-immortal { color: #ff5d89; }
.rank-radiant { color: #ffe682; }
.rank-god { color: #ff3d3d; }
.profile-progress-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.profile-progress-label {
  font-size: 9px;
  text-align: center;
  opacity: 0.85;
}
.profile-progress-track {
  width: 100%;
  height: 10px;
  border: 1px solid var(--accent-dim);
  background: rgba(255, 255, 255, 0.05);
}
.profile-progress-fill {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #0f0, #afffaf);
  transition: width 0.35s ease;
}

.profile-stats {
  text-align: left;
  width: 100%;
  margin-top: 20px;
}
.stat-row {
  display: flex;
  justify-content: space-between;
  margin: 10px 0;
  border-bottom: 1px solid var(--accent-dim);
  padding-bottom: 5px;
}

/* Config */
.config-box {
  width: 300px;
  padding: 20px;
  border: 1px solid var(--accent);
  background: #000;
}
.config-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 15px 0;
}

/* TTT */
.ttt-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
  margin-top: 10px;
}
.ttt-cell {
  width: 70px;
  height: 70px;
  background: #111;
  border: 2px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 35px;
}

/* Hangman */
.hangman-room {
  display: grid;
  grid-template-columns: 1fr 1.3fr 1fr;
  gap: 20px;
  width: 100%;
  max-width: 1100px;
}
.hangman-sidebar,
.hangman-chat {
  display: flex;
  flex-direction: column;
  gap: 15px;
}
.hangman-panel {
  border: 1px solid var(--accent);
  background: rgba(0, 0, 0, 0.8);
  padding: 12px;
  font-size: 10px;
  box-shadow: 0 0 10px var(--accent-dim);
}
.hangman-section-title {
  font-size: 9px;
  letter-spacing: 2px;
  margin-bottom: 8px;
  opacity: 0.8;
  text-transform: uppercase;
}
.hangman-turn {
  margin-top: 10px;
  font-size: 10px;
}
.hangman-chat-log {
  height: 260px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.hangman-chat-line {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.hangman-chat-name {
  color: var(--accent);
  font-weight: bold;
  font-size: 9px;
}
.hangman-chat-text {
  color: #fff;
  font-family: var(--font-type);
  font-size: 11px;
  text-shadow: none;
}
.hangman-chat-text.good {
  color: #0f0;
}
.hangman-chat-text.bad {
  color: #f00;
}
.hangman-chat-input {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.hangman-hint {
  font-size: 8px;
  opacity: 0.7;
  text-align: center;
}
.hangman-status {
  margin-bottom: 12px;
  font-size: 10px;
  text-align: center;
}
.hangman-word {
  font-size: 24px;
  letter-spacing: 8px;
  margin: 10px 0 20px;
  text-align: center;
}
.hangman-row {
  font-size: 10px;
  margin-bottom: 10px;
  text-align: center;
}
.hangman-letters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  font-size: 12px;
  margin-bottom: 10px;
}
.hangman-letters span {
  border: 1px solid var(--accent);
  padding: 4px 6px;
}
.hangman-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.hangman-figure {
  position: relative;
  width: 200px;
  height: 220px;
  margin-bottom: 15px;
}
.hangman-gallows {
  position: absolute;
  inset: 0;
}
.hangman-base {
  position: absolute;
  bottom: 0;
  left: 20px;
  width: 140px;
  height: 6px;
  background: var(--accent);
}
.hangman-post {
  position: absolute;
  bottom: 6px;
  left: 40px;
  width: 6px;
  height: 170px;
  background: var(--accent);
}
.hangman-beam {
  position: absolute;
  top: 20px;
  left: 40px;
  width: 100px;
  height: 6px;
  background: var(--accent);
}
.hangman-rope {
  position: absolute;
  top: 26px;
  left: 132px;
  width: 4px;
  height: 30px;
  background: var(--accent);
}
.hangman-man div {
  position: absolute;
  background: #fff;
  opacity: 0;
  transition: opacity 0.3s;
}
.hangman-head {
  width: 28px;
  height: 28px;
  border: 3px solid #fff;
  border-radius: 50%;
  top: 56px;
  left: 118px;
  background: transparent;
}
.hangman-body {
  width: 6px;
  height: 50px;
  top: 86px;
  left: 131px;
}
.hangman-arm.left {
  width: 30px;
  height: 4px;
  top: 100px;
  left: 102px;
  transform: rotate(-25deg);
  transform-origin: right center;
}
.hangman-arm.right {
  width: 30px;
  height: 4px;
  top: 100px;
  left: 134px;
  transform: rotate(25deg);
  transform-origin: left center;
}
.hangman-leg.left {
  width: 32px;
  height: 4px;
  top: 132px;
  left: 102px;
  transform: rotate(-30deg);
  transform-origin: right center;
}
.hangman-leg.right {
  width: 32px;
  height: 4px;
  top: 132px;
  left: 132px;
  transform: rotate(30deg);
  transform-origin: left center;
}
.hangman-figure[data-stage="1"] .hangman-head {
  opacity: 1;
}
.hangman-figure[data-stage="2"] .hangman-body {
  opacity: 1;
}
.hangman-figure[data-stage="3"] .hangman-arm.left {
  opacity: 1;
}
.hangman-figure[data-stage="4"] .hangman-arm.right {
  opacity: 1;
}
.hangman-figure[data-stage="5"] .hangman-leg.left {
  opacity: 1;
}
.hangman-figure[data-stage="6"] .hangman-leg.right {
  opacity: 1;
}
.hangman-figure[data-stage="2"] .hangman-head,
.hangman-figure[data-stage="3"] .hangman-head,
.hangman-figure[data-stage="4"] .hangman-head,
.hangman-figure[data-stage="5"] .hangman-head,
.hangman-figure[data-stage="6"] .hangman-head,
.hangman-figure[data-stage="3"] .hangman-body,
.hangman-figure[data-stage="4"] .hangman-body,
.hangman-figure[data-stage="5"] .hangman-body,
.hangman-figure[data-stage="6"] .hangman-body,
.hangman-figure[data-stage="4"] .hangman-arm.left,
.hangman-figure[data-stage="5"] .hangman-arm.left,
.hangman-figure[data-stage="6"] .hangman-arm.left,
.hangman-figure[data-stage="5"] .hangman-arm.right,
.hangman-figure[data-stage="6"] .hangman-arm.right,
.hangman-figure[data-stage="6"] .hangman-leg.left {
  opacity: 1;
}
@media (max-width: 900px) {
  .hangman-room {
    grid-template-columns: 1fr;
  }
  .hangman-stage {
    order: 1;
  }
  .hangman-sidebar {
    order: 2;
  }
  .hangman-chat {
    order: 3;
  }
  .hangman-figure {
    transform: scale(0.9);
  }

  .wrap {
    padding: 76px 12px 24px;
    gap: 10px;
  }

  #globalChat {
    position: static;
    width: min(92vw, 420px);
    height: 220px;
    margin: 10px auto 16px;
  }

  .top-bar {
    height: auto;
    min-height: 50px;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 12px;
  }

  .sys-info {
    width: 100%;
    order: 3;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
  }
}
/* Game Over Modal */
#modalGameOver {
  background: rgba(5, 5, 5, 0.95);
  z-index: 9500;
}
#modalGameOver h1 {
  color: #fff;
  text-shadow: 2px 2px red;
  font-size: 24px;
  margin-bottom: 10px;
}
.restart-hint {
  font-size: 10px;
  margin-top: 20px;
  animation: blink 1s infinite;
  color: #fff;
}

/* --- ACHIEVEMENTS & SHOP --- */
.badge-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 15px;
  max-height: 200px;
  overflow-y: auto;
}
.badge-item {
  border: 1px solid #333;
  padding: 8px;
  color: #555;
  font-size: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0.5;
  transition: 0.2s;
  cursor: help;
  height: 70px;
}
.badge-item:hover {
  transform: scale(1.05);
  border-color: var(--accent-glow);
}
.badge-item.unlocked {
  border-color: var(--accent);
  color: var(--accent);
  opacity: 1;
  box-shadow: 0 0 5px var(--accent-dim);
  background: rgba(255, 255, 255, 0.05);
}
.badge-item.common {
  border-color: var(--common);
  color: var(--common);
}
.badge-item.rare {
  border-color: var(--rare);
  color: var(--rare);
}
.badge-item.epic {
  border-color: var(--epic);
  color: var(--epic);
}
.badge-item.legendary {
  border-color: var(--leg);
  color: var(--leg);
  box-shadow: 0 0 10px var(--leg);
}
.badge-icon {
  font-size: 20px;
  margin-bottom: 5px;
}

#modalBadgeDetail {
  background: rgba(5, 5, 5, 0.98);
  z-index: 9600;
  text-align: center;
}
#bdIcon {
  font-size: 50px;
  margin-bottom: 20px;
  display: block;
}
#bdTitle {
  font-size: 18px;
  margin-bottom: 10px;
  color: var(--accent);
}
#bdRarity {
  font-size: 10px;
  margin-bottom: 15px;
  text-transform: uppercase;
  font-weight: bold;
}
#bdDesc {
  font-size: 10px;
  line-height: 1.5;
  color: #fff;
  max-width: 80%;
  margin: 0 auto;
}
#bdReward {
  margin-top: 20px;
  color: #0f0;
  font-size: 12px;
}

#toastBox {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  background: rgba(0, 0, 0, 0.95);
  border: 2px solid var(--accent);
  color: var(--accent);
  padding: 15px 25px;
  min-width: 300px;
  text-align: center;
  box-shadow: 0 0 20px var(--accent-glow);
  display: flex;
  align-items: center;
  gap: 15px;
  animation:
    slideUp 0.5s cubic-bezier(0.18, 0.89, 0.32, 1.28),
    fadeOut 0.5s ease-in 3.5s forwards;
}
.toast-icon {
  font-size: 30px;
}
.toast-content {
  text-align: left;
}
.toast-title {
  font-size: 12px;
  font-weight: bold;
  margin-bottom: 5px;
}
.toast-desc {
  font-size: 8px;
  opacity: 0.8;
}
@keyframes slideUp {
  from {
    transform: translateY(100px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}
@keyframes fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

.shop-list {
  max-height: 250px;
  overflow-y: auto;
  margin-top: 10px;
}
.shop-item {
  border: 1px solid var(--accent);
  padding: 10px;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10px;
}
.shop-buy-btn {
  background: var(--accent);
  color: #000;
  border: none;
  padding: 5px 10px;
  font-weight: bold;
  font-family: inherit;
}
.shop-buy-btn:disabled {
  background: #333;
  color: #555;
  cursor: not-allowed;
}
.shop-item-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
  justify-content: flex-end;
}
.shop-toggle-btn {
  background: #111;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 5px 8px;
  font-weight: bold;
  font-family: inherit;
}

.bank-log {
  max-height: 150px;
  overflow-y: auto;
  text-align: left;
  font-size: 8px;
  color: #aaa;
  margin-top: 10px;
  border-top: 1px solid #333;
  padding-top: 5px;
}
.bank-entry {
  margin-bottom: 5px;
  display: flex;
  justify-content: space-between;
}

.bank-transfer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.bank-transfer-input {
  margin-bottom: 0;
  font-size: 12px;
  padding: 8px;
}

.bank-transfer-presets {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.bank-preset-btn {
  padding: 6px;
  font-size: 9px;
}

.bank-transfer-help {
  text-align: center;
  color: #777;
  font-size: 8px;
}

.bank-transfer-msg {
  min-height: 12px;
  font-size: 10px;
  text-align: center;
  color: #aaa;
}


.bank-loan {
  border-top: 1px dashed #333;
  margin-top: 10px;
  padding-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bank-loan-title {
  text-align: center;
  font-size: 10px;
  color: #f80;
  letter-spacing: 0.5px;
}

.bank-loan-stats {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  color: #aaa;
}

.bank-loan-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}


.stock-market {
  border-top: 1px dashed #333;
  margin-top: 10px;
  padding-top: 10px;
}

.stock-market-header {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  color: #aaa;
  margin-bottom: 8px;
}

.stock-market-grid {
  display: grid;
  grid-template-columns: minmax(170px, 220px) 1fr;
  gap: 10px;
}

.stock-list {
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid #333;
}

.stock-row {
  width: 100%;
  border: none;
  border-bottom: 1px solid #222;
  background: transparent;
  color: var(--accent);
  font-family: inherit;
  font-size: 9px;
  padding: 8px;
  display: flex;
  justify-content: space-between;
}

.stock-row:hover,
.stock-row.active {
  background: var(--accent-dim);
}

.stock-detail {
  border: 1px solid #333;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stock-detail-title {
  font-size: 11px;
}

.stock-detail-price {
  font-size: 16px;
  color: #fff;
}

#stockChart {
  width: 100%;
  border: 1px solid #222;
  background: #050505;
  image-rendering: pixelated;
}

.stock-detail-meta {
  font-size: 8px;
  color: #aaa;
  min-height: 18px;
}

.stock-multipliers {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}

.stock-mult-btn {
  padding: 4px 0;
}

.stock-mult-btn.active {
  background: var(--accent-dim);
}

.stock-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

@media (max-width: 900px) {
  .stock-market-grid {
    grid-template-columns: 1fr;
  }
}

::-webkit-scrollbar {
  width: 5px;
}
::-webkit-scrollbar-thumb {
  background: var(--accent);
}

/* --- ROULETTE --- */
.roulette-balance {
  margin-bottom: 8px;
  color: #ffd700;
  font-size: 14px;
  text-shadow: 0 0 8px rgba(255, 215, 0, 0.4);
}

.roulette-history-wrap {
  width: min(94vw, 720px);
  border: 1px solid var(--accent-dim);
  padding: 8px;
  margin-bottom: 12px;
}

.roulette-history {
  display: flex;
  gap: 8px;
  align-items: center;
  overflow-x: auto;
  min-height: 36px;
}

.roulette-history-empty {
  font-size: 10px;
  opacity: 0.6;
}

.roulette-history-chip {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  border: 1px solid #666;
  flex: 0 0 auto;
}

.roulette-history-chip.red {
  background: #9d1717;
}

.roulette-history-chip.black {
  background: #111;
}

.roulette-history-chip.green {
  background: #0c8b3e;
}

.roulette-wheel-wrap {
  position: relative;
  width: min(82vw, 360px);
  height: min(82vw, 360px);
  aspect-ratio: 1 / 1;
  margin: 8px auto 12px;
  flex: 0 0 auto;
}

.roulette-pointer {
  position: absolute;
  left: 50%;
  top: -8px;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-top: 18px solid #fff;
  z-index: 4;
  filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.6));
}

.roulette-wheel-rim {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 8px solid #111;
  box-shadow:
    inset 0 0 12px rgba(0, 0, 0, 0.8),
    0 0 16px var(--accent-dim);
  z-index: 1;
}

.roulette-wheel {
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  overflow: hidden;
  z-index: 2;
  transition-property: transform;
  transition-timing-function: cubic-bezier(0.1, 0.7, 0.12, 1);
  background: conic-gradient(
    #0c8b3e 0deg 9.73deg,
    #1f1f1f 9.73deg 19.46deg,
    #a11a1a 19.46deg 29.19deg,
    #1f1f1f 29.19deg 38.92deg,
    #a11a1a 38.92deg 48.65deg,
    #1f1f1f 48.65deg 58.38deg,
    #a11a1a 58.38deg 68.11deg,
    #1f1f1f 68.11deg 77.84deg,
    #a11a1a 77.84deg 87.57deg,
    #1f1f1f 87.57deg 97.3deg,
    #a11a1a 97.3deg 107.03deg,
    #1f1f1f 107.03deg 116.76deg,
    #a11a1a 116.76deg 126.49deg,
    #1f1f1f 126.49deg 136.22deg,
    #a11a1a 136.22deg 145.95deg,
    #1f1f1f 145.95deg 155.68deg,
    #a11a1a 155.68deg 165.41deg,
    #1f1f1f 165.41deg 175.14deg,
    #a11a1a 175.14deg 184.87deg,
    #1f1f1f 184.87deg 194.6deg,
    #a11a1a 194.6deg 204.33deg,
    #1f1f1f 204.33deg 214.06deg,
    #a11a1a 214.06deg 223.79deg,
    #1f1f1f 223.79deg 233.52deg,
    #a11a1a 233.52deg 243.25deg,
    #1f1f1f 243.25deg 252.98deg,
    #a11a1a 252.98deg 262.71deg,
    #1f1f1f 262.71deg 272.44deg,
    #a11a1a 272.44deg 282.17deg,
    #1f1f1f 282.17deg 291.9deg,
    #a11a1a 291.9deg 301.63deg,
    #1f1f1f 301.63deg 311.36deg,
    #a11a1a 311.36deg 321.09deg,
    #1f1f1f 321.09deg 330.82deg,
    #a11a1a 330.82deg 340.55deg,
    #1f1f1f 340.55deg 350.28deg,
    #a11a1a 350.28deg 360deg
  );
}

.roulette-wheel-numbers {
  position: absolute;
  inset: 0;
}

.roulette-marker {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: center;
  padding-top: 8px;
}

.roulette-marker span {
  font-size: 10px;
  text-shadow: 0 1px 2px #000;
}

.roulette-marker span.red {
  color: #ff8a8a;
}

.roulette-marker span.black {
  color: #f5f5f5;
}

.roulette-marker span.green {
  color: #8fffbc;
}

.roulette-wheel-center {
  position: absolute;
  inset: 32%;
  border: 2px solid #444;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  font-size: 10px;
  letter-spacing: 1px;
}

.roulette-status {
  width: min(94vw, 720px);
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 11px;
  margin-bottom: 10px;
}

.roulette-message {
  width: min(94vw, 720px);
  border: 1px solid var(--accent-dim);
  padding: 10px;
  text-align: center;
  margin-bottom: 12px;
}

.roulette-message.win {
  border-color: #0f0;
  color: #83ff83;
}

.roulette-message.loss {
  border-color: #f00;
  color: #ff8c8c;
}

.roulette-controls {
  width: min(94vw, 720px);
  border: 1px solid var(--accent-dim);
  padding: 10px;
  margin-bottom: 95px;
}

.roulette-bet-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.roulette-label {
  font-size: 9px;
  letter-spacing: 1px;
  opacity: 0.8;
}

.roulette-presets {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
  margin: 10px 0;
}

.roulette-presets .menu-btn {
  width: 100%;
  min-width: 0;
}

.roulette-board {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.roulette-bet {
  border: 2px solid var(--accent);
  padding: 14px 8px;
  font-family: inherit;
  background: #111;
  color: #fff;
  cursor: pointer;
  text-transform: uppercase;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
}

.roulette-bet.red {
  background: linear-gradient(#a11a1a, #6e0f0f);
}

.roulette-bet.black {
  background: linear-gradient(#1f1f1f, #060606);
}

.roulette-bet.green {
  background: linear-gradient(#0c8b3e, #075626);
  grid-column: span 2;
}

.roulette-actions {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 8px;
  margin-top: 10px;
}

/* --- BONK ARENA --- */
.bonk-sub {
  font-size: 10px;
  margin-bottom: 16px;
  opacity: 0.9;
}

.bonk-wrap {
  width: min(840px, 95vw);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.bonk-hud {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10px;
  gap: 10px;
  flex-wrap: wrap;
}

#baCanvas {
  width: min(780px, 94vw);
  height: auto;
  max-height: 62vh;
  border: 2px solid var(--accent);
  background: radial-gradient(circle at 50% 45%, #111 0%, #050505 65%);
  box-shadow: 0 0 20px var(--accent-dim);
}

.bonk-winner {
  min-height: 18px;
  font-size: 13px;
  color: #00ff9d;
}

/* --- NEON DRIFT --- */
.drift-hud {
  width: min(780px, 94vw);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 10px;
  margin-bottom: 8px;
}

#driftCanvas {
  width: min(780px, 94vw);
  height: auto;
  max-height: 62vh;
  border: 2px solid #43f0ff;
  box-shadow: 0 0 22px rgba(67, 240, 255, 0.35);
  background: #070a14;
}


/* CPU emulator overlay layout. */
.emu-layout {
  width: min(1100px, 94vw);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.emu-panel {
  border: 1px solid var(--accent);
  background: rgba(0, 0, 0, 0.65);
  padding: 10px;
  min-height: 180px;
}
.emu-label {
  font-size: 9px;
  margin: 0 0 8px;
}
.emu-program {
  width: 100%;
  min-height: 140px;
  background: #000;
  color: var(--accent);
  border: 1px solid var(--accent);
  font-family: var(--font-type);
  font-size: 12px;
  padding: 8px;
  resize: vertical;
}
.emu-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.emu-doc-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}
.emu-terminal-controls {
  display: flex;
  gap: 8px;
  align-items: stretch;
  margin-bottom: 8px;
}

.emu-terminal-input {
  flex: 1;
  margin: 0;
  min-height: 56px;
  padding: 8px;
  border: 1px solid var(--accent);
  background: #000;
  color: var(--accent);
  font-family: var(--font-type);
  font-size: 12px;
  text-align: left;
  resize: vertical;
}

.emu-terminal-controls .term-btn {
  width: auto;
  min-width: 110px;
}

.emu-output {
  margin: 0 0 8px;
  border: 1px solid var(--accent-dim);
  background: rgba(0, 0, 0, 0.55);
  padding: 8px;
  min-height: 80px;
  white-space: pre-wrap;
  font-family: var(--font-type);
  font-size: 11px;
  color: #fff;
  text-shadow: none;
}
@media (max-width: 900px) {
  .emu-layout {
    grid-template-columns: 1fr;
  }
}
