:root {
  --bg-a: #0b0f1a;
  --bg-b: #141a2b;
  --card: rgba(15, 23, 42, 0.7);
  --accent: #f97316;
  --accent-2: #22c55e;
  --muted: #94a3b8;
  --ink: #e2e8f0;
}

body {
  font-family: "Space Grotesk", system-ui, sans-serif;
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(234, 179, 8, 0.18), transparent 55%),
    radial-gradient(900px 500px at 90% 10%, rgba(56, 189, 248, 0.18), transparent 55%),
    linear-gradient(135deg, var(--bg-a), var(--bg-b));
}

.app-title {
  font-family: "Bebas Neue", "Space Grotesk", sans-serif;
  letter-spacing: 0.08em;
}

.panel {
  background: var(--card);
  border: 1px solid rgba(148, 163, 184, 0.15);
  backdrop-filter: blur(10px);
}

.input-shell {
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(15, 23, 42, 0.8);
}

.hit-cell {
  position: relative;
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.8);
  transition: transform 0.12s ease, background 0.2s ease, border 0.2s ease;
}

.hit-cell:active {
  transform: scale(0.98);
}

.hit-cell.closed {
  background: rgba(34, 197, 94, 0.2);
  border-color: rgba(34, 197, 94, 0.4);
}

.hit-cell.dead {
  opacity: 0.45;
}

.hit-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  border: 2px solid rgba(148, 163, 184, 0.6);
  background: transparent;
  box-shadow: inset 0 0 0 2px transparent;
}

.hit-dot.on {
  border-color: rgba(249, 115, 22, 0.9);
  background: rgba(249, 115, 22, 0.9);
  box-shadow: 0 0 8px rgba(249, 115, 22, 0.45);
}

.hit-dot.on.closed {
  border-color: rgba(34, 197, 94, 0.9);
  background: rgba(34, 197, 94, 0.9);
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.45);
}

.number-pill {
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 700;
  text-transform: uppercase;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(249, 115, 22, 0.4);
  color: #fdba74;
}

.number-pill.dead {
  border-color: rgba(148, 163, 184, 0.3);
  color: var(--muted);
}

.score-card {
  border-radius: 16px;
  padding: 8px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(15, 23, 42, 0.55);
}

.player-initials {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #cbd5f5;
}

.shanghai-btn {
  width: 100%;
  padding: 8px 8px;
  border-radius: 12px;
  border: 1px solid rgba(249, 115, 22, 0.5);
  background: rgba(249, 115, 22, 0.15);
  color: #fde68a;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  line-height: 1.1;
  display: grid;
  gap: 4px;
  place-items: center;
  justify-items: center;
  text-align: center;
  transition: transform 0.12s ease, background 0.2s ease, border 0.2s ease;
}

.shanghai-btn span {
  display: block;
  width: 100%;
  text-align: center;
  white-space: nowrap;
}

.shanghai-break {
  white-space: nowrap;
}

.shanghai-break .shanghai-num {
  display: inline;
}

@media (max-width: 520px) {
  .shanghai-btn {
    font-size: 10px;
    letter-spacing: 0.05em;
    padding: 6px 6px;
  }

  .shanghai-break {
    white-space: normal;
  }

  .shanghai-break .shanghai-num {
    display: block;
  }
}

.shanghai-btn:active {
  transform: scale(0.98);
}

.shanghai-btn.shanghai-alt {
  border-color: rgba(148, 163, 184, 0.4);
  background: rgba(148, 163, 184, 0.12);
  color: #e2e8f0;
}

.step-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(30, 41, 59, 0.8);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.modal-panel {
  background: linear-gradient(135deg, #fef08a, #fde047, #fbbf24);
}

.history-row {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 12px;
  align-items: center;
  padding: 8px 12px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(148, 163, 184, 0.15);
}

.history-time {
  font-size: 12px;
  color: #94a3b8;
  font-variant-numeric: tabular-nums;
}

.history-text {
  font-size: 14px;
  color: #e2e8f0;
}

.history-toggle {
  border-radius: 999px;
  padding: 4px 10px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.5);
  color: #cbd5f5;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.ranking-row {
  display: grid;
  grid-template-columns: 32px 1fr 48px;
  gap: 8px;
  align-items: center;
  padding: 6px 10px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.2);
}

.ranking-rank {
  font-weight: 700;
}

.ranking-name {
  font-weight: 600;
}

.ranking-score {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.penalty-flash {
  animation: penaltyFlash 0.9s ease;
}

.score-flash {
  animation: scoreFlash 0.9s ease;
}

@keyframes penaltyFlash {
  0% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.5);
    border-color: rgba(239, 68, 68, 0.8);
    background: rgba(239, 68, 68, 0.2);
  }
  50% {
    box-shadow: 0 0 18px 4px rgba(239, 68, 68, 0.4);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
  }
}

@keyframes scoreFlash {
  0% {
    color: #f87171;
    text-shadow: 0 0 12px rgba(248, 113, 113, 0.6);
  }
  100% {
    color: #fde68a;
    text-shadow: none;
  }
}
