@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700;900&display=swap');

:root {
  --bg: #0f1117;
  --bg-card: #1a1d27;
  --bg-input: #252836;
  --accent: #f05545;
  --accent-btn: #f05545;
  --accent-btn-text: #000;
  --accent-glow: rgba(240, 85, 69, 0.3);
  --green: #5ee4a0;
  --green-glow: rgba(94, 228, 160, 0.3);
  --yellow: #fad961;
  --text: #f0f0f0;
  --text-dim: #b0b4c8;
  --border: #2d3045;
  --radius: 12px;
  --radius-sm: 8px;
}

/* ── Accent color themes (dark) ──
   --accent: bright for text on dark bg (≥7:1 vs #0f1117)
   --accent-btn: dark enough for white text on it (≥7:1) */

[data-accent='red'] {
  --accent: #f05545;
  --accent-btn: #f05545;
  --accent-btn-text: #000;
  --accent-glow: rgba(240, 85, 69, 0.3);
}

[data-accent='green'] {
  --accent: #5ee4a0;
  --accent-btn: #5ee4a0;
  --accent-btn-text: #000;
  --accent-glow: rgba(94, 228, 160, 0.3);
}

[data-accent='blue'] {
  --accent: #7cc4f0;
  --accent-btn: #7cc4f0;
  --accent-btn-text: #000;
  --accent-glow: rgba(124, 196, 240, 0.3);
}

[data-accent='yellow'] {
  --accent: #fad961;
  --accent-btn: #fad961;
  --accent-btn-text: #000;
  --accent-glow: rgba(250, 217, 97, 0.3);
}

/* ── Light theme ──
   --text-dim ≥7:1 on --bg-card (#fff)
   accents ≥7:1 on --bg (#f5f5f7) */

[data-theme='light'] {
  --bg: #f5f5f7;
  --bg-card: #ffffff;
  --bg-input: #e8e8ec;
  --text: #111827;
  --text-dim: #4b5060;
  --border: #d1d5db;
  --green: #157a4a;
  --yellow: #92700c;
}

[data-theme='light'][data-accent='red'] {
  --accent: #b91c1c;
  --accent-btn: #b91c1c;
  --accent-btn-text: #fff;
  --accent-glow: rgba(185, 28, 28, 0.2);
}

[data-theme='light'][data-accent='green'] {
  --accent: #15803d;
  --accent-btn: #15803d;
  --accent-btn-text: #fff;
  --accent-glow: rgba(21, 128, 61, 0.2);
}

[data-theme='light'][data-accent='blue'] {
  --accent: #1d4ed8;
  --accent-btn: #1d4ed8;
  --accent-btn-text: #fff;
  --accent-glow: rgba(29, 78, 216, 0.2);
}

[data-theme='light'][data-accent='yellow'] {
  --accent: #92400e;
  --accent-btn: #92400e;
  --accent-btn-text: #fff;
  --accent-glow: rgba(146, 64, 14, 0.2);
}

[data-theme='light'] .theme-toggle {
  background: #fef3c7;
  border-color: #fbbf24;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* ── Focus styles ── */

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button:focus-visible,
.input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

[role='button']:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

html,
body,
#root {
  height: 100%;
  font-family:
    'Inter',
    -apple-system,
    sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  outline: none;
  transition:
    transform 0.1s,
    box-shadow 0.2s;
}

button:active {
  transform: scale(0.96);
}

button:disabled {
  opacity: 0.45;
  pointer-events: none;
}

input {
  font-family: inherit;
  outline: none;
  border: none;
}

/* ── App shell ── */

.app {
  max-width: 480px;
  margin: 0 auto;
  padding: 20px 16px env(safe-area-inset-bottom, 16px);
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

/* ── Buttons ── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 24px;
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 700;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--accent-btn);
  color: var(--accent-btn-text);
  box-shadow: 0 4px 15px var(--accent-glow);
}

.btn-primary:hover {
  box-shadow: 0 6px 25px var(--accent-glow);
}

.btn-green {
  background: #14724a;
  color: #fff;
  box-shadow: 0 4px 15px rgba(20, 114, 74, 0.3);
}

.btn-secondary {
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-danger {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}

.btn-full {
  width: 100%;
}

.btn-lg {
  padding: 18px 32px;
  font-size: 18px;
  border-radius: 16px;
}

.btn-sm {
  padding: 8px 14px;
  font-size: 14px;
}

.btn-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  padding: 0;
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Input ── */

.input {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-input);
  color: var(--text);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 16px;
  transition: border-color 0.2s;
}

.input:focus {
  border-color: var(--accent);
}

.input-code {
  text-align: center;
  font-size: 32px;
  font-weight: 900;
  letter-spacing: 8px;
  text-transform: uppercase;
  padding: 20px;
}

/* ── Checkbox ── */

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.checkbox-row input[type='checkbox'] {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  margin-top: 2px;
  accent-color: var(--accent);
}

/* ── Card ── */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

/* ── Tabs ── */

.tabs {
  display: flex;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px;
  gap: 4px;
}

.tab {
  flex: 1;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 700;
  color: var(--text-dim);
  background: transparent;
  transition: all 0.2s;
}

.tab.active {
  background: var(--accent-btn);
  color: var(--accent-btn-text);
  box-shadow: 0 2px 8px var(--accent-glow);
}

.tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  background: var(--accent);
  color: var(--accent-btn-text);
  font-size: 11px;
  font-weight: 900;
  margin-left: 6px;
  padding: 0 5px;
}

.tab.active .tab-badge {
  background: var(--accent-btn-text);
  color: var(--accent-btn);
}

/* ── Animations ── */

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-8px);
  }
  40% {
    transform: translateX(8px);
  }
  60% {
    transform: translateX(-4px);
  }
  80% {
    transform: translateX(4px);
  }
}

