:root {
  --bg-deep: #070B14;
  --bg-surface: #0F1525;
  --bg-elevated: #161E30;
  --bg-card: #1A2340;
  --border-subtle: rgba(74, 222, 128, 0.12);
  --border-medium: rgba(74, 222, 128, 0.2);
  --text: #E2E8F0;
  --text-dim: #94A3B8;
  --text-muted: #64748B;
  --accent: #4ade80;
  --accent-dim: #22c55e;
  --accent-glow: rgba(74, 222, 128, 0.3);
  --accent-soft: rgba(74, 222, 128, 0.06);
  --cyan: #22d3ee;
  --cyan-glow: rgba(34, 211, 238, 0.25);
  --yellow: #facc15;
  --yellow-glow: rgba(250, 204, 21, 0.25);
  --orange: #fb923c;
  --orange-glow: rgba(251, 146, 60, 0.25);
  --red: #ef4444;
  --red-glow: rgba(239, 68, 68, 0.25);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-pill: 999px;
}

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

html {
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  height: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  min-height: 100%;
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-deep);
  background-image:
    radial-gradient(ellipse at 20% 0%, rgba(74, 222, 128, 0.04) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(34, 211, 238, 0.03) 0%, transparent 50%);
  color: var(--text);
  display: flex;
  justify-content: center;
  overflow-y: auto;
}

#app {
  width: 100%;
  max-width: 960px;
  padding: 20px 24px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
}

/* ─── Header ─── */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 0 0 14px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.header-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.title {
  font-family: 'Sora', sans-serif;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 6px;
  display: flex;
  align-items: center;
  gap: 10px;
  line-height: 1.2;
}

.logo-svg {
  width: 1.5em;
  height: 1.5em;
  flex-shrink: 0;
  filter: drop-shadow(0 0 8px rgba(74, 222, 128, 0.15));
  animation: logoBreath 3s ease-in-out infinite;
}

.logo-svg.win-pulse {
  animation: logoWinPulse 0.8s ease 3;
}

@keyframes logoBreath {
  0%, 100% { filter: drop-shadow(0 0 6px rgba(74, 222, 128, 0.12)); }
  50% { filter: drop-shadow(0 0 16px rgba(74, 222, 128, 0.3)) drop-shadow(0 0 30px rgba(34, 211, 238, 0.1)); }
}

@keyframes logoWinPulse {
  0%, 100% { filter: drop-shadow(0 0 8px rgba(74, 222, 128, 0.2)) drop-shadow(0 0 20px rgba(74, 222, 128, 0.1)); }
  50% { filter: drop-shadow(0 0 20px rgba(74, 222, 128, 0.5)) drop-shadow(0 0 40px rgba(34, 211, 238, 0.25)); }
}

.logo-hex {
  filter: drop-shadow(0 0 4px rgba(74, 222, 128, 0.15));
}

.logo-globe {
  filter: drop-shadow(0 0 2px rgba(74, 222, 128, 0.1));
}

.logo-pin {
  filter: drop-shadow(0 0 6px rgba(74, 222, 128, 0.3));
}

.title-text {
  display: flex;
  align-items: center;
  gap: 0;
}

.title-geo {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dim) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: none;
  filter: drop-shadow(0 0 12px rgba(74, 222, 128, 0.2));
}

