:root {
  --ink: #172128;
  --muted: #69747b;
  --paper: #f5f3ee;
  --panel: #fffefa;
  --line: #deded8;
  --soft-line: #ebeae5;
  --amber: #e4a83c;
  --amber-dark: #9c6716;
  --cyan: #2f7e84;
  --green: #55775c;
  --charcoal: #111a20;
  --map-bg: #182127;
  --radius: 6px;
  --header-h: 76px;
  --footer-h: 38px;
  font-family: "Microsoft YaHei UI", "Noto Sans SC", "Microsoft YaHei", Inter, system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-width: 320px;
  min-height: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  min-height: 100vh;
  background: var(--paper);
  font-size: 17px;
  line-height: 1.55;
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(47, 126, 132, 0.28);
  outline-offset: 2px;
}

.app-shell {
  height: 100vh;
  min-height: 100vh;
  display: grid;
  grid-template-rows: var(--header-h) minmax(0, 1fr) var(--footer-h);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  padding: 0 28px;
  background: #fbfaf6;
  border-bottom: 1px solid var(--line);
  z-index: 4;
}

.brand-lockup {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 15px;
}

.brand-mark {
  position: relative;
  width: 39px;
  height: 39px;
  flex: 0 0 39px;
  border: 1px solid var(--ink);
  background: var(--ink);
  overflow: hidden;
}

.brand-mark span {
  position: absolute;
  display: block;
  width: 4px;
  height: 56px;
  top: -9px;
  background: var(--amber);
  transform: rotate(35deg);
}

.brand-mark span:nth-child(1) { left: 6px; }
.brand-mark span:nth-child(2) { left: 17px; background: #f7d58f; }
.brand-mark span:nth-child(3) { left: 28px; }

.brand-lockup h1,
.section-heading h2,
.brand-lockup p {
  margin: 0;
}

.brand-lockup h1 {
  font-size: 24px;
  line-height: 1.08;
  font-weight: 800;
  letter-spacing: 0;
}

.eyebrow,
.section-kicker,
.caption-kicker {
  color: var(--muted);
  font-family: Inter, "Microsoft YaHei UI", sans-serif;
  font-size: 13px;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: .11em;
}

.eyebrow {
  margin-bottom: 5px !important;
}

.topbar-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #4d585f;
  font-size: 14px;
  white-space: nowrap;
}

.meta-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4f8b67;
  box-shadow: 0 0 0 4px rgba(79, 139, 103, .12);
}

.meta-divider {
  height: 14px;
  width: 1px;
  background: #ced0ca;
}

.workspace {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(500px, 1fr) 410px;
}

.map-column {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: 48px minmax(0, 1fr) 54px;
  background: var(--map-bg);
  border-right: 1px solid #080e12;
}

.map-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 17px 0 20px;
  color: #edf0ec;
  background: #10171d;
  border-bottom: 1px solid rgba(255, 255, 255, .1);
  font-size: 14px;
}

.toolbar-title,
.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.live-pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 0 4px rgba(228, 168, 60, .15);
}

.icon-button {
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 4px;
  background: rgba(255, 255, 255, .04);
  color: #eef1ec;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  transition: background .16s ease, border-color .16s ease;
}

.layer-button {
  height: 30px;
  padding: 0 9px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 4px;
  color: #98a3a7;
  background: rgba(255, 255, 255, .03);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.layer-button:hover {
  color: #eef1ec;
  border-color: rgba(255, 255, 255, .28);
}

.layer-button.active {
  color: #f5d99b;
  border-color: rgba(228, 168, 60, .46);
  background: rgba(228, 168, 60, .1);
}

.icon-button:hover {
  background: rgba(255, 255, 255, .12);
  border-color: rgba(255, 255, 255, .3);
}

.map-stage {
  position: relative;
  min-height: 0;
  overflow: hidden;
  background:
    linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px),
    #182127;
  background-size: 28px 28px;
  isolation: isolate;
}

.map-stage picture,
.map-stage img,
#shadow-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.map-stage img {
  object-fit: fill;
  transition: filter .25s ease, opacity .25s ease;
}

.map-stage.base-dim img {
  filter: brightness(.66) saturate(.72) contrast(1.05);
}

#shadow-canvas {
  z-index: 2;
  pointer-events: auto;
}

