/* ===== VARIABLES ===== */
:root {
  --blue-night:  #080f20;
  --blue-deep:   #1a3a5c;
  --blue-mid:    #2a5f8f;
  --blue-light:  #c8dff0;
  --gold:        #c8a84b;
  --gold-light:  #f0d98a;
  --gold-dark:   #8a6428;
  --cream:       #fdf8ef;
  --text-dark:   #1a1a2e;
  --text-muted:  #6b7280;
  --white:       #ffffff;
  --correct:     #27ae60;
  --correct-bg:  #d4edda;
  --wrong:       #e74c3c;
  --wrong-bg:    #fde8e8;
  --shadow-card: 0 10px 40px rgba(0,0,0,0.4), 0 2px 10px rgba(0,0,0,0.25);
}

/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-tap-highlight-color: transparent; }
body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--text-dark);
  overflow-x: hidden;
}

/* ===== ANIMATED BACKGROUND ===== */
.bg-scene {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: linear-gradient(155deg, #060d1a 0%, #0c1e3c 40%, #0f243f 65%, #080f1e 100%);
  overflow: hidden;
}

.bg-scene::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 55% 50% at 15% 85%, rgba(200,168,75,0.09) 0%, transparent 65%),
    radial-gradient(ellipse 45% 40% at 85% 15%, rgba(42,95,143,0.14) 0%, transparent 65%),
    radial-gradient(ellipse 70% 60% at 50% 50%, rgba(8,15,30,0.4) 0%, transparent 80%);
  pointer-events: none;
}

/* Water glow at bottom */
.water-layer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 100px;
  background: linear-gradient(to top, rgba(8,20,55,0.7) 0%, rgba(10,25,60,0.3) 50%, transparent 100%);
  animation: waterPulse 9s ease-in-out infinite;
}
@keyframes waterPulse {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 0.9; }
}

/* Stars */
.bg-stars { position: absolute; inset: 0; }
.star {
  position: absolute;
  width: 3px; height: 3px;
  border-radius: 50%;
  background: rgba(240,217,138,0.8);
}
.star:nth-child(3), .star:nth-child(7) { width: 4px; height: 4px; }
.star:nth-child(1) { animation: twinkle 3.2s ease-in-out infinite; }
.star:nth-child(2) { animation: twinkle 4.1s ease-in-out infinite 0.8s; }
.star:nth-child(3) { animation: twinkle 2.7s ease-in-out infinite 1.5s; }
.star:nth-child(4) { animation: twinkle 5.1s ease-in-out infinite 0.3s; }
.star:nth-child(5) { animation: twinkle 3.4s ease-in-out infinite 2.1s; }
.star:nth-child(6) { animation: twinkle 4.7s ease-in-out infinite 1.2s; }
.star:nth-child(7) { animation: twinkle 3.0s ease-in-out infinite 2.8s; }
.star:nth-child(8) { animation: twinkle 3.8s ease-in-out infinite 0.6s; }
@keyframes twinkle {
  0%, 100% { opacity: 0.12; transform: scale(1); }
  50% { opacity: 0.95; transform: scale(1.9); }
}

/* Sailing ships */
.ship {
  position: absolute;
  opacity: 0.13;
  will-change: transform;
  filter: drop-shadow(0 3px 6px rgba(0,0,0,0.4));
}
.ship svg { display: block; }
.ship-1 { top: 10%; animation: sailRight 48s linear infinite; }
.ship-1 svg { width: 135px; }
.ship-2 { top: 54%; animation: sailRight 65s linear infinite -22s; }
.ship-2 svg { width: 100px; }
.ship-3 { top: 30%; animation: sailLeftReverse 40s linear infinite -12s; }
.ship-3 svg { width: 90px; }

@keyframes sailRight {
  from { transform: translateX(-220px); }
  to   { transform: translateX(calc(100vw + 220px)); }
}
@keyframes sailLeftReverse {
  from { transform: translateX(calc(100vw + 200px)) scaleX(-1); }
  to   { transform: translateX(-200px) scaleX(-1); }
}

