/* Themes (Amos 12 Nov): dark (the original look) and light (warm paper, dark ink). public/theme.js puts html.light or
   html.dark on the page before it is drawn, from Settings > Appearance (Match my phone / Light / Dark). Every colour that
   changes with the theme is a variable here; the rules below use only these. Fixed artwork (element tiles, coins, sticks,
   tarot backs, the floor plan on its white paper, the Guanyin poem paper) looks the same in both themes on purpose. */
:root {
  color-scheme: dark;
  --bg: #1d1a16; --card: #2a251f; --ink: #f2ead9; --muted: #a99d88; --line: #4a4136;
  --gold: #e0b44c; --teal: #2fb8ac; --red: #e5534b; --purple: #b07cf0; --green: #5cc46a; --blue: #5aa8ff; --pink: #ff6fae;
  /* Five elements 五行. Contrast on the dark cards (#211d18 / #2a251f): wood 8.7, fire 5.5, earth 6.8, metal 11.1, water 6.4. */
  --wood: #4ed46a; --fire: #ff5c4d; --earth: #d39a3f; --metal: #c9d3e0; --water: #4da3ff;
  /* Surfaces: page, cards, chart cells, reading panels, text boxes, buttons, sidebar */
  --cell: #211d18; --panel: #221e19; --field: #191612; --btn: #3a332a; --side: #17140f;
  /* Text on a gold fill / on an accent or element fill (Zi Wei 四化, free tag, element bars) */
  --on-gold: #1d1a16; --on-acc: #1d1a16;
  /* Softer text shades: bold in readings, stars, Zi Wei major stars, chips and notes, "bad" / "good" / warning text */
  --strong: #fff6e3; --star: #e9d9b6; --zmajor: #f0c674; --chip-ink: #a89e8c; --chip-ink2: #c9bfae; --note-ink: #b9ae9a;
  --bad: #e98a80; --bad2: #f0a49c; --good2: #7fd18b; --warn: #f0b46a; --chou: #d68fd0;
  /* Neutral marker badges (击刑 入墓 门迫), offline bar, Apple button, 神煞 good tag */
  --bd-bg: #e9e2d2; --bd-ink: #1d1a16; --bd-mu: #6f665a; --offline: #5a4a1f; --apple-bg: #fff; --apple-ink: #000;
  --ss-good-bg: rgba(240, 220, 170, .16); --ss-good-line: rgba(240, 220, 170, .45); --ss-good-ink: #f2e3bf;
  /* TEST MODE banner: the same yellow in both themes */
  --banner-bg: #f2c94c; --banner-ink: #1d1a16;
  /* Coloured pills with their own fill (Guanyin grade, tarot upright / reversed): same in both themes */
  --pill-up: #2f7a3a; --pill-up-ink: #eaffea; --pill-mid: #7a6326; --pill-mid-ink: #fff6dc; --pill-low: #6e2a24; --pill-low-ink: #ffe6e2;
  --shade: rgba(0, 0, 0, .5); --scrim: rgba(0, 0, 0, .5);
  /* Ba Zhai strength tags: text on the strongest fills, and on the mid fills */
  --st-good: #9fe0a8; --st-bad: #f2aaa2; --on-teal: #0f2220;
  --st5-good: color-mix(in srgb, var(--green) 80%, var(--cell)); --st5-good-ink: #0c1a0e; --st4-good: color-mix(in srgb, var(--green) 40%, var(--cell));
  --st5-bad: color-mix(in srgb, var(--red) 80%, var(--cell)); --st5-bad-ink: #fff; --st4-bad: color-mix(in srgb, var(--red) 40%, var(--cell));
  /* Red as text (moving-line marks, errors): a little brighter than the red fill on the dark theme */
  --red-ink: #ff7a70; --icon-tint: 12%; --rc-tint: 18%;
  /* Gold for tinted fills and soft borders (the dark theme uses the same gold as the text) */
  --gold-tint: var(--gold);
}
/* Light theme: warm ivory paper, dark ink, deeper gold and accents. All text pairs pass WCAG AA (4.5:1) on the page,
   cards and cells (checked by tests/theme-contrast.mjs); gold and the accents also carry white text when used as a fill. */
html.light {
  color-scheme: light;
  --bg: #f4eee1; --card: #fffbf3; --ink: #2b2117; --muted: #67594a; --line: #d8cbb1;
  --gold: #7d590c; --teal: #0b6f67; --red: #b8322a; --purple: #7041b3; --green: #27702f; --blue: #1d5bb8; --pink: #a92c66;
  /* Element text colours (contrast on white / #f6f1e7: wood 5.4/4.8, fire 5.3/4.7, earth 5.5/4.9, metal 5.9/5.2, water 5.5/4.8) */
  --wood: #157a30; --fire: #d0281c; --earth: #8f5f0f; --metal: #5a6577; --water: #1f64d6;
  --cell: #faf4e7; --panel: #fbf5ea; --field: #fffdf8; --btn: #eee4d1; --side: #eee6d5;
  --on-gold: #fff; --on-acc: #fff;
  --strong: #1c140c; --star: #5b4527; --zmajor: #855700; --chip-ink: #67594a; --chip-ink2: #5c4f40; --note-ink: #5c4f40;
  --bad: #ad3328; --bad2: #ad3328; --good2: #23702e; --warn: #8f5300; --chou: #8f3486;
  --bd-bg: #5b4f40; --bd-ink: #fff; --bd-mu: #7a6f62; --offline: #f1dda0; --apple-bg: #000; --apple-ink: #fff;
  --ss-good-bg: #fbf3dc; --ss-good-line: #e3cf96; --ss-good-ink: #6b5313;
  --shade: rgba(60, 40, 10, .18); --scrim: rgba(30, 20, 5, .4);
  --st-good: #1d5a25; --st-bad: #761d16; --on-teal: #fff;
  --st5-good: var(--green); --st5-good-ink: #fff; --st4-good: color-mix(in srgb, var(--green) 18%, var(--cell));
  --st5-bad: var(--red); --st5-bad-ink: #fff; --st4-bad: color-mix(in srgb, var(--red) 16%, var(--cell));
  --red-ink: var(--red); --icon-tint: 4%; --rc-tint: 10%; --active-tint: 10%; --tag-tint: 6%; --hover-tint: 3%;
  --gold-tint: #d9a63c;
}
/* Fixed artwork: the same in both themes (floor plan drawn on white paper, fortune sticks and cup, moon blocks, poem paper,
   tarot backs, coins). */
:root {
  --paper-white: #fff; --fp-ink: #1d1a16; --fp-wall: rgba(40, 30, 20, .55); --fp-none: rgba(150, 150, 150, .12); --fp-good: rgba(60, 180, 80, .26); --fp-bad: rgba(220, 70, 60, .24);
  --fp-clash: rgba(230, 170, 40, .24); --fp-dn: #3a2f20; --fp-g: #11702a; --fp-b: #b3261e; --fp-room: #2fb8ac; --art-gold: #e0b44c;
  --fp-north: #e5534b; --stick-1: #c99a52; --stick-2: #f0d08a; --stick-3: #b07f3c; --stick-hi: #f6dc9c; --lacquer: #c0392b;
  --lacquer-dk: #6e1d14; --lacquer-2: #b8382a; --lacquer-3: #8a2418; --art-gold-lt: #f3d78a; --block-1: #d4473a; --block-2: #8f2318;
  --block-edge: #5c140c; --block-flat: #e86a5c; --paper: #f3e7c9; --paper-ink: #3a2414; --tarot-1: #1f2a5a; --tarot-2: #273370;
  --tarot-rim: #c9a043; --coin-1: #f6d98a; --coin-2: #c9962f; --coin-3: #8d6516; --coin-b1: #c79a45; --coin-b3: #5c410c;
  --coin-ink: #3a2a0c; --coin-ink-b: #f6ecd2; --coin-rim: rgba(80,55,10,.45);
}
.wx-wood { color: var(--wood); } .wx-fire { color: var(--fire); } .wx-earth { color: var(--earth); } .wx-metal { color: var(--metal); } .wx-water { color: var(--water); }
span.wx { font-weight: 600; }
/* 3D element tiles (CSS only). Same tile colours in dark and light mode; white text on wood/fire/water, dark on earth/metal
   (glyph contrast at tile middle about 4.5-11). Every span.wx is a small flat bead; main chart positions get the raised tile. */
