/* ============================================================
   ASTRAL GROVE — design system
   deep-space ink · nebula violet/teal/rose · antique gold hairlines
   ============================================================ */
:root {
  --ink: #05040f;
  --ink-2: #0b0920;
  --glass: rgba(14, 11, 34, .62);
  --glass-2: rgba(22, 18, 52, .72);
  --glass-hi: rgba(40, 32, 90, .45);
  --hair: rgba(232, 199, 122, .28);
  --hair-2: rgba(232, 199, 122, .55);
  --gold: #e8c77a;
  --gold-2: #f6e2a8;
  --ivory: #efe7d6;
  --text: #e6ddf2;
  --muted: #a79fc4;
  --faint: #6f6892;
  --violet: #8f73ff;
  --teal: #54e0cf;
  --rose: #ff86bd;
  --moss: #8fd18a;
  --ember: #ffad6b;
  --r: 18px;
  --shadow: 0 20px 60px rgba(0, 0, 0, .55), 0 2px 0 rgba(255, 255, 255, .03) inset;
  --display: 'Cinzel Decorative', 'Cinzel', serif;
  --title: 'Cinzel', serif;
  --serif: 'Cormorant Garamond', Georgia, serif;
  --sans: 'Jost', system-ui, sans-serif;
  --dock-h: 74px;
  --top-h: 64px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--ink); color: var(--text); overflow: hidden; }
body { font-family: var(--serif); font-size: 19px; line-height: 1.5; -webkit-font-smoothing: antialiased; overscroll-behavior: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
a { color: var(--gold-2); text-decoration: none; }
svg { display: block; }
::selection { background: rgba(143, 115, 255, .45); }
#gl { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; touch-action: none; outline: none; }
.nojs { position: fixed; inset: 0; display: grid; place-items: center; font-size: 22px; }
[hidden] { display: none !important; }

/* ---------- glass primitive ---------- */
.glass, .codex, .dock, .hud-card, .modal__box, .chip, .card {
  background: var(--glass);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  backdrop-filter: blur(18px) saturate(140%);
  border: 1px solid var(--hair);
  box-shadow: var(--shadow);
}

/* ---------- top bar ---------- */
.top { position: fixed; top: 0; left: 0; right: 0; height: var(--top-h); display: flex; align-items: center; gap: 16px; padding: 12px max(18px, env(safe-area-inset-right)) 0 max(18px, env(safe-area-inset-left)); z-index: 30; pointer-events: none; }
.top > * { pointer-events: auto; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--gold); }
.sigil { width: 34px; height: 34px; color: var(--gold); filter: drop-shadow(0 0 8px rgba(232, 199, 122, .45)); animation: spin 90s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.brand__name { font-family: var(--display); font-size: 20px; letter-spacing: .06em; color: var(--gold-2); text-shadow: 0 0 18px rgba(232, 199, 122, .35); }
.top__realm { flex: 1; text-align: center; font-family: var(--title); font-size: 13px; letter-spacing: .38em; text-transform: uppercase; color: var(--muted); }
.top__chips { display: flex; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px; border-radius: 999px; font-family: var(--sans); font-size: 13.5px; letter-spacing: .02em; color: var(--ivory); transition: border-color .2s, background .2s; white-space: nowrap; }
.chip:hover { border-color: var(--hair-2); background: var(--glass-2); }
.chip svg { width: 17px; height: 17px; color: var(--gold); }
.chip--icon { width: 38px; padding: 0; justify-content: center; }
.chip[aria-pressed="true"] { border-color: var(--gold); background: rgba(232, 199, 122, .14); }
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 10px var(--teal); }
.chip.is-shifted .dot { background: var(--rose); box-shadow: 0 0 10px var(--rose); }