/* Floating crowns */
.crown { position: absolute; will-change: transform, opacity; }
.crown svg { display: block; }
.crown-1 { left: 7%;  width: 52px; animation: floatCrown 24s ease-in-out infinite 3s; }
.crown-2 { left: 31%; width: 40px; animation: floatCrown 30s ease-in-out infinite 10s; }
.crown-3 { left: 64%; width: 58px; animation: floatCrown 20s ease-in-out infinite 6s; }
.crown-4 { left: 83%; width: 38px; animation: floatCrown 26s ease-in-out infinite 16s; }
@keyframes floatCrown {
  0%   { transform: translateY(105vh) rotate(-8deg); opacity: 0; }
  8%   { opacity: 0.11; }
  82%  { opacity: 0.07; }
  100% { transform: translateY(-80px) rotate(10deg); opacity: 0; }
}

/* Cannons drifting left */
.cannon { position: absolute; will-change: transform; }
.cannon svg { display: block; }
.cannon-1 { top: 80%; width: 80px; opacity: 0.09; animation: sailLeftPlain 72s linear infinite -8s; }
.cannon-2 { top: 18%; width: 65px; opacity: 0.08; animation: sailLeftPlain 58s linear infinite -33s; }
@keyframes sailLeftPlain {
  from { transform: translateX(calc(100vw + 200px)); }
  to   { transform: translateX(-200px); }
}

/* ===== APP CONTAINER ===== */
.app-container {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 16px 48px;
}

/* ===== SCREENS ===== */
.screen {
  display: none;
  width: 100%;
  max-width: 480px;
  animation: screenIn 0.38s cubic-bezier(0.22,1,0.36,1);
}
.screen.active { display: block; }
@keyframes screenIn {
  from { opacity: 0; transform: translateY(18px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ===== LOGIN HERO CROWN ===== */
.login-hero {
  display: flex;
  justify-content: center;
  margin-bottom: -14px;
  animation: crownBob 4.5s ease-in-out infinite;
}
.hero-crown {
  width: 190px;
  height: auto;
  filter: drop-shadow(0 10px 24px rgba(200,168,75,0.55));
}
@keyframes crownBob {
  0%, 100% { transform: translateY(0) rotate(-1.5deg); }
  50% { transform: translateY(-10px) rotate(1.5deg); }
}

/* ===== CARD ===== */
.card {
  background: var(--cream);
  border-radius: 22px;
  padding: 28px 22px;
  box-shadow: var(--shadow-card);
  border: 1px solid rgba(200,168,75,0.28);
  position: relative;
  overflow: hidden;
}
/* Animated gold shimmer on top border */
.card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--gold-dark) 0%, var(--gold-light) 35%, var(--gold) 65%, var(--gold-dark) 100%);
  background-size: 250% 100%;
  animation: shimmerBar 3.5s linear infinite;
}
@keyframes shimmerBar {
  from { background-position: 250% 0; }
  to   { background-position: -250% 0; }
}

/* ===== TYPOGRAPHY ===== */
h1 {
  font-family: 'Cinzel', Georgia, 'Times New Roman', serif;
  font-size: clamp(1.25rem, 5vw, 1.8rem);
  color: var(--blue-deep);
  text-align: center;
  margin-bottom: 4px;
  letter-spacing: 0.04em;
  font-weight: 700;
}
.subtitle {
  font-family: 'Playfair Display', Georgia, serif;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 22px;
  font-style: italic;
}
.footer-text {
  font-family: 'Cinzel', Georgia, serif;
  text-align: center;
  color: rgba(255,255,255,0.2);
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  margin-top: 14px;
}