.title-shape {
  background: linear-gradient(135deg, var(--cyan) 0%, #818cf8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 12px rgba(34, 211, 238, 0.2));
}

.title-sub {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 2px;
  text-transform: uppercase;
}

.header-controls {
  display: flex;
  gap: 8px;
  align-items: center;
}

.icon-btn {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-dim);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.icon-btn:hover {
  background: var(--bg-card);
  color: var(--accent);
  border-color: var(--accent-glow);
  box-shadow: 0 0 20px rgba(74, 222, 128, 0.08);
}

.icon-btn svg {
  transition: transform 0.2s ease;
}

.icon-btn:hover svg {
  transform: scale(1.1);
}

/* ─── Lang Toggle ─── */
.lang-toggle {
  display: flex;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  overflow: hidden;
  margin-right: 2px;
}

.lang-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  padding: 6px 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.lang-btn:hover {
  color: var(--text-dim);
}

.lang-btn.active {
  background: var(--accent);
  color: #070B14;
  box-shadow: 0 0 12px rgba(74, 222, 128, 0.15);
}

/* ─── Mode Toggle ─── */
.mode-toggle {
  display: flex;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  overflow: hidden;
  margin-right: 2px;
}

.mode-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  padding: 6px 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.mode-btn:hover {
  color: var(--text-dim);
}

.mode-btn.active {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dim) 100%);
  color: #070B14;
  box-shadow: 0 0 14px rgba(74, 222, 128, 0.2);
}

/* ─── Lock Screen ─── */
.lock-screen {
  position: fixed;
  inset: 0;
  background: rgba(7, 11, 20, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 250;
  animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.lock-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-xl);
  padding: 48px 40px 40px;
  width: 90%;
  max-width: 360px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  animation: lockSlideUp 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes lockSlideUp {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.lock-icon {
  font-size: 56px;
  line-height: 1;
  margin-bottom: 4px;
  filter: drop-shadow(0 0 20px rgba(74, 222, 128, 0.2));
}

.lock-title {
  font-family: 'Sora', sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 1px;
}

.lock-subtitle {
  font-size: 13px;
  color: var(--text-dim);
  font-weight: 500;
}

.lock-timer {
  font-family: 'Sora', sans-serif;
  font-size: 42px;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: 4px;
  text-shadow: 0 0 24px var(--accent-glow), 0 0 48px rgba(74, 222, 128, 0.1);
  margin: 8px 0;
  font-variant-numeric: tabular-nums;
}

.lock-practice-link {
  margin-top: 12px;
  padding-top: 20px;
  border-top: 1px solid var(--border-subtle);
  width: 100%;
}

.practice-link {
  background: none;
  border: 1.5px solid var(--border-medium);
  color: var(--text-dim);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 600;
  padding: 12px 24px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 0.25s ease;
  width: 100%;
}

.practice-link:hover {
  border-color: var(--cyan);
  color: var(--cyan);
  box-shadow: 0 0 20px rgba(34, 211, 238, 0.08);
}

/* ─── Streak ─── */
.streak-display {
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
  text-shadow: 0 0 20px var(--accent-glow), 0 0 40px rgba(74, 222, 128, 0.15);
  margin-bottom: 18px;
  min-height: 32px;
  letter-spacing: 0.5px;
  text-align: center;
}

/* ─── Game Layout ─── */
.game-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  flex: 1;
}

/* ─── Map Panel ─── */
.map-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding-top: 4px;
}

@media (min-width: 768px) {
  .map-panel {
    gap: 18px;
  }
}

.svg-container {
  position: relative;
  width: 100%;
  max-width: 500px;
  aspect-ratio: 1 / 0.85;
  background: var(--bg-surface);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px;
  overflow: visible;
  transition: all 0.4s ease;
}

.svg-container::before {
  content: '\01F310';
  position: absolute;
  font-size: 160px;
  opacity: 0.025;
  pointer-events: none;
}

.svg-container::after {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background: linear-gradient(135deg, var(--accent-glow) 0%, transparent 40%, transparent 60%, var(--cyan-glow) 100%);
  opacity: 0;
  transition: opacity 0.6s ease;
  pointer-events: none;
}

.svg-container.win-glow::after {
  opacity: 1;
}

/* ─── 3D Relief Button ─── */
.relief-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 10;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-dim);
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s ease;
  opacity: 0.6;
}

.relief-btn:hover {
  opacity: 1;
  color: var(--accent);
  border-color: var(--accent-glow);
  background: var(--bg-card);
  box-shadow: 0 0 16px rgba(74, 222, 128, 0.1);
}

