:root {
  color-scheme: dark;
  --bg: #0f1618;
  --bg-subtle: #151f22;
  --surface: #1b262a;
  --surface-elevated: #213035;
  --surface-alt: #26363b;
  --surface-input: #11191c;
  --ink: #f1f7f5;
  --muted: #a4b8b5;
  --border: #33454a;
  --border-control: #5d767b;
  --sign-yellow: #f6c200;
  --sign-yellow-bright: #ffe047;
  --sign-yellow-soft: rgba(246, 194, 0, 0.16);
  --sign-ink: #111618;
  --highway: #0b7240;
  --highway-hover: #0e8a4e;
  --highway-deep: #064b29;
  --highway-border: #38c172;
  --accent: #ea580c;
  --accent-hover: #fb6a1e;
  --accent-deep: #9a3412;
  --accent-ink: #ffffff;
  --success: #5dd88b;
  --success-bg: rgba(18, 94, 52, 0.52);
  --success-border: #37b26c;
  --danger: #ff8787;
  --danger-bg: rgba(122, 28, 28, 0.5);
  --danger-border: #e05252;
  --radius: 16px;
  --shadow: 0 14px 36px rgba(0, 0, 0, 0.42);
  --target-min: 36px;
  --font-mono: ui-monospace, "Cascadia Mono", "SFMono-Regular", Menlo, Consolas, monospace;

  accent-color: var(--sign-yellow);
  scrollbar-color: #6b8186 #141d20;
}

@media (pointer: coarse) {
  :root {
    --target-min: 44px;
  }
}

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

html {
  scroll-padding-top: 4.2rem;
  scroll-padding-bottom: calc(3.5rem + env(safe-area-inset-bottom, 0px));
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  line-height: 1.48;
  color: var(--ink);
  background-color: var(--bg);
  background-image:
    radial-gradient(circle at 14% 0%, rgba(11, 114, 64, 0.22), transparent 45%),
    radial-gradient(circle at 86% 6%, rgba(246, 194, 0, 0.12), transparent 40%),
    radial-gradient(circle at 50% 100%, rgba(234, 88, 12, 0.09), transparent 48%);
  overflow-wrap: break-word;
  min-block-size: 100dvh;
  display: flex;
  flex-direction: column;
}

.fx-canvas {
  position: fixed;
  inset: 0;
  inline-size: 100%;
  block-size: 100%;
  pointer-events: none;
  z-index: 950;
}

img, svg {
  max-inline-size: 100%;
}

:where(a, code) {
  overflow-wrap: anywhere;
}

h1, h2, h3 {
  margin-block: 0 0.45rem;
  line-height: 1.2;
  text-wrap: balance;
}

p, li {
  text-wrap: pretty;
}

.hidden, [hidden] {
  display: none !important;
}

.visually-hidden:where(:not(:focus-within, :active)) {
  position: absolute !important;
  clip-path: inset(50%) !important;
  overflow: hidden !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  border: 0 !important;
  white-space: nowrap !important;
}

.skip-link:focus {
  position: fixed;
  inset-block-start: 0.5rem;
  inset-inline-start: 0.5rem;
  z-index: 999;
  padding: 0.65rem 1rem;
  background: var(--sign-yellow);
  color: var(--sign-ink);
  font-weight: 800;
  border-radius: 8px;
  text-decoration: none;
}

:where(button, input, select, textarea, a, summary, [tabindex="0"]):focus-visible {
  outline: 3px solid var(--sign-yellow);
  outline-offset: 2px;
}

:where(button, select, input:not([type="checkbox"], [type="radio"]), [role="button"], nav a) {
  min-block-size: var(--target-min);
  min-inline-size: var(--target-min);
}

/* ==================== ENTRY ANIMATIONS (COMPOSITOR SAFE) ==================== */
.stage-enter {
  opacity: 1;
  translate: 0 0;
  transition:
    opacity 0.28s ease-out,
    translate 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}

@starting-style {
  .stage-enter {
    opacity: 0;
    translate: 0 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .stage-enter {
    translate: none;
    transition-duration: 0.08s;
  }
  @starting-style {
    .stage-enter {
      translate: none;
    }
  }
}

body.reduced-motion .stage-enter {
  translate: none;
  transition: none;
}

/* ==================== BOOT LOADER ==================== */
.boot-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3.5rem 1rem;
  gap: 0.85rem;
  text-align: center;
}

.boot-sign-pulse {
  display: inline-flex;
  padding: 0.55rem 1.25rem;
  background: var(--sign-yellow);
  color: var(--sign-ink);
  font-weight: 900;
  font-size: 1.45rem;
  border-radius: 9px;
  border: 2px solid #111618;
  box-shadow:
    inset 0 0 0 2.5px var(--sign-yellow),
    inset 0 0 0 4.5px #111618,
    0 8px 24px rgba(246, 194, 0, 0.22);
}

/* ==================== TOPBAR & YELLOW TOWN-ENTRANCE SIGN ==================== */
.topbar {
  position: sticky;
  inset-block-start: 0;
  z-index: 40;
  background: rgba(15, 22, 24, 0.92);
  backdrop-filter: blur(10px);
  border-block-end: 1px solid var(--border);
  padding-inline: max(0.75rem, env(safe-area-inset-left, 0px)) max(0.75rem, env(safe-area-inset-right, 0px));
  padding-block: max(0.42rem, env(safe-area-inset-top, 0px)) 0.42rem;
}

.topbar-inner {
  max-inline-size: 1460px;
  margin-inline: auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.75rem;
}

.brand-cluster {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-inline-size: 0;
}

.brand-plate,
.hero-sign-plate {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.42rem;
  background: linear-gradient(180deg, var(--sign-yellow-bright) 0%, var(--sign-yellow) 100%);
  color: var(--sign-ink);
  border-radius: 8px;
  border: 2px solid #111618;
  box-shadow:
    inset 0 0 0 2.5px var(--sign-yellow),
    inset 0 0 0 4.5px #111618,
    0 4px 12px rgba(0, 0, 0, 0.4);
  text-decoration: none;
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1;
}

.brand-plate {
  padding: 0.36rem 0.78rem;
  font-size: 1.06rem;
}

.brand-plate-icon {
  border-radius: 4px;
  flex-shrink: 0;
}

.hero-sign-plate {
  padding: 0.55rem 1.2rem;
  font-size: clamp(1.35rem, 1.1rem + 1vw, 1.85rem);
  border-radius: 10px;
  margin-block-end: 0.55rem;
}

.topbar-route-meta {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--muted);
  display: none;
}

@media (min-width: 1020px) {
  .topbar-route-meta {
    display: inline-block;
  }
}

.topbar-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.nav-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  padding: 0.32rem 0.72rem;
  border-radius: 9px;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.nav-btn:hover {
  background: var(--surface-alt);
  color: var(--ink);
}

