/* === StatStack — Styles === */

/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #0f0f23;
  --bg-card: #1a1a2e;
  --bg-card-b: #16213e;
  --accent: #e94560;
  --accent-green: #00c853;
  --accent-red: #ff1744;
  --text: #eee;
  --text-muted: #8892b0;
  --text-dim: #5a6080;
  --border: #2a2a4a;
  --radius: 12px;
  --shadow: 0 4px 24px rgba(0,0,0,0.3);
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --mono: 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
  --max-width: 480px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

.hidden {
  display: none !important;
}

/* --- Header --- */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1rem;
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}

.logo-icon {
  font-size: 1.5rem;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.day-number {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
}

.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}
.icon-btn:hover {
  background: var(--border);
  color: var(--text);
}

/* --- Modal --- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: fadeIn 0.2s ease;
}

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  max-width: 400px;
  width: 100%;
  position: relative;
}

.modal-content h2 {
  margin-bottom: 1rem;
  font-size: 1.25rem;
}

.modal-content p {
  margin-bottom: 0.75rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.modal-content ul {
  list-style: none;
  margin-bottom: 0.75rem;
}

.modal-content li {
  padding: 0.25rem 0;
  color: var(--text-muted);
}

.modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}

/* --- Main --- */
.main {
  flex: 1;
  max-width: var(--max-width);
  width: 100%;
  margin: 0 auto;
  padding: 1rem;
}

/* --- Score Bar --- */
.score-bar {
  margin-bottom: 1rem;
}

.progress-container {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.4s ease;
  width: 0%;
}

.score-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.progress-text {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.score-label {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.score-label strong {
  color: var(--accent);
  font-size: 1rem;
}

/* --- Cards --- */
.game-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.cards-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0;
  position: relative;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  transition: var(--transition);
  position: relative;
}

.card-a {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  border-bottom: none;
}

.card-b {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
  background: var(--bg-card-b);
}

.card-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  margin-bottom: 0.75rem;
  font-weight: 600;
}

.stat-text {
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.4;
  color: var(--text);
  margin-bottom: 0.75rem;
}

.stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--accent);
  font-family: var(--mono);
  letter-spacing: -0.02em;
  transition: all 0.4s ease;
}

.stat-value.revealed {
  animation: revealPop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.stat-source {
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-top: 0.5rem;
}

/* VS Divider */
.vs-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 2;
  margin: -0.75rem 0;
}

.vs-divider span {
  background: var(--accent);
  color: white;
  font-weight: 800;
  font-size: 0.75rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  letter-spacing: 0.05em;
}

/* Card State Colors */
.card.correct {
  border-color: var(--accent-green);
  box-shadow: 0 0 20px rgba(0, 200, 83, 0.15);
}

.card.wrong {
  border-color: var(--accent-red);
  box-shadow: 0 0 20px rgba(255, 23, 68, 0.15);
}

/* --- Feedback --- */
.feedback {
  font-size: 1.1rem;
  font-weight: 700;
  text-align: center;
  padding: 0.5rem;
  animation: fadeIn 0.3s ease;
}

.feedback-correct {
  color: var(--accent-green);
}

.feedback-wrong {
  color: var(--accent-red);
}

/* --- Buttons --- */
.guess-buttons {
  display: flex;
  gap: 0.75rem;
  width: 100%;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.875rem 1.5rem;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  font-family: var(--font);
  -webkit-tap-highlight-color: transparent;
}

.btn:active {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-higher {
  flex: 1;
  background: var(--accent-green);
  color: #fff;
}
.btn-higher:hover:not(:disabled) {
  background: #00e676;
  box-shadow: 0 4px 16px rgba(0, 200, 83, 0.3);
}

.btn-lower {
  flex: 1;
  background: var(--accent-red);
  color: #fff;
}
.btn-lower:hover:not(:disabled) {
  background: #ff5252;
  box-shadow: 0 4px 16px rgba(255, 23, 68, 0.3);
}

.btn-arrow {
  font-size: 0.85rem;
}

.btn-next {
  width: 100%;
  background: var(--accent);
  color: #fff;
  font-size: 1.1rem;
}
.btn-next:hover {
  background: #f25672;
  box-shadow: 0 4px 16px rgba(233, 69, 96, 0.3);
}

.btn-share {
  width: 100%;
  background: var(--accent);
  color: #fff;
  font-size: 1.1rem;
  margin-bottom: 1rem;
}
.btn-share:hover {
  background: #f25672;
}

/* --- Results --- */
.results-area {
  text-align: center;
  animation: fadeIn 0.5s ease;
}

.result-title {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
}

.result-score-container {
  margin-bottom: 1.25rem;
}

.result-score {
  font-size: 2.5rem;
  font-weight: 900;
  color: var(--accent);
  font-family: var(--mono);
}

.result-message {
  color: var(--text-muted);
  margin-top: 0.25rem;
  font-size: 0.95rem;
}

.result-grid {
  font-size: 1.75rem;
  line-height: 1.5;
  letter-spacing: 0.15em;
  margin: 1rem auto;
  text-align: center;
  font-family: 'Apple Color Emoji', 'Segoe UI Emoji', sans-serif;
}

/* --- Countdown --- */
.countdown-container {
  margin: 1.5rem 0;
  padding: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.countdown-label {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-bottom: 0.25rem;
}

.countdown {
  font-size: 1.75rem;
  font-weight: 800;
  font-family: var(--mono);
  color: var(--text);
  letter-spacing: 0.05em;
}

/* --- Stats Grid --- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  margin-top: 1.25rem;
}

.stats-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.75rem 0.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.stats-number {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text);
}

.stats-label {
  font-size: 0.65rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.15rem;
}

/* --- Ad Slots --- */
.ad-slot {
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 1rem 0;
}

.ad-slot:empty {
  display: none;
}

/* --- Toast --- */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 0.75rem 1.5rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 300;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* --- Footer --- */
.footer {
  text-align: center;
  padding: 1.5rem 1rem;
  color: var(--text-dim);
  font-size: 0.75rem;
  border-top: 1px solid var(--border);
  margin-top: 2rem;
}

.footer a {
  color: var(--text-muted);
}
.footer a:hover {
  color: var(--text);
}

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

@keyframes revealPop {
  0% { transform: scale(0.8); opacity: 0.5; }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); opacity: 1; }
}

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

/* --- Responsive --- */
@media (max-width: 380px) {
  .stat-value {
    font-size: 1.5rem;
  }
  .stat-text {
    font-size: 0.9rem;
  }
  .result-grid {
    font-size: 1.5rem;
  }
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 600px) {
  .card {
    padding: 2rem;
  }
  .stat-value {
    font-size: 2.25rem;
  }
  .guess-buttons {
    gap: 1rem;
  }
}

/* --- Content Pages (about, privacy) --- */
.content-page {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1rem;
}

.content-page h1 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

.content-page h2 {
  font-size: 1.15rem;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

.content-page p {
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 0.75rem;
}

.content-page ul {
  color: var(--text-muted);
  margin-left: 1.25rem;
  margin-bottom: 0.75rem;
}

.content-page li {
  margin-bottom: 0.25rem;
  line-height: 1.6;
}

.content-page a {
  color: var(--accent);
}

/* --- Selection color --- */
::selection {
  background: var(--accent);
  color: #fff;
}
