:root {
  --bg: #0a0a0f;
  --bg-card: #14141b;
  --bg-elevated: #1c1c26;
  --text-primary: #f4f4f8;
  --text-secondary: #8b8b9a;
  --text-tertiary: #5c5c6a;
  --color-ai: #7c3aed;
  --color-ai-hover: #8b4ff0;
  --color-real: #06b6d4;
  --color-real-hover: #22c8e0;
  --color-correct: #22c55e;
  --color-wrong: #ef4444;
  --color-border: rgba(255, 255, 255, 0.08);
  --color-border-hover: rgba(255, 255, 255, 0.15);

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;

  --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);

  --font-display: 'Space Grotesk', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-display);
  overflow: hidden;
  overscroll-behavior: none;
}

#app {
  height: 100%;
  position: relative;
}

.screen {
  display: none;
  height: 100%;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 24px 20px;
  flex-direction: column;
  align-items: center;
}

.screen.active {
  display: flex;
  animation: screenFadeIn 0.4s var(--ease-out-expo);
}

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


/* ====== START SCREEN ====== */

.start-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  gap: 16px;
}

.puzzle-number {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-tertiary);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.logo {
  font-size: clamp(48px, 14vw, 64px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
  text-align: center;
  margin: 8px 0;
}

.logo-or {
  font-weight: 400;
  font-style: italic;
  color: var(--text-secondary);
  font-size: 0.6em;
}

.tagline {
  font-size: 15px;
  color: var(--text-secondary);
  font-weight: 400;
}

.theme-name {
  color: var(--text-primary);
  font-weight: 500;
}

.streak-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 24px;
  padding: 16px 32px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
}

.streak-number {
  font-size: 42px;
  font-weight: 700;
  color: #f59e0b;
  line-height: 1;
  font-family: var(--font-mono);
}

.streak-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.btn-primary {
  margin-top: 32px;
  padding: 16px 48px;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 500;
  color: var(--text-primary);
  background: var(--text-primary);
  color: var(--bg);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: transform 0.15s var(--ease-out-quart), opacity 0.2s;
}

.btn-primary:active {
  transform: scale(0.96);
  opacity: 0.9;
}

.hint-first {
  margin-top: 24px;
  font-size: 13px;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
}


/* ====== GAME SCREEN ====== */

.game-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.progress-bar {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--text-secondary);
}

.progress-current {
  color: var(--text-primary);
  font-weight: 500;
  font-size: 18px;
}

.progress-divider {
  margin: 0 4px;
  color: var(--text-tertiary);
}

.progress-total {
  color: var(--text-tertiary);
}

.progress-dots {
  display: flex;
  gap: 6px;
}

.progress-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--bg-elevated);
  transition: background 0.3s var(--ease-out-quart);
}

.progress-dot.answered {
  background: var(--text-tertiary);
}

.progress-dot.correct {
  background: var(--color-correct);
}

.progress-dot.wrong {
  background: var(--color-wrong);
}

.game-stage {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-container {
  position: relative;
  width: 100%;
  max-width: 360px;
  aspect-ratio: 1;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-card);
}

#puzzle-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.3s var(--ease-out-quart), transform 0.4s var(--ease-out-expo);
}

#puzzle-image.loaded {
  opacity: 1;
}

.skeleton-pulse {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, var(--bg-card) 0%, var(--bg-elevated) 50%, var(--bg-card) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

.skeleton-pulse.hidden {
  display: none;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.answer-buttons {
  width: 100%;
  display: flex;
  gap: 12px;
  margin-top: 24px;
  margin-bottom: 12px;
}

.btn-answer {
  flex: 1;
  padding: 18px 0;
  border: 1px solid var(--color-border);
  background: var(--bg-card);
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 500;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transition: all 0.15s var(--ease-out-quart);
}

.btn-answer:active:not(:disabled) {
  transform: scale(0.97);
}

.btn-answer:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.btn-answer.btn-ai:active:not(:disabled) {
  background: var(--color-ai);
  border-color: var(--color-ai);
}

.btn-answer.btn-real:active:not(:disabled) {
  background: var(--color-real);
  border-color: var(--color-real);
}

.btn-icon {
  font-size: 24px;
}

.btn-answer.selected-ai {
  background: var(--color-ai);
  border-color: var(--color-ai);
}

.btn-answer.selected-real {
  background: var(--color-real);
  border-color: var(--color-real);
}


/* ====== FEEDBACK OVERLAY ====== */

.feedback-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  transition: opacity 0.25s var(--ease-out-quart);
}

.feedback-overlay.show {
  display: flex;
  opacity: 1;
}

.feedback-overlay.correct {
  background: var(--color-correct);
}

.feedback-overlay.wrong {
  background: var(--color-wrong);
}

.feedback-content {
  text-align: center;
  padding: 40px;
  max-width: 360px;
}

.feedback-icon {
  font-size: 64px;
  margin-bottom: 16px;
  animation: feedbackPop 0.5s var(--ease-out-expo);
}

@keyframes feedbackPop {
  0% { transform: scale(0); }
  60% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

.feedback-result {
  font-size: 24px;
  font-weight: 700;
  color: white;
  margin-bottom: 12px;
  line-height: 1.3;
}

.feedback-hint {
  font-size: 15px;
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.5;
  font-weight: 400;
}

.btn-next {
  margin-top: 32px;
  padding: 12px 36px;
  background: rgba(0, 0, 0, 0.2);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-md);
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-next:active {
  background: rgba(0, 0, 0, 0.35);
}


/* ====== RESULTS SCREEN ====== */

.results-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  gap: 12px;
}

.results-label {
  font-size: 14px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

.results-score {
  font-size: clamp(56px, 18vw, 80px);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
  font-family: var(--font-mono);
}

.results-title {
  font-size: 20px;
  font-weight: 500;
  color: var(--text-primary);
  margin-top: 4px;
}

.emoji-grid {
  margin: 20px 0 8px;
  padding: 12px 20px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  font-size: 28px;
  letter-spacing: 4px;
  display: flex;
  gap: 4px;
}

.emoji-grid span {
  display: inline-block;
  opacity: 0;
  animation: emojiAppear 0.4s var(--ease-out-expo) forwards;
}

@keyframes emojiAppear {
  from { opacity: 0; transform: translateY(10px) scale(0.8); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.results-stats {
  display: flex;
  gap: 32px;
  margin: 16px 0;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  font-family: var(--font-mono);
}

.stat-label {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.btn-share {
  margin-top: 8px;
}

.share-copied {
  font-size: 13px;
  color: var(--color-correct);
  margin-top: 8px;
}

.countdown-section {
  margin-top: 32px;
  text-align: center;
}

.countdown-label {
  font-size: 12px;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
}

.countdown-timer {
  font-size: 20px;
  font-weight: 500;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  margin-top: 4px;
}

.tomorrow-theme {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 8px;
}

.badge-popup {
  position: fixed;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  border: 1px solid var(--color-border-hover);
  border-radius: var(--radius-md);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 200;
  animation: badgeSlideUp 0.5s var(--ease-out-expo);
}

@keyframes badgeSlideUp {
  from { transform: translate(-50%, 100px); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

.badge-emoji {
  font-size: 32px;
}

.badge-text {
  font-size: 15px;
  font-weight: 500;
}


/* ====== RESPONSIVE ====== */

@media (min-width: 481px) {
  .image-container {
    max-width: 420px;
  }
}

@media (min-width: 768px) {
  .image-container {
    max-width: 500px;
  }
  .btn-answer {
    font-size: 18px;
    padding: 22px 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
