﻿:root {
  color-scheme: dark;
  --ink: #e2e8f0;
  --muted: #94a3b8;
  --accent: #4f8cff;
  --accent-strong: #2f6bff;
  --accent-alt: #1bd6b6;
  --panel: rgba(15, 23, 42, 0.78);
  --panel-border: rgba(148, 163, 184, 0.25);
  --surface: rgba(30, 41, 59, 0.8);
  --shadow: 0 28px 70px rgba(2, 6, 23, 0.5);
  --shadow-soft: 0 20px 40px rgba(2, 6, 23, 0.35);
  --stroke: rgba(148, 163, 184, 0.2);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Sora", system-ui, sans-serif;
  color: var(--ink);
  min-height: 100vh;
  background:
        radial-gradient(circle at 10% 20%, rgba(79, 140, 255, 0.22), transparent 45%),
    radial-gradient(circle at 80% 10%, rgba(27, 214, 182, 0.18), transparent 40%),
    linear-gradient(120deg, #0b1120 0%, #111827 45%, #0f172a 100%);
}

.backdrop {
  position: fixed;
  inset: 0;
  background:
        radial-gradient(circle at 15% 80%, rgba(148, 163, 184, 0.12), transparent 55%),
    radial-gradient(circle at 85% 85%, rgba(79, 140, 255, 0.2), transparent 50%);
  pointer-events: none;
  z-index: 0;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  z-index: 5;
}

.modal {
  width: min(480px, 92vw);
  background: rgba(15, 23, 42, 0.95);
  border-radius: 22px;
  padding: 24px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(148, 163, 184, 0.25);
  display: grid;
  gap: 12px;
  text-align: center;
  animation: fadeUp 400ms ease both;
}

.profiles-modal {
  width: min(620px, 94vw);
  text-align: left;
}

.settings-modal {
  width: min(700px, 94vw);
  text-align: left;
}

.settings-block {
  display: grid;
  gap: 12px;
}

.settings-block h4 {
  margin: 0;
}

.calibration-board {
  width: min(360px, 88vw);
  aspect-ratio: 1;
  margin: 0 auto;
  background: var(--dartboard-image, url("assets/dartboard.svg")) center/contain no-repeat;
  position: relative;
  border-radius: 50%;
  box-shadow: 0 18px 36px rgba(2, 6, 23, 0.35);
}

.calibration-marker {
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: rgba(79, 140, 255, 0.9);
  border: 2px solid rgba(255, 255, 255, 0.9);
  pointer-events: none;
}

.profiles-manager {
  display: grid;
  gap: 12px;
  max-height: 320px;
  overflow-y: auto;
  padding-right: 4px;
}

.profiles-manager .profile-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  background: rgba(30, 41, 59, 0.9);
  border-radius: 16px;
  padding: 10px 12px;
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.profiles-manager img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(47, 107, 255, 0.25);
}

.profiles-manager .profile-meta {
  display: grid;
  gap: 2px;
  font-size: 0.85rem;
  color: var(--muted);
}

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

.profile-form {
  display: grid;
  gap: 12px;
}

.modal h3 {
  margin: 0;
  font-size: 1.5rem;
}

.modal p {
  margin: 0;
  color: var(--muted);
}

.modal-meta {
  display: flex;
  justify-content: center;
  gap: 16px;
  font-weight: 600;
  color: var(--ink);
}

.modal-meta span {
  background: rgba(47, 107, 255, 0.08);
  border-radius: 999px;
  padding: 6px 12px;
  border: 1px solid rgba(47, 107, 255, 0.18);
}

.decider-inputs {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.decider-toggle {
  display: inline-flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.decider-toggle button.active {
  background: rgba(47, 107, 255, 0.12);
  border: 1px solid rgba(47, 107, 255, 0.35);
  color: var(--ink);
}

.decider-board {
  width: min(340px, 80vw);
  aspect-ratio: 1;
  margin: 8px auto 4px;
  background: var(--dartboard-image, url("assets/dartboard.svg")) center/contain no-repeat;
  position: relative;
}

.bull-marker {
  position: absolute;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  border: 2px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.25);
  object-fit: cover;
}

.bull-marker.left {
  border-color: rgba(47, 107, 255, 0.9);
}

.bull-marker.right {
  border-color: rgba(17, 197, 165, 0.9);
}

.coin {
  width: 86px;
  height: 86px;
  margin: 6px auto 4px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #fff7cc, #f2c94c 55%, #d4a634 100%);
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.2);
  display: grid;
  place-items: center;
  font-weight: 700;
  color: #5a3b00;
  transform-style: preserve-3d;
}

.coin-face {
  font-size: 1.4rem;
  border-radius: 50%;
  width: 60px;
  height: 60px;
  display: grid;
  place-items: center;
  background: rgba(30, 41, 59, 0.6);
  border: 2px solid rgba(90, 59, 0, 0.25);
}

.coin.flip {
  animation: coinFlip 900ms ease-in-out;
}

@keyframes coinFlip {
  0% {
    transform: rotateY(0deg);
  }
  50% {
    transform: rotateY(720deg);
  }
  100% {
    transform: rotateY(1440deg);
  }
}

.app {
  position: relative;
  z-index: 1;
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 20px 56px;
  display: grid;
  gap: 24px;
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}


.brand h1 {
  font-family: "Fraunces", serif;
  font-size: clamp(2.2rem, 4vw, 3.2rem);
  margin: 0;
}