@keyframes popIn {
  0% {
    transform: scale(0.8);
    opacity: 0;
  }
  70% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.fade-in {
  animation: fadeIn 0.25s ease-out;
}

.slide-up {
  animation: slideUp 0.35s ease-out;
}

.pop-in {
  animation: popIn 0.3s ease-out;
}

/* ── Rainbow glow for active player ── */

@keyframes rainbowGlow {
  0% {
    box-shadow:
      inset 0 0 0 1px #e74c3c,
      0 0 12px rgba(231, 76, 60, 0.3);
  }
  25% {
    box-shadow:
      inset 0 0 0 1px #2ecc71,
      0 0 12px rgba(46, 204, 113, 0.3);
  }
  50% {
    box-shadow:
      inset 0 0 0 1px #5dade2,
      0 0 12px rgba(93, 173, 226, 0.3);
  }
  75% {
    box-shadow:
      inset 0 0 0 1px #f4d03f,
      0 0 12px rgba(244, 208, 63, 0.3);
  }
  100% {
    box-shadow:
      inset 0 0 0 1px #e74c3c,
      0 0 12px rgba(231, 76, 60, 0.3);
  }
}

@keyframes arrowBounce {
  0%,
  100% {
    transform: translateX(0);
  }
  50% {
    transform: translateX(5px);
  }
}

.active-arrow {
  display: inline-block;
  color: var(--yellow);
  margin-right: 6px;
  animation: arrowBounce 0.8s ease-in-out infinite;
}

/* ── Scoreboard ── */

.scoreboard {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 4px;
}

.scoreboard th {
  padding: 6px 8px;
  text-align: center;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
  font-weight: 600;
}

.scoreboard td {
  padding: 12px 10px;
  text-align: center;
  font-size: 16px;
  font-weight: 600;
  background: var(--bg-input);
}

.scoreboard tr td:first-child {
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  text-align: left;
}

.scoreboard tr td:last-child {
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.scoreboard .active-player td {
  animation: rainbowGlow 4s linear infinite;
  background: var(--bg-card);
}

.scoreboard .halved {
  color: var(--accent);
}

/* ── Player chips ── */

.player-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--bg-input);
  border: 2px solid var(--border);
  border-radius: 50px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}

.player-chip.selected {
  border-color: var(--green);
  background: rgba(46, 204, 113, 0.1);
}

.player-chip .remove {
  background: none;
  color: var(--text-dim);
  font-size: 18px;
  padding: 0;
  line-height: 1;
}

/* ── Player row (with avatar) ── */

.player-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.player-row-avatar {
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
}

.player-row-avatar-hint {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 50%;
  font-size: 16px;
  opacity: 0;
  transition: opacity 0.2s;
}

.player-row-avatar:active .player-row-avatar-hint,
.player-row-avatar:hover .player-row-avatar-hint {
  opacity: 1;
}

.player-row-name {
  flex: 1;
  font-weight: 600;
  font-size: 15px;
}

.player-row-action {
  background: none;
  border: none;
  font-size: 16px;
  padding: 4px;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.15s;
}

.player-row-action:hover {
  opacity: 1;
}

.player-row .remove {
  background: none;
  color: var(--text-dim);
  font-size: 20px;
  padding: 2px 4px;
  line-height: 1;
}

/* ── Scoreboard player cell with avatar ── */

.sb-player-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Dart input ── */

.dart-input-area {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dart-tally {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.dart-tally-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.dart-tally-total {
  font-size: 52px;
  font-weight: 900;
  color: var(--text-dim);
  min-width: 90px;
  text-align: center;
  transition:
    color 0.15s,
    transform 0.15s;
  line-height: 1;
}

.dart-tally-total.has-value {
  color: var(--green);
}

.dart-tally-total.pop {
  animation: scorePop 0.25s ease-out;
}

@keyframes scorePop {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(1.2);
  }
  100% {
    transform: scale(1);
  }
}

.dart-tally-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--text-dim);
}

/* Dart pips with throw animation */

.dart-pips {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 2px;
}

.dart-pip {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: transparent;
  transition: all 0.2s;
  position: relative;
}

.dart-pip.used {
  background: var(--accent);
  color: var(--accent-btn-text);
  box-shadow: 0 0 10px var(--accent-glow);
}

.dart-pip.just-thrown {
  animation: dartThrow 0.4s ease-out;
}

@keyframes dartThrow {
  0% {
    transform: scale(0.3) rotate(-180deg);
    opacity: 0;
  }
  60% {
    transform: scale(1.3) rotate(10deg);
    opacity: 1;
  }
  100% {
    transform: scale(1) rotate(0);
    opacity: 1;
  }
}

.dart-pip.miss-pip {
  background: rgba(231, 76, 60, 0.15);
  color: #f05545;
  border: 2px solid rgba(231, 76, 60, 0.4);
  box-shadow: none;
}

.dart-breakdown {
  font-size: 12px;
  color: var(--text-dim);
  min-height: 16px;
}

.dart-buttons {
  display: grid;
  gap: 8px;
}

.dart-buttons.cols-2 {
  grid-template-columns: repeat(2, 1fr);
}

.dart-buttons.cols-3 {
  grid-template-columns: repeat(3, 1fr);
}

.dart-buttons.cols-4 {
  grid-template-columns: repeat(4, 1fr);
}

.dart-buttons.cols-5 {
  grid-template-columns: repeat(5, 1fr);
}

.dart-btn {
  padding: 18px 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text);
  font-size: 20px;
  font-weight: 700;
  border: 2px solid var(--border);
  transition: all 0.12s;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.dart-btn:active:not(:disabled) {
  background: var(--accent);
  border-color: var(--accent);
  transform: scale(0.94);
}

.dart-btn:disabled {
  opacity: 0.25;
}

.dart-btn-value {
  display: block;
  font-size: 22px;
  line-height: 1;
}

.dart-btn-label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-dim);
  margin-top: 3px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.dart-btn-sublabel {
  display: block;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-dim);
  margin-top: 1px;
}

/* Single / Double / Triple / Bull visual styles */

.dart-btn-single {
  border-color: var(--border);
}

.dart-btn-single .dart-btn-label {
  color: var(--text-dim);
}

/* Double — outer ring feel: thick outer border */

.dart-btn-double {
  border-width: 3px;
  border-color: var(--accent);
  background: transparent;
  position: relative;
}

.dart-btn-double .dart-btn-label {
  color: var(--accent);
}

.dart-btn-double:active:not(:disabled) {
  background: var(--accent);
  border-color: var(--accent);
}

/* Triple — middle ring feel: inset band */

.dart-btn-triple {
  border-color: var(--border);
  background: transparent;
  position: relative;
  box-shadow: inset 0 0 0 3px var(--accent);
}

.dart-btn-triple .dart-btn-label {
  color: var(--accent);
}

