/* ============================================================
   GeoTrivia — Stylesheet
   ============================================================ */

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

:root {
  --bg-deep:     #0d1b2a;
  --bg-mid:      #112240;
  --bg-card:     #172a45;
  --bg-card2:    #1e3557;
  --border:      rgba(100, 160, 220, 0.18);
  --border-glow: rgba(100, 200, 255, 0.35);
  --text-primary:   #e8f0fe;
  --text-secondary: #8eb4d8;
  --text-muted:     #4a7fa8;
  --accent:      #4fc3f7;
  --accent-dark: #0288d1;
  --accent-glow: rgba(79, 195, 247, 0.25);
  --green:       #43e97b;
  --green-bg:    rgba(67, 233, 123, 0.12);
  --green-border:rgba(67, 233, 123, 0.35);
  --red:         #ff6b6b;
  --red-bg:      rgba(255, 107, 107, 0.12);
  --red-border:  rgba(255, 107, 107, 0.35);
  --amber:       #ffd93d;
  --amber-bg:    rgba(255, 217, 61, 0.12);
  --amber-border:rgba(255, 217, 61, 0.35);
  --radius:      14px;
  --radius-sm:   8px;
  --shadow:      0 8px 32px rgba(0,0,0,0.5);
  --shadow-sm:   0 2px 12px rgba(0,0,0,0.3);
  font-size: 16px;
}

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

/* ============================================================
   ANIMATED BACKGROUND
   ============================================================ */
.bg-container {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  color: var(--accent);
}

.bg-svg {
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
}

.grid-lines line {
  stroke: var(--accent);
  stroke-width: 0.5;
}

.flight-path {
  stroke: var(--accent);
  stroke-width: 1.2;
  fill: none;
}

.fp1 { animation: dash 12s linear infinite; }
.fp2 { animation: dash 18s linear infinite 3s; }
.fp3 { animation: dash 15s linear infinite 6s; }
.fp4 { animation: dash 20s linear infinite 1s; }

@keyframes dash {
  from { stroke-dashoffset: 0; }
  to   { stroke-dashoffset: -200; }
}

.plane { fill: var(--accent); opacity: 0.3; font-family: sans-serif; }
.plane1 { animation: float1 16s ease-in-out infinite; }
.plane2 { animation: float2 22s ease-in-out infinite 4s; }
.plane3 { animation: float3 19s ease-in-out infinite 8s; }

@keyframes float1 {
  0%,100% { transform: translate(0,0); opacity: 0.3; }
  50%      { transform: translate(60px, -30px); opacity: 0.5; }
}
@keyframes float2 {
  0%,100% { transform: translate(0,0); opacity: 0.2; }
  50%      { transform: translate(-40px, 20px); opacity: 0.4; }
}
@keyframes float3 {
  0%,100% { transform: translate(0,0); opacity: 0.2; }
  50%      { transform: translate(30px, 40px); opacity: 0.35; }
}

/* ============================================================
   SCREENS
   ============================================================ */
.screen {
  display: none;
  position: relative;
  z-index: 10;
  min-height: 100vh;
}
.screen.active { display: flex; }

/* ============================================================
   SPLASH SCREEN
   ============================================================ */
