/* ── Wine Label Quiz - WSET Study Tool ── */

:root {
  --bg-primary: #0f0a15;
  --bg-card: #1a1225;
  --bg-card-hover: #231830;
  --text-primary: #f0e8d8;
  --text-secondary: #a89880;
  --text-muted: #6a5a4a;
  --accent-gold: #c9a84c;
  --accent-wine: #8B1A3A;
  --accent-wine-light: #a82a4a;
  --correct: #2d8a4e;
  --correct-bg: rgba(45, 138, 78, 0.15);
  --incorrect: #c43a3a;
  --incorrect-bg: rgba(196, 58, 58, 0.15);
  --border: rgba(201, 168, 76, 0.2);
  --border-active: rgba(201, 168, 76, 0.5);
  --shadow: rgba(0, 0, 0, 0.4);
  --radius: 8px;
  --transition: 0.3s ease;
}

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

body {
  font-family: "Georgia", "Times New Roman", serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
}

/* ── Layout ── */

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 20px;
}

/* ── Header ── */

.app-header {
  text-align: center;
  padding: 30px 0 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 30px;
}

.app-header h1 {
  font-size: 2rem;
  color: var(--accent-gold);
  font-weight: 400;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.app-header .subtitle {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-top: 6px;
  font-style: italic;
}

/* ── Screens ── */

.screen {
  display: none;
  animation: fadeIn 0.4s ease;
}

.screen.active {
  display: block;
}

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

/* ── Welcome Screen ── */

.welcome {
  text-align: center;
  padding: 60px 20px;
}

.welcome h2 {
  font-size: 1.8rem;
  color: var(--text-primary);
  margin-bottom: 20px;
  font-weight: 400;
}

.welcome p {
  color: var(--text-secondary);
  max-width: 500px;
  margin: 0 auto 15px;
  font-size: 1rem;
}

.welcome .instructions {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 25px;
  margin: 30px auto;
  max-width: 500px;
  text-align: left;
}

.welcome .instructions h3 {
  color: var(--accent-gold);
  font-size: 1rem;
  margin-bottom: 12px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.welcome .instructions li {
  color: var(--text-secondary);
  margin-bottom: 8px;
  font-size: 0.9rem;
  list-style: none;
  padding-left: 20px;
  position: relative;
}

.welcome .instructions li::before {
  content: "~";
  position: absolute;
  left: 0;
  color: var(--accent-gold);
}

/* ── Buttons ── */

.btn {
  display: inline-block;
  padding: 14px 40px;
  font-family: inherit;
  font-size: 1rem;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

.btn-primary {
  background: var(--accent-wine);
  color: var(--text-primary);
  border: 1px solid var(--accent-wine-light);
}

.btn-primary:hover {
  background: var(--accent-wine-light);
  transform: translateY(-2px);
  box-shadow: 0 4px 15px var(--shadow);
}

.btn-secondary {
  background: transparent;
  color: var(--accent-gold);
  border: 1px solid var(--accent-gold);
}

.btn-secondary:hover {
  background: rgba(201, 168, 76, 0.1);
  transform: translateY(-2px);
}

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

/* ── Progress Bar ── */

.progress-bar {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 25px;
}

.progress-bar .label {
  color: var(--text-secondary);
  font-size: 0.85rem;
  white-space: nowrap;
}

.progress-track {
  flex: 1;
  height: 6px;
  background: var(--bg-card);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-wine), var(--accent-gold));
  border-radius: 3px;
  transition: width 0.5s ease;
}

.progress-bar .score {
  color: var(--accent-gold);
  font-size: 0.85rem;
  white-space: nowrap;
}

/* ── Quiz Layout ── */

.quiz-content {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 30px;
  align-items: start;
}

.label-area {
  display: flex;
  justify-content: center;
  position: sticky;
  top: 80px;
}

.label-area canvas {
  width: 280px;
  height: auto;
  filter: drop-shadow(0 8px 20px rgba(0,0,0,0.5));
}

/* ── Answer Area ── */

.answer-area {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.question-group {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}

.question-group h3 {
  font-size: 0.8rem;
  color: var(--accent-gold);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 12px;
  font-weight: 400;
}

.options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.option-btn {
  display: block;
  width: 100%;
  padding: 10px 14px;
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--text-primary);
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
}

.option-btn:hover:not(:disabled) {
  border-color: var(--border-active);
  background: var(--bg-card-hover);
}

.option-btn.selected {
  border-color: var(--accent-gold);
  background: rgba(201, 168, 76, 0.1);
  color: var(--accent-gold);
}

.option-btn.correct {
  border-color: var(--correct);
  background: var(--correct-bg);
  color: var(--correct);
}

.option-btn.incorrect {
  border-color: var(--incorrect);
  background: var(--incorrect-bg);
  color: var(--incorrect);
}

.option-btn:disabled {
  cursor: default;
}

/* ── Feedback ── */

.feedback {
  display: none;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-top: 5px;
}

.feedback.visible {
  display: block;
  animation: fadeIn 0.3s ease;
}

.feedback .explanation {
  color: var(--text-secondary);
  font-size: 0.85rem;
  line-height: 1.5;
}

.feedback .explanation strong {
  color: var(--text-primary);
}

/* ── Action Buttons ── */

.action-buttons {
  display: flex;
  gap: 12px;
  margin-top: 5px;
}

/* ── Results Screen ── */

.results {
  text-align: center;
  padding: 40px 20px;
}

.results h2 {
  font-size: 1.8rem;
  color: var(--accent-gold);
  margin-bottom: 10px;
  font-weight: 400;
}

.results .final-score {
  font-size: 3.5rem;
  color: var(--text-primary);
  margin: 20px 0;
  font-weight: 300;
}

.results .final-score span {
  font-size: 1.5rem;
  color: var(--text-secondary);
}

.results .grade {
  font-size: 1.2rem;
  color: var(--accent-gold);
  margin-bottom: 30px;
  font-style: italic;
}

.score-breakdown {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
  max-width: 500px;
  margin: 30px auto;
}

.score-category {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 12px;
}

.score-category .cat-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.score-category .cat-score {
  font-size: 1.8rem;
  color: var(--text-primary);
  font-weight: 300;
}

.score-category .cat-score span {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.results-actions {
  margin-top: 30px;
  display: flex;
  gap: 15px;
  justify-content: center;
}

/* ── Review Section ── */

.review-section {
  margin-top: 40px;
  text-align: left;
}

.review-section h3 {
  text-align: center;
  color: var(--accent-gold);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 20px;
}

.review-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 14px;
  align-items: start;
}

.review-item .q-num {
  font-size: 1.2rem;
  color: var(--text-muted);
  font-weight: 300;
  text-align: center;
  padding-top: 2px;
}

.review-detail {
  font-size: 0.85rem;
  line-height: 1.7;
}

.review-detail .wine-name {
  color: var(--text-primary);
  font-size: 0.95rem;
  margin-bottom: 4px;
}

.review-detail .answer-line {
  color: var(--text-secondary);
}

.review-detail .answer-line .correct-mark {
  color: var(--correct);
}

.review-detail .answer-line .incorrect-mark {
  color: var(--incorrect);
}

/* ── Responsive ── */

@media (max-width: 768px) {
  .quiz-content {
    grid-template-columns: 1fr;
  }

  .label-area {
    position: static;
  }

  .label-area canvas {
    width: 220px;
  }

  .app-header h1 {
    font-size: 1.4rem;
  }

  .score-breakdown {
    grid-template-columns: 1fr;
    max-width: 250px;
  }

  .results-actions {
    flex-direction: column;
    align-items: center;
  }

  .welcome {
    padding: 30px 10px;
  }
}

/* ── Footer ── */

.app-footer {
  text-align: center;
  padding: 30px 0;
  margin-top: 40px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.75rem;
}

/* ═══════════════════════════════════════════════════════════════
   Site Navigation
   ═══════════════════════════════════════════════════════════════ */

.site-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 30px;
  background: rgba(10, 6, 16, 0.9);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-brand {
  font-size: 1.1rem;
  color: var(--accent-gold);
  text-decoration: none;
  letter-spacing: 1.5px;
  font-weight: 400;
}

.nav-brand:hover {
  color: #e0c870;
}

.nav-links {
  display: flex;
  gap: 25px;
}

.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.85rem;
  letter-spacing: 0.5px;
  transition: color var(--transition);
  position: relative;
}