.nav-btn.is-active {
  background: var(--surface-alt);
  color: var(--sign-yellow);
  border-color: rgba(246, 194, 0, 0.42);
}

.topbar-controls {
  margin-inline-start: auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

@media (max-width: 640px) {
  .topbar {
    padding-block: max(0.28rem, env(safe-area-inset-top, 0px)) 0.28rem;
  }
  .topbar-inner {
    gap: 0.26rem 0.42rem;
  }
  .brand-plate {
    padding: 0.3rem 0.62rem;
    font-size: 0.96rem;
  }
  .topbar-controls {
    order: 2;
  }
  .topbar-nav {
    order: 3;
    flex-basis: 100%;
    gap: 0.2rem;
  }
  .topbar .nav-btn,
  .topbar .icon-btn,
  .topbar .btn-sm {
    min-block-size: 36px;
    padding: 0.2rem 0.5rem;
    font-size: 0.81rem;
  }
}

/* ==================== MAIN CONTAINER, FOOTER & CARDS ==================== */
.app-main {
  flex: 1 1 auto;
  inline-size: 100%;
  max-inline-size: 1460px;
  margin-inline: auto;
  padding: 0.65rem 0.8rem;
}

.app-footer {
  border-block-start: 1px solid rgba(51, 69, 74, 0.65);
  padding: 0.7rem max(0.85rem, env(safe-area-inset-left, 0px)) max(0.85rem, env(safe-area-inset-bottom, 0px)) max(0.85rem, env(safe-area-inset-right, 0px));
  background: rgba(15, 22, 24, 0.75);
}

.app-footer-inner {
  max-inline-size: 1460px;
  margin-inline: auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem 1rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.footer-link {
  color: var(--sign-yellow);
  text-decoration: underline;
  text-underline-offset: 2px;
  font-weight: 700;
}

.card {
  background: linear-gradient(180deg, var(--surface-elevated) 0%, var(--surface) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem;
  min-inline-size: 0;
}

.subcard {
  box-shadow: none;
  background: var(--bg-subtle);
  margin-block-end: 0.85rem;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 0.86rem;
}

.divider {
  border: 0;
  border-block-start: 1px solid var(--border);
  margin-block: 0.9rem;
}

.section-h2 {
  font-size: 1.04rem;
  margin-block-end: 0.55rem;
}

/* ==================== GAME BUTTONS & INPUTS ==================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.42rem;
  font: inherit;
  font-weight: 800;
  padding: 0.55rem 1.05rem;
  border-radius: 11px;
  border: 1.5px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, translate 0.1s ease, box-shadow 0.15s ease;
}

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.48;
  cursor: not-allowed;
}

.btn-lg {
  inline-size: 100%;
  min-block-size: 54px;
  font-size: 1.08rem;
  letter-spacing: 0.01em;
}

.btn-sm {
  padding: 0.32rem 0.68rem;
  font-size: 0.84rem;
}

.btn-highway,
.btn-primary {
  background: linear-gradient(180deg, #10854a 0%, var(--highway) 100%);
  color: #ffffff;
  border-color: var(--highway-border);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    0 4px 0 var(--highway-deep),
    0 8px 20px rgba(11, 114, 64, 0.32);
}

.btn-highway:hover:not(:disabled),
.btn-primary:hover:not(:disabled) {
  background: linear-gradient(180deg, #139a56 0%, var(--highway-hover) 100%);
  border-color: var(--sign-yellow);
}

.btn-highway:active:not(:disabled),
.btn-primary:active:not(:disabled),
.btn-game-3d:active:not(:disabled) {
  translate: 0 2px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    0 2px 0 var(--highway-deep);
}

.btn-secondary {
  background: linear-gradient(180deg, #f97316 0%, var(--accent) 100%);
  color: var(--accent-ink);
  border-color: rgba(255, 255, 255, 0.26);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.25),
    0 4px 0 var(--accent-deep),
    0 6px 18px rgba(234, 88, 12, 0.28);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-secondary:active:not(:disabled) {
  translate: 0 2px;
  box-shadow: 0 2px 0 var(--accent-deep);
}

.btn-outline {
  background: var(--bg-subtle);
  color: var(--ink);
  border-color: var(--border-control);
}

.btn-outline:hover:not(:disabled) {
  background: var(--surface-alt);
  border-color: var(--sign-yellow);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border-color: transparent;
}

.btn-ghost:hover:not(:disabled) {
  background: var(--surface-alt);
  color: var(--ink);
}

.btn-danger {
  background: #b91c1c;
  color: #ffffff;
  border-color: #f87171;
}

@keyframes pk-cta-glow {
  0%, 100% { box-shadow: inset 0 1px 0 rgba(255,255,255,0.28), 0 4px 0 var(--highway-deep), 0 8px 22px rgba(16, 185, 129, 0.28); }
  50% { box-shadow: inset 0 1px 0 rgba(255,255,255,0.36), 0 4px 0 var(--highway-deep), 0 10px 28px rgba(246, 194, 0, 0.34); }
}

@media (prefers-reduced-motion: no-preference) {
  body:not(.reduced-motion) .btn-cta-pulse:not(:disabled) {
    animation: pk-cta-glow 2.8s ease-in-out infinite;
  }
}

.icon-btn {
  background: var(--bg-subtle);
  border: 1.5px solid var(--border-control);
  color: var(--ink);
  border-radius: 9px;
  padding: 0.28rem 0.56rem;
  font: inherit;
  font-weight: 800;
  font-size: 0.86rem;
  cursor: pointer;
}

.icon-btn:hover {
  background: var(--surface-alt);
}

.icon-btn.is-active {
  background: var(--sign-yellow);
  color: var(--sign-ink);
  border-color: var(--sign-yellow);
}

input[type="text"],
input[type="password"],
input[type="search"],
input[type="number"],
input[type="url"],
select,
textarea {
  font: inherit;
  font-size: max(1rem, 1em);
  inline-size: 100%;
  min-inline-size: 0;
  padding: 0.62rem 0.85rem;
  border: 1.5px solid var(--border-control);
  border-radius: 11px;
  background: var(--surface-input);
  color: var(--ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.game-answer-input {
  min-block-size: 52px;
  font-size: 1.08rem !important;
  font-weight: 700;
  border-width: 2px;
  border-color: #6b888e;
  background: #0d1417;
}

.game-answer-input:focus {
  border-color: var(--sign-yellow);
  box-shadow: 0 0 0 4px rgba(246, 194, 0, 0.2);
}

input::placeholder,
textarea::placeholder {
  color: #8ba09d;
  font-weight: 500;
}

.input-mini {
  max-inline-size: 120px;
  padding: 0.3rem 0.5rem !important;
  min-block-size: 32px !important;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  margin-block-end: 0.65rem;
}

.form-field label {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--muted);
}

.form-error {
  background: var(--danger-bg);
  color: #ffd8d8;
  border: 1px solid var(--danger-border);
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  font-weight: 700;
}

.form-status {
  color: var(--success);
  font-weight: 700;
}

/* ==================== BADGES ==================== */
.badge,
.outcome-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.26rem 0.68rem;
  border-radius: 999px;
  font-size: 0.81rem;
  font-weight: 800;
  border: 1px solid transparent;
  font-variant-numeric: tabular-nums;
}

.badge-sign {
  background: var(--sign-yellow);
  color: var(--sign-ink);
  border-color: #111618;
  border-radius: 7px;
  box-shadow: inset 0 0 0 1.5px #111618;
}

.badge-info {
  background: rgba(56, 189, 248, 0.15);
  color: #bae6fd;
  border-color: rgba(56, 189, 248, 0.42);
}

.badge-accent {
  background: rgba(246, 194, 0, 0.16);
  color: #fde047;
  border-color: rgba(246, 194, 0, 0.48);
}

.badge-success {
  background: var(--success-bg);
  color: #bbf7d0;
  border-color: var(--success-border);
}

.badge-danger {
  background: var(--danger-bg);
  color: #fecaca;
  border-color: var(--danger-border);
}

.badge-neutral {
  background: var(--surface-alt);
  color: var(--ink);
  border-color: var(--border-control);
}

/* ==================== HOME SCREEN (WIDE MAP-FIRST STAGE) ==================== */
.home-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
}

@media (min-width: 960px) {
  .home-layout {
    grid-template-columns: minmax(355px, 430px) minmax(0, 1fr);
    align-items: start;
  }
  .home-layout.is-map-expanded {
    grid-template-columns: minmax(0, 1fr);
  }
  .home-layout.is-map-expanded .home-map-card {
    order: -1;
    position: static;
  }
  .home-map-card {
    position: sticky;
    inset-block-start: 4.3rem;
  }
}

.hero-sub {
  margin-block: 0 0.85rem;
  color: var(--ink);
  font-size: 0.98rem;
  font-weight: 500;
}

.edition-picker {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.45rem;
  margin-block-end: 0.8rem;
}

@media (max-width: 430px) {
  .edition-picker {
    grid-template-columns: minmax(0, 1fr);
  }
}

.edition-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.18rem;
  text-align: start;
  padding: 0.6rem 0.68rem;
  border: 1.5px solid var(--border-control);
  border-radius: 12px;
  background: var(--bg-subtle);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease, translate 0.12s ease;
}

