:root {
  color-scheme: dark;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #10131a;
  color: #f7f7f8;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(ellipse at 50% -20%, rgba(255, 181, 71, .15), transparent 55%),
    #10131a;
}

button, input { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.shell {
  width: min(100% - 28px, 620px);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 0 max(18px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
}

.topbar {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: #fff;
  font-size: 17px;
  font-weight: 850;
  letter-spacing: -.04em;
  text-decoration: none;
}

.brand-mark {
  width: 31px;
  height: 31px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: #ffb547;
  color: #171717;
}

.business-name {
  overflow: hidden;
  max-width: 65%;
  margin: 0;
  color: #c6c7cb;
  font-size: 12px;
  font-weight: 650;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.panel {
  border: 1px solid rgba(255, 255, 255, .09);
  border-radius: 22px;
  background: rgba(25, 29, 38, .94);
  box-shadow: 0 18px 55px rgba(0, 0, 0, .18);
}

.landing, .result-panel, .leaderboard-panel {
  margin: auto 0;
  padding: clamp(24px, 7vw, 42px);
}

.eyebrow {
  margin: 0 0 10px;
  color: #ffb547;
  font-size: 10px;
  font-weight: 850;
  letter-spacing: .18em;
}

h1, h2, p { margin-top: 0; }
h1 {
  margin-bottom: 12px;
  font-size: clamp(32px, 9vw, 48px);
  line-height: 1.03;
  letter-spacing: -.06em;
}

.intro {
  max-width: 420px;
  margin-bottom: 24px;
  color: #c2c5cc;
  font-size: 15px;
  line-height: 1.6;
}

.rule-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin: 0 0 26px;
  color: #d7d9de;
  font-size: 12px;
}

.rule-list span { display: inline-flex; align-items: center; gap: 6px; }
.rule-list b { color: #fff; }
.dot { width: 10px; height: 10px; border-radius: 50%; }
.dot-normal { background: #76ddff; }
.dot-gold { background: #ffcc50; }
.dot-bomb { background: #ff6572; }

.button {
  min-height: 48px;
  padding: 0 18px;
  border: 0;
  border-radius: 13px;
  font-size: 14px;
  font-weight: 800;
}

.button-primary {
  width: 100%;
  background: #ffb547;
  color: #171717;
}

.button-primary:hover { background: #ffc66e; }
.button:disabled { cursor: wait; opacity: .58; }

.button-secondary {
  background: rgba(255, 255, 255, .08);
  color: #f3f4f6;
}

.landing > .button-secondary { width: 100%; margin-top: 10px; }

.game-panel { padding: 12px; }
.game-stats {
  display: flex;
  justify-content: space-between;
  padding: 8px 8px 12px;
  color: #bfc2c9;
  font-size: 12px;
  font-weight: 650;
}
.game-stats b { margin-left: 4px; color: #fff; }

#game-canvas {
  display: block;
  width: 100%;
  height: min(62vh, 500px);
  min-height: 300px;
  border-radius: 15px;
  background: #171d29;
  touch-action: none;
  user-select: none;
}

.game-hint {
  margin: 9px 0 1px;
  color: #959ba7;
  font-size: 11px;
  text-align: center;
}

.result-panel h2, .leaderboard-panel h2 {
  margin-bottom: 12px;
  font-size: 28px;
  letter-spacing: -.04em;
}

.final-score { margin-bottom: 22px; color: #c2c5cc; }
.final-score strong { margin-left: 5px; color: #ffb547; font-size: 27px; }

.score-form { display: grid; gap: 9px; }
.score-form label { color: #c2c5cc; font-size: 12px; font-weight: 700; }
.score-form input {
  width: 100%;
  min-height: 46px;
  padding: 0 13px;
  border: 1px solid rgba(255, 255, 255, .15);
  border-radius: 11px;
  outline: none;
  background: #11151d;
  color: #fff;
}
.score-form input:focus { border-color: #ffb547; }
.result-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 10px; }

.leaderboard-heading { display: flex; align-items: flex-start; justify-content: space-between; }
.icon-button {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 11px;
  background: rgba(255, 255, 255, .08);
  color: #fff;
  font-size: 24px;
}
.leaderboard-list { display: grid; gap: 8px; margin: 18px 0 0; padding: 0; list-style: none; }
.leaderboard-row {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  align-items: center;
  gap: 10px;
  min-height: 45px;
  padding: 0 12px;
  border-radius: 11px;
  background: rgba(255, 255, 255, .045);
  font-size: 13px;
}
.leaderboard-rank { color: #ffb547; font-weight: 850; }
.leaderboard-name { overflow: hidden; color: #e6e7ea; text-overflow: ellipsis; white-space: nowrap; }
.leaderboard-score { color: #fff; font-weight: 800; }
.empty-state { margin: 20px 0 0; color: #bfc2c9; font-size: 13px; }
.message { min-height: 20px; margin: 12px 4px; color: #ffcb82; font-size: 12px; text-align: center; }
footer { margin-top: auto; padding: 8px 0 2px; color: #777e8a; font-size: 10px; text-align: center; }

@media (max-height: 650px) {
  .shell { padding-top: 8px; }
  .topbar { min-height: 42px; margin-bottom: 8px; }
  #game-canvas { height: min(58vh, 390px); min-height: 250px; }
}
