:root {
  --ink: #efe6cf; --ink-dim: rgba(239,230,207,.62); --hero-ink: #efe6cf; --hero-dark: #1d150d;
  --accent: #f2c12e; --accent-ink: #141414; --panel: rgba(10,13,21,.58); --line: rgba(255,255,255,.14);
  --display: 'Limelight', serif; --dscale: 1;
  --ui: 'Instrument Sans', system-ui, -apple-system, sans-serif;
  --radius: 22px; --gap: 14px;
  --rail-w: 292px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 90px; }
body {
  margin: 0; min-height: 100svh; font: 400 15px/1.45 var(--ui); color: var(--ink);
  background: #0b0e16; overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
#sky { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 0; display: block; }
.grain {
  position: fixed; inset: 0; z-index: 1; pointer-events: none; opacity: .07; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.top, .rail, main, .foot { position: relative; z-index: 2; }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 8px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ic { width: 22px; height: 22px; flex: none; }
.muted { color: var(--ink-dim); }

/* ---------- header ---------- */
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: max(14px, env(safe-area-inset-top)) 20px 10px; color: var(--hero-ink); transition: color .6s;
}
body.on-light .top { color: var(--hero-dark); }
.brand { display: flex; flex-direction: column; text-decoration: none; line-height: 1; }
.mark { font: italic 400 30px/1 'Instrument Serif', serif; letter-spacing: -.01em; }
.tag { font: 600 10px/1.2 var(--ui); letter-spacing: .16em; text-transform: uppercase; opacity: .72; margin-top: 4px; }
.top-actions { display: flex; gap: 8px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 8px 14px;
  background: rgba(10,12,18,.42); border: 1px solid rgba(255,255,255,.2); color: #fff;
  font: 600 13px/1 var(--ui); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  transition: transform .15s, background .2s;
}
.pill:hover { background: rgba(10,12,18,.6); }
.pill:active { transform: scale(.97); }
.pill-accent { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.pill { white-space: nowrap; }
.pill .short { display: none; }
@media (max-width: 480px) {
  .pill .long { display: none; } .pill .short { display: inline; }
  .tag { font-size: 9px; letter-spacing: .12em; }
  .mark { font-size: 27px; }
}
.pill-accent:hover { background: var(--accent); filter: brightness(1.08); }

/* ---------- rail ---------- */
.rail {
  display: flex; gap: 8px; overflow-x: auto; padding: 6px 16px 12px; scroll-snap-type: x proximity;
  scrollbar-width: none; position: sticky; top: 0;
}
.rail::-webkit-scrollbar { display: none; }
.rail-title { display: none; }
.place {
  scroll-snap-align: center; flex: none; display: grid; grid-template-columns: 36px auto auto; align-items: center; gap: 10px;
  padding: 6px 12px 6px 6px; border-radius: 16px; text-decoration: none; color: #f6f2ea;
  background: rgba(10,12,18,.55); border: 1px solid rgba(255,255,255,.1);
  backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px) saturate(1.2);
  transition: border-color .25s, background .25s, transform .15s;
}
.place:hover { background: rgba(10,12,18,.72); }
.place:active { transform: scale(.98); }
.place.on { border-color: var(--w-accent); box-shadow: 0 0 0 1px var(--w-accent) inset; background: rgba(10,12,18,.8); }
.sw { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; color: #fff; box-shadow: inset 0 0 0 1px rgba(255,255,255,.15); }
.sw .ic { width: 20px; height: 20px; filter: drop-shadow(0 1px 2px rgba(0,0,0,.4)); }
.pn { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.nm { white-space: nowrap; }
.cd { display: none; font-size: 11.5px; color: rgba(246,242,234,.6); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pt { font: 600 15px/1 var(--ui); font-variant-numeric: tabular-nums; }

/* ---------- main ---------- */
main { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 16px 24px; display: flex; flex-direction: column; gap: var(--gap); }

.hero {
  min-height: calc(62svh - 120px); padding: 4svh 6px 2svh; color: var(--hero-ink); transition: color .6s;
  display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-start;
  text-shadow: 0 1px 18px rgba(0,0,0,.28);
}
body.on-light .hero { color: var(--hero-dark); text-shadow: 0 1px 16px rgba(255,255,255,.25); }
.where { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font: 600 11.5px/1.3 var(--ui); letter-spacing: .14em; text-transform: uppercase; opacity: .85; }
.where .sep { width: 4px; height: 4px; border-radius: 50%; background: currentColor; opacity: .7; }
.where time { font-variant-numeric: tabular-nums; }
.name { margin: 10px 0 0; font: 400 calc(clamp(40px, 7.4vw, 84px) * var(--dscale))/1 var(--display); letter-spacing: -.005em; }
.temp { font: 400 calc(clamp(112px, 22vw, 210px) * var(--dscale))/.86 var(--numfont, var(--display)); margin: 10px 0 2px -4px; font-variant-numeric: tabular-nums; display: flex; }
.temp .deg { font: 300 .42em/1 var(--ui); margin-top: .08em; opacity: .9; align-self: flex-start; }
.cond { margin: 8px 0 0; display: flex; align-items: center; gap: 10px; font: 500 21px/1.2 var(--ui); }
.cond .ic { width: 28px; height: 28px; }
.hilo { margin: 8px 0 0; display: flex; flex-wrap: wrap; gap: 6px 16px; font: 500 15px/1.3 var(--ui); opacity: .9; font-variant-numeric: tabular-nums; }
.hilo .feels { opacity: .78; }
.back { margin-top: 16px; text-shadow: none; }
.clocknote { margin: auto 0 0; padding-top: 20px; font-size: 12px; opacity: .78; text-shadow: 0 1px 3px rgba(0,0,0,.55), 0 0 14px rgba(0,0,0,.4); }
body.on-light .clocknote { text-shadow: 0 0 10px rgba(255,255,255,.5); }

/* ---------- panels: the four personalities ---------- */
.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px;
  backdrop-filter: blur(20px) saturate(1.25); -webkit-backdrop-filter: blur(20px) saturate(1.25);
  color: var(--ink); transition: background-color .5s, color .5s, border-color .5s;
  box-shadow: 0 10px 40px rgba(0,0,0,.18);
}
body.s-parchment .panel {
  border-radius: 6px; backdrop-filter: none; -webkit-backdrop-filter: none;
  background:
    radial-gradient(120% 90% at 0% 0%, rgba(255,250,235,.55), transparent 55%),
    radial-gradient(90% 80% at 100% 100%, rgba(150,100,40,.22), transparent 60%),
    var(--panel);
  border: 1px solid rgba(58,41,21,.35);
  box-shadow: 0 12px 34px rgba(0,0,0,.4), inset 0 0 50px rgba(120,80,30,.2);
}
body.s-parchment .panel .eyebrow { font-family: 'IM Fell English', serif; font-style: italic; text-transform: none; letter-spacing: .02em; font-size: 15px; font-weight: 400; color: var(--accent); }
body.s-cutout .panel {
  border: 3px solid #151b22; border-radius: 16px; backdrop-filter: none; -webkit-backdrop-filter: none;
  box-shadow: 6px 6px 0 #151b22; transform: rotate(var(--tilt, 0deg));
}
body.s-cutout .panel .eyebrow { color: #e8402c; }
body.s-neon .panel {
  border-radius: 3px; border: 1px solid rgba(37,226,255,.42); position: relative; overflow: hidden;
  box-shadow: 0 0 26px rgba(37,226,255,.12), inset 0 0 40px rgba(255,63,164,.06);
}
body.s-neon .panel::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(255,255,255,.035) 0 1px, transparent 1px 3px);
}
body.s-neon .panel .eyebrow { color: #25e2ff; text-shadow: 0 0 10px rgba(37,226,255,.6); }

.eyebrow { margin: 0; font: 600 11px/1.3 var(--ui); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-dim); display: flex; align-items: center; gap: 6px; }
.note { margin: 6px 0 0; font-size: 13px; line-height: 1.4; color: var(--ink-dim); }

/* alerts */
.alerts { display: flex; flex-direction: column; gap: 10px; }
.alerts:empty { display: none; }
.alert { display: flex; gap: 14px; align-items: flex-start; padding: 14px 16px; }
.alert strong { display: block; font-size: 15px; }
.alert p { margin: 3px 0 0; font-size: 14px; color: var(--ink-dim); }
.badge { flex: none; font: 700 10.5px/1 var(--ui); letter-spacing: .12em; text-transform: uppercase; padding: 6px 8px; border-radius: 6px; margin-top: 1px; background: #d9a52a; color: #1a1205; }
.alert.warning .badge { background: #e2412b; color: #fff; }
body.s-cutout .badge { border: 2px solid #151b22; }

/* hourly */
.phead { display: flex; flex-direction: column; gap: 6px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.summary { margin: 0; font-size: 15px; }
.hours { display: flex; gap: 2px; overflow-x: auto; padding: 10px 0 2px; scrollbar-width: none; scroll-snap-type: x proximity; -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent); mask-image: linear-gradient(90deg, #000 88%, transparent); }
.hours::-webkit-scrollbar { display: none; }
.hour {
  flex: none; width: 60px; scroll-snap-align: start; display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 10px 4px; border-radius: 14px; background: transparent; border: 1px solid transparent; transition: background .2s, border-color .2s;
}
.hour:hover { background: color-mix(in srgb, var(--ink) 8%, transparent); }
.hour[aria-pressed="true"] { background: color-mix(in srgb, var(--accent) 22%, transparent); border-color: var(--accent); }
.hour .h { font: 600 13px/1 var(--ui); color: var(--ink-dim); font-variant-numeric: tabular-nums; }
.hour:first-child .h { color: var(--ink); }
.hour .p { font: 600 11px/1 var(--ui); color: #6fc3ff; min-height: 11px; }
body.s-parchment .hour .p, body.s-cutout .hour .p { color: #1f6fb2; }
.hour .t { font: 600 16px/1 var(--ui); font-variant-numeric: tabular-nums; }

/* columns */
.cols { display: grid; gap: var(--gap); grid-template-columns: 1fr; }
.week .days { list-style: none; margin: 8px 0 0; padding: 0; }
.days li { display: grid; grid-template-columns: 52px 26px 38px 40px 1fr 40px; align-items: center; gap: 8px; padding: 9px 0; border-top: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.days li:first-child { border-top: 0; }
.days .dn { font-weight: 600; }
.days .pp { font: 600 12px/1 var(--ui); color: #6fc3ff; }
body.s-parchment .days .pp, body.s-cutout .days .pp { color: #1f6fb2; }
.days .lo { text-align: right; color: var(--ink-dim); }
.days .hi { font-weight: 600; }
.bar { position: relative; height: 6px; border-radius: 4px; background: color-mix(in srgb, var(--ink) 14%, transparent); }
.bar i { position: absolute; top: 0; bottom: 0; border-radius: 4px; }
.bar b { position: absolute; top: 50%; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; background: var(--ink); box-shadow: 0 0 0 2px var(--panel); }
body.s-parchment .bar b, body.s-cutout .bar b { box-shadow: 0 0 0 2px #fff; }

.almanac { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-content: start; }
.eyebrow-out {
  grid-column: 1 / -1; justify-self: start; color: var(--ink); padding: 6px 10px; border-radius: 999px;
  background: var(--panel); border: 1px solid var(--line); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
body.s-parchment .eyebrow-out { font-family: 'IM Fell English', serif; font-style: italic; text-transform: none; letter-spacing: .02em; font-size: 14px; font-weight: 400; color: var(--accent); }
body.s-cutout .eyebrow-out { border: 2px solid #151b22; color: #e8402c; }
.tile { display: flex; flex-direction: column; min-height: 150px; padding: 14px 16px; }
.tile .val { margin: 8px 0 0; font: 400 calc(28px * var(--dscale))/1.1 var(--display); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tile .val small { font: 500 14px var(--ui); color: var(--ink-dim); }
.tile .note { margin-top: auto; padding-top: 8px; }
.gauge { display: block; height: 4px; margin-top: 10px; border-radius: 3px; background: color-mix(in srgb, var(--ink) 14%, transparent); overflow: hidden; }
.gauge i { display: block; height: 100%; border-radius: 3px; background: var(--accent); transition: width .6s cubic-bezier(.2,.7,.2,1); }
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.tile.small { min-height: 132px; }
.tile.small .val { font: 600 24px/1.1 var(--ui); font-variant-numeric: tabular-nums; }
.arrow { display: inline-grid; width: 26px; height: 26px; place-items: center; border-radius: 50%; background: color-mix(in srgb, var(--ink) 12%, transparent); transition: transform .6s; }
.arrow .ic { width: 15px; height: 15px; }

.voice blockquote { margin: 12px 0 0; font: 400 calc(23px * var(--dscale))/1.3 var(--display); }
.voice blockquote::before { content: "“"; color: var(--accent); margin-right: 2px; }
.voice blockquote::after { content: "”"; color: var(--accent); }
.pack h3 { margin: 10px 0 12px; font: 400 calc(23px * var(--dscale))/1.2 var(--display); }
.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chips li { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px; font-size: 14px; background: color-mix(in srgb, var(--ink) 10%, transparent); border: 1px solid var(--line); }
.chips .ck { width: 15px; height: 15px; color: var(--accent); }
body.s-cutout .chips li { border: 2px solid #151b22; background: #fff; }

/* ---------- twin ---------- */
.twin { padding: 22px; }
.twin h2 { margin: 8px 0 6px; font: 400 calc(30px * var(--dscale))/1.15 var(--display); }
.twin .muted { margin: 0; }
.twin-form { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.twin-form input {
  flex: 1 1 240px; min-width: 0; font: 500 16px var(--ui); color: var(--ink); padding: 12px 14px; border-radius: 12px;
  background: color-mix(in srgb, var(--ink) 8%, transparent); border: 1px solid var(--line); outline: none;
}
.twin-form input::placeholder { color: var(--ink-dim); }
.twin-form input:focus { border-color: var(--accent); }
.btn { font: 600 14px/1 var(--ui); padding: 12px 16px; border-radius: 12px; border: 1px solid transparent; background: var(--accent); color: var(--accent-ink); transition: filter .2s, transform .15s; }
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: scale(.98); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
body.s-cutout .btn { border: 2px solid #151b22; box-shadow: 3px 3px 0 #151b22; }
.hits { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.hit { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 9px 12px; border-radius: 12px; background: color-mix(in srgb, var(--ink) 8%, transparent); border: 1px solid var(--line); font-weight: 600; }
.hit span { font-weight: 400; font-size: 12px; color: var(--ink-dim); }
.twin-out { margin-top: 18px; display: flex; flex-direction: column; gap: 14px; }
.twin-out:empty { display: none; }
.loading { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45; } }
.real { margin: 0; display: flex; gap: 10px; align-items: center; }
.match { border-radius: 18px; padding: 20px; color: #fff; text-shadow: 0 1px 14px rgba(0,0,0,.35); border: 1px solid rgba(255,255,255,.16); }
.match .eyebrow { color: rgba(255,255,255,.8); }
.match .score { margin: 6px 0 10px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; line-height: 1; }
.match .pc { font: 700 clamp(56px, 10vw, 88px)/1 var(--ui); letter-spacing: -.03em; color: var(--m-accent); text-shadow: 0 2px 24px rgba(0,0,0,.45); }
.match .wn { font-size: clamp(30px, 5.4vw, 52px); }
.match .chips li { background: rgba(0,0,0,.28); border-color: rgba(255,255,255,.2); color: #fff; text-shadow: none; }
.match .actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.match .btn { background: #fff; color: #111; text-shadow: none; }
.match .btn-ghost { background: rgba(0,0,0,.25); color: #fff; border-color: rgba(255,255,255,.35); }
.ranks { list-style: none; margin: 0; padding: 0; }
.ranks a { display: grid; grid-template-columns: 22px minmax(120px, 190px) 1fr 44px; gap: 12px; align-items: center; padding: 8px 4px; text-decoration: none; border-top: 1px solid var(--line); border-radius: 6px; }
.ranks li:first-child a { border-top: 0; }
.ranks a:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); }
.rk { color: var(--ink-dim); font: 600 12px var(--ui); font-variant-numeric: tabular-nums; }
.rn { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rb { height: 6px; border-radius: 4px; background: color-mix(in srgb, var(--ink) 12%, transparent); overflow: hidden; }
.rb i { display: block; height: 100%; border-radius: 4px; }
.rs { text-align: right; font: 600 14px var(--ui); font-variant-numeric: tabular-nums; }
.least { font-size: 14px; }

/* ---------- footer, toast ---------- */
.foot { max-width: 1120px; margin: 8px auto 0; padding: 22px 22px max(28px, env(safe-area-inset-bottom)); color: rgba(255,255,255,.72); font-size: 13px; background: linear-gradient(transparent, rgba(0,0,0,.55) 30%); }
.foot p { margin: 0 0 6px; max-width: 70ch; }
.toast { position: fixed; z-index: 10; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; padding: 12px 16px; border-radius: 12px; background: rgba(10,12,18,.88); color: #fff; font-size: 14px; width: max-content; max-width: calc(100vw - 32px); text-align: center; transition: opacity .25s, transform .25s; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.noscript { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 24px; text-align: center; background: #0b0e16; color: #efe6cf; font-size: 18px; }

/* ---------- world accents that need more than variables ---------- */
body.s-cutout .hero { color: #fff; -webkit-text-stroke: 2px #151b22; paint-order: stroke fill; text-shadow: 4px 4px 0 #151b22; }
body.s-cutout .hero .where, body.s-cutout .hero .hilo, body.s-cutout .hero .cond, body.s-cutout .hero .clocknote {
  -webkit-text-stroke: 0; text-shadow: none; color: #151b22; background: #fff; border: 2.5px solid #151b22; border-radius: 10px;
  padding: 5px 10px; box-shadow: 3px 3px 0 #151b22; opacity: 1; width: fit-content;
}
body.s-cutout .hero .cond { margin-top: 14px; }
body.s-cutout .hero .back { -webkit-text-stroke: 0; text-shadow: none; background: #e8402c; color: #fff; border: 2.5px solid #151b22; box-shadow: 3px 3px 0 #151b22; backdrop-filter: none; }
body.s-neon .hero .name { text-shadow: 0 0 18px rgba(255,63,164,.7), 0 0 2px rgba(255,63,164,.9); }
body.s-neon .hero .temp { text-shadow: 0 0 24px rgba(37,226,255,.55); }
body.w-mordor .hero .name { letter-spacing: .06em; text-shadow: 0 0 22px rgba(255,90,31,.55); }
body.w-arrakis .hero .name, body.w-hoth .hero .name { letter-spacing: .08em; text-transform: uppercase; }
body.w-silenthill .hero { text-shadow: 0 0 1px rgba(0,0,0,.6), 0 1px 18px rgba(0,0,0,.35); }

/* ---------- larger screens ---------- */
@media (min-width: 720px) {
  main { padding: 0 24px 32px; }
  .cols { grid-template-columns: 1.05fr 1fr; }
  .cols-even { grid-template-columns: 1fr 1fr; }
  .tiles { grid-template-columns: repeat(3, 1fr); }
  .top { padding: 18px 28px 12px; }
}
@media (min-width: 1100px) {
  body { display: grid; grid-template-columns: var(--rail-w) minmax(0, 1fr); grid-template-rows: auto 1fr auto; }
  .top { grid-column: 1 / -1; }
  .rail {
    grid-column: 1; grid-row: 2; flex-direction: column; gap: 6px; overflow: auto; align-self: start;
    position: sticky; top: 12px; max-height: calc(100vh - 24px); padding: 4px 8px 20px 20px;
  }
  .rail-title { display: block; margin: 4px 4px 6px; font: 600 11px/1 var(--ui); letter-spacing: .16em; text-transform: uppercase; color: var(--hero-ink); opacity: .8; text-shadow: 0 1px 8px rgba(0,0,0,.4); }
  body.on-light .rail-title { color: var(--hero-dark); text-shadow: none; }
  .place { grid-template-columns: 40px 1fr auto; padding: 7px 14px 7px 7px; }
  .sw { width: 40px; height: 40px; }
  .cd { display: block; }
  main { grid-column: 2; grid-row: 2; padding: 0 32px 32px; }
  .foot { grid-column: 2; grid-row: 3; width: 100%; }
  .hero { min-height: calc(64vh - 90px); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