.edition-card:hover {
  background: var(--surface-alt);
  translate: 0 -1px;
}

.edition-card.is-selected {
  border-color: var(--sign-yellow);
  background: linear-gradient(180deg, rgba(246, 194, 0, 0.17) 0%, rgba(246, 194, 0, 0.08) 100%);
  box-shadow: inset 0 0 0 1px var(--sign-yellow), 0 6px 16px rgba(0, 0, 0, 0.25);
}

.edition-flag {
  display: inline-block;
  padding: 0.08rem 0.4rem;
  border-radius: 5px;
  background: var(--surface-alt);
  color: var(--sign-yellow);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.06em;
}

.edition-card.is-selected .edition-flag {
  background: var(--sign-yellow);
  color: var(--sign-ink);
}

.edition-route-mini {
  font-size: 0.74rem;
  color: var(--muted);
}

/* 6-stepena skala vozila po rijetkosti */
.rarity-legend {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 0.7rem;
  margin-block-end: 0.85rem;
}

.rarity-vehicles-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.3rem;
  text-align: center;
}

@media (max-width: 480px) {
  .rarity-vehicles-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    row-gap: 0.48rem;
  }
}

.rarity-tier-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.14rem;
  min-inline-size: 0;
}

.rarity-tier-icon {
  display: block;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.35));
}

.rarity-tier-name {
  font-size: 0.69rem;
  color: var(--muted);
  line-height: 1.15;
  font-weight: 600;
}

.rarity-tier-km {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--sign-yellow);
}

.rarity-spectrum-bar {
  block-size: 6px;
  border-radius: 999px;
  margin-block: 0.55rem 0.28rem;
  background: linear-gradient(90deg, #64748b 0%, #14b8a6 22%, #3b82f6 44%, #8b5cf6 66%, #ea580c 84%, #f6c200 100%);
}

.rarity-spectrum-labels {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--muted);
}

.primary-actions {
  margin-block-end: 0.75rem;
}

.quota-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.38rem;
  margin-block-end: 0.45rem;
}

.quota-explain {
  font-size: 0.86rem;
  margin-block: 0 0.35rem;
  color: var(--ink);
}

.mp-actions-row {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.join-room-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.join-room-form input {
  flex: 1 1 135px;
}

/* ==================== LARGE CARTOGRAPHIC MAP STAGE & ROAD-SIGN HUD ==================== */
.map-card {
  padding: 0.75rem;
}

.map-header {
  padding-inline: 0.25rem;
  margin-block-end: 0.55rem;
}

.map-route-sub {
  margin: 0;
  font-size: 0.86rem;
  color: var(--muted);
}

.map-panel {
  position: relative;
  inline-size: 100%;
  min-block-size: 300px;
  aspect-ratio: 4 / 3;
  border-radius: 14px;
  overflow: hidden;
  border: 2px solid #445a60;
  background: #76accf;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.45);
}

@media (min-width: 960px) {
  .home-map-panel {
    aspect-ratio: auto;
    block-size: clamp(440px, 68dvh, 720px);
  }
  .home-layout.is-map-expanded .home-map-panel {
    block-size: clamp(540px, 78dvh, 860px);
  }
}

.map-stage {
  color-scheme: light;
  color: #162328;
  position: relative;
  inline-size: 100%;
  block-size: 100%;
  background: #76accf;
}

.map-svg {
  display: block;
  inline-size: 100%;
  block-size: 100%;
  touch-action: pan-y;
}

.map-svg.is-panning {
  cursor: grabbing;
}

.map-ocean-bg {
  fill: #dfdad0;
}

.map-stage.is-vector-only .map-ocean-bg {
  fill: #72a7cb;
}

.map-country-neighbor {
  fill: rgba(232, 227, 217, 0.14);
}

.map-country-focus {
  fill: rgba(178, 214, 124, 0.48);
  mix-blend-mode: multiply;
}

.map-stage.is-vector-only .map-country-neighbor {
  fill: #e5e0d5;
}

.map-stage.is-vector-only .map-country-focus {
  fill: #d2e4b8;
  mix-blend-mode: normal;
}

.map-lake {
  fill: #75add0;
  stroke: #578fb2;
  stroke-width: 0.85;
}

.map-river {
  fill: none;
  stroke: #5294bf;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.9;
}

.map-border-neighbor {
  fill: none;
  stroke: rgba(90, 84, 72, 0.65);
  stroke-width: 1.05;
  stroke-dasharray: 3 3;
}

.map-border-focus {
  fill: none;
  stroke: #3f522d;
  stroke-width: 2.1;
  stroke-dasharray: 5 3;
}

.map-sea-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.24em;
  fill: rgba(28, 66, 94, 0.72);
}