.relief-btn.active {
  opacity: 1;
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 20px rgba(74, 222, 128, 0.15);
}

.svg-glow-ring {
  position: absolute;
  width: 90%;
  height: 90%;
  border-radius: 50%;
  border: 1px solid var(--border-medium);
  opacity: 0.3;
  z-index: 0;
  pointer-events: none;
}

#country-svg {
  width: 100%;
  height: 100%;
  z-index: 1;
  overflow: visible;
  filter: drop-shadow(0 0 6px rgba(74, 222, 128, 0.15));
  transition: all 0.4s ease;
}

#country-svg.glow-active {
  filter: drop-shadow(0 0 16px var(--accent-glow));
}

#country-svg.relief-mode {
  filter:
    drop-shadow(-3px -3px 8px rgba(180, 240, 255, 0.35))
    drop-shadow(6px 10px 20px rgba(0, 0, 0, 0.75))
    drop-shadow(0 0 25px rgba(74, 222, 128, 0.35))
    drop-shadow(0 0 50px rgba(74, 222, 128, 0.12));
  transform: scale(1.06) translateY(-8px);
}

#country-svg.party-spin {
  animation: spin360 1s linear infinite;
}

#country-shape {
  transition: fill 0.5s ease;
}

#country-shape.glow {
  animation: countryPulse 0.8s ease 3;
}

@keyframes countryPulse {
  0%, 100% {
    filter: drop-shadow(0 0 4px var(--accent-glow));
  }
  50% {
    filter: drop-shadow(0 0 20px var(--accent));
  }
}

.hint-text {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dim);
  text-align: center;
  z-index: 2;
  white-space: nowrap;
  background: rgba(15, 21, 37, 0.85);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  padding: 6px 18px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  transition: all 0.3s ease;
}

@media (min-width: 768px) {
  .hint-text {
    font-size: 14px;
    padding: 7px 22px;
    bottom: 18px;
  }
}

@media (min-width: 1024px) {
  .hint-text {
    font-size: 15px;
    padding: 8px 24px;
    bottom: 20px;
  }
}

.map-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.map-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 2px;
}

.map-attempts {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
}

@media (min-width: 768px) {
  .map-label {
    font-size: 12px;
    letter-spacing: 2.5px;
  }
  .map-attempts {
    font-size: 14px;
  }
}

@media (min-width: 1024px) {
  .map-label {
    font-size: 13px;
  }
  .map-attempts {
    font-size: 15px;
  }
}

/* ─── Guess Grid ─── */
.guess-grid {
  width: 100%;
  margin-bottom: 16px;
}

.grid-header {
  display: grid;
  grid-template-columns: 2fr 1.1fr 0.5fr 0.7fr;
  gap: 6px;
  padding: 0 4px;
  margin-bottom: 8px;
}

.header-cell {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  text-align: center;
  padding: 4px 0;
}

.guess-cell-label {
  text-align: left;
  padding-left: 8px;
}

