@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=DM+Sans:wght@400;500;600;700&family=DM+Mono:wght@400;500&display=swap');

/* ============================================================
   STATMASK — SHARED STYLES
   ============================================================ */

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

:root {
  --bg: #f5f4f0;
  --surface: #ffffff;
  --border: #e2e0d8;
  --text: #1a1a1a;
  --text-muted: #888880;
  --text-light: #b0aea6;
  --green: #4caf7d;
  --green-light: #e8f5ee;
  --red: #e05252;
  --red-light: #fdeaea;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.10);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.13);
  --radius: 14px;
  --card-width: 300px;
  --card-height: 480px;
}

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* ── NAV ── */
nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.nav-logo {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 22px;
  letter-spacing: 1.5px;
  color: var(--text);
  text-decoration: none;
  margin-right: 16px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-logo span { color: var(--accent); }

.nav-links {
  display: flex;
  gap: 4px;
  list-style: none;
}

.nav-links a {
  text-decoration: none;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: 20px;
  transition: all 0.15s;
  letter-spacing: 0.5px;
}

.nav-links a:hover { background: var(--bg); color: var(--text); }
.nav-links a.active { background: var(--accent); color: white; }

.nav-spacer { flex: 1; }

.nav-date {
  font-size: 12px;
  color: var(--text-muted);
  font-family: 'DM Mono', monospace;
}

.nav-avg {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px 10px;
  margin-left: 4px;
  line-height: 1;
  gap: 2px;
  white-space: nowrap;
}

.nav-avg-label {
  font-size: 7px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--text-muted);
  font-family: 'DM Mono', monospace;
  text-transform: uppercase;
}

.nav-avg-value {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  font-family: 'DM Mono', monospace;
}

/* ── MAIN LAYOUT ── */
main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px 16px 48px;
  gap: 28px;
}

/* ── PAGE HEADER ── */
.page-header {
  text-align: center;
}

.page-header h1 {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 42px;
  letter-spacing: 2px;
  color: var(--text);
  line-height: 1;
}

.page-header h1 span { color: var(--accent); }

.game-subtitle {
  margin-top: 6px;
  font-size: 14px;
  color: var(--text);
  font-weight: 500;
}

.eligibility-note {
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-light);
  font-family: 'DM Mono', monospace;
  letter-spacing: 0.3px;
}

/* ── SPORTS CARD ── */
.card-wrapper {
  perspective: 1000px;
  width: var(--card-width);
  min-height: var(--card-height);
}

.sports-card {
  width: var(--card-width);
  min-height: var(--card-height);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  border: 1.5px solid var(--border);
  position: relative;
  transition: box-shadow 0.4s, border-color 0.4s;
}

.sports-card.win {
  box-shadow: 0 0 0 3px var(--green), 0 8px 40px rgba(76,175,125,0.25);
  border-color: var(--green);
  animation: winGlow 0.6s ease;
}

.sports-card.lose {
  box-shadow: 0 0 0 3px var(--red), 0 8px 40px rgba(224,82,82,0.2);
  border-color: var(--red);
}

@keyframes winGlow {
  0%   { box-shadow: 0 0 0 0px var(--green), 0 8px 32px rgba(76,175,125,0); transform: scale(1); }
  25%  { box-shadow: 0 0 0 10px var(--green), 0 8px 48px rgba(76,175,125,0.5); transform: scale(1.03); }
  60%  { box-shadow: 0 0 0 6px var(--green), 0 8px 40px rgba(76,175,125,0.35); transform: scale(1.01); }
  100% { box-shadow: 0 0 0 3px var(--green), 0 8px 40px rgba(76,175,125,0.25); transform: scale(1); }
}

/* ── WIN SWEEP ── */
@keyframes sweepDown {
  0%   { transform: translateY(-100%); }
  100% { transform: translateY(500%); }
}

.sports-card.win-sweep {
  overflow: hidden;
}

