:root {
  --bg: #0f172a;
  --panel: #111827;
  --card: #1f2937;
  --accent: #22d3ee;
  --accent-2: #a78bfa;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --success: #34d399;
  --error: #f87171;
  --warning: #fbbf24;
  --border: rgba(255, 255, 255, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: radial-gradient(
      circle at 10% 20%,
      rgba(34, 211, 238, 0.08),
      transparent 25%
    ),
    radial-gradient(
      circle at 90% 10%,
      rgba(167, 139, 250, 0.1),
      transparent 22%
    ),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  overflow: hidden;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

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

h1 {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 10px;
  align-items: stretch;
  flex: 1 1 auto;
  min-height: 0;
}

@media (max-width: 960px) {
  .layout {
    grid-template-columns: 1fr;
    flex: unset;
    gap: 12px;
  }
}

@media (max-width: 640px) {
  body {
    padding: 10px;
    gap: 8px;
    overflow: auto;
    height: auto;
  }
  header {
    gap: 8px;
    align-items: flex-start;
  }
  h1 {
    font-size: 1.1rem;
  }
  .controls {
    flex-wrap: nowrap;
    gap: 8px;
    width: 100%;
  }
  .controls > button {
    flex: 1 1 0;
  }
  .layout {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: calc(100vh - 80px);
  }
  .panel,
  .map-card {
    padding: 10px;
  }
  .card {
    padding: 10px 12px;
  }
  .svg-holder {
    aspect-ratio: auto;
    height: 65vh;
    min-height: 360px;
    max-height: 70vh;
  }
  svg {
    width: 100%;
    height: 100%;
  }
  .map-card {
    flex: 1 1 auto;
    min-height: 0;
    order: 1;
  }
  .panel {
    order: 2;
    margin-top: 8px;
  }
  button {
    width: auto;
    justify-content: center;
  }
  .counter-row {
    flex-wrap: nowrap;
  }
  .counter-row .stat-pill {
    flex: 1 1 0;
    text-align: center;
  }
}

.panel,
.map-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.24);
  height: 100%;
  display: flex;
  flex-direction: column;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.status-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

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

.value {
  font-weight: 700;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(34, 211, 238, 0.12);
  border: 1px solid rgba(34, 211, 238, 0.25);
  color: var(--text);
  font-weight: 600;
  font-size: 0.9rem;
}

button {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: none;
  color: #0b1021;
  padding: 10px 14px;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 10px 25px rgba(34, 211, 238, 0.2);
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}

.secondary {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: none;
}

button:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

button:active {
  transform: translateY(0);
  box-shadow: 0 6px 16px rgba(34, 211, 238, 0.14);
}

.toggle-btn {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: none;
}

.toggle-btn.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #0b1021;
  border-color: transparent;
  box-shadow: 0 8px 20px rgba(34, 211, 238, 0.18);
}

.message {
  min-height: 28px;
  color: var(--muted);
  font-size: 0.95rem;
}

.message strong {
  color: var(--text);
}

.report {
  margin-top: 10px;
}

.hidden {
  display: none;
}

.svg-holder {
  position: relative;
  width: 100%;
  flex: 1 1 auto;
  height: 100%;
  aspect-ratio: 1000 / 684;
  background: radial-gradient(
      circle at 30% 30%,
      rgba(34, 211, 238, 0.09),
      transparent 38%
    ),
    radial-gradient(
      circle at 70% 60%,
      rgba(167, 139, 250, 0.1),
      transparent 42%
    ),
    #0a1a33;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
}

@media (min-width: 961px) {
  .layout {
    min-height: calc(100vh - 80px);
  }
  .map-card {
    min-height: 0;
  }
  .svg-holder {
    max-height: calc(100vh - 140px);
  }
}

.svg-content {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
}

.menu-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  padding: 16px;
}

.menu-overlay.hidden {
  display: none !important;
}

.menu-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  width: min(420px, 100%);
  box-shadow: 0 16px 60px rgba(0, 0, 0, 0.35);
}

.menu-card h2 {
  margin: 0 0 12px;
  font-size: 1.2rem;
}

.menu-list {
  display: grid;
  gap: 10px;
}

.menu-list button {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.reset-view {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.88);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
}

.reset-view:hover {
  filter: brightness(1.08);
}

.center-view {
  position: absolute;
  bottom: 10px;
  left: 10px;
  z-index: 2;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.92);
  color: #f8fafc;
  border: 1px solid rgba(255, 255, 255, 0.26);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  line-height: 1;
  backdrop-filter: blur(4px);
}

.center-view img {
  width: 18px;
  height: 18px;
  filter: invert(1);
}

.center-view:hover {
  filter: brightness(1.08);
}

@media (max-width: 640px) {
  .reset-view,
  .center-view {
    width: 40px;
    height: 40px;
    font-size: 18px;
    border-radius: 10px;
    padding: 0;
  }
  .reset-view {
    top: 8px;
    right: 8px;
  }
  .center-view {
    bottom: 8px;
    left: 8px;
  }
  .center-view img {
    width: 16px;
    height: 16px;
  }
}

.non-target {
  fill: #330025;
  stroke: #661447;
  stroke-width: 0.8;
  pointer-events: none;
  cursor: default;
}

.non-target:hover {
  fill: #330025;
  stroke: #661447;
}

svg {
  width: 70%;
  height: 70%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

svg path {
  cursor: pointer;
  transition: fill 160ms ease, stroke 160ms ease, transform 140ms ease;
  fill: #1f2937;
  stroke: #e2e8f0;
  stroke-width: 0.55;
  stroke-linejoin: round;
  stroke-linecap: round;
  paint-order: stroke fill;
}

svg path:not(.correct):not(.non-target):hover {
  fill: #2b3a4f;
  stroke: #345ee9;
  stroke-width: 0.9;
}

svg path.correct {
  fill: #34d399;
  stroke: #22c55e;
  stroke-width: 0.8;
}

svg path.wrong.flash {
  fill: rgba(248, 113, 113, 0.45);
  stroke: var(--error);
  stroke-width: 0.8;
}

.counter-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.stat-pill {
  padding: 6px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
}

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

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

@media (max-width: 960px) {
  body {
    overflow: auto;
    height: auto;
  }

  .layout {
    min-height: 0;
  }

  .map-card {
    min-height: 320px;
  }

  svg {
    width: 100%;
    height: 100%;
  }
}

.hard-list {
  margin: 6px 0 0;
  padding-left: 16px;
  color: var(--muted);
}

.hard-list li {
  margin-bottom: 4px;
}

.small {
  font-size: 0.88rem;
  color: var(--muted);
}
