:root {
  --bg: #0b1220;
  --panel: rgba(255, 255, 255, 0.06);
  --panel2: rgba(255, 255, 255, 0.08);
  --text: rgba(255, 255, 255, 0.92);
  --muted: rgba(255, 255, 255, 0.70);
  --stroke: rgba(255, 255, 255, 0.14);
  --accent: #60a5fa;
  --good: #34d399;
  --bad: #fb7185;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  min-height: 100%;
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  background: radial-gradient(1200px 700px at 20% 0%, rgba(96, 165, 250, 0.25), transparent 55%),
              radial-gradient(900px 600px at 100% 10%, rgba(52, 211, 153, 0.18), transparent 55%),
              var(--bg);
  background-color: var(--bg);
  background-repeat: no-repeat;
  color: var(--text);
}

 body {
  padding-bottom: env(safe-area-inset-bottom);
 }

@media (max-width: 720px) {
  body {
    padding-bottom: calc(env(safe-area-inset-bottom) + 86px);
  }
}

.header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 18px 20px;
  gap: 16px;
}

.brand {
  text-align: center;
  justify-self: center;
}

.nav {
  justify-self: start;
}

.headerRight {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 16px;
}

@media (max-width: 720px) {
  .mobileTopBar {
    display: flex;
    margin-bottom: 10px;
  }

  .mobileTopBar .filter {
    width: 100%;
  }

  .taskBox {
    display: block;
    margin-top: 12px;
    background: var(--panel);
    border: 1px solid var(--stroke);
    border-radius: 16px;
    padding: 14px;
    box-shadow: 0 18px 45px rgba(0,0,0,0.22);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }

  .taskBox .prompt {
    box-shadow: none;
    margin: 0;
    padding: 0;
    background: transparent;
    border: none;
  }

  .taskBox .controls {
    margin-top: 12px;
  }

  .taskBox .message {
    margin-top: 12px;
  }

  .bottomBar {
    display: block;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
    background: rgba(11, 18, 32, 0.78);
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    z-index: 60;
  }

  .bottomBar .stats {
    width: 100%;
    justify-content: space-between;
  }

  .bottomBar .stat {
    min-width: 0;
    flex: 1;
  }
}

@media (max-width: 720px) {
  .header {
    grid-template-columns: 1fr;
    justify-items: stretch;
    padding: calc(14px + env(safe-area-inset-top)) 14px 14px;
    gap: 10px;
  }

  .brand {
    width: 100%;
    text-align: center;
  }

  .headerRight {
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
  }

  .nav {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .nav::-webkit-scrollbar { display: none; }

  .tab {
    white-space: nowrap;
  }

  .filter {
    width: 100%;
    justify-content: space-between;
  }

  .stats {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }
}

@media (max-width: 420px) {
  .tab {
    padding: 8px 9px;
    font-size: 13px;
  }

  .select,
  .chip {
    font-size: 13px;
  }
}

.nav {
  display: flex;
  gap: 8px;
  padding: 6px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--stroke);
}

.tab {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  padding: 8px 10px;
  border-radius: 12px;
  font-weight: 800;
  cursor: pointer;
}

.tab:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.tab.active {
  background: rgba(96, 165, 250, 0.16);
  border-color: rgba(96, 165, 250, 0.35);
  color: var(--text);
}

.filter {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--stroke);
}

.filterLabel {
  font-size: 12px;
  color: var(--muted);
  font-weight: 800;
}

.select {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  padding: 8px 10px;
  padding-right: 32px;
  border-radius: 12px;
  font-weight: 800;
  cursor: pointer;

  background-image:
    linear-gradient(45deg, transparent 50%, rgba(255, 255, 255, 0.70) 50%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.70) 50%, transparent 50%);
  background-position:
    calc(100% - 16px) 52%,
    calc(100% - 11px) 52%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

 .select:hover {
   background-color: rgba(255, 255, 255, 0.10);
 }

 .select option {
   background: #0b1220;
   color: rgba(255, 255, 255, 0.92);
 }

.chip {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 12px;
  font-weight: 800;
  cursor: pointer;
}

.chip:hover {
  background: rgba(255, 255, 255, 0.10);
}

.chip.active {
  border-color: rgba(96, 165, 250, 0.35);
  background: rgba(96, 165, 250, 0.16);
}

.select:focus {
  outline: 2px solid rgba(96, 165, 250, 0.45);
  outline-offset: 2px;
}

.brand .title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.brand .subtitle {
  margin-top: 4px;
  font-size: 13px;
  color: var(--muted);
}

.stats {
  display: flex;
  gap: 10px;
}

.stat {
  background: var(--panel);
  border: 1px solid var(--stroke);
  padding: 10px 12px;
  border-radius: 12px;
  min-width: 92px;
}

.statLabel {
  font-size: 12px;
  color: var(--muted);
}

.statValue {
  font-size: 18px;
  font-weight: 700;
  margin-top: 2px;
}