.wx-wood { --t1: #2f9a4b; --t2: #17692e; --tx: #fff; --tex: repeating-linear-gradient(100deg, rgba(255,255,255,0) 0 3px, rgba(255,255,255,.07) 3px 4px, rgba(0,0,0,.05) 4px 6px); }
.wx-fire { --t1: #e8533f; --t2: #b3261a; --tx: #fff; --tex: radial-gradient(120% 80% at 50% 110%, rgba(255,190,80,.45), rgba(255,190,80,0) 60%); --glow: 0 0 6px rgba(255,98,60,.45); }
.wx-earth { --t1: #dcab58; --t2: #ab7624; --tx: #24160a; --tex: linear-gradient(rgba(0,0,0,0), rgba(0,0,0,0)); --hi: .18; }
.wx-metal { --t1: #f3f6fa; --t2: #a7b2c1; --tx: #1f2630; --tex: linear-gradient(115deg, rgba(255,255,255,0) 30%, rgba(255,255,255,.75) 45%, rgba(255,255,255,0) 58%); }
.wx-water { --t1: #3d8fe6; --t2: #1752ad; --tx: #fff; --tex: radial-gradient(90% 55% at 35% 0%, rgba(255,255,255,.45), rgba(255,255,255,0) 70%); }
span.wx { display: inline-block; min-width: 1.3em; padding: 0 .16em; margin: 0 1px; border-radius: .32em; line-height: 1.3; text-align: center; text-indent: 0;
  color: var(--tx); background: linear-gradient(var(--t1), var(--t2)); box-shadow: inset 0 1px 0 rgba(255,255,255,.25), 0 1px 1px rgba(0,0,0,.3); }
.stem .g .wx, table.bz tr.big .wx, .lp .gz .wx, .cell.center .stem .g .wx, .zgz .wx {
  font-weight: 700; padding: 0 .14em; border-radius: .26em; line-height: 1.32; text-shadow: 0 1px 1px rgba(0,0,0,.35);
  background: var(--tex), linear-gradient(var(--t1), var(--t2));
  box-shadow: inset 0 1px 0 rgba(255,255,255,var(--hi, .5)), inset 0 -2px 0 rgba(0,0,0,.2), 0 2px 3px rgba(0,0,0,.45), var(--glow, 0 0 0 transparent); }
.wx-earth.wx, .wx-metal.wx { text-shadow: 0 1px 0 rgba(255,255,255,.35) !important; }
.zgz .wx { margin: 0; min-width: 1.25em; } .zgz .wx + .wx { margin-left: 2px; }
.lp .gz .wx { margin: 1px 0; }
table.bz tr.big .wx { min-width: 1.35em; }
/* Hidden stems: smaller, flatter bead */
.hid .wx, table.bz .hs .wx { font-size: 12px; min-width: 1.4em; line-height: 1.35; box-shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 1px 1px rgba(0,0,0,.25); }
.legend.wxlegend span::before { display: none; } .legend.wxlegend .wx { font-size: 12px; }
/* Element dot before a door or star */
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, rgba(255,255,255,.65), rgba(255,255,255,0) 55%), currentColor; box-shadow: 0 1px 1px rgba(0,0,0,.4); margin: 0 4px 1px 0; vertical-align: middle; }
/* Marker badges (击刑 刑, 入墓 墓, 门迫 迫): neutral, so they never look like an element colour */
.bd { display: inline-grid; place-items: center; font-size: 9px; line-height: 1; font-weight: 700; min-width: 13px; height: 13px; padding: 0 2px; border-radius: 3px; color: var(--bd-ink); background: var(--bd-bg); vertical-align: 1px; }
.bd.xing { background: var(--purple); color: var(--on-acc); } .bd.mu { background: var(--bd-mu); color: var(--paper-white); } .bd.po { background: var(--bd-bg); color: var(--bd-ink); font-size: 10px; height: 15px; min-width: 15px; }
.bds { display: flex; gap: 1px; margin-top: 1px; }
*, *::before, *::after { box-sizing: border-box; }
/* No sideways scroll on phones (Amos 12 Nov): nothing may be wider than the screen. overflow-x on body only (it moves to the
   page itself, so the sticky header keeps working); long words wrap; pictures never wider than their box. */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { overflow-x: hidden; overflow-wrap: break-word; }
img, video { max-width: 100%; }
/* No pull-down-to-refresh in Chrome / the Android app / iPhone: it reloaded the app; the ↻ button refreshes in place. */
html, body { overscroll-behavior-y: contain; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 -apple-system, "PingFang SC", "Noto Sans SC", "Segoe UI", sans-serif; }
/* Safe area applied once: top on the header (or main when the header is hidden), bottom on the footer. Never on body too, or it doubles. */
body { padding: 0 env(safe-area-inset-right) 0 env(safe-area-inset-left); }
.hidden { display: none !important; }
.top { display: flex; justify-content: space-between; align-items: center; padding: calc(env(safe-area-inset-top) + 10px) 14px 10px; border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; font-size: 17px; display: flex; gap: 8px; align-items: center; white-space: nowrap; flex: none; }
.logo { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 6px; background: var(--gold); color: var(--on-gold); }
.who { font-size: 12px; min-width: 0; color: var(--muted); display: flex; gap: 8px; align-items: center; }
main { max-width: 820px; margin: 0 auto; padding: 12px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 14px; margin-bottom: 12px; }
h1 { font-size: 22px; margin: 0 0 8px; } h2 { font-size: 17px; margin: 0 0 10px; } h4 { margin: 12px 0 4px; }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
input, select { display: block; width: 100%; max-width: 100%; margin-top: 3px; padding: 8px; border-radius: 6px; border: 1px solid var(--line); background: var(--field); color: var(--ink); font-size: 15px; }
/* iPhone zooms the whole page in when you tap a text box under 16px and stays zoomed: the header and right-hand cards
   then hang off the right edge and the page scrolls sideways. 16px on iPhone / iPad only, so nothing zooms. */
@supports (-webkit-touch-callout: none) { input, select, textarea { font-size: 16px !important; } }
.row { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.row.tight { align-items: center; gap: 4px; flex-wrap: nowrap; } .row.tight select { width: auto; flex: 1; }
.grow { flex: 1; min-width: 160px; margin-bottom: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
@media (max-width: 520px) { .grid2 { grid-template-columns: 1fr; } }
label.check { display: flex; gap: 8px; align-items: center; color: var(--ink); }
label.check input { width: auto; margin: 0; }
button { padding: 8px 14px; border-radius: 6px; border: 1px solid var(--line); background: var(--btn); color: var(--ink); font-size: 14px; cursor: pointer; }
button.primary { background: var(--gold); color: var(--on-gold); border-color: var(--gold); font-weight: 600; }
button.danger { color: var(--red-ink); }
button.linkbtn { background: none; border: 0; padding: 0; min-height: 0; text-decoration: underline; color: var(--gold); font: inherit; cursor: pointer; }
button.linkbtn.danger { color: var(--red-ink); }
.ld-agree a, #tab-settings a { color: var(--gold); }
/* App links (Terms of use · Privacy policy and the rest): gold, thin underline, never the browser's default blue. */
main a, dialog a { color: var(--gold); text-decoration-thickness: 1px; text-underline-offset: 2px; }
main a:visited, dialog a:visited { color: var(--gold); }
button:disabled { opacity: .5; cursor: default; }
/* Every buy / subscribe button is gold (Amos 2026-11-15); grey only when it really can't be tapped. */
button.primary:disabled { background: var(--btn); color: var(--ink); border-color: var(--line); font-weight: 400; }
.small { font-size: 12px; } .muted { color: var(--muted); }
.foot { text-align: center; padding: 18px 12px calc(env(safe-area-inset-bottom) + 28px); }

/* Nine-palace grid */
.qm { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin: 6px 0 10px; }
.cell { position: relative; background: var(--cell); border: 1px solid var(--line); border-radius: 6px; padding: 6px 6px 5px; min-height: 132px; display: flex; flex-direction: column; gap: 2px; }
.toprow { display: flex; justify-content: space-between; align-items: center; min-height: 16px; }
.toprow .pn { font-size: 10px; color: var(--muted); }
.cell .god { font-weight: 600; } .cell .en { font-size: 10px; color: var(--muted); font-weight: 400; }
.toprow .marks { display: flex; gap: 3px; }
.mk { font-size: 11px; padding: 0 3px; border-radius: 3px; border: 1px solid var(--muted); }
.mk.horse { border-color: var(--gold); color: var(--gold); }
.cell .star { color: var(--star); }
.cell .door.pressured { font-weight: 700; }
.stems { display: flex; justify-content: space-between; align-items: flex-end; margin-top: auto; }
.plate { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; }
.plate .lbl { font-size: 9px; color: var(--muted); }
.stemrow { display: flex; gap: 3px; }
.stem { display: flex; flex-direction: column; align-items: center; }
.stem .st { font-size: 9px; color: var(--muted); min-height: 11px; letter-spacing: -1px; }
.stem .g { font-size: 18px; line-height: 1.1; padding: 2px; border: 2px solid transparent; border-radius: 7px; }
.stem.day .g { border-color: var(--gold); } .stem.hour .g { border-color: var(--teal); }
.stem.day.hour .g { border-color: var(--gold); box-shadow: 0 0 0 2px var(--teal); }
.stem.person .g { outline: 2px dashed var(--pink); outline-offset: 1px; }
.hid { font-size: 12px; color: var(--muted); }
html[lang=ms] .hid, html[lang=id] .hid { overflow-wrap: anywhere; } /* "tersembunyi" is too long for a phone palace cell (18 Nov) */ .hid b { color: var(--ink); font-weight: 400; font-size: 14px; }
.cell.center { justify-content: center; align-items: center; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 11px; color: var(--muted); }
.legend.wxlegend { margin: 0 0 6px; font-size: 13px; gap: 4px 14px; align-items: center; } .legend.wxlegend b { color: var(--muted); font-weight: 400; font-size: 11px; }
.legend.wxlegend span { font-weight: 700; }
.legend .box::before { background: none; border: 2px solid var(--c); } .legend .box.you { --c: var(--gold); } .legend .box.matter { --c: var(--teal); } .legend .box.person::before { border: 2px dashed var(--pink); }
.legend.boxes span:not(.box)::before { display: none; } .legend .bd { margin-right: 2px; }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; background: var(--c); }
.meta { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; font-size: 13px; margin-top: 10px; }
.meta dt { color: var(--muted); } .meta dd { margin: 0; }
/* Reading: one rounded card per section, then the one-line advice bubble */
.reading { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.rcard { --acc: var(--line); background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--acc); border-radius: 14px; padding: 14px 16px; line-height: 1.65; font-size: 15.5px; }
.rc-title { display: flex; align-items: center; gap: 8px; font-size: 16px; line-height: 1.3; margin: 0 0 8px; color: var(--ink); }
.rc-icon { display: inline-grid; place-items: center; flex: none; width: 26px; height: 26px; border-radius: 50%; font-size: 14px; color: var(--acc); background: color-mix(in srgb, var(--acc) var(--rc-tint), transparent); }
.rc-body p { margin: 0 0 10px; } .rc-body p:last-child, .rc-body ul:last-child, .rc-body ol:last-child { margin-bottom: 0; }
.rc-body strong { color: var(--strong); font-weight: 600; }
.rc-body h3, .rc-body h4, .rc-body h5 { font-size: 15px; margin: 10px 0 4px; }
.rc-body ul, .rc-body ol { margin: 0 0 10px; padding-left: 20px; } .rc-body li { margin-bottom: 4px; }
.rc-you { --acc: var(--gold); } .rc-matter { --acc: var(--teal); } .rc-person { --acc: var(--pink); } .rc-timing { --acc: var(--blue); } .rc-advice { --acc: var(--green); } .rc-other { --acc: var(--line); }
.rc-summary { border: 1px solid var(--gold); border-left-width: 1px; background: linear-gradient(135deg, color-mix(in srgb, var(--gold-tint) 22%, transparent), color-mix(in srgb, var(--gold-tint) 8%, transparent)); text-align: center; padding: 16px 18px; }
.rc-summary .rc-label { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--gold); margin-bottom: 6px; }
.rc-summary p { margin: 0; font-size: 16.5px; font-weight: 600; line-height: 1.5; }
.disclaimer { margin: 10px 4px 4px; font-size: 11.5px; line-height: 1.5; color: var(--muted); opacity: .85; }
/* Chart basis: small muted chips under the plain meaning; tap one for a one-line note. */
.rc-basis { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 12px; padding-top: 10px; border-top: 1px dashed color-mix(in srgb, var(--ink) 8%, transparent); }
.rc-blabel { font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-right: 2px; }
.rc-basis .chip { font: inherit; font-size: 12px; line-height: 1.2; padding: 3px 9px; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--ink) 10%, transparent); background: color-mix(in srgb, var(--ink) 4%, transparent); color: var(--chip-ink); cursor: pointer; width: auto; margin: 0; min-height: 0; }
.rc-basis .chip.on { color: var(--ink); border-color: var(--acc); background: color-mix(in srgb, var(--acc) 14%, transparent); }
.rc-note { flex-basis: 100%; font-size: 12.5px; line-height: 1.45; color: var(--note-ink); padding: 2px 2px 0; }
@media (max-width: 420px) { .rcard { padding: 13px 14px; font-size: 15px; } }
.err { color: var(--red-ink); }
.hist { border-top: 1px solid var(--line); padding: 10px 0; } .hist summary { cursor: pointer; line-height: 1.4; } .hist-meta { display: block; margin: 2px 0 0 16px; }
.hist summary::marker { color: var(--muted); } .hist-title { font-weight: 600; } .hist[open] summary { margin-bottom: 4px; }
@media (max-width: 420px) { .stem .g { font-size: 16px; } .cell { min-height: 124px; padding: 5px 4px; } }

/* Bazi */
h3 { font-size: 15px; margin: 16px 0 6px; }
table.bz { width: 100%; border-collapse: collapse; text-align: center; table-layout: fixed; }
table.bz th, table.bz td { border-bottom: 1px solid var(--line); padding: 4px 2px; vertical-align: top; }
table.bz tr > th:first-child { width: 44px; font-size: 11px; color: var(--muted); font-weight: 400; text-align: left; }
table.bz tr.big td { font-size: 28px; line-height: 1.2; }
table.bz tr.gods td, table.bz tr.small td { font-size: 12px; }
table.bz .dm { color: var(--gold); font-weight: 700; }
table.bz .hs { font-size: 14px; white-space: nowrap; } table.bz .hs .small { font-size: 10px; color: var(--muted); }
table.bz .mk { font-size: 10px; vertical-align: super; margin-left: 2px; }
.wxbars { display: flex; flex-direction: column; gap: 3px; margin: 4px 0 8px; }
.wxbar { display: grid; grid-template-columns: 18px 1fr 22px; gap: 6px; align-items: center; font-size: 13px; }
.wxbar .bar { height: 8px; background: var(--field); border-radius: 4px; overflow: hidden; }
.wxbar .bar i { display: block; height: 100%; }
.bar i, .wxstack i { background: currentColor; }
.wxstack { display: flex; height: 22px; border-radius: 6px; overflow: hidden; gap: 2px; margin: 4px 0 4px; }
.wxstack i { display: grid; place-items: center; min-width: 22px; font-style: normal; font-size: 12px; font-weight: 700; }
.wxstack i b { color: var(--on-acc); }
.wxstack-key { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; } .wxstack-key span { font-weight: 700; }
.strength { margin: 4px 0; }
.luck { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 4px; }
.lp { flex: 0 0 64px; text-align: center; background: var(--cell); border: 1px solid var(--line); border-radius: 6px; padding: 4px 2px; }
.lp.cur { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); }
.lp .gz { font-size: 20px; line-height: 1.15; margin: 2px 0; }
table.ln { width: 100%; border-collapse: collapse; font-size: 12px; text-align: center; }
table.ln th { color: var(--muted); font-weight: 400; } table.ln td, table.ln th { border-bottom: 1px solid var(--line); padding: 3px 2px; }
table.ln tr.cur td { color: var(--gold); }

