/* ===== Footix — Design System ===== */
/* Light + Dark mode, green gazon / stadium theme */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;700&family=Russo+One&family=Space+Mono:wght@400;700&display=swap');

/* ===== RESET ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body, input, button, select, textarea { font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
img { max-width: 100%; display: block; }
button { cursor: pointer; border: none; background: none; font: inherit; }

/* ===== CSS VARIABLES — LIGHT MODE ===== */
:root {
  --bg:              #F5F9F0;
  --bg-secondary:    #EBF2E4;
  --surface:         #FFFFFF;
  --surface-warm:    #F0F5E8;
  --text:            #1A2E1A;
  --text-secondary:  #3A5A3A;
  --text-muted:      #7A9A7A;
  --border:          #D2E0C8;

  --accent:          #2E7D32;
  --accent-hover:    #1B5E20;
  --accent-light:    #4CAF50;
  --accent-dim:      rgba(46, 125, 50, 0.12);
  --gold:            #D4A017;
  --gold-light:      #FFD54F;

  --success:         #2E7D32;
  --close:           #F59E0B;
  --wrong:           #DC2626;
  --blue:            #2563EB;

  --radius:          12px;
  --radius-sm:       8px;
  --radius-xs:       4px;
  --shadow:          0 4px 16px rgba(0, 0, 0, 0.08);
  --shadow-lg:       0 8px 32px rgba(0, 0, 0, 0.12);
  --transition:      0.25s ease;

  /* Score level colors */
  --level-0:  #1A237E;
  --level-1:  #0D47A1;
  --level-2:  #01579B;
  --level-3:  #0277BD;
  --level-4:  #F57F17;
  --level-5:  #E65100;
  --level-6:  #D32F2F;
  --level-7:  #B71C1C;
  --level-8:  #2E7D32;
}

/* ===== DARK MODE ===== */
[data-theme="dark"] {
  --bg:              #0F1A0F;
  --bg-secondary:    #152215;
  --surface:         #1E3320;
  --surface-warm:    #253D25;
  --text:            #E8F0E4;
  --text-secondary:  #B8D4B0;
  --text-muted:      #6A8A62;
  --border:          #2A4A2A;

  --accent:          #4CAF50;
  --accent-hover:    #66BB6A;
  --accent-light:    #81C784;
  --accent-dim:      rgba(76, 175, 80, 0.15);
  --gold:            #FFD54F;
  --gold-light:      #FFECB3;

  --shadow:          0 4px 16px rgba(0, 0, 0, 0.3);
  --shadow-lg:       0 8px 32px rgba(0, 0, 0, 0.5);
}

/* ===== BODY ===== */
body {
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  transition: background var(--transition), color var(--transition);
}

/* ===== TYPOGRAPHY ===== */
.font-display { font-family: 'Russo One', sans-serif; font-weight: 400; }
.font-mono { font-family: 'Space Mono', monospace; }

h1, h2, h3 { font-family: 'Russo One', sans-serif; font-weight: 400; letter-spacing: 0.02em; }
h1 { font-size: 2.4rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.1rem; }