/* ===== FORM ===== */
.form-group { margin-bottom: 13px; }
.form-group label {
  display: block;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--blue-deep);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.form-group input {
  width: 100%;
  padding: 13px 15px;
  border: 2px solid #dde4ef;
  border-radius: 11px;
  font-size: 16px;
  background: var(--white);
  color: var(--text-dark);
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
}
.form-group input:focus {
  outline: none;
  border-color: var(--blue-mid);
  box-shadow: 0 0 0 3px rgba(42,95,143,0.15);
}
.form-group input::placeholder { color: #b8c2d4; }

.error {
  color: var(--wrong);
  font-size: 0.82rem;
  text-align: center;
  margin-bottom: 10px;
  font-weight: 600;
  padding: 9px 12px;
  background: var(--wrong-bg);
  border-radius: 9px;
  border: 1px solid rgba(231,76,60,0.25);
}
.hidden { display: none !important; }

/* ===== BUTTONS ===== */
.btn {
  display: block;
  width: 100%;
  padding: 15px 20px;
  border: none;
  border-radius: 13px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.22,1,0.36,1);
  min-height: 52px;
  -webkit-appearance: none;
  letter-spacing: 0.02em;
}
.btn-primary {
  background: linear-gradient(135deg, var(--blue-mid) 0%, var(--blue-deep) 100%);
  color: var(--white);
  margin-top: 14px;
  box-shadow: 0 4px 18px rgba(42,95,143,0.45);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #2060a0, #102a48);
  transform: translateY(-2px);
  box-shadow: 0 7px 24px rgba(42,95,143,0.55);
}
.btn-primary:active { transform: translateY(0); box-shadow: 0 2px 8px rgba(42,95,143,0.3); }

.btn-secondary {
  background: transparent;
  color: var(--text-muted);
  border: 2px solid #dde4ef;
  margin-top: 8px;
}
.btn-secondary:hover {
  border-color: var(--blue-light);
  color: var(--blue-mid);
  background: rgba(200,224,245,0.25);
}

/* ===== SETUP SCREEN ===== */
.setup-icon {
  font-size: 3rem;
  text-align: center;
  margin-bottom: 8px;
  display: block;
  animation: setupBob 3s ease-in-out infinite;
}
@keyframes setupBob {
  0%, 100% { transform: scale(1) rotate(-3deg); }
  50% { transform: scale(1.1) rotate(3deg); }
}

.count-section {
  background: linear-gradient(135deg, #e4edf8, #d2e2f5);
  border-radius: 15px;
  padding: 18px 16px;
  margin-bottom: 16px;
  text-align: center;
  border: 1px solid rgba(42,95,143,0.15);
}
.count-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--blue-mid);
  margin-bottom: 12px;
}
.count-control {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
}
.btn-count {
  width: 48px; height: 48px;
  border-radius: 50%;
  border: 2.5px solid var(--gold);
  background: var(--white);
  color: var(--blue-deep);
  font-size: 1.5rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  line-height: 1;
  -webkit-appearance: none;
  box-shadow: 0 2px 10px rgba(200,168,75,0.25);
}
.btn-count:hover { background: var(--gold); color: var(--white); transform: scale(1.1); }
.btn-count:active { transform: scale(0.93); }

#count-display {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 3rem;
  font-weight: 700;
  color: var(--blue-deep);
  min-width: 72px;
  text-align: center;
  display: inline-block;
}
#count-display.bump { animation: countBump 0.18s ease; }
@keyframes countBump {
  0%,100% { transform: scale(1); }
  50% { transform: scale(1.18); }
}
.count-hint {
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-top: 10px;
}

.topic-list {
  background: linear-gradient(135deg, rgba(200,168,75,0.09), rgba(200,168,75,0.04));
  border: 1px solid rgba(200,168,75,0.28);
  border-radius: 13px;
  padding: 14px 14px;
  margin-bottom: 16px;
}
.topic-header {
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--gold-dark);
  margin-bottom: 10px;
}
#topics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px 12px;
}
.topic-item {
  font-size: 0.74rem;
  color: var(--blue-deep);
  padding: 2px 0;
  display: flex;
  align-items: center;
  gap: 5px;
}
.topic-item::before {
  content: '•';
  color: var(--gold);
  font-size: 0.85rem;
  flex-shrink: 0;
}

/* ===== PROGRESS BAR ===== */
.progress-bar-container {
  height: 6px;
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
  margin-bottom: 12px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--gold-dark), var(--gold-light), var(--gold));
  border-radius: 4px;
  transition: width 0.5s cubic-bezier(0.22,1,0.36,1);
  position: relative;
  overflow: hidden;
  width: 0%;
}
.progress-shimmer {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.5) 50%, transparent 100%);
  animation: progressShimmer 1.8s linear infinite;
}
@keyframes progressShimmer {
  from { transform: translateX(-100%); }
  to   { transform: translateX(100%); }
}