.dart-btn-triple:active:not(:disabled) {
  background: var(--accent);
  box-shadow: none;
}

.dart-btn-bull,
.dart-btn-bull-inner {
  border-color: var(--accent);
  border-width: 3px;
  background: rgba(231, 76, 60, 0.08);
}

.dart-btn-bull .dart-btn-label,
.dart-btn-bull-inner .dart-btn-label {
  color: var(--accent);
}

.dart-btn-bull-outer {
  border-color: var(--accent);
  background: transparent;
  box-shadow: inset 0 0 0 3px var(--accent);
}

.dart-btn-bull-outer .dart-btn-label {
  color: var(--accent);
}

.dart-actions {
  display: flex;
  gap: 8px;
}

.dart-actions > * {
  flex: 1;
}

/* ── Overlays ── */

.halved-inline {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(231, 76, 60, 0.12);
  border: 2px solid rgba(231, 76, 60, 0.4);
  border-radius: var(--radius);
  padding: 28px 16px;
  animation: fadeIn 0.15s ease-out;
  cursor: pointer;
}

.halved-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--text);
}

.halved-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-dim);
  animation: fadeIn 0.15s ease-out;
}

.halved-score-anim {
  display: flex;
  align-items: baseline;
  gap: 4px;
  font-weight: 900;
  animation: halvedScoreIn 0.3s ease-out;
}

.halved-before {
  font-size: 48px;
  text-decoration: line-through;
  text-decoration-thickness: 3px;
  text-decoration-color: #f05545;
  opacity: 0;
  animation: halvedStrike 0.4s ease-out 0.1s forwards;
}

@keyframes halvedStrike {
  0% {
    opacity: 1;
    text-decoration-color: transparent;
  }
  50% {
    opacity: 1;
    text-decoration-color: #f05545;
  }
  100% {
    opacity: 0.35;
    text-decoration-color: #f05545;
  }
}

.halved-slash {
  font-size: 30px;
  color: var(--text-dim);
  opacity: 0;
  animation: fadeIn 0.15s ease-out 0.25s forwards;
}

.halved-divisor {
  font-size: 30px;
  color: var(--text-dim);
  opacity: 0;
  animation: fadeIn 0.15s ease-out 0.3s forwards;
}