.map-region-label {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.2em;
  fill: rgba(70, 66, 58, 0.74);
  paint-order: stroke;
  stroke: rgba(242, 239, 232, 0.6);
  stroke-width: 2.6px;
}

.map-town-dot {
  fill: #ffffff;
  stroke: #5c6661;
  stroke-width: 1.3;
  opacity: 0.88;
}

.map-town-label {
  font-size: 10.5px;
  font-weight: 700;
  fill: #3f4743;
  paint-order: stroke;
  stroke: rgba(246, 244, 238, 0.86);
  stroke-width: 2.8px;
}

/* Cestovna trasa sa animacijom toka */
.map-route-shadow {
  fill: none;
  stroke: rgba(14, 22, 25, 0.34);
  stroke-width: 11.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.map-route-casing {
  fill: none;
  stroke: #ffffff;
  stroke-width: 8.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.map-route-upcoming {
  fill: none;
  stroke: #3f4d54;
  stroke-width: 3;
  stroke-dasharray: 6 6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@keyframes pk-road-flow {
  from { stroke-dashoffset: 24; }
  to { stroke-dashoffset: 0; }
}

@media (prefers-reduced-motion: no-preference) {
  body:not(.reduced-motion) .map-route-upcoming {
    animation: pk-road-flow 1.4s linear infinite;
  }
}

.map-route-passed-glow {
  fill: none;
  stroke: rgba(246, 194, 0, 0.55);
  stroke-width: 11.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.map-route-passed {
  fill: none;
  stroke: #ea580c;
  stroke-width: 6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Stanice / gradovi rute */
.map-stop-next-halo {
  fill: rgba(11, 114, 64, 0.22);
  stroke: #0b7240;
  stroke-width: 2;
  opacity: 0;
}

.map-stop.is-next .map-stop-next-halo {
  opacity: 1;
}

@keyframes pk-pulse-halo {
  0%, 100% { r: 11px; opacity: 0.88; }
  50% { r: 18px; opacity: 0.25; }
}

@keyframes pk-radar-pulse {
  0% { r: 16px; opacity: 0.72; }
  100% { r: 30px; opacity: 0; }
}

@media (prefers-reduced-motion: no-preference) {
  body:not(.reduced-motion) .map-stop.is-next .map-stop-next-halo {
    animation: pk-pulse-halo 1.8s ease-in-out infinite;
  }
  body:not(.reduced-motion) .map-vehicle-radar {
    animation: pk-radar-pulse 1.7s ease-out infinite;
  }
}

.map-vehicle-radar {
  fill: none;
  stroke: #f6c200;
  stroke-width: 2.5;
  opacity: 0;
  pointer-events: none;
}

.map-stop-dot {
  fill: #ffffff;
  stroke: #182327;
  stroke-width: 2.8;
}

.map-stop.is-reached .map-stop-dot {
  fill: #ea580c;
  stroke: #ffffff;
  stroke-width: 2.8;
}

.map-stop.is-start .map-stop-dot {
  fill: #0b7240;
  stroke: #ffffff;
  stroke-width: 3;
}

.map-stop.is-end .map-stop-dot {
  fill: #111618;
  stroke: #f6c200;
  stroke-width: 3.4;
}

.map-finish-flag {
  font-size: 15px;
  pointer-events: none;
}

.map-stop-label {
  font-size: 13.5px;
  font-weight: 850;
  fill: #10191d;
  paint-order: stroke;
  stroke: rgba(255, 255, 255, 0.96);
  stroke-width: 4.2px;
  stroke-linejoin: round;
}

.map-vehicle-pin {
  cursor: pointer;
}

.map-vehicle-gain-pop {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 900;
  fill: #111618;
  paint-order: stroke;
  stroke: #ffe047;
  stroke-width: 4.5px;
  stroke-linejoin: round;
  pointer-events: none;
}

.map-vehicle-initial {
  font-size: 12px;
  font-weight: 900;
  fill: #ffffff;
  pointer-events: none;
}

.map-vehicle-tag {
  font-size: 12.5px;
  font-weight: 800;
  fill: #141e22;
  paint-order: stroke;
  stroke: #ffffff;
  stroke-width: 3.6px;
}

/* HUD slojevi na mapi */
.map-hud-loc {
  position: absolute;
  inset-block-start: 0.7rem;
  inset-inline-start: 0.7rem;
  z-index: 3;
  display: flex;
  flex-direction: column;
  padding: 0.45rem 0.78rem;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.95);
  color: #121e22;
  border: 1.5px solid rgba(20, 32, 36, 0.18);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
  max-inline-size: 46%;
  pointer-events: none;
}

.map-hud-loc-title {
  font-size: 0.92rem;
  font-weight: 900;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.map-hud-loc-sub {
  font-size: 0.75rem;
  color: #42555b;
  font-weight: 700;
}

/* Zelena autoputska putokazna tabla u gornjem desnom uglu */
.map-hud-signboard {
  position: absolute;
  inset-block-start: 0.7rem;
  inset-inline-end: 0.7rem;
  z-index: 3;
  background: linear-gradient(180deg, #0d7a43 0%, #085c32 100%);
  color: #ffffff;
  border-radius: 9px;
  padding: 0.5rem 0.72rem;
  border: 1.5px solid #053e21;
  box-shadow:
    inset 0 0 0 2px #0a6a3b,
    inset 0 0 0 3.5px rgba(255, 255, 255, 0.94),
    0 6px 20px rgba(0, 0, 0, 0.28);
  min-inline-size: 156px;
  max-inline-size: 50%;
  pointer-events: none;
}

.map-signboard-rows {
  display: flex;
  flex-direction: column;
  gap: 0.16rem;
}

.map-signboard-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.28;
}

.map-signboard-row strong {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 900;
  color: #ffe047;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* Donji centralni toast za dobitak runde */
.map-hud-toast {
  position: absolute;
  inset-block-end: 2.2rem;
  inset-inline-start: 50%;
  translate: -50% 0;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.42rem 0.88rem;
  border-radius: 999px;
  background: rgba(15, 22, 25, 0.94);
  color: #eef4f2;
  border: 2px solid rgba(246, 194, 0, 0.55);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.42);
  max-inline-size: calc(100% - 1.5rem);
  pointer-events: none;
}

.map-hud-toast.is-miss {
  border-color: rgba(248, 113, 113, 0.55);
}

.map-hud-toast-label {
  font-size: 0.85rem;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.map-hud-toast-km {
  font-family: var(--font-mono);
  font-size: 0.96rem;
  font-weight: 900;
  color: var(--sign-yellow);
  white-space: nowrap;
}

.map-hud-toast.is-miss .map-hud-toast-km {
  color: #fca5a5;
}

/* Lijeve kontrole zuma (+ / − / ⟲) */
.map-hud-zoom {
  position: absolute;
  inset-block-end: 1.65rem;
  inset-inline-start: 0.65rem;
  z-index: 4;
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  padding: 2px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(20, 32, 36, 0.22);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22);
}

.map-zoom-btn {
  min-block-size: 30px;
  min-inline-size: 30px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #142024;
  font: inherit;
  font-size: 1rem;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
}

.map-zoom-btn:hover {
  background: rgba(20, 32, 36, 0.1);
}

/* Prekidač kamere i veličine karte */
.map-hud-cam {
  position: absolute;
  inset-block-end: 1.65rem;
  inset-inline-end: 0.65rem;
  z-index: 4;
  display: inline-flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 3px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(20, 32, 36, 0.22);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22);
}

.map-cam-btn {
  min-block-size: 30px;
  min-inline-size: 0;
  padding: 0.22rem 0.6rem;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #1a282d;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 800;
  cursor: pointer;
}

.map-cam-btn:hover {
  background: rgba(20, 30, 34, 0.09);
}

.map-cam-btn.is-active {
  background: #141e22;
  color: #ffffff;
}

.map-expand-btn.is-active {
  background: #0b7240;
  color: #ffffff;
}

@media (max-width: 560px) {
  .map-hud-loc {
    padding: 0.32rem 0.55rem;
  }
  .map-hud-loc-title {
    font-size: 0.8rem;
  }
  .map-hud-loc-sub {
    font-size: 0.68rem;
  }
  .map-hud-signboard {
    padding: 0.34rem 0.52rem;
    min-inline-size: 122px;
  }
  .map-signboard-row,
  .map-signboard-row strong {
    font-size: 0.69rem;
    gap: 0.45rem;
  }
  .map-hud-toast {
    inset-block-end: 3.9rem;
    max-inline-size: calc(100% - 3.6rem);
    padding: 0.28rem 0.62rem;
  }
  .map-hud-zoom {
    flex-direction: column;
    inset-block-end: 3.9rem;
    inset-inline-start: 0.42rem;
  }
  .map-zoom-btn {
    min-block-size: 28px;
    min-inline-size: 28px;
    font-size: 0.9rem;
  }
  .map-hud-cam {
    inset-block-end: 1.55rem;
    inset-inline-end: 0.42rem;
    max-inline-size: calc(100% - 0.84rem);
  }
  .map-cam-btn {
    font-size: 0.67rem;
    min-block-size: 27px;
    padding: 0.15rem 0.42rem;
  }
}

.map-cluster-popover {
  position: absolute;
  inset-block-start: 3.8rem;
  inset-inline-start: 0.7rem;
  z-index: 5;
  background: rgba(16, 24, 27, 0.95);
  color: #ffffff;
  padding: 0.42rem 0.72rem;
  border-radius: 9px;
  font-size: 0.8rem;
  font-weight: 700;
  max-inline-size: calc(100% - 1.4rem);
}

.map-attribution {
  position: absolute;
  inset-block-end: 0;
  inset-inline: 0;
  z-index: 3;
  background: rgba(255, 255, 255, 0.84);
  color: #24343a;
  font-size: 0.63rem;
  padding: 0.14rem 0.5rem;
  line-height: 1.2;
  pointer-events: none;
}

/* ==================== ROUTE MILESTONE RIBBON ==================== */
.route-progress-ribbon {
  margin-block-start: 0.5rem;
  padding: 0.48rem 0.65rem;
  background: rgba(21, 31, 34, 0.92);
  border: 1px solid var(--border);
  border-radius: 11px;
}

.route-ribbon-bar-track {
  inline-size: 100%;
  block-size: 6px;
  border-radius: 999px;
  background: #0d1417;
  overflow: hidden;
  margin-block-end: 0.42rem;
}

.route-ribbon-bar-fill {
  block-size: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #10b981 0%, #ea580c 60%, #f6c200 100%);
  transition: width 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.route-ribbon-stops {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.3rem 0.45rem;
}

.milestone-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.24rem;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--muted);
  padding: 0.14rem 0.42rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid transparent;
}

.milestone-chip.is-reached {
  color: #bbf7d0;
  background: rgba(16, 185, 129, 0.14);
  border-color: rgba(16, 185, 129, 0.34);
}

.milestone-chip.is-next {
  color: var(--sign-yellow);
  background: rgba(246, 194, 0, 0.14);
  border-color: rgba(246, 194, 0, 0.45);
}

.milestone-km {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  opacity: 0.8;
}

/* ==================== GAMEPLAY LAYOUT (LARGE ARENA + MOBILE KEYBOARD SAFE) ==================== */
.game-layout {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  max-inline-size: 1400px;
  margin-inline: auto;
  inline-size: 100%;
}

.game-hud {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.42rem;
}

.hud-odometer {
  font-family: var(--font-mono);
  font-size: 0.86rem;
}

.hud-right-actions {
  margin-inline-start: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.hud-mobile-only,
.hud-inline-sound {
  display: none;
}

.hud-abandon-btn {
  margin-inline-start: auto;
}

.game-grid {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Mobilni (< 900px): tokom aktivnog pitanja — istaknuto pitanje na vrhu iznad tastature, krupna karta odmah ispod;
   na otkrivanju rezultata ili kad korisnik klikne "Veća karta" — karta ide u prvi plan! */
@media (max-width: 899px) {
  /* Fokusirani režim igre: sakrij glavno zaglavlje/navigaciju i podnožje da karta + rezultat stanu na 1 ekran bez skrolovanja */
  body.in-game-active .topbar,
  body.in-game-active .app-footer {
    display: none;
  }
  body.in-game-active .app-main {
    padding-block-start: max(0.35rem, env(safe-area-inset-top, 0px));
    padding-block-end: max(0.5rem, env(safe-area-inset-bottom, 0px));
    padding-inline: max(0.48rem, env(safe-area-inset-left, 0px)) max(0.48rem, env(safe-area-inset-right, 0px));
  }
  body.in-game-active .game-layout {
    gap: 0.35rem;
  }
  body.in-game-active .game-grid {
    gap: 0.42rem;
  }
  body.in-game-active .game-hud {
    flex-wrap: nowrap;
    gap: 0.32rem;
    min-block-size: 40px;
  }
  body.in-game-active .hud-desktop-only,
  body.in-game-active .hud-round-badge {
    display: none;
  }
  body.in-game-active .hud-mobile-only {
    display: inline;
  }
  body.in-game-active .hud-inline-sound {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    min-inline-size: 40px;
    min-block-size: 40px;
    padding: 0;
  }
  body.in-game-active .hud-abandon-btn {
    min-inline-size: 40px;
    min-block-size: 40px;
    padding: 0 0.55rem;
    font-size: 1rem;
    font-weight: 800;
  }
  body.in-game-active .game-hud .badge {
    padding: 0.24rem 0.55rem;
    font-size: 0.76rem;
    white-space: nowrap;
  }
  /* Tokom aktivne igre na mobitelu traka stanica je tanka linija (svi gradovi i km su već na karti!) */
  body.in-game-active .route-progress-ribbon {
    margin-block-start: 0.28rem;
    padding: 0;
    background: transparent;
    border: none;
  }
  body.in-game-active .route-ribbon-stops {
    display: none;
  }
  body.in-game-active .map-attribution {
    font-size: 0.6rem;
    padding: 0.14rem 0.45rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .is-question-active {
    gap: 0.38rem;
  }
  .is-question-active .game-grid {
    gap: 0.45rem;
  }
  .is-question-active .game-stage-col {
    order: 1;
  }
  .is-question-active .game-map-col {
    order: 2;
  }
  .is-question-active .game-map-panel {
    aspect-ratio: auto;
    block-size: clamp(220px, 34dvh, 320px);
  }
  .is-result-focus .game-map-col {
    order: 1;
  }
  .is-result-focus .game-stage-col {
    order: 2;
  }
  .is-result-focus .game-map-panel {
    aspect-ratio: auto;
    block-size: clamp(245px, 39dvh, 355px);
  }
  .is-map-expanded .game-map-col {
    order: 1 !important;
  }
  .is-map-expanded .game-stage-col {
    order: 2 !important;
  }
  .is-map-expanded .game-map-panel {
    block-size: clamp(390px, 64dvh, 580px) !important;
  }
}

@media (max-width: 899px) and (pointer: coarse) {
  body.in-game-active .hud-inline-sound,
  body.in-game-active .hud-abandon-btn {
    min-inline-size: 44px;
    min-block-size: 44px;
  }
}

@media (max-width: 640px) {
  body.in-game-active .result-card {
    padding: 0.65rem 0.78rem;
  }
  body.in-game-active .result-card .question-meta {
    margin-block-end: 0.36rem;
    gap: 0.4rem;
  }
  body.in-game-active .result-card .topic-chip {
    font-size: 0.72rem;
    letter-spacing: 0.01em;
    padding: 0.16rem 0.5rem;
    line-height: 1.25;
  }
  body.in-game-active .result-banner-box {
    flex-wrap: nowrap;
    padding: 0.52rem 0.68rem;
    gap: 0.55rem;
    margin-block-end: 0.4rem;
  }
  body.in-game-active .result-vehicle-pop {
    inline-size: 42px;
    block-size: 42px;
    flex-shrink: 0;
  }
  body.in-game-active .result-canonical-name {
    font-size: 0.96rem;
  }
  body.in-game-active .km-gain {
    font-size: 1.28rem;
    white-space: nowrap;
    flex-shrink: 0;
  }
  body.in-game-active .reveal-rarity-strip {
    display: none;
  }
  body.in-game-active .progress-msg {
    font-size: 0.88rem;
    line-height: 1.32;
    margin-block: 0.22rem 0.48rem;
  }
  body.in-game-active .result-actions {
    margin-block-start: 0.35rem;
    gap: 0.45rem;
  }
  body.in-game-active .result-actions #btn-next-question {
    flex: 1 1 auto;
    min-block-size: 46px;
  }
}

/* Desktop (>= 900px): široka kino-pozornica karte gore + istaknuta konzola pitanja odmah u fokusu */
@media (min-width: 900px) {
  .game-map-col {
    order: 1;
    inline-size: 100%;
  }
  .game-map-panel {
    aspect-ratio: auto;
    block-size: clamp(320px, 52dvh, 630px);
  }
  .is-result-focus .game-map-panel {
    block-size: clamp(360px, 60dvh, 710px);
  }
  .is-map-expanded .game-map-panel {
    block-size: clamp(460px, 78dvh, 860px);
  }
  .game-stage-col {
    order: 2;
    inline-size: 100%;
    max-inline-size: 940px;
    margin-inline: auto;
  }
}

/* ==================== SPOTLIGHT ACTIVE QUESTION STAGE ==================== */
.question-card {
  padding: 0.95rem 1.15rem;
}

.question-spotlight-card {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 0%, rgba(246, 194, 0, 0.16), transparent 62%),
    linear-gradient(180deg, #213238 0%, #172327 100%);
  border: 2px solid rgba(246, 194, 0, 0.65);
  box-shadow:
    0 18px 46px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(255, 255, 255, 0.06) inset,
    0 0 32px rgba(246, 194, 0, 0.12);
}

.question-spotlight-card::before {
  content: "";
  position: absolute;
  inset-block-start: 0;
  inset-inline: 0;
  block-size: 5px;
  background: linear-gradient(90deg, var(--highway-border) 0%, var(--sign-yellow) 50%, var(--accent) 100%);
}

.question-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
  margin-block-end: 0.45rem;
}

.question-badges-left {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.question-num-plate {
  display: inline-flex;
  align-items: center;
  padding: 0.24rem 0.65rem;
  border-radius: 6px;
  background: var(--sign-yellow);
  color: var(--sign-ink);
  border: 1.5px solid #111618;
  box-shadow: inset 0 0 0 1.5px var(--sign-yellow), inset 0 0 0 2.8px #111618;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.question-meta-right {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.topic-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  padding: 0.22rem 0.6rem;
  border-radius: 999px;
  background: rgba(11, 114, 64, 0.28);
  border: 1px solid rgba(56, 193, 114, 0.45);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #d1fae5;
}

.round-counter-mono {
  font-family: var(--font-mono);
  font-size: 0.84rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Kružni mjerač vremena + digitalni bedž */
.timer-gauge {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
}

.timer-gauge-svg {
  inline-size: 38px;
  block-size: 38px;
  rotate: -90deg;
  flex-shrink: 0;
}

.timer-gauge-track {
  fill: none;
  stroke: rgba(255, 255, 255, 0.12);
  stroke-width: 4;
}

.timer-gauge-ring {
  fill: none;
  stroke: var(--sign-yellow);
  stroke-width: 4.2;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.2s linear, stroke 0.2s ease;
}

.timer-gauge.is-urgent .timer-gauge-ring {
  stroke: #ef4444;
}

.timer-pill {
  padding: 0.24rem 0.7rem;
  border-radius: 999px;
  background: var(--surface-alt);
  color: var(--sign-yellow);
  border: 1.5px solid rgba(246, 194, 0, 0.45);
  font-family: var(--font-mono);
  font-size: 0.94rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  min-inline-size: 3.6rem;
  white-space: nowrap;
  text-align: center;
}

.timer-pill.is-urgent {
  background: var(--danger-bg);
  color: #fecaca;
  border-color: var(--danger-border);
}

@keyframes pk-urgent-pulse {
  0%, 100% { scale: 1; }
  50% { scale: 1.07; }
}

@media (prefers-reduced-motion: no-preference) {
  body:not(.reduced-motion) .timer-pill.is-urgent {
    animation: pk-urgent-pulse 0.65s ease-in-out infinite;
  }
}

.timer-bar-track {
  inline-size: 100%;
  block-size: 8px;
  border-radius: 999px;
  background: #0d1417;
  overflow: hidden;
  margin-block-end: 0.7rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.timer-bar-fill {
  block-size: 100%;
  inline-size: 100%;
  background: linear-gradient(90deg, #10b981 0%, #f6c200 100%);
  transition: width 0.2s linear;
}

.timer-bar-fill.is-urgent {
  background: linear-gradient(90deg, #dc2626 0%, #f97316 100%);
}

/* Istaknuta pozornica samog teksta pitanja */
.question-prompt-stage {
  padding: 0.78rem 0.95rem;
  margin-block-end: 0.55rem;
  border-radius: 12px;
  background: rgba(11, 18, 20, 0.68);
  border: 1px solid rgba(246, 194, 0, 0.28);
  box-shadow: inset 0 2px 12px rgba(0, 0, 0, 0.32);
}

.question-prompt {
  margin: 0;
  font-size: clamp(1.26rem, 1.05rem + 1.05vw, 1.88rem);
  font-weight: 850;
  line-height: 1.24;
  color: #ffffff;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
}

.acceptance-rule-bar {
  margin-block: 0 0.7rem;
  padding: 0.34rem 0.72rem;
  border-radius: 8px;
  background: rgba(246, 194, 0, 0.1);
  border-inline-start: 4px solid var(--sign-yellow);
  font-size: 0.86rem;
  font-weight: 600;
  color: #e2ece9;
}

@media (max-width: 640px) {
  .question-card {
    padding: 0.72rem 0.82rem;
  }
  .question-prompt-stage {
    padding: 0.58rem 0.72rem;
    margin-block-end: 0.42rem;
  }
  .question-prompt {
    font-size: clamp(1.14rem, 1rem + 0.9vw, 1.42rem);
  }
  .acceptance-rule-bar {
    font-size: 0.8rem;
    padding: 0.26rem 0.58rem;
    margin-block-end: 0.5rem;
  }
  .timer-gauge-svg {
    inline-size: 32px;
    block-size: 32px;
  }
}

.answer-form {
  margin-block-start: 0.45rem;
}

.answer-inline-bar {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.answer-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.5rem;
}

.answer-actions .btn-highway {
  flex: 1.7 1 0;
  white-space: nowrap;
}

.answer-actions .btn-outline {
  flex: 1 1 0;
  white-space: nowrap;
}

@media (min-width: 680px) {
  .answer-inline-bar {
    flex-direction: row;
    align-items: center;
  }
  .answer-inline-bar > input {
    flex: 1 1 auto;
  }
  .answer-actions {
    flex: 0 0 auto;
  }
  .answer-actions .btn-highway,
  .answer-actions .btn-outline {
    flex: 0 0 auto;
    min-block-size: 52px;
    padding-inline: 1.25rem;
  }
}

/* ==================== ROUND REVEAL & RARITY TIER SHOWCASE ==================== */
.result-card.is-accepted {
  border: 2px solid var(--success-border);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.48), 0 0 28px rgba(55, 178, 108, 0.16);
}

.result-card.is-missed {
  border: 2px solid var(--danger-border);
}

@keyframes pk-miss-shake {
  0%, 100% { translate: 0 0; }
  20% { translate: -5px 0; }
  40% { translate: 5px 0; }
  60% { translate: -3px 0; }
  80% { translate: 3px 0; }
}

@keyframes pk-badge-pop {
  0% { scale: 0.6; opacity: 0; }
  70% { scale: 1.12; opacity: 1; }
  100% { scale: 1; opacity: 1; }
}

@media (prefers-reduced-motion: no-preference) {
  body:not(.reduced-motion) .result-card.is-missed {
    animation: pk-miss-shake 0.36s ease-out;
  }
  body:not(.reduced-motion) .result-vehicle-pop {
    animation: pk-badge-pop 0.42s cubic-bezier(0.22, 1, 0.36, 1);
  }
}

.result-banner-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.78rem 0.95rem;
  border-radius: 12px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  margin-block-end: 0.65rem;
}

.result-banner-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-inline-size: 0;
}

.result-banner-copy {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-inline-size: 0;
}

.result-answer-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
}

.result-canonical-name {
  font-size: 1.08rem;
}

.km-gain {
  font-family: var(--font-mono);
  font-size: clamp(1.45rem, 1.2rem + 0.9vw, 1.9rem);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.km-gain.is-positive {
  color: var(--sign-yellow);
  text-shadow: 0 2px 14px rgba(246, 194, 0, 0.35);
}

.km-gain.is-zero {
  color: #fca5a5;
}

/* 6-stepena traka osvojenog vozila na otkrivanju runde */
.reveal-rarity-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.36rem;
  margin-block-end: 0.6rem;
}

.reveal-tier-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.22rem 0.52rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--muted);
  opacity: 0.62;
}

.reveal-tier-pill.is-unlocked {
  opacity: 1;
  background: rgba(246, 194, 0, 0.18);
  border-color: var(--sign-yellow);
  color: #ffffff;
  font-weight: 900;
  box-shadow: 0 4px 14px rgba(246, 194, 0, 0.22);
}

.progress-msg {
  font-weight: 700;
  font-size: 0.98rem;
  margin-block: 0.35rem 0.55rem;
  color: var(--ink);
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  margin-block-start: 0.6rem;
}

.finish-score-big {
  font-family: var(--font-mono);
  font-size: clamp(1.4rem, 1.15rem + 0.9vw, 1.95rem);
  font-weight: 900;
  color: var(--sign-yellow);
  margin-block-end: 0.45rem;
}

.share-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
  margin-block: 0.75rem;
}

.share-preview {
  margin: 0;
  padding: 0.65rem 0.85rem;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: var(--font-mono);
  font-size: 0.86rem;
  font-weight: 700;
  white-space: pre-wrap;
  color: var(--ink);
}

.copy-tip {
  font-size: 0.86rem;
  font-weight: 800;
  color: var(--sign-yellow);
}

.round-summary-list,
.lobby-players-list,
.mp-reveal-list,
.submitted-chips,
.simple-list {
  list-style: none;
  margin: 0.5rem 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.round-sum-item,
.lobby-player,
.mp-reveal-row {
  padding: 0.58rem 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
}

.round-sum-item.is-ok,
.mp-reveal-row.is-ok {
  border-inline-start: 4px solid var(--success-border);
}

.round-sum-item.is-miss,
.mp-reveal-row.is-miss {
  border-inline-start: 4px solid var(--danger-border);
}

.round-sum-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.65rem;
}

.round-sum-km {
  font-family: var(--font-mono);
  color: var(--sign-yellow);
  white-space: nowrap;
}

.lobby-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  margin-block-end: 0.35rem;
}

.lobby-player,
.mp-reveal-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.lobby-player > .badge,
.mp-reveal-row > strong:last-child {
  margin-inline-start: auto;
}

.submitted-chips {
  flex-direction: row;
  flex-wrap: wrap;
  margin-block-start: 0.65rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.26rem 0.62rem;
  border-radius: 999px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  font-size: 0.8rem;
  font-weight: 700;
}

.chip.is-done {
  background: var(--success-bg);
  color: #bbf7d0;
  border-color: var(--success-border);
}

.submitted-wait-box {
  padding: 0.7rem 0.85rem;
  border-radius: 10px;
  background: var(--bg-subtle);
  border: 1px solid var(--success-border);
}

.submitted-wait-box p {
  margin: 0;
  font-weight: 700;
}

.countdown-hero {
  font-size: 1.4rem;
  font-weight: 850;
  color: var(--sign-yellow);
  padding-block: 0.6rem;
}

.color-dot {
  display: inline-block;
  inline-size: 12px;
  block-size: 12px;
  border-radius: 50%;
  border: 1.5px solid #ffffff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
}

/* ==================== TABLES ==================== */
.table-wrapper {
  overflow: auto;
  max-inline-size: 100%;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--bg-subtle);
}