/* Admin */
ul.rel { list-style: none; padding: 0; margin: 4px 0 8px; }
ul.rel li { padding: 5px 0; border-top: 1px solid var(--line); line-height: 1.5; }
ul.rel li .small { display: block; }
ul.plain { list-style: none; padding: 0; margin: 8px 0 0; }
ul.plain li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 0; border-top: 1px solid var(--line); word-break: break-all; }
ul.plain li button, table.signins button { padding: 4px 10px; font-size: 12px; white-space: nowrap; flex-shrink: 0; }
.tag { font-size: 11px; padding: 1px 6px; border-radius: 3px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.tag.ok { border-color: var(--green); color: var(--green); } .tag.no { border-color: var(--red); color: var(--red-ink); }
table.signins { width: 100%; border-collapse: collapse; font-size: 12px; }
/* Wide lists (sign-ins, payments, errors): the table scrolls inside its own box, the page never scrolls sideways. */
table.signins { display: block; max-width: 100%; overflow-x: auto; }
table.signins th, table.signins td { text-align: left; padding: 4px 4px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.signins td:first-child { word-break: break-all; } table.signins td:last-child { white-space: nowrap; }
table.signins td:last-child button { margin-top: 4px; display: block; }
table.signins th { color: var(--muted); font-weight: 400; }

/* Zi Wei board: 4x4, palaces on the edge, chart info in the middle */
.zw { display: grid; grid-template-columns: repeat(4, 1fr); grid-template-rows: repeat(4, auto); gap: 3px; margin: 6px 0 10px; }
.zc { background: var(--cell); border: 1px solid var(--line); border-radius: 5px; padding: 4px; min-height: 128px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.zc.soul { border-color: var(--gold); } .zc.dec { box-shadow: inset 0 0 0 2px var(--teal); }
.zc.soul.dec { border-color: var(--gold); box-shadow: inset 0 0 0 2px var(--teal); }
.zcenter { grid-column: 2 / 4; grid-row: 2 / 4; border: 1px solid var(--line); border-radius: 5px; padding: 8px; display: flex; flex-direction: column; gap: 4px; justify-content: center; text-align: center; font-size: 13px; }
.zmain, .zminor { display: flex; flex-wrap: wrap; gap: 0 4px; }
.zs { white-space: nowrap; } .zs.major { font-size: 15px; font-weight: 600; color: var(--zmajor); } .zs.minor { font-size: 12px; color: var(--star); }
.zs .br { font-size: 9px; color: var(--muted); font-weight: 400; margin-left: 1px; }
.mut { font-size: 10px; padding: 0 2px; border-radius: 3px; color: var(--on-acc); font-weight: 700; margin-left: 1px; }
.mut.lu { background: var(--green); } .mut.quan { background: var(--purple); } .mut.ke { background: var(--blue); } .mut.ji { background: var(--red); }
.zadj { font-size: 10px; color: var(--muted); line-height: 1.25; }
.zfoot { margin-top: auto; display: flex; justify-content: space-between; align-items: flex-end; line-height: 1.2; }
.zname { text-align: right; font-size: 13px; } .zname .mk { margin-right: 2px; font-size: 10px; } .mk.yr { border-color: var(--teal); color: var(--teal); }
@media (max-width: 520px) { .zs.major { font-size: 13px; } .zs.minor { font-size: 11px; } .zadj { display: none; } .zc { min-height: 112px; padding: 3px; } .zname { font-size: 12px; } .zcenter { font-size: 12px; padding: 4px; } }
.zname, .zfoot .small { white-space: nowrap; } .zfoot { gap: 2px; }
@media (max-width: 520px) { .zfoot .small { font-size: 10px; } .zname { font-size: 11px; } .zname .small { font-size: 10px; } }

/* Sign-in buttons, offline bar, iPhone app */
.signins { display: flex; flex-direction: column; gap: 10px; max-width: 320px; }
.signins button { padding: 11px 14px; font-size: 16px; }
button.apple { background: var(--apple-bg); color: var(--apple-ink); border-color: var(--apple-bg); font-weight: 600; }
.offlineBar { display: none; background: var(--offline); color: var(--ink); text-align: center; padding: 6px; }
html.offline .offlineBar { display: block; }
button.share { margin-top: 10px; }
body:has(#signedOut:not(.hidden)) main { padding-top: calc(env(safe-area-inset-top) + 12px); }

/* Ask now history list */
.ahist { display: flex; align-items: stretch; gap: 8px; border-top: 1px solid var(--line); padding: 8px 0; }
.ahist:first-child { border-top: 0; }
.ah-open { flex: 1; min-width: 0; text-align: left; background: none; border: 0; padding: 4px 2px; color: inherit; font: inherit; cursor: pointer; }
.ah-q { display: block; font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.ah-meta { display: block; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.ah-del { flex: none; min-width: 44px; background: none; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); cursor: pointer; }
.hist-del { margin-top: 10px; padding: 8px 12px; }
.ah-more { width: 100%; margin-top: 8px; }
.saved-tag { color: var(--gold); margin: 0 0 4px; }
.saved-tag a.regen { color: var(--gold); text-decoration: underline; }

/* Sidebar: fixed on the left from 760px wide (tablet, foldable open, desktop); slide-in drawer on phones. */
:root { --sbw: 272px; }
.menuBtn, .sidebar, .scrim, .refreshBtn { display: none; }
body.nav-on .refreshBtn { display: inline-grid; place-items: center; width: 36px; height: 36px; padding: 0; margin-left: 8px; font-size: 18px; flex: none; }
.refreshBtn.spin { opacity: .5; }
.topSection { flex: 1; min-width: 0; margin-left: 10px; text-align: right; font-size: 14px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body.nav-on .sidebar { display: flex; }
.sidebar { position: fixed; z-index: 30; top: 0; bottom: 0; left: 0; width: var(--sbw); flex-direction: column; gap: 14px; overflow-y: auto; overscroll-behavior: contain;
  background: var(--side); border-right: 1px solid var(--line); padding: calc(env(safe-area-inset-top) + 14px) 12px calc(env(safe-area-inset-bottom) + 12px) calc(env(safe-area-inset-left) + 12px); }
.sb-brand { font-weight: 700; font-size: 17px; display: flex; gap: 8px; align-items: center; padding: 0 4px; }
.sb-label { font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.sb-profile { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px; }
.sb-person { display: flex; flex-direction: column; margin-bottom: 6px; line-height: 1.3; } .sb-person b { font-size: 16px; overflow-wrap: anywhere; }
.sb-profile select { font-size: 14px; padding: 6px; margin: 0 0 8px; }
.sb-pbtn { display: flex; gap: 6px; } .sb-pbtn button { flex: 1; padding: 6px 8px; }
.sb-nav { display: flex; flex-direction: column; gap: 2px; }
.sb-nav button { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: none; border: 0; border-radius: 8px; padding: 9px 10px; font-size: 15px; color: var(--ink); min-height: 44px; }
.sb-nav button .ic { display: inline-grid; place-items: center; flex: none; width: 26px; height: 26px; border-radius: 7px; font-size: 14px; color: var(--gold); background: color-mix(in srgb, var(--gold-tint) var(--icon-tint), transparent); }
.sb-nav button .nm { flex: 1; min-width: 0; }
.sb-nav button.tab:hover { background: color-mix(in srgb, var(--ink) var(--hover-tint, 5%), transparent); }
.sb-nav button.tab.active { background: color-mix(in srgb, var(--gold-tint) var(--active-tint, 16%), transparent); box-shadow: inset 3px 0 0 var(--gold); font-weight: 600; }
.sb-nav button.tab.active .ic { background: var(--gold); color: var(--on-gold); }
.sb-grp + .sb-grp, .sb-other { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--line); }
.sb-nav button.sb-gh { min-height: 40px; padding: 6px 10px; gap: 10px; color: var(--ink); }
.sb-nav button.sb-gh:hover { background: color-mix(in srgb, var(--ink) 4%, transparent); }
.sb-gh .gz { display: inline-grid; place-items: center; flex: none; min-width: 26px; white-space: nowrap; height: 26px; font-size: 19px; font-weight: 700; color: var(--gold); }
.sb-gh .gn { flex: 1; min-width: 0; font-size: 12px; font-weight: 700; letter-spacing: .05em; white-space: nowrap; text-transform: uppercase; line-height: 1.25; }
.sb-gh .gn small { display: block; font-size: 10.5px; font-weight: 400; letter-spacing: .02em; text-transform: none; color: var(--muted); }
.sb-gh .chev { color: var(--muted); font-size: 12px; transition: transform .15s ease; }
.sb-gh[aria-expanded="false"] .chev { transform: rotate(-90deg); }
.sb-items { display: flex; flex-direction: column; gap: 2px; }
.sb-grp.closed .sb-items { display: none; }
.sb-nav button.soon { opacity: .45; cursor: default; } .sb-nav button.soon .ic { color: var(--muted); background: color-mix(in srgb, var(--ink) 6%, transparent); }
.sb-nav .tag { font-size: 10px; }
.sb-foot { margin-top: auto; display: flex; flex-direction: column; align-items: stretch; gap: 8px; padding: 10px 4px 0; border-top: 1px solid var(--line); font-size: 12px; }
.sb-foot .who { flex-direction: column; align-items: stretch; gap: 6px; }
.sb-foot span { overflow-wrap: anywhere; } .sb-foot button { width: 100%; }
.sb-lang { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 12px; } .sb-lang select { margin: 0; padding: 5px 6px; font-size: 13px; flex: 1; }
.sb-legal { color: var(--muted); text-align: center; } .sb-legal a, .foot a { color: var(--muted); }
.foot .legal { margin-top: 6px; } .foot .nw { white-space: nowrap; }
@media (min-width: 760px) {
  body.nav-on { padding-left: calc(var(--sbw) + env(safe-area-inset-left)); }
  body.nav-on header.top { display: none; }
  body.nav-on main { padding-top: calc(env(safe-area-inset-top) + 12px); }
}
@media (max-width: 759.98px) {
  body.nav-on .menuBtn { display: inline-grid; place-items: center; width: 40px; height: 40px; padding: 0; font-size: 20px; margin-right: 6px; }
  body.nav-on header.top { justify-content: flex-start; position: sticky; top: 0; z-index: 20; background: var(--bg); }
  .sidebar { width: min(86vw, 300px); transform: translateX(-102%); transition: transform .22s ease; box-shadow: 0 0 30px var(--shade); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 25; background: var(--scrim); }
  body.nav-open { overflow: hidden; }
}
/* Ba Zhai 八宅 */
.bh-method { display: inline-block; margin: 0 0 8px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--gold); color: var(--gold); font-size: 13px; }
.bh-cell { min-height: 92px; gap: 4px; } .bh-cell.pgood { background: color-mix(in srgb, var(--green) 9%, var(--cell)); } .bh-cell.pbad { background: color-mix(in srgb, var(--red) 7%, var(--cell)); }
.bh-s { font-size: 14px; } .bh-s.good { color: var(--green); } .bh-s.bad { color: var(--bad); }
.bh-who { display: inline-block; font-size: 10px; color: var(--muted); border: 1px solid var(--line); border-radius: 3px; padding: 0 3px; margin-right: 4px; }
.mk.bh-door { border-color: var(--gold); color: var(--gold); } .mk.bh-sit { border-color: var(--teal); color: var(--teal); }
.bh-c { gap: 4px; text-align: center; font-size: 14px; } .bh-match.ok { color: var(--green); font-size: 12px; } .bh-match.no { color: var(--bad); font-size: 12px; }
.bh-legend span::before { display: none; } .bh-legend .bh-g { color: var(--green); } .bh-legend .bh-b { color: var(--bad); }
.bh-list { margin: 0; padding-left: 20px; font-size: 14px; } .bh-list li { margin-bottom: 4px; }
.compass { margin-top: 6px; } .bh-live { display: flex; gap: 12px; align-items: center; margin: 10px 0; }
.bh-needle { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--gold); color: var(--red); font-size: 22px; transition: transform .15s; }
#bhWorkRow { align-self: end; }
/* Ba Zhai overlay: sectors where the house and the people agree (good / weak) or clash */
.bh-cell.ag-good { background: color-mix(in srgb, var(--green) 10%, var(--cell)); box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--green) 55%, transparent); }
.bh-cell.ag-bad { background: color-mix(in srgb, var(--red) 8%, var(--cell)); box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--red) 50%, transparent); }
.bh-cell.ag-clash { background: color-mix(in srgb, var(--gold-tint) 6%, var(--cell)); box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--gold-tint) 45%, transparent); outline: 1px dashed color-mix(in srgb, var(--gold-tint) 50%, transparent); outline-offset: -5px; }
.bh-ag { font-size: 11px; margin-top: auto; color: var(--muted); } .ag-good .bh-ag { color: var(--green); } .ag-bad .bh-ag { color: var(--bad); } .ag-clash .bh-ag { color: var(--gold); }
.bh-s.p1 .bh-who { border-style: dashed; }
.bh-st { display: inline-block; width: fit-content; font-size: 11px; line-height: 1.3; padding: 0 5px; border-radius: 3px; margin: -2px 0 2px 2px; }
.bh-st .en { font-size: 10px; opacity: .8; }
.bh-st.good.l5 { background: var(--st5-good); color: var(--st5-good-ink); } .bh-st.good.l4 { background: var(--st4-good); color: var(--ink); }
.bh-st.good.l3 { background: color-mix(in srgb, var(--green) 30%, transparent); color: var(--st-good); } .bh-st.good.l2 { background: color-mix(in srgb, var(--green) 16%, transparent); color: var(--st-good); }
.bh-st.good.l1 { background: color-mix(in srgb, var(--green) 7%, transparent); color: var(--st-good); }
.bh-st.bad.l5 { background: var(--st5-bad); color: var(--st5-bad-ink); } .bh-st.bad.l4 { background: var(--st4-bad); color: var(--ink); }
.bh-st.bad.l3 { background: color-mix(in srgb, var(--red) 30%, transparent); color: var(--st-bad); } .bh-st.bad.l2 { background: color-mix(in srgb, var(--red) 16%, transparent); color: var(--st-bad); }
.bh-st.bad.l1 { background: color-mix(in srgb, var(--red) 7%, transparent); color: var(--st-bad); }
.bh-st-legend .bh-st { margin: 0; }
.bh-list .bh-st { margin: 0 2px; }
.legend .lg-ag { padding: 1px 6px; border-radius: 4px; } .legend .lg-ag.ag-good { color: var(--green); border: 1px solid var(--green); } .legend .lg-ag.ag-bad { color: var(--bad); border: 1px solid var(--bad); } .legend .lg-ag.ag-clash { color: var(--gold); border: 1px dashed var(--gold); }
@media (max-width: 420px) { .bh-cell .bh-s .en, .bh-cell .bh-st .en { display: none; } }
/* Floor plan */
.fp-pick select { min-width: 0; }
.fp-modes { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0; } .fp-mode.on { background: var(--gold); color: var(--on-gold); border-color: var(--gold); font-weight: 600; }
#fpRoomRow { margin-bottom: 6px; } #fpRoomRow select { flex: 0 1 45%; } #fpRoomRow input { flex: 1; margin: 0; } #fpRoomRow select { margin: 0; }
#fpStage { background: var(--paper-white); border-radius: 8px; overflow: hidden; border: 1px solid var(--line); touch-action: manipulation; }
#fpSvg { display: block; width: 100%; height: auto; max-height: 78vh; cursor: crosshair; }
.fp-w { stroke: var(--fp-wall); stroke-width: .25%; } .fp-none { fill: var(--fp-none); }
.fp-good { fill: var(--fp-good); } .fp-bad { fill: var(--fp-bad); } .fp-clash { fill: var(--fp-clash); }
#fpSvg text { text-anchor: middle; font-weight: 700; fill: var(--fp-ink); paint-order: stroke; stroke: rgba(255, 255, 255, .85); stroke-width: 3px; stroke-linejoin: round; pointer-events: none; }
#fpSvg .fp-dn { fill: var(--fp-dn); } #fpSvg .fp-g { fill: var(--fp-g); } #fpSvg .fp-b { fill: var(--fp-b); }
.fp-taiji circle { fill: var(--paper-white); stroke: var(--fp-ink); stroke-width: 2px; } .fp-room circle { fill: var(--fp-room); stroke: var(--paper-white); stroke-width: 2px; } .fp-room.door circle { fill: var(--art-gold); }
#fpSvg .fp-room text { fill: var(--paper-white); stroke: none; } #fpSvg .fp-room.door text { fill: var(--fp-ink); } #fpSvg .fp-room .fp-rl { fill: var(--fp-ink); stroke: rgba(255, 255, 255, .9); stroke-width: 3px; font-weight: 600; }
.fp-north circle { fill: rgba(255, 255, 255, .9); stroke: var(--fp-ink); stroke-width: 1.5px; } .fp-north path { fill: var(--fp-north); }
.fp-align { margin-top: 8px; } .fp-align input[type=range] { padding: 0; accent-color: var(--gold); }
.fp-rooms { list-style: none; padding: 0; margin: 8px 0 0; font-size: 14px; } .fp-rooms li { display: flex; align-items: center; gap: 6px; padding: 4px 0; border-top: 1px solid var(--line); }
.fp-rooms .fp-ic { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--teal); color: var(--on-teal); font-size: 12px; }
.fp-rm { margin-left: auto; padding: 2px 8px; font-size: 12px; }
.fp-ok { color: var(--green); } .fp-warn { color: var(--gold); }
#fpFile { display: none; }