@keyframes halvedScoreIn {
  from {
    transform: scale(0.8);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.halved-title {
  font-size: 44px;
  font-weight: 900;
  color: #f05545;
  margin: 2px 0;
  opacity: 0;
  animation: halvedTitleIn 0.3s ease-out 0.45s forwards;
}

@keyframes halvedTitleIn {
  0% {
    opacity: 0;
    transform: scale(1.5);
  }
  60% {
    opacity: 1;
    transform: scale(0.95);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

.halved-after {
  font-size: 56px;
  font-weight: 900;
  color: var(--text);
  opacity: 0;
  animation: halvedNewScore 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) 0.7s forwards;
}

@keyframes halvedNewScore {
  0% {
    opacity: 0;
    transform: scale(0.3);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* ── Changelog ── */

.changelog-trigger {
  font-size: 12px;
  color: var(--text-dim);
  background: none;
  border: none;
  padding: 8px;
  cursor: pointer;
  transition: color 0.2s;
}

.changelog-trigger:hover,
.changelog-trigger:active {
  color: var(--text);
}

.changelog-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 20px;
  max-width: 400px;
  width: 100%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}

.changelog-list {
  overflow-y: auto;
  flex: 1;
}

.changelog-entry {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.changelog-entry:last-child {
  border-bottom: none;
}

.changelog-version-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.changelog-version {
  font-size: 13px;
  font-weight: 900;
  color: var(--accent);
  background: var(--bg-input);
  padding: 2px 8px;
  border-radius: 4px;
}

.changelog-date {
  font-size: 11px;
  color: var(--text-dim);
}

.changelog-items {
  margin: 0;
  padding-left: 18px;
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.7;
}

.changelog-items li {
  padding-left: 2px;
}

/* ── Board footer ── */

.board-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 8px;
  margin-bottom: 4px;
}

/* ── Destroy room ── */

.destroy-room-box {
  max-width: 380px;
}

.destroy-room-box h3 {
  margin-bottom: 4px;
}

.destroy-warning-box {
  background: rgba(231, 76, 60, 0.1);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-size: 13px;
  color: var(--text);
  line-height: 1.6;
}

.destroy-player-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  user-select: none;
  transition: border-color 0.15s;
}

.destroy-player-row:has(input:checked) {
  border-color: var(--accent);
  background: rgba(231, 76, 60, 0.06);
}

.destroy-player-name {
  font-weight: 700;
  font-size: 14px;
  flex: 1;
}

.destroy-player-score {
  font-size: 13px;
  color: var(--text-dim);
  font-weight: 600;
}

.destroy-player-sad {
  font-size: 18px;
  width: 24px;
  text-align: center;
}

.destroy-trigger {
  font-size: 12px;
  color: var(--text-dim);
  background: none;
  border: none;
  padding: 8px;
  cursor: pointer;
  transition: color 0.2s;
}

.destroy-trigger:hover,
.destroy-trigger:active {
  color: var(--accent);
}

/* ── Player profile card ── */

.player-profile-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 32px 24px 28px;
  max-width: 320px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  position: relative;
  overflow: hidden;
  animation: profileCardIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes profileCardIn {
  0% {
    transform: scale(0.7) translateY(30px);
    opacity: 0;
  }
  100% {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

.player-profile-card.champion {
  border-color: #d4a017;
  border-width: 2px;
  background: linear-gradient(180deg, #2a2311 0%, #1e1a14 30%, var(--bg-card) 70%);
  box-shadow:
    0 0 50px rgba(241, 196, 15, 0.2),
    0 0 100px rgba(241, 196, 15, 0.08);
}

[data-theme='light'] .player-profile-card.champion {
  background: linear-gradient(180deg, #fef9e7 0%, #fdf2d0 30%, #fff 70%);
  box-shadow:
    0 0 50px rgba(212, 160, 23, 0.15),
    0 0 100px rgba(212, 160, 23, 0.05);
}

.profile-shimmer {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    105deg,
    transparent 30%,
    rgba(241, 196, 15, 0.08) 45%,
    rgba(241, 196, 15, 0.18) 50%,
    rgba(241, 196, 15, 0.08) 55%,
    transparent 70%
  );
  background-size: 300% 100%;
  animation: profileShimmer 3s ease-in-out infinite;
  pointer-events: none;
  border-radius: 20px;
}

@keyframes profileShimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.profile-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition:
    background 0.15s,
    color 0.15s;
  padding: 0;
}

.profile-close:hover,
.profile-close:active {
  background: var(--accent);
  color: var(--accent-btn-text);
  border-color: var(--accent);
}

.profile-avatar-wrap {
  position: relative;
  animation: profileAvatarIn 0.5s ease-out 0.1s both;
}

@keyframes profileAvatarIn {
  0% {
    transform: scale(0) rotate(-20deg);
    opacity: 0;
  }
  60% {
    transform: scale(1.1) rotate(3deg);
  }
  100% {
    transform: scale(1) rotate(0);
    opacity: 1;
  }
}

.player-profile-card.champion .profile-avatar-wrap {
  filter: drop-shadow(0 0 16px rgba(241, 196, 15, 0.4));
}

.profile-medal {
  position: absolute;
  bottom: -4px;
  right: -4px;
  font-size: 28px;
  animation: profileMedalBounce 0.5s ease-out 0.3s both;
}

@keyframes profileMedalBounce {
  0% {
    transform: scale(0) rotate(-30deg);
    opacity: 0;
  }
  70% {
    transform: scale(1.2) rotate(5deg);
  }
  100% {
    transform: scale(1) rotate(0);
    opacity: 1;
  }
}

.profile-name {
  font-size: 24px;
  font-weight: 900;
  color: var(--text);
  text-align: center;
  animation: fadeIn 0.3s ease-out 0.15s both;
}

.player-profile-card.champion .profile-name {
  background: linear-gradient(90deg, #f5d442, #f0b823, #fce588, #f0b823, #f5d442);
  background-size: 300% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation:
    profileNameShine 4s linear infinite,
    fadeIn 0.3s ease-out 0.15s both;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

@keyframes profileNameShine {
  0% {
    background-position: 0% center;
  }
  100% {
    background-position: 300% center;
  }
}

.profile-champion-tag {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 3px;
  color: #f5d442;
  font-weight: 900;
  margin-top: -6px;
  animation: fadeIn 0.3s ease-out 0.25s both;
  text-shadow: 0 0 12px rgba(245, 212, 66, 0.4);
}

[data-theme='light'] .profile-champion-tag {
  color: #92700c;
  text-shadow: none;
}

.profile-score-block {
  text-align: center;
  padding: 16px 0 8px;
  animation: fadeIn 0.3s ease-out 0.2s both;
}

.profile-score-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--text-dim);
  margin-bottom: 4px;
}

.profile-score-value {
  font-size: 52px;
  font-weight: 900;
  color: var(--accent);
  line-height: 1;
}

.player-profile-card.champion .profile-score-value {
  color: #f5d442;
  text-shadow: 0 0 24px rgba(245, 212, 66, 0.4);
}

[data-theme='light'] .player-profile-card.champion .profile-score-value {
  color: #92700c;
  text-shadow: none;
}

.profile-stats {
  display: flex;
  gap: 24px;
  padding: 8px 0;
  animation: fadeIn 0.3s ease-out 0.3s both;
}

.profile-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.profile-stat-value {
  font-size: 22px;
  font-weight: 900;
  color: var(--text);
}

.profile-stat-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-dim);
  font-weight: 600;
}

/* ── Loading ── */

.loading-dart {
  font-size: 48px;
  animation: loadingPulse 1s ease-in-out infinite;
}

@keyframes loadingPulse {
  0%,
  100% {
    transform: scale(1) rotate(0deg);
    opacity: 0.6;
  }
  50% {
    transform: scale(1.15) rotate(10deg);
    opacity: 1;
  }
}

/* ── Player stats ── */

.stats-game-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.stats-rounds-mini {
  display: flex;
  gap: 3px;
  flex-shrink: 0;
}

.stats-round-pip {
  width: 22px;
  height: 22px;
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 700;
  background: var(--bg-card);
  color: var(--text-dim);
  border: 1px solid var(--border);
}

.stats-round-pip.scored {
  background: rgba(46, 204, 113, 0.15);
  border-color: rgba(46, 204, 113, 0.3);
  color: var(--green);
}

.stats-round-pip.halved {
  background: rgba(231, 76, 60, 0.15);
  border-color: rgba(231, 76, 60, 0.3);
  color: var(--accent);
}

/* ── QR Code ── */

.qr-wrap {
  position: relative;
  padding: 12px;
  background: #fff;
  border-radius: var(--radius);
  border: 2px solid var(--border);
}

.qr-inner {
  width: 100%;
  height: 100%;
}

.qr-inner svg {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

.qr-dart {
  position: absolute;
  font-size: 14px;
  z-index: 1;
}

.qr-tl {
  top: -8px;
  left: -8px;
  transform: rotate(-45deg);
}

.qr-tr {
  top: -8px;
  right: -8px;
  transform: rotate(45deg);
}

.qr-bl {
  bottom: -8px;
  left: -8px;
  transform: rotate(-135deg);
}

.qr-br {
  bottom: -8px;
  right: -8px;
  transform: rotate(135deg);
}

/* ── Lobby ── */

.lobby-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.lobby-icon {
  font-size: 28px;
  flex-shrink: 0;
}

.lobby-info {
  flex: 1;
  min-width: 0;
}

.lobby-title {
  font-size: 16px;
  font-weight: 900;
}

.lobby-subtitle {
  font-size: 13px;
  color: var(--text-dim);
}

.lobby-section-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 8px;
}

.lobby-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2px 0;
}

/* ── Default avatar picker ── */

.default-avatar-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.default-avatar-option {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 3px solid var(--border);
  background: transparent;
  cursor: pointer;
  padding: 0;
  overflow: hidden;
  transition:
    border-color 0.15s,
    transform 0.15s;
}

.default-avatar-option:hover,
.default-avatar-option:active {
  border-color: var(--accent);
  transform: scale(1.08);
}

/* ── Shuffle animation ── */

.shuffle-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--bg-input);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  transition: all 0.3s ease;
}

.shuffle-row.locked {
  border-color: var(--accent);
  background: var(--accent-glow);
  animation: shuffleLock 0.35s ease-out;
}