.data-table {
  inline-size: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.data-table caption {
  text-align: start;
  font-weight: 800;
  padding: 0.55rem 0.7rem;
  color: var(--ink);
}

.data-table th,
.data-table td {
  text-align: start;
  padding: 0.55rem 0.75rem;
  border-block-end: 1px solid var(--border);
}

.data-table thead th {
  background: var(--surface-alt);
  color: var(--ink);
  font-weight: 800;
}

.is-me-row {
  background: rgba(246, 194, 0, 0.14);
  font-weight: 800;
}

/* ==================== DIALOGS ==================== */
dialog {
  background: var(--surface);
  color: var(--ink);
  border: 1.5px solid var(--border-control);
  border-radius: var(--radius);
  padding: 0;
  max-inline-size: min(460px, calc(100dvw - 1.5rem));
  inline-size: 100%;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.65);
  opacity: 1;
  scale: 1;
  transition:
    opacity 0.2s ease-out,
    scale 0.2s ease-out,
    display 0.2s,
    overlay 0.2s;
  transition-behavior: allow-discrete;
}

@starting-style {
  dialog[open] {
    opacity: 0;
    scale: 0.96;
  }
}

@media (prefers-reduced-motion: reduce) {
  dialog {
    scale: none;
    transition-duration: 0.08s;
  }
  @starting-style {
    dialog[open] {
      scale: none;
    }
  }
}