/* ===== LAYOUT ===== */
.page-wrapper {
  max-width: 860px;
  width: 100%;
  margin: 0 auto;
  padding: 0 16px 80px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ===== HEADER ===== */
.header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  justify-content: center;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.btn-back {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 1.1rem;
  transition: all var(--transition);
}
.btn-back:hover { border-color: var(--accent); background: var(--accent-dim); }

/* Logo */
.logo {
  font-family: 'Russo One', sans-serif;
  font-size: 1.6rem;
  background: linear-gradient(135deg, var(--accent), var(--gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
}
.logo-icon { -webkit-text-fill-color: initial; font-size: 1.4rem; }

/* Nav tabs */
.nav-tab {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: all var(--transition);
  white-space: nowrap;
}
.nav-tab:hover { color: var(--text); background: var(--accent-dim); }
.nav-tab.active { color: var(--accent); background: var(--accent-dim); font-weight: 700; }

/* Header icon buttons */
.icon-btn {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: all var(--transition);
}
.icon-btn:hover { border-color: var(--text-muted); }
.icon-btn.active { border-color: var(--accent); background: var(--accent-dim); }

/* ===== DIFFICULTY SELECTOR ===== */
.difficulty-selector {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 8px 0 20px;
}

.diff-btn {
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}
.diff-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--text-secondary); }
.diff-btn.active { border-color: var(--accent); background: var(--accent-dim); color: var(--accent); }
.diff-btn.locked, .diff-btn:disabled { opacity: 0.3; cursor: not-allowed; }

/* ===== SEARCH BAR ===== */
.search-row {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  align-items: stretch;
}

.search-wrap { flex: 1; position: relative; }

.search-input {
  width: 100%;
  padding: 14px 18px;
  border-radius: var(--radius);
  border: 2px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.95rem;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.search-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
.search-input:disabled { opacity: 0.5; cursor: not-allowed; }
.search-input::placeholder { color: var(--text-muted); }

.btn-guess {
  padding: 14px 28px;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn-guess:hover:not(:disabled) { background: var(--accent-hover); transform: translateY(-1px); }
.btn-guess:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-guess.loading { position: relative; color: transparent; }
.btn-guess.loading::after {
  content: ''; position: absolute; inset: 0; margin: auto;
  width: 20px; height: 20px; border: 2px solid #fff; border-top-color: transparent;
  border-radius: 50%; animation: spin 0.6s linear infinite;
}

/* ===== AUTOCOMPLETE ===== */
.autocomplete-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  max-height: 280px;
  overflow-y: auto;
  z-index: 100;
  display: none;
  box-shadow: var(--shadow-lg);
}
.autocomplete-dropdown.active { display: block; }

.autocomplete-item {
  padding: 10px 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  transition: background var(--transition);
  border-bottom: 1px solid var(--border);
}
.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item:hover, .autocomplete-item.highlighted { background: var(--surface-warm); }
.autocomplete-item-name { font-weight: 600; }
.autocomplete-item-detail { color: var(--text-muted); font-size: 0.8rem; margin-left: auto; }

/* ===== STATUS BAR ===== */
.status-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 10px 16px;
  margin-bottom: 16px;
  font-size: 0.82rem;
  color: var(--text-muted);
  background: var(--surface);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.status-bar strong { color: var(--accent); font-family: 'Space Mono', monospace; }
.status-bar .sep { color: var(--border); }

/* ===== CARD ===== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

/* ===== RESULTS TABLE ===== */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.results-table thead th {
  padding: 10px 12px;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  background: var(--bg-secondary);
}

.results-table tbody tr {
  transition: background var(--transition);
}
.results-table tbody tr:hover { background: var(--surface-warm); }
.results-table tbody tr.latest-guess { background: var(--surface-warm); }
.results-table tbody tr.victory-row { background: rgba(46, 125, 50, 0.08); }

.results-table tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  font-size: 0.82rem;
}
.results-table tbody tr:last-child td { border-bottom: none; }

/* Cell states */
.cell-match { background: rgba(46, 125, 50, 0.12); color: var(--success); }
.cell-partial { background: rgba(245, 158, 11, 0.1); color: var(--close); }
.cell-none { background: rgba(220, 38, 38, 0.08); color: var(--wrong); }

/* ===== VICTORY OVERLAY ===== */
.victory-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.victory-overlay.active { display: flex; }

.victory-card {
  background: var(--surface);
  border: 2px solid var(--gold);
  border-radius: var(--radius);
  padding: 40px 32px;
  text-align: center;
  max-width: 420px;
  width: 90%;
  box-shadow: 0 0 60px rgba(212, 160, 23, 0.15);
  animation: slideUp 0.5s ease;
}
.victory-emoji { font-size: 3.5rem; margin-bottom: 12px; }
.victory-title { font-family: 'Russo One', sans-serif; font-size: 1.8rem; color: var(--gold); margin-bottom: 8px; }
.victory-subtitle { color: var(--text-secondary); margin-bottom: 24px; }

.victory-share-buttons {
  display: flex; flex-wrap: wrap; gap: 8px;
  justify-content: center; margin-bottom: 16px;
}
.btn-share {
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem; font-weight: 600;
  color: #fff; transition: opacity var(--transition);
}
.btn-share:hover { opacity: 0.85; }
.btn-share.twitter { background: #1da1f2; }
.btn-share.facebook { background: #1877f2; }
.btn-share.whatsapp { background: #25d366; }
.btn-share.telegram { background: #0088cc; }
.btn-share.copy { background: var(--bg-secondary); color: var(--text); border: 1px solid var(--border); }

.btn-close-overlay {
  color: var(--text-muted); font-size: 0.85rem; padding: 8px 16px;
  transition: color var(--transition);
}
.btn-close-overlay:hover { color: var(--text); }

/* ===== CONFETTI ===== */
#confetti-canvas {
  position: fixed; inset: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 1001;
}

/* ===== MASCOTTE ===== */
.mascot-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.mascot-container svg {
  width: 120px; height: 120px;
  transition: all 0.3s ease;
}

.mascot-bubble {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  box-shadow: var(--shadow);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}
.mascot-bubble::after {
  content: ''; position: absolute; top: 100%; left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--border);
}
.mascot-bubble.visible { opacity: 1; }

/* Mascot animations */
@keyframes mascotFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes mascotJump { 0% { transform: translateY(0); } 40% { transform: translateY(-20px); } 100% { transform: translateY(0); } }
@keyframes mascotShiver { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-2px); } 75% { transform: translateX(2px); } }
@keyframes mascotSlide { 0% { transform: translateX(0); } 50% { transform: translateX(30px); } 100% { transform: translateX(0); } }

.mascot-state-neutral svg { animation: mascotFloat 3s ease-in-out infinite; }
.mascot-state-search svg { animation: mascotFloat 2s ease-in-out infinite; }
.mascot-state-hot svg { animation: mascotShiver 0.15s ease 5; }
.mascot-state-cold svg { animation: mascotShiver 0.1s ease 5; }
.mascot-state-victory svg { animation: mascotJump 0.5s ease; }
.mascot-state-celebration svg { animation: mascotSlide 0.6s ease; }

/* ===== ANIMATIONS ===== */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); max-height: 0; } to { opacity: 1; transform: translateY(0); max-height: 500px; } }
@keyframes slideRow { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: translateX(0); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.03); } }
@keyframes popIn { 0% { transform: scale(0.5); opacity: 0; } 70% { transform: scale(1.1); } 100% { transform: scale(1); opacity: 1; } }
@keyframes countUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes glow { 0%, 100% { box-shadow: 0 0 8px var(--accent-dim); } 50% { box-shadow: 0 0 20px var(--accent-dim); } }

