/* ═══════════════════════════════════════════════════════════════════════════
   Bounce Blast — black and green, in the Game Room's house style.
   The arena is portrait (600x900 logical), so the canvas is capped by HEIGHT
   rather than width: on a desktop it sits centred and tall, on a phone it fills
   the column.
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  --font-display: 'Bebas Neue', 'DM Sans', system-ui, sans-serif;
  --font-body: 'DM Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'DM Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --bg: #000000;
  --surface: #0b0b0b;
  --surface2: #131313;
  --surface3: #1c1c1c;
  --border: #232323;
  --border2: #2f2f2f;

  --text: #f5f5f5;
  --muted: #8a8a8a;

  --green: #1db954;
  --green-bright: #1ed760;
  --green-dim: #0f5c2a;
  --red: #e91429;
}

html[data-theme='light'] {
  --bg: #f4f6f4;
  --surface: #ffffff;
  --surface2: #f0f3f0;
  --surface3: #e6eae6;
  --border: #d8ded8;
  --border2: #c6cec6;
  --text: #101410;
  --muted: #5c665c;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.shell { max-width: 720px; margin: 0 auto; padding: 14px 16px 44px; }

/* ── Header ────────────────────────────────────────────────────────────── */

.header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--border);
}
.home-btn {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--font-mono); font-size: 12px; letter-spacing: .08em;
  color: var(--muted); text-decoration: none; padding: 6px 10px;
  border: 1px solid var(--border); border-radius: 8px;
  transition: color .15s, border-color .15s;
}
.home-btn svg { width: 14px; height: 14px; }
.home-btn:hover { color: var(--green); border-color: var(--green-dim); }
.brand { display: flex; align-items: center; gap: 8px; }
.brand-mark { font-size: 20px; line-height: 1; }
.brand-text { font-family: var(--font-display); font-size: 22px; letter-spacing: .12em; }
.header-right { display: flex; align-items: center; gap: 8px; }
.user-badge { font-family: var(--font-mono); font-size: 11px; color: var(--muted); }
.icon-btn {
  width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface2); color: var(--muted); cursor: pointer;
  display: flex; align-items: center; justify-content: center; padding: 0;
  transition: color .15s, border-color .15s;
}
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn:hover { color: var(--green); border-color: var(--green-dim); }

.settings-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0;
  background: var(--surface2); border: 1px solid var(--border2);
  border-radius: 8px; min-width: 200px; z-index: 100;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.8); overflow: hidden; display: none;
}
.settings-dropdown.open { display: block; }
.dropdown-item {
  display: block; padding: 11px 14px; font-size: 13px; color: var(--muted);
  border-bottom: 1px solid var(--border); cursor: pointer;
  text-decoration: none; transition: color .2s, background .2s;
}
.dropdown-item:hover { color: var(--green); background: var(--surface3); }
.dropdown-item:last-child { border-bottom: none; }

/* ── Screens ───────────────────────────────────────────────────────────── */

.screen { display: none; padding-top: 18px; }
.screen.active { display: block; }

.screen-title {
  font-family: var(--font-display); font-size: 40px; letter-spacing: .04em;
  margin: 0 0 6px; color: var(--text);
}
.screen-sub { color: var(--muted); font-size: 14px; line-height: 1.55; margin: 0 0 18px; max-width: 78ch; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.muted { color: var(--muted); }
.mono { font-family: var(--font-mono); }
.how-to { display: block; font-size: 11px; margin-top: 16px; }

/* ── Buttons and fields ────────────────────────────────────────────────── */

.btn {
  font-family: var(--font-display); font-size: 16px; letter-spacing: .08em;
  background: var(--surface2); color: var(--text);
  border: 1px solid var(--border2); border-radius: 10px;
  padding: 9px 16px; cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, transform .1s;
}
.btn:hover { border-color: var(--green); color: var(--green); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--green); border-color: var(--green); color: #04140a; font-weight: 700; }
.btn-primary:hover { background: var(--green-bright); color: #04140a; }
.btn-sm { font-size: 13px; padding: 6px 11px; border-radius: 8px; }

.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 6px; }
.field label { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .08em; color: var(--muted); text-transform: uppercase; }
.field input {
  background: var(--surface2); border: 1px solid var(--border2); border-radius: 8px;
  color: var(--text); padding: 8px 10px; font-size: 14px; font-family: var(--font-body);
}
.field input:focus { outline: none; border-color: var(--green); }
.chip {
  font-family: var(--font-mono); font-size: 12px; color: var(--green);
  border: 1px solid var(--green-dim); border-radius: 999px; padding: 5px 11px;
}

/* ── Menu ──────────────────────────────────────────────────────────────── */

.menu-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
.mode-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 16px; display: flex; flex-direction: column; gap: 8px;
  transition: border-color .18s, background .18s;
}
.mode-card:hover { border-color: var(--green-dim); background: var(--surface2); }
.mode-icon { font-size: 26px; line-height: 1; }
.mode-name { font-family: var(--font-display); font-size: 22px; letter-spacing: .04em; }
.mode-desc { color: var(--muted); font-size: 13px; line-height: 1.5; flex: 1; }
.mode-form { display: flex; flex-direction: column; }

/* ── Game ──────────────────────────────────────────────────────────────── */

.game-layout { display: flex; flex-direction: column; gap: 12px; align-items: center; }
.hud { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.hud-stats { display: flex; gap: 14px; flex-wrap: wrap; }
.hud-stat { display: flex; flex-direction: column; gap: 2px; }
.hud-label { font-family: var(--font-mono); font-size: 10px; letter-spacing: .1em; color: var(--muted); text-transform: uppercase; }
.hud-value { font-family: var(--font-display); font-size: 22px; letter-spacing: .04em; }
.hud-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.board-wrap { display: flex; justify-content: center; width: 100%; }
#board {
  background: #0a140d;
  border: 1px solid var(--border2); border-radius: 10px;
  /* Portrait arena: the height is what limits it, so a tall phone sees all of it. */
  max-width: 100%; max-height: 76vh;
  width: auto; height: auto;
  touch-action: none; cursor: crosshair;
}

.banner {
  width: 100%; max-width: 520px; text-align: center;
  padding: 12px 14px; border-radius: 10px; font-family: var(--font-display);
  font-size: 20px; letter-spacing: .05em;
  border: 1px solid var(--green-dim); background: rgba(29, 185, 84, 0.12); color: var(--green-bright);
}
.banner.warn { border-color: var(--red); background: rgba(233, 20, 41, 0.12); color: #ff6b7d; }
.banner.hidden { display: none; }
