:root {
  color-scheme: dark;

  --bg: #0b1020;
  --panel: rgba(255, 255, 255, 0.06);
  --panel-2: rgba(255, 255, 255, 0.09);
  --border: rgba(255, 255, 255, 0.12);
  --text: rgba(255, 255, 255, 0.92);
  --muted: rgba(255, 255, 255, 0.68);

  --accent: #7c3aed;
  --good: #22c55e;
  --bad: #ef4444;
  --warn: #f59e0b;

  --radius: 16px;
  --radius-sm: 12px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);

  --gap: 18px;
  --max: 1100px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, "Noto Sans", "Liberation Sans", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  background: radial-gradient(1200px 800px at 20% 0%, rgba(124, 58, 237, 0.22), transparent 55%),
    radial-gradient(1200px 800px at 90% 30%, rgba(34, 197, 94, 0.12), transparent 60%),
    var(--bg);
  color: var(--text);
}

.app {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

/* HUD */
.hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.16);
  backdrop-filter: blur(10px);
}

.hud__left {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hud__brand {
  font-weight: 750;
  letter-spacing: 0.2px;
}

.hud__status {
  font-size: 13px;
  color: var(--muted);
  min-height: 16px;
}

.hud__right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.hud__stat {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.hud__stat-label {
  font-size: 12px;
  color: var(--muted);
}

.hud__stat-value {
  font-weight: 700;
}

.hud__run {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.hud__run-label {
  color: rgba(255, 255, 255, 0.7);
}

.hud__run-sep {
  opacity: 0.7;
}

/* Screens */
.screen {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px 18px;
  padding-bottom: 98px;
}

.screen--game {
  align-items: center;
}

.hud__logo {
  display: block;
  height: 51px;
  width: auto;
}

/* Bottom bar */
.bottom-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(10, 12, 24, 0.72);
  backdrop-filter: blur(10px);
}

.bottom-bar__left {
  display: flex;
  align-items: baseline;
  gap: 10px;
  color: var(--text);
}

.bottom-bar__stat {
  display: inline-flex;
  gap: 8px;
  align-items: baseline;
}

.bottom-bar__label {
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
}

.bottom-bar__value {
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.2px;
}

.bottom-bar__sep {
  opacity: 0.65;
}

/* Arena */
.arena {
  width: 100%;
  max-width: var(--max);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: var(--gap);
  align-items: start;
}

@media (max-width: 860px) {
  .arena {
    grid-template-columns: 1fr;
  }
}

/* Prompt */
.prompt {
  grid-column: 1 / -1;
  text-align: center;
  font-weight: 900;
  letter-spacing: -0.3px;
  font-size: 22px;
  margin-bottom: 14px;
}

@media (max-width: 860px) {
  .prompt {
    font-size: 20px;
    margin-bottom: 12px;
  }
}

.vs {
  align-self: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 18px;
}

.vs__pill {
  width: 56px;
  height: 56px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.8), rgba(59, 130, 246, 0.6));
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: var(--shadow);
  font-weight: 800;
}



/* City Card */
.city-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: 18px;
  gap: 10px;

  min-height: 170px;

  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.03));
  box-shadow: var(--shadow);

  cursor: pointer;
  user-select: none;
  text-align: left;
  color: var(--text);

  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

@media (max-width: 860px) {
  .city-card {
    min-height: 150px;
  }
}

.city-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.22);
}

.city-card:focus-visible {
  outline: 3px solid rgba(124, 58, 237, 0.55);
  outline-offset: 3px;
}

.city-card[disabled] {
  cursor: default;
  opacity: 0.75;
}

.city-card--selected {
  border-color: rgba(124, 58, 237, 0.9);
  background: linear-gradient(180deg, rgba(124, 58, 237, 0.18), rgba(255, 255, 255, 0.03));
}

.city-card--wrong {
  border-color: rgba(239, 68, 68, 0.9);
  background: linear-gradient(180deg, rgba(239, 68, 68, 0.18), rgba(255, 255, 255, 0.03));
}

.city-card__side {
  font-size: 12px;
  color: var(--muted);
}

.city-card__title {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.3px;
}

.city-card__meta {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.78);
}

/* Buttons */
.button {
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  border-radius: 999px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 650;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
}

.button:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.22);
}

.button:focus-visible {
  outline: 3px solid rgba(124, 58, 237, 0.55);
  outline-offset: 3px;
}

.button--ghost {
  background: transparent;
}

/* Panels */
.panel {
  width: 100%;
  max-width: var(--max);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 18px;
}

.panel__title {
  margin: 0;
  font-size: 34px;
  letter-spacing: -0.3px;
}