.anim-slide-in { animation: slideDown 0.3s ease forwards; }
.anim-fade-in { animation: fadeIn 0.3s ease; }
.anim-pop-in { animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); }

/* ===== AUDIO CONTROLS (header) ===== */
.audio-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}
.audio-btn {
  background: none;
  border: none;
  font-size: 1rem;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px;
  border-radius: var(--radius-xs);
  transition: color var(--transition), background var(--transition);
}
.audio-btn:hover { color: var(--accent); }
.audio-btn.active { color: var(--accent); background: var(--accent-dim); }
.audio-slider {
  width: 60px;
  height: 4px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* ===== RADIO BAR ===== */
.radio-bar {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: 44px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: none;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  z-index: 999;
  font-size: 0.8rem;
}
.radio-bar.active { display: flex; }
.radio-icon { font-size: 1rem; }
.radio-track { flex: 1; color: var(--text); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.radio-btn { color: var(--text); font-size: 1rem; padding: 4px; transition: color var(--transition); }
.radio-btn:hover { color: var(--accent); }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  h1 { font-size: 1.8rem; }
  .page-wrapper { padding: 0 12px 60px; }
  .header-nav { display: none; }
  .logo { font-size: 1.3rem; }
  .mascot-container svg { width: 80px; height: 80px; }
  .search-row { flex-wrap: wrap; }
  .search-wrap { min-width: 100%; }
  .btn-guess { flex: 1; }
  .difficulty-selector { gap: 6px; }
  .diff-btn { padding: 6px 12px; font-size: 0.78rem; }
  .status-bar { gap: 12px; font-size: 0.75rem; flex-wrap: wrap; justify-content: center; }
  .results-table thead th, .results-table tbody td { padding: 8px; font-size: 0.75rem; }
}

@media (max-width: 480px) {
  .logo { font-size: 1.1rem; }
  .status-bar { flex-direction: column; gap: 4px; }
}
