:root {
  --bg: #080b16;
  --panel: #10152490;
  --panel-solid: #101524;
  --line: #232a42;
  --text: #e6e9f5;
  --muted: #8d95b3;
  --gold: #e9c583;
  --gold-2: #f4dcae;
  --good: #7fd6a0;
  --warn: #f08a7a;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  --sym: "Apple Symbols", "Segoe UI Symbol", "Noto Sans Symbols 2", "Noto Sans Symbols", sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}
.app {
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr) 400px;
  height: 100vh;
}
h1, h2, h3, h4 { margin: 0; font-weight: 600; }
.g { font-family: var(--sym); font-variant-emoji: text; }

/* ---------- sidebar ---------- */
.side, .panel {
  background: var(--panel-solid);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #2a3252 transparent;
}
.side { border-right: 1px solid var(--line); padding: 20px 18px 24px; }
.brand { display: flex; gap: 12px; align-items: center; margin-bottom: 22px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center;
  color: #1a1408; font-size: 18px;
  background: radial-gradient(circle at 30% 30%, var(--gold-2), #b98a3c);
  box-shadow: 0 0 22px #e9c58355;
}
.brand h1 { font: 600 21px/1.1 var(--serif); letter-spacing: .01em; }
.brand p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }

form label { display: block; font-size: 11.5px; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; margin-bottom: 12px; }
input[type=date], input[type=time], input[type=text], input[type=number] {
  display: block; width: 100%; margin-top: 5px;
  background: #0a0e1b; color: var(--text);
  border: 1px solid var(--line); border-radius: 8px;
  padding: 9px 10px; font: 14px var(--sans);
  color-scheme: dark;
}
input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px #e9c58322; }
.row2 { display: grid; grid-template-columns: 1.2fr 1fr; gap: 10px; }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.place-wrap { position: relative; }
.place-results {
  position: absolute; z-index: 20; left: 0; right: 0; top: 100%;
  margin: 4px 0 0; padding: 4px; list-style: none;
  background: #151b30; border: 1px solid #2f3859; border-radius: 10px;
  box-shadow: 0 14px 40px #000a;
  text-transform: none; letter-spacing: 0;
}
.place-results li { padding: 8px 10px; border-radius: 7px; cursor: pointer; color: var(--text); font-size: 13.5px; }
.place-results li small { display: block; color: var(--muted); font-size: 11.5px; }
.place-results li:hover, .place-results li.active { background: #222b4a; }
.place-results li.none { color: var(--muted); cursor: default; background: none; }
details { margin-bottom: 14px; }
summary { cursor: pointer; color: var(--muted); font-size: 12.5px; }
summary:hover { color: var(--text); }
.hint, .fine { color: var(--muted); font-size: 11.5px; line-height: 1.45; }
.hint { margin: 0; }
.actions { display: flex; gap: 8px; }
button { font: inherit; cursor: pointer; }
.primary {
  flex: 1; border: 0; border-radius: 9px; padding: 11px 14px;
  background: linear-gradient(180deg, var(--gold-2), #d2a759);
  color: #1b1405; font-weight: 650; letter-spacing: .01em;
}
.primary:hover { filter: brightness(1.07); }
.ghost { border: 1px solid var(--line); background: transparent; color: var(--text); border-radius: 9px; padding: 0 14px; }
.ghost:hover { border-color: #3a4470; }
.form-msg { margin: 10px 0 0; font-size: 12.5px; color: var(--warn); }

.summary {
  margin-top: 16px; padding: 12px; border-radius: 10px;
  background: #0b1020; border: 1px solid var(--line);
  font-size: 12.5px; color: var(--muted);
}
.summary b { color: var(--text); font-weight: 600; display: block; font-size: 14px; margin-bottom: 2px; }

.layers { margin-top: 20px; }
.layers h2, .tab-body h4 {
  font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted); margin: 18px 0 9px;
}
.check { display: flex; align-items: center; gap: 9px; margin: 7px 0; cursor: pointer; font-size: 13.5px; }
.check input { accent-color: var(--gold); margin: 0; }
.swatch { width: 22px; height: 0; border-top: 2px solid #cfd6ee; }
.swatch.dashed { border-top-style: dashed; }
.swatch.dot { width: 8px; height: 8px; border: 0; border-radius: 50%; background: #fff; margin: 0 7px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid color-mix(in srgb, var(--c) 55%, transparent);
  background: color-mix(in srgb, var(--c) 14%, transparent);
  color: var(--text); border-radius: 999px; padding: 4px 10px 4px 8px; font-size: 12.5px;
}
.chip-btn .g { color: var(--c); font-size: 15px; line-height: 1; }
.chip-btn.off { opacity: .38; background: transparent; }
.fine { margin-top: 22px; }

/* ---------- stage ---------- */
.stage {
  position: relative; overflow: hidden; min-height: 420px;
  background:
    radial-gradient(1px 1px at 12% 22%, #ffffff88 50%, transparent 51%),
    radial-gradient(1px 1px at 78% 12%, #ffffff66 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 64% 82%, #ffffff66 50%, transparent 51%),
    radial-gradient(1px 1px at 28% 72%, #ffffff55 50%, transparent 51%),
    radial-gradient(1px 1px at 91% 55%, #ffffff66 50%, transparent 51%),
    radial-gradient(1px 1px at 43% 9%, #ffffff55 50%, transparent 51%),
    radial-gradient(1px 1px at 6% 88%, #ffffff55 50%, transparent 51%),
    radial-gradient(ellipse at 50% 45%, #141b38 0%, #080b16 70%);
}
#map { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
#map.dragging { cursor: grabbing; }
#map.hit { cursor: pointer; }
.map-top { position: absolute; top: 14px; left: 14px; right: 14px; display: flex; justify-content: space-between; pointer-events: none; }
.map-top > * { pointer-events: auto; }
.seg { display: inline-flex; padding: 3px; border-radius: 10px; background: #0d1222cc; border: 1px solid var(--line); backdrop-filter: blur(8px); }
.seg button { border: 0; background: transparent; color: var(--muted); padding: 6px 14px; border-radius: 7px; font-weight: 550; font-size: 13px; }
.seg button.on { background: var(--gold); color: #1b1405; }
.zoom { display: flex; flex-direction: column; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: #0d1222cc; backdrop-filter: blur(8px); }
.zoom button { width: 34px; height: 32px; border: 0; background: transparent; color: var(--text); font-size: 18px; line-height: 1; }
.zoom button:hover { background: #1b2340; }
.zoom button + button { border-top: 1px solid var(--line); }
.map-hint, .proj-note {
  position: absolute; bottom: 12px; font-size: 11.5px; color: var(--muted);
  pointer-events: none; text-shadow: 0 1px 4px #000;
}
.map-hint { left: 0; right: 0; text-align: center; }
.proj-note { left: 16px; top: 58px; bottom: auto; }

.tip {
  position: absolute; z-index: 10; pointer-events: none; max-width: 300px;
  background: #0c1122f2; border: 1px solid #323b60; border-radius: 10px;
  padding: 9px 11px; box-shadow: 0 12px 34px #000b; font-size: 12.5px;
}
.tip .t-row + .t-row { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.tip .t-head { display: flex; align-items: center; gap: 7px; font-weight: 650; font-size: 13.5px; }
.tip .t-head .g { font-size: 17px; line-height: 1; }
.tip .t-sub { color: var(--muted); margin-top: 1px; }
.tip .t-txt { margin-top: 4px; color: #cdd3ea; line-height: 1.4; }

.reading {
  position: absolute; left: 14px; bottom: 38px; width: min(330px, calc(100% - 28px));
  max-height: 55%; overflow-y: auto;
  background: #0c1122ee; border: 1px solid #323b60; border-radius: 12px;
  padding: 12px 14px; backdrop-filter: blur(10px); box-shadow: 0 16px 40px #000a;
}
.reading h3 { font: 600 15px var(--serif); padding-right: 22px; }
.reading .r-where { font-size: 12.5px; color: #c9cfe6; margin: 3px 0 2px; }
.reading .r-where b { color: var(--gold); font-weight: 600; }
.reading .r-sub { color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.reading .close { position: absolute; top: 8px; right: 8px; border: 0; background: none; color: var(--muted); font-size: 18px; line-height: 1; }
.reading .close:hover { color: var(--text); }
.r-line { display: flex; gap: 9px; padding: 7px 0; border-top: 1px solid var(--line); font-size: 12.5px; }
.r-line .g { font-size: 18px; line-height: 1.2; width: 20px; text-align: center; }
.r-line b { font-weight: 600; }
.r-line span.km { color: var(--muted); font-weight: 400; }
.r-line p { margin: 2px 0 0; color: #b9c0da; line-height: 1.4; }

/* ---------- right panel ---------- */
.panel { border-left: 1px solid var(--line); display: flex; flex-direction: column; overflow: hidden; }
.tabs { display: flex; border-bottom: 1px solid var(--line); padding: 0 8px; flex: none; }
.tabs button {
  flex: 1; border: 0; background: none; color: var(--muted);
  padding: 14px 4px 12px; font-size: 13px; font-weight: 550;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs button:hover { color: var(--text); }
.tabs button.on { color: var(--gold); border-bottom-color: var(--gold); }
.tab-body { overflow-y: auto; padding: 18px 18px 30px; flex: 1; scrollbar-width: thin; scrollbar-color: #2a3252 transparent; }
.empty h3, .tab-body h3 { font: 600 19px/1.25 var(--serif); margin-bottom: 8px; }
.empty p, .lead { color: #b3bad4; }
.lead { margin: 0 0 14px; font-size: 13px; }
.tab-body h4:first-child { margin-top: 0; }

.hero {
  border-radius: 14px; padding: 16px; margin-bottom: 6px;
  background: linear-gradient(145deg, #2a2210, #141a30 60%);
  border: 1px solid #5a4a25;
}
.hero .eyebrow { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--gold); }
.hero h3 { font-size: 24px; margin: 4px 0 2px; }
.hero h3 small { font: 400 13px var(--sans); color: var(--muted); margin-left: 6px; }
.hero p { margin: 8px 0 0; color: #d6d2c4; font-size: 13px; }

.city {
  display: block; width: 100%; text-align: left;
  background: #0b1020; border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; margin-bottom: 7px; color: var(--text);
}
.city:hover { border-color: #46507c; background: #0f1529; }
.city .c-top { display: flex; align-items: baseline; gap: 8px; }
.city .rank { color: var(--muted); font-size: 12px; width: 14px; }
.city .c-name { font-weight: 600; font-size: 14px; }
.city .c-country { color: var(--muted); font-size: 12px; }
.city .bar { margin-left: auto; width: 54px; height: 4px; border-radius: 2px; background: #1c2440; overflow: hidden; align-self: center; }
.city .bar i { display: block; height: 100%; background: var(--gold); border-radius: 2px; }
.city.care .bar i { background: var(--warn); }
.tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; padding-left: 22px; }
.tag {
  display: inline-flex; align-items: center; gap: 4px; white-space: nowrap;
  font-size: 11.5px; padding: 1px 7px 1px 5px; border-radius: 999px;
  color: #dfe3f3;
  background: color-mix(in srgb, var(--c) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--c) 45%, transparent);
}
.tag .g { color: var(--c); font-size: 13px; }
.tag.neg { border-style: dashed; opacity: .8; }
.cat-blurb { color: var(--muted); font-size: 12px; margin: -4px 0 8px; }
.none-note { color: var(--muted); font-size: 12.5px; font-style: italic; margin: 0 0 8px; }

.planet-block { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; overflow: hidden; background: #0b1020; }
.planet-block > header { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: color-mix(in srgb, var(--c) 10%, #0b1020); }
.planet-block > header .g { color: var(--c); font-size: 22px; line-height: 1; }
.planet-block > header b { font-size: 14.5px; }
.planet-block > header span { color: var(--muted); font-size: 12px; margin-left: auto; }
.pl-line { padding: 9px 12px; border-top: 1px solid var(--line); font-size: 12.5px; }
.pl-line .pl-h { display: flex; gap: 8px; align-items: baseline; }
.pl-line .pl-h b { color: var(--c); font-size: 12px; letter-spacing: .05em; }
.pl-line .pl-h em { font-style: normal; color: var(--muted); font-size: 11.5px; }
.pl-line p { margin: 3px 0 0; color: #c3c9e0; line-height: 1.45; }
.pl-line .near { margin-top: 5px; color: var(--muted); font-size: 11.5px; }
.pl-line .near a { color: #dfe3f3; cursor: pointer; text-decoration: underline; text-decoration-color: #46507c; text-underline-offset: 2px; }
.pl-line .near a:hover { color: var(--gold); }

/* ---------- location report ---------- */
.meter { display: block; height: 4px; border-radius: 2px; background: #1c2440; overflow: hidden; margin: 1px 0 7px; }
.meter i { display: block; height: 100%; border-radius: 2px; }
.themes td { vertical-align: middle; }
.themes td:nth-child(2) { width: 42%; }
.themes .meter { margin: 0; }
tr.hit td { background: #e9c5830f; }
.rp-where { margin-bottom: 8px; }
.rp-where b { color: var(--gold); }
.was { color: var(--muted); margin-left: 6px; }
.rp-geo { width: 100%; padding: 9px 12px; margin-top: 4px; }
.r-cast + .r-cast { margin-top: 6px; }

/* ---------- profiles ---------- */
.profiles { margin-bottom: 18px; }
.profiles h2 { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: 0 0 8px; }
.profiles ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; }
.profiles li { display: flex; border: 1px solid var(--line); border-radius: 9px; background: #0b1020; overflow: hidden; }
.profiles li.on { border-color: var(--gold); background: #2a221055; }
.profiles li:hover { border-color: #46507c; }
.profiles li.on:hover { border-color: var(--gold); }
.p-load { flex: 1; min-width: 0; text-align: left; border: 0; background: none; color: var(--text); padding: 7px 10px; }
.p-load b { display: block; font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-load small { display: block; color: var(--muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-del { border: 0; background: none; color: var(--muted); width: 32px; font-size: 16px; }
.p-del:hover { color: var(--warn); }
.opt { text-transform: none; letter-spacing: 0; opacity: .7; }
.sub-actions { display: flex; justify-content: space-between; margin-top: 9px; }
.link { border: 0; background: none; padding: 0; color: var(--muted); font-size: 12.5px; text-decoration: underline; text-decoration-color: #3a4470; text-underline-offset: 3px; }
.link:hover { color: var(--text); }
.ghost { white-space: nowrap; }
.form-msg.ok { color: var(--good); }

/* ---------- geomancy ---------- */
.tabs button { font-size: 12.5px; white-space: nowrap; }
.r-cast { margin-top: 8px; width: 100%; border: 1px solid #5a4a25; background: #2a221066; color: var(--gold); border-radius: 8px; padding: 7px 10px; font-size: 12.5px; }
.r-cast:hover { background: #2a2210; }
.geo-target { background: #0b1020; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; }
.geo-target span { display: block; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.geo-target b { display: block; font: 600 16px var(--serif); margin: 2px 0; }
.geo-target small { color: var(--muted); font-size: 11.5px; }
.geo-cast { width: 100%; margin-bottom: 16px; }
.fig { display: grid; gap: 4px; justify-items: center; }
.fig i { display: flex; gap: 5px; height: 6px; }
.fig s { width: 6px; height: 6px; border-radius: 50%; background: var(--c); box-shadow: 0 0 6px color-mix(in srgb, var(--c) 60%, transparent); }
.figure { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.fig-cap { text-align: center; font-size: 12px; line-height: 1.3; }
.fig-cap b { display: block; color: var(--c); }
.fig-cap em { font-style: normal; color: var(--muted); font-size: 11px; }
.shield { border: 1px solid #5a4a25; border-radius: 14px; padding: 16px 10px 14px; background: linear-gradient(180deg, #171c33, #0b1020); margin-bottom: 12px; }
.sh-row { display: grid; justify-items: center; }
.sh-row.r8 { grid-template-columns: repeat(8, 1fr); }
.sh-row.r4 { grid-template-columns: repeat(4, 1fr); }
.sh-row.r2 { grid-template-columns: repeat(2, 1fr); margin-top: 6px; }
.sh-row.r1 { margin-top: 14px; }
.sh-row.r2 .fig, .sh-row.r1 .fig { transform: scale(1.35); margin: 6px 0 8px; }
.sh-row.r1 .fig { transform: scale(1.7); margin: 10px 0 14px; }
.sh-labels { display: grid; grid-template-columns: 1fr 1fr; text-align: center; font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: 7px 0 14px; padding-top: 5px; border-top: 1px solid var(--line); }
.sh-labels.one { grid-template-columns: 1fr; }
.verdict { border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; border: 1px solid var(--line); background: #0b1020; border-left: 3px solid var(--gold); }
.verdict.good { border-left-color: var(--good); }
.verdict.bad { border-left-color: var(--warn); }
.verdict span { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.verdict b { display: block; font: 600 17px var(--serif); margin: 2px 0 4px; }
.verdict p { margin: 0; color: #c9cfe6; font-size: 13px; }
.verdict p b { display: inline; font: 600 13px var(--sans); margin: 0; color: var(--text); }
.fig-ref { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.fig-ref .ref { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; background: #0b1020; }
.fig-ref .ref .fig { width: 20px; }
.fig-ref b { display: block; font-size: 12.5px; }
.fig-ref small { color: var(--muted); font-size: 11px; }

table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
th { text-align: left; color: var(--muted); font-weight: 500; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; padding: 6px 6px; border-bottom: 1px solid var(--line); }
td { padding: 7px 6px; border-bottom: 1px solid #1a2036; vertical-align: top; }
td .g { font-size: 16px; line-height: 1; }
td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.retro { color: var(--warn); font-size: 11px; margin-left: 3px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 13px; margin-bottom: 6px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

@media (max-width: 1150px) {
  .app { grid-template-columns: 290px minmax(0, 1fr); grid-template-rows: 62vh auto; height: auto; }
  .side { grid-row: 1 / span 2; }
  .panel { border-left: 0; border-top: 1px solid var(--line); overflow: visible; }
  .tab-body { overflow: visible; }
}
@media (max-width: 760px) {
  .app { display: block; }
  .side { border-right: 0; border-bottom: 1px solid var(--line); }
  .stage { height: 70vh; }
  .map-hint { display: none; }
}