@keyframes shuffleLock {
  0% {
    transform: scale(0.96);
    opacity: 0.6;
  }
  50% {
    transform: scale(1.04);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.shuffle-rank {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 13px;
  color: var(--text-dim);
  flex-shrink: 0;
  transition: all 0.3s;
}

.shuffle-rank.locked {
  background: var(--accent);
  color: var(--accent-btn-text);
}

.shuffle-avatar-wrap {
  flex-shrink: 0;
}

.shuffle-avatar-wrap.spinning {
  animation: avatarSpin 0.3s linear infinite;
}

@keyframes avatarSpin {
  0% {
    transform: rotateY(0deg);
  }
  100% {
    transform: rotateY(360deg);
  }
}

.shuffle-name {
  font-weight: 600;
  font-size: 15px;
  color: var(--text-dim);
  transition: all 0.3s;
}

.shuffle-name.locked {
  font-weight: 900;
  font-size: 18px;
  color: var(--text);
}

/* ── Game controls ── */

.game-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.game-controls-history {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.game-ctrl-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

.game-ctrl-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--text);
}

.game-ctrl-btn:disabled {
  opacity: 0.3;
  cursor: default;
}

.game-ctrl-icon {
  font-size: 18px;
  line-height: 1;
}

.game-ctrl-label {
  font-size: 12px;
  font-weight: 600;
}

.game-controls-actions {
  display: flex;
  gap: 8px;
}

.game-controls-actions > * {
  flex: 1;
}

/* ── Waiting / spectator state ── */

.waiting-card {
  padding: 24px 16px;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: transparent;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.waiting-tally {
  border: 2px dashed var(--border);
  background: transparent;
  min-height: 120px;
}

.halved-inline {
  min-height: 120px;
}

/* ── Feature requests ── */

.feature-modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  max-width: 400px;
  width: 100%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  align-self: flex-start;
  margin-top: 10vh;
}

.feature-card {
  display: flex;
  gap: 10px;
  padding: 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.feature-card-main {
  flex: 1;
  min-width: 0;
}

.feature-card-text {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text);
}

.feature-card-meta {
  display: flex;
  gap: 6px;
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 4px;
}

.feature-vote-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 8px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}

.feature-vote-btn:hover:not(:disabled) {
  border-color: var(--accent);
}

.feature-vote-btn.voted {
  border-color: var(--accent);
  background: rgba(231, 76, 60, 0.08);
}

.feature-vote-arrow {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1;
}

.feature-vote-btn.voted .feature-vote-arrow {
  color: var(--accent);
}

.feature-vote-count {
  font-size: 14px;
  font-weight: 900;
  color: var(--text);
}

.feature-req-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 16px;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s;
  flex-shrink: 0;
}

.feature-req-btn:hover,
.feature-req-btn:active {
  color: var(--accent);
}

/* ── Confetti ── */

.confetti-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 50;
}

.confetti-piece {
  position: absolute;
  top: -20px;
  animation: confettiFall linear forwards;
}

@keyframes confettiFall {
  0% {
    transform: translateY(0) translateX(0) rotate(0deg);
    opacity: 1;
  }
  80% {
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) translateX(var(--drift)) rotate(var(--rotation));
    opacity: 0;
  }
}

.newbest-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(46, 204, 113, 0.92);
  z-index: 100;
  animation: fadeIn 0.2s ease-out;
}

.newbest-overlay h1 {
  font-size: 48px;
  font-weight: 900;
  animation: pulse 0.6s ease-in-out infinite;
}

.newbest-overlay p {
  font-size: 24px;
  font-weight: 700;
}

/* ── Board badge ── */

.board-badge {
  display: inline-block;
  padding: 5px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 50px;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 4px;
  color: var(--text-dim);
}

/* ── Section title ── */

.section-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--text-dim);
  margin-bottom: 16px;
  font-weight: 600;
}

/* ── Round timeline ── */

.round-timeline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  position: relative;
  padding: 0 4px;
}

.round-timeline-track {
  position: absolute;
  top: 13px;
  left: 20px;
  right: 20px;
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  z-index: 0;
}

.round-timeline-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.5s ease;
}

.round-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  position: relative;
  z-index: 1;
  min-width: 0;
  flex: 1;
}

.round-step-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-input);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 900;
  color: var(--text-dim);
  transition: all 0.3s;
}

.round-step.done .round-step-dot {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-btn-text);
  font-size: 12px;
}

.round-step.current .round-step-dot {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
  animation: pulse 2s ease-in-out infinite;
}

.round-step-label {
  font-size: 9px;
  font-weight: 700;
  color: var(--text-dim);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 48px;
  transition: color 0.3s;
}

.round-step.current .round-step-label {
  color: var(--accent);
}

.round-step.done .round-step-label {
  color: var(--text-dim);
  opacity: 0.6;
}

/* ── Game header ── */

.game-header {
  text-align: center;
  padding: 4px 0;
}

.game-round-target {
  font-size: 40px;
  font-weight: 900;
  color: var(--accent);
  line-height: 1.1;
}

.game-round-desc {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 4px;
}

.game-round-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--text-dim);
  margin-bottom: 2px;
}

.game-current-player {
  font-size: 22px;
  font-weight: 900;
  color: var(--yellow);
  text-align: center;
  padding: 4px 0;
}

/* ── Spacing ── */

.stack-xs > * + * {
  margin-top: 8px;
}

.stack-sm > * + * {
  margin-top: 12px;
}

.stack-md > * + * {
  margin-top: 20px;
}

.stack-lg > * + * {
  margin-top: 32px;
}

.flex {
  display: flex;
}

.flex-col {
  display: flex;
  flex-direction: column;
}