/* ===== QUIZ HEADER ===== */
.quiz-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  gap: 8px;
}
.topic-label {
  font-size: 0.73rem;
  color: var(--gold-light);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.question-counter {
  font-size: 0.78rem;
  color: rgba(255,255,255,0.55);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ===== QUIZ CARD ===== */
.quiz-card {
  min-height: 430px;
  display: flex;
  flex-direction: column;
}
.question-text {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(1rem, 3.8vw, 1.18rem);
  line-height: 1.6;
  color: var(--blue-deep);
  margin-bottom: 20px;
  flex-shrink: 0;
}

/* ===== ANSWER OPTIONS ===== */
.options-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}
.option-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 15px;
  border: 2px solid #dde4ef;
  border-radius: 13px;
  background: var(--white);
  color: var(--text-dark);
  font-size: 0.9rem;
  line-height: 1.4;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.22,1,0.36,1);
  min-height: 54px;
  width: 100%;
  -webkit-appearance: none;
  position: relative;
  overflow: hidden;
}
.option-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(42,95,143,0.06), transparent 60%);
  opacity: 0;
  transition: opacity 0.2s;
}
.option-btn:hover:not(:disabled)::after { opacity: 1; }
.option-btn:hover:not(:disabled) {
  border-color: var(--blue-mid);
  transform: translateX(4px);
  box-shadow: 0 3px 14px rgba(42,95,143,0.18);
}
.option-btn:active:not(:disabled) { transform: translateX(2px); }

.option-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #e5edf8;
  color: var(--blue-mid);
  font-weight: 700;
  font-size: 0.76rem;
  flex-shrink: 0;
  transition: all 0.2s;
}
.option-text { flex: 1; }

.option-btn.correct {
  background: var(--correct-bg);
  border-color: var(--correct);
  color: var(--correct);
  animation: correctPop 0.4s cubic-bezier(0.22,1,0.36,1);
}
.option-btn.correct .option-label { background: var(--correct); color: var(--white); }
@keyframes correctPop {
  0%   { transform: scale(1); }
  35%  { transform: scale(1.04) translateX(4px); }
  70%  { transform: scale(0.99) translateX(1px); }
  100% { transform: scale(1) translateX(0); }
}

.option-btn.wrong {
  background: var(--wrong-bg);
  border-color: var(--wrong);
  color: var(--wrong);
  animation: wrongShake 0.42s ease;
}
.option-btn.wrong .option-label { background: var(--wrong); color: var(--white); }
@keyframes wrongShake {
  0%,100% { transform: translateX(0); }
  18%  { transform: translateX(-7px); }
  36%  { transform: translateX(7px); }
  54%  { transform: translateX(-5px); }
  72%  { transform: translateX(5px); }
  90%  { transform: translateX(-2px); }
}

.option-btn:disabled { cursor: not-allowed; }
.option-btn:disabled:not(.correct):not(.wrong) { opacity: 0.45; }

/* ===== RESULTS ===== */
.results-card { text-align: center; }
.results-hero {
  font-size: 4.2rem;
  display: block;
  text-align: center;
  margin-bottom: 6px;
  animation: trophyDance 2.5s ease-in-out infinite;
}
@keyframes trophyDance {
  0%,100% { transform: rotate(-5deg) scale(1); }
  25%  { transform: rotate(6deg) scale(1.07); }
  50%  { transform: rotate(-3deg) scale(1.02); }
  75%  { transform: rotate(4deg) scale(1.05); }
}

.score-ring-container {
  position: relative;
  width: 140px; height: 140px;
  margin: 18px auto;
}
.score-ring {
  width: 140px; height: 140px;
  transform: rotate(-90deg);
  display: block;
}
.ring-bg { fill: none; stroke: var(--blue-light); stroke-width: 10; }
.ring-fill {
  fill: none;
  stroke: var(--gold);
  stroke-width: 10;
  stroke-linecap: round;
  transition: stroke-dashoffset 1.3s cubic-bezier(0.22,1,0.36,1);
}
.score-text-wrap {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%,-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
  gap: 2px;
}
.score-num {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--blue-deep);
}
.score-divider { font-size: 0.63rem; color: var(--text-muted); }
.score-denom   { font-size: 1rem; color: var(--text-muted); }