.main {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 18px;
  padding: 0 20px 20px;
  align-items: start;
}

@media (max-width: 980px) {
  .main { grid-template-columns: 1fr; }
}

.panel {
  background: var(--panel);
  border: 1px solid var(--stroke);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 18px 45px rgba(0,0,0,0.22);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.prompt {
  background: var(--panel2);
  border: 1px solid var(--stroke);
  border-radius: 14px;
  padding: 14px;
  box-shadow: 0 14px 34px rgba(0,0,0,0.18);
}

.promptLabel {
  font-size: 12px;
  color: var(--muted);
}

.promptCountry {
  margin-top: 6px;
  font-size: 22px;
  font-weight: 800;
}

.controls {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

@media (max-width: 720px) {
  .main {
    padding: 0 14px 14px;
    display: flex;
    flex-direction: column;
  }

  .mapWrap {
    order: 0;
  }

  .panel {
    order: 1;
  }

  .controls {
    flex-wrap: wrap;
  }

  .controls .btn {
    flex: 1;
    min-width: 140px;
  }

  .flagInputRow {
    flex-direction: column;
  }

  .flagInputRow .btn {
    width: 100%;
  }
}

.tooltip {
  position: fixed;
  z-index: 50;
  pointer-events: none;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(11, 18, 32, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: rgba(255, 255, 255, 0.92);
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 10px 30px rgba(0,0,0,0.35);
}

.hidden {
  display: none !important;
}

.flagCard {
  margin-top: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--stroke);
  border-radius: 14px;
  padding: 12px;
}

.flagImg {
  width: 100%;
  height: 160px;
  object-fit: contain;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
}

.flagInputRow {
  margin-top: 10px;
  display: flex;
  gap: 10px;
}

.input {
  flex: 1;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 12px;
  font-weight: 800;
}

.input::placeholder {
  color: rgba(255, 255, 255, 0.45);
  font-weight: 700;
}

.input:focus {
  outline: 2px solid rgba(96, 165, 250, 0.45);
  outline-offset: 2px;
}

.btn {
  appearance: none;
  border: 1px solid rgba(96, 165, 250, 0.45);
  background: rgba(96, 165, 250, 0.16);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 12px;
  font-weight: 700;
  cursor: pointer;
}

.btn:hover { background: rgba(96, 165, 250, 0.22); }

.btn.secondary {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
}

.btn.secondary:hover { background: rgba(255, 255, 255, 0.10); }

.message {
  margin-top: 12px;
  min-height: 22px;
  color: var(--muted);
  font-size: 13px;
}

.message.good { color: var(--good); }
.message.bad { color: var(--bad); }

.mapWrap {
  min-height: 520px;
}

.mobileMeta {
  display: none;
}

@media (max-width: 720px) {
  .mobileMeta {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 12px;
  }

  .mobileMeta .filter,
  .mobileMeta .stats {
    width: 100%;
  }
}

.mapCard {
  background: var(--panel);
  border: 1px solid var(--stroke);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 22px 55px rgba(0,0,0,0.28);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

@media (prefers-reduced-motion: no-preference) {
  .panel,
  .mapCard,
  .prompt,
  .btn,
  .tab,
  .chip,
  .select {
    transition: transform 180ms ease, box-shadow 180ms ease, background-color 180ms ease, border-color 180ms ease;
  }

  .btn:hover,
  .chip:hover,
  .tab:hover {
    transform: translateY(-1px);
  }

  .panel:hover,
  .mapCard:hover {
    transform: translateY(-1px);
  }
}

.map {
  width: 100%;
  height: min(74vh, 760px);
  display: block;
}

@media (max-width: 720px) {
  .map {
    height: min(54vh, 520px);
  }
}

@media (max-width: 720px) {
  .mapWrap .prompt {
    margin-top: 12px;
  }
}

@media (max-width: 420px) {
  .map {
    height: min(48vh, 460px);
  }
}

.country {
  fill: rgba(255, 255, 255, 0.10);
  stroke: rgba(255, 255, 255, 0.22);
  stroke-width: 0.6;
  cursor: pointer;
}

.country.dimmed {
  fill: rgba(255, 255, 255, 0.04);
  stroke: rgba(255, 255, 255, 0.10);
  opacity: 0.55;
}

.country:hover {
  fill: rgba(96, 165, 250, 0.22);
}

.country.correct {
  fill: rgba(52, 211, 153, 0.28);
  stroke: rgba(52, 211, 153, 0.65);
  stroke-width: 1.2;
}

.country.wrong {
  fill: rgba(251, 113, 133, 0.24);
  stroke: rgba(251, 113, 133, 0.72);
  stroke-width: 1.2;
}

.country.target {
  fill: rgba(96, 165, 250, 0.26);
  stroke: rgba(96, 165, 250, 0.75);
  stroke-width: 1.2;
}

.footer {
  padding: 0 20px 18px;
  color: var(--muted);
  font-size: 12px;
}