.map-vignette {
  z-index: 3;
  pointer-events: none;
  box-shadow: inset 0 0 80px rgba(3, 8, 11, .3);
}

.north-badge {
  position: absolute;
  z-index: 4;
  top: 18px;
  right: 18px;
  width: 54px;
  height: 76px;
  display: flex;
  flex-direction: column;
  align-items: center;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,.6);
  transform-origin: 50% 31px;
  transition: transform .18s ease;
}

.north-arrow {
  width: 40px;
  height: 52px;
  display: grid;
  place-items: start center;
  padding-top: 3px;
  font: 700 14px/1 Inter, sans-serif;
  background: linear-gradient(to bottom, #f6c662 0 44%, #f6f3e9 44% 100%);
  clip-path: polygon(50% 0, 73% 54%, 56% 45%, 56% 100%, 44% 100%, 44% 45%, 27% 54%);
  color: #1e2a31;
}

.north-caption {
  margin-top: 3px;
  font-size: 13px;
  font-weight: 600;
}

.map-scale {
  position: absolute;
  z-index: 4;
  left: 18px;
  bottom: 18px;
  display: flex;
  align-items: flex-end;
  gap: 9px;
  color: #fff;
  font: 600 13px/1 Inter, sans-serif;
  text-shadow: 0 1px 3px #000;
}

.scale-line {
  position: relative;
  width: 92px;
  height: 8px;
  border-bottom: 2px solid #fff;
}

.scale-line i {
  position: absolute;
  bottom: -2px;
  width: 2px;
  height: 8px;
  background: #fff;
}

.scale-line i:nth-child(1) { left: 0; }
.scale-line i:nth-child(2) { left: 50%; }
.scale-line i:nth-child(3) { right: 0; }

.map-status {
  position: absolute;
  z-index: 4;
  left: 50%;
  bottom: 17px;
  transform: translateX(-50%);
  max-width: calc(100% - 280px);
  padding: 6px 11px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 4px;
  color: rgba(255,255,255,.9);
  background: rgba(10, 16, 20, .74);
  backdrop-filter: blur(8px);
  font-size: 13px;
  white-space: nowrap;
}

.map-caption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 20px;
  color: #d6dbd7;
  background: #10171d;
  border-top: 1px solid rgba(255,255,255,.1);
}

.map-caption p {
  margin: 3px 0 0;
  font-size: 14px;
}

.caption-kicker { color: #7f8b91; }

.caption-coords {
  display: flex;
  gap: 15px;
  color: #9ba5a9;
  font: 500 13px/1.4 Inter, sans-serif;
  white-space: nowrap;
}

.control-column {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 14px;
  background: #eceae4;
  scrollbar-color: #b9b8b1 transparent;
  scrollbar-width: thin;
}

.panel {
  margin-bottom: 10px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 1px 1px rgba(20, 27, 31, .035);
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.section-heading h2 {
  margin-top: 4px;
  font-size: 20px;
  line-height: 1.25;
  font-weight: 800;
}

.section-kicker { color: #596368; }

.status-pill,
.model-badge {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 9px;
  border-radius: 99px;
  background: #eef4eb;
  color: #4e7259;
  font-size: 13px;
  font-weight: 700;
}

.status-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  margin-right: 6px;
  border-radius: 50%;
  background: currentColor;
}

.status-pill.night {
  color: #5f687d;
  background: #eef0f4;
}

.status-pill.twilight {
  color: #98662a;
  background: #faf0de;
}

.readout-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--soft-line);
}

.readout-cell {
  min-width: 0;
  padding: 11px 12px 10px;
  border-right: 1px solid var(--soft-line);
  border-bottom: 1px solid var(--soft-line);
}

.readout-cell:nth-child(2n) { border-right: 0; }
.readout-cell:nth-child(n+3) { border-bottom: 0; }

.readout-cell span {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 13px;
}