.grade-message {
  font-family: 'Playfair Display', Georgia, serif;
  font-style: italic;
  font-size: 0.98rem;
  color: var(--blue-deep);
  margin: 10px 0 18px;
  padding: 14px 16px;
  background: linear-gradient(135deg, rgba(200,168,75,0.13), rgba(200,168,75,0.05));
  border-radius: 11px;
  border-left: 3px solid var(--gold);
  text-align: left;
}

.topic-breakdown { text-align: left; margin-bottom: 10px; }
.breakdown-title {
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--blue-deep);
  margin-bottom: 8px;
}
.breakdown-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid #eeebdf;
  font-size: 0.79rem;
}
.breakdown-item:last-child { border-bottom: none; }
.breakdown-topic { color: var(--text-dark); flex: 1; }
.breakdown-score {
  font-weight: 700;
  color: var(--blue-mid);
  margin-left: 8px;
  min-width: 30px;
  text-align: right;
}
.breakdown-score.perfect { color: var(--correct); }

/* ===== LOGIN SHAKE ===== */
@keyframes shake {
  0%,100% { transform: translateX(0); }
  18%  { transform: translateX(-10px); }
  36%  { transform: translateX(10px); }
  54%  { transform: translateX(-7px); }
  72%  { transform: translateX(7px); }
  90%  { transform: translateX(-3px); }
}
.shake { animation: shake 0.46s ease; }

/* ===== STREAK BADGE (quiz header) ===== */
.quiz-right-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.streak-badge {
  background: linear-gradient(135deg, #c0392b, #e74c3c);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 20px;
  white-space: nowrap;
  animation: streakPop 0.3s cubic-bezier(0.22,1,0.36,1);
  box-shadow: 0 2px 8px rgba(192,57,43,0.4);
}
@keyframes streakPop {
  0%   { transform: scale(0.7); }
  60%  { transform: scale(1.15); }
  100% { transform: scale(1); }
}

/* ===== SETUP PROGRESS PANEL ===== */
.progress-panel {
  margin-bottom: 16px;
}

/* Stats row (4 chips) */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 12px;
}
.stat-chip {
  background: linear-gradient(135deg, #e4edf8, #d2e2f5);
  border-radius: 10px;
  padding: 8px 4px;
  text-align: center;
  border: 1px solid rgba(42,95,143,0.12);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.stat-chip strong {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--blue-deep);
  line-height: 1;
}
.stat-chip span {
  font-size: 0.58rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badges-intro {
  font-size: 0.82rem;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 10px;
  font-style: italic;
}
.best-rank-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.78rem;
  color: var(--blue-deep);
  background: linear-gradient(135deg,rgba(200,168,75,0.14),rgba(200,168,75,0.05));
  border: 1px solid rgba(200,168,75,0.3);
  border-radius: 20px;
  padding: 4px 12px;
  margin-bottom: 10px;
  width: 100%;
  justify-content: center;
}

/* ===== LOGIN BADGE WALL ===== */
.login-badge-wall {
  width: 100%;
  max-width: 480px;
  margin-top: 16px;
  text-align: center;
}
.login-badge-empty {
  font-size: 0.78rem;
  color: rgba(255,255,255,0.3);
  font-style: italic;
  padding: 8px 0;
}
.login-badge-heading {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.65rem;
  color: rgba(255,255,255,0.45);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 12px;
}
.login-shields {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}
.login-shield-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  animation: shieldFloat 3.2s ease-in-out infinite;
  animation-delay: var(--delay, 0s);
  cursor: default;
}
.login-shield-item svg {
  width: clamp(48px, 12vw, 64px);
  height: auto;
  filter: drop-shadow(0 0 10px var(--glow, rgba(200,168,75,0.5)));
}
.login-shield-label {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.52rem;
  color: rgba(255,255,255,0.5);
  letter-spacing: 0.04em;
  text-align: center;
  max-width: 72px;
  line-height: 1.2;
}
@keyframes shieldFloat {
  0%, 100% { transform: translateY(0) rotate(-1.5deg); }
  50% { transform: translateY(-7px) rotate(1.5deg); }
}

/* Horizontal badge strip (setup screen) */
.badge-strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x mandatory;
  padding-bottom: 6px;
  scrollbar-width: none;
}
.badge-strip::-webkit-scrollbar { display: none; }