.nav-link:hover {
  color: var(--text-primary);
}

.nav-link.active {
  color: var(--accent-gold);
}

.nav-link.active::after {
  content: "";
  position: absolute;
  bottom: -4px;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--accent-gold);
}

/* ═══════════════════════════════════════════════════════════════
   Homepage — Magic 8-Ball
   ═══════════════════════════════════════════════════════════════ */

/* Blue-tinted overrides for home page */
.home-page {
  --bg-primary: #080c18;
  --bg-card: #0f1528;
  --bg-card-hover: #151d35;
  --accent-gold: #6aadff;
  --accent-wine: #1a4a8a;
  --accent-wine-light: #2560a8;
  --border: rgba(106, 173, 255, 0.15);
  --border-active: rgba(106, 173, 255, 0.4);
  --text-primary: #e4ecf8;
  --text-secondary: #8a9cbc;
  --text-muted: #506080;
  background: linear-gradient(160deg, #080c18 0%, #0a1228 40%, #0c1a35 100%);
}

.home-page .site-nav {
  background: rgba(8, 12, 24, 0.92);
}

.home-page .nav-brand {
  color: #6aadff;
}

.home-page .nav-brand:hover {
  color: #8ec4ff;
}

.home-page .nav-link.active {
  color: #6aadff;
}

.home-page .btn-secondary {
  color: #6aadff;
  border-color: #6aadff;
}

.home-page .btn-secondary:hover {
  background: rgba(106, 173, 255, 0.1);
}

.home-page .app-footer {
  color: var(--text-muted);
  border-top-color: var(--border);
}

.home-container {
  max-width: 700px;
  margin: 0 auto;
  padding: 20px;
  text-align: center;
}

.hero {
  padding: 60px 20px 30px;
}

.hero-title {
  font-size: 2.4rem;
  font-weight: 300;
  color: var(--text-primary);
  line-height: 1.3;
  letter-spacing: 1px;
}

.hero-sub {
  font-size: 1rem;
  color: var(--text-secondary);
  font-style: italic;
  margin-top: 15px;
  transition: opacity 0.4s ease;
}

/* ── The Ball ── */

.ball-section {
  padding: 20px 0 40px;
  display: flex;
  justify-content: center;
}

.magic-ball {
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #444, #1a1a1a 50%, #000 100%);
  position: relative;
  cursor: pointer;
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.7),
    inset 0 -8px 20px rgba(0, 0, 0, 0.6),
    inset 0 8px 20px rgba(80, 80, 80, 0.15);
  user-select: none;
  transition: transform 0.2s ease;
}

