:root {
  color-scheme: dark;
  --app-height: 100svh;
  --bg: #070b14;
  --panel: rgba(12, 18, 32, 0.72);
  --panel-strong: rgba(17, 25, 40, 0.86);
  --border: rgba(255, 255, 255, 0.12);
  --text: #f3f5fb;
  --muted: #88a0bd;
  --accent: #5ea8ff;
  --accent-strong: #64f0c4;
  --danger: #ff6b6b;
  --success: #33d17a;
  --warning: #ffcb5c;
  --shadow: 0 25px 60px rgba(0, 0, 0, 0.35);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background:
    radial-gradient(circle at top left, rgba(94, 168, 255, 0.26), transparent 38%),
    radial-gradient(circle at bottom right, rgba(100, 240, 196, 0.16), transparent 32%),
    var(--bg);
  color: var(--text);
}

body {
  min-height: var(--app-height);
}

#root,
.app-shell {
  min-height: 0;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.app-shell {
  min-height: var(--app-height);
  height: auto;
  padding: 24px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 20px;
  overflow: visible;
}

.glass-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: var(--shadow);
}

.topbar {
  padding: 24px 28px;
  border-radius: var(--radius-lg);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.eyebrow {
  margin: 0 0 6px;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.24em;
  color: var(--accent-strong);
}

h1 {
  margin: 0;
  font-size: clamp(1.35rem, 2.3vw, 2rem);
}

.subtitle {
  margin: 8px 0 0;
  color: var(--muted);
  max-width: 680px;
}

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

.primary-btn,
.secondary-btn,
.icon-btn {
  padding: 10px 14px;
  border-radius: 999px;
  color: var(--text);
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.primary-btn {
  background: linear-gradient(135deg, var(--accent), #2b7ede);
  box-shadow: 0 14px 28px rgba(94, 168, 255, 0.28);
}

.secondary-btn {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.icon-btn {
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 1.1rem;
}

.primary-btn:hover,
.secondary-btn:hover,
.icon-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.2);
}

.main-layout {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 20px;
  overflow: hidden;
}

.sidebar,
.map-card {
  border-radius: var(--radius-lg);
  padding: 20px;
  min-height: 0;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow: auto;
  min-height: 0;
}

.section-title {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--muted);
  margin-bottom: 10px;
}

.mode-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.mode-btn {
  padding: 12px 10px;
  border-radius: 14px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid transparent;
  transition: all 180ms ease;
}

.mode-btn.active {
  background: linear-gradient(135deg, rgba(94, 168, 255, 0.2), rgba(100, 240, 196, 0.16));
  border-color: rgba(100, 240, 196, 0.24);
  box-shadow: inset 0 0 0 1px rgba(100, 240, 196, 0.2);
}

.search-card {
  padding: 16px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  position: relative;
}

.helper-text {
  margin: 0 0 12px;
  color: var(--muted);
  line-height: 1.45;
  font-size: 0.95rem;
}

.question-label {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 12px;
  min-height: 28px;
}

.input-label {
  display: block;
  font-size: 0.92rem;
  color: var(--muted);
  margin-bottom: 8px;
}

.input-row {
  display: flex;
  gap: 10px;
}

.text-input {
  flex: 1;
  background: rgba(6, 10, 18, 0.7);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  padding: 12px 14px;
  outline: none;
}

.text-input:focus {
  border-color: rgba(94, 168, 255, 0.85);
  box-shadow: 0 0 0 2px rgba(94, 168, 255, 0.16);
}

.suggestions {
  position: absolute;
  z-index: 20;
  left: 16px;
  right: 16px;
  top: calc(100% + 8px);
  display: none;
  background: rgba(8, 12, 20, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.suggestions.open {
  display: block;
}

.suggestion-item {
  width: 100%;
  text-align: left;
  color: var(--text);
  padding: 12px 14px;
  background: transparent;
  transition: background 180ms ease;
}

.suggestion-item:hover,
.suggestion-item.active {
  background: rgba(94, 168, 255, 0.16);
}

.stats-grid,
.meta-grid {
  display: grid;
  gap: 10px;
}

.stats-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.stat-card,
.meta-card {
  padding: 14px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stat-label,
.meta-card span {
  font-size: 0.8rem;
  color: var(--muted);
}

.stat-card strong,
.meta-card strong {
  font-size: 1.1rem;
}

.editor-panel {
  border-radius: var(--radius-md);
  padding: 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.editor-panel.hidden,
.modal.hidden {
  display: none;
}

.editor-grid {
  display: grid;
  gap: 8px;
}

.editor-grid .text-input {
  border-radius: 12px;
}

.editor-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.map-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  overflow: hidden;
  height: auto;
  min-height: 720px;
}

.map-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.zoom-group {
  display: flex;
  gap: 8px;
}

.map-hint {
  color: var(--muted);
  font-size: 0.9rem;
}

.map-shell {
  flex: 1;
  min-height: 0;
  min-height: clamp(760px, 84vh, 1280px);
  max-height: none;
  border-radius: calc(var(--radius-lg) - 4px);
  overflow: hidden;
  background: linear-gradient(180deg, rgba(16, 24, 39, 0.95), rgba(8, 12, 20, 0.95));
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.map-viewport {
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  position: relative;
  touch-action: none;
  user-select: none;
}

.map-surface {
  width: 100%;
  height: 100%;
  min-height: 0;
  position: relative;
  will-change: transform;
}

.map-surface img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  pointer-events: none;
}

.stations-layer {
  position: absolute;
  inset: 0;
}

.station-marker {
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.92);
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.12);
  transform: translate(-50%, -50%);
  transition: transform 160ms ease, box-shadow 160ms ease, background 180ms ease;
  z-index: 4;
}

.station-marker:hover {
  transform: translate(-50%, -50%) scale(1.16);
}

.station-marker.active,
.station-marker.selected {
  transform: translate(-50%, -50%) scale(1.22);
  box-shadow: 0 0 0 8px rgba(94, 168, 255, 0.28);
  background: var(--accent);
}

.station-marker.correct {
  background: var(--success);
  animation: pulseGreen 700ms ease;
}

.station-marker.wrong {
  background: var(--danger);
  animation: shake 500ms ease;
}

.station-marker.editor-target {
  box-shadow: 0 0 0 10px rgba(255, 203, 92, 0.18);
}

@keyframes pulseGreen {
  0% { transform: translate(-50%, -50%) scale(0.8); }
  60% { transform: translate(-50%, -50%) scale(1.32); }
  100% { transform: translate(-50%, -50%) scale(1); }
}

@keyframes shake {
  0%, 100% { transform: translate(-50%, -50%) rotate(0deg); }
  25% { transform: translate(-50%, -50%) rotate(-8deg); }
  75% { transform: translate(-50%, -50%) rotate(8deg); }
}

.toast-root {
  position: fixed;
  right: 20px;
  bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 60;
}

.toast {
  padding: 12px 14px;
  background: rgba(11, 16, 26, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  color: var(--text);
  animation: fadeIn 220ms ease;
}

.toast.success { border-color: rgba(51, 209, 122, 0.28); }
.toast.error { border-color: rgba(255, 107, 107, 0.3); }

.modal {
  position: fixed;
  inset: 0;
  background: rgba(3, 6, 12, 0.82);
  display: grid;
  place-items: center;
  z-index: 80;
  padding: 20px;
}

.modal-card {
  width: min(560px, 100%);
  padding: 26px;
  border-radius: 24px;
  position: relative;
  overflow: hidden;
  text-align: center;
}

.confetti-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.confetti-piece {
  position: absolute;
  width: 10px;
  height: 18px;
  border-radius: 4px;
  animation: confettiFall 900ms ease forwards;
}

@keyframes confettiFall {
  0% { transform: translateY(-10px) rotate(0deg); opacity: 1; }
  100% { transform: translateY(120vh) rotate(520deg); opacity: 0; }
}

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

@media (max-width: 1024px) {
  .main-layout {
    grid-template-columns: 1fr;
  }
  .map-shell {
    min-height: 480px;
  }
}

@media (max-height: 900px) {
  .app-shell {
    padding: 16px;
    gap: 14px;
  }
  .topbar {
    padding: 18px 20px;
  }
  .sidebar,
  .map-card {
    padding: 16px;
  }
  .map-shell {
    min-height: 360px;
  }
}

@media (max-width: 720px) {
  body {
    overflow: auto;
  }
  .app-shell {
    padding: 14px;
  }
  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }
  .input-row {
    flex-direction: column;
  }
  .mode-grid {
    grid-template-columns: 1fr;
  }
  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }
  .map-shell {
    min-height: 360px;
  }
}
/* Стиль для кнопки "Ответить" */
.btn-save {
  background: #3b82f6;
  color: white;
}
.btn-save:hover:not(:disabled) {
  background: #2563eb;
}

/* Стиль для кнопки "Проверить все" */
.btn-check-all {
  background: #059669;
  color: white;
}
.btn-check-all:hover:not(:disabled) {
  background: #047857;
}
.btn-check-all:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Состояния маркеров на карте */
.station-marker.pending {
  background: #3b82f6 !important;
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.5);
}

.station-marker.correct {
  background: #22c55e !important;
  box-shadow: 0 0 24px rgba(34, 197, 94, 0.5);
}

.station-marker.wrong {
  background: #ef4444 !important;
  box-shadow: 0 0 24px rgba(239, 68, 68, 0.5);
}

.station-marker.active {
  transform: translate(-50%, -50%) scale(1.3);
  box-shadow: 0 0 0 8px rgba(94, 168, 255, 0.3);
}