.flex-wrap {
  flex-wrap: wrap;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.justify-center {
  justify-content: center;
}

.text-center {
  text-align: center;
}

.text-dim {
  color: var(--text-dim);
}

.text-accent {
  color: var(--accent);
}

.text-sm {
  font-size: 13px;
}

.font-bold {
  font-weight: 700;
}

.w-full {
  width: 100%;
}

.gap-8 {
  gap: 8px;
}

.gap-12 {
  gap: 12px;
}

/* ── Landing ── */

.landing-dart-icon {
  font-size: 96px;
  margin-bottom: 8px;
  animation: dartLand 0.6s ease-out;
}

@keyframes dartLand {
  0% {
    transform: translateY(-40px) rotate(-20deg);
    opacity: 0;
  }
  60% {
    transform: translateY(4px) rotate(5deg);
    opacity: 1;
  }
  100% {
    transform: translateY(0) rotate(0);
    opacity: 1;
  }
}

/* ── High Score Board ── */

.hs-container {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 24px 20px 20px;
}

.hs-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.hs-dartboard {
  position: absolute;
  width: 200px;
  height: 200px;
  top: -30px;
  right: -40px;
  opacity: 0.08;
  animation: dartboardSpin 60s linear infinite;
}

@keyframes dartboardSpin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.hs-flying-dart {
  position: absolute;
  opacity: 0;
  animation: dartFly 4s ease-in-out infinite;
}

@keyframes dartFly {
  0% {
    opacity: 0;
    transform: translateX(0) rotate(30deg);
  }
  10% {
    opacity: 0.6;
  }
  50% {
    opacity: 0.6;
    transform: translateX(calc(50vw - 40px)) rotate(30deg) scale(0.8);
  }
  60% {
    opacity: 0;
    transform: translateX(calc(50vw)) rotate(30deg) scale(0.6);
  }
  100% {
    opacity: 0;
  }
}

.hs-sparkle {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--yellow);
  opacity: 0;
  animation: sparkle 3s ease-in-out infinite;
}

@keyframes sparkle {
  0%,
  100% {
    opacity: 0;
    transform: scale(0);
  }
  50% {
    opacity: 0.8;
    transform: scale(1);
  }
  70% {
    opacity: 0;
    transform: scale(1.5);
  }
}

.hs-header {
  position: relative;
  text-align: center;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hs-trophy {
  font-size: 44px;
  animation: trophyBounce 2s ease-in-out infinite;
}

@keyframes trophyBounce {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-6px);
  }
}

.hs-title {
  font-size: 26px;
  font-weight: 900;
  color: var(--text);
  margin-top: 4px;
}

.hs-subtitle {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 3px;
  color: var(--text-dim);
  margin-top: 2px;
}

.hs-add-btn {
  position: relative;
  background: var(--accent-btn);
  color: var(--accent-btn-text);
}

.hs-warning {
  position: relative;
  background: rgba(231, 76, 60, 0.1);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 16px;
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.6;
}

.hs-warning-title {
  font-size: 14px;
  font-weight: 900;
  color: var(--accent);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.hs-empty {
  position: relative;
  text-align: center;
  padding: 32px 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-dim);
}

.hs-list {
  list-style: none;
  position: relative;
}

.hs-entry {
  display: flex;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  animation: entrySlide 0.4s ease-out both;
  gap: 14px;
}

.hs-entry:last-child {
  border-bottom: none;
}

@keyframes entrySlide {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.hs-entry.gold {
  background: linear-gradient(90deg, rgba(241, 196, 15, 0.08) 0%, transparent 80%);
  border-radius: var(--radius-sm);
  padding: 14px 10px;
  margin: 0 -10px;
}

.hs-rank-badge {
  flex-shrink: 0;
}

.hs-rank {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-input);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 16px;
}

.hs-rank.gold {
  background: linear-gradient(135deg, #f1c40f, #f39c12);
  color: #000;
  box-shadow: 0 0 20px rgba(241, 196, 15, 0.4);
  animation: goldGlow 2s ease-in-out infinite;
}

@keyframes goldGlow {
  0%,
  100% {
    box-shadow: 0 0 15px rgba(241, 196, 15, 0.3);
  }
  50% {
    box-shadow: 0 0 30px rgba(241, 196, 15, 0.6);
  }
}

.hs-rank.silver {
  background: linear-gradient(135deg, #bdc3c7, #95a5a6);
  color: #000;
}

.hs-rank.bronze {
  background: linear-gradient(135deg, #e67e22, #cd7f32);
  color: #000;
}

.hs-player-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.hs-player-name {
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
  transition: color 0.15s;
}

.hs-player-name:hover {
  color: var(--accent);
}

.hs-champion-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--yellow);
  font-weight: 700;
}

.hs-date {
  font-size: 11px;
  color: var(--text-dim);
}

.hs-manual {
  color: var(--text-dim);
  font-size: 16px;
  margin-left: 1px;
  vertical-align: super;
}

.hs-footnote {
  position: relative;
  font-size: 11px;
  color: var(--text-dim);
  text-align: center;
  margin-top: 12px;
  font-style: italic;
}

/* ── Killer mode ── */

.killer-lives {
  display: inline-flex;
  gap: 1px;
  font-size: 14px;
}

.killer-heart {
  transition: all 0.2s;
}

.killer-heart.dead {
  opacity: 0.3;
  filter: grayscale(1);
}

.killer-number-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 2px solid var(--accent);
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  flex-shrink: 0;
}

.killer-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--accent);
  color: var(--accent-btn-text);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.killer-badge-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  background: var(--accent);
  color: var(--accent-btn-text);
  font-size: 10px;
  font-weight: 900;
  flex-shrink: 0;
}

.killer-sb-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  transition: all 0.2s;
}

.killer-sb-row.active {
  border-color: var(--accent);
  animation: rainbowGlow 4s linear infinite;
  background: var(--bg-card);
}

.killer-sb-row.eliminated {
  opacity: 0.35;
  text-decoration: line-through;
}

/* ── 301 grid ── */

.three01-grid {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 360px;
  overflow-y: auto;
}

.three01-number-row {
  display: grid;
  grid-template-columns: 32px 1fr 1fr 1fr;
  gap: 4px;
  align-items: center;
}

.three01-number {
  font-size: 12px;
  font-weight: 900;
  color: var(--text-dim);
  text-align: center;
}

.three01-number-row .dart-btn {
  padding: 10px 4px;
  font-size: 14px;
}

.killer-attack-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

/* ── Language picker ── */

.lang-picker {
  position: relative;
  flex-shrink: 0;
}

.lang-picker-trigger {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-dim);
  transition:
    border-color 0.15s,
    color 0.15s;
}

.lang-picker-trigger:hover,
.lang-picker-trigger:active {
  border-color: var(--accent);
  color: var(--text);
}

.lang-flag {
  font-size: 15px;
  line-height: 1;
}