.readout-cell strong {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font: 700 18px/1.25 Inter, "Microsoft YaHei UI", sans-serif;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.accent-cell strong { color: var(--amber-dark); }

.sun-track {
  position: relative;
  height: 42px;
  margin-top: 16px;
  border-top: 1px solid #d3d2cc;
}

.track-fill {
  position: absolute;
  top: -2px;
  left: 25%;
  width: 50%;
  height: 3px;
  background: linear-gradient(90deg, #b9792a, #f2c865 50%, #b9792a);
}

.sun-marker {
  position: absolute;
  top: -7px;
  left: 50%;
  width: 13px;
  height: 13px;
  border: 2px solid #fffefa;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 0 1px #be831d, 0 1px 8px rgba(228,168,60,.4);
  transform: translateX(-50%);
}

.track-label {
  position: absolute;
  top: 10px;
  color: #7d8588;
  font-size: 13px;
}

.track-label.dawn { left: 25%; transform: translateX(-50%); }
.track-label.dusk { left: 75%; transform: translateX(-50%); }

.compact-heading { margin-bottom: 14px; }

.time-output {
  flex: 0 0 auto;
  color: var(--ink);
  font: 700 28px/1 Inter, sans-serif;
}

.field-label {
  display: flex;
  justify-content: space-between;
  margin: 0 0 7px;
  color: #566167;
  font-size: 14px;
  font-weight: 600;
}

.date-input {
  width: 100%;
  height: 43px;
  margin-bottom: 17px;
  padding: 0 12px;
  border: 1px solid #d6d5cf;
  border-radius: 4px;
  color: var(--ink);
  background: #faf9f5;
  font: 600 15px/1 Inter, sans-serif;
}

.range-wrap {
  display: block;
}

input[type="range"] {
  --range-progress: 45%;
  width: 100%;
  height: 20px;
  margin: 0;
  appearance: none;
  background: transparent;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(to right, var(--amber) 0 var(--range-progress), #dcddd7 var(--range-progress) 100%);
}

input[type="range"]::-moz-range-track {
  height: 4px;
  border-radius: 2px;
  background: #dcddd7;
}

input[type="range"]::-moz-range-progress {
  height: 4px;
  border-radius: 2px;
  background: var(--amber);
}

input[type="range"]::-webkit-slider-thumb {
  width: 18px;
  height: 18px;
  margin-top: -7px;
  appearance: none;
  border: 3px solid #fffefa;
  border-radius: 50%;
  background: var(--amber-dark);
  box-shadow: 0 0 0 1px var(--amber-dark), 0 1px 3px rgba(0,0,0,.22);
}

input[type="range"]::-moz-range-thumb {
  width: 13px;
  height: 13px;
  border: 3px solid #fffefa;
  border-radius: 50%;
  background: var(--amber-dark);
  box-shadow: 0 0 0 1px var(--amber-dark), 0 1px 3px rgba(0,0,0,.22);
}

.range-ticks,
.range-endpoints {
  display: flex;
  justify-content: space-between;
  color: #596368;
  font: 500 13px/1 Inter, sans-serif;
}

.range-ticks { margin-top: 3px; }

.quick-times,
.season-presets {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
  margin-top: 16px;
}

.quick-times button {
  min-width: 0;
  height: 33px;
  padding: 0 3px;
  border: 1px solid #d9d8d2;
  border-radius: 4px;
  color: #5c666c;
  background: #f8f7f2;
  font: 600 13px/1 Inter, sans-serif;
  cursor: pointer;
}

.quick-times button:hover,
.quick-times button.selected {
  border-color: #bd892e;
  color: #875a10;
  background: #fff8e9;
}

.season-presets {
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
  margin: -7px 0 17px;
}

.season-presets button {
  height: 32px;
  padding: 0 4px;
  border: 1px solid #d9d8d2;
  border-radius: 4px;
  color: #5c666c;
  background: #f8f7f2;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.season-presets button:hover,
.season-presets button.selected {
  border-color: #608d8c;
  color: #2c696c;
  background: #eff7f5;
}

.photo-match-button {
  width: 100%;
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: -8px 0 16px;
  padding: 7px 10px;
  border: 1px solid #d2a85c;
  border-radius: 4px;
  color: #6e4a13;
  background: #fff9eb;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.photo-match-button small {
  color: #886f47;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.photo-match-button:hover,
.photo-match-button.selected {
  border-color: #a66f17;
  background: #fff2d4;
  box-shadow: inset 3px 0 #d29a37;
}

.play-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 15px;
}

.play-button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  border: 0;
  border-radius: 4px;
  color: #fff;
  background: var(--ink);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.play-button:hover { background: #26343c; }
.play-icon { font-size: 11px; }

.speed-select {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #697278;
  font-size: 13px;
}

.speed-select select {
  height: 36px;
  padding: 0 24px 0 8px;
  border: 1px solid #d8d7d1;
  border-radius: 4px;
  color: var(--ink);
  background: #faf9f5;
  font-size: 13px;
}

.panel-note {
  margin: -3px 0 13px;
  color: #717a7e;
  font-size: 13px;
}

.building-list {
  border-top: 1px solid var(--soft-line);
}

.building-row {
  display: grid;
  grid-template-columns: 25px minmax(0, 1fr) 58px;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  border-bottom: 1px solid var(--soft-line);
}

.building-swatch {
  width: 19px;
  height: 19px;
  display: grid;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 3px;
  color: var(--building-color, var(--amber-dark));
  background: color-mix(in srgb, var(--building-color, var(--amber)) 15%, white);
  font: 700 13px/1 Inter, sans-serif;
}

.building-name {
  min-width: 0;
  color: #414c52;
  font-size: 13px;
  font-weight: 600;
}

.height-control {
  position: relative;
}

.height-control input {
  width: 100%;
  height: 32px;
  padding: 0 20px 0 7px;
  border: 1px solid #d9d8d2;
  border-radius: 4px;
  color: var(--ink);
  background: #faf9f5;
  font: 700 13px/1 Inter, sans-serif;
}

.height-control span {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  color: #8a9193;
  font-size: 13px;
  pointer-events: none;
}

.calibration-panel input[type="range"]::-webkit-slider-runnable-track {
  background: linear-gradient(to right, var(--cyan) 0 var(--range-progress), #dcddd7 var(--range-progress) 100%);
}

.calibration-panel input[type="range"]::-webkit-slider-thumb {
  background: var(--cyan);
  box-shadow: 0 0 0 1px var(--cyan), 0 1px 3px rgba(0,0,0,.22);
}

.offset-label { margin-top: 16px; }

.source-note {
  display: grid;
  grid-template-columns: 25px 1fr;
  gap: 10px;
  padding: 10px 5px 16px;
  color: #646d71;
}

.source-note p {
  margin: 0;
  font-size: 13px;
  line-height: 1.75;
}

.note-mark {
  width: 23px;
  height: 23px;
  display: grid;
  place-items: center;
  border: 1px solid #a8afb0;
  border-radius: 50%;
  font: 700 12px/1 Georgia, serif;
}

.footer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-width: 0;
  padding: 0 22px;
  border-top: 1px solid var(--line);
  color: #757d80;
  background: #f7f5f0;
  font-size: 13px;
  white-space: nowrap;
}

@media (max-width: 1080px) {
  :root { --header-h: 70px; }
  .workspace { grid-template-columns: minmax(440px, 1fr) 370px; }
  .control-column { padding: 10px; }
  .panel { padding: 15px; }
  .map-status { display: none; }
}

@media (max-width: 820px) {
  html,
  body { height: auto; overflow: auto; }
  .app-shell { display: block; height: auto; }
  .topbar { height: 70px; padding: 0 16px; }
  .topbar-meta .meta-divider,
  .topbar-meta #header-date { display: none; }
  .workspace { display: block; }
  .map-column { height: min(76vh, 720px); grid-template-rows: 44px minmax(0, 1fr) 48px; }
  .control-column { overflow: visible; padding: 12px; }
  .footer-bar { min-height: 52px; flex-wrap: wrap; padding: 8px 14px; white-space: normal; }
}

@media (max-width: 520px) {
  body { font-size: 16px; }
  .topbar { height: 66px; }
  .brand-mark { width: 34px; height: 34px; flex-basis: 34px; }
  .brand-lockup { gap: 10px; }
  .brand-lockup h1 { font-size: 21px; }
  .eyebrow { font-size: 13px; }
  .topbar-meta { font-size: 13px; }
  .map-column { height: 70vh; min-height: 520px; }
  .layer-button { padding: 0 7px; }
  .map-caption { padding: 0 13px; }
  .caption-coords { display: none; }
  .north-badge { top: 12px; right: 10px; transform: scale(.9); }
  .map-scale { left: 12px; bottom: 12px; }
  .panel { padding: 16px; }
  .quick-times { grid-template-columns: repeat(3, 1fr); }
  .play-row { align-items: stretch; }
  .play-button { flex: 1; }
  .footer-bar { font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
  }
}