.sports-card.win-sweep::after {
  content: '';
  position: absolute;
  left: -5%;
  right: -5%;
  top: 0;
  height: 28%;
  background: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(76, 175, 125, 0.2) 25%,
    rgba(255, 255, 255, 0.75) 50%,
    rgba(76, 175, 125, 0.2) 75%,
    transparent 100%
  );
  animation: sweepDown 0.85s cubic-bezier(0.4, 0, 0.4, 1) forwards;
  z-index: 20;
  pointer-events: none;
}

@keyframes wrongFlash {
  0%   { box-shadow: var(--shadow-lg); }
  40%  { box-shadow: 0 0 0 8px var(--red), 0 8px 40px rgba(224,82,82,0.3); }
  100% { box-shadow: var(--shadow-lg); }
}

.sports-card.wrong-flash {
  animation: wrongFlash 0.6s ease;
}

/* ── CARD HEADER (sport texture) ── */
.card-header {
  min-height: 140px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.card-header .sport-label {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 13px;
  letter-spacing: 3px;
  color: rgba(255,255,255,0.7);
  position: relative;
  z-index: 2;
}

.card-header .mystery-name {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 30px;
  letter-spacing: 3px;
  color: white;
  text-align: center;
  padding: 12px;
  filter: blur(14px);
  opacity: 1;
  z-index: 2;
  transition: opacity 0.5s, filter 0.5s;
  pointer-events: none;
  user-select: none;
}

.card-header.revealed .mystery-name {
  opacity: 0;
  filter: blur(0px);
}

.card-header .player-reveal-group {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 20px 10px 10px;
  z-index: 3;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s 0.2s;
}

.card-header.revealed .player-reveal-group { opacity: 1; }

.card-header .player-name-reveal {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 30px;
  letter-spacing: 2px;
  color: white;
  text-shadow: 0 2px 8px rgba(0,0,0,0.3);
  text-align: center;
  padding: 0 12px;
}

.card-header .player-accolades-reveal {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
  padding: 0 10px;
}

.accolade-badge {
  font-size: 9px;
  font-weight: 600;
  color: rgba(255,255,255,0.9);
  background: rgba(255,255,255,0.18);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 20px;
  padding: 3px 8px;
  letter-spacing: 0.3px;
  font-family: 'DM Sans', sans-serif;
  white-space: nowrap;
}

/* ── CLUE ROWS ── */
.clue-rows {
  display: flex;
  flex-direction: column;
}

.clue-row {
  min-height: 72px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 10px 18px;
  gap: 12px;
  position: relative;
  overflow: visible;
  transform-origin: top center;
}

.clue-row-inner {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
}

.clue-row-locked { display: none; }

.clue-num-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.clue-tag {
  font-size: 7px;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: var(--text-muted);
  font-family: 'DM Mono', monospace;
  text-transform: uppercase;
  line-height: 1;
}

.clue-num-circle {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent-light, #f0f0f0);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'DM Mono', monospace;
}

.clue-value {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.45;
  white-space: normal;
  filter: blur(8px);
  transition: filter 0.5s;
  user-select: none;
}

.clue-row.revealed .clue-value {
  filter: blur(0);
  user-select: auto;
}

/* ── GUESS INPUT AREA ── */
.guess-area {
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.guess-count {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.guess-pip {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: transparent;
  transition: all 0.2s;
}

.guess-pip.wrong { background: var(--red); border-color: var(--red); }
.guess-pip.correct { background: var(--green); border-color: var(--green); }

.search-container {
  position: relative;
}

.search-input {
  width: 100%;
  padding: 13px 18px;
  border: 2px solid var(--border);
  border-radius: 12px;
  font-size: 16px;
  font-family: 'DM Sans', sans-serif;
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow, rgba(0,0,0,0.06));
}

.search-input:disabled {
  background: var(--bg);
  color: var(--text-muted);
  cursor: not-allowed;
}

.autocomplete-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  z-index: 50;
  max-height: 200px;
  overflow-y: auto;
  display: none;
}

.autocomplete-dropdown.open { display: block; }

.autocomplete-item {
  padding: 10px 16px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.1s;
  border-bottom: 1px solid var(--border);
}

.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item:hover, .autocomplete-item.active { background: var(--bg); }

.autocomplete-item mark {
  background: none;
  color: var(--accent);
  font-weight: 700;
}

.guess-btn {
  width: 100%;
  padding: 13px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  letter-spacing: 0.5px;
  transition: opacity 0.2s, transform 0.1s;
}

.guess-btn:hover { opacity: 0.9; }
.guess-btn:active { transform: scale(0.98); }
.guess-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

/* ── WRONG GUESSES LIST ── */
.wrong-guesses {
  width: 100%;
  max-width: 360px;
  overflow: hidden;
}

.wrong-guesses-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.wrong-guess-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--red-light);
  color: var(--red);
  font-size: 13px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  margin: 3px;
  text-decoration: line-through;
  text-decoration-color: var(--red);
}