.magic-ball:hover {
  transform: scale(1.03);
}

.magic-ball:active {
  transform: scale(0.97);
}

/* Glossy highlight */
.ball-shine {
  position: absolute;
  width: 80px;
  height: 50px;
  background: radial-gradient(ellipse, rgba(255,255,255,0.25), transparent 70%);
  top: 25px;
  left: 50px;
  border-radius: 50%;
  pointer-events: none;
}

/* The "8" on top */
.ball-eight {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 60px;
  background: radial-gradient(circle, #ffffff, #e0e0e0);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: Arial, sans-serif;
  font-size: 36px;
  font-weight: 900;
  color: #1a1a1a;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
  pointer-events: none;
}

/* Blue triangle window */
.ball-window {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  height: 120px;
  background: radial-gradient(circle, #0a1628, #06102a);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.8);
  overflow: hidden;
  pointer-events: none;
}

.ball-triangle {
  width: 0;
  height: 0;
  border-left: 48px solid transparent;
  border-right: 48px solid transparent;
  border-bottom: 82px solid #0d1f3c;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ball-answer {
  position: absolute;
  bottom: -65px;
  left: 50%;
  transform: translateX(-50%);
  width: 90px;
  text-align: center;
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: #4a9eff;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0;
  transition: opacity 0.6s ease;
  line-height: 1.2;
}

.ball-answer.visible {
  opacity: 1;
}

/* ── Shake Animation ── */

.magic-ball.shaking {
  animation: ballShake 1.5s ease-in-out;
}

@keyframes ballShake {
  0% { transform: rotate(0deg) translateY(0); }
  5% { transform: rotate(-12deg) translateY(-8px); }
  10% { transform: rotate(10deg) translateY(-6px); }
  15% { transform: rotate(-14deg) translateY(-10px); }
  20% { transform: rotate(8deg) translateY(-4px); }
  25% { transform: rotate(-10deg) translateY(-12px); }
  30% { transform: rotate(12deg) translateY(-8px); }
  35% { transform: rotate(-8deg) translateY(-6px); }
  40% { transform: rotate(6deg) translateY(-10px); }
  45% { transform: rotate(-6deg) translateY(-4px); }
  50% { transform: rotate(4deg) translateY(-6px); }
  55% { transform: rotate(-4deg) translateY(-2px); }
  60% { transform: rotate(3deg) translateY(-4px); }
  65% { transform: rotate(-2deg) translateY(-2px); }
  70% { transform: rotate(2deg) translateY(-1px); }
  80% { transform: rotate(-1deg) translateY(0); }
  90% { transform: rotate(0.5deg) translateY(0); }
  100% { transform: rotate(0deg) translateY(0); }
}

/* ── Result Card ── */

.result-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 30px 25px;
  margin: 0 auto;
  max-width: 520px;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease, transform 0.5s ease;
  pointer-events: none;
}

.result-card.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.result-country {
  font-size: 2rem;
  color: var(--accent-gold);
  font-weight: 400;
  margin-bottom: 15px;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.result-fact {
  color: var(--text-primary);
  font-size: 1rem;
  line-height: 1.6;
  margin-bottom: 18px;
  font-style: italic;
}

.result-reason {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.5;
  padding-top: 15px;
  border-top: 1px solid var(--border);
}

.result-reason::before {
  content: "Why go? ";
  color: var(--accent-gold);
  font-style: normal;
  font-weight: 400;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 1px;
}

/* ── Home Actions ── */

.home-actions {
  padding: 25px 0;
  display: flex;
  justify-content: center;
}

/* ── Homepage Responsive ── */

@media (max-width: 768px) {
  .hero-title {
    font-size: 1.6rem;
  }

  .magic-ball {
    width: 200px;
    height: 200px;
  }

  .ball-eight {
    width: 46px;
    height: 46px;
    font-size: 28px;
    top: 14px;
  }

  .ball-window {
    width: 90px;
    height: 90px;
    bottom: 30px;
  }

  .ball-triangle {
    border-left: 36px solid transparent;
    border-right: 36px solid transparent;
    border-bottom: 62px solid #0d1f3c;
  }

  .ball-answer {
    font-size: 11px;
    width: 70px;
    bottom: -50px;
  }

  .ball-shine {
    width: 60px;
    height: 35px;
    top: 18px;
    left: 35px;
  }

  .site-nav {
    padding: 12px 16px;
  }

  .nav-brand {
    font-size: 0.9rem;
  }

  .nav-link {
    font-size: 0.78rem;
  }

  .result-country {
    font-size: 1.5rem;
  }
}