/* Guanyin fortune sticks 观音灵签 */
.sb-nav .tag.free { background: var(--green); color: var(--on-acc); }
.gy-stage { display: grid; place-items: center; padding: 8px 0 4px; }
.gy-tube { position: relative; width: 110px; height: 170px; transform-origin: 50% 90%; }
.gy-sticks { position: absolute; left: 14px; right: 14px; bottom: 80px; height: 80px; display: flex; justify-content: center; align-items: flex-end; gap: 3px; }
.gy-sticks i { display: block; width: 7px; height: 70px; border-radius: 3px 3px 1px 1px; background: linear-gradient(90deg, var(--stick-1), var(--stick-2) 45%, var(--stick-3)); box-shadow: 0 1px 1px rgba(0,0,0,.4); }
.gy-sticks i:nth-child(odd) { height: 62px; } .gy-sticks i:nth-child(3n) { height: 76px; }
.gy-sticks i::before { content: ''; display: block; height: 10px; border-radius: 3px 3px 0 0; background: var(--lacquer); }
.gy-cup { position: absolute; left: 0; right: 0; bottom: 0; height: 96px; border-radius: 10px 10px 18px 18px; display: grid; place-items: center;
  background: linear-gradient(90deg, var(--lacquer-dk), var(--lacquer-2) 40%, var(--lacquer-3)); border: 2px solid var(--art-gold); box-shadow: inset 0 6px 10px rgba(0,0,0,.35), 0 4px 10px rgba(0,0,0,.5); }
.gy-cup span { color: var(--art-gold-lt); font-weight: 700; font-size: 15px; line-height: 1.25; text-align: center; letter-spacing: 2px; }
.gy-tube.shaking { animation: gyShake .16s ease-in-out infinite alternate; }
@keyframes gyShake { from { transform: rotate(-14deg) translateY(-2px); } to { transform: rotate(14deg) translateY(2px); } }
.gy-fall { position: absolute; left: 50%; bottom: 120px; width: 12px; height: 92px; margin-left: -6px; border-radius: 4px; background: linear-gradient(90deg, var(--stick-1), var(--stick-hi) 45%, var(--stick-3));
  box-shadow: 0 2px 6px rgba(0,0,0,.6); animation: gyFall .7s cubic-bezier(.2,.8,.3,1) forwards; display: grid; place-items: start center; }
