/* SportsGuesser — blue variant of Harman hub background + DM Sans */
:root {
  --bg: #0d1525;
  --surface: rgba(26, 35, 50, 0.88);
  --border: rgba(96, 165, 250, 0.22);
  --text: #e8eef7;
  --muted: #94a8c4;
  --accent: #7cb8ff;
  --accent-dim: rgba(124, 184, 255, 0.25);
  --success: #7cb8ff;
  --error: #f0a8a8;
  --max-width: min(640px, 100%);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "DM Sans", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  position: relative;
  overflow-x: hidden;
}
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  background: linear-gradient(
    135deg,
    #0d1525 0%,
    #132043 25%,
    #0f1a2e 50%,
    #1a2d4e 75%,
    #0d1525 100%
  );
  background-size: 400% 400%;
  animation: sportsguesser-bg-gradient 12s ease-in-out infinite;
}
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(ellipse 100% 80% at 20% 20%, rgba(59, 130, 246, 0.25) 0%, transparent 50%),
    radial-gradient(ellipse 80% 100% at 80% 80%, rgba(96, 165, 250, 0.2) 0%, transparent 50%),
    radial-gradient(ellipse 60% 60% at 50% 50%, rgba(37, 99, 235, 0.12) 0%, transparent 60%);
  animation: sportsguesser-bg-orbs 16s ease-in-out infinite alternate;
  pointer-events: none;
}
@keyframes sportsguesser-bg-gradient {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}
@keyframes sportsguesser-bg-orbs {
  0% { opacity: 1; transform: scale(1) translate(0, 0) rotate(0deg); }
  100% { opacity: 1; transform: scale(1.15) translate(2%, 1%) rotate(2deg); }
}

#app {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1rem;
}

.screen {
  display: none;
  flex-direction: column;
  min-height: 100vh;
}

.screen.active {
  display: flex;
}

.header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.header h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  font-family: "Libre Baskerville", Georgia, serif;
  letter-spacing: 0.02em;
}

.back-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: inherit;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 8px;
  font-size: 1.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.back-btn:hover {
  background: var(--border);
}

a.back-btn {
  text-decoration: none;
}

/* Home – sport selection */
.sport-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  flex: 1;
  align-content: start;
}

.sport-card {
  aspect-ratio: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  cursor: pointer;
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 600;
  transition: border-color 0.2s, transform 0.1s, box-shadow 0.2s;
  position: relative;
  text-decoration: none;
}

.sport-card:not(.disabled):hover {
  border-color: rgba(124, 184, 255, 0.45);
  transform: scale(1.02);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.25);
}

.sport-card.disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.sport-sub {
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--muted);
}

.sport-icon {
  font-size: 3rem;
}

.sport-badge {
  position: absolute;
  bottom: 0.5rem;
  font-size: 0.7rem;
  font-weight: 400;
  color: var(--muted);
}

/* Basketball – game list */
.game-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.game-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  text-align: left;
  cursor: pointer;
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.game-card:hover {
  border-color: rgba(124, 184, 255, 0.45);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.game-name {
  display: block;
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.game-desc {
  display: block;
  font-size: 0.9rem;
  color: var(--muted);
}

/* Embedded football game (iframe) */
.screen-embed {
  flex: 1;
  min-height: 0;
}

.embed-wrap {
  flex: 1;
  min-height: min(85vh, 880px);
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: rgba(13, 21, 37, 0.75);
}

.game-embed {
  display: block;
  width: 100%;
  height: 100%;
  min-height: min(85vh, 880px);
  border: none;
}

/* Dart game */
.dart-board {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.scores {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.player-score {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  text-align: center;
}

.player-score.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-dim);
}

.player-label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

.score-value {
  font-size: 2rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.turn-indicator {
  text-align: center;
  font-weight: 600;
  color: var(--accent);
  margin: 0;
}

.guess-area-wrapper {
  position: relative;
}

.guess-area {
  display: flex;
  gap: 0.5rem;
}

.dart-suggestions {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  margin: 2px 0 0;
  padding: 0;
  list-style: none;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 8px;
  max-height: 220px;
  overflow-y: auto;
  z-index: 10;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.dart-suggestions:empty {
  display: none;
}

.dart-suggestions li {
  padding: 0.6rem 1rem;
  cursor: pointer;
  font-size: 0.95rem;
  border-bottom: 1px solid var(--border);
}

.dart-suggestions li:last-child {
  border-bottom: none;
}

.dart-suggestions li:hover,
.dart-suggestions li[aria-selected="true"] {
  background: var(--accent-dim);
}

.guess-input {
  flex: 1;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  color: var(--text);
}

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

.guess-input::placeholder {
  color: var(--muted);
}

.guess-btn {
  background: linear-gradient(180deg, rgba(124, 184, 255, 0.28), rgba(124, 184, 255, 0.12));
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1.25rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
}

.guess-btn:hover {
  border-color: rgba(124, 184, 255, 0.45);
}

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

.dart-feedback {
  min-height: 2.5rem;
  padding: 0.5rem 0;
  font-size: 0.95rem;
}

.dart-feedback.success {
  color: var(--success);
}

.dart-feedback.error {
  color: var(--error);
}

.dart-rules {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0;
}