#splash-screen {
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.splash-content {
  width: 100%;
  max-width: 700px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.logo-area {
  text-align: center;
}

.logo-globe {
  font-size: 64px;
  display: block;
  animation: spin-globe 8s ease-in-out infinite;
  filter: drop-shadow(0 0 24px rgba(79,195,247,0.5));
}

@keyframes spin-globe {
  0%,100% { transform: rotateY(0deg) scale(1); }
  50%      { transform: rotateY(20deg) scale(1.05); }
}

.logo-title {
  font-size: clamp(2rem, 6vw, 3.5rem);
  font-weight: 800;
  letter-spacing: -1px;
  background: linear-gradient(135deg, #4fc3f7, #81ecec, #a29bfe);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-top: 8px;
}

.logo-subtitle {
  color: var(--text-secondary);
  font-size: 1rem;
  margin-top: 8px;
}

/* Stats bar */
.stats-bar {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.stat-chip {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 20px;
  text-align: center;
  flex: 1;
  max-width: 160px;
}
.stat-num {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
}
.stat-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Difficulty grid */
.section-title {
  text-align: center;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.difficulty-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.diff-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text-primary);
  font-family: inherit;
}

.diff-card:hover, .diff-card:focus {
  border-color: var(--accent);
  background: var(--bg-card2);
  box-shadow: 0 0 20px var(--accent-glow);
  transform: translateY(-2px);
  outline: none;
}

.diff-card.selected {
  border-color: var(--accent);
  background: var(--bg-card2);
  box-shadow: 0 0 24px var(--accent-glow), inset 0 0 0 1px rgba(79,195,247,0.3);
}

.diff-icon  { font-size: 1.8rem; }
.diff-name  { font-weight: 700; font-size: 1rem; }
.diff-desc  { font-size: 0.78rem; color: var(--text-secondary); }
.diff-mult  { font-size: 0.72rem; color: var(--accent); font-weight: 600; background: var(--accent-glow); padding: 2px 8px; border-radius: 20px; margin-top: 2px; }

/* How to play */
.how-to-play {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
}
.how-to-play h3 {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.how-to-play ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.how-to-play li {
  font-size: 0.88rem;
  color: var(--text-secondary);
}
.how-to-play strong { color: var(--text-primary); }

/* ============================================================
   GAME SCREEN
   ============================================================ */
#game-screen {
  flex-direction: column;
  align-items: center;
  padding: 0 0 32px;
}

.game-wrapper {
  width: 100%;
  max-width: 720px;
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Top bar */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0 0;
}

.btn-icon {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 1.1rem;
  cursor: pointer;
  transition: 0.15s;
  color: var(--text-primary);
}
.btn-icon:hover { border-color: var(--accent); background: var(--bg-card2); }

.game-title-small {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 1.1rem;
  background: linear-gradient(135deg, #4fc3f7, #81ecec);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.logo-globe-sm { font-size: 1.2rem; -webkit-text-fill-color: initial; }

.top-right-stats { display: flex; gap: 8px; align-items: center; }

.streak-badge, .score-badge {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 0.85rem;
  font-weight: 600;
}
.streak-badge { color: var(--amber); border-color: var(--amber-border); }
.score-badge  { color: var(--accent); }

/* Round info */
.round-info {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
}

.diff-badge {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid;
}
.diff-badge.easy       { background: var(--green-bg); color: var(--green); border-color: var(--green-border); }
.diff-badge.medium     { background: var(--amber-bg); color: var(--amber); border-color: var(--amber-border); }
.diff-badge.hard       { background: var(--red-bg); color: var(--red); border-color: var(--red-border); }
.diff-badge.impossible { background: rgba(162,130,254,0.12); color: #a29bfe; border-color: rgba(162,130,254,0.4); }

#round-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  flex: 1;
}

/* Timer */
.timer-wrap { margin-left: auto; }

.timer-ring {
  position: relative;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.timer-svg {
  position: absolute;
  inset: 0;
  transform: rotate(-90deg);
}

.timer-track    { fill: none; stroke: rgba(255,255,255,0.08); stroke-width: 3; }
.timer-progress {
  fill: none;
  stroke: var(--accent);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 113;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 1s linear, stroke 0.5s;
}
.timer-progress.warning { stroke: var(--amber); }
.timer-progress.danger  { stroke: var(--red); }

.timer-text {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-primary);
  position: relative;
  z-index: 1;
}
.timer-text.warning { color: var(--amber); }
.timer-text.danger  { color: var(--red); }

/* Hints */
.hints-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hint-card {
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: all 0.3s ease;
}

.hint-card.locked {
  background: rgba(255,255,255,0.03);
}
.hint-card.revealed {
  background: var(--bg-card);
  border-color: var(--border-glow);
  box-shadow: 0 0 16px rgba(79,195,247,0.08);
}
.hint-card.revealed.hard-hint   { border-color: rgba(255,107,107,0.4); }
.hint-card.revealed.medium-hint { border-color: rgba(255,217,61,0.4); }
.hint-card.revealed.easy-hint   { border-color: rgba(67,233,123,0.4); }

.hint-inner {
  padding: 12px 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.hint-num-badge {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
}
.hard-hint   .hint-num-badge { background: var(--red-bg); color: var(--red); }
.medium-hint .hint-num-badge { background: var(--amber-bg); color: var(--amber); }
.easy-hint   .hint-num-badge { background: var(--green-bg); color: var(--green); }
.locked      .hint-num-badge { background: rgba(255,255,255,0.05); color: var(--text-muted); }

.hint-body { flex: 1; }

.hint-type-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 4px;
  display: block;
}
.hard-hint   .hint-type-label { color: var(--red); }
.medium-hint .hint-type-label { color: var(--amber); }
.easy-hint   .hint-type-label { color: var(--green); }
.locked      .hint-type-label { color: var(--text-muted); }

.hint-text {
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text-primary);
}
.locked .hint-text { color: var(--text-muted); }

.hint-reveal-anim {
  animation: hint-pop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
@keyframes hint-pop {
  0%   { opacity: 0; transform: translateY(-8px) scale(0.97); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* Wrong indicators */
.wrong-indicators {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
}
.wi-label { color: var(--text-muted); font-size: 0.75rem; }
.wi-dot { font-size: 1rem; color: var(--text-muted); transition: all 0.2s; }
.wi-dot.wrong { color: var(--red); }
.wi-dot.correct { color: var(--green); }

/* Guess area */
.guess-area {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.guess-input-wrap { position: relative; }

/* Custom select */
.custom-select { position: relative; user-select: none; }

.cs-display {
  background: var(--bg-card);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  font-size: 0.92rem;
  color: var(--text-secondary);
  transition: 0.2s;
}
.cs-display:hover, .cs-display:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 2px var(--accent-glow);
}
.cs-display.has-value { color: var(--text-primary); }
.cs-arrow { font-size: 0.75rem; color: var(--text-muted); transition: transform 0.2s; }
.custom-select.open .cs-arrow { transform: rotate(180deg); }

.cs-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  background: var(--bg-card2);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  z-index: 100;
  overflow: hidden;
}
.custom-select.open .cs-dropdown { display: block; }

.cs-search {
  width: 100%;
  background: rgba(255,255,255,0.04);
  border: none;
  border-bottom: 1px solid var(--border);
  padding: 10px 14px;
  color: var(--text-primary);
  font-size: 0.88rem;
  font-family: inherit;
  outline: none;
}
.cs-search::placeholder { color: var(--text-muted); }

.cs-list {
  list-style: none;
  max-height: 200px;
  overflow-y: auto;
}
.cs-list::-webkit-scrollbar { width: 4px; }
.cs-list::-webkit-scrollbar-track { background: transparent; }
.cs-list::-webkit-scrollbar-thumb { background: var(--border-glow); border-radius: 2px; }

.cs-list li {
  padding: 9px 14px;
  cursor: pointer;
  font-size: 0.88rem;
  color: var(--text-secondary);
  transition: 0.1s;
  display: flex;
  align-items: center;
  gap: 8px;
}
.cs-list li:hover, .cs-list li.focused {
  background: rgba(79,195,247,0.1);
  color: var(--text-primary);
}
.cs-list li.hidden { display: none; }

/* Guess buttons */
.guess-buttons {
  display: flex;
  gap: 10px;
}

.btn-guess {
  flex: 1;
  padding: 13px;
  background: linear-gradient(135deg, var(--accent-dark), var(--accent));
  border: none;
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: 0.2s;
  box-shadow: 0 4px 16px rgba(2, 136, 209, 0.35);
}
.btn-guess:hover { transform: translateY(-1px); box-shadow: 0 6px 22px rgba(2, 136, 209, 0.5); }
.btn-guess:active { transform: translateY(0); }
.btn-guess:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.btn-giveup {
  padding: 13px 18px;
  background: transparent;
  border: 1px solid var(--red-border);
  border-radius: var(--radius-sm);
  color: var(--red);
  font-size: 0.88rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: 0.2s;
}
.btn-giveup:hover { background: var(--red-bg); }

/* ============================================================
   RESULT SCREEN
   ============================================================ */
#result-screen {
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.result-card {
  background: var(--bg-card);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius);
  padding: 28px 24px;
  width: 100%;
  max-width: 560px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 20px;
  animation: card-in 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes card-in {
  from { opacity: 0; transform: scale(0.94) translateY(20px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.result-card.win-card  { border-color: var(--green-border); box-shadow: 0 0 40px rgba(67,233,123,0.15); }
.result-card.lose-card { border-color: var(--red-border); box-shadow: 0 0 40px rgba(255,107,107,0.12); }

.result-header { text-align: center; }
.result-emoji { font-size: 3rem; display: block; animation: bounce-in 0.6s ease; }
@keyframes bounce-in {
  0%   { transform: scale(0); opacity: 0; }
  60%  { transform: scale(1.2); }
  100% { transform: scale(1); opacity: 1; }
}
.result-header h2 { font-size: 1.5rem; font-weight: 800; margin-top: 8px; }
.result-header p  { color: var(--text-secondary); font-size: 0.9rem; margin-top: 4px; }

.country-reveal {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 1.4rem;
  font-weight: 700;
  background: var(--bg-card2);
  border-radius: var(--radius-sm);
  padding: 14px;
  border: 1px solid var(--border);
}
#result-flag { font-size: 1.8rem; }

.country-image-wrap {
  border-radius: var(--radius-sm);
  overflow: hidden;
  height: 180px;
}
.country-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Score breakdown */
.score-breakdown {
  background: var(--bg-card2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  overflow: hidden;
}
.sb-row {
  display: flex;
  justify-content: space-between;
  padding: 9px 14px;
  font-size: 0.88rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
}
.sb-row:last-child { border-bottom: none; }
.sb-row span:last-child { font-weight: 600; color: var(--text-primary); }
.sb-total {
  background: rgba(79,195,247,0.08);
  font-weight: 700 !important;
}
.sb-total span { color: var(--accent) !important; font-size: 1rem !important; }

/* Did you know */
.dyk-box {
  background: rgba(162,130,254,0.08);
  border: 1px solid rgba(162,130,254,0.25);
  border-radius: var(--radius-sm);
  padding: 14px;
}
.dyk-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #a29bfe;
  display: block;
  margin-bottom: 6px;
}
.dyk-box p {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.streak-lost {
  background: var(--amber-bg);
  border: 1px solid var(--amber-border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.88rem;
  color: var(--amber);
  text-align: center;
}

.result-actions {
  display: flex;
  gap: 10px;
}

.btn-next {
  flex: 1;
  padding: 13px;
  background: linear-gradient(135deg, var(--accent-dark), var(--accent));
  border: none;
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: 0.2s;
  box-shadow: 0 4px 16px rgba(2,136,209,0.35);
}
.btn-next:hover { transform: translateY(-1px); }

.btn-home-result {
  padding: 13px 18px;
  background: transparent;
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.88rem;
  font-family: inherit;
  cursor: pointer;
  transition: 0.2s;
}
.btn-home-result:hover { border-color: var(--accent); color: var(--text-primary); }

/* ============================================================
   SOUND TOGGLE
   ============================================================ */
.sound-toggle {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 1.1rem;
  cursor: pointer;
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: 0.2s;
}
.sound-toggle:hover { border-color: var(--accent); background: var(--bg-card2); }
.sound-toggle.muted { opacity: 0.5; }

/* ============================================================
   CONFETTI
   ============================================================ */
.confetti-piece {
  position: fixed;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  z-index: 9999;
  pointer-events: none;
  animation: confetti-fall 1.2s ease-out forwards;
}
@keyframes confetti-fall {
  0%   { transform: translateY(-20px) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 480px) {
  .difficulty-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .diff-card { padding: 12px 8px; }
  .diff-icon { font-size: 1.4rem; }
  .diff-name { font-size: 0.9rem; }
  .diff-desc { font-size: 0.72rem; }
  .stats-bar { gap: 8px; }
  .stat-chip { padding: 8px 10px; }
  .hint-text { font-size: 0.84rem; }
  .game-wrapper { gap: 10px; }
  .result-card { padding: 20px 16px; }
  .logo-title { font-size: 2.2rem; }
  .logo-globe { font-size: 50px; }
  .country-image-wrap { height: 140px; }
}

@media (min-width: 768px) {
  .guess-area {
    flex-direction: row;
    align-items: flex-end;
  }
  .guess-input-wrap { flex: 1; }
  .guess-buttons { flex-direction: column; width: 160px; }
  .btn-guess, .btn-giveup { width: 100%; padding: 11px; }
}
