/* The Arcade — the MafiaTownRP phone's Games app on the web: warm dark
   panels, brass/gold trim, red pressed buttons (colours from cl_ui_theme.lua). */
:root {
  --bg: #141110; --panel: #1e1a18; --panel-alt: #25201d; --track: #100e0d;
  --gold: #c49c54; --gold-dim: #78603a; --text-gold: #d4b26e;
  --text: #e0d8c8; --text-dim: #c3b6a4; --red: #962020; --red-dark: #5a1418; --good: #5ac86e;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body.arcade-body {
  background: radial-gradient(ellipse at top, #2e1010 0%, var(--bg) 55%) fixed, var(--bg);
  color: var(--text); font: 17px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
}
body.arcade-body.is-playing { height: 100vh; height: 100dvh; overflow: hidden; }
[hidden] { display: none !important; }

/* Buttons: panel colour, gold 1px trim, red when pressed */
.arcade-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 8px 16px; border: 1px solid rgba(196,156,84,0.55); border-radius: 4px;
  background: var(--panel); color: var(--text); font-family: inherit; font-size: 1rem; font-weight: 600; line-height: 1.2;
  text-decoration: none; cursor: pointer; user-select: none; -webkit-user-select: none; touch-action: manipulation;
  transition: background .12s, border-color .12s, color .12s;
}
.arcade-btn:hover, .arcade-btn:focus-visible { background: #2a2420; border-color: var(--gold); color: #fff5e1; outline: none; }
.arcade-btn:active { background: var(--red-dark); }
.arcade-icon { width: 44px; padding: 0; font-size: 1.25rem; }

/* Top bar: like the phone window's blood-red header band */
.arcade-top {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: #2e1010;
  border-bottom: 1px solid var(--gold-dim); box-shadow: 0 2px 14px rgba(0,0,0,0.5);
}
.arcade-brand { flex: 1; margin: 0; text-align: center; color: var(--text-gold); font-size: 1.35rem; letter-spacing: 0.06em; text-transform: uppercase; }
.arcade-home { white-space: nowrap; }

/* The game list */
.arcade-list { width: min(860px, 100%); margin: 0 auto; padding: 18px 16px 28px; }
.arcade-lead { margin: 0 0 16px; color: var(--text-dim); text-align: center; font-size: 1.05rem; }
.arcade-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.arcade-card {
  display: grid; justify-items: center; gap: 4px; padding: 18px 12px 16px; min-height: 150px;
  background: linear-gradient(180deg, var(--panel-alt), var(--panel)); color: var(--text);
  border: 1px solid var(--gold-dim); border-radius: 6px; box-shadow: inset 0 0 0 3px var(--panel), inset 0 0 0 4px rgba(196,156,84,0.25);
  font: inherit; text-decoration: none; cursor: pointer; text-align: center; transition: transform .12s, border-color .12s;
}
.arcade-card:hover, .arcade-card:focus-visible { border-color: var(--gold); transform: translateY(-2px); outline: none; }
.arcade-card:active { background: var(--red-dark); }
.arcade-card-icon { font-size: 2.6rem; line-height: 1.1; }
.arcade-card b { color: var(--text-gold); font-size: 1.2rem; text-transform: uppercase; letter-spacing: 0.04em; }
.arcade-card small { color: var(--text-dim); font-size: 0.92rem; }
.arcade-made-by { margin: 22px 0 0; text-align: center; color: var(--text-dim); font-weight: 700; }

/* One game: title, help, the board (filling the room left), pad, buttons */
.arcade-game {
  flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center;
  width: min(560px, 100%); margin: 0 auto; padding: 8px 16px calc(10px + env(safe-area-inset-bottom));
}
.arcade-game[data-game="bounce"] { width: min(980px, 100%); }
.arcade-title { margin: 2px 0 0; color: var(--text-gold); font-size: 1.45rem; letter-spacing: 0.08em; }
.arcade-help { margin: 2px 0 8px; color: var(--text-dim); font-size: 0.95rem; text-align: center; }
.arcade-frame {
  flex: 1; min-height: 200px; width: 100%; padding: 3px; display: flex; align-items: center; justify-content: center;
  background: var(--track); border: 1px solid var(--gold); border-radius: 4px;
  box-shadow: inset 0 0 0 2px var(--track), inset 0 0 0 3px var(--gold-dim), 0 8px 30px rgba(0,0,0,0.55);
}
.arcade-frame canvas { display: block; touch-action: none; outline: none; border-radius: 2px; }

/* Touch pads */
.arcade-pad { display: grid; gap: 8px; width: 100%; margin-top: 10px; }
.arcade-pad.is-empty { display: none; }
.arcade-pad .arcade-btn { min-height: 54px; font-size: 1.4rem; padding: 0; }
/* Snake: a D-pad */
.arcade-game[data-game="snake"] .arcade-pad { grid-template-columns: repeat(3, 1fr); width: min(300px, 100%); }
.arcade-game[data-game="snake"] .arcade-pad [data-code="ArrowUp"] { grid-column: 2; grid-row: 1; }
.arcade-game[data-game="snake"] .arcade-pad [data-code="ArrowLeft"] { grid-column: 1; grid-row: 2; }
.arcade-game[data-game="snake"] .arcade-pad [data-code="ArrowDown"] { grid-column: 2; grid-row: 2; }
.arcade-game[data-game="snake"] .arcade-pad [data-code="ArrowRight"] { grid-column: 3; grid-row: 2; }
/* Sudoku: 1-9 and ⌫ */
.arcade-pad.is-numbers { grid-template-columns: repeat(5, 1fr); }
.arcade-pad.is-numbers .arcade-btn { font-size: 1.35rem; font-weight: 800; color: var(--text-gold); }
/* Bounce: roll on the left, dive/jump on the right */
.arcade-pad.is-bounce { grid-template-columns: 1fr 1fr 0.5fr 1fr 1fr; }
.arcade-pad.is-bounce [data-code="ArrowDown"] { grid-column: 4; }
.arcade-pad.is-bounce [data-code="ArrowUp"] { grid-column: 5; background: var(--red); border-color: var(--gold); }
.arcade-pad.is-bounce .arcade-btn { min-height: 64px; }

.arcade-buttons { display: flex; gap: 10px; width: 100%; margin-top: 10px; }
.arcade-wide { flex: 1; }

/* Top 10 popup */
.arcade-modal { position: fixed; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(8,6,5,0.72); }
.arcade-modal-box {
  width: min(380px, 100%); max-height: calc(100dvh - 32px); overflow-y: auto; background: var(--bg);
  border: 1px solid var(--gold); border-radius: 4px; box-shadow: inset 0 0 0 3px var(--bg), inset 0 0 0 4px var(--gold-dim), 0 20px 60px rgba(0,0,0,0.6);
  padding: 12px 14px 16px;
}
.arcade-modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.arcade-modal-head b { color: var(--text-gold); text-transform: uppercase; letter-spacing: 0.05em; font-size: 1.1rem; }
.arcade-row { display: grid; grid-template-columns: 42px 1fr auto; gap: 8px; align-items: center; padding: 9px 10px; background: var(--panel); border-radius: 3px; margin-bottom: 4px; }
.arcade-row:nth-child(even) { background: var(--panel-alt); }
.arcade-row span { color: var(--text-dim); font-weight: 700; }
.arcade-row b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.arcade-row em { font-style: normal; color: var(--text-gold); font-weight: 800; }
.arcade-row.is-me { outline: 1px solid var(--gold); background: #33281c; }
.arcade-muted { color: var(--text-dim); text-align: center; margin: 14px 0; }
.arcade-mine { margin: 12px 0 0; text-align: center; color: var(--text); }
.arcade-mine b { color: var(--good); }

@media (max-width: 520px) {
  body.arcade-body { font-size: 16px; }
  .arcade-top { padding-left: 12px; padding-right: 12px; gap: 8px; }
  .arcade-brand { font-size: 1.1rem; }
  .arcade-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .arcade-card { min-height: 130px; padding: 14px 8px; }
  .arcade-game { padding-left: 10px; padding-right: 10px; }
  .arcade-title { font-size: 1.2rem; }
  .arcade-help { font-size: 0.88rem; }
  body.is-playing .arcade-home { display: none; }
}
@media (max-height: 560px) and (orientation: landscape) {
  .arcade-help { display: none; }
  .arcade-top { padding-top: 6px; padding-bottom: 6px; }
}
@media (prefers-reduced-motion: reduce) { .arcade-card { transition: none; } }

/* the LateTowers trailer above the games */
.arcade-trailer { display: block; width: 100%; max-width: 760px; height: auto; aspect-ratio: 16 / 9; margin: 0 auto 18px; border-radius: 16px; background: #0d0a24; box-shadow: 0 10px 30px rgba(0,0,0,0.35); }

/* Scroll everywhere (wheel, touch, keys, trackpad), but never show a scrollbar */
html, body, * { scrollbar-width: none; -ms-overflow-style: none; }
*::-webkit-scrollbar { display: none; width: 0; height: 0; background: transparent; }
.arcade-guest { margin: -6px auto 16px; max-width: 760px; text-align: center; font-size: 0.95rem; color: var(--text-dim); }
.arcade-guest a { color: #ffd23a; font-weight: 700; }