.brand-logo {
  width: min(260px, 70vw);
  height: auto;
  display: block;
}

.brand-kicker {
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.25em;
  margin: 0 0 8px;
  color: var(--muted);
}

.status {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  padding: 12px 18px;
  border-radius: 999px;
  box-shadow: var(--shadow-soft);
  font-weight: 600;
}

.panel {
  background: var(--panel);
  border-radius: 26px;
  padding: clamp(22px, 4vw, 34px);
  box-shadow: var(--shadow);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(18px);
  animation: fadeUp 600ms ease both;
}

.profiles-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.profile-card {
  background: rgba(30, 41, 59, 0.9);
  border-radius: 18px;
  padding: 16px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  display: grid;
  gap: 10px;
}

.profile-card img {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(47, 107, 255, 0.25);
}

.profile-card h4 {
  margin: 0;
  font-size: 1.1rem;
}

.profile-stats {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  font-size: 0.85rem;
  color: var(--muted);
}

.profile-stats span strong {
  color: var(--ink);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 22px;
}

.panel-header h2 {
  margin: 0;
  font-size: 1.6rem;
}

.panel-header p {
  margin: 0;
  color: var(--muted);
}

.grid {
  display: grid;
  gap: 16px;
}

.grid.two {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.player-config {
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1fr) repeat(2, minmax(120px, 160px));
  align-items: end;
}

.cpu-name {
  grid-column: 1 / -1;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-strong);
}

.field {
  display: grid;
  gap: 6px;
  font-weight: 600;
}

.field span {
  font-size: 0.9rem;
}

.field.small span {
  font-size: 0.8rem;
  color: var(--muted);
}

.field input,
.field select {
  font: inherit;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--stroke);
  background: rgba(15, 23, 42, 0.9);
  color: var(--ink);
}

.field input:focus,
.field select:focus {
  outline: 2px solid rgba(79, 140, 255, 0.6);
  border-color: rgba(47, 107, 255, 0.6);
}

.stack {
  display: grid;
  gap: 10px;
}

.note {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 500;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 22px;
}

button {
  font: inherit;
  border: none;
  border-radius: 999px;
  padding: 12px 20px;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.18);
}

button:active {
  transform: translateY(1px);
}

button.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff;
  font-weight: 700;
}

button.ghost {
  background: transparent;
  border: 1px solid rgba(148, 163, 184, 0.35);
  color: var(--ink);
}

.hidden {
  display: none !important;
}

.scoreboard {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  margin-bottom: 20px;
}

.card {
  border-radius: 20px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid rgba(148, 163, 184, 0.18);
  box-shadow: 0 18px 40px rgba(2, 6, 23, 0.35);
  display: grid;
  gap: 10px;
}

.card.active {
  outline: 2px solid rgba(79, 140, 255, 0.6);
  background: rgba(30, 41, 59, 0.95);
}

.card h3 {
  margin: 0;
  font-size: 1.2rem;
}

.score-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  margin-right: 10px;
  vertical-align: middle;
  border: 2px solid rgba(47, 107, 255, 0.2);
}

.score {
  font-size: 2.6rem;
  font-weight: 700;
}

.meta {
  display: flex;
  gap: 12px;
  font-size: 0.9rem;
  color: var(--muted);
}

.members {
  display: grid;
  gap: 4px;
  font-size: 0.95rem;
}

.members span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.member-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(47, 107, 255, 0.25);
}

.members span.active {
  color: var(--accent-strong);
  font-weight: 700;
}

.turn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.25);
  margin-bottom: 18px;
}

.turn h3 {
  margin: 0;
}

.turn-sub {
  margin: 4px 0 0;
  color: var(--muted);
}

.pill {
  background: var(--ink);
  color: #fff;
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 600;
}

.input-area {
  display: grid;
  gap: 16px;
  margin-bottom: 16px;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}

.toggle input {
  width: 18px;
  height: 18px;
}

.dartboard-input {
  width: min(360px, 88vw);
  aspect-ratio: 1;
  margin: 0 auto;
  background: var(--dartboard-image, url("assets/dartboard.svg")) center/contain no-repeat;
  position: relative;
  border-radius: 50%;
  box-shadow: 0 18px 36px rgba(2, 6, 23, 0.35);
}

.dartboard-input .dart-hit {
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(79, 140, 255, 0.9);
  border: 2px solid rgba(255, 255, 255, 0.9);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.entry-input {
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--stroke);
  font-size: 1.1rem;
  text-transform: uppercase;
}

.keypad {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(70px, 1fr));
  gap: 8px;
}

.keypad button {
  border-radius: 14px;
  background: rgba(30, 41, 59, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.25);
  padding: 10px;
  font-weight: 600;
}

.keypad button.active {
  background: var(--accent-alt);
  color: #fff;
  border-color: transparent;
}

.keypad.disabled button {
  opacity: 0.5;
  pointer-events: none;
}

.history {
  margin-top: 20px;
}

.history h3 {
  margin-bottom: 10px;
}

.history-item {
  display: flex;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(148, 163, 184, 0.18);
  margin-bottom: 8px;
  font-size: 0.9rem;
}

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

@media (max-width: 720px) {
  .status {
    width: 100%;
  }

  .panel-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .player-config {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1200px) {
  .player-config {
    grid-template-columns: 1fr;
  }

  .panel {
    backdrop-filter: none;
  }

  .modal {
    backdrop-filter: none;
  }

  .card {
    box-shadow: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .panel {
    animation: none;
  }
}