/* ---------- dock ---------- */
.dock { position: fixed; left: 50%; bottom: max(14px, env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; gap: 2px; padding: 6px; border-radius: 24px; z-index: 30; }
.dock a { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; width: 78px; height: 60px; border-radius: 18px; color: var(--muted); font-family: var(--sans); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; transition: color .25s, background .25s; }
.dock a svg { width: 26px; height: 26px; transition: transform .35s cubic-bezier(.2, .9, .3, 1.4); }
.dock a:hover { color: var(--ivory); }
.dock a:hover svg { transform: translateY(-2px) scale(1.06); }
.dock a.is-on { color: var(--gold-2); background: linear-gradient(180deg, rgba(232, 199, 122, .16), rgba(143, 115, 255, .10)); }
.dock a.is-on::after { content: ''; position: absolute; bottom: 4px; width: 5px; height: 5px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 10px var(--gold); }

/* ---------- codex drawer ---------- */
.codex { position: fixed; top: calc(var(--top-h) + 10px); right: 16px; bottom: calc(var(--dock-h) + 30px); width: min(460px, calc(100vw - 32px)); border-radius: 22px; z-index: 25; transform: translateX(calc(100% + 40px)); opacity: 0; transition: transform .55s cubic-bezier(.2, .8, .2, 1), opacity .4s; overflow: hidden; }
.codex.is-open { transform: none; opacity: 1; }
.codex::before { content: ''; position: absolute; inset: 6px; border: 1px solid rgba(232, 199, 122, .12); border-radius: 17px; pointer-events: none; }
.codex__close { position: absolute; top: 12px; right: 12px; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: rgba(0, 0, 0, .3); z-index: 2; color: var(--muted); }
.codex__close svg { width: 18px; height: 18px; }
.codex__close:hover { color: var(--ivory); }
.codex__scroll { height: 100%; overflow-y: auto; padding: 30px 28px 34px; scrollbar-width: thin; scrollbar-color: var(--hair) transparent; }

/* ---------- typography blocks ---------- */
.kicker { font-family: var(--sans); font-size: 11.5px; letter-spacing: .32em; text-transform: uppercase; color: var(--gold); margin: 0 0 6px; }
.h-display { font-family: var(--display); font-weight: 400; font-size: clamp(30px, 4vw, 46px); line-height: 1.08; margin: 0 0 6px; color: var(--ivory); letter-spacing: .02em; }
.h-title { font-family: var(--title); font-weight: 500; font-size: 24px; letter-spacing: .06em; margin: 0 0 4px; color: var(--ivory); }
.h-sec { font-family: var(--title); font-size: 13px; letter-spacing: .3em; text-transform: uppercase; color: var(--gold); margin: 28px 0 10px; display: flex; align-items: center; gap: 12px; }
.h-sec::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, var(--hair), transparent); }
.epithet { font-style: italic; color: var(--muted); font-size: 21px; margin: 0 0 14px; }
.prose p { margin: 0 0 12px; }
.prose.drop p:first-of-type::first-letter { font-family: var(--display); float: left; font-size: 3.1em; line-height: .9; padding: 6px 8px 0 0; color: var(--gold-2); }
.muted { color: var(--muted); }
.small { font-size: 15px; }
.tag { display: inline-flex; align-items: center; gap: 6px; padding: 3px 11px; border: 1px solid var(--hair); border-radius: 999px; font-family: var(--sans); font-size: 12px; letter-spacing: .06em; color: var(--ivory); background: rgba(255, 255, 255, .03); margin: 0 6px 6px 0; cursor: default; }
button.tag { cursor: pointer; }
button.tag:hover { border-color: var(--gold); }
.lore-label { font-family: var(--sans); font-size: 10.5px; letter-spacing: .22em; text-transform: uppercase; padding: 2px 8px; border-radius: 6px; margin-right: 6px; vertical-align: 2px; }
.lore-label--sci { background: rgba(84, 224, 207, .14); color: var(--teal); }
.lore-label--lore { background: rgba(255, 134, 189, .14); color: var(--rose); }
.lore-label--care { background: rgba(255, 173, 107, .16); color: var(--ember); }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--hair); border: 1px solid var(--hair); border-radius: 14px; overflow: hidden; margin: 12px 0; }
.facts div { background: rgba(10, 8, 26, .82); padding: 10px 14px; }
.facts dt { font-family: var(--sans); font-size: 10.5px; letter-spacing: .2em; text-transform: uppercase; color: var(--faint); }
.facts dd { margin: 2px 0 0; font-size: 17px; color: var(--ivory); line-height: 1.25; }
.bullets { list-style: none; padding: 0; margin: 0; }
.bullets li { position: relative; padding: 0 0 10px 24px; }
.bullets li::before { content: '✦'; position: absolute; left: 0; top: 0; color: var(--gold); font-size: 13px; }
.quote { font-style: italic; font-size: 22px; color: var(--gold-2); text-align: center; margin: 22px 0 6px; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 46px; padding: 0 22px; border-radius: 999px; font-family: var(--title); font-size: 13.5px; letter-spacing: .2em; text-transform: uppercase; color: var(--ivory); border: 1px solid var(--hair-2); background: rgba(255, 255, 255, .04); transition: all .25s; }
.btn:hover { background: rgba(232, 199, 122, .12); border-color: var(--gold); }
.btn svg { width: 18px; height: 18px; }
.btn--gold { color: #1b1206; background: linear-gradient(180deg, #f8e3a6, #d6ac56); border-color: #f8e3a6; box-shadow: 0 0 30px rgba(232, 199, 122, .35), 0 1px 0 rgba(255, 255, 255, .6) inset; }
.btn--gold:hover { background: linear-gradient(180deg, #fff0c4, #e2b862); box-shadow: 0 0 44px rgba(232, 199, 122, .55); }
.btn--sm { min-height: 36px; padding: 0 15px; font-size: 11.5px; }
.btn--ghost { border-color: transparent; }
.icon-btn { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--hair); background: rgba(255, 255, 255, .03); color: var(--ivory); transition: all .2s; }
.icon-btn:hover { border-color: var(--gold); color: var(--gold-2); }
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn.is-on { background: rgba(232, 199, 122, .18); border-color: var(--gold); color: var(--gold-2); }

/* ---------- HUD (per-realm floating controls) ---------- */
.hud { position: fixed; left: 0; right: 0; bottom: calc(var(--dock-h) + 26px); z-index: 20; pointer-events: none; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 0 16px; }
.hud > * { pointer-events: auto; }
.hud-card { border-radius: 20px; padding: 12px 14px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center; max-width: min(980px, 100%); }
.seg { display: inline-flex; padding: 3px; border-radius: 999px; border: 1px solid var(--hair); background: rgba(0, 0, 0, .25); }
.seg button { height: 34px; padding: 0 15px; border-radius: 999px; font-family: var(--sans); font-size: 12.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.seg button.is-on { background: linear-gradient(180deg, rgba(232, 199, 122, .3), rgba(232, 199, 122, .12)); color: var(--gold-2); }
.pchips { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.pchip { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px 0 8px; border-radius: 999px; border: 1px solid var(--hair); font-family: var(--sans); font-size: 12.5px; color: var(--ivory); background: rgba(255, 255, 255, .03); }
.pchip i { width: 12px; height: 12px; border-radius: 50%; box-shadow: 0 0 8px currentColor; }
.pchip:hover, .pchip.is-on { border-color: var(--gold); background: rgba(232, 199, 122, .12); }
.speed { font-family: var(--sans); font-size: 13px; color: var(--muted); min-width: 120px; text-align: center; }
.hud-title { position: fixed; left: max(22px, env(safe-area-inset-left)); top: calc(var(--top-h) + 18px); z-index: 15; pointer-events: none; max-width: min(520px, 60vw); }
.hud-title .h-display { font-size: clamp(28px, 3.6vw, 44px); text-shadow: 0 2px 30px rgba(0, 0, 0, .8); }
.hud-title p { margin: 0; color: var(--muted); font-style: italic; text-shadow: 0 1px 12px #000; }

/* ---------- full pages (Grimoire, Rituals, Journal) ---------- */
.page { position: fixed; inset: 0; z-index: 12; overflow-y: auto; padding: calc(var(--top-h) + 26px) 20px calc(var(--dock-h) + 60px); scrollbar-width: thin; scrollbar-color: var(--hair) transparent; animation: pageIn .7s cubic-bezier(.2, .8, .2, 1); }
@keyframes pageIn { from { opacity: 0; transform: translateY(14px); } }
.wrap { max-width: 1120px; margin: 0 auto; }
.page-head { text-align: center; margin: 10px auto 30px; max-width: 760px; }
.page-head .h-display { font-size: clamp(34px, 5vw, 60px); text-shadow: 0 0 40px rgba(143, 115, 255, .35); }
.page-head p { color: var(--muted); font-style: italic; font-size: 21px; margin: 6px 0 0; }
.ornament { display: flex; align-items: center; justify-content: center; gap: 14px; color: var(--gold); margin: 12px 0; }
.ornament::before, .ornament::after { content: ''; width: 90px; height: 1px; background: linear-gradient(90deg, transparent, var(--hair-2)); }
.ornament::after { transform: scaleX(-1); }
.ornament svg { width: 14px; height: 14px; }
.grid { display: grid; gap: 16px; }
.grid--cards { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.grid--wide { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.card { position: relative; border-radius: var(--r); padding: 18px 18px 16px; text-align: left; transition: transform .35s cubic-bezier(.2, .8, .2, 1), border-color .25s, background .25s; overflow: hidden; display: block; width: 100%; color: inherit; }
button.card:hover, a.card:hover { transform: translateY(-3px); border-color: var(--hair-2); background: var(--glass-2); }
.card::after { content: ''; position: absolute; inset: 0; background: radial-gradient(120% 80% at 100% 0%, var(--accent, rgba(143, 115, 255, .16)), transparent 60%); pointer-events: none; opacity: .9; }
.card__glyph { font-size: 30px; line-height: 1; color: var(--accent-solid, var(--gold)); margin-bottom: 10px; font-family: 'Segoe UI Symbol', 'Apple Symbols', var(--serif); }
.card__title { font-family: var(--title); font-size: 17px; letter-spacing: .08em; color: var(--ivory); margin: 0; }
.card__sub { font-style: italic; color: var(--muted); font-size: 16px; margin: 2px 0 0; }
.card__meta { font-family: var(--sans); font-size: 11.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--faint); margin-top: 10px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin: 0 auto 22px; }
.tabs button { height: 38px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--hair); font-family: var(--sans); font-size: 12.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); background: rgba(10, 8, 26, .5); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.tabs button.is-on { color: #1b1206; background: linear-gradient(180deg, #f8e3a6, #d6ac56); border-color: #f8e3a6; }
.search { display: flex; align-items: center; gap: 10px; max-width: 460px; margin: 0 auto 18px; padding: 0 16px; height: 48px; border-radius: 999px; border: 1px solid var(--hair); background: rgba(10, 8, 26, .6); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.search svg { width: 18px; height: 18px; color: var(--gold); flex: none; }
.search input { flex: 1; background: none; border: 0; outline: none; color: var(--ivory); font: inherit; font-size: 18px; }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 20px; background: rgba(3, 2, 10, .55); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); animation: fadeIn .3s; }
@keyframes fadeIn { from { opacity: 0; } }
.modal__box { position: relative; width: min(560px, 100%); max-height: calc(100vh - 40px); overflow-y: auto; border-radius: 24px; padding: 30px 28px; background: var(--glass-2); }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-family: var(--sans); font-size: 11.5px; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); }
.input, textarea.input, select.input { width: 100%; min-height: 46px; padding: 10px 14px; border-radius: 14px; border: 1px solid var(--hair); background: rgba(0, 0, 0, .3); color: var(--ivory); font: inherit; font-size: 18px; outline: none; }
.input:focus { border-color: var(--gold); }
textarea.input { min-height: 140px; resize: vertical; line-height: 1.5; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.list-pick { max-height: 280px; overflow-y: auto; border: 1px solid var(--hair); border-radius: 14px; }
.list-pick button { display: flex; justify-content: space-between; width: 100%; padding: 11px 14px; border-bottom: 1px solid rgba(232, 199, 122, .08); text-align: left; }
.list-pick button:hover { background: rgba(232, 199, 122, .1); }
.list-pick small { color: var(--faint); font-family: var(--sans); font-size: 12px; }

/* ---------- toast + tooltip ---------- */
.toast { position: fixed; left: 50%; top: calc(var(--top-h) + 14px); transform: translate(-50%, -20px); z-index: 70; padding: 12px 20px; border-radius: 999px; background: var(--glass-2); border: 1px solid var(--hair-2); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); font-family: var(--sans); font-size: 14px; color: var(--ivory); opacity: 0; pointer-events: none; transition: all .45s cubic-bezier(.2, .8, .2, 1); display: flex; align-items: center; gap: 10px; }
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.toast b { color: var(--gold-2); font-weight: 500; }
.tip { position: fixed; z-index: 40; pointer-events: none; padding: 8px 12px; border-radius: 12px; background: rgba(10, 8, 26, .88); border: 1px solid var(--hair); font-family: var(--sans); font-size: 13px; color: var(--ivory); transform: translate(14px, 14px); max-width: 260px; }
.tip b { font-family: var(--title); letter-spacing: .06em; font-weight: 500; color: var(--gold-2); }

/* ---------- intro ---------- */
.intro { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 24px; background: radial-gradient(ellipse at 50% 60%, rgba(40, 20, 90, .35), rgba(5, 4, 15, .82) 70%); transition: opacity 1.2s, visibility 1.2s; }
.intro.is-gone { opacity: 0; visibility: hidden; }
.intro__inner { text-align: center; max-width: 640px; animation: pageIn 1.6s cubic-bezier(.2, .8, .2, 1); }
.intro__sigil { width: 86px; height: 86px; margin: 0 auto 18px; color: var(--gold); filter: drop-shadow(0 0 22px rgba(232, 199, 122, .6)); animation: spin 60s linear infinite; }
.intro__kicker { font-family: var(--sans); font-size: 12.5px; letter-spacing: .42em; text-transform: uppercase; color: var(--gold); margin: 0; }
.intro__title { font-family: var(--display); font-weight: 400; font-size: clamp(48px, 10vw, 104px); margin: 6px 0 12px; line-height: 1; background: linear-gradient(180deg, #fff6dc 10%, #e8c77a 55%, #a882ff 110%); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 0 30px rgba(232, 199, 122, .25)); }
.intro__lede { font-size: 21px; color: var(--text); margin: 0 auto 28px; max-width: 560px; }
.intro__small { font-family: var(--sans); font-size: 12px; letter-spacing: .12em; color: var(--faint); margin-top: 16px; }

/* ---------- red night-vision mode ---------- */
html.red { --gold: #ff5a4a; --gold-2: #ff7a66; --ivory: #ff9a8a; --text: #e8705f; --muted: #b04a3e; --faint: #7a332b; --hair: rgba(255, 70, 50, .25); --hair-2: rgba(255, 70, 50, .5); --teal: #ff5a4a; --rose: #ff5a4a; --violet: #c43a2e; }
html.red .btn--gold { background: #7a1b12; color: #ffb0a0; border-color: #ff5a4a; box-shadow: none; }
html.red .tabs button.is-on { background: #7a1b12; color: #ffb0a0; border-color: #ff5a4a; }
html.red img, html.red .card::after { filter: grayscale(1) sepia(1) hue-rotate(-50deg) saturate(3) brightness(.6); }

/* ---------- responsive ---------- */
@media (max-width: 820px) {
  :root { --dock-h: 64px; --top-h: 56px; }
  body { font-size: 18px; }
  .brand__name { display: none; }
  .top__realm { text-align: left; letter-spacing: .26em; font-size: 12px; }
  .top__chips { gap: 6px; }
  #placeText { max-width: 90px; overflow: hidden; text-overflow: ellipsis; }
  .chip { height: 34px; padding: 0 11px; font-size: 12.5px; }
  .chip--icon { width: 34px; padding: 0; }
  .dock { left: 8px; right: 8px; transform: none; justify-content: space-between; border-radius: 22px; bottom: max(8px, env(safe-area-inset-bottom)); }
  .dock a { width: auto; flex: 1; height: 52px; font-size: 9px; letter-spacing: .08em; }
  .dock a svg { width: 23px; height: 23px; }
  .codex { top: auto; left: 8px; right: 8px; width: auto; bottom: calc(var(--dock-h) + 18px); max-height: 72vh; height: 72vh; transform: translateY(calc(100% + 120px)); }
  .codex__scroll { padding: 26px 20px 30px; }
  .hud { bottom: calc(var(--dock-h) + 20px); }
  .hud-title { top: calc(var(--top-h) + 8px); max-width: 80vw; }
}
@media (max-width: 520px) {
  #timeText .t-date { display: none; }
  .top__realm { display: none; }
  .top { justify-content: space-between; }
  .facts { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ============================================================ CODEX PARTS */
.codex__back { margin: -8px 0 8px -8px; }
.codex__back svg { width: 16px; height: 16px; }
.cx-head { position: relative; padding-bottom: 4px; }
.cx-head .h-display { font-size: clamp(30px, 3.4vw, 40px); padding-right: 40px; }
.cx-glyph { font-size: 46px; line-height: 1; color: var(--accent-solid, var(--gold)); text-shadow: 0 0 24px currentColor; margin-bottom: 10px; font-family: 'Apple Symbols', 'Segoe UI Symbol', var(--serif); }
.cx-gem { display: block; width: 44px; height: 44px; transform: rotate(45deg); border-radius: 6px; background: linear-gradient(135deg, #fff8, var(--c) 40%, #0006); box-shadow: 0 0 26px var(--c); }
.cx-cultures { display: grid; gap: 10px; margin-top: 10px; }
.cx-culture { padding: 12px 14px; border-left: 2px solid var(--hair-2); background: rgba(255, 255, 255, .025); border-radius: 0 12px 12px 0; }
.cx-culture p { margin: 0; }
.cx-culture .kicker { margin-bottom: 3px; }
.cx-tone { display: flex; gap: 12px; align-items: center; margin: 14px 0; padding: 12px; border: 1px solid var(--hair); border-radius: 14px; background: rgba(143, 115, 255, .07); }
.cx-tone b { font-family: var(--title); color: var(--gold-2); font-weight: 500; }
.cx-practice { padding: 16px; border-radius: 16px; border: 1px solid var(--hair); background: linear-gradient(160deg, rgba(84, 224, 207, .07), rgba(143, 115, 255, .05)); }
.cx-steps { margin: 10px 0 14px; padding-left: 22px; }
.cx-steps li { margin-bottom: 7px; padding-left: 4px; }
.cx-steps li::marker { color: var(--gold); font-family: var(--title); font-size: .85em; }
.cx-warn { padding: 12px 14px; border-radius: 12px; background: rgba(255, 70, 70, .12); border: 1px solid rgba(255, 90, 90, .4); color: #ffb3b3; font-family: var(--sans); font-size: 14px; margin: 10px 0; }
.cx-care { padding: 10px 14px; border-radius: 12px; background: rgba(255, 173, 107, .08); border: 1px solid rgba(255, 173, 107, .25); }
.codex a[data-open], .codex a[data-sky], .codex a[data-time] { cursor: pointer; border-bottom: 1px dotted var(--hair-2); }
.codex .facts a { color: var(--gold-2); cursor: pointer; }

/* night bar (Tonight report) */
.night-bar { margin: 8px 0 14px; }
.nb { position: relative; height: 26px; border-radius: 8px; overflow: hidden; border: 1px solid var(--hair); }
.nb i { position: absolute; top: 0; bottom: 0; }
.nb-day { background: linear-gradient(180deg, #7fb3ff, #cfe3ff); }
.nb-civ { background: #4a4f8f; }
.nb-nau { background: #26285a; }
.nb-ast { background: #141433; }
.nb-night { background: #05040f; }
.nb .nb-moon { top: auto; height: 5px; bottom: 2px; background: #e8ecff; box-shadow: 0 0 8px #bfd0ff; border-radius: 3px; }
.nb-ticks { position: relative; height: 16px; font-family: var(--sans); font-size: 10.5px; color: var(--faint); }
.nb-ticks span { position: absolute; transform: translateX(-50%); top: 2px; }
.nb-ticks span:first-child { transform: none; } .nb-ticks span:last-child { transform: translateX(-100%); }
.nb-legend { display: flex; gap: 12px; flex-wrap: wrap; font-family: var(--sans); font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.nb-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; border: 1px solid var(--hair); }

/* ============================================================ HUD extras */
.scrub { display: flex; align-items: center; gap: 10px; min-width: 220px; flex: 1; max-width: 360px; }
.scrub span { font-family: var(--sans); font-size: 12.5px; color: var(--muted); min-width: 52px; text-align: right; }
input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 4px; border-radius: 4px; background: linear-gradient(90deg, rgba(143, 115, 255, .5), rgba(232, 199, 122, .6)); outline: none; }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%; background: radial-gradient(circle, #fff6d8, #e8c77a 60%); box-shadow: 0 0 14px rgba(232, 199, 122, .8); cursor: grab; border: 0; }
input[type="range"]::-moz-range-thumb { width: 20px; height: 20px; border-radius: 50%; background: #e8c77a; border: 0; }
.layers { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; padding-top: 10px; border-top: 1px solid var(--hair); margin-top: 4px; }
.bortle { flex-basis: 100%; display: flex; align-items: center; gap: 12px; font-family: var(--sans); font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.bortle b { color: var(--gold-2); font-weight: 500; white-space: nowrap; }
.bortle input { flex: 1; }

/* ============================================================ PRACTICE PLAYER */
.player { position: fixed; inset: 0; z-index: 90; display: flex; flex-direction: column; align-items: center; justify-content: center; opacity: 0; transition: opacity .6s; }
.player.is-on { opacity: 1; }
.player__bg { position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 45%, rgba(40, 26, 100, .55), rgba(3, 2, 12, .94) 70%); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.player > *:not(.player__bg):not(.player__close):not(.player__head):not(.player__ctl) { position: relative; }
.player__close { position: absolute; top: 18px; right: 18px; }
.player__head { position: absolute; top: 24px; left: 0; right: 0; text-align: center; }
.player__total { font-family: var(--sans); font-size: 13px; color: var(--muted); margin: 4px 0 0; }
.player__stage { display: flex; flex-direction: column; align-items: center; gap: 26px; padding: 0 24px; max-width: 760px; text-align: center; }
.orb { --s: .7; position: relative; width: min(58vw, 300px); height: min(58vw, 300px); display: grid; place-items: center; }
.orb__core { position: absolute; inset: 18%; border-radius: 50%; transform: scale(var(--s)); background: radial-gradient(circle at 40% 35%, #fff8e6, #e8c77a 30%, #8f73ff 70%, rgba(84, 224, 207, .2)); box-shadow: 0 0 80px rgba(232, 199, 122, .55), 0 0 160px rgba(143, 115, 255, .45); transition: transform .12s linear; }
.orb__ring { position: absolute; inset: 6%; border-radius: 50%; border: 1px solid rgba(232, 199, 122, .35); transform: scale(calc(var(--s) * 1.12)); }
.orb__ring--2 { inset: 0; border-style: dashed; border-color: rgba(143, 115, 255, .3); animation: spin 40s linear infinite; transform: none; }
.orb__prog { position: absolute; inset: -4%; width: 108%; height: 108%; transform: rotate(-90deg); }
.orb__prog circle { fill: none; stroke-width: 1.6; }
.orb__prog .bg { stroke: rgba(255, 255, 255, .06); }
.orb__prog .fg { stroke: var(--gold); stroke-linecap: round; filter: drop-shadow(0 0 4px var(--gold)); transition: stroke-dashoffset .25s linear; }
.orb__label { position: relative; font-family: var(--title); font-size: 15px; letter-spacing: .12em; text-transform: uppercase; color: #1c1330; text-align: center; max-width: 60%; line-height: 1.3; text-shadow: 0 0 10px rgba(255, 255, 255, .6); }
.orb__label small { display: block; font-size: 30px; letter-spacing: 0; font-family: var(--display); margin-top: 2px; }
.orb:not(.orb--breath) .orb__label { color: #1c1330; }
.player__step { font-size: clamp(22px, 3vw, 30px); line-height: 1.35; color: var(--ivory); max-width: 680px; min-height: 3.2em; margin: 0; opacity: 0; transform: translateY(8px); }
.player__step.is-in { animation: stepIn .9s forwards; }
@keyframes stepIn { to { opacity: 1; transform: none; } }
.player__dots { display: flex; gap: 8px; }
.player__dots i { width: 9px; height: 9px; border-radius: 50%; background: rgba(255, 255, 255, .15); cursor: pointer; transition: all .3s; }
.player__dots i.is-done { background: var(--hair-2); }
.player__dots i.is-on { background: var(--gold); box-shadow: 0 0 10px var(--gold); transform: scale(1.3); }
.player__ctl { position: absolute; bottom: max(30px, env(safe-area-inset-bottom)); display: flex; gap: 14px; }
.player__pp { width: 58px; height: 58px; }
.player.is-paused .orb__core { filter: saturate(.4) brightness(.8); }
.player__done { text-align: center; animation: pageIn 1s; }
.done-star { width: 110px; height: 110px; margin: 0 auto 14px; color: var(--gold-2); filter: drop-shadow(0 0 30px var(--gold)); animation: spin 14s linear infinite, pulse 2.4s ease-in-out infinite; }
.done-star svg { width: 100%; height: 100%; }
@keyframes pulse { 50% { filter: drop-shadow(0 0 60px var(--gold)); } }
@media (max-width: 820px) {
  .hud-card { padding: 10px; gap: 8px; }
  .scrub { min-width: 150px; }
  .hud-title .h-display { font-size: 26px; }
  .hud-title p { font-size: 15px; }
}

/* ============================================================ MOON */
.moon-card { flex-direction: column; align-items: stretch; }
.phase-strip { display: flex; gap: 2px; justify-content: center; flex-wrap: wrap; }
.phase-strip button { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 6px 4px; border-radius: 12px; font-family: var(--sans); font-size: 9.5px; letter-spacing: .06em; color: var(--faint); text-transform: uppercase; width: 74px; }
.phase-strip button:hover { color: var(--ivory); }
.phase-strip button.is-on { background: rgba(232, 199, 122, .14); color: var(--gold-2); box-shadow: inset 0 0 0 1px var(--hair-2); }
.moonic { display: block; filter: drop-shadow(0 0 4px rgba(239, 233, 216, .25)); }
.mini-facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px 18px; margin: 4px 6px 8px; }
.mini-facts dt { font-family: var(--sans); font-size: 10px; letter-spacing: .2em; text-transform: uppercase; color: var(--faint); }
.mini-facts dd { margin: 0; font-size: 16.5px; color: var(--ivory); }
.mini-facts a { cursor: pointer; color: var(--gold-2); }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal > span { font-family: var(--sans); font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--faint); text-align: center; padding-bottom: 4px; }
.cal-d { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 5px 2px; border-radius: 10px; border: 1px solid transparent; min-height: 66px; }
.cal-d b { font-family: var(--sans); font-weight: 400; font-size: 11.5px; color: var(--muted); }
.cal-d small { font-family: var(--sans); font-size: 8.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--gold); line-height: 1; }
.cal-d:hover { border-color: var(--hair); background: rgba(255, 255, 255, .03); }
.cal-d.is-today { border-color: var(--gold); }
.cal-d.is-ev { background: rgba(232, 199, 122, .06); }
@media (max-width: 820px) { .phase-strip button { width: 42px; } .phase-strip button span { display: none; } .mini-facts { grid-template-columns: repeat(2, 1fr); } }

/* ============================================================ WHEEL */
.wheel-card { flex-direction: column; align-items: stretch; width: min(760px, 100%); }
.wheel-prog { display: flex; align-items: center; gap: 12px; font-family: var(--title); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--gold-2); }
.wheel-prog div { flex: 1; height: 5px; border-radius: 5px; background: rgba(255, 255, 255, .08); overflow: hidden; }
.wheel-prog i { display: block; height: 100%; background: linear-gradient(90deg, var(--violet), var(--gold)); box-shadow: 0 0 10px var(--gold); }
.fest-row { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; }
.fest { display: flex; flex-direction: column; align-items: center; padding: 7px 2px; border-radius: 12px; border: 1px solid transparent; }
.fest b { font-family: var(--title); font-weight: 500; font-size: 12.5px; letter-spacing: .04em; color: var(--ivory); }
.fest small { font-family: var(--sans); font-size: 11px; color: var(--muted); }
.fest::before { content: ''; width: 8px; height: 8px; transform: rotate(45deg); background: var(--c); box-shadow: 0 0 8px var(--c); margin-bottom: 5px; filter: brightness(1.6); }
.fest:hover { border-color: var(--hair); }
.fest.is-next { border-color: var(--gold); background: rgba(232, 199, 122, .1); }
.fest.is-past { opacity: .55; }
.daychart-wrap { padding: 2px 4px; }
.daychart { width: 100%; height: 110px; display: block; overflow: visible; }
.daychart text { font-family: var(--sans); font-size: 10px; fill: var(--faint); }
.daychart .yl { font-size: 9px; }
.hud-title a { color: var(--gold-2); cursor: pointer; border-bottom: 1px dotted var(--hair-2); pointer-events: auto; }
@media (max-width: 820px) { .fest-row { grid-template-columns: repeat(4, 1fr); } .daychart { height: 80px; } }

/* ============================================================ PAGES */
.discover { display: flex; align-items: center; gap: 12px; max-width: 420px; margin: 14px auto 0; font-family: var(--sans); font-size: 12.5px; color: var(--muted); }
.discover div { flex: 1; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .08); overflow: hidden; }
.discover i { display: block; height: 100%; background: linear-gradient(90deg, var(--violet), var(--gold)); }
.chapter-intro { text-align: center; max-width: 720px; margin: 0 auto 22px; color: var(--text); font-style: italic; font-size: 20px; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin: -6px 0 18px; }
.card.is-seen .card__title::after { content: ' ✦'; color: var(--gold); font-size: 12px; }
.card__badge { position: absolute; top: 12px; right: 12px; font-family: var(--sans); font-size: 10px; letter-spacing: .16em; text-transform: uppercase; padding: 3px 8px; border-radius: 999px; background: rgba(84, 224, 207, .16); color: var(--teal); z-index: 1; }
.gem { display: block; width: 26px; height: 26px; transform: rotate(45deg); border-radius: 4px; background: linear-gradient(135deg, #fff9, var(--c) 45%, #0008); box-shadow: 0 0 16px var(--c); margin: 4px 0 4px 4px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--hair); border-radius: 16px; background: rgba(10, 8, 26, .6); }
.ctable { width: 100%; border-collapse: collapse; font-size: 16.5px; }
.ctable th, .ctable td { padding: 10px 14px; text-align: left; border-bottom: 1px solid rgba(232, 199, 122, .1); }
.ctable thead th { font-family: var(--sans); font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--gold); font-weight: 400; }
.ctable tbody th button { font-family: var(--title); letter-spacing: .06em; color: var(--ivory); white-space: nowrap; }
.hour-now { display: flex; align-items: center; gap: 18px; max-width: 520px; margin: 0 auto 22px; padding: 18px 22px; border-radius: 20px; border: 1px solid var(--c); background: radial-gradient(120% 100% at 0% 50%, color-mix(in srgb, var(--c) 25%, transparent), rgba(10, 8, 26, .7)); }
.hour-now > span { font-size: 46px; color: var(--c); text-shadow: 0 0 20px var(--c); }
.hour-now p { margin: 0; }
.hours { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.hour { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 10px 6px; border-radius: 14px; border: 1px solid var(--hair); background: rgba(40, 32, 90, .25); }
.hour.is-night { background: rgba(5, 4, 15, .55); }
.hour span { font-size: 22px; color: var(--c); }
.hour b { font-family: var(--title); font-weight: 500; font-size: 13px; letter-spacing: .06em; }
.hour small { font-family: var(--sans); font-size: 11.5px; color: var(--muted); }
.hour.is-now { border-color: var(--c); box-shadow: 0 0 20px color-mix(in srgb, var(--c) 40%, transparent); }

.level { display: flex; align-items: center; gap: 18px; padding: 18px 22px; border-radius: 22px; max-width: 620px; margin: 0 auto 20px; }
.level__badge { flex: none; width: 64px; height: 64px; display: grid; place-items: center; border-radius: 50%; font-family: var(--display); font-size: 28px; color: #1b1206; background: radial-gradient(circle at 35% 30%, #fff6d8, #e8c77a 55%, #a07a2a); box-shadow: 0 0 30px rgba(232, 199, 122, .5); }
.level__txt { flex: 1; } .level__txt p { margin: 0; }
.level__bar { height: 6px; border-radius: 6px; background: rgba(255, 255, 255, .08); margin: 8px 0 6px; overflow: hidden; }
.level__bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--teal), var(--gold)); box-shadow: 0 0 10px var(--gold); }
.hero-ritual { display: flex; gap: 26px; align-items: center; padding: 28px 30px; border-radius: 26px; background: radial-gradient(120% 140% at 0% 0%, rgba(84, 224, 207, .16), transparent 60%), radial-gradient(100% 120% at 100% 100%, rgba(143, 115, 255, .2), transparent 60%), var(--glass); }
.hero-ritual__icon { font-size: 76px; line-height: 1; filter: drop-shadow(0 0 22px rgba(232, 199, 122, .5)); flex: none; }
.hero-ritual p { margin: 0 0 12px; }
.practice-card { display: flex; flex-direction: column; }
.practice-card .row { margin-top: auto !important; padding-top: 12px; }
.bowls { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 12px; margin-top: 12px; }
.bowl { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 16px 8px; border-radius: 50% 50% 22px 22px; border: 1px solid var(--hair); background: radial-gradient(circle at 50% 30%, color-mix(in srgb, var(--c, #e8c77a) 26%, transparent), rgba(10, 8, 26, .7) 70%); transition: transform .3s; }
.bowl span { font-size: 30px; color: var(--c, var(--gold)); text-shadow: 0 0 16px var(--c, var(--gold)); }
.bowl b { font-family: var(--title); font-weight: 500; font-size: 13px; letter-spacing: .08em; }
.bowl small { font-family: var(--sans); font-size: 11px; color: var(--muted); }
.bowl:hover { transform: translateY(-3px); }
.bowl.is-ring { animation: ring 1.6s ease-out; }
@keyframes ring { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--c, #e8c77a) 70%, transparent); } 100% { box-shadow: 0 0 0 26px transparent; } }

.stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-bottom: 18px; }
.stats > div { border-radius: 18px; padding: 14px; text-align: center; }
.stats b { display: block; font-family: var(--display); font-size: 30px; color: var(--gold-2); font-weight: 400; }
.stats span { font-family: var(--sans); font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.composer { border-radius: 22px; padding: 18px 20px; display: flex; align-items: center; flex-wrap: wrap; }
.composer.is-open { display: block; padding: 22px; }
.composer__stamp { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; }
.composer__stamp p { margin: 0; }
.composer__prompt { margin: 0 0 10px; }
.kinds { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.mood { display: flex; align-items: center; gap: 4px; }
.mood button { opacity: .35; transition: opacity .2s, transform .2s; }
.mood button.is-on, .mood button:hover { opacity: 1; transform: scale(1.1); }
.entries { display: grid; gap: 12px; }
.entry { position: relative; display: flex; gap: 16px; padding: 18px 20px; border-radius: 20px; }
.entry__side { display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--gold); font-size: 18px; }
.entry__body { flex: 1; min-width: 0; }
.entry__body p { margin: 0 0 4px; }
.entry__text { font-size: 19px; }
.entry__stamp { font-family: var(--sans); font-size: 11.5px; letter-spacing: .06em; color: var(--faint); margin-top: 8px !important; }
.entry__del { position: absolute; top: 12px; right: 14px; color: var(--faint); font-size: 13px; opacity: 0; transition: opacity .2s; }
.entry:hover .entry__del { opacity: 1; }
.obs { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.obs__group { border-radius: 18px; padding: 16px 18px; }
.obs__item { display: flex; align-items: center; gap: 10px; padding: 5px 0; cursor: pointer; }
.obs__item input { position: absolute; opacity: 0; pointer-events: none; }
.obs__item .tick { width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--hair-2); flex: none; display: grid; place-items: center; transition: all .25s; }
.obs__item input:checked + .tick { background: radial-gradient(circle, #fff6d8, var(--gold)); box-shadow: 0 0 12px var(--gold); border-color: var(--gold); }
.obs__item a { color: var(--ivory); cursor: pointer; }
.ach { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.ach__item { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; padding: 16px 10px; border-radius: 18px; border: 1px dashed var(--hair); opacity: .5; }
.ach__item svg { width: 28px; height: 28px; color: var(--faint); }
.ach__item b { font-family: var(--title); font-weight: 500; font-size: 14px; letter-spacing: .06em; }
.ach__item small { font-size: 14px; color: var(--muted); line-height: 1.3; }
.ach__item.is-got { opacity: 1; border-style: solid; border-color: var(--hair-2); background: radial-gradient(circle at 50% 0%, rgba(232, 199, 122, .15), transparent 70%); }
.ach__item.is-got svg { color: var(--gold-2); filter: drop-shadow(0 0 8px var(--gold)); }
@media (max-width: 820px) {
  .stats { grid-template-columns: repeat(3, 1fr); }
  .stats > div:nth-child(n+4) { display: none; }
  .hero-ritual { flex-direction: column; text-align: center; padding: 24px 18px; gap: 10px; }
  .hero-ritual .row { justify-content: center; }
}
.page-head p.kicker { font-size: 12px; font-style: normal; color: var(--gold); letter-spacing: .32em; margin: 0 0 8px; }
.level__badge, .stats b { font-family: var(--serif); font-weight: 600; }
body { font-variant-numeric: lining-nums; }
.level__badge, .stats b { font-variant-numeric: lining-nums; font-feature-settings: "lnum" 1; }
@media (min-width: 821px) {
  .hud { transition: padding .5s cubic-bezier(.2, .8, .2, 1); }
  body.codex-open .hud { padding-right: 490px; }
  body.codex-open .hud-card { max-width: 100%; }
}
@media (max-width: 820px) {
  .phase-strip { flex-wrap: nowrap; gap: 0; }
  .phase-strip button { width: auto; flex: 1; padding: 4px 1px; }
  .phase-strip .moonic { width: 26px; height: 26px; }
  .mini-facts { gap: 2px 12px; margin: 2px 4px 6px; }
  .mini-facts dd { font-size: 14.5px; }
  .moon-card .btn--sm { padding: 0 12px; font-size: 10.5px; letter-spacing: .14em; }
  .hud-title .kicker { letter-spacing: .2em; font-size: 10.5px; }
}
.tourbar { position: fixed; left: 50%; top: calc(var(--top-h) + 14px); transform: translateX(-50%); z-index: 26; border-radius: 20px; padding: 12px 16px; display: flex; align-items: center; gap: 14px; max-width: min(640px, calc(100vw - 24px)); animation: pageIn .5s; }
.tourbar p { margin: 0; flex: 1; font-style: italic; font-size: 17px; }
.tourbar .kicker { margin: 0; white-space: nowrap; }
.tourbar .icon-btn { width: 36px; height: 36px; }
body.codex-open .tourbar { left: calc((100vw - 490px) / 2); }
@media (max-width: 820px) { .tourbar { flex-wrap: wrap; top: calc(var(--top-h) + 6px); gap: 6px 10px; } body.codex-open .tourbar { left: 50%; } }