.gy-fall b { margin-top: 14px; writing-mode: vertical-rl; font-size: 10px; color: var(--lacquer-dk); }
@keyframes gyFall { from { transform: translateY(40px) rotate(0); opacity: .2; } to { transform: translate(78px, 70px) rotate(72deg); opacity: 1; } }
.gy-btns { justify-content: center; align-items: center; } .gy-ask #gyHint { text-align: center; }
.gy-blocks { display: flex; gap: 18px; justify-content: center; margin: 10px 0; min-height: 56px; }
.gy-block { width: 56px; height: 30px; border-radius: 30px 30px 6px 6px; background: linear-gradient(var(--block-1), var(--block-2)); border: 1px solid var(--block-edge); box-shadow: 0 3px 4px rgba(0,0,0,.45); }
.gy-block.flat { border-radius: 6px 6px 30px 30px; background: linear-gradient(var(--block-flat), var(--lacquer-2)); }
.gy-blocks.tossing .gy-block { animation: gyToss .5s ease-out; }
@keyframes gyToss { 0% { transform: translateY(-40px) rotate(-200deg); } 70% { transform: translateY(4px) rotate(10deg); } 100% { transform: none; } }
.gy-tosses { text-align: center; } .gy-tosses .small { display: block; }
.gy-card { border-color: color-mix(in srgb, var(--gold-tint) 55%, var(--card)); }
.gy-head { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.gy-num { font-size: 26px; font-weight: 800; color: var(--gold); }
.gy-grade { padding: 3px 10px; border-radius: 999px; font-weight: 700; font-size: 14px; }
.gy-grade.up { background: var(--pill-up); color: var(--pill-up-ink); } .gy-grade.mid { background: var(--pill-mid); color: var(--pill-mid-ink); } .gy-grade.low { background: var(--pill-low); color: var(--pill-low-ink); }
.gy-poem { display: flex; flex-direction: row-reverse; justify-content: center; gap: 14px; margin: 14px 0; padding: 14px; border-radius: 10px; background: var(--paper); color: var(--paper-ink); }
.gy-poem span { writing-mode: vertical-rl; font-size: 20px; letter-spacing: 4px; font-family: "Songti SC", "Noto Serif SC", serif; }
@media (max-width: 380px) { .gy-poem span { font-size: 17px; letter-spacing: 2px; } .gy-poem { gap: 8px; } }
.gy-sec { margin: 10px 0; } .gy-sec b { color: var(--gold); }
.gy-topic { background: var(--panel); border-left: 4px solid var(--gold); border-radius: 10px; padding: 12px 14px; font-size: 15.5px; line-height: 1.6; }
.gy-verdict { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.gy-verdict span { border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; font-size: 13px; }
details.gy-alt summary { cursor: pointer; color: var(--muted); font-size: 13px; }

/* Tarot 塔罗: deck, shuffle, fan to pick from, flip, spreads */
.tr-back { background: radial-gradient(circle at 50% 50%, var(--art-gold) 0 7%, transparent 8%), repeating-linear-gradient(45deg, var(--tarot-1) 0 6px, var(--tarot-2) 6px 12px);
  border: 2px solid var(--art-gold); border-radius: 7px; box-shadow: inset 0 0 0 3px var(--tarot-1), inset 0 0 0 4px var(--tarot-rim), 0 3px 6px rgba(0,0,0,.5); }
.tr-stage { position: relative; height: 200px; overflow: hidden; display: grid; place-items: center; margin: 8px 0 2px; }
.tr-deck { position: relative; width: 84px; height: 140px; }
.tr-deck i { position: absolute; inset: 0; } .tr-deck i:nth-child(n) { transform: translate(calc(var(--k, 0) * 1px), calc(var(--k, 0) * -1px)); }
.tr-deck i:nth-child(1) { --k: 0 } .tr-deck i:nth-child(2) { --k: 1 } .tr-deck i:nth-child(3) { --k: 2 } .tr-deck i:nth-child(4) { --k: 3 } .tr-deck i:nth-child(5) { --k: 4 } .tr-deck i:nth-child(6) { --k: 5 }
.tr-deck.shuffling i:nth-child(odd) { animation: trRiffleL .45s ease-in-out infinite alternate; }
.tr-deck.shuffling i:nth-child(even) { animation: trRiffleR .45s ease-in-out infinite alternate; }
@keyframes trRiffleL { from { transform: translateX(0) rotate(0); } to { transform: translateX(-52px) rotate(-12deg); } }
@keyframes trRiffleR { from { transform: translateX(0) rotate(0); } to { transform: translateX(52px) rotate(12deg); } }
.tr-fan { position: absolute; left: 0; right: 0; top: 0; bottom: 0; }
.tr-fan button { position: absolute; left: 50%; top: 40px; width: 58px; height: 96px; margin-left: -29px; padding: 0; transform-origin: 50% 230%;
  transform: rotate(var(--a)); transition: transform .35s ease, opacity .35s ease; animation: trFanIn .5s ease-out backwards; animation-delay: var(--d); }
.tr-fan button:hover:not(:disabled) { transform: rotate(var(--a)) translateY(-14px); }
.tr-fan button.picked { transform: rotate(var(--a)) translateY(-70px); opacity: 0; pointer-events: none; }
@keyframes trFanIn { from { transform: rotate(0); opacity: 0; } }
.tr-say { text-align: center; min-height: 1em; } .tr-btns { justify-content: center; align-items: center; }
/* the spread */
.tr-spread { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; margin: 12px 0; }
.tr-slot { display: flex; flex-direction: column; align-items: center; gap: 4px; width: var(--w, 100px); text-align: center; }
.tr-slot .pos { font-size: 12px; color: var(--gold); font-weight: 600; }
.tr-slot .nm { font-size: 12.5px; line-height: 1.3; } .tr-slot .nm.rev { color: var(--bad2); }
.tr-card { width: var(--w, 100px); aspect-ratio: 300 / 515; perspective: 800px; }
.tr-in { position: relative; width: 100%; height: 100%; transition: transform .7s ease; transform-style: preserve-3d; }
.tr-card.up .tr-in { transform: rotateY(180deg); }
.tr-card .tr-back, .tr-card .tr-face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.tr-face { transform: rotateY(180deg); border-radius: 7px; overflow: hidden; background: var(--paper); box-shadow: 0 3px 8px rgba(0,0,0,.55); }
.tr-face img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tr-face.rev img { transform: rotate(180deg); }
.tr-card.land { animation: trLand .35s ease-out; }
@keyframes trLand { from { transform: translateY(-40px) scale(.8); opacity: 0; } }
.tr-spread.one { --w: 150px; } .tr-spread.three { --w: 100px; }
@media (max-width: 380px) { .tr-spread.three { --w: 92px; gap: 8px; } }
/* Celtic Cross: the cross (1 centre, 2 across it, 3 below, 4 left, 5 above, 6 right) and the staff (7 bottom to 10 top) */
.tr-spread.celtic { --w: 62px; display: grid; grid-template-columns: repeat(3, var(--w)) 14px var(--w); grid-template-rows: repeat(4, auto); gap: 6px 6px; justify-content: center; }
.tr-spread.celtic .tr-slot .nm { display: none; } .tr-spread.celtic .tr-slot .pos { font-size: 11px; }
.tr-spread.celtic .p1 { grid-area: 2 / 2; } .tr-spread.celtic .p2 { grid-area: 2 / 2; z-index: 2; justify-content: center; padding-top: 16px; }
.tr-spread.celtic .p2 .tr-card { transform: rotate(90deg); } .tr-spread.celtic .p2 .pos, .tr-spread.celtic .p2 .nm { display: none; }
.tr-spread.celtic .p3 { grid-area: 3 / 2; } .tr-spread.celtic .p4 { grid-area: 2 / 1; } .tr-spread.celtic .p5 { grid-area: 1 / 2; } .tr-spread.celtic .p6 { grid-area: 2 / 3; }
.tr-spread.celtic .p7 { grid-area: 4 / 5; } .tr-spread.celtic .p8 { grid-area: 3 / 5; } .tr-spread.celtic .p9 { grid-area: 2 / 5; } .tr-spread.celtic .p10 { grid-area: 1 / 5; }
/* meanings under the spread */
.tr-mean { display: flex; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.tr-mean img { width: 64px; height: 110px; object-fit: cover; border-radius: 5px; flex: none; }
.tr-mean img.rev { transform: rotate(180deg); }
.tr-mean h3 { margin: 0 0 4px; font-size: 15.5px; } .tr-mean h3 .zh { color: var(--muted); font-weight: 400; }
.tr-ori { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; margin-left: 6px; vertical-align: 1px; }
.tr-ori.up { background: var(--pill-up); color: var(--pill-up-ink); } .tr-ori.rev { background: var(--pill-low); color: var(--pill-low-ink); }
.tr-kw { font-size: 13px; color: var(--muted); margin: 2px 0 6px; }
.tr-topic { background: var(--panel); border-left: 4px solid var(--gold); border-radius: 8px; padding: 8px 10px; font-size: 15px; line-height: 1.55; margin-bottom: 6px; }
details.tr-waite summary { cursor: pointer; color: var(--muted); font-size: 13px; }
details.tr-waite p { font-size: 13.5px; margin: 6px 0 0; }
.tr-spreadsel option:disabled { color: var(--muted); }

/* Landing page (signed-out visitors) */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.landing { max-width: 960px; margin: 0 auto; }
.ld-bar { display: flex; justify-content: space-between; align-items: center; margin: 4px 0 12px; }
.ld-lang select { margin: 0; width: auto; padding: 6px 8px; font-size: 14px; }
/* Appearance picker in the page footer (every screen, also signed out); the full switch is in Settings. */
.ft-theme { display: inline-flex; align-items: center; gap: 6px; margin: 10px 0 0; font-size: 12px; color: var(--muted); }
.ft-theme select { display: inline-block; width: auto; margin: 0; padding: 4px 6px; font-size: 13px; }
/* Appearance: three-way switch in Settings (Match my phone / Light / Dark) */
.seg { display: flex; gap: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; max-width: 460px; }
.seg button { flex: 1 1 0; min-width: 0; min-height: 44px; border: 0; border-radius: 0; background: var(--field); color: var(--ink); padding: 8px 6px; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-checked="true"] { background: var(--gold); color: var(--on-gold); font-weight: 600; }
body:has(#signedOut:not(.hidden)) header.top { display: none; }
.ld-hero { padding: 26px 20px; background: radial-gradient(120% 140% at 100% 0%, color-mix(in srgb, var(--gold-tint) 18%, transparent), transparent 55%), var(--card); }
.ld-hero h1 { font-size: 30px; }
.ld-tag { font-size: 17px; max-width: 34em; margin: 0 0 18px; }
.ld-h { margin: 18px 4px 10px; }
.ld-say { margin: -6px 4px 10px; word-break: keep-all; }
.sb-say { padding: 2px 10px 6px; font-size: 11.5px; line-height: 1.35; word-break: keep-all; }
.ld-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 12px; }
.ld-grid .card { margin: 0; }
@media (max-width: 760px) { .ld-grid { grid-template-columns: 1fr; } }
.ld-zi { font-size: 34px; font-weight: 700; color: var(--gold); line-height: 1; }
.ld-sec h3 { margin: 6px 0 2px; }
.ld-sec ul, .ld-free { margin: 8px 0 0; padding-left: 18px; } .ld-sec li, .ld-free li { margin: 4px 0; }
.ld-tiers { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
@media (max-width: 760px) { .ld-tiers { grid-template-columns: repeat(2, 1fr); } }
.ld-tier { display: flex; flex-direction: column; gap: 4px; border: 1px solid var(--line); border-radius: 8px; padding: 10px; background: var(--cell); }
.ld-cost { color: var(--gold); font-weight: 600; }
.ld-sub { margin-top: auto; }
.ld-tier .ld-cost { margin-bottom: 6px; }
.ld-subnote { color: var(--gold); font-weight: 600; }
/* Website payments only: inside the iPhone / Android apps purchases stay in the store (Google Play rules). */
html.native .ld-sub, html.native .ld-subnote, html.native .ld-subhow { display: none !important; }
/* One store tile (Google Play) since the iPhone tile was removed 1 Dec: one column, wide enough for its name on one line. */
.ld-stores { display: grid; grid-template-columns: minmax(0, 300px); gap: 8px; max-width: 460px; align-items: stretch; }
/* Not buttons yet: dashed outline, no fill, default cursor, so they don't look tappable. */
.ld-store { display: flex; flex-direction: column; padding: 10px 12px; border: 1px dashed var(--line); border-radius: 8px; background: transparent; font-weight: 600; color: var(--muted); cursor: default; user-select: none; }
.ld-store small { font-weight: 400; font-size: 14px; color: var(--muted); font-style: italic; }
.ld-store.ld-live { border-style: solid; border-color: var(--gold); color: var(--gold); cursor: pointer; text-decoration: none; }
.ld-store.ld-live small { font-style: normal; }
.landing li { text-wrap: pretty; }
/* Start page small print: at least 14px on phones (AI eye 16 Nov). Charts keep the global 12px .small. */
.landing .small, .foot { font-size: 14px; line-height: 1.45; }
html.native .ld-price, html.native .ld-apps { display: none; }
/* Store apps: no "coming soon" placeholders (App Store guideline 2.1 / Play metadata policy); the website still shows them. */
html.native .sb-nav button.soon, html.native li.soon { display: none; }
/* Legal pages */
.legalpage { max-width: 760px; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 16px) 16px calc(env(safe-area-inset-bottom) + 16px); }
.legalpage h1 { font-size: 24px; } .legalpage h2 { margin-top: 22px; } .legalpage a { color: var(--gold); }
.legalpage li { margin: 4px 0; }
.draft { border: 2px dashed var(--gold); border-radius: 10px; padding: 10px 14px; margin: 10px 0 16px; background: color-mix(in srgb, var(--gold-tint) 8%, transparent); }
html.zh .cell .en, html.zh .bh-s .en, html.zh .bh-st .en { display: none; }
/* 神煞 tags (Bazi table) and 称骨 */
table.bz tr.ss td { vertical-align: top; padding-top: 6px; white-space: normal; overflow-wrap: anywhere; }
.ss { display: inline-block; margin: 2px 1px; padding: 1px 6px; border-radius: 9px; font-size: 11px; line-height: 1.5; white-space: nowrap; border: 1px solid var(--line); }
.ss-good { background: var(--ss-good-bg); border-color: var(--ss-good-line); color: var(--ss-good-ink); }
.ss-hard { background: color-mix(in srgb, var(--muted) 12%, transparent); color: var(--chip-ink2); }
.ss-note { margin-top: 4px; }
.cg-w { margin: 4px 0; }
.cg-verse { margin: 6px 0; padding: 8px 12px; border-left: 3px solid var(--gold); background: color-mix(in srgb, var(--gold-tint) 7%, transparent); border-radius: 0 8px 8px 0; line-height: 1.8; letter-spacing: .5px; }
/* Bazi "Now" panel: 大运 / 流年 / 流月 / 流日 and tappable strips */
table.bz.now tr.when td { line-height: 1.3; }
.flrow { position: relative; display: flex; gap: 4px; overflow-x: auto; padding: 2px 0 6px; -webkit-overflow-scrolling: touch; }
.fl { flex: 0 0 auto; min-width: 46px; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 3px 4px; border-radius: 6px;
  border: 1px solid var(--line); background: transparent; color: inherit; font: inherit; cursor: pointer; }
.fl .gz { font-size: 17px; line-height: 1.2; font-weight: 700; }
.fl .small { font-size: 10px; white-space: nowrap; }
.fl.today { border-style: dashed; border-color: var(--gold); }
.fl.on { border-style: solid; border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); background: color-mix(in srgb, var(--gold-tint) 8%, transparent); }
.fl-reset { padding: 4px 12px; font-size: 12px; }

/* 神煞 / 称骨 note card (tap a tag) */
button.ss { font: inherit; font-size: 11px; cursor: pointer; }
.ss-en { display: block; font-size: 9.5px; line-height: 1.2; white-space: normal; } html.zh .ss-en { display: none; }
button.ss:hover, button.ss:focus-visible { border-color: var(--gold); outline: none; }
.cg-tag { font-size: 14px !important; font-weight: 600; padding: 2px 10px; }
.ssi { position: fixed; inset: 0; z-index: 60; background: var(--scrim); display: flex; align-items: flex-end; justify-content: center; padding: calc(env(safe-area-inset-top) + 12px) 12px calc(env(safe-area-inset-bottom) + 12px); }
.ssi[hidden] { display: none; }
.ssi-card { position: relative; width: 100%; max-width: 520px; max-height: 80vh; overflow-y: auto; background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px 10px; box-shadow: 0 8px 30px var(--shade); }
@media (min-width: 760px) { .ssi { align-items: center; } }
.ssi-card h3 { margin: 0 28px 6px 0; }
.ssi-card p { margin: 8px 0; line-height: 1.5; }
.ssi-en { font-size: 13px; font-weight: normal; color: var(--muted); }
html.zh .ssi-en { display: none; }
.ssi-x { position: absolute; top: 8px; right: 10px; background: none; border: 0; color: inherit; font-size: 22px; line-height: 1; cursor: pointer; padding: 4px 8px; }
.ssi-tone { display: inline-block; padding: 1px 8px; border-radius: 9px; font-size: 12px; border: 1px solid var(--line); }
.ssi-good { background: color-mix(in srgb, var(--green) 16%, transparent); border-color: color-mix(in srgb, var(--green) 50%, transparent); }
.ssi-hard { background: color-mix(in srgb, var(--red) 14%, transparent); border-color: color-mix(in srgb, var(--red) 50%, transparent); }
.ssi-mixed { background: color-mix(in srgb, var(--gold-tint) 14%, transparent); border-color: color-mix(in srgb, var(--gold-tint) 50%, transparent); }

/* Report this reading (flag under every AI reading) */
.rp-flag { margin-left: auto; background: none; border: 1px solid var(--line); color: var(--muted); font-size: 12px; padding: 3px 9px; border-radius: 12px; cursor: pointer; }
.rp-flag:hover { color: var(--ink); }
.rp-flag.sent { opacity: .7; }
.rp-reasons { border: 0; padding: 0; margin: 8px 0; display: grid; gap: 4px; }
.rp-reasons legend { font-weight: bold; margin-bottom: 4px; }
.rp-card textarea { width: 100%; box-sizing: border-box; }
.rp-card .ssi-x-btn { background: none; }
.rp-comment { background: color-mix(in srgb, var(--gold-tint) 10%, transparent); border-left: 3px solid color-mix(in srgb, var(--gold-tint) 60%, transparent); padding: 6px 10px; }
.rp-reviewed .hist-title { opacity: .7; }
table.errs td.err-msg { word-break: break-word; max-width: 420px; }
table.errs td.err-leo { word-break: break-word; max-width: 260px; font-size: 0.85em; }
.jn-row { display: flex; gap: 14px; align-items: center; padding: 8px 0; border-bottom: 1px solid color-mix(in srgb, var(--ink) 8%, transparent); }
.jn-fig { display: flex; flex-direction: column; min-width: 120px; }
.jn-pct { font-size: 1.8em; color: var(--zmajor); line-height: 1.1; }
/* App review sign-in (hidden unless ?review or 5 taps on the title) */
.emailOpen { display: block; width: 100%; max-width: 320px; margin-top: 10px; padding: 11px 14px; font-size: 15px; }
.emailForm { display: flex; flex-direction: column; gap: 8px; max-width: 340px; margin: 12px 0 4px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; }
.emailForm p { margin: 0; }
.emailForm .err:empty { display: none; }
.emailForm .row { gap: 16px; }
.emTabs { display: flex; gap: 6px; }
.emTabs button { flex: 1; min-height: 36px; opacity: .65; }
.emTabs button.active { opacity: 1; border-color: var(--gold); color: var(--gold); }
#veMsg:empty { display: none; }
/* Liu Yao 六爻: three coins, the lines built so far (top line on top), the chart table. */
.ly-coins { display: flex; justify-content: center; gap: 16px; margin: 14px 0 4px; perspective: 600px; }
.ly-coin { width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-size: 20px; font-weight: 700; color: var(--coin-ink);
  background: radial-gradient(circle at 50% 50%, var(--card) 0 15%, transparent 16%), radial-gradient(circle at 35% 30%, var(--coin-1), var(--coin-2) 70%, var(--coin-3));
  box-shadow: inset 0 0 0 3px var(--coin-rim), 0 3px 6px rgba(0,0,0,.5); }
.ly-coin.zi, .ly-coin.bei { background: radial-gradient(circle at 35% 30%, var(--coin-1), var(--coin-2) 70%, var(--coin-3)); }
.ly-coin.bei { color: var(--coin-ink-b); background: radial-gradient(circle at 35% 30%, var(--coin-b1), var(--coin-3) 70%, var(--coin-b3)); }
.ly-coin.spin { animation: lySpin .25s linear infinite; }
@keyframes lySpin { from { transform: rotateY(0) translateY(-6px); } to { transform: rotateY(360deg) translateY(-6px); } }
.ly-say { text-align: center; min-height: 1em; } .ly-btns { justify-content: center; }
/* One-tap cast: tip line, big Cast button, six progress dots (filled as lines land), the newest line drawn in. */
.ly-tip { text-align: center; margin: 12px 0 0; color: var(--gold); font-style: italic; }
.ly-cast { min-width: 160px; font-size: 1.08em; }
.ly-mode { text-align: center; margin: 6px 0 0; }
.ly-prog { display: flex; justify-content: center; gap: 8px; margin: 8px 0 0; }
.ly-prog i { width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid var(--gold); }
.ly-prog i.on { background: var(--gold); }
.ly-row.ly-new .ly-line i { animation: lyDrawIn .35s ease-out both; transform-origin: left center; }
@keyframes lyDrawIn { from { transform: scaleX(0); opacity: .3; } to { transform: scaleX(1); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .ly-row.ly-new .ly-line i, .ly-coin.spin { animation: none; } }
.ly-build { display: flex; flex-direction: column; align-items: center; gap: 4px; margin: 6px 0 10px; min-height: 8px; }
.ly-row { display: grid; grid-template-columns: 16px 92px 16px auto; align-items: center; gap: 8px; }
.ly-line { display: inline-flex; gap: 12%; width: 84px; height: 11px; vertical-align: middle; }
.ly-line i { flex: 1; background: var(--ink); border-radius: 2px; }
.ly-line.yang i:last-child { display: none; }
.ly-line.mv i { background: var(--red); }
.ly-mk { display: inline-block; width: 14px; color: var(--red-ink); text-align: center; }
.ly-hexes { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; margin: 10px 0; }
.ly-hx { display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; min-width: 150px; }
.ly-hx b { font-size: 22px; color: var(--gold); }
.ly-hxl { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; } .ly-hxl .ly-line { width: 56px; height: 7px; }
.ly-arrow { font-size: 22px; color: var(--muted); } .ly-still { max-width: 220px; }
.ly-chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 4px 0 10px; }
.ly-chips .chip { font-size: 12.5px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); background: color-mix(in srgb, var(--ink) 4%, transparent); }
.ly-wrap { overflow-x: auto; }
table.ly-chart { width: 100%; border-collapse: collapse; font-size: 14px; }
.ly-chart th { font-size: 12px; color: var(--muted); font-weight: 600; text-align: left; padding: 2px 4px; }
.ly-chart td { padding: 6px 4px; border-top: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
.ly-chart tr.yong td { background: color-mix(in srgb, var(--gold-tint) 10%, transparent); } .ly-chart tr.yong td:first-child { box-shadow: inset 3px 0 0 var(--gold); }
.ly-chart .ly-god, .ly-chart .ly-fu { color: var(--muted); font-size: 13px; }
.ly-chart .ly-g { white-space: nowrap; } .ly-chart .ly-g .ly-line { width: 64px; }
.ly-chw { display: flex; align-items: center; gap: 6px; }
.ly-chart .ly-ch .ly-line { width: 44px; height: 9px; }
.ly-sy b { display: inline-block; width: 1.6em; text-align: center; border-radius: 4px; font-size: 13px; }
.ly-sy .shi { background: var(--gold); color: var(--on-gold); } .ly-sy .ying { border: 1px solid var(--gold); color: var(--gold); }
.ly-tags { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 3px; white-space: normal; }
.ly-tag { font-size: 11px; line-height: 1.3; padding: 0 5px; border-radius: 4px; background: color-mix(in srgb, var(--ink) 6%, transparent); color: var(--chip-ink2); }
.ly-tag.good { color: var(--green); } .ly-tag.bad { color: var(--bad2); }
.ly-yong { margin: 10px 0 4px; } .ly-help summary { cursor: pointer; font-size: 13px; color: var(--gold); }
@media (max-width: 480px) { table.ly-chart { font-size: 13px; } .ly-chart .ly-g .ly-line { width: 48px; } .ly-chart .ly-ch .ly-line { width: 32px; } .ly-hx { min-width: 130px; } }
/* Liu Yao five roles (用神 原神/喜神 忌神 仇神 闲神) */
.ly-role { display: inline-grid; place-items: center; width: 1.45em; height: 1.45em; margin-right: 4px; border-radius: 50%; font-size: 11px; font-weight: 700; vertical-align: 1px; border: 1px solid currentColor; }
.ly-role.r-yong { color: var(--gold); } .ly-role.r-yong.main { background: var(--gold); color: var(--on-gold); border-color: var(--gold); }
.ly-role.r-yuan { color: var(--green); } .ly-role.r-ji { color: var(--bad2); } .ly-role.r-chou { color: var(--chou); } .ly-role.r-xian { color: var(--muted); }
.ly-tag.lv { font-weight: 700; } .ly-tag.lv-strong { color: var(--green); } .ly-tag.lv-weak, .ly-tag.lv-broken, .ly-tag.lv-void { color: var(--bad2); }
.ly-legend { color: var(--muted); margin: 8px 0 0; } .ly-pick { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 6px; } .ly-pick select { width: auto; min-width: 0; max-width: 100%; flex: 1 1 12em; }
.ly-roles { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line); } .ly-roles h3 { margin: 4px 0 6px; font-size: 16px; }
.ly-rrow { display: grid; grid-template-columns: 22px minmax(0, 1.3fr) auto minmax(0, 2fr); gap: 4px 8px; align-items: center; padding: 5px 0; border-top: 1px dashed var(--line); font-size: 14px; }
.ly-rname { display: flex; flex-direction: column; min-width: 0; } .ly-rel2 { white-space: nowrap; }
.ly-where { display: flex; flex-wrap: wrap; gap: 4px 10px; } .ly-at { white-space: nowrap; } .ly-dong { color: var(--red-ink); font-size: 12px; }
.ly-as { margin: 10px 0 0; padding: 8px 10px; border-left: 3px solid var(--line); background: color-mix(in srgb, var(--ink) 3%, transparent); border-radius: 0 8px 8px 0; }
.ly-as p { margin: 0; font-size: 14px; } .ly-roles .tone-good { border-left-color: var(--green); } .ly-roles .tone-bad { border-left-color: var(--bad2); } .ly-roles .tone-mid { border-left-color: var(--gold); }
.ly-basis { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; } .ly-basis .chip { font-size: 12px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); }
.ly-overall { margin: 10px 0 4px; padding: 8px 10px; border-left: 3px solid var(--line); font-weight: 600; font-size: 14px; } .ly-xi { margin: 6px 0; }
.ly-zh { display: none; } html.zh .ly-zh { display: inline; } html.zh .ly-en { display: none; }
/* Liu Yao for a layman: answer first, simple picture, key lines; the expert chart folds away. Every term taps to explain. */
[data-lyt] { cursor: pointer; } .lyt { border-bottom: 1px dotted currentColor; }
[data-lyt]:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
.ly-q { margin: 0 0 4px; line-height: 1.45; } .ly-q b { font-size: 17px; }
.ly-answer { margin-top: 8px; }
.ly-verdict .ly-v { font-size: 24px; font-weight: 700; margin: 0 0 6px; }
.ly-verdict .ly-why { font-size: 15px; font-weight: 500; margin: 0; }
.ly-verdict.v-likely { border-color: var(--green); background: linear-gradient(135deg, color-mix(in srgb, var(--green) 22%, transparent), color-mix(in srgb, var(--green) 6%, transparent)); } .ly-verdict.v-likely .ly-v, .ly-verdict.v-likely .rc-label { color: var(--green); }
.ly-verdict.v-unlikely { border-color: var(--bad2); background: linear-gradient(135deg, color-mix(in srgb, var(--red) 20%, transparent), color-mix(in srgb, var(--red) 5%, transparent)); } .ly-verdict.v-unlikely .ly-v, .ly-verdict.v-unlikely .rc-label { color: var(--bad2); }
.ly-verdict.v-mixed .ly-v { color: var(--gold); }
.ly-h3 { margin: 18px 0 6px; font-size: 16px; }
.lyp { display: flex; align-items: flex-start; justify-content: center; gap: 10px; }
.lyp-col { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; flex: 0 1 auto; }
.lyp-h { font-size: 12px; color: var(--muted); letter-spacing: .04em; }
.lyp-lines { display: flex; flex-direction: column; gap: 7px; padding: 10px 10px; border: 1px solid var(--line); border-radius: 12px; background: color-mix(in srgb, var(--ink) 3%, transparent); }
.lyp-row { display: grid; grid-template-columns: 12px 72px 14px auto; align-items: center; gap: 6px; min-height: 22px; }
.lyp-c .lyp-row { grid-template-columns: 72px; }
.lyp .ly-line { width: 72px; height: 13px; }
.lyp-row.chg .ly-line i { background: var(--gold); }
.lyp-n { font-size: 11px; color: var(--muted); text-align: right; }
.lyp-tags { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.lyp-arrow { align-self: center; font-size: 26px; color: var(--gold); margin-top: -40px; }
.lyp-name { display: flex; flex-direction: column; align-items: center; text-align: center; max-width: 170px; line-height: 1.35; }
.lyp-name b { color: var(--gold); font-size: 15px; } .lyp-key { text-align: center; margin: 8px 0 0; }
.lyk { display: inline-block; font-size: 11px; line-height: 1.3; padding: 1px 7px; border-radius: 999px; font-weight: 600; white-space: nowrap; }
.lyk.k-shi { background: var(--gold); color: var(--on-gold); } .lyk.k-ying { border: 1px solid var(--teal); color: var(--teal); } .lyk.k-yong { border: 1px solid var(--pink); color: var(--pink); }
.ly-keys { margin-top: 14px; } .ly-keys h3 { margin: 0 0 6px; font-size: 16px; }
.lyk-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding: 9px 0; border-top: 1px solid var(--line); }
.lyk-row p { flex-basis: 100%; margin: 2px 0 0; font-size: 14.5px; line-height: 1.45; }
.lyk-row .lyk { font-size: 12.5px; padding: 2px 9px; }
.lyk-st { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.lys { font-size: 12px; padding: 1px 8px; border-radius: 6px; border: 1px solid var(--line); }
.lys-strong, .lys-fair { color: var(--green); border-color: color-mix(in srgb, var(--green) 50%, transparent); } .lys-weak, .lys-broken { color: var(--bad2); border-color: color-mix(in srgb, var(--bad2) 50%, transparent); }
.lys-void { color: var(--purple); border-color: color-mix(in srgb, var(--purple) 50%, transparent); } .lys-moving { color: var(--red-ink); border-color: color-mix(in srgb, var(--red) 50%, transparent); }
.ly-full { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 10px; }
.ly-full > summary { cursor: pointer; display: inline-block; padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; color: var(--gold); font-weight: 600; list-style: none; }
.ly-full > summary::-webkit-details-marker { display: none; } .ly-full > summary::before { content: '▸ '; } .ly-full[open] > summary::before { content: '▾ '; }
.ly-fullname { margin: 12px 0 0; }
/* Casting help: animated coins, steps, the sum table; own-coin entry with heads / tails */
.ly-how { margin: 10px 0 4px; } .ly-how > summary { cursor: pointer; color: var(--gold); font-size: 14px; font-weight: 600; }
.ly-demo { display: flex; justify-content: center; gap: 14px; height: 74px; margin: 8px 0 2px; perspective: 500px; }
.ly-dc { position: relative; width: 40px; height: 40px; font-style: normal; animation: lyDrop 2.6s ease-in infinite; transform-style: preserve-3d; }
.ly-dc:nth-child(2) { animation-delay: .15s; } .ly-dc:nth-child(3) { animation-delay: .3s; }
.ly-dc b { position: absolute; inset: 0; display: grid; place-items: center; border-radius: 50%; backface-visibility: hidden; font-size: 15px;
  color: var(--coin-ink); background: radial-gradient(circle at 35% 30%, var(--coin-1), var(--coin-2) 70%, var(--coin-3)); }
.ly-dc b + b { transform: rotateY(180deg); color: var(--coin-ink-b); background: radial-gradient(circle at 35% 30%, var(--coin-b1), var(--coin-3) 70%, var(--coin-b3)); }
@keyframes lyDrop { 0% { transform: translateY(0) rotateY(0); } 35% { transform: translateY(30px) rotateY(540deg); } 45% { transform: translateY(26px) rotateY(540deg); } 52%, 100% { transform: translateY(30px) rotateY(540deg); } }
.ly-dc:nth-child(2) { animation-name: lyDrop2; } @keyframes lyDrop2 { 0% { transform: translateY(0) rotateY(0); } 35% { transform: translateY(30px) rotateY(720deg); } 45% { transform: translateY(26px) rotateY(720deg); } 52%, 100% { transform: translateY(30px) rotateY(720deg); } }
@media (prefers-reduced-motion: reduce) { .ly-dc { animation: none; transform: translateY(30px); } }
.ly-steps { margin: 6px 0; padding-left: 20px; font-size: 14px; line-height: 1.5; } .ly-steps li { margin-bottom: 4px; }
.ly-sumtab { display: grid; gap: 4px; margin: 8px 0; font-size: 13px; }
.ly-sumtab > div { display: grid; grid-template-columns: 62px minmax(0, 1fr) 60px minmax(0, 1.2fr); gap: 8px; align-items: center; padding: 4px 6px; border-radius: 8px; background: color-mix(in srgb, var(--ink) 3%, transparent); }
.ly-sumtab .ly-line { width: 56px; height: 9px; } .ly-cf { letter-spacing: .08em; color: var(--gold); }
.ly-man { margin: 10px 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; }
.ly-mcs { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.ly-mc { display: flex; flex-direction: column; align-items: stretch; gap: 4px; min-width: 92px; }
.ly-mc > span { text-align: center; }
.ly-mc button { margin: 0; padding: 7px 8px; font-size: 13.5px; }
.ly-mc button.on { background: var(--gold); color: var(--on-gold); border-color: var(--gold); font-weight: 700; }
#lyManSum { text-align: center; }
@media (max-width: 420px) {
  .lyp { gap: 6px; } .lyp-lines { padding: 8px 6px; } .lyp-row { grid-template-columns: 10px 58px 12px auto; gap: 4px; }
  .lyp-c .lyp-row { grid-template-columns: 54px; } .lyp .ly-line { width: 58px; height: 12px; } .lyp-c .ly-line { width: 54px; }
  .lyp-name { max-width: 140px; } .lyp-name b { font-size: 14px; } .lyp-arrow { font-size: 20px; }
  .ly-sumtab > div { grid-template-columns: 54px minmax(0, 1fr) 46px minmax(0, 1fr); gap: 5px; font-size: 12px; } .ly-sumtab .ly-line { width: 44px; }
}
@media (max-width: 480px) { .ly-rrow { grid-template-columns: 22px minmax(0, 1fr) auto; } .ly-where { grid-column: 2 / -1; } }

/* Master's method page (admins only) */
.el-box, .el-rem { margin: 10px 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: color-mix(in srgb, var(--ink) 3%, transparent); }
.el-box h3, .el-rem h3 { margin: 2px 0 6px; font-size: 15px; } .el-box p, .el-rem p { margin: 4px 0; }
.el-now { font-size: 14px; } .el-count .wx { margin-left: 4px; }
.el-tab { border-collapse: collapse; font-size: 13.5px; width: 100%; max-width: 680px; }
.el-tab th, .el-tab td { padding: 3px 8px; border-top: 1px dashed var(--line); text-align: left; white-space: nowrap; }
.xi-roles { white-space: nowrap; } .xi-r { margin-right: 2px; } .el-tab .xi-r { margin-right: 0; white-space: nowrap; display: inline-block; } .el-tab td.el-roles, .el-tab td.el-roles .xi-roles { white-space: normal; } .el-tab th, .el-tab td.el-roles { padding-right: 4px; } .xi-r .wx { margin-left: 1px; }
.xi-use { color: var(--good2); } .xi-avoid, .xi-r.xi-avoid { color: var(--bad); } .xi-r.xi-use { color: var(--good2); } .xi-r.xi-neutral { opacity: .8; }
.el-warn { color: var(--warn); } .el-check { display: block; margin-top: 8px; } .el-check textarea { width: 100%; box-sizing: border-box; margin-top: 4px; }
.el-checked { margin: 6px 0; padding-left: 18px; font-size: 13.5px; }
.el-tab tr.now td, .el-tab tr.now th { background: color-mix(in srgb, var(--gold-tint) 14%, transparent); font-weight: 700; }
.el-st { color: var(--green); } .el-wk { color: var(--bad2); }
.el-items { margin: 4px 0; padding-left: 18px; font-size: 14px; } .el-items li { margin: 3px 0; }
.ms-step h3 { margin: 2px 0 8px; } .ms-xi { font-size: 14px; } #tab-master textarea { width: 100%; box-sizing: border-box; margin-top: 4px; }
.ms-cy td { vertical-align: top; } .ms-cy tr.xi-use td { color: inherit; background: color-mix(in srgb, var(--good2) 8%, transparent); } .ms-cy tr.el-warn td { color: inherit; background: color-mix(in srgb, var(--bad) 7%, transparent); }

/* Paid plans (TEST MODE): Plans & usage page, sidebar meter, paywall + test checkout dialogs */
.sb-meter { margin: 6px 0; }
.sb-meter .linkbtn { text-align: left; }
.bl-test { border-color: var(--gold); background: color-mix(in srgb, var(--gold-tint) 12%, transparent); }
.bl-banner { background: var(--banner-bg); color: var(--banner-ink); border-radius: 8px; padding: 8px 12px; margin: 0 0 12px; font-size: .9rem; }
.bl-banner .linkbtn { color: var(--banner-ink); text-decoration: underline; font-weight: 600; }
.tag.bl-testtag { background: color-mix(in srgb, var(--gold-tint) var(--tag-tint, 20%), transparent); color: var(--gold); border-color: var(--gold); }
.bl-msg:empty { display: none; }
.bl-msg { color: var(--ink); background: var(--card); border: 1px solid var(--line); border-left: 3px solid var(--gold); border-radius: 8px; padding: 10px 12px; margin: 0 0 12px; line-height: 1.45; }
/* Plans & usage: the page's own TEST MODE card says it, so the top strip would only repeat it (Amos 19 Nov). */
body[data-tab="plans"] #blBanner { display: none; }
.bl-why { border: 1px solid var(--line, rgba(127,127,127,.35)); border-radius: 10px; padding: 4px 12px; margin: 8px 0; }
.bl-why p { margin: 8px 0; } .bl-why button { margin-top: 6px; }
/* Plan / pack cards: one column on phones under 420px, two above, three on wide screens (sidebar layout). */
.bl-tiers { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; margin: 8px 0; }
@media (min-width: 420px) { .bl-tiers { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 760px) { .bl-tiers { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.bl-tier { border: 1px solid var(--line); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 6px; min-width: 0; overflow-wrap: anywhere; }
.bl-tier button { width: 100%; margin-top: 2px; }
.bl-tier button.bl-cur { background: none; border-color: var(--gold); color: var(--gold); opacity: 1; font-weight: 600; }
.bl-tier.cur { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); }
.bl-tier ul { margin: 0; padding-left: 16px; flex: 1; }
.bl-name { font-size: 16px; }
.bl-price { font-size: 20px; color: var(--gold); font-weight: 700; }
.bl-kinds { display: grid; gap: 6px; margin: 8px 0; }
.bl-kind { display: grid; grid-template-columns: minmax(0, 1fr) minmax(60px, 120px) auto; align-items: center; gap: 8px; font-size: 14px; }
.bl-bar { height: 8px; background: var(--field); border-radius: 4px; overflow: hidden; display: block; }
.bl-bar span { display: block; height: 100%; background: var(--teal); }
.bl-tools { margin-top: 10px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
dialog.pw { background: var(--card); color: var(--ink); border: 1px solid var(--gold); border-radius: 12px; max-width: 420px; width: calc(100% - 32px); padding: 18px; }
dialog.pw::backdrop { background: var(--scrim); }
.pw-opts { display: grid; gap: 8px; margin: 12px 0; }
.pw-opt { display: flex; justify-content: space-between; align-items: center; text-align: left; }
.pw-opt.primary .muted { color: inherit; opacity: .8; }
.bl-n { white-space: nowrap; }

/* Invite friends */
.rf-link { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 4px 0 8px; }
.rf-link input { flex: 1 1 220px; min-width: 0; font-size: .9em; }
.rf-code { letter-spacing: .12em; }
.rf-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0; }
.rf-stats div { border: 1px solid var(--line); border-radius: 8px; padding: 8px; text-align: center; }
.rf-stats b { display: block; font-size: 1.5em; color: var(--gold); }
.rf-stats span { font-size: .8em; opacity: .8; }

/* Numbers 数字 */
.nm-digits { font-size: 26px; letter-spacing: 4px; margin: 6px 0 2px; font-variant-numeric: tabular-nums; }
.nm-d.nm-z { color: var(--chip-ink); }
.nm-d.nm-k { text-decoration: underline; text-decoration-color: var(--gold); text-underline-offset: 5px; }
.nm-wrap { overflow-x: auto; }
.nm-table { width: 100%; border-collapse: collapse; }
.nm-table th, .nm-table td { text-align: left; vertical-align: top; padding: 6px 8px; border-bottom: 1px solid color-mix(in srgb, var(--ink) 7%, transparent); }
.nm-table tr.good td.nm-pair { color: var(--green); } .nm-table tr.bad td.nm-pair { color: var(--bad); }
.nm-table tr.key4 td.nm-pair { text-decoration: underline; text-decoration-color: var(--gold); text-underline-offset: 4px; }
.nm-pair { font-size: 18px; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.nm-dots { font-size: 10px; letter-spacing: 1px; color: var(--gold); }
.nm-mod { color: var(--gold); }

/* Date selection 择日 */
.zr-list { display: grid; gap: 10px; margin: 10px 0; }
.zr-day { border: 1px solid color-mix(in srgb, var(--ink) 8%, transparent); border-left: 3px solid var(--chip-ink); border-radius: 10px; padding: 10px 12px; background: color-mix(in srgb, var(--ink) 2%, transparent); }
.zr-day.best { border-left-color: var(--green); } .zr-day.good { border-left-color: var(--gold); }
.zr-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; }
.zr-rank { display: inline-grid; place-items: center; min-width: 22px; height: 22px; border-radius: 50%; background: color-mix(in srgb, var(--ink) 8%, transparent); font-size: 12px; }
.zr-gz { color: var(--chip-ink); }
.zr-grade { margin-left: auto; font-size: 12px; padding: 1px 8px; border-radius: 999px; background: color-mix(in srgb, var(--ink) 6%, transparent); }
.zr-grade.best { background: color-mix(in srgb, var(--green) 30%, transparent); color: var(--st-good); } .zr-grade.good { background: color-mix(in srgb, var(--gold-tint) 22%, transparent); }
.zr-chips { display: flex; flex-wrap: wrap; gap: 5px; margin: 8px 0 4px; }
.zr-chip { font-size: 12px; line-height: 1.3; padding: 2px 8px; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--ink) 10%, transparent); color: var(--chip-ink2); }
.zr-chip.good { border-color: color-mix(in srgb, var(--green) 40%, transparent); color: var(--green); } .zr-chip.bad { border-color: color-mix(in srgb, var(--red) 40%, transparent); color: var(--bad); }
.zr-hr { display: inline-block; margin-right: 10px; white-space: nowrap; }
.zr-removed li { margin: 4px 0; } .zr-removed .zr-chip { margin-left: 4px; }

/* "Reading for" bar + person switcher (Amos 17 Nov). Sticks under the phone header (--hdrh is set by src/app.js). */
.forBar { position: sticky; top: var(--hdrh, 0px); z-index: 15; display: flex; align-items: center; gap: 10px; margin: 0 0 12px; padding: 8px 8px 8px 10px;
  background: var(--card); border: 1px solid var(--gold); border-radius: 10px; box-shadow: 0 -12px 0 -1px var(--bg), 0 2px 8px rgba(0, 0, 0, .18); }
.fb-av { flex: none; display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--gold); color: var(--on-gold); font-weight: 700; font-size: 15px; line-height: 1; }
.fb-txt { flex: 1; min-width: 0; font-size: 14px; line-height: 1.3; }
.fb-lbl { color: var(--muted); font-size: 12px; }
.fb-txt b { color: var(--ink); overflow-wrap: anywhere; }
.fb-meta { display: block; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.forBar .fb-switch { flex: none; min-height: 40px; padding: 6px 12px; border-color: var(--gold); color: var(--gold); background: transparent; font-weight: 600; }
.forBar.fb-none { border-style: dashed; } .forBar.fb-none .fb-av { background: var(--btn); color: var(--ink); }
@media (min-width: 760px) { .forBar { top: 0; } }
html.light .forBar { box-shadow: 0 -12px 0 -1px var(--bg), 0 2px 8px rgba(60, 40, 10, .10); }
.who-sheet h2 { margin-top: 0; font-size: 18px; }
.ws-list { display: grid; gap: 8px; margin: 10px 0 14px; max-height: 55vh; overflow-y: auto; }
.ws-item { display: flex; align-items: center; gap: 10px; text-align: left; width: 100%; padding: 8px 10px; min-height: 48px; }
.ws-item.on { border-color: var(--gold); background: color-mix(in srgb, var(--gold-tint) 14%, var(--card)); }
.ws-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; } .ws-txt b { overflow-wrap: anywhere; }
.ws-tick { color: var(--gold); font-weight: 700; font-size: 18px; }
.who-sheet .row { flex-wrap: wrap; gap: 8px; }
.hist-for { display: block; margin: 2px 0 0 16px; color: var(--ink); } .hist-for > span { color: var(--muted); }
.ahist .ah-meta b { color: var(--ink); font-weight: 600; }

/* Menu button pulse until the menu has been opened once (no motion when the phone asks for less motion). */
.menuBtn.pulse { position: relative; border-color: var(--gold); }
.menuBtn.pulse::after { content: ''; position: absolute; inset: -4px; border-radius: 10px; border: 2px solid var(--gold); animation: menu-pulse 1.8s ease-out infinite; pointer-events: none; }
@keyframes menu-pulse { 0% { opacity: .9; transform: scale(.92); } 70% { opacity: 0; transform: scale(1.18); } 100% { opacity: 0; transform: scale(1.18); } }
@media (prefers-reduced-motion: reduce) { .menuBtn.pulse::after { animation: none; opacity: .8; } }

/* First-run tutorial (src/tour.js): a dimmed screen with a gap (ring) around the part being explained, and a card. */
.tour { position: fixed; inset: 0; z-index: 70; display: flex; flex-direction: column; justify-content: flex-end; align-items: center;
  padding: calc(env(safe-area-inset-top) + 12px) calc(env(safe-area-inset-right) + 12px) calc(env(safe-area-inset-bottom) + 12px) calc(env(safe-area-inset-left) + 12px); }
.tour.dim { background: var(--scrim); }
.tour-ring { position: fixed; border-radius: 12px; border: 2px solid var(--gold); box-shadow: 0 0 0 200vmax var(--scrim); pointer-events: none; transition: all .2s ease; }
.tour-card { position: relative; width: 100%; max-width: 420px; max-height: calc(100vh - 40px); overflow-y: auto; background: var(--card); color: var(--ink);
  border: 1px solid var(--gold); border-radius: 14px; padding: 16px 16px 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, .35); }