.grid-rows {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.guess-row {
  display: grid;
  grid-template-columns: 2fr 1.1fr 0.5fr 0.7fr;
  gap: 6px;
  opacity: 0;
}

.guess-row.slide-in {
  animation: slideInAndFade 0.35s ease forwards;
}

@keyframes slideInAndFade {
  0% {
    opacity: 0;
    transform: translateY(-10px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.guess-row.shake {
  animation: shakeRow 0.5s ease !important;
  opacity: 1 !important;
  transform: none !important;
}

@keyframes shakeRow {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

.guess-cell {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  padding: 10px 12px;
  font-size: 13px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  transition: all 0.3s ease;
}

.guess-cell.name-cell {
  font-weight: 600;
  font-size: 12px;
  text-align: left;
  justify-content: flex-start;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  gap: 6px;
}

.guess-cell.dist-cell {
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.guess-cell.dir-cell {
  font-size: 20px;
  font-weight: 600;
  background: var(--bg-card);
  border-color: transparent;
}

.guess-cell.prox-cell {
  font-weight: 700;
  font-size: 14px;
}

.guess-cell.prox-high {
  background: rgba(74, 222, 128, 0.12);
  border-color: rgba(74, 222, 128, 0.25);
  color: var(--accent);
  box-shadow: 0 0 12px rgba(74, 222, 128, 0.06);
}

.guess-cell.prox-mid {
  background: rgba(250, 204, 21, 0.1);
  border-color: rgba(250, 204, 21, 0.2);
  color: var(--yellow);
}

.guess-cell.prox-low {
  background: rgba(251, 146, 60, 0.1);
  border-color: rgba(251, 146, 60, 0.2);
  color: var(--orange);
}

.guess-cell.prox-cold {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.15);
  color: var(--red);
}

/* ─── Input Area ─── */
.input-area {
  width: 100%;
  display: flex;
  gap: 8px;
  align-items: flex-start;
  position: relative;
  margin-bottom: 16px;
}

.autocomplete-wrapper {
  flex: 1;
  position: relative;
}

.guess-input {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--border-medium);
  border-radius: var(--radius-pill);
  background: var(--bg-elevated);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 500;
  outline: none;
  transition: all 0.25s ease;
}

.guess-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.1), 0 0 20px rgba(74, 222, 128, 0.04);
  background: var(--bg-card);
}

.guess-input::placeholder {
  color: var(--text-muted);
  font-weight: 400;
}

.autocomplete-list {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: rgba(22, 30, 48, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  max-height: 220px;
  overflow-y: auto;
  display: none;
  z-index: 100;
  scrollbar-width: thin;
  scrollbar-color: rgba(74, 222, 128, 0.2) transparent;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.autocomplete-list::-webkit-scrollbar {
  width: 4px;
}

.autocomplete-list::-webkit-scrollbar-thumb {
  background: rgba(74, 222, 128, 0.2);
  border-radius: 2px;
}

.autocomplete-list.show {
  display: block;
  animation: dropdownSlide 0.15s ease;
}

@keyframes dropdownSlide {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.autocomplete-item {
  padding: 11px 16px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: all 0.12s ease;
  color: var(--text-dim);
}

.autocomplete-item:last-child {
  border-bottom: none;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.autocomplete-item:first-child {
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.autocomplete-item:hover,
.autocomplete-item.selected {
  background: rgba(74, 222, 128, 0.1);
  color: var(--accent);
  padding-left: 20px;
}

.submit-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 20px;
  border: none;
  border-radius: var(--radius-pill);
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dim) 100%);
  color: #070B14;
  font-family: 'DM Sans', sans-serif;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.25s ease;
  white-space: nowrap;
  height: 48px;
  box-shadow: 0 4px 14px rgba(74, 222, 128, 0.2);
}

.submit-btn:hover {
  filter: brightness(1.15);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(74, 222, 128, 0.3);
}

.submit-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(74, 222, 128, 0.2);
}

.submit-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
  filter: none;
}

.submit-btn svg {
  transition: transform 0.2s ease;
}

.submit-btn:hover svg {
  transform: translateX(2px);
}

.submit-btn:disabled svg {
  transform: none;
}

/* ─── Give Up Button ─── */
.giveup-btn {
  padding: 0 18px;
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-pill);
  background: rgba(239, 68, 68, 0.08);
  color: var(--red);
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.25s ease;
  white-space: nowrap;
  height: 48px;
  letter-spacing: 0.3px;
}

.giveup-btn:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: var(--red);
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.1);
}

.giveup-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  box-shadow: none;
  border-color: rgba(239, 68, 68, 0.12);
  background: rgba(239, 68, 68, 0.04);
}