.lang-code {
  letter-spacing: 0.5px;
}

.lang-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 160px;
  max-height: 240px;
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  z-index: 50;
  padding: 4px;
}

.lang-option {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 12px;
  background: transparent;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  transition: background 0.12s;
  text-align: left;
}

.lang-option:hover {
  background: var(--bg-input);
}

.lang-option.active {
  color: var(--accent);
}

.lang-option-name {
  flex: 1;
}

.lang-check {
  font-size: 12px;
  color: var(--accent);
  font-weight: 900;
}

/* ── Rules helper ── */

.rules-trigger {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 15px;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.rules-trigger:hover,
.rules-trigger:active {
  border-color: var(--accent);
  color: var(--accent);
}

/* Bottom sheet overlay */

.rules-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fadeIn 0.15s ease-out;
}

.rules-sheet {
  width: 100%;
  max-width: 480px;
  max-height: 75vh;
  background: var(--bg-card);
  border-radius: 16px 16px 0 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: sheetUp 0.25s ease-out;
}

@keyframes sheetUp {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

.rules-sheet-handle {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  margin: 10px auto 0;
}

.rules-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.rules-sheet-title {
  font-weight: 900;
  font-size: 16px;
}

.rules-sheet-body {
  padding: 16px;
  overflow-y: auto;
  flex: 1;
}

.rules-summary {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.5;
  margin-bottom: 12px;
}

.rules-list {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.7;
}

.rules-list li {
  padding-left: 2px;
  margin-bottom: 6px;
}

.rules-rounds {
  margin-top: 12px;
  padding: 10px 12px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-dim);
}

.rules-rounds-label {
  font-weight: 700;
  color: var(--text);
}

.rules-dynamic {
  margin-top: 12px;
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.6;
}

.rules-dynamic p {
  margin: 4px 0;
  padding: 8px 12px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
}

/* ── Board settings button ── */

.board-settings-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}

.board-settings-btn:hover,
.board-settings-btn.active {
  border-color: var(--accent);
  color: var(--accent);
}

/* ── Settings ── */

.settings-toggle {
  position: relative;
  width: 48px;
  height: 28px;
  border-radius: 28px;
  background: var(--border);
  border: none;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  transition: background 0.3s;
}

.settings-toggle:has(.settings-toggle-knob.on) {
  background: var(--accent);
}

.settings-toggle-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: white;
  transition: transform 0.3s cubic-bezier(0.68, -0.3, 0.27, 1.3);
}

.settings-toggle-knob.on {
  transform: translateX(20px);
}

.settings-accordion {
  display: flex;
  align-items: center;
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 10px 14px;
  text-align: left;
  transition:
    color 0.15s,
    border-color 0.15s;
}

.settings-accordion:hover,
.settings-accordion:active {
  color: var(--text);
  border-color: var(--accent);
}

.settings-beta-item {
  padding: 8px 10px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

/* ── Toast ── */

.toast-top {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  padding: 14px 20px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  color: var(--text);
  animation: toastSlideDown 0.25s ease-out;
}

@keyframes toastSlideDown {
  from {
    transform: translateY(-100%);
  }
  to {
    transform: translateY(0);
  }
}

.hs-score-wrap {
  display: flex;
  align-items: baseline;
  gap: 4px;
  cursor: pointer;
  transition: transform 0.15s;
}

.hs-score-wrap:active {
  transform: scale(0.95);
}

.hs-score {
  font-size: 28px;
  font-weight: 900;
  color: var(--accent);
}

.hs-pts {
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 600;
  text-transform: uppercase;
}

/* ── Confirm / Modal dialog ── */

.confirm-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.7);
  z-index: 100;
  animation: fadeIn 0.15s ease-out;
  padding: 20px;
}

.confirm-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
  max-width: 360px;
  width: 100%;
}

.confirm-box.text-center {
  text-align: center;
}

.confirm-box h3 {
  font-size: 20px;
  font-weight: 900;
  margin-bottom: 8px;
}

.confirm-box p {
  font-size: 14px;
  color: var(--text-dim);
  margin-bottom: 20px;
  line-height: 1.5;
}

.confirm-actions {
  display: flex;
  gap: 8px;
}

.confirm-actions > * {
  flex: 1;
  white-space: nowrap;
}

.confirm-actions.stacked {
  flex-direction: column;
}

.confirm-actions.stacked > * {
  flex: none;
  width: 100%;
}

/* ── Theme toggle ── */

.theme-toggle {
  position: relative;
  width: 56px;
  height: 30px;
  border-radius: 30px;
  background: var(--bg-input);
  border: 2px solid var(--border);
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  transition:
    background 0.3s,
    border-color 0.3s;
  overflow: hidden;
}

.theme-toggle-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.theme-toggle-knob.light {
  transform: translateX(26px);
}

/* ── Active game cards ── */

.active-game-card {
  display: flex;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.2s;
}

.active-game-card:hover {
  border-color: var(--accent);
}

.active-game-main {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  flex: 1;
  cursor: pointer;
  min-width: 0;
}

.active-game-avatars {
  display: flex;
  flex-shrink: 0;
}

.active-game-avatar-wrap {
  position: relative;
  border: 2px solid var(--bg-card);
  border-radius: 50%;
}

.active-game-info {
  flex: 1;
  min-width: 0;
}

.active-game-round {
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.active-game-status {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 2px;
}

.active-game-arrow {
  font-size: 22px;
  color: var(--text-dim);
  flex-shrink: 0;
}

.active-game-cancel {
  padding: 0 14px;
  align-self: stretch;
  display: flex;
  align-items: center;
  background: none;
  color: var(--text-dim);
  font-size: 14px;
  border-left: 1px solid var(--border);
  transition:
    color 0.15s,
    background 0.15s;
}

.active-game-cancel:hover {
  color: var(--accent);
  background: rgba(231, 76, 60, 0.08);
}

/* ── Game type cards ── */

.game-type-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
  width: 100%;
}

.game-type-card:hover,
.game-type-card:active:not(:disabled) {
  border-color: var(--accent);
  box-shadow: 0 0 16px var(--accent-glow);
}

.game-type-card.disabled {
  opacity: 0.6;
  cursor: default;
}

.game-type-disabled-reason {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  margin-top: 2px;
}

.game-type-icon {
  font-size: 36px;
  flex-shrink: 0;
}