.tour-card.at-top { margin-bottom: auto; }
.tour-card h2 { margin: 6px 0 8px; font-size: 18px; line-height: 1.3; }
.tour-body p { margin: 0 0 8px; line-height: 1.5; }
.tour-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.tour-dots { display: flex; gap: 5px; } .tour-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--line); } .tour-dots i.on { background: var(--gold); }
.tour-list { list-style: none; padding: 0; margin: 4px 0 8px; display: grid; gap: 10px; }
.tour-list li { display: flex; gap: 10px; align-items: flex-start; line-height: 1.4; }
.tour-ic { flex: none; display: inline-grid; place-items: center; min-width: 34px; height: 34px; padding: 0 4px; border-radius: 8px; background: var(--gold); color: var(--on-gold); font-weight: 700; font-size: 15px; }
.tour-try { flex-wrap: wrap; gap: 8px; margin: 4px 0 8px; } .tour-try button { flex: 1 1 140px; }
.tour-never { margin: 6px 0 10px; color: var(--muted); }
.tour-nav { display: flex; align-items: center; gap: 8px; } .tour-gap { flex: 1; }
.tour-nav button { min-height: 44px; } .tour-nav .tour-skip { min-height: 44px; padding: 0 4px; color: var(--muted); }
@media (min-width: 760px) { body.nav-on .tour { padding-left: calc(var(--sbw) + 24px); justify-content: center; } }
@media (prefers-reduced-motion: reduce) { .tour-ring { transition: none; } }
/* Plans & usage: total readings at the top + the extras line highlighted right after a pack buy (17 Nov 2026). */
.bl-total { border: 1px solid var(--gold); border-radius: 10px; padding: 8px 12px; margin: 0 0 10px; background: color-mix(in srgb, var(--gold-tint) 10%, transparent); }
.bl-total p { margin: 4px 0; }
.bl-total .bl-big { font-size: 22px; color: var(--gold); }
.bl-split { display: grid; gap: 2px; }
.bl-hl { background: color-mix(in srgb, var(--gold-tint) 22%, transparent); border-left: 3px solid var(--gold); padding: 6px 10px; border-radius: 6px; }

