@property --sky-0 { syntax: '<color>'; inherits: true; initial-value: #0a1440; }
@property --sky-1 { syntax: '<color>'; inherits: true; initial-value: #182c72; }
@property --sky-2 { syntax: '<color>'; inherits: true; initial-value: #4c5fa5; }

:root {
  --sky-0: #0a1440;
  --sky-1: #182c72;
  --sky-2: #4c5fa5;
  --ink: #e9edff;
  --muted: rgba(233, 237, 255, 0.66);
  --accent: #ffc86e;
  --accent-ink: #1a1408;
  --card: rgba(5, 10, 40, 0.4);
  --line: rgba(255, 255, 255, 0.14);
  --stars: 0;
  --sun-y: 52%;
  --sun-a: 0.5;
  --font-display: "Instrument Serif", "Noto Serif SC", "Songti SC", Georgia, serif;
  --font-body: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Noto Sans SC", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--sky-1);
  -webkit-font-smoothing: antialiased;
  padding: 0 16px calc(28px + env(safe-area-inset-bottom));
  transition: color 1.2s ease;
  overflow-x: hidden;
}
.sky {
  position: fixed; inset: 0; z-index: -2;
  background: linear-gradient(180deg, var(--sky-0) 0%, var(--sky-1) 58%, var(--sky-2) 100%);
  transition: --sky-0 2.5s ease, --sky-1 2.5s ease, --sky-2 2.5s ease;
}
.stars { position: fixed; inset: 0; z-index: -1; opacity: var(--stars); transition: opacity 2.5s ease; pointer-events: none; }
.star { position: absolute; width: 2px; height: 2px; border-radius: 50%; background: #fff; animation: twinkle 5s ease-in-out infinite; }
@keyframes twinkle { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }

.top {
  display: flex; align-items: center; justify-content: space-between;
  max-width: 560px; margin: 0 auto;
  padding: calc(14px + env(safe-area-inset-top)) 0 0;
}
.loc {
  display: inline-flex; align-items: center; gap: 6px;
  font: inherit; font-size: 14px; color: var(--ink);
  background: var(--card); border: 1px solid var(--line); border-radius: 999px;
  padding: 8px 14px 8px 12px; cursor: pointer;
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
}
.brand { text-align: right; line-height: 1.1; }
.brand-zh { display: block; font-family: var(--font-display); font-size: 20px; letter-spacing: .12em; }
.brand-en { display: block; font-family: var(--font-display); font-style: italic; font-size: 13px; color: var(--muted); letter-spacing: .04em; }

main { max-width: 560px; margin: 0 auto; }

.hero {
  position: relative; text-align: center;
  padding: 18vh 0 12vh; min-height: 62vh;
  display: flex; flex-direction: column; justify-content: center; align-items: center;
}
.scene { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.sun {
  position: absolute; left: 50%; top: var(--sun-y);
  width: 160px; height: 160px; margin-left: -80px;
  transform: translateY(-50%);
  border-radius: 50%;
  background: radial-gradient(circle, #fff8e1 0%, #ffd58c 30%, rgba(255, 176, 92, 0.35) 55%, rgba(255, 160, 80, 0) 72%);
  filter: blur(12px);
  opacity: var(--sun-a);
  transition: top 2.5s ease, opacity 2.5s ease;
}
.horizon {
  position: absolute; left: -16px; right: -16px; top: 52%; height: 1px;
  background: linear-gradient(90deg, transparent, var(--line) 30%, var(--line) 70%, transparent);
}
.eyebrow {
  position: relative; margin: 0 0 10px;
  font-size: 13px; letter-spacing: .22em; color: var(--muted);
}
.count {
  position: relative; margin: 0;
  font-family: var(--font-display); font-weight: 400;
  font-size: clamp(72px, 20vw, 132px); line-height: 1;
  letter-spacing: -0.015em; font-variant-numeric: tabular-nums;
}
.count b { font-weight: 400; }
.count i {
  font-style: normal; font-family: var(--font-body);
  font-size: .22em; color: var(--muted); margin: 0 .2em 0 .12em; letter-spacing: .05em;
}
.count .colon { display: inline-block; transform: translateY(-.08em); margin: 0 .04em; }
.count.word { font-size: clamp(56px, 15vw, 96px); letter-spacing: .06em; }
.sub {
  position: relative; margin: 16px auto 0; max-width: 34ch;
  font-size: 15px; line-height: 1.65; color: var(--muted);
}
.sub .wx { display: block; margin-top: 4px; }

.card {
  background: var(--card);
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
  border: 1px solid var(--line); border-radius: 20px;
  padding: 18px; margin: 14px 0;
  transition: background 1.2s ease;
}
.h { margin: 0 0 12px; font-size: 13px; letter-spacing: .18em; color: var(--muted); font-weight: 500; }

.win + .win { margin-top: 22px; }
.win-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.win-kind { font-family: var(--font-display); font-size: 22px; letter-spacing: .1em; }
.win-kind small { font-family: var(--font-body); font-size: 12px; color: var(--muted); margin-left: 8px; letter-spacing: .05em; }
.win-range { font-variant-numeric: tabular-nums; font-size: 14px; color: var(--muted); }
.bar { position: relative; height: 8px; border-radius: 4px; }
.bar.evening { background: linear-gradient(90deg, #f6c98c 0%, #e59a63 42%, #6d6fb0 52%, #2a3f8f 75%, #0c1747 100%); }
.bar.morning { background: linear-gradient(90deg, #0c1747 0%, #2a3f8f 25%, #6d6fb0 48%, #e59a63 58%, #f6c98c 100%); }
.bar .mark { position: absolute; top: -2px; width: 1px; height: 12px; background: rgba(255,255,255,.55); }
.bar .now {
  position: absolute; top: -6px; width: 3px; height: 20px; border-radius: 2px;
  background: #fff; box-shadow: 0 0 10px rgba(255,255,255,.9); transform: translateX(-50%);
}
.ticks { display: flex; justify-content: space-between; margin-top: 10px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ticks span { display: flex; flex-direction: column; gap: 2px; }
.ticks span:nth-child(2) { text-align: center; }
.ticks span:last-child { text-align: right; }
.ticks b { color: var(--ink); font-weight: 500; }
.empty { color: var(--muted); font-size: 14px; }

.week { list-style: none; margin: 0; padding: 0; }
.week li {
  display: grid; grid-template-columns: 6.2em 1fr auto; align-items: baseline; gap: 10px;
  padding: 10px 0; border-top: 1px solid var(--line); font-size: 14px; font-variant-numeric: tabular-nums;
}
.week li:first-child { border-top: 0; }
.week .d { color: var(--muted); }
.week li.today .d { color: var(--accent); }
.week .t { }
.week .t small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.week .w { color: var(--muted); font-size: 12px; text-align: right; white-space: nowrap; }

.row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 0; border-top: 1px solid var(--line); }
.row:first-of-type { border-top: 0; padding-top: 4px; }
.row.col { flex-direction: column; align-items: stretch; }
.row-main { min-width: 0; }
.row-title { font-size: 15px; }
.row-hint { font-size: 12.5px; color: var(--muted); margin-top: 3px; line-height: 1.5; }
label.row { cursor: pointer; }

.seg { display: inline-flex; background: rgba(255,255,255,.08); border: 1px solid var(--line); border-radius: 999px; padding: 3px; flex: none; }
.seg button {
  font: inherit; font-size: 13px; color: var(--muted); background: transparent; border: 0;
  border-radius: 999px; padding: 6px 11px; cursor: pointer; font-variant-numeric: tabular-nums;
}
.seg button[aria-checked="true"] { background: var(--ink); color: var(--sky-0); }

.switch { appearance: none; -webkit-appearance: none; width: 46px; height: 28px; border-radius: 999px; background: rgba(255,255,255,.18); position: relative; flex: none; cursor: pointer; transition: background .2s; margin: 0; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(18px); }

.actions { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  font: inherit; font-size: 14px; font-weight: 600; text-decoration: none;
  background: var(--accent); color: var(--accent-ink);
  border: 0; border-radius: 999px; padding: 12px 18px; cursor: pointer;
}
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); font-weight: 500; }

.foot { margin: 26px 4px 0; font-size: 12.5px; line-height: 1.7; color: var(--muted); }
.foot b { color: var(--ink); font-weight: 500; }

.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 9; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  background: var(--sky-0); color: var(--ink);
  border-radius: 22px 22px 0 0; padding: 10px 16px calc(20px + env(safe-area-inset-bottom));
  max-height: 78vh; overflow: auto; box-shadow: 0 -20px 60px rgba(0,0,0,.4);
  animation: rise .25s ease;
}
@keyframes rise { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet-handle { width: 36px; height: 4px; border-radius: 2px; background: rgba(255,255,255,.25); margin: 0 auto 14px; }
.sheet-head { display: flex; gap: 10px; align-items: center; }
#search {
  flex: 1; font: inherit; font-size: 16px; color: var(--ink);
  background: rgba(255,255,255,.08); border: 1px solid var(--line); border-radius: 12px; padding: 11px 14px; outline: none;
}
#search::placeholder { color: rgba(255,255,255,.4); }
.link { font: inherit; font-size: 14px; color: var(--accent); background: none; border: 0; cursor: pointer; white-space: nowrap; }
.results { list-style: none; margin: 12px 0 0; padding: 0; }
.results li { padding: 12px 4px; border-top: 1px solid var(--line); cursor: pointer; font-size: 15px; }
.results li small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.results li.note { color: var(--muted); font-size: 13.5px; cursor: default; }
.presets { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.presets button {
  font: inherit; font-size: 14px; color: var(--ink);
  background: rgba(255,255,255,.08); border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; cursor: pointer;
}

@media (prefers-reduced-motion: reduce) {
  .star { animation: none; opacity: .6; }
  .sky, .sun, .stars { transition: none; }
}
@media (min-width: 600px) {
  .hero { padding: 16vh 0 10vh; }
}

/* --- i18n / SEO additions --- */
.top { gap: 10px; }
.brand { text-align: center; flex: 1; }
.lang {
  font-size: 13px; color: var(--ink); text-decoration: none;
  background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 8px 12px;
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); white-space: nowrap;
}
.h1 { position: relative; margin: 0 0 14px; font-size: 13px; font-weight: 500; letter-spacing: .14em; color: var(--muted); text-transform: uppercase; }
html[lang^="zh"] .h1 { text-transform: none; letter-spacing: .12em; }
.h1 span { color: var(--ink); }
.eyebrow { text-transform: none; }
.prose { margin: 36px 4px 0; font-size: 15px; line-height: 1.75; color: var(--muted); }
.prose h2 { font-family: var(--font-display); font-weight: 400; font-size: 26px; letter-spacing: .01em; color: var(--ink); margin: 34px 0 8px; line-height: 1.2; }
.prose h3 { font-size: 15.5px; font-weight: 600; color: var(--ink); margin: 20px 0 4px; }
.prose p { margin: 0 0 10px; }
.prose b { color: var(--ink); font-weight: 600; }
.prose a { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line); }
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; margin: 6px 0 10px; }
.tbl th, .tbl td { text-align: left; padding: 8px 8px 8px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl th { font-weight: 600; color: var(--ink); }
.tbl td:first-child { color: var(--ink); font-weight: 500; white-space: nowrap; }
.week .t small { display: block; }
@media (max-width: 420px) { .brand-en { display: none; } .brand-zh { font-size: 17px; } }

/* --- header grid (all pages) --- */
.top { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; }
.top-l { justify-self: start; min-width: 0; }
.top-r { justify-self: end; }
a.brand { color: var(--ink); text-decoration: none; }
a.loc { text-decoration: none; }
.loc span { max-width: 38vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* --- inner pages --- */
.page { padding-top: 18px; }
.crumbs { font-size: 12.5px; color: var(--muted); margin: 18px 2px 10px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--ink); }
.crumbs .sep { opacity: .6; }
.page-h1 { font-family: var(--font-display); font-weight: 400; font-size: clamp(34px, 8.5vw, 50px); line-height: 1.08; margin: 6px 0 12px; letter-spacing: -.005em; }
.lede { font-size: 16px; line-height: 1.7; color: var(--muted); margin: 0 0 8px; }
.live { padding: 22px 18px; }
.live-k { margin: 0; font-size: 13.5px; letter-spacing: .04em; color: var(--muted); }
.live-k b { color: var(--ink); font-weight: 600; }
.live-v { margin: 6px 0 4px; font-family: var(--font-display); font-size: clamp(44px, 12vw, 68px); line-height: 1.05; font-variant-numeric: tabular-nums; }
.live-s { margin: 0 0 14px; font-size: 14.5px; color: var(--muted); line-height: 1.55; }
.live-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; margin: 0; padding-top: 14px; border-top: 1px solid var(--line); }
.live-grid div { min-width: 0; }
.live-grid dt { font-size: 12px; color: var(--muted); letter-spacing: .03em; }
.live-grid dd { margin: 2px 0 0; font-size: 15.5px; font-variant-numeric: tabular-nums; }
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 6px 0 12px; }
.tbl caption { caption-side: bottom; text-align: left; font-size: 12px; color: var(--muted); padding-top: 8px; line-height: 1.5; }
.tbl small { color: var(--muted); font-size: 11.5px; }
.tbl th[scope="row"] { color: var(--ink); font-weight: 500; white-space: nowrap; }
.tbl td { font-variant-numeric: tabular-nums; }
.week-tbl { margin: 0; }
.week-tbl tr.today th, .week-tbl tr.today td { color: var(--accent); }
.prose ul { padding-left: 1.2em; margin: 0 0 10px; }
.prose li { margin: 4px 0; }
.more .links { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr; gap: 0; }
.more .links li { border-top: 1px solid var(--line); }
.more .links li:first-child { border-top: 0; }
.more .links a { display: block; padding: 11px 0; color: var(--ink); text-decoration: none; font-size: 15px; }
.more .links a::after { content: "→"; float: right; color: var(--muted); }
@media (min-width: 600px) { .more .links { grid-template-columns: 1fr 1fr; column-gap: 24px; } .more .links li:nth-child(2) { border-top: 0; } }

/* --- footer --- */
.foot-ask { color: var(--ink); }
.foot-ask a, .foot a { color: var(--ink); }
.foot-links { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 8px 0; }
.foot-links a { color: var(--ink); text-decoration: none; }
.linkish { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line); }

/* --- UV card --- */
.uv-row { display: flex; align-items: center; gap: 10px; }
.uv-v { font-size: 18px; }
.uv-dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.uv-0 { background: #6fcf73; } .uv-1 { background: #f2d24b; } .uv-2 { background: #f39a3c; } .uv-3 { background: #e5484d; } .uv-4 { background: #a35bd8; }

/* --- forms --- */
.form { display: grid; gap: 14px; margin: 8px 0 18px; }
.form label { display: grid; gap: 6px; font-size: 14px; color: var(--ink); }
.form label small { color: var(--muted); font-size: 12px; margin-left: 6px; }
.form input, .form textarea {
  font: inherit; font-size: 16px; color: var(--ink); background: rgba(255,255,255,.08);
  border: 1px solid var(--line); border-radius: 12px; padding: 11px 13px; outline: none; width: 100%;
}
.form textarea { resize: vertical; min-height: 140px; line-height: 1.55; }
.form input:focus, .form textarea:focus { border-color: var(--accent); }
.form .hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form-status { margin: 0; font-size: 14px; color: var(--muted); min-height: 1.4em; }
.form-status.ok { color: var(--accent); }
.btn[disabled] { opacity: .6; cursor: default; }

/* --- consent banner --- */
.consent {
  position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 20;
  max-width: 560px; margin: 0 auto; padding: 16px; border-radius: 18px;
  background: rgba(8, 14, 44, .92); color: #eef1ff; border: 1px solid rgba(255,255,255,.14);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); box-shadow: 0 16px 40px rgba(0,0,0,.35);
  font-size: 13.5px; line-height: 1.6;
}
.consent p { margin: 0 0 12px; }
.consent a { color: #fff; }
.consent .actions { margin: 0; }
.consent .btn { padding: 10px 16px; font-size: 13.5px; }
.consent .btn.ghost { color: #eef1ff; border-color: rgba(255,255,255,.25); }
.consent small { display: block; margin-top: 10px; color: rgba(238,241,255,.6); font-size: 11.5px; word-break: break-all; }

[hidden] { display: none !important; }
