/* ISOPOLIS — city.css */
:root {
  --ink: #eef2f7;
  --ink-dim: #9aa7ba;
  --panel-bg: rgba(16, 20, 30, 0.82);
  --panel-border: rgba(255, 255, 255, 0.09);
  --accent: #e8b04b;
  --accent-2: #7fb2d9;
  --radius: 10px;
  --shadow: 0 10px 30px rgba(4, 8, 18, 0.45);
  --font: ui-sans-serif, -apple-system, "Avenir Next", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; overflow: hidden; background: #0a0e18; color: var(--ink);
  font-family: var(--font); font-size: 14px;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
#view { position: fixed; inset: 0; display: block; touch-action: none; cursor: default; }

/* ---------- boot overlay ---------- */
#boot {
  position: fixed; inset: 0; display: grid; place-items: center;
  background: radial-gradient(120% 100% at 50% 30%, rgba(12,18,34,0.5), rgba(6,8,16,0.9));
  z-index: 60; pointer-events: none;
  animation: bootfade 0.9s ease 2s forwards;
}
#boot.gone { display: none; }
.boot-inner { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.boot-kicker { font-size: 11px; letter-spacing: 0.34em; text-transform: uppercase; color: var(--ink-dim); }
.boot-title { font-size: 44px; font-weight: 650; letter-spacing: 0.22em; }
.boot-hint { font-size: 12px; color: var(--accent); opacity: 0.9; }
@keyframes bootfade { to { opacity: 0; visibility: hidden; } }

/* ---------- brand ---------- */
#brand {
  position: fixed; top: 14px; left: 16px; display: flex; gap: 10px; align-items: center;
  z-index: 20; pointer-events: none;
}
#brand .logo {
  width: 30px; height: 30px; border-radius: 7px;
  background: linear-gradient(160deg, #4a6f9e, #2c3a52 70%);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.14), 0 4px 14px rgba(0,0,0,0.4);
  position: relative;
}
#brand .logo::after {
  content: ""; position: absolute; inset: 8px 6px 4px;
  background:
    linear-gradient(#ffd58c, #ffd58c) 20% 20% / 22% 26% no-repeat,
    linear-gradient(#ffd58c, #ffd58c) 62% 20% / 22% 26% no-repeat,
    linear-gradient(#ffd58c, #ffd58c) 20% 58% / 22% 26% no-repeat;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; text-shadow: 0 1px 8px rgba(0,0,0,0.6); }
.brand-text strong { letter-spacing: 0.24em; font-size: 15px; }
.brand-text span { font-size: 10.5px; letter-spacing: 0.12em; color: var(--ink-dim); text-transform: uppercase; }

/* ---------- hud ---------- */
#hud {
  position: fixed; left: 16px; bottom: 14px; z-index: 20; pointer-events: none;
  display: flex; align-items: baseline; gap: 10px;
  background: var(--panel-bg); border: 1px solid var(--panel-border);
  padding: 7px 14px; border-radius: var(--radius); backdrop-filter: blur(8px);
  box-shadow: var(--shadow);
  font-variant-numeric: tabular-nums;
}
#hud-clock { font-size: 21px; font-weight: 600; letter-spacing: 0.06em; }
#daypart { font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-dim); }

/* ---------- panel ---------- */
#panel {
  position: fixed; top: 14px; right: 14px; z-index: 30; width: 268px;
  max-height: calc(100vh - 28px); overflow-y: auto; overscroll-behavior: contain;
  background: var(--panel-bg); border: 1px solid var(--panel-border);
  border-radius: 14px; padding: 6px 14px 12px; backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
  transition: transform 0.25s ease, opacity 0.2s ease;
  scrollbar-width: thin;
}
#panel.closed { transform: translateX(calc(100% + 20px)); }
#panel-toggle {
  position: absolute; left: -34px; top: 10px; width: 28px; height: 44px;
  border-radius: 8px 0 0 8px; border: 1px solid var(--panel-border); border-right: none;
  background: var(--panel-bg); color: var(--ink-dim); font-size: 14px; cursor: pointer;
  backdrop-filter: blur(8px);
}
#panel.closed + * #panel-toggle { display: none; }
#panel-toggle:hover, #panel-toggle:focus-visible { color: var(--ink); }

.pgroup { border-top: 1px solid var(--panel-border); padding: 11px 0 7px; }
.pgroup:first-child { border-top: none; padding-top: 12px; }
.pgroup h2 {
  margin: 0 0 8px; font-size: 10.5px; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--ink-dim); font-weight: 600;
}
.row { display: flex; justify-content: space-between; align-items: baseline; font-size: 12px; color: var(--ink-dim); margin: 8px 0 4px; }
.row output { color: var(--ink); font-variant-numeric: tabular-nums; }

