/* 视觉体系沿用「微城」miniature-city：雾蓝径向渐变、编辑式排版、深青强调色 */
:root {
  --background: #d7e2e8;
  --foreground: #263f4c;
  --muted: #617985;
  --muted-2: #6b8490;
  --line: #829da933;
  --line-strong: #829da955;
  --primary: #294f5e;
  --ring: #308d91;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: Arial, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  color: var(--foreground);
  background: var(--background);
  overflow: hidden;
}
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; cursor: pointer; color: inherit; }
button:focus-visible, a:focus-visible { outline: 3px solid var(--ring); outline-offset: 4px; }
a { color: inherit; text-decoration: none; }
svg { display: block; flex: none; }

.city-app {
  position: relative; min-height: 820px; height: 100svh; overflow: hidden;
  background: radial-gradient(ellipse at 45% 40%, #d7e3eb 0%, #c7d7e1 67%, #b9cedc 100%);
  transition: color 1.5s;
}
.city-app::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse at 40% 35%, #344c61, #1b2e40 75%, #142532);
  opacity: 0; transition: opacity 2s;
}
.city-app.night { color: #e2eaf0; }
.city-app.night::before { opacity: 1; }

/* 页眉 */
.masthead { position: absolute; z-index: 5; top: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: space-between; padding: 30px 42px; }
.brand { display: flex; align-items: center; gap: 12px; font-weight: 600; font-size: 19px; letter-spacing: 3px; }
.brand-caption { font-size: 13px; font-weight: 400; letter-spacing: 1px; margin-left: 20px; border-left: 1px solid var(--line-strong); padding-left: 24px; color: var(--muted); }
.edition { font-size: 13px; letter-spacing: 2px; color: var(--muted); }

/* 城市标题 */
.intro { position: absolute; top: 125px; left: 5%; z-index: 3; pointer-events: none; }
.eyebrow { font-size: 12px; letter-spacing: 3px; margin: 0 0 18px; color: var(--muted); }
.intro h1 { font-size: 52px; font-weight: 450; letter-spacing: 5px; line-height: 1.16; margin: 0; }
.intro h1 span { display: block; font-size: 20px; letter-spacing: 1px; margin-top: 12px; color: var(--muted); }
.coordinates { font-family: monospace; font-size: 12px; letter-spacing: 1px; color: var(--muted-2); margin-top: 22px; }
.model-tag { display: inline-block; margin-top: 8px; font-size: 12px; letter-spacing: 1px; color: #607e8a; }

/* 三维场景 */
.scene-wrap { position: absolute; inset: 0; z-index: 1; }
/* 模型的构图框：画布铺满整页，相机视口偏移让城市落在此框中 */
.scene-frame { position: absolute; inset: 40px 170px 215px 0; pointer-events: none; visibility: hidden; }
.three-host { position: absolute; inset: 0; cursor: grab; touch-action: none; }
.three-host:active { cursor: grabbing; }
.three-host canvas { display: block; width: 100%; height: 100%; }

/* 天气卡 */
.weather-card { position: absolute; z-index: 4; right: 4.5%; top: 148px; width: 210px; padding: 17px 0 0; border-top: 1px solid #809ba54d; }
.weather-heading { display: flex; align-items: center; justify-content: space-between; }
.weather-heading .eyebrow { margin: 0; }
.local-time { color: var(--muted); margin: 4px 0 15px; font-size: 13px; }
.temperature { display: flex; align-items: center; justify-content: space-between; margin: 20px 0 6px; }
.temperature > span:first-child { font-size: 78px; font-weight: 300; line-height: 1.1; letter-spacing: -5px; }
.temperature b { font-weight: 300; }
.temperature sup { font-size: 38px; vertical-align: top; position: relative; top: 4px; margin-left: 5px; }
.weather-icon { color: #7c9cab; }
.weather-description { display: flex; justify-content: space-between; align-items: center; margin-top: 15px; font-size: 16px; }
.range { font-size: 14px; color: var(--muted-2); }
.weather-metrics { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-top: 25px; padding: 19px 0; display: flex; flex-direction: column; gap: 18px; }
.weather-metrics > div { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--muted); }
.weather-metrics strong { font-size: 14px; font-weight: 400; margin-left: auto; color: #2f4b58; }
.sun-times { display: flex; justify-content: space-between; margin: 18px 0 12px; font-size: 13px; color: var(--muted); }
.sun-times > span { display: flex; gap: 8px; align-items: center; }
.sun-times em { font-style: normal; }
.hours { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; margin: 0 -6px; padding-bottom: 2px; }
.hours::-webkit-scrollbar { display: none; }
.hr { flex: 0 0 auto; width: 40px; padding: 7px 0 6px; border: 0; border-radius: 14px; background: transparent; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 5px; font-size: 11px; transition: background .2s, color .2s; }
.hr:hover { background: #ffffff78; }
.hr strong { font-weight: 400; font-size: 13px; color: #2f4b58; font-variant-numeric: tabular-nums; }
.hr.on { background: var(--primary); color: #d9e7ec; }
.hr.on strong { color: #fff; }
.data-status { font-size: 12px; color: #5d7c87; margin-top: 12px; display: flex; align-items: center; gap: 7px; }
.data-status i { width: 5px; height: 5px; flex: none; border-radius: 50%; background: #4c8b76; }
.data-status.warning { color: #966238; }
.data-status.warning i { background: #ae773c; }

/* 图标按钮与视角工具 */
.icon-button { display: inline-flex; justify-content: center; align-items: center; width: 40px; height: 40px; border: 0; background: transparent; color: inherit; border-radius: 50%; transition: background .2s; }
.icon-button:hover { background: #ffffff78; }
.icon-button:disabled { opacity: .4; cursor: default; }
.icon-button.selected { background: #e7f4f2; color: #286c69; }
.refresh { width: 30px; height: 30px; }
.spinning svg { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.view-tools { position: absolute; right: 4.5%; bottom: 215px; z-index: 4; display: flex; align-items: center; gap: 3px; background: #edf4f569; border: 1px solid #fff6; padding: 5px; border-radius: 32px; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.view-tools > span { height: 19px; width: 1px; background: #829da94d; margin: 0 3px; }
.scene-caption { position: absolute; bottom: 237px; left: 40%; transform: translateX(-50%); display: flex; gap: 8px; color: #607e8a; font-size: 12px; align-items: center; z-index: 3; pointer-events: none; white-space: nowrap; }

/* 氛围控制 */
.atmosphere-controls { position: absolute; bottom: 48px; left: 50%; transform: translateX(-50%); z-index: 5; width: 700px; max-width: calc(100% - 40px); }
.mode-list { display: flex; width: 100%; height: 56px; border-radius: 36px; background: #eff5f5aa; border: 1px solid #fff9; padding: 5px; gap: 1px; backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); box-shadow: 0 8px 28px #64818b13; }
.mode-button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 5px; border: 0; border-radius: 27px; height: 44px; padding: 12px 8px; background: transparent; color: #5a7582; font-size: 14px; white-space: nowrap; transition: background .25s, color .25s; }
.mode-button:hover { color: #294f5e; }
.mode-button.on { background: #294f5e; color: #fff; box-shadow: 0 2px 9px #2d4f6026; }
.mode-explanation { font-size: 12px; text-align: center; color: #66818d; padding-top: 3px; min-height: 24px; margin: 6px 0 0; }
.time-controls { display: flex; align-items: center; gap: 12px; height: 39px; color: #557580; }
.time-controls .icon-button { width: 30px; height: 30px; flex-shrink: 0; }
.time-label { font-variant-numeric: tabular-nums; font-size: 13px; min-width: 36px; }
.cycle-note { font-size: 11px; white-space: nowrap; }
.motion-toggle { background: transparent; border: 1px solid var(--line-strong); border-radius: 16px; padding: 5px 9px; font-size: 11px; white-space: nowrap; transition: background .2s, color .2s; }
.motion-toggle[aria-pressed=true] { background: #294f5e; border-color: #294f5e; color: #fff; }

input[type=range] { -webkit-appearance: none; appearance: none; flex: 1; height: 16px; background: transparent; margin: 0; cursor: pointer; }
input[type=range]::-webkit-slider-runnable-track { height: 3px; border-radius: 3px; background: linear-gradient(to right, #6f9aa6 var(--p, 50%), #c2d3dc var(--p, 50%)); }
input[type=range]::-moz-range-track { height: 3px; border-radius: 3px; background: #c2d3dc; }
input[type=range]::-moz-range-progress { height: 3px; border-radius: 3px; background: #6f9aa6; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; margin-top: -5.5px; border-radius: 50%; background: #fff; border: 1.5px solid #3d7a86; box-shadow: 0 1px 3px #29495a33; }
input[type=range]::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 1.5px solid #3d7a86; }

/* 页脚与提示 */
.page-footer { position: absolute; bottom: 22px; left: 42px; right: 42px; display: flex; justify-content: space-between; gap: 15px; font-size: 12px; color: #587480; z-index: 4; }
.page-footer a { display: flex; gap: 4px; align-items: center; }
.tip { position: fixed; z-index: 9; pointer-events: none; padding: 9px 13px; border-radius: 14px; background: #edf4f5e6; color: #33505c; font-size: 12px; line-height: 1.55; box-shadow: 0 6px 20px #29495a1f; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); opacity: 0; transform: translate(14px, 14px); transition: opacity .15s; max-width: 250px; }
.tip b { display: block; font-size: 13px; font-weight: 600; color: #263f4c; }
.tip.show { opacity: 1; }
.loading { position: absolute; inset: 0; z-index: 10; display: grid; place-items: center; background: radial-gradient(ellipse at 45% 40%, #d7e3eb 0%, #c7d7e1 67%, #b9cedc 100%); color: var(--muted); font-size: 14px; letter-spacing: 2px; transition: opacity .8s; }
.loading.done { opacity: 0; pointer-events: none; }

/* 夜间 */
.night .intro h1 span, .night .coordinates, .night .eyebrow, .night .brand-caption, .night .edition, .night .local-time, .night .range,
.night .weather-metrics > div, .night .sun-times, .night .data-status, .night .scene-caption, .night .model-tag, .night .page-footer,
.night .mode-explanation, .night .hr, .night .time-controls { color: #acc1ce; }
.night .weather-metrics strong, .night .hr strong { color: #e1eaf1; }
.night .mode-list, .night .view-tools { background: #32495baa; border-color: #6c849544; }
.night .mode-button { color: #bed0da; }
.night .mode-button.on { background: #c9dde7; color: #1b3c4e; }
.night .icon-button:hover, .night .hr:hover { background: #65839766; }
.night .hr.on { background: #c9dde7; color: #1b3c4e; }
.night .hr.on strong { color: #1b3c4e; }
.night .motion-toggle[aria-pressed=true] { background: #c9dde7; border-color: #c9dde7; color: #1b3c4e; }
.night input[type=range]::-webkit-slider-runnable-track { background: linear-gradient(to right, #9ec9cc var(--p, 50%), #476171 var(--p, 50%)); }
.night .tip { background: #2a3f50e6; color: #d5e2ea; }
.night .tip b { color: #fff; }

@media (min-width: 1600px) {
  .intro { top: 17%; left: 6%; }
  .intro h1 { font-size: 64px; }
  .weather-card { top: 20%; right: 6%; width: 240px; }
  .scene-frame { inset: 50px 170px 190px 20px; }
}
@media (max-width: 1050px) and (min-width: 761px) {
  .scene-frame { right: 110px; top: 130px; bottom: 215px; }
  .intro { left: 32px; top: 110px; }
  .intro h1 { font-size: 40px; }
  .weather-card { right: 28px; width: 175px; top: 130px; }
  .temperature > span:first-child { font-size: 62px; }
  .brand-caption { display: none; }
  .view-tools { bottom: 248px; right: 28px; }
  .page-footer { bottom: 18px; }
  .mode-button span { display: none; }
}
@media (max-width: 760px) {
  .city-app { min-height: 840px; }
  .masthead { padding: 20px 18px; }
  .brand { font-size: 16px; gap: 7px; }
  .brand-caption, .model-tag, .coordinates, .feels { display: none; }
  .intro { top: 98px; left: 24px; }
  .intro h1 { font-size: 34px; }
  .intro h1 span { font-size: 17px; margin-top: 7px; }
  .eyebrow { letter-spacing: 2px; margin-bottom: 14px; }
  .coordinates { letter-spacing: 0; margin-top: 17px; }
  .weather-card { top: 98px; right: 24px; width: 133px; padding: 0; border: 0; }
  .local-time { white-space: nowrap; margin-bottom: 4px; font-size: 12px; }
  .temperature { margin: 11px 0 3px; }
  .temperature > span:first-child { font-size: 53px; letter-spacing: -2px; }
  .temperature sup { font-size: 25px; }
  .weather-description { font-size: 14px; margin-top: 8px; }
  .range { font-size: 12px; }
  .weather-metrics, .sun-times, .hours { display: none; }
  .scene-frame { inset: 235px -12px 238px -12px; }
  .scene-caption { left: 50%; bottom: 250px; }
  .view-tools { right: 20px; bottom: 282px; padding: 3px; gap: 0; }
  .icon-button { width: 35px; height: 35px; }
  .atmosphere-controls { bottom: 61px; width: calc(100% - 32px); }
  .mode-list { height: 56px; }
  .mode-button { font-size: 11px; padding: 6px 2px; gap: 3px; flex-direction: column; height: 46px; }
  .cycle-note { display: none; }
  .time-controls { gap: 8px; }
  .page-footer { left: 22px; right: 22px; bottom: 17px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
