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

:root {
  --bg:        #0d0d1a;
  --surface:   #1a1a30;
  --surface2:  #222240;
  --border:    #2e2e52;
  --accent:    #7c83fd;
  --accent2:   #a78bfa;
  --green:     #22c55e;
  --yellow:    #f59e0b;
  --red:       #f87171;
  --text:      #e2e8f0;
  --muted:     #94a3b8;
  --cat-game:  #6c63ff;
  --cat-env:   #22c55e;
  --cat-music: #f59e0b;
  --cat-sport: #3b82f6;
  --radius:    12px;
  --shadow:    0 4px 24px rgba(0,0,0,0.4);
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  overflow-x: hidden;
}

/* ── Container ────────────────────────────────────────────── */
#game-container {
  min-height: 100dvh;
  max-width: 720px;
  margin: 0 auto;
  padding: 0 1rem 4rem;
  position: relative;
}

/* ── Mute Button ──────────────────────────────────────────── */
#mute-btn {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 100;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 1.1rem;
  cursor: pointer;
  color: var(--text);
  transition: background 0.2s;
}
#mute-btn:hover { background: var(--border); }

/* ── Screens ──────────────────────────────────────────────── */
.screen { display: none; flex-direction: column; align-items: center; padding: 2rem 0 2rem; gap: 1.5rem; }
.screen.active { display: flex; }

/* ── Round Header ─────────────────────────────────────────── */
.round-header {
  width: 100%;
  text-align: center;
}
.round-header h2 {
  font-size: 1.6rem;
  font-weight: 700;
  margin: 0.4rem 0 0.3rem;
  color: var(--text);
}
.round-desc {
  color: var(--muted);
  font-size: 0.95rem;
  max-width: 480px;
  margin: 0 auto;
}
.round-badge {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 12px;
  border-radius: 20px;
}

/* ── Sparky ───────────────────────────────────────────────── */
.sparky-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  width: 100%;
}
.sparky-svg { width: 100px; height: 120px; flex-shrink: 0; }
.sparky-sm  { width: 56px; height: 68px; }

.sparky-inline {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  width: 100%;
  padding: 0 0.5rem;
}

/* ── Speech Bubble ────────────────────────────────────────── */
.bubble {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  font-size: 1rem;
  line-height: 1.6;
  max-width: 440px;
  text-align: center;
  position: relative;
}
.bubble p + p { margin-top: 0.5rem; }
.bubble strong { color: var(--accent); }
.bubble em     { color: var(--yellow); font-style: italic; }

.bubble-sm {
  font-size: 0.9rem;
  padding: 0.6rem 0.9rem;
  text-align: left;
  max-width: 320px;
  border-radius: 10px;
  margin-top: 4px;
}

/* ── Intro ────────────────────────────────────────────────── */
.game-title {
  font-size: 2.2rem;
  font-weight: 800;
  text-align: center;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.game-subtitle {
  color: var(--muted);
  text-align: center;
  font-size: 1rem;
}
.learning-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}
.pill {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 14px;
  font-size: 0.8rem;
  color: var(--muted);
}

/* ── Buttons ──────────────────────────────────────────────── */
.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 50px;
  padding: 0.75rem 2rem;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s, opacity 0.2s;
  min-width: 200px;
  min-height: 48px;
}
.btn-primary:hover:not(:disabled) {
  background: var(--accent2);
  transform: translateY(-2px);
}
.btn-primary:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none;
}

/* ── Feed Grid ────────────────────────────────────────────── */
.feed-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  width: 100%;
}

/* ── Feed Card ────────────────────────────────────────────── */
.feed-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  transition: border-color 0.2s, background 0.2s;
  position: relative;
}
.feed-card:hover { background: var(--surface2); }
.feed-card.suppressed {
  opacity: 0.38;
  filter: grayscale(0.6);
  border-style: dashed;
}
.feed-card.suppressed::after {
  content: '⬇ Suppressed';
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 0.65rem;
  background: var(--red);
  color: #fff;
  padding: 2px 7px;
  border-radius: 10px;
  font-weight: 700;
}