/* ── END STATE ── */
.end-state {
  width: 100%;
  max-width: 360px;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  padding: 20px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  display: none;
  flex-direction: column;
  gap: 14px;
  animation: slideUp 0.4s ease;
}

.end-state.show { display: flex; }

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

.end-state-score {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 28px;
  letter-spacing: 1px;
  line-height: 1;
}

.end-state-score.win-text { color: var(--green); }
.end-state-score.lose-text { color: var(--red); }

.end-state-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: -8px;
}

.emoji-grid {
  font-size: 18px;
  letter-spacing: 4px;
  line-height: 1.6;
}

.share-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 11px 20px;
  background: var(--text);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  transition: opacity 0.2s;
  letter-spacing: 0.3px;
}

.share-btn:hover { opacity: 0.85; }
.share-btn.copied { background: var(--green); }

.come-back {
  font-size: 12px;
  color: var(--text-muted);
  font-family: 'DM Mono', monospace;
}

/* ── LOCKED STATE ── */
.locked-banner {
  display: none;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 12px 18px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  width: 100%;
  max-width: 360px;
}

.locked-banner.show { display: block; }

/* ── SCROLLBAR ── */
.autocomplete-dropdown::-webkit-scrollbar { width: 4px; }
.autocomplete-dropdown::-webkit-scrollbar-track { background: transparent; }
.autocomplete-dropdown::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* ── GAME LAYOUT — MOBILE (column, default) ── */
.game-layout {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  width: 100%;
}

.controls-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 360px;
}

/* ── DESKTOP SIDE-BY-SIDE LAYOUT ── */
@media (min-width: 768px) {
  main {
    align-items: center;
    padding: 32px 24px 48px;
  }

  .game-layout {
    flex-direction: row;
    align-items: flex-start;
    gap: 48px;
    justify-content: center;
    width: auto;
  }

  .card-col {
    flex-shrink: 0;
  }

  .controls-col {
    width: 340px;
    max-width: 340px;
    padding-top: 8px;
  }

  .guess-area {
    max-width: 100%;
    width: 100%;
  }

  .wrong-guesses,
  .end-state,
  .locked-banner {
    max-width: 100%;
    width: 100%;
  }
}

/* ── RESPONSIVE ── */
@media (max-width: 480px) {
  :root {
    --card-width: min(300px, calc(100vw - 32px));
    --card-height: 390px;
  }

  main { padding: 10px 16px 20px; gap: 12px; }

  .page-header h1 { font-size: 32px; }
  .game-subtitle { font-size: 13px; }
  .eligibility-note { font-size: 10px; margin-top: 2px; }

  .card-header { min-height: 120px; }

  .search-input { padding: 10px 14px; font-size: 16px; }
  .guess-btn { padding: 10px; font-size: 14px; }

  .guess-count { padding-top: 4px; }

  nav { padding: 0 12px; gap: 4px; }
  .nav-logo { font-size: 17px; margin-right: 6px; }
  .nav-links { gap: 2px; }
  .nav-links a { font-size: 14px; padding: 5px 9px; letter-spacing: 0; }
  .nav-date { font-size: 10px; white-space: nowrap; }
}

@media (max-width: 390px) {
  :root {
    --card-width: calc(100vw - 28px);
    --card-height: 360px;
  }

  main { padding: 6px 14px 16px; gap: 10px; }

  .page-header h1 { font-size: 28px; }
  .game-subtitle { font-size: 12px; }
  .eligibility-note { display: none; }

  .card-header { min-height: 110px; }
}