dialog:modal {
  overscroll-behavior: contain;
}

dialog::backdrop {
  background: rgba(7, 12, 14, 0.76);
  backdrop-filter: blur(4px);
  overflow: hidden;
  overscroll-behavior: contain;
}

.dialog-shell {
  padding: 1.15rem;
}

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-block-end: 0.75rem;
}

.dialog-tabs,
.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-block-end: 0.85rem;
}

.tab-btn {
  background: var(--bg-subtle);
  border: 1.5px solid var(--border-control);
  color: var(--ink);
  border-radius: 8px;
  padding: 0.4rem 0.75rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.tab-btn.active {
  background: var(--sign-yellow);
  color: var(--sign-ink);
  border-color: var(--sign-yellow);
}

.auth-note {
  margin-block: 0.8rem 0;
  font-size: 0.82rem;
  color: var(--muted);
}

/* ==================== ADMIN & UTILITY LAYOUTS ==================== */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-block: 0.5rem;
}

:where(.toolbar > :not(button, input, select, textarea, a, [role="button"], label)) {
  min-inline-size: 0;
}

.inline-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-block-start: 0.3rem;
}

.stack-layout {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.stat-grid {
  list-style: none;
  padding: 0;
  margin: 0 0 0.85rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.65rem;
}

.stat-card {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.75rem 0.9rem;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.stat-card strong {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  line-height: 1.1;
  color: var(--sign-yellow);
}

.stat-card span {
  font-size: 0.84rem;
  color: var(--muted);
  font-weight: 700;
}

.admin-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.85rem;
}

@media (min-width: 960px) {
  .admin-split {
    grid-template-columns: minmax(320px, 0.9fr) minmax(0, 1.3fr);
    align-items: start;
  }
}

.admin-details {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.55rem 0.75rem;
  margin-block: 0.55rem;
  background: var(--bg-subtle);
}

.admin-details summary {
  cursor: pointer;
  font-weight: 700;
}

.form-grid {
  display: grid;
  gap: 0.55rem;
  margin-block-start: 0.55rem;
}

.code-preview {
  background: #0e1416;
  color: #e6f2f5;
  border: 1px solid var(--border);
  padding: 0.75rem;
  border-radius: 8px;
  max-block-size: 280px;
  overflow: auto;
  font-size: 0.82rem;
}

.admin-shell a:not(.btn) {
  color: #7dd3fc;
}

.reduced-motion .timer-bar-fill,
.reduced-motion .timer-gauge-ring,
.reduced-motion .route-ribbon-bar-fill {
  transition: none;
}

@media (prefers-reduced-motion: reduce) {
  .timer-bar-fill,
  .timer-gauge-ring,
  .route-ribbon-bar-fill {
    transition: none;
  }
}

@supports not (scrollbar-color: auto) {
  ::-webkit-scrollbar {
    width: 12px;
    height: 12px;
  }
  ::-webkit-scrollbar-thumb {
    background: #6b8186;
  }
  ::-webkit-scrollbar-track {
    background: #172023;
  }
}

@media (forced-colors: active) {
  .btn, .card, .edition-card, .brand-plate, .hero-sign-plate, .map-hud-signboard, input, select, textarea, dialog {
    border: 2px solid ButtonText;
  }
  .edition-card.is-selected, .nav-btn.is-active, .tab-btn.active {
    outline: 3px solid Highlight;
  }
}