/* ─── Next Button ─── */
.next-btn {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: var(--radius-pill);
  background: linear-gradient(135deg, var(--accent), var(--cyan));
  color: #070B14;
  font-family: 'DM Sans', sans-serif;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.3s ease;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 16px rgba(74, 222, 128, 0.2);
  animation: fadeInUp 0.4s ease;
}

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

.next-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
  box-shadow: 0 6px 24px rgba(74, 222, 128, 0.3);
}

/* ─── Modal ─── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(7, 11, 20, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.show {
  opacity: 1;
  pointer-events: auto;
  display: flex !important;
}

.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-xl);
  padding: 36px 32px 28px;
  width: 90%;
  max-width: 380px;
  position: relative;
  transform: scale(0.92);
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.show .modal {
  transform: scale(1);
}

.modal-header {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  margin-bottom: 24px;
}

.modal-icon {
  color: var(--accent);
}

.modal h2 {
  font-family: 'Sora', sans-serif;
  text-align: center;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 1px;
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 16px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  color: var(--text);
  background: rgba(255,255,255,0.05);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.stat {
  text-align: center;
  padding: 14px 6px 10px;
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.stat-icon {
  font-size: 14px;
  line-height: 1;
  margin-bottom: 2px;
}

.stat-value {
  display: block;
  font-family: 'Sora', sans-serif;
  font-size: 26px;
  font-weight: 800;
  color: var(--accent);
  line-height: 1.2;
}

.stat-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.stats-section {
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-subtle);
}

.stats-section:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.stats-section-alt {
  opacity: 0.85;
}

.stats-section-title {
  font-family: 'Sora', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 12px;
  text-align: center;
}

.daily-result {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin-bottom: 16px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-dim);
  font-family: monospace;
  letter-spacing: 0.5px;
}

.share-btn {
  width: 100%;
  padding: 12px;
  border: 1.5px solid var(--border-medium);
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text-dim);
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.5px;
}

.share-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 16px rgba(74, 222, 128, 0.06);
}

.share-btn.copied {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(74, 222, 128, 0.1);
}

/* ─── Info Modal ─── */
.info-modal-content {
  max-width: 420px;
}

.info-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
}

.info-story {
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--text-dim);
  font-weight: 400;
  max-width: 360px;
}

.info-developer {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  padding: 8px 20px;
  background: var(--bg-elevated);
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
}

.info-socials {
  display: flex;
  gap: 16px;
  justify-content: center;
  padding: 8px 0;
}

.info-social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-dim);
  transition: all 0.3s ease;
  text-decoration: none;
}

.info-social-link svg {
  width: 22px;
  height: 22px;
}

.info-social-link:hover {
  color: var(--accent);
  border-color: var(--accent-glow);
  background: var(--accent-soft);
  box-shadow: 0 0 20px rgba(74, 222, 128, 0.15), 0 0 40px rgba(74, 222, 128, 0.05);
  transform: translateY(-2px) scale(1.05);
}

.info-social-link:nth-child(2):hover {
  color: var(--cyan);
  border-color: var(--cyan-glow);
  box-shadow: 0 0 20px rgba(34, 211, 238, 0.15), 0 0 40px rgba(34, 211, 238, 0.05);
}

.info-social-link:nth-child(3):hover {
  color: #f472b6;
  border-color: rgba(244, 114, 182, 0.25);
  box-shadow: 0 0 20px rgba(244, 114, 182, 0.15), 0 0 40px rgba(244, 114, 182, 0.05);
}

.info-star {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  padding-top: 4px;
}

/* ─── Footer ─── */
.game-footer {
  width: 100%;
  margin-top: auto;
  padding: 24px 0 6px;
  border-top: 1px solid var(--border-subtle);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.footer-logo {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--text-muted);
  opacity: 0.5;
  transition: opacity 0.3s ease;
}

.game-footer:hover .footer-logo {
  opacity: 0.8;
  color: var(--accent-dim);
}

.game-footer p {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
  letter-spacing: 0.3px;
}