.game-type-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.game-type-name {
  font-size: 18px;
  font-weight: 900;
  color: var(--text);
}

.game-type-desc {
  font-size: 13px;
  color: var(--text-dim);
  font-weight: 600;
}

.game-type-rounds {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 2px;
}

.game-type-arrow {
  font-size: 24px;
  color: var(--text-dim);
  flex-shrink: 0;
}

/* ── Player selection cards ── */

.player-select-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

@media (max-width: 340px) {
  .player-select-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.player-select-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 8px;
  background: var(--bg-input);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.player-select-card:active {
  transform: scale(0.96);
}

.player-select-card.selected {
  border-color: var(--accent);
  background: rgba(var(--accent), 0.08);
  box-shadow: 0 0 16px var(--accent-glow);
}

/* Since we can't use rgba with css var directly, use a filter trick */

.player-select-card.selected {
  border-color: var(--accent);
  box-shadow:
    0 0 20px var(--accent-glow),
    inset 0 0 0 1px var(--accent-glow);
}

.player-select-avatar {
  position: relative;
}

.player-select-check {
  position: absolute;
  bottom: -4px;
  right: -4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-btn-text);
  font-size: 12px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-input);
}

.player-select-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.player-select-card.selected .player-select-name {
  color: var(--accent);
}

/* Start button glow when ready */

.game-start-btn.ready {
  animation: startBtnPulse 2s ease-in-out infinite;
}

@keyframes startBtnPulse {
  0%,
  100% {
    box-shadow: 0 4px 15px var(--accent-glow);
  }
  50% {
    box-shadow:
      0 6px 30px var(--accent-glow),
      0 0 40px var(--accent-glow);
  }
}

/* ── Manual order rows ── */

.manual-order-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.manual-order-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 6px 8px 10px;
  background: var(--bg-input);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  transition:
    transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow 0.35s ease,
    border-color 0.35s ease,
    background 0.35s ease;
  user-select: none;
  -webkit-user-select: none;
  position: relative;
}

.manual-order-row.just-moved {
  border-color: var(--accent);
  background: rgba(231, 76, 60, 0.08);
  animation: rowFlash 0.5s ease-out;
}

@keyframes rowFlash {
  0% {
    transform: scale(1.04);
    box-shadow: 0 0 20px var(--accent-glow);
  }
  100% {
    transform: scale(1);
    box-shadow: none;
  }
}

.manual-order-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-btn-text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 12px;
  flex-shrink: 0;
}

.manual-order-name {
  font-weight: 700;
  font-size: 14px;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.manual-order-arrows {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.manual-order-arrow-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  font-weight: 900;
  cursor: pointer;
  padding: 0;
  transition:
    background 0.12s,
    color 0.12s,
    border-color 0.12s;
  -webkit-tap-highlight-color: transparent;
}

.manual-order-arrow-btn:active:not(:disabled) {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-btn-text);
}

.manual-order-arrow-btn:disabled {
  opacity: 0.15;
  cursor: default;
  pointer-events: none;
}

/* ── Avatar edit hint (modal) ── */

.avatar-edit-hint {
  opacity: 0 !important;
}

*:hover > .avatar-edit-hint,
*:active > .avatar-edit-hint {
  opacity: 1 !important;
}

/* ── Me badge ── */

.me-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 9px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--accent);
  color: var(--accent-btn-text);
  flex-shrink: 0;
  line-height: 1.4;
}

/* ── Accuracy badge ── */

.accuracy-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 900;
  flex-shrink: 0;
  line-height: 1;
}

/* ── Online indicator ── */

.online-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px rgba(46, 204, 113, 0.6);
  flex-shrink: 0;
  animation: onlinePulse 2s ease-in-out infinite;
}

@keyframes onlinePulse {
  0%,
  100% {
    box-shadow: 0 0 4px rgba(46, 204, 113, 0.4);
  }
  50% {
    box-shadow: 0 0 10px rgba(46, 204, 113, 0.8);
  }
}

/* ── App Menu Dropdown ── */

.app-menu-wrap {
  position: relative;
}

.app-menu-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 6px;
  min-width: 200px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  z-index: 100;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.app-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: none;
  border: none;
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  text-align: left;
  width: 100%;
}

.app-menu-item:hover {
  background: var(--bg-input);
}

.app-menu-icon {
  width: 20px;
  text-align: center;
  flex-shrink: 0;
  font-size: 16px;
}

.app-menu-chevron {
  margin-left: auto;
  font-size: 10px;
  color: var(--text-dim);
}

.app-menu-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 8px;
}

.app-menu-lang-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 0 4px 4px;
}

.app-menu-lang-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px 8px 32px;
  border-radius: var(--radius-sm);
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  width: 100%;
}

.app-menu-lang-option:hover {
  background: var(--bg-input);
  color: var(--text);
}

.app-menu-lang-option.active {
  color: var(--accent);
  font-weight: 700;
}

.app-menu-check {
  margin-left: auto;
  font-size: 12px;
}

/* ── Board Title & Banner ── */

.board-banner {
  height: 120px;
  border-radius: var(--radius);
  background-size: cover;
  background-position: center;
  margin-bottom: 12px;
}

.board-banner-preview {
  height: 80px;
  border-radius: var(--radius-sm);
  background-size: cover;
  background-position: center;
}

.board-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  margin: 0;
}

.board-title-row:hover .board-edit-hint {
  opacity: 1;
}

.board-emoji {
  font-size: 24px;
  line-height: 1;
}

.board-edit-hint {
  font-size: 14px;
  opacity: 0;
  transition: opacity 0.15s;
}

.room-emoji-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 4px;
}

.room-emoji-btn {
  width: 36px;
  height: 36px;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.1s;
}

.room-emoji-btn:hover {
  border-color: var(--text-dim);
}

.room-emoji-btn.active {
  border-color: var(--accent);
  background: var(--accent-glow);
}

.passkey-emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 6px;
  justify-items: center;
}

.passkey-slots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.passkey-slot {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  border: 2px dashed var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  transition: all 0.15s;
}

.passkey-slot.filled {
  border-style: solid;
  border-color: var(--accent);
  background: var(--accent-glow);
}

.passkey-undo {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: 4px;
}

.passkey-undo:hover {
  border-color: var(--accent);
  color: var(--accent);
}