input[type="text"] {
  width: 100%; padding: 8px 10px; border-radius: 8px; border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.05); color: var(--ink); font: inherit;
  letter-spacing: 0.06em; font-variant-numeric: tabular-nums;
}
input[type="text"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.seedrow { display: flex; gap: 6px; }
.seedrow input { flex: 1; }

button {
  font: inherit; color: var(--ink); background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.13); border-radius: 8px;
  padding: 7px 10px; cursor: pointer; transition: background 0.15s ease, border-color 0.15s ease;
}
button:hover { background: rgba(255,255,255,0.13); }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
button.on { background: rgba(232,176,75,0.2); border-color: rgba(232,176,75,0.55); color: #ffd58c; }

.btnrow { display: flex; gap: 6px; margin: 8px 0; }
.btnrow button { flex: 1; }

.seg { display: flex; gap: 4px; margin: 8px 0; }
.seg button { flex: 1; padding: 6px 4px; font-size: 12px; }

input[type="range"] {
  width: 100%; appearance: none; -webkit-appearance: none; height: 22px; background: transparent; cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 5px; border-radius: 3px;
  background: linear-gradient(90deg, #22304a 0%, #3c5578 30%, #7db3d9 50%, #3c5578 70%, #141c30 100%);
}
input[type="range"]::-moz-range-track { height: 5px; border-radius: 3px; background: #2c3a52; }
input[type="range"]::-webkit-slider-thumb {
  appearance: none; -webkit-appearance: none; width: 15px; height: 15px; margin-top: -5px;
  border-radius: 50%; background: #f3d489; border: 2px solid #1a2236;
  box-shadow: 0 1px 6px rgba(0,0,0,0.5);
}
input[type="range"]::-moz-range-thumb {
  width: 13px; height: 13px; border-radius: 50%; background: #f3d489; border: 2px solid #1a2236;
}
input[type="range"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.clockrow { display: flex; align-items: baseline; justify-content: space-between; }
#clock-big { font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: 0.04em; }
.timerange-labels { display: flex; justify-content: space-between; font-size: 9.5px; color: var(--ink-dim); margin-top: -4px; }

.checkrow { display: flex; gap: 8px; align-items: center; font-size: 13px; margin: 6px 0; cursor: pointer; }
.checkrow input { accent-color: var(--accent); }

#btn-help { width: 100%; margin-top: 4px; font-size: 12px; }
#help { margin-top: 8px; font-size: 12px; }
#help dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; margin: 0; }
#help dt { color: var(--accent-2); font-weight: 600; white-space: nowrap; }
#help dd { margin: 0; color: var(--ink-dim); }

.stats { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
.stats div { display: flex; flex-direction: column; gap: 2px; }
.stats span { font-size: 9.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-dim); }
.stats strong { font-size: 15px; font-variant-numeric: tabular-nums; font-weight: 600; }

/* ---------- tooltip ---------- */
#tooltip {
  position: fixed; z-index: 40; pointer-events: none; opacity: 0;
  background: rgba(12, 16, 26, 0.92); border: 1px solid var(--panel-border);
  border-radius: 9px; padding: 8px 12px; max-width: 240px;
  display: flex; flex-direction: column; gap: 2px;
  transform: translateY(4px); transition: opacity 0.12s ease;
  box-shadow: var(--shadow);
}
#tooltip.show { opacity: 1; }
#tooltip strong { font-size: 13.5px; }
#tooltip span { font-size: 11.5px; color: var(--ink-dim); }

/* ---------- follow card ---------- */
#follow-card {
  position: fixed; left: 50%; bottom: 18px; transform: translate(-50%, 20px);
  z-index: 35; width: min(400px, calc(100vw - 32px));
  background: rgba(14, 18, 28, 0.92); border: 1px solid rgba(232,176,75,0.35);
  border-radius: 12px; padding: 10px 14px; opacity: 0; pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease; box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}
#follow-card.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
#follow-card h3 {
  margin: 0 0 6px; font-size: 10.5px; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--accent); font-weight: 600;
}
#follow-close {
  position: absolute; top: 8px; right: 8px; padding: 2px 8px; border-radius: 6px;
  font-size: 12px; line-height: 1.4;
}
.fr { display: flex; justify-content: space-between; gap: 12px; font-size: 12.5px; padding: 2px 0; }
.fr span { color: var(--ink-dim); flex-shrink: 0; }
.fr strong { font-weight: 500; text-align: right; }
.turns { margin-top: 6px; border-top: 1px solid var(--panel-border); padding-top: 5px; display: flex; flex-direction: column; gap: 3px; }
.turn { font-size: 11.5px; color: var(--ink-dim); display: flex; align-items: center; gap: 7px; }
.turn .dir { width: 0; height: 0; border-style: solid; flex-shrink: 0; }
.turn.right .dir { border-width: 3.5px 0 3.5px 6px; border-color: transparent transparent transparent var(--accent-2); }
.turn.left .dir { border-width: 3.5px 6px 3.5px 0; border-color: transparent var(--accent-2) transparent transparent; }
.turn.straight .dir { border-width: 2px 3px 0 3px; border-color: var(--accent-2) transparent transparent transparent; margin-bottom: 3px; }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  #panel {
    top: auto; bottom: 0; right: 0; left: 0; width: auto;
    max-height: 46vh; border-radius: 16px 16px 0 0; padding: 4px 16px 18px;
  }
  #panel.closed { transform: translateY(105%); }
  #panel-toggle { left: auto; right: 14px; top: -38px; width: 44px; height: 32px; border-radius: 8px 8px 0 0; border-bottom: none; }
  #brand { top: 10px; left: 12px; }
  #hud { left: 12px; bottom: auto; top: 56px; }
  #follow-card { bottom: auto; top: 100px; transform: translate(-50%, -12px); }
  #follow-card.show { transform: translate(-50%, 0); }
  .boot-title { font-size: 32px; }
}
@media (max-width: 480px) {
  #panel { max-height: 40vh; }
}