.game-footer a {
  color: var(--accent-dim);
  text-decoration: none;
  transition: color 0.2s;
}

.game-footer a:hover {
  color: var(--accent);
  text-decoration: underline;
}

/* ─── Toast ─── */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-elevated);
  border: 1px solid var(--border-medium);
  padding: 10px 24px;
  border-radius: var(--radius-pill);
  color: var(--accent);
  font-weight: 600;
  font-size: 14px;
  z-index: 400;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  white-space: nowrap;
}

.toast.toast-in {
  animation: toastIn 0.3s ease forwards;
}

.toast.toast-out {
  animation: toastOut 0.3s ease forwards;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

@keyframes toastOut {
  from {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
  to {
    opacity: 0;
    transform: translateX(-50%) translateY(12px);
  }
}

/* ─── Party Mode ─── */
@keyframes spin360 {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes partyToastPulse {
  0%, 100% { box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5); }
  50% { box-shadow: 0 4px 32px rgba(255, 255, 255, 0.15); }
}

.toast.party-toast {
  background: linear-gradient(135deg, #ff006e, #8338ec, #3a86ff, #00f5d4, #fb5607, #ff006e);
  background-size: 300% 300%;
  animation: partyToastPulse 1s ease infinite;
  color: #fff;
  font-weight: 700;
  border-color: transparent;
}

/* ─── UFO Mode ─── */
.ufo-ship {
  position: fixed;
  top: 60px;
  left: -120px;
  z-index: 250;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1s ease;
}
.ufo-ship.flying {
  opacity: 1;
  animation: ufoFly 3s ease-in-out forwards;
}
@keyframes ufoFly {
  0% { left: -120px; top: 60px; }
  30% { left: 30%; top: 50px; }
  50% { left: 45%; top: 55px; }
  70% { left: 60%; top: 50px; }
  100% { left: 110vw; top: 60px; }
}
#country-svg.ufo-glow {
  animation: ufoVibrate 0.15s infinite, ufoGreenPulse 1s ease 3;
}
@keyframes ufoVibrate {
  0%, 100% { transform: translate(0, 0); }
  25% { transform: translate(-2px, 1px); }
  50% { transform: translate(2px, -1px); }
  75% { transform: translate(-1px, 2px); }
}
@keyframes ufoGreenPulse {
  0%, 100% { filter: drop-shadow(0 0 8px #39ff14) drop-shadow(0 0 30px #39ff14); }
  50% { filter: drop-shadow(0 0 20px #39ff14) drop-shadow(0 0 60px #39ff14); }
}

/* ─── Earthquake Mode ─── */
#game-container.earthquake {
  animation: shake 0.1s infinite;
}
@keyframes shake {
  0%, 100% { transform: translate(0, 0); }
  10% { transform: translate(-6px, 4px); }
  20% { transform: translate(5px, -6px); }
  30% { transform: translate(-4px, 5px); }
  40% { transform: translate(6px, -3px); }
  50% { transform: translate(-5px, 6px); }
  60% { transform: translate(4px, -5px); }
  70% { transform: translate(-6px, 3px); }
  80% { transform: translate(5px, -4px); }
  90% { transform: translate(-3px, 6px); }
}
#country-shape.glitch {
  animation: glitchStripes 0.2s infinite;
}
@keyframes glitchStripes {
  0% { clip-path: inset(0 0 80% 0); transform: translate(-3px, 2px); opacity: 0.8; }
  10% { clip-path: inset(20% 0 60% 0); transform: translate(3px, -1px); }
  20% { clip-path: inset(40% 0 40% 0); transform: translate(-2px, 3px); }
  30% { clip-path: inset(60% 0 20% 0); transform: translate(2px, -2px); }
  40% { clip-path: inset(80% 0 0 0); transform: translate(-3px, 1px); }
  50% { clip-path: inset(10% 0 70% 0); transform: translate(3px, -3px); }
  60% { clip-path: inset(30% 0 50% 0); transform: translate(-2px, 2px); }
  70% { clip-path: inset(50% 0 30% 0); transform: translate(2px, -1px); }
  80% { clip-path: inset(70% 0 10% 0); transform: translate(-3px, 3px); }
  90% { clip-path: inset(90% 0 0 0); transform: translate(3px, -2px); }
}

/* ─── Detective Mode ─── */
.detective-mode {
  --bg-deep: #000a12 !important;
  --bg-surface: #001520 !important;
  --bg-elevated: #002033 !important;
  --bg-card: #002a40 !important;
  --border-subtle: rgba(0, 255, 255, 0.15) !important;
  --border-medium: rgba(0, 255, 255, 0.25) !important;
  --text: #e0f7fa !important;
  --text-dim: #80deea !important;
  --text-muted: #4dd0e1 !important;
}
.detective-mode #country-shape {
  fill: rgba(0, 255, 255, 0.1) !important;
  stroke: #00ffff !important;
  stroke-width: 2.5 !important;
  opacity: 1 !important;
  filter: drop-shadow(0 0 8px #00ffff) !important;
}
.detective-mode .svg-glow-ring {
  border-color: rgba(0, 255, 255, 0.2);
}
.detective-mode .svg-container::after {
  background: linear-gradient(135deg, rgba(0, 255, 255, 0.08) 0%, transparent 40%, transparent 60%, rgba(0, 255, 255, 0.04) 100%);
}
.detective-mode .guess-cell {
  border-color: rgba(0, 255, 255, 0.15);
}
.detective-mode .guess-input,
.detective-mode .submit-btn,
.detective-mode .giveup-btn,
.detective-mode .next-btn {
  border-color: rgba(0, 255, 255, 0.2) !important;
  color: var(--text) !important;
}
.detective-mode .guess-input::placeholder {
  color: var(--text-muted);
}
.detective-mode .mode-btn,
.detective-mode .lang-btn {
  color: var(--text-dim);
  border-color: var(--border-subtle);
}
.detective-mode .mode-btn.active,
.detective-mode .lang-btn.active {
  color: #00ffff;
  border-color: #00ffff;
}

/* ─── Confetti Canvas ─── */
.confetti-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 300;
}

/* ─── Hidden ─── */
.hidden {
  display: none !important;
}

/* ─── Responsive: Desktop Two-Column ─── */
@media (min-width: 768px) {
  #app {
    padding: 28px 32px 24px;
    justify-content: flex-start;
  }

  .game-layout {
    grid-template-columns: 5fr 4fr;
    gap: 36px;
    align-items: start;
  }

  .map-panel {
    position: sticky;
    top: 28px;
    padding-top: 0;
    width: 100%;
  }

  .svg-container {
    max-width: none;
    width: 100%;
    min-height: 380px;
    aspect-ratio: 1 / 0.85;
    padding: 28px;
  }

  .svg-container::before {
    font-size: 180px;
  }

  .svg-glow-ring {
    width: 92%;
    height: 92%;
  }

  .game-panel {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding-top: 4px;
  }

  .title {
    font-size: 20px;
    letter-spacing: 5px;
  }

  .title-sub {
    font-size: 9px;
    letter-spacing: 1.5px;
  }
}

/* ─── Responsive: Extra Large Desktop ─── */
@media (min-width: 1024px) {
  #app {
    max-width: 1100px;
  }

  .game-layout {
    gap: 48px;
  }

  .svg-container {
    min-height: 460px;
    padding: 32px;
  }

  .svg-container::before {
    font-size: 200px;
  }

  .title {
    font-size: 28px;
    letter-spacing: 8px;
  }

  .title-sub {
    font-size: 11px;
  }
}

/* ─── Responsive: Mobile ─── */
@media (max-width: 767px) {
  #app {
    padding: 14px 16px 20px;
  }

  header {
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
    padding-bottom: 10px;
  }

  .header-left {
    flex: 1 1 auto;
    min-width: 0;
  }

  .title {
    font-size: 15px;
    letter-spacing: 3px;
    gap: 7px;
  }

  .logo-svg {
    width: 1.4em;
    height: 1.4em;
  }

  .title-sub {
    font-size: 8px;
    letter-spacing: 1.5px;
  }

  .header-controls {
    flex: 1 1 auto;
    justify-content: flex-end;
    min-width: 0;
    gap: 4px;
  }

  .mode-toggle {
    margin-right: 0;
  }

  .mode-btn {
    font-size: 9px;
    padding: 4px 8px;
    letter-spacing: 0;
  }

  .game-layout {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .svg-container {
    width: 100%;
    max-width: calc(100vw - 32px);
    aspect-ratio: 1 / 0.85;
    padding: 20px;
  }

  .svg-container::before {
    font-size: 120px;
  }

  .map-panel {
    order: -1;
  }

  .guess-cell {
    font-size: 11px;
    padding: 8px 8px;
    min-height: 36px;
    border-radius: var(--radius-pill);
  }

  .guess-cell.name-cell {
    font-size: 11px;
  }

  .guess-cell.dir-cell {
    font-size: 16px;
  }

  .guess-cell.prox-cell {
    font-size: 12px;
  }

  .grid-header .header-cell {
    font-size: 9px;
  }

  .guess-input {
    font-size: 14px;
    padding: 11px 14px;
  }

  .submit-btn {
    padding: 0 14px;
    font-size: 12px;
    height: 44px;
  }

  .submit-btn svg {
    display: none;
  }

  .giveup-btn {
    padding: 0 12px;
    font-size: 11px;
    height: 44px;
  }

  .lock-card {
    padding: 32px 24px 28px;
    width: 92%;
    max-width: 340px;
  }

  .lock-icon {
    font-size: 42px;
  }

  .lock-title {
    font-size: 18px;
  }

  .lock-timer {
    font-size: 34px;
    letter-spacing: 3px;
  }

  .streak-display {
    font-size: 18px;
    min-height: 26px;
    margin-bottom: 14px;
  }

  .modal {
    padding: 28px 20px 24px;
  }

  .stat-value {
    font-size: 22px;
  }

  .stats-grid {
    gap: 8px;
  }

  .stat {
    padding: 10px 4px 8px;
  }

  .lang-btn {
    padding: 4px 10px;
    font-size: 10px;
  }

  .icon-btn {
    width: 34px;
    height: 34px;
  }

  .icon-btn svg {
    width: 18px;
    height: 18px;
  }

  .game-footer p {
    font-size: 10px;
  }

  .toast {
    padding: 8px 18px;
    font-size: 12px;
    bottom: 20px;
  }
}

/* ─── Responsive: Small Mobile ─── */
@media (max-width: 400px) {
  .svg-container {
    width: 100%;
    aspect-ratio: 1 / 0.85;
    padding: 16px;
  }

  .svg-container::before {
    font-size: 100px;
  }

  .guess-cell {
    font-size: 10px;
    padding: 6px 6px;
    min-height: 32px;
  }

  .guess-cell.name-cell {
    font-size: 10px;
  }

  .grid-header .header-cell {
    font-size: 8px;
  }

  .lock-card {
    padding: 24px 16px 24px;
    width: 96%;
  }

  .lock-icon {
    font-size: 36px;
  }

  .lock-title {
    font-size: 16px;
  }

  .lock-timer {
    font-size: 28px;
    letter-spacing: 2px;
  }

  .stats-grid {
    gap: 6px;
  }

  .stat-value {
    font-size: 18px;
  }
}

/* ─── Screen Shake ─── */
#app.shake {
  animation: screenShake 0.4s ease;
}

@keyframes screenShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-5px); }
  40% { transform: translateX(5px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
}

/* ─── Smooth scrollbar ─── */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-subtle);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-medium);
}