.badge-strip-card {
  flex-shrink: 0;
  width: 136px;
  border-radius: 14px;
  padding: 14px 10px 12px;
  border: 2px solid;
  scroll-snap-align: start;
  text-align: center;
  transition: transform 0.22s cubic-bezier(0.22,1,0.36,1), box-shadow 0.22s;
}
.badge-strip-card:active { transform: scale(0.95) !important; }

.badge-strip-card.earned {
  transform: translateY(-3px);
  animation: badgeCardLevitate var(--dur, 3.5s) ease-in-out infinite;
}
.badge-strip-card.earned:hover {
  transform: translateY(-7px) scale(1.04) !important;
}
.badge-strip-card.locked {
  background: rgba(0,0,0,0.04);
  border-color: #dde3ee;
  border-style: dashed;
}
@keyframes badgeCardLevitate {
  0%,100% { transform: translateY(-3px); }
  50% { transform: translateY(-8px); }
}

/* Shield inside badge strip card */
.bsc-shield {
  width: 68px;
  margin: 0 auto 8px;
  display: block;
}
.bsc-shield svg { width: 100%; height: auto; display: block; }
.bsc-shield.locked { filter: grayscale(1) opacity(0.28); }
.bsc-shield.earned {
  filter: drop-shadow(0 3px 8px rgba(255,255,255,0.25));
  animation: shieldBobInCard 2.8s ease-in-out infinite;
}
@keyframes shieldBobInCard {
  0%,100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-3px) scale(1.05); }
}

.bsc-title {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--blue-deep);
  margin-bottom: 3px;
  word-break: break-word;
  hyphens: auto;
  line-height: 1.25;
  letter-spacing: 0.02em;
}
.badge-strip-card.earned .bsc-title { color: rgba(255,255,255,0.95); }
.badge-strip-card.locked .bsc-title { color: var(--text-muted); }

.bsc-desc {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 0.6rem;
  font-style: italic;
  color: var(--text-muted);
  margin-bottom: 8px;
  line-height: 1.3;
}
.badge-strip-card.earned .bsc-desc { color: rgba(255,255,255,0.7); }

.bsc-prog {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--blue-deep);
  margin-top: 5px;
}
.bsc-prog span { font-weight: 400; color: var(--text-muted); }
.badge-strip-card.earned .bsc-prog { color: rgba(255,255,255,0.9); }
.badge-strip-card.earned .bsc-prog span { color: rgba(255,255,255,0.6); }
.badge-strip-card.locked .bsc-prog { color: var(--text-muted); }

/* ===== SHARED BADGE BAR ===== */
.badge-bar {
  height: 6px;
  background: rgba(0,0,0,0.1);
  border-radius: 3px;
  overflow: hidden;
}
.badge-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--blue-mid), var(--blue-light));
  width: 0%;
  transition: width 1s cubic-bezier(0.22,1,0.36,1);
}
/* On earned (dark) cards: white bar fill */
.badge-strip-card.earned .badge-bar { background: rgba(255,255,255,0.18); }
.badge-strip-card.earned .badge-bar-fill { background: rgba(255,255,255,0.85); }
.badge-card.earned .badge-bar { background: rgba(255,255,255,0.18); }
.badge-card.earned .badge-bar-fill { background: rgba(255,255,255,0.85); }
/* Completed (100%) bar on locked cards: gold */
.badge-bar-fill.complete {
  background: linear-gradient(90deg, var(--gold-dark), var(--gold-light));
}

/* ===== RESULTS — rank badge ===== */
.badges-section {
  margin: 4px 0 16px;
}
.rank-badge {
  display: flex;
  align-items: center;
  gap: 14px;
  border: 2px solid;
  border-radius: 15px;
  padding: 14px 14px;
  margin-bottom: 14px;
  animation: badgeFadeIn 0.5s cubic-bezier(0.22,1,0.36,1);
}
@keyframes badgeFadeIn {
  from { opacity:0; transform: translateY(8px); }
  to   { opacity:1; transform: translateY(0); }
}
.rank-medal {
  width: 58px; height: 58px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.9rem;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(0,0,0,0.2);
}
.rank-info { flex: 1; }
.rank-name {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--blue-deep);
  margin-bottom: 3px;
  letter-spacing: 0.03em;
}
.rank-desc {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 0.8rem;
  font-style: italic;
  color: var(--text-muted);
  line-height: 1.4;
}