.panel__subtitle {
  margin: 6px 0 0;
  color: var(--muted);
}

.panel__actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.panel__section-title {
  margin: 18px 0 10px;
  font-size: 18px;
}

/* Summary */
.summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 14px;
}

@media (max-width: 700px) {
  .summary {
    grid-template-columns: 1fr;
  }
}

.summary__item {
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--panel-2);
  padding: 12px;
}

.summary__label {
  color: var(--muted);
  font-size: 12px;
}

.summary__value {
  font-weight: 800;
  font-size: 20px;
  margin-top: 4px;
}

/* History */
.history {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.history__item {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-sm);
  padding: 12px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

@media (max-width: 700px) {
  .history__item {
    grid-template-columns: 1fr;
  }
}

.history__title {
  font-weight: 700;
}

.history__meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.history__right {
  display: flex;
  align-items: start;
  justify-content: flex-end;
  gap: 8px;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  white-space: nowrap;
}

.badge--easy {
  border-color: rgba(34, 197, 94, 0.35);
}

.badge--medium {
  border-color: rgba(59, 130, 246, 0.35);
}

.badge--hard {
  border-color: rgba(245, 158, 11, 0.45);
}

.badge--impossible {
  border-color: rgba(239, 68, 68, 0.7);
  background: rgba(239, 68, 68, 0.1);
}

.badge--correct {
  border-color: rgba(34, 197, 94, 0.55);
}

.badge--wrong {
  border-color: rgba(239, 68, 68, 0.55);
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 50;
}

.modal--open {
  display: grid;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}

.modal__panel {
  position: relative;
  width: min(720px, 100%);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(15, 18, 35, 0.96);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.modal--correct .modal__panel {
  border-color: rgba(34, 197, 94, 0.7);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(34, 197, 94, 0.18);
}

.modal--wrong .modal__panel {
  border-color: rgba(239, 68, 68, 0.7);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(239, 68, 68, 0.18);
}

.modal__header,
.modal__footer {
  padding: 14px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--border);
}

.modal__footer {
  border-bottom: 0;
  border-top: 1px solid var(--border);
  justify-content: flex-end;
}

.modal__title {
  font-weight: 800;
}

.modal__body {
  padding: 14px;
}

/* Result */
.result {
  display: grid;
  gap: 10px;
}

/* Side-by-side city display */
.result-cities {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

@media (max-width: 720px) {
  .result-cities {
    grid-template-columns: 1fr;
  }
}

.result-cities__item {
  padding: 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
}

.result-cities__label {
  color: var(--muted);
  font-size: 12px;
}

.result-cities__value {
  margin-top: 4px;
  font-weight: 750;
}

/* Result banner */
.result-banner {
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  padding: 12px;
  font-weight: 900;
  letter-spacing: -0.2px;
  text-transform: uppercase;
}

.result-banner__text {
  font-size: 18px;
}

.modal--correct .result-banner {
  border-color: rgba(34, 197, 94, 0.6);
  background: rgba(34, 197, 94, 0.12);
}

.modal--wrong .result-banner {
  border-color: rgba(239, 68, 68, 0.6);
  background: rgba(239, 68, 68, 0.12);
}

.result__row {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
}

.result__label {
  color: var(--muted);
  font-size: 12px;
}

.result__value {
  font-weight: 650;
}

.result__metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 8px;
}

@media (max-width: 720px) {
  .result__metrics {
    grid-template-columns: repeat(2, 1fr);
  }
}

.metric {
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  padding: 10px;
}

.metric__label {
  color: var(--muted);
  font-size: 12px;
}

.metric__value {
  margin-top: 4px;
  font-weight: 800;
}

/* Globe */
.globe {
  margin-top: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  overflow: hidden;
}

.globe__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.globe__title {
  font-weight: 800;
}

.globe__hint {
  color: var(--muted);
  font-size: 12px;
}

.globe__stage {
  width: 100%;
  height: 320px;
  background: radial-gradient(700px 340px at 40% 20%, rgba(124, 58, 237, 0.18), transparent 55%),
    rgba(0, 0, 0, 0.25);
}

@media (max-width: 720px) {
  .globe__stage {
    height: 260px;
  }
}

.globe__fallback {
  padding: 12px;
  color: var(--muted);
  font-size: 13px;
}

/* Help */
.help__text {
  margin: 0 0 10px;
}

.help__text--muted {
  color: var(--muted);
  font-size: 13px;
}

.help__list {
  margin: 0 0 10px;
  padding-left: 18px;
  color: rgba(255, 255, 255, 0.82);
}

/* Footer */
.footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.12);
}

.footer__text {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
}
