:root {
  color-scheme: dark;
  --bg: #07080b;
  --panel: #111318;
  --panel-2: #171a20;
  --silver: #c7ccd4;
  --muted: #7f8793;
  --red: #d51f2b;
  --red-bright: #ff4250;
  --line: #2a2f37;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: radial-gradient(circle at 50% -10%, #20232a 0, #0b0c10 35%, var(--bg) 75%); font-family: Arial, Helvetica, sans-serif; color: #fff; }
body { min-height: 100vh; }
button { font: inherit; }

.shell { width: min(100%, 760px); margin: 0 auto; padding: 14px 14px 28px; }
.topbar, .hud, .game-card { border: 1px solid var(--line); background: linear-gradient(180deg, rgba(28,31,38,.96), rgba(14,16,20,.96)); box-shadow: 0 18px 45px rgba(0,0,0,.32); }
.topbar { min-height: 82px; border-radius: 20px; display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.gj-mark { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; font-weight: 900; letter-spacing: -2px; color: var(--silver); border: 1px solid #4d535d; background: linear-gradient(145deg,#30343c,#0e1014 55%,#2a080b); box-shadow: inset 0 0 18px rgba(255,255,255,.06), 0 0 18px rgba(213,31,43,.18); }
.brand-name { font-size: 12px; letter-spacing: 1.7px; color: var(--silver); font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.game-name { margin-top: 5px; font-size: 20px; font-weight: 900; letter-spacing: .7px; }
.version { color: var(--red-bright); font-size: 12px; vertical-align: middle; }
.icon-btn { width: 44px; height: 44px; border: 1px solid #3a4049; border-radius: 14px; background: #15181e; color: #fff; cursor: pointer; }
.icon-btn:active { transform: scale(.97); }

.hud { margin-top: 12px; border-radius: 18px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; padding: 12px 16px; }
.hud-block { display: flex; flex-direction: column; gap: 2px; }
.hud-block.right { text-align: right; }
.hud-label { font-size: 10px; letter-spacing: 1.5px; color: var(--muted); font-weight: 800; }
.hud strong { font-size: 22px; }
.stars { display: flex; gap: 5px; }
.star { font-size: 26px; color: #414650; text-shadow: 0 0 0 transparent; transition: .18s ease; }
.star.active { color: #f4d84c; text-shadow: 0 0 12px rgba(244,216,76,.25); }

.game-card { margin-top: 12px; border-radius: 22px; padding: 14px; min-height: 470px; display: flex; flex-direction: column; justify-content: center; }
.board { position: relative; width: min(92vw, 620px); aspect-ratio: 1 / 1; margin: 0 auto; border-radius: 18px; overflow: hidden; background:
  linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px),
  linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px),
  radial-gradient(circle at center, #191c22 0, #0d0f13 70%);
  background-size: 10% 10%, 10% 10%, auto;
  border: 1px solid #2b3038;
}
.arrow { position: absolute; width: 48px; height: 48px; margin: -24px 0 0 -24px; display: grid; place-items: center; border: 0; background: transparent; color: var(--silver); cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent; transition: transform .15s ease, opacity .15s ease, color .15s ease; }
.arrow::before { content: '➜'; font-size: 36px; line-height: 1; filter: drop-shadow(0 2px 4px rgba(0,0,0,.45)); }
.arrow.hot { color: var(--red-bright); }
.arrow.blocked { animation: bump .22s ease; color: #fff; }
.arrow.clearing { pointer-events: none; animation: fly .42s ease forwards; }
@keyframes bump { 0%,100%{ transform: translate(var(--tx,0),var(--ty,0)) rotate(var(--rot)) } 45%{ transform: translate(calc(var(--tx,0) + var(--bx,0px)), calc(var(--ty,0) + var(--by,0px))) rotate(var(--rot)) } }
@keyframes fly { to { transform: translate(var(--fx), var(--fy)) rotate(var(--rot)); opacity: 0; } }
.message { min-height: 24px; margin-top: 12px; text-align: center; color: #aeb5bf; font-size: 14px; }
.message.good { color: #9ce0a7; }
.message.bad { color: #ff8b92; }
.controls { display: flex; justify-content: center; padding-top: 14px; }
.primary-btn { border: 1px solid #7a171e; background: linear-gradient(180deg,#e1303b,#991821); color: #fff; font-weight: 900; letter-spacing: 1px; border-radius: 16px; padding: 14px 24px; box-shadow: 0 8px 22px rgba(213,31,43,.18); cursor: pointer; }
.primary-btn:active { transform: translateY(1px); }

.modal { border: 0; padding: 0; background: transparent; width: min(92vw, 520px); }
.modal::backdrop { background: rgba(0,0,0,.72); backdrop-filter: blur(4px); }
.modal-card { border: 1px solid #343943; background: linear-gradient(180deg,#1a1d23,#0d0f13); border-radius: 22px; padding: 18px; color: #fff; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.modal-head h2 { margin: 4px 0 0; font-size: 21px; }
.modal-note { color: #9ea6b1; font-size: 13px; }
.leaderboard-list { display: grid; gap: 8px; margin-top: 12px; }
.leaderboard-row { display: grid; grid-template-columns: 42px 1fr auto; gap: 10px; align-items: center; border: 1px solid #2d323a; background: #14171c; border-radius: 14px; padding: 11px 12px; }
.rank { color: var(--red-bright); font-weight: 900; }
.name { font-weight: 800; }
.score { color: var(--silver); font-weight: 900; }

@media (max-width: 480px) {
  .shell { padding: 10px 10px 22px; }
  .topbar { min-height: 72px; padding: 10px 12px; border-radius: 17px; }
  .gj-mark { width: 46px; height: 46px; }
  .brand-name { font-size: 10px; }
  .game-name { font-size: 17px; }
  .game-card { min-height: 430px; padding: 10px; }
  .arrow { width: 42px; height: 42px; margin: -21px 0 0 -21px; }
  .arrow::before { font-size: 32px; }
}