.badges-label {
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--gold-dark);
  margin-bottom: 8px;
}

/* Achievement grid (results: 2 cols) */
.badge-cards-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-bottom: 14px;
}
.badge-card {
  border-radius: 14px;
  padding: 12px 11px;
  border: 2px solid;
  animation: badgeCardIn 0.5s cubic-bezier(0.22,1,0.36,1) both;
  position: relative;
  overflow: visible;
}
@keyframes badgeCardIn {
  from { opacity:0; transform: scale(0.82) translateY(10px); }
  to   { opacity:1; transform: scale(1) translateY(0); }
}
.badge-card.earned {
  transform: translateY(-2px);
}
.badge-card.earned:hover {
  transform: translateY(-5px) scale(1.02);
  transition: transform 0.2s cubic-bezier(0.22,1,0.36,1);
}
.badge-card.locked {
  background: rgba(0,0,0,0.03);
  border-color: #dde3ee;
  border-style: dashed;
  opacity: 0.55;
}
.badge-card.newly-earned {
  animation: badgeUnlock 0.85s cubic-bezier(0.22,1,0.36,1) both !important;
}
@keyframes badgeUnlock {
  0%   { opacity:0; transform: scale(0.4) rotate(-12deg); }
  50%  { transform: scale(1.18) rotate(4deg); }
  72%  { transform: scale(0.96) rotate(-2deg); }
  86%  { transform: scale(1.04) rotate(1deg); }
  100% { opacity:1; transform: scale(1) rotate(0); }
}

/* Shield container inside results badge card */
.badge-shield-wrap {
  position: relative;
  display: flex;
  justify-content: center;
  margin-bottom: 8px;
}
.badge-shield {
  width: 72px;
  height: auto;
  display: block;
}
.badge-shield svg { width: 100%; height: auto; display: block; }
.badge-shield.locked { filter: grayscale(1) opacity(0.25); }
.badge-shield.earned {
  filter: drop-shadow(0 4px 10px rgba(255,255,255,0.3));
  animation: shieldBobInCard 3s ease-in-out infinite;
}
.badge-new-tag {
  position: absolute;
  top: -8px;
  right: -6px;
  background: var(--gold-light);
  color: var(--blue-deep);
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.5rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 2px 7px;
  border-radius: 8px;
  box-shadow: 0 2px 7px rgba(0,0,0,0.22);
  white-space: nowrap;
  animation: newTagPop 0.5s 0.6s cubic-bezier(0.22,1,0.36,1) both;
}
@keyframes newTagPop {
  from { opacity:0; transform: scale(0.5) rotate(-10deg); }
  to   { opacity:1; transform: scale(1) rotate(0); }
}
.badge-card-name {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.66rem;
  font-weight: 700;
  color: var(--blue-deep);
  letter-spacing: 0.02em;
  word-break: break-word;
  hyphens: auto;
  line-height: 1.3;
}
.badge-card.earned .badge-card-name { color: rgba(255,255,255,0.96); }
.badge-card.locked .badge-card-name { color: var(--text-muted); }

.badge-card-desc {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 0.66rem;
  font-style: italic;
  color: var(--text-muted);
  margin-bottom: 8px;
  line-height: 1.35;
}
.badge-card.earned .badge-card-desc { color: rgba(255,255,255,0.72); }

.badge-bar-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}
.badge-bar-wrap .badge-bar { flex: 1; }
.badge-bar-label {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--blue-mid);
  white-space: nowrap;
  min-width: 26px;
  text-align: right;
}
.badge-card.earned .badge-bar-label { color: rgba(255,255,255,0.88); }
.badge-card.locked .badge-bar-label { color: var(--text-muted); }

/* ===== RESPONSIVE ===== */
@media (min-width: 520px) {
  .app-container { padding: 36px 20px 56px; }
  .card { padding: 34px 30px; }
}
@media (max-width: 360px) {
  .card { padding: 22px 16px; }
  .btn-count { width: 42px; height: 42px; }
  #count-display { font-size: 2.6rem; }
}
