/* city.css - one restrained theme: deep slate, one accent, system type. */

:root {
  --bg: #0d141b;
  --bg2: #101a24;
  --panel: #101820;
  --line: #223041;
  --ink: #dbe4ee;
  --ink2: #8b98a8;
  --accent: #e2a356;
  --accent2: #5d93b8;
  --focus: #ffd68c;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ── header ─────────────────────────────────────────────────────────── */

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--bg2);
  position: relative;
  z-index: 3;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.mark { width: 34px; height: 34px; flex: none; }
h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 650;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.tag {
  margin: 1px 0 0;
  font-size: 11px;
  color: var(--ink2);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hint {
  margin: 0;
  font-size: 12px;
  color: var(--ink2);
  white-space: nowrap;
}
kbd {
  font: 11px/1 ui-monospace, SFMono-Regular, Consolas, monospace;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 1px 5px;
  color: var(--ink);
  background: var(--bg);
}

/* ── layout ─────────────────────────────────────────────────────────── */

.wrap {
  display: flex;
  gap: 14px;
  padding: 14px;
  height: calc(100vh - 57px);
  min-height: 420px;
}
.canvas {
  position: relative;
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: #0b1118;
}
#scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
  touch-action: none;
  user-select: none;
}
#scene:active { cursor: grabbing; }
#scene text {
  font-family: system-ui, "Segoe UI", Roboto, sans-serif;
  pointer-events: none;
}

.fallback { position: absolute; inset: 0; width: 100%; height: 100%; }

/* ── minimap ────────────────────────────────────────────────────────── */

.mini {
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: 150px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--panel);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
  z-index: 2;
}
#mini { display: block; width: 100%; height: auto; cursor: crosshair; touch-action: none; }

/* ── panel ──────────────────────────────────────────────────────────── */

.panel {
  width: 330px;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  padding: 6px 16px 16px;
  overflow-y: auto;
}
.group { padding: 14px 0; border-bottom: 1px solid var(--line); }
.group:last-child { border-bottom: 0; }
h2 {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink2);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}
h2 output { font-size: 14px; color: var(--accent); letter-spacing: 0.05em; font-variant-numeric: tabular-nums; }
.fine, .note { font-size: 12px; color: var(--ink2); margin: 8px 0 0; }
.stats {
  font: 12px/1.6 ui-monospace, SFMono-Regular, Consolas, monospace;
  color: var(--ink2);
  margin: 0;
}
.note { font-size: 12px; color: var(--ink2); margin-top: 8px; }

/* ── controls ───────────────────────────────────────────────────────── */

.row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.row:last-child { margin-bottom: 0; }

input[type="text"] {
  flex: 1;
  min-width: 0;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  font: 14px ui-monospace, SFMono-Regular, Consolas, monospace;
  padding: 7px 10px;
}
input[type="text"]:focus-visible,
input[type="range"]:focus-visible,
button:focus-visible,
.chk input:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

button.btn {
  background: var(--bg2);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 7px;
  padding: 7px 12px;
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease;
}
button.btn:hover { border-color: var(--accent2); background: #152230; }
button.btn.small { padding: 4px 10px; font-size: 12px; }
button.rot[aria-pressed="true"] {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(226, 163, 86, 0.08);
}

input[type="range"] {
  width: 100%;
  margin: 4px 0 10px;
  appearance: none;
  -webkit-appearance: none;
  height: 22px;
  background: transparent;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(90deg, #1c2733, #3a4b60);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #0d141b;
  margin-top: -5.5px;
}
input[type="range"]::-moz-range-track {
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(90deg, #1c2733, #3a4b60);
}
input[type="range"]::-moz-range-thumb {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #0d141b;
}

.presets { flex-wrap: wrap; }

.chk {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
  user-select: none;
}
.chk input { accent-color: var(--accent); width: 15px; height: 15px; }

/* ── dossier ────────────────────────────────────────────────────────── */

.hoverName {
  margin: 0 0 6px;
  min-height: 18px;
  font-size: 13px;
  color: var(--accent);
  font-weight: 600;
}
.dEmpty { font-size: 12.5px; color: var(--ink2); margin: 0; }
.dList { margin: 0; font-size: 13.5px; }
.dList dt {
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink2);
  margin-top: 9px;
}
.dList dd { margin: 2px 0 0; }

/* ── scene element classes ──────────────────────────────────────────── */

.gridoff #gridG { display: none; }

/* LOD: d1 details need mid zoom, d2 need close zoom */
.d1, .d2 { display: none; }
.lod1 .d1 { display: block; }
.lod2 .d1, .lod2 .d2 { display: block; }
.lod2 .d1 { display: block; }

/* window lights & beacon fade in with darkness (driven by --lights) */
.litw { opacity: var(--lights, 0); }
.beacon { opacity: calc(var(--lights, 0) * 0.9); transform-box: fill-box; transform-origin: center; }

/* beacon pulse only when motion is acceptable */
@media (prefers-reduced-motion: no-preference) {
  .beacon { animation: beaconPulse 3.2s ease-in-out infinite; }
}
.reduce-motion .beacon { animation: none; }
@keyframes beaconPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.25); }
}

/* pattern overlays never stroke */
.pat { stroke: none; pointer-events: none; }

#fx { pointer-events: none; }
#scene #view { pointer-events: none; }
#scene #skyBg { pointer-events: none; }

/* small screens: panel drops below the canvas */
@media (max-width: 880px) {
  .hint { display: none; }
  .wrap { flex-direction: column; height: auto; }
  .canvas { height: 62vh; min-height: 340px; }
  .panel { width: 100%; }
  .mini { width: 120px; }
}