.card-cat {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 8px;
  border-radius: 20px;
  width: fit-content;
}
.card-title {
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
}
.card-desc {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.4;
  flex: 1;
}
.card-like-btn {
  align-self: flex-end;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px 10px;
  cursor: pointer;
  font-size: 1.1rem;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
  color: var(--muted);
  min-width: 44px;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.card-like-btn:hover       { background: var(--surface2); }
.card-like-btn.liked       { background: rgba(248,113,113,0.15); border-color: var(--red); color: var(--red); transform: scale(1.15); }

/* ── Action Bar ───────────────────────────────────────────── */
.action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0 0.25rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.like-counter {
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 600;
}

/* ── Interest Bars ────────────────────────────────────────── */
.interest-bars {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.interest-bars h3 {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.25rem;
}
.bar-row {
  display: grid;
  grid-template-columns: 110px 1fr 42px;
  align-items: center;
  gap: 0.75rem;
}
.bar-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}
.bar-track {
  background: var(--surface2);
  border-radius: 4px;
  height: 14px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.9s cubic-bezier(0.4,0,0.2,1);
  width: 0%;
}
.bar-pct {
  font-size: 0.8rem;
  color: var(--muted);
  text-align: right;
}

/* ── Quiz Panel ───────────────────────────────────────────── */
.quiz-panel {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.quiz-q {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}
.quiz-opts {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.quiz-opt-btn {
  background: var(--surface2);
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 0.65rem 1rem;
  font-size: 0.95rem;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, border-color 0.15s;
  min-height: 48px;
  font-weight: 500;
}
.quiz-opt-btn:hover:not(:disabled) { background: var(--border); }
.quiz-opt-btn.correct { background: rgba(34,197,94,0.15); border-color: var(--green); color: var(--green); }
.quiz-opt-btn.wrong   { background: rgba(248,113,113,0.12); border-color: var(--red);   color: var(--red);   }
.quiz-opt-btn:disabled { cursor: not-allowed; }

.hint-text {
  font-size: 0.85rem;
  color: var(--yellow);
  background: rgba(245,158,11,0.1);
  border: 1px solid rgba(245,158,11,0.25);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
}

/* ── Concept Card ─────────────────────────────────────────── */
.concept-card {
  background: linear-gradient(135deg, rgba(124,131,253,0.12), rgba(167,139,250,0.08));
  border: 1px solid rgba(124,131,253,0.3);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  width: 100%;
}
.concept-card h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--accent);
}
.concept-card p {
  font-size: 0.92rem;
  color: var(--text);
  line-height: 1.6;
}
.concept-card strong { color: var(--accent2); }

/* ── Stars ────────────────────────────────────────────────── */
.stars-row {
  display: flex;
  gap: 0.4rem;
  justify-content: center;
}
.star {
  font-size: 1.8rem;
  transition: transform 0.3s;
}
.star.earned {
  color: var(--yellow);
  text-shadow: 0 0 12px rgba(245,158,11,0.6);
  animation: pop-star 0.4s ease forwards;
}
.star.empty { color: var(--border); }

@keyframes pop-star {
  0%   { transform: scale(0.4); }
  60%  { transform: scale(1.25); }
  100% { transform: scale(1); }
}

/* ── Scenario ─────────────────────────────────────────────── */
#scenario-area {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.scenario-progress {
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.user-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.user-emoji-big { font-size: 2.5rem; flex-shrink: 0; }
.user-name { font-weight: 700; font-size: 1rem; color: var(--text); }
.user-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}
.user-tag {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 1px 10px;
  font-size: 0.72rem;
  color: var(--muted);
}
.scenario-ctx {
  background: var(--surface);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 0.85rem 1rem;
  font-size: 0.92rem;
  color: var(--text);
  line-height: 1.55;
}
.scenario-q {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  text-align: center;
}
.sparky-sc-row {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}
.sc-options {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  width: 100%;
}
.sc-opt-btn {
  background: var(--surface2);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1.1rem;
  font-size: 0.93rem;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
  min-height: 56px;
  font-weight: 500;
  line-height: 1.4;
}
.sc-opt-btn:hover:not(:disabled) {
  background: var(--border);
  transform: translateX(3px);
}
.sc-opt-btn.best  { background: rgba(34,197,94,0.15);  border-color: var(--green); color: var(--green); }
.sc-opt-btn.wrong { background: rgba(248,113,113,0.12); border-color: var(--red);   color: var(--red);   }
.sc-opt-btn:disabled { cursor: not-allowed; transform: none; }

.sc-feedback {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}
.sc-feedback.hidden { display: none; }
.feedback-msg {
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--text);
}
.feedback-icon { font-size: 1.1rem; margin-right: 6px; }

.sc-pts-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--yellow);
  font-weight: 600;
}

/* ── Badge Card (final) ───────────────────────────────────── */
.badge-card {
  text-align: center;
  background: linear-gradient(135deg, rgba(245,158,11,0.12), rgba(124,131,253,0.08));
  border: 2px solid rgba(245,158,11,0.4);
  border-radius: 20px;
  padding: 1.75rem 2.5rem;
  animation: badge-appear 0.6s ease forwards;
}
@keyframes badge-appear {
  0%   { transform: scale(0.6) rotate(-5deg); opacity: 0; }
  70%  { transform: scale(1.08) rotate(1deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); }
}
.badge-icon {
  font-size: 3rem;
  margin-bottom: 0.5rem;
}
.badge-card h2 {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--yellow);
}
.badge-sub {
  font-size: 0.85rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 4px;
}

/* ── Final Insight ────────────────────────────────────────── */
.final-insight {
  background: var(--surface);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 1rem 1.25rem;
  width: 100%;
}
.final-insight p {
  font-size: 0.97rem;
  font-style: italic;
  color: var(--text);
  line-height: 1.6;
}

.score-summary {
  font-size: 0.9rem;
  color: var(--muted);
  text-align: center;
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 480px) {
  .feed-grid { grid-template-columns: 1fr; }
  .game-title { font-size: 1.7rem; }
  .round-header h2 { font-size: 1.3rem; }
  .btn-primary { min-width: 160px; }
  .bar-row { grid-template-columns: 90px 1fr 36px; }
  .sparky-svg { width: 80px; height: 96px; }
}

@media (max-width: 360px) {
  .bar-row { grid-template-columns: 80px 1fr 32px; }
  .bar-label { font-size: 0.8rem; }
}