/* Tap-to-explain terms (shared glossary, src/glossary.js): dotted underline = tappable; small popover next to the term. */
button.gt { font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0; cursor: pointer; text-decoration: underline dotted; text-decoration-thickness: 1px; text-underline-offset: 3px; -webkit-tap-highlight-color: transparent; }
button.gt:hover, button.gt:focus-visible { color: var(--gold); }
button.gt:focus-visible, .gt-i:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; border-radius: 3px; }
html:not(.zh) button.gt.sp { margin-left: .3em; }
.lyt { border-bottom: 0; text-decoration: underline dotted; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.gt-i { font: inherit; font-size: 12px; line-height: 1; color: var(--gold); background: none; border: 0; padding: 4px 2px; margin: -4px 0; cursor: pointer; vertical-align: baseline; }
table.ln th.ln-th { word-break: keep-all; line-height: 1.3; }
table.ln td { white-space: nowrap; }
.gtp { position: absolute; z-index: 70; box-sizing: border-box; background: var(--card); color: var(--ink); border: 1px solid var(--gold); border-radius: 12px; padding: 10px 34px 8px 12px; box-shadow: 0 8px 26px var(--shade); font-size: 14px; line-height: 1.45; text-align: left; }
.gtp[hidden] { display: none; }
.gtp-h { margin: 0 0 4px; } .gtp-h b { font-size: 16px; }
.gtp-n { font-size: 13px; color: var(--muted); }
html.zh .gtp-n { display: none; }
.gtp p { margin: 4px 0; }
.gtp-hint { padding-top: 6px; border-top: 1px solid var(--line); }
.gtp-hint b { color: var(--gold); font-weight: 600; }
.gtp-x { position: absolute; top: 4px; right: 4px; background: none; border: 0; color: var(--muted); font-size: 16px; line-height: 1; padding: 8px; cursor: pointer; }
.gtp-x:hover { color: var(--ink); }
.tour-tip { margin: 6px 0 0; text-decoration: underline dotted; text-decoration-thickness: 1px; text-underline-offset: 3px; }

/* App version + build line at the bottom of Settings and Plans & usage (so testers know which build they have) */
.app-ver { text-align: center; margin: 18px 0 6px; user-select: all; -webkit-user-select: all; }
