/* Lab 8 design system. Loaded after styles.css on every page so that the same component looks the same everywhere.
   The look stays "temple": rice paper, ink, one vermilion accent. What this file settles:
   - colour roles: vermilion only for the main action, links and emphasis; one hairline colour for every border
   - corners: cards and panels 10px, buttons and fields 8px, tags as pills
   - cards: a hairline and a soft shadow, no inner double frame
   - buttons: two kinds (solid vermilion, hairline outline), one height, letter-spacing by language
   - type: three heading sizes (page, section, card) and one body size; English gets its own spacing
   - spacing on a 4px grid
   Selectors start with :root so they win over the older ".temple ..." theme rules of the same weight. */

:root {
  --ds-paper: #efe9dd;
  --ds-card: #fbf8f2;
  --ds-card-2: #f6f1e7;
  --ds-ink: #2b2722;
  --ds-ink-2: #5d554b;
  --ds-ink-3: #8a8174;
  --ds-line: rgba(74, 52, 38, .16);
  --ds-line-2: rgba(74, 52, 38, .09);
  --ds-red: #a8402e;
  --ds-red-dark: #8f3424;
  --ds-red-soft: rgba(168, 64, 46, .08);
  --ds-green: #2e7a4b;
  --ds-r-card: 10px;
  --ds-r-ctl: 8px;
  --ds-shadow: 0 1px 0 rgba(255, 255, 255, .7) inset, 0 10px 26px -18px rgba(60, 38, 20, .45);
  --ds-shadow-lift: 0 1px 0 rgba(255, 255, 255, .7) inset, 0 16px 32px -20px rgba(60, 38, 20, .55);
  --ds-h-page: clamp(28px, 6.4vw, 40px);
  --ds-h-sec: clamp(22px, 4.8vw, 30px);
  --ds-h-card: 19px;
  --ds-body: 16px;
  --ds-small: 13.5px;
}

/* ---------- cards and panels ---------- */
:root .panel, :root .pkg, :root .play-card, :root .el-intro, :root .cycle, :root .lb-inner, :root .install-bar, :root .daily-box, :root .dr-ask-card, :root .acc-plan, :root .daily:not(main) {
  background: var(--ds-card); border: 1px solid var(--ds-line); border-radius: var(--ds-r-card); box-shadow: var(--ds-shadow);
}
:root .panel::before, :root .panel::after { display: none; }
:root .play-card:hover, :root .pkg:hover { transform: translateY(-2px); box-shadow: var(--ds-shadow-lift); }
/* inner boxes inside cards: a lighter tint, same corners */
:root .bk-quote, :root .today-notes, :root .order-meta, :root .track-card, :root .month-detail, :root .bk-list li, :root .rel-list li, :root .sum-facts, :root .dm-facts, :root .bk-orig, :root .bk-match {
  border-radius: var(--ds-r-ctl); border-color: var(--ds-line);
}
:root .bk-quote { background: var(--ds-card-2); border-left: 3px solid #b08a3c; }

/* ---------- buttons ---------- */
:root .btn-primary, :root .btn-gold, :root .btn-ghost, :root .btn-line {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 22px;
  border-radius: var(--ds-r-ctl); font: 600 15px/1.2 var(--f-body); letter-spacing: .14em; text-decoration: none; text-shadow: none;
  box-shadow: none; transition: background .15s, color .15s, border-color .15s, transform .15s; cursor: pointer;
}
:root .btn-primary, :root .btn-gold { background: var(--ds-red); color: #fbf6ee; border: 1px solid var(--ds-red); }
:root .btn-primary:hover, :root .btn-gold:hover { background: var(--ds-red-dark); border-color: var(--ds-red-dark); transform: none; filter: none; }
:root .btn-ghost, :root .btn-line { background: transparent; color: var(--ds-ink); border: 1px solid rgba(43, 39, 34, .45); }
:root .btn-ghost:hover, :root .btn-line:hover { background: rgba(43, 39, 34, .06); color: var(--ds-ink); border-color: var(--ds-ink); transform: none; }
:root .btn-primary:active, :root .btn-gold:active, :root .btn-ghost:active, :root .btn-line:active { transform: translateY(1px); box-shadow: none; }
:root .btn-sm { min-height: 40px; padding: 0 16px; font-size: 14px; }
:root:lang(en) .btn-primary, :root:lang(en) .btn-gold, :root:lang(en) .btn-ghost, :root:lang(en) .btn-line,
:root .btn-primary:lang(en), :root .btn-gold:lang(en), :root .btn-ghost:lang(en), :root .btn-line:lang(en) { letter-spacing: .03em; font-size: 15.5px; }
/* text links */
:root .zoom-link { color: var(--ds-red); text-decoration: underline; text-decoration-color: rgba(168, 64, 46, .35); text-underline-offset: 3px; }
:root .zoom-link:hover { text-decoration-color: var(--ds-red); }

/* ---------- tags ---------- */
:root .play-tag, :root .pc-tag, :root .play-kind, :root .tag {
  display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border: 0; border-radius: 999px;
  background: var(--ds-red-soft); color: var(--ds-red); font-size: 12.5px; letter-spacing: .08em; line-height: 1;
}

/* ---------- fields ---------- */
:root input[type=text], :root input[type=number], :root input[type=email], :root input[type=date], :root input[type=time], :root input[type=search], :root select, :root textarea {
  min-height: 48px; border-radius: var(--ds-r-ctl); border: 1px solid var(--ds-line); background-color: #fffdf8; color: var(--ds-ink); box-shadow: none;
}
:root input:focus, :root select:focus, :root textarea:focus { outline: 2px solid rgba(168, 64, 46, .35); outline-offset: 1px; border-color: var(--ds-red); }
:root .seg { padding: 4px; gap: 4px; border: 1px solid var(--ds-line); border-radius: calc(var(--ds-r-ctl) + 4px); background: var(--ds-card-2); box-shadow: none; }
:root .seg span { min-height: 40px; display: flex; align-items: center; justify-content: center; border-radius: var(--ds-r-ctl); color: var(--ds-ink-2); }
:root .seg input:checked + span { background: var(--ds-red); color: #fbf6ee; box-shadow: 0 4px 10px -6px rgba(143, 52, 36, .6); }

/* ---------- headings ---------- */
/* page title on sub-pages */
:root .th-title, :root .fun-page h1, :root main > .wrap > h1 { font: 500 var(--ds-h-page)/1.2 var(--f-body); letter-spacing: .08em; color: var(--ds-ink); text-shadow: none; }
:root:lang(en) .th-title, :root:lang(en) .fun-page h1, :root:lang(en) main > .wrap > h1 { font-family: var(--f-display); letter-spacing: .005em; font-weight: 600; }
/* section title */
:root .sec-head h2, :root .play .sec-head h2, :root .stems .sec-head h2, :root .readings > .wrap > .sec-head h2, :root .panel-title {
  font-family: var(--f-body); font-weight: 600; letter-spacing: .08em; color: var(--ds-ink); text-shadow: none;
}
:root .sec-head h2, :root .play .sec-head h2, :root .stems .sec-head h2, :root .readings > .wrap > .sec-head h2 { font-size: var(--ds-h-sec); }
:root .panel-title { font-size: 21px; }
:root:lang(en) .sec-head h2, :root:lang(en) .panel-title { font-family: var(--f-display); letter-spacing: .005em; font-weight: 600; }
:root:lang(en) .sec-head h2 { font-size: calc(var(--ds-h-sec) + 4px); }
:root:lang(en) .panel-title { font-size: 24px; }
/* card title */
:root .play-text strong, :root .pkg h3, :root .daily-box h2 { font: 600 var(--ds-h-card)/1.35 var(--f-body); letter-spacing: .04em; color: var(--ds-ink); }
:root:lang(en) .play-text strong, :root:lang(en) .pkg h3 { font-family: var(--f-display); font-size: 21px; letter-spacing: 0; }
/* eyebrow and lede */
:root .eyebrow { color: var(--ds-red); letter-spacing: .24em; font-size: 13px; }
:root:lang(en) .eyebrow { letter-spacing: .14em; }
:root .lede { color: var(--ds-ink-2); font-size: var(--ds-body); line-height: 1.8; }
:root .crumbs { font-size: 13px; letter-spacing: .06em; color: var(--ds-ink-3); }

/* ---------- card thumbnails: no heavy dark frames anywhere ---------- */
:root .play-art, :root .temple .play-art { border-radius: 8px; box-shadow: inset 0 0 0 1px var(--ds-line), 0 6px 16px -12px rgba(60, 38, 20, .4) !important; outline: 0 !important; overflow: hidden; }

/* ---------- back button: a quiet pill ---------- */
:root .back-link { display: inline-flex; align-items: center; gap: 4px; height: 34px; padding: 0 14px 0 10px; border: 1px solid var(--ds-line); border-radius: 999px; background: rgba(251, 248, 242, .8); color: var(--ds-ink-2); font-size: 14px; text-decoration: none; box-shadow: none; }

/* ---------- spacing ---------- */
:root .panel { padding-left: 20px; padding-right: 20px; }
@media (min-width: 761px) { :root .panel { padding-left: 28px; padding-right: 28px; } }
:root .play-grid, :root .dr-acts { gap: 12px; }

/* header controls: language and sign-in share one pill shape */
:root .acct-btn, :root .temple .acct-btn { border-radius: 999px; height: 32px; padding: 0 14px; border: 1px solid rgba(246, 239, 226, .55); letter-spacing: .06em; }
:root .site-head .acct-btn, :root .site-nav .acct-btn { border-radius: 999px; }
/* the drawn slip: one fine vermilion line instead of the heavy double rule */
:root .dr-slip { background: #fbf6ec; border: 1px solid rgba(168, 64, 46, .45); border-radius: var(--ds-r-card); box-shadow: var(--ds-shadow), inset 0 0 0 5px #fbf6ec, inset 0 0 0 6px rgba(168, 64, 46, .18); }

/* ---------- sub-page header: back pill, breadcrumb, title, one-line intro, all centred ---------- */
:root .fun-page .crumbs, :root .game .crumbs, :root .theater .crumbs { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; text-align: center; }
:root .fun-page .th-title, :root .fun-page .wrap > .lede, :root .fun-page .cal-lede { text-align: center; margin-left: auto; margin-right: auto; }
:root .fun-page .wrap > .lede, :root .fun-page .cal-lede { max-width: 34em; text-align: center; }
:root .fun-page .th-title { margin-top: 6px; margin-bottom: 10px; }
:root .fun-page.legal h1 { text-align: center; }
@media (max-width: 760px) {
  :root .game .th-title, :root .theater .th-side > .th-title, :root .theater .th-side > .lede { text-align: center; }
  :root .game .gm-intro > .lede { text-align: left; }
}
/* every page title in Chinese uses the same calm serif, not the brush face */
:root:lang(zh) .th-title { font: 600 var(--ds-h-page)/1.25 var(--f-body); letter-spacing: .1em; }

/* ---------- score chips (merge game): light cards, not dark blocks ---------- */
:root .mg-chips span { min-width: 76px; padding: 6px 12px; background: var(--ds-card-2); color: var(--ds-ink); border: 1px solid var(--ds-line); border-radius: var(--ds-r-ctl); text-align: center; }
:root .mg-chips small { color: var(--ds-ink-3); opacity: 1; }
:root .mg-chips b { color: var(--ds-red); }

/* ---------- tab switchers: one segmented control ---------- */
:root .tm-tabs { gap: 6px; padding: 5px; border: 1px solid var(--ds-line); border-radius: calc(var(--ds-r-ctl) + 4px); background: var(--ds-card-2); }
:root .tm-tabs button { min-height: 42px; border: 0; border-radius: var(--ds-r-ctl); background: transparent; color: var(--ds-ink-2); font: 500 15px/1.2 var(--f-body); letter-spacing: .08em; }
:root .tm-tabs button.is-on { background: var(--ds-red); color: #fbf6ee; box-shadow: 0 4px 10px -6px rgba(143, 52, 36, .6); }
:root:lang(en) .tm-tabs button { letter-spacing: .01em; }

/* ---------- small fixes found in the page pass ---------- */
:root .lede, :root .cal-lede, :root .sec-head p { text-wrap: pretty; }
:root .fun-page .wrap > .lede, :root .fun-page .cal-lede { text-wrap: balance; }
:root .cal-day { border-radius: 6px; }
:root .mg-board { border-radius: var(--ds-r-card); background: #c3b296; }
:root .mg-board > i, :root .mg-board .mg-tile { border-radius: 6px; }
:root .cal-day.is-sel { border-color: var(--ds-red); box-shadow: 0 0 0 1px var(--ds-red) inset; }
/* no lonely last characters in body text */
:root main p, :root main li { text-wrap: pretty; }
:root .rtabs { gap: 4px; padding: 4px; border: 1px solid var(--ds-line); border-radius: calc(var(--ds-r-ctl) + 4px); background: var(--ds-card-2); }
:root .rtabs button { border: 0; border-radius: var(--ds-r-ctl); min-height: 42px; color: var(--ds-ink-2); }
:root .rtabs button + button { border-left: 0; }
:root .rtabs button[aria-selected="true"] { background: var(--ds-red); color: #fbf6ee; box-shadow: 0 4px 10px -6px rgba(143, 52, 36, .6); }
/* classical-book findings: one per row on phones, word pairs never split */
@media (max-width: 760px) { :root .bk-list { grid-template-columns: minmax(0, 1fr) !important; } }
:root .bk-list li > span:first-child { white-space: nowrap; }
:root:lang(zh) .bk-score small, :root:lang(zh) .bk-score span { white-space: nowrap; }
:root:lang(en) .bk-score small { display: block; max-width: 7.5em; text-align: center; line-height: 1.3; }

/* ---------- English: words, not spaced-out letters ---------- */
:root:lang(en) :is(.brand-name, .acct-btn, .crumbs a, .crumbs span, .tabbar span, .bottom-nav span, .cal-month, .cal-today, .cal-h3, .dr-hang-head b, .dr-hang-head span, .dr-no, .dr-level, .dr-jie h3, .gm-end-label, .play-tag, .el-name, .el-tags, .play-gh, .sec-head h2, .ls-u-name, .th-who, .th-rel) { letter-spacing: .01em; }
:root:lang(en) .cal-wd { letter-spacing: .04em; }
:root:lang(en) :is(.hero-eyebrow, .eyebrow, .tm-kicker, .pkg-soon) { letter-spacing: .1em; }
:root:lang(en) .dr-jie h3 { font-family: var(--f-display); font-size: 21px; font-weight: 600; }
@media (max-width: 760px) { :root body[data-tab="home"] .dy-acts .btn-gold { width: 100%; justify-content: center; } }
/* almanac Do / Avoid badges: fit the English word, rounded like other tags */
:root .cal-yj > b, :root .ch-yj b.cal-yi, :root .ch-yj b.cal-ji { border-radius: 6px; }
:root:lang(en) .cal-yj { grid-template-columns: auto minmax(0, 1fr); }
:root:lang(en) .cal-yj > b { width: auto; min-width: 30px; padding: 0 8px; font-size: 13px; }
:root:lang(en) .ch-yj b.cal-yi, :root:lang(en) .ch-yj b.cal-ji { width: 3.7em; padding: 0; height: 20px; }
:root .cal-cta { border-radius: var(--ds-r-ctl); }
/* game intro start button: centred and wide like the quiz one */
:root .gm-intro .btn-primary { display: flex; width: min(100%, 260px); margin-left: auto; margin-right: auto; }
:root .qz-wrap .btn-primary { min-width: min(100%, 260px); }

/* ---------- home daily card with a chart, desktop: the character stands at the left of its own words ----------
   left column = character | score, bubble (tail pointing at the character), buttons; right column = hour bars */
@media (min-width: 761px) {
  :root .daily-band .daily.has-chart { position: relative; grid-template-columns: 132px fit-content(520px) minmax(0, 1fr); column-gap: 0;
    grid-template-areas: "k k hours" ". people hours" ". row hours" ". talk hours" ". acts hours"; }
  :root .daily-band .daily.has-chart > :not(.dy-hours) { margin-right: 40px; }
  :root .daily-band .daily.has-chart .dy-hours { padding-left: 40px; }
  :root .daily-band .daily.has-chart .dy-row.has-char { align-items: center !important; min-height: 64px; margin-top: 10px; }
  :root .daily-band .daily.has-chart .dy-char-top { position: absolute; left: 22px; bottom: 20px; width: 118px; margin: 0; }
  :root .daily-band .daily.has-chart .dy-talk.is-solo { margin-top: 12px; }
  :root .daily-band .daily.has-chart .dy-talk.is-solo .dy-bubble { text-align: left; padding: 14px 18px 14px 20px; }
  :root .daily-band .daily.has-chart .dy-talk.is-solo .dy-yj { justify-content: flex-start; }
  :root .daily-band .daily.has-chart .dy-talk.is-solo .dy-bubble::after { left: -7px; right: auto; top: 50%; margin-top: -6px; border-top: 0; border-right: 0; border-left: 1.5px solid #4a3426; border-bottom: 1.5px solid #4a3426; transform: rotate(45deg); }
  :root .daily-band .daily.has-chart .dy-acts { margin-top: 16px; }
}

/* ---------- team page role rows: both figures the same height, a light frame instead of the dark one ---------- */
:root .pv-row { border-radius: var(--ds-r-card); border-color: var(--ds-line); background: var(--ds-card); }
:root .pv-pair { --fig: 48px; border-radius: var(--ds-r-ctl); box-shadow: inset 0 0 0 1px var(--ds-line); background: linear-gradient(180deg, #f6efe2, #ece2cf); overflow: hidden; }
:root .pv-pair img { height: calc(var(--fig) * 1100 / var(--feet, 1100)); margin: 0 -4px calc(5px - var(--fig) * (1100 - var(--feet, 1100)) / var(--feet, 1100)); }
@media (max-width: 560px) { :root .pv-pair { --fig: 40px; } }

/* daily pages (draw, merit, merge): no card behind the scene, it sits straight on the page like before */
:root main.fun-page.daily .daily-box { background: transparent; border: 0; box-shadow: none; }
/* balance pass: two equal halves; both halves start on the same line (small heading) and end on the same line (actions / links) */
@media (min-width: 761px) {
  :root .daily-band .daily.has-chart { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 0;
    grid-template-areas: "k hours" "people hours" "row hours" "talk hours" "acts hours"; grid-template-rows: auto auto auto 1fr auto; }
  :root .daily-band .daily.has-chart > :is(.dy-people, .dy-row, .dy-talk, .dy-acts) { margin-left: 140px; }
  :root .daily-band .daily.has-chart .dy-talk.is-solo { align-self: start; }
  :root .daily-band .daily.has-chart .dy-acts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-self: end; }
  :root .daily-band .daily.has-chart .dy-acts > * { width: 100%; min-height: 46px; margin: 0; }
  :root .daily-band .daily.has-chart .dy-acts .dy-add { display: inline-flex; align-items: center; justify-content: center; border: 1px solid rgba(43, 39, 34, .45); border-radius: var(--ds-r-ctl); text-decoration: none; color: var(--ds-ink); font-size: 15px; }
  :root .daily-band .daily.has-chart .dy-hours { display: flex; flex-direction: column; }
  :root .daily-band .daily.has-chart .dy-hours .dy-cal { margin-top: auto; }
  :root .daily-band .daily.has-chart .dy-hours .score-how { margin-bottom: 0; }
  :root .daily-band .daily.has-chart .dy-hours .hr-bars { width: 100%; }
}
@media (min-width: 761px) {
  /* the hour bars take up the spare height instead of a gap above the links */
  :root .daily-band .daily.has-chart .dy-hours .hr-bars { flex: 1 1 auto; height: auto; min-height: 72px; }
  :root .daily-band .daily.has-chart .dy-hours .dy-cal { margin-top: 10px; }
}
@media (min-width: 761px) {
  :root .daily-band .daily.has-chart .dy-acts > * { white-space: nowrap; letter-spacing: .06em; padding: 0 12px; }
}
@media (min-width: 761px) and (max-width: 1100px) {
  :root .daily-band .daily.has-chart > :is(.dy-people, .dy-row, .dy-talk, .dy-acts) { margin-left: 118px; }
  :root .daily-band .daily.has-chart .dy-char-top { width: 100px; left: 16px; }
  :root .daily-band .daily.has-chart > :not(.dy-hours) { margin-right: 28px; }
  :root .daily-band .daily.has-chart .dy-hours { padding-left: 28px; }
}

/* ---------- drawn slip on wide screens: landscape, verse on the left, reading on the right ----------
   both halves share one top line (slip number / "what it means") and one bottom line */
@media (min-width: 900px) {
  :root .dr-result .dr-slip { max-width: 960px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); padding: 30px 0; }
  :root .dr-side { display: flex; flex-direction: column; min-width: 0; padding: 0 36px; }
  :root .dr-side-verse { border-right: 1px dashed rgba(168, 64, 46, .35); }
  :root .dr-side-verse .dr-slip-head { margin-bottom: 0; }
  :root .dr-side-verse .dr-verse { margin: auto 0; padding: 18px 0; }
  :root .dr-side-verse:has(.dr-verse-en) .dr-verse { margin-bottom: 0; }
  :root .dr-side-verse .dr-verse-en { margin: 10px auto auto; }
  :root .dr-side-read .dr-jie { margin: 0; padding: 0; border-top: 0; }
  :root .dr-side-read .dr-jie h3 { line-height: 35px; margin-bottom: 8px; }
  :root .dr-side-read .dr-yiji { justify-content: flex-start; }
  :root .dr-side-read .dr-why { margin-top: auto; padding-top: 12px; }
  :root .dr-side-read .dr-yiji + .dr-why { margin-top: 16px; }
}
/* role / pair thumbnails: each figure gets its own half, a gap between them, both scaled from the feet */
:root .pv-row { grid-template-columns: 128px minmax(0, 1fr) auto; }
:root .pv-pair { --fig: 66px; height: 82px; display: grid; grid-template-columns: 1fr 1fr; column-gap: 8px; align-items: end; justify-items: center; padding: 0 10px; }
:root .pv-pair img { margin: 0 0 calc(6px - var(--fig) * (1100 - var(--feet, 1100)) / var(--feet, 1100)); max-width: none; }
@media (max-width: 560px) { :root .pv-row { grid-template-columns: 96px minmax(0, 1fr) auto; } :root .pv-pair { --fig: 52px; height: 66px; column-gap: 6px; padding: 0 6px; } }
/* relation-kind switcher on the match tab: same segmented control as the other tabs */
:root .pv-kinds { gap: 4px; padding: 4px; border: 1px solid var(--ds-line); border-radius: calc(var(--ds-r-ctl) + 4px); background: var(--ds-card-2); }
:root .pv-kinds button { border: 0 !important; border-radius: var(--ds-r-ctl); background: transparent; color: var(--ds-ink-2); min-height: 42px; }
:root .pv-kinds button[aria-pressed="true"], :root .pv-kinds button.is-on, :root .pv-kinds button[aria-selected="true"] { background: var(--ds-red); color: #fbf6ee; box-shadow: 0 4px 10px -6px rgba(143, 52, 36, .6); }
:root .pv-text em { border: 0; border-radius: 999px; background: var(--ds-red-soft); color: var(--ds-red); padding: 2px 10px; font-style: normal; }
:root .tm-seg { gap: 4px; padding: 4px; border: 1px solid var(--ds-line); border-radius: calc(var(--ds-r-ctl) + 4px); background: var(--ds-card-2); }
:root .tm-seg span { border-radius: var(--ds-r-ctl); color: var(--ds-ink-2); }
:root .tm-seg label + label span { border-left: 0; }
:root .tm-seg input:checked + span, :root .lang-toggle button[aria-pressed=true] { background: var(--ds-red); color: #fbf6ee; }
:root .lang-toggle { padding: 4px; gap: 4px; background: var(--ds-card-2); border: 1px solid var(--ds-line); border-radius: calc(var(--ds-r-ctl) + 4px); }
:root .lang-toggle button { border: 0; border-radius: var(--ds-r-ctl); }
/* match page: both panels the same height; choice chips rounded like every other control */
@media (min-width: 761px) { :root .tm-layout { align-items: stretch; } }
:root .mt-sc, :root .chip-btn { border-radius: var(--ds-r-ctl); border-color: var(--ds-line); }
:root .mt-sc.is-on, :root .mt-sc[aria-pressed="true"] { border-color: var(--ds-red); background: var(--ds-red-soft); color: var(--ds-red); }
@media (min-width: 761px) {
  /* the empty-state preview fills its panel: rows share the height evenly, no blank patch at the bottom */
  :root .tm-result.is-empty { display: flex; flex-direction: column; }
  :root .tm-result.is-empty > .pv { flex: 1; display: flex; flex-direction: column; }
  :root .tm-result.is-empty .pv-rows, :root .tm-result.is-empty .pv-grid { flex: 1; grid-auto-rows: 1fr; }
  :root .tm-result.is-empty .pv-foot { margin-bottom: 0; }
}
@media (max-width: 760px) {
  /* phone rows: picture and element on one line, the words underneath at full width */
  :root .pv-row { grid-template-columns: 96px minmax(0, 1fr); grid-template-areas: "pair el" "text text"; row-gap: 10px; padding: 10px 14px 12px 10px; }
  :root .pv-row .pv-pair { grid-area: pair; }
  :root .pv-row .pv-el { grid-area: el; align-self: center; }
  :root .pv-row .pv-text { grid-area: text; padding-left: 2px; }
  :root .pv-row .pv-el small { display: block; }
  :root .pv-text b { white-space: normal; }
  :root .pv-text em { display: inline-block; white-space: nowrap; margin-left: 6px; }
  /* five relation kinds: three on top, two below */
  :root .pv-kinds { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  :root .pv-kinds button { grid-column: span 2; white-space: nowrap; font-size: 13px; padding: 0 4px; min-height: 40px; }
  :root .pv-kinds button:nth-child(n+4) { grid-column: span 3; }
}
@media (max-width: 760px) {
  :root .pv-kinds button { white-space: normal; line-height: 1.15; font-size: 12.5px; }

  /* home daily card on phones: score on top; the character sits left of its bubble, exactly as tall as the bubble */
  :root .daily-band .daily.has-chart { display: grid; grid-template-columns: 76px minmax(0, 1fr); column-gap: 10px;
    grid-template-areas: "k k" "people people" "ring head" "char talk" "hours hours" "acts acts"; align-items: center; }
  :root .daily-band .daily.has-chart .dy-k { grid-area: k; }
  :root .daily-band .daily.has-chart .dy-people { grid-area: people; }
  :root .daily-band .daily.has-chart .dy-row.has-char { display: contents !important; }
  :root .daily-band .daily.has-chart .dy-ring { grid-area: ring; justify-self: center; margin-top: 8px; }
  :root .daily-band .daily.has-chart .dy-head { grid-area: head; margin-top: 8px; }
  :root .daily-band .daily.has-chart .dy-char-top { grid-area: char; width: 100%; height: 0; min-height: 100%; object-fit: contain; object-position: center bottom; margin: 12px 0 0; align-self: stretch; }
  :root .daily-band .daily.has-chart .dy-talk.is-solo { grid-area: talk; margin-top: 12px; }
  :root .daily-band .daily.has-chart .dy-talk.is-solo .dy-bubble { margin: 0; text-align: left; padding: 12px 14px; }
  :root .daily-band .daily.has-chart .dy-talk.is-solo .dy-yj { justify-content: flex-start; }
  :root .daily-band .daily.has-chart .dy-talk.is-solo .dy-bubble::after { left: -7px; right: auto; top: 50%; margin-top: -6px; border-top: 0; border-right: 0; border-left: 1.5px solid #4a3426; border-bottom: 1.5px solid #4a3426; transform: rotate(45deg); }
  :root .daily-band .daily.has-chart .dy-hours { grid-area: hours; }
  :root .daily-band .daily.has-chart .dy-acts { grid-area: acts; }
}
@media (max-width: 760px) {
  :root .daily-band .daily.has-chart .dy-char-top, :root .daily-band .daily.has-chart .dy-talk.is-solo { margin-top: 0; }
  :root .daily-band .daily.has-chart :is(.dy-ring, .dy-head) { margin-bottom: 14px; }
}
/* the bubble's first sentence breaks evenly instead of leaving a few characters alone on line two */
:root .dy-bubble .dy-s { text-wrap: pretty; }
@media (max-width: 760px) {
  /* height comes from the bubble (set by fitDailyChar); width follows the figure, so wide and narrow characters both match */
  :root .daily-band .daily.has-chart { grid-template-columns: auto minmax(0, 1fr); }
  :root .daily-band .daily.has-chart .dy-char-top { height: var(--bubble-h, 130px); min-height: 0; width: auto; max-width: 120px; object-fit: contain; justify-self: center; align-self: center; }
}
@media (max-width: 760px) {
  :root .daily-band .daily.has-chart { grid-template-columns: 92px minmax(0, 1fr); }
  :root .daily-band .daily.has-chart .dy-char-top { min-height: 0; max-width: none; object-fit: cover; object-position: center bottom; justify-self: center; align-self: center; }
}
:root .dy-bubble .dy-yj span { text-wrap: balance; }

/* ---------- home daily card without a chart, desktop: two equal halves like the chart version ----------
   left = date, question, character beside its bubble (same height), button; right = the ten stems filling the half,
   top on the date line, bottom on the button line */
@media (min-width: 761px) {
  :root .daily-band .daily.is-ask.is-ask.is-ask { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 0;
    grid-template-areas: "k stems" "ask stems" "s stems" "acts stems"; grid-template-rows: auto auto 1fr auto; }
  :root .daily-band .daily.is-ask.is-ask.is-ask > :not(.dy-stems) { margin-right: 40px; }
  :root .daily-band .daily.is-ask.is-ask.is-ask .dy-stems { grid-area: stems; align-self: stretch; justify-self: stretch;
    max-width: none !important; width: auto !important; margin: 0; padding-left: 40px; border-left: 1px dashed var(--line);
    display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); grid-template-rows: 1fr 1fr; gap: 10px; }
  :root .daily-band .daily.is-ask.is-ask.is-ask .dy-stem { aspect-ratio: auto; height: auto; min-height: 0; border-radius: var(--ds-r-ctl); font-size: 26px; }
  :root .daily-band .daily.is-ask.is-ask.is-ask .dy-host { display: grid; grid-template-columns: 72px minmax(0, 1fr); column-gap: 14px; align-items: stretch; margin-top: 14px; }
  :root .daily-band .daily.is-ask.is-ask.is-ask .dy-host .dy-char { width: 72px; height: 0; min-height: 100%; object-fit: contain; object-position: center bottom; margin: 0; }
  :root .daily-band .daily.is-ask.is-ask.is-ask .dy-host .dy-bubble { margin: 0; }
  :root .daily-band .daily.is-ask.is-ask.is-ask .dy-acts { margin-top: 18px; }
  :root .daily-band .daily.is-ask.is-ask.is-ask .dy-acts .btn-gold { width: 100%; justify-content: center; }
}

/* ---------- home hero on phones: one centred column, a short promise, clear hierarchy ----------
   small kicker with a rule on both sides, a big two-line title, a one-or-two-line lede in a softer tone, then the buttons */
@media (max-width: 760px) {
  :root .temple .hero-copy, :root .hero-copy { display: flex !important; flex-direction: column; align-items: center; text-align: center; }
  :root .hero-copy > * { grid-column: auto !important; }
  :root .hero-eyebrow { justify-content: center; margin: 4px 0 14px; font-size: 12.5px; letter-spacing: .22em; }
  :root .hero-eyebrow::before, :root .hero-eyebrow::after { content: ""; width: 22px; height: 1px; background: currentColor; opacity: .6; flex: none; }
  :root:lang(en) .hero-eyebrow { letter-spacing: .14em; }
  :root .temple .hero-title, :root .hero-title { height: auto !important; margin: 0 auto 14px !important; padding: 0 !important; text-align: center; text-wrap: balance; }
  :root .temple:lang(zh) .hero-title, :root .temple .hero-title:lang(zh) { font-size: 34px; line-height: 1.3; letter-spacing: .06em; }
  :root .temple:lang(en) .hero-title, :root .temple .hero-title:lang(en) { font-size: 36px; line-height: 1.12; }
  :root .temple .hero-lede, :root .hero-lede { margin: 0 auto 22px; padding: 0; max-width: 22em; font-size: 15.5px; line-height: 1.8; color: var(--ds-ink-2); text-align: center; text-wrap: balance; }
  :root .temple .hero-lede br, :root .hero-lede br { display: inline; }
  :root:lang(en) .hero-lede { max-width: 21em; font-size: 16px; }
  :root .hero-cta { width: 100%; justify-content: center; }
  :root .hero-trust { justify-content: center; text-align: center; font-size: 13px; color: var(--ds-ink-3); }
}
@media (max-width: 760px) {
  :root .hero-trust { margin-bottom: 18px; }
  :root .hero-cta { margin-bottom: 14px; }
}
/* hero cards sit lower on phones, so the whole taiji in the dial stays in view above them */
@media (max-width: 760px) { :root body[data-tab="home"] .hero-fan { height: calc(var(--gate) * .516 + var(--card-w) * 1.62 + 104px); } }

/* ---------- 脆皮捏捏 squish page ---------- */
:root .sq-stage { width: 100%; max-width: 560px; margin: 0 auto; touch-action: pan-y; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
:root .sq-canvas { display: block; width: 100%; cursor: grab; touch-action: pan-y; }
:root .sq-canvas:active { cursor: grabbing; }
:root .sq-hint { margin: 14px 0 0; text-align: center; color: var(--ds-ink-2); font-size: 15px; min-height: 1.6em; }
:root .sq-acts { display: flex; justify-content: center; margin-top: 10px; }
:root .sq-acts .btn-primary { min-width: min(100%, 240px); }
:root .sq-kinds, :root .sq-els { display: grid; gap: 4px; padding: 4px; max-width: 560px; margin: 16px auto 0; border: 1px solid var(--ds-line); border-radius: calc(var(--ds-r-ctl) + 4px); background: rgba(251, 248, 242, .8); }
:root .sq-kinds { grid-template-columns: repeat(4, minmax(0, 1fr)); }
:root .sq-els { grid-template-columns: repeat(5, minmax(0, 1fr)); margin-top: 8px; }
:root .sq-els[hidden] { display: none; }
:root .sq-kind, :root .sq-el { min-height: 40px; border: 0; border-radius: var(--ds-r-ctl); background: transparent; color: var(--ds-ink-2); font: 500 14px/1.2 var(--f-body); cursor: pointer; }
:root .sq-kind.is-on { background: var(--ds-red); color: #fbf6ee; }
:root .sq-el { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
:root .sq-el::before { content: ""; width: 12px; height: 12px; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .1); }
:root .sq-el.is-on { background: #fff; color: var(--ds-ink); box-shadow: inset 0 0 0 1.5px var(--ds-red); }
:root .sq-foot { display: flex; justify-content: space-between; align-items: center; max-width: 560px; margin: 12px auto 0; font-size: 13.5px; color: var(--ds-ink-3); }
@media (max-width: 560px) { :root .sq-kind { font-size: 13px; } :root .sq-el { font-size: 12.5px; gap: 4px; white-space: nowrap; } }
@media (max-width: 400px) { :root .sq-el { font-size: 11.5px; gap: 3px; } :root .sq-el::before { width: 9px; height: 9px; } }
:root .sq-modes { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; max-width: 320px; margin: 0 auto 16px; border: 1px solid var(--ds-line); border-radius: calc(var(--ds-r-ctl) + 4px); background: rgba(251, 248, 242, .8); }
:root .sq-modes button { min-height: 40px; border: 0; border-radius: var(--ds-r-ctl); background: transparent; color: var(--ds-ink-2); font: 500 15px/1 var(--f-body); cursor: pointer; }
:root .sq-modes button.is-on { background: var(--ds-red); color: #fbf6ee; }
:root .sq-kinds[hidden], :root .sq-stage[hidden], :root .sq-hud[hidden], :root .sq-lvs[hidden] { display: none; }
:root .sq-hud { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; max-width: 560px; margin: 0 auto 10px; padding: 10px 16px; border: 1px solid var(--ds-line); border-radius: var(--ds-r-card); background: rgba(251, 248, 242, .9); font-size: 15px; }
:root .sq-hud b { font-weight: 600; color: var(--ds-ink); }
:root .sq-hud span { color: var(--ds-ink-2); }
:root .sq-clock { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--ds-ink) !important; }
:root .sq-clock.is-low { color: var(--ds-red) !important; }
:root .sq-res { width: 100%; margin: 0; text-align: center; font-size: 17px; font-weight: 600; color: var(--ds-ink); }
:root .sq-stars { color: #d99a2b; letter-spacing: .1em; }
:root .sq-stars i, :root .sq-lv span i { font-style: normal; color: rgba(74, 52, 38, .2); }
:root .sq-res-acts { width: 100%; display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
:root .sq-res-acts .btn-primary, :root .sq-res-acts .btn-ghost { min-height: 42px; padding: 0 16px; }
:root .sq-lvs { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; max-width: 560px; margin: 0 auto; }
:root .sq-lv { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; aspect-ratio: 1; border: 1px solid var(--ds-line); border-radius: var(--ds-r-ctl); background: var(--ds-card); cursor: pointer; font-family: var(--f-body); }
:root .sq-lv b { font-size: 20px; font-weight: 600; color: var(--ds-ink); }
:root .sq-lv span { font-size: 11px; color: #d99a2b; letter-spacing: .05em; }
:root .sq-lv:hover:not(:disabled) { border-color: var(--ds-red); }
:root .sq-lv.is-locked { opacity: .5; cursor: default; }

/* ---------- 五行消消乐 ---------- */
:root .match-page .daily-box { padding: 0; }
:root .mt-play { max-width: 476px; margin: 0 auto; }
/* the bar above the board: level | goals | moves, three blocks of one height */
:root .mt-hud { display: grid; grid-template-columns: 64px minmax(0, 1fr) 64px; align-items: stretch; gap: 8px; margin: 0 0 12px; }
:root .mt-hud > div { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 60px; border-radius: var(--ds-r-card); background: var(--ds-card); box-shadow: inset 0 0 0 1px var(--ds-line); }
:root .mt-hud small { font: 500 11.5px/1.2 var(--f-body); color: var(--ds-ink-3); letter-spacing: .08em; }
:root .mt-hud-lv b, :root .mt-hud-mv b { font: 600 22px/1.15 var(--f-body); color: var(--ds-ink); margin-top: 2px; font-variant-numeric: tabular-nums; }
:root .mt-hud-mv.is-low b { color: var(--ds-red); }
:root .mt-hud .mt-goals { flex-direction: row; gap: 14px; }
:root .mt-goal { display: inline-flex; align-items: center; gap: 6px; font: 600 18px/1 var(--f-body); color: var(--ds-ink); font-variant-numeric: tabular-nums; }
:root .mt-goal.is-done b { color: #4f9a62; }
:root .mt-gi { width: 28px; height: 28px; border-radius: 30%; display: grid; place-items: center; box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .16), inset 0 1px 0 rgba(255, 255, 255, .5); }
:root .mt-gi svg { width: 86%; height: 86%; }

:root .mt-wrap { display: flex; justify-content: center; }
:root .mt-board { position: relative; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; border-radius: 14px; overflow: hidden;
  background: linear-gradient(#e2d1b4, #d5c09d); box-shadow: inset 0 0 0 1px rgba(74, 52, 38, .18), 0 10px 24px -14px rgba(60, 36, 18, .45); }
:root .mt-cells { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(7, 1fr); }
:root .mt-cells i { margin: 2px; border-radius: 24%; background: rgba(255, 252, 245, .45); }
:root .mt-cells i:nth-child(odd) { background: rgba(255, 252, 245, .7); }
:root .mt-tiles, :root .mt-fx { position: absolute; inset: 0; }
:root .mt-fx { pointer-events: none; }
:root .mt-t { position: absolute; left: 0; top: 0; width: var(--s); height: var(--s); padding: 3px; transition-property: transform; transition-timing-function: cubic-bezier(.25, .9, .35, 1.08); will-change: transform; cursor: pointer; }
:root .mt-g { width: 100%; height: 100%; border-radius: 26%; display: grid; place-items: center; position: relative;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .17), inset 0 2px 0 rgba(255, 255, 255, .45), 0 2px 3px rgba(70, 40, 16, .22); transition: transform .16s ease, filter .16s ease; }
:root .mt-g svg { width: 80%; height: 80%; filter: drop-shadow(0 1.5px 0 rgba(40, 20, 8, .25)); }
:root .mt-e0 { background: radial-gradient(circle at 34% 26%, #6fbf5c, #3a8d35 60%, #286a26); }
:root .mt-e1 { background: radial-gradient(circle at 34% 26%, #f2735a, #d43a28 60%, #a6261a); }
:root .mt-e2 { background: radial-gradient(circle at 34% 26%, #ffe07a, #f0b52a 60%, #c48a14); }
:root .mt-e3 { background: radial-gradient(circle at 34% 26%, #ffffff, #f1eee8 60%, #cfc9bd); }

:root .mt-g.mt-e3, :root .mt-gi.mt-e3 { box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .12), inset 0 0 0 1.5px rgba(150, 125, 85, .5), 0 2px 3px rgba(70, 40, 16, .22); }
:root .mt-e4 { background: radial-gradient(circle at 34% 26%, #5a8fe0, #2856ad 60%, #1a3b82); }
:root .mt-taiji { background: radial-gradient(circle at 34% 26%, #fff8e6, #e9d3a1 60%, #c6a564); }
:root .mt-taiji svg { width: 74%; height: 74%; fill: initial; animation: mt-spin 6s linear infinite; }
@keyframes mt-spin { to { transform: rotate(360deg); } }
/* 旺: a bright band across the tile, along the line it will clear */
:root .mt-sp-row .mt-g::after, :root .mt-sp-col .mt-g::after { content: ""; position: absolute; border-radius: 3px; background: rgba(255, 255, 255, .78); box-shadow: 0 0 8px rgba(255, 255, 255, .9); }
:root .mt-sp-row .mt-g::after { left: 10%; right: 10%; top: 50%; height: 4px; margin-top: -2px; }
:root .mt-sp-col .mt-g::after { top: 10%; bottom: 10%; left: 50%; width: 4px; margin-left: -2px; }
:root .mt-sp-row svg, :root .mt-sp-col svg { position: relative; z-index: 1; }
/* 爆: a glowing ring */
:root .mt-sp-burst .mt-g { box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .17), inset 0 0 0 3px rgba(255, 255, 255, .7), 0 0 10px 2px rgba(255, 230, 160, .85); animation: mt-glow 1.4s ease-in-out infinite; }
@keyframes mt-glow { 50% { filter: brightness(1.12); } }
:root .mt-t.is-sel .mt-g { transform: scale(1.1); filter: brightness(1.08); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .17), 0 0 0 2.5px #fff, 0 0 0 4.5px var(--ds-red); }
:root .mt-t.mt-hint .mt-g { animation: mt-nudge 1s ease-in-out infinite; }
@keyframes mt-nudge { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.12); } }
:root .mt-t.mt-no .mt-g { animation: mt-shake .26s ease; }
@keyframes mt-shake { 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }
:root .mt-t.mt-pop .mt-g { animation: mt-pop .24s ease-in forwards; }
@keyframes mt-pop { 40% { transform: scale(1.22); filter: brightness(1.3); } 100% { transform: scale(.2); opacity: 0; } }
:root .mt-t.mt-born .mt-g { animation: mt-born .26s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes mt-born { from { transform: scale(.3); } }

/* sparks, beams, rings and the combo words */
:root .mt-spark { position: absolute; width: 7px; height: 7px; margin: -3.5px 0 0 -3.5px; border-radius: 50%; animation: mt-spark .5s cubic-bezier(.2, .7, .4, 1) forwards; }
@keyframes mt-spark { to { transform: translate(var(--dx), var(--dy)) scale(.2); opacity: 0; } }
:root .mt-k0 { --k: #5fb84e; } :root .mt-k1 { --k: #ef5a40; } :root .mt-k2 { --k: #f3bd32; } :root .mt-k3 { --k: #ffffff; } :root .mt-k4 { --k: #3f74d0; }
:root .mt-spark { background: var(--k); box-shadow: 0 0 6px var(--k); }
:root .mt-beam { position: absolute; background: linear-gradient(90deg, transparent, #fff 20%, #fff 80%, transparent); box-shadow: 0 0 14px 4px var(--k); animation: mt-beam .5s ease-out forwards; }
:root .mt-beam-h { left: 0; right: 0; height: calc(var(--s) * .34); margin-top: calc(var(--s) * .33); }
:root .mt-beam-v { top: 0; bottom: 0; width: calc(var(--s) * .34); margin-left: calc(var(--s) * .33); background: linear-gradient(180deg, transparent, #fff 20%, #fff 80%, transparent); }
@keyframes mt-beam { from { opacity: 1; } to { opacity: 0; transform: scale(1, .2); } }
:root .mt-beam-v { animation-name: mt-beam-v; }
@keyframes mt-beam-v { from { opacity: 1; } to { opacity: 0; transform: scale(.2, 1); } }
:root .mt-ring { position: absolute; width: calc(var(--s) * 3); height: calc(var(--s) * 3); margin: calc(var(--s) * -1.5) 0 0 calc(var(--s) * -1.5); border-radius: 50%; border: 4px solid #fff; box-shadow: 0 0 16px 4px var(--k), inset 0 0 16px 4px var(--k); animation: mt-ring .55s ease-out forwards; }
:root .mt-ring-tj { --k: #e9c879; width: calc(var(--s) * 9); height: calc(var(--s) * 9); margin: calc(var(--s) * -4.5) 0 0 calc(var(--s) * -4.5); }
@keyframes mt-ring { from { transform: scale(.2); opacity: 1; } to { transform: scale(1); opacity: 0; } }
:root .mt-say { position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); white-space: nowrap; padding: 8px 16px; border-radius: 999px; background: rgba(43, 33, 26, .82); color: #fbf6ee;
  font: 600 17px/1.2 var(--f-body); letter-spacing: .06em; animation: mt-say 1.1s ease-out forwards; }
:root .mt-say-sheng { background: rgba(168, 64, 46, .92); }
@keyframes mt-say { 0% { opacity: 0; transform: translate(-50%, -30%) scale(.8); } 15% { opacity: 1; transform: translate(-50%, -50%) scale(1.04); } 70% { opacity: 1; transform: translate(-50%, -60%); } 100% { opacity: 0; transform: translate(-50%, -80%); } }

/* the result card over the board */
:root .mt-res { position: absolute; inset: 0; display: grid; place-items: center; padding: 18px; background: rgba(244, 239, 228, .82); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); animation: mt-fade .3s ease; }
:root .mt-res[hidden] { display: none; }
@keyframes mt-fade { from { opacity: 0; } }
:root .mt-res-in { width: 100%; max-width: 300px; padding: 22px 20px 20px; text-align: center; border-radius: var(--ds-r-card); background: var(--ds-card); box-shadow: inset 0 0 0 1px var(--ds-line), 0 14px 30px -16px rgba(60, 36, 18, .5); }
:root .mt-res-in h2 { margin: 0 0 6px; font: 600 22px/1.3 var(--f-body); color: var(--ds-ink); }
:root .mt-res-in p { margin: 6px 0 16px; color: var(--ds-ink-2); font-size: 14.5px; }
:root .mt-stars { font-size: 30px; letter-spacing: .12em; color: #ddd2bf; line-height: 1.2; }
:root .mt-stars .is-on { color: #d9a03a; text-shadow: 0 1px 0 #a8742a; }
:root .mt-res-acts { display: grid; gap: 10px; }
:root .mt-res-done { margin: 0 !important; color: var(--ds-red) !important; font-weight: 600; }

:root .mt-bar { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; align-items: center; margin-top: 14px; }
:root .mt-bar .btn-ghost { min-height: 44px; }
:root .mt-sound { padding: 0 4px; white-space: nowrap; }
:root .mt-how { margin: 16px 0 0; font-size: 13.5px; line-height: 1.75; color: var(--ds-ink-3); text-align: center; text-wrap: pretty; }
:root .mt-lvs { max-width: 476px; margin: 0 auto; }
:root .mt-lvs[hidden], :root .mt-play[hidden] { display: none; }
:root .mt-pick { text-align: center; color: var(--ds-ink-2); margin: 0 0 12px; }
:root .mt-lvs-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
:root .mt-lvb { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 62px; border-radius: var(--ds-r-ctl); border: 1px solid var(--ds-line); background: var(--ds-card); color: var(--ds-ink); cursor: pointer; }
:root .mt-lvb b { font: 600 19px/1.1 var(--f-body); }
:root .mt-lvb small { font-size: 11px; color: #d9a03a; letter-spacing: .05em; }
:root .mt-lvb.is-cur { border-color: var(--ds-red); box-shadow: inset 0 0 0 1px var(--ds-red); }
:root .mt-lvb.is-locked { opacity: .5; cursor: default; }
:root .mt-lvb:hover:not(:disabled) { border-color: var(--ds-red); }
@media (max-width: 400px) { :root .mt-hud { grid-template-columns: 56px minmax(0, 1fr) 56px; } :root .mt-hud .mt-goals { gap: 10px; } :root .mt-goal { font-size: 16px; } :root .mt-gi { width: 24px; height: 24px; } }

/* Chinese text: Safari's "pretty" wrapping re-breaks every line at punctuation, which leaves a ragged right edge and
   empty space in bubbles and cards; Chinese reads best filled to the edge, so plain wrapping there */
/* Safari's "pretty" and "balance" wrapping re-break every line early, which leaves a ragged right edge and an empty
   patch in bubbles and cards (in both languages). Plain wrapping fills each line; the speech bubbles are also set
   centred with balanced lines, the way a speech bubble is lettered: equal lines with equal space either side, so
   no side of the box is left empty. Centred headings keep their balanced lines too. */
:root main p, :root main li, :root .lede, :root .cal-lede, :root .sec-head p, :root .dy-s, :root .play-text > span, :root .site-foot p,
:root .dy-bubble, :root .dy-bubble .dy-s, :root .dy-bubble .dy-yj span, :root .mt-how, :root .stem-tag { text-wrap: wrap; }
:root .dy-bubble > p:not(.dy-yj) { text-align: center !important; text-wrap: balance; }
:root .dy-bubble .dy-cl { display: inline-block; }
/* the 宜 / 忌 lines sit as one block in the middle, their labels lined up on the left of it */
:root .dy-bubble .dy-yj { display: grid !important; justify-content: center !important; justify-items: start; gap: 4px; }
/* 宜 / 忌 lines: the label, then the items; a wrapped line starts under the first item, not under the label */
:root .dy-bubble .dy-yj { grid-template-columns: auto auto; column-gap: 10px; align-items: baseline; }
:root .dy-bubble .dy-yj span { display: contents; text-align: left; }
:root .dy-bubble .dy-yj b { margin-right: 0 !important; width: auto !important; text-align: left; }
:root .dy-bubble .dy-yj em { flex: 1; min-width: 0; font-style: normal; }
:root .dy-bubble .dy-yj i { font-style: normal; white-space: nowrap; }

/* centred text (marked by js/clauses.js): balanced lines, and in Chinese whole clauses */
:root [data-bal] { text-wrap: balance; }
:root [data-bal] .cl { display: inline-block; }
html[lang^="zh"] [data-just] { text-align: justify; text-justify: inter-character; }

/* 万年历 hour rows on a phone: the hour on the left, its 宜 and 忌 in the middle, the 干支 and 吉/凶 on the right, so
   each row is filled evenly across instead of crowding the left half */
@media (max-width: 640px) {
  :root .ch-row, :root .cal-hours.has-me .ch-row { grid-template-columns: 5.8em minmax(0, 1fr) auto; grid-template-areas: "name yi gz" "name ji luck"; column-gap: 12px; row-gap: 5px; align-items: center; padding: 9px 4px; }
  :root .cal-hours.has-me .ch-row { grid-template-columns: 5.8em minmax(0, 1fr) auto auto; grid-template-areas: "name yi gz me" "name ji luck me"; }
  :root .ch-name { grid-area: name; align-self: center; white-space: nowrap; }
  :root .ch-gz { grid-area: gz; text-align: right; }
  :root .ch-luck { grid-area: luck; text-align: right; }
  :root .ch-me { grid-area: me; align-self: center; min-width: 2.4em; padding: 6px 0; border-radius: 6px; }
  :root .ch-row .ch-yj { grid-column: auto; white-space: normal; }
  :root .ch-row .ch-yj:nth-last-child(2) { grid-area: yi; }
  :root .ch-row .ch-yj:last-child { grid-area: ji; }
}

/* section intros: two even lines rather than a long one and a stray word */
:root .sec-head p { text-wrap: balance; }
/* 宜 / 忌 on the home card as small filled tags, the same as the almanac's */
:root .dy-pair b, :root .hr-yj b.dy-yi, :root .hr-yj b.dy-ji { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 4px; border-radius: 6px; font-size: 11.5px; font-weight: 600; line-height: 1; color: #fff; align-self: center; }
:root .dy-pair b.dy-yi, :root .hr-yj b.dy-yi { background: #5d7a3c; }
:root .dy-pair b.dy-ji, :root .hr-yj b.dy-ji { background: #a8402e; }
:root:lang(en) .dy-pair b, :root:lang(en) .hr-yj b.dy-yi, :root:lang(en) .hr-yj b.dy-ji { width: 3.7em; padding: 0; }
:root .hr-yj b.dy-yi, :root .hr-yj b.dy-ji { margin-right: 6px; vertical-align: 1px; }
/* 宜 and 忌 side by side in two equal halves under a hairline, each tag above its items */
:root .dy-pair { display: grid; grid-template-columns: 1fr 1fr; margin-top: 10px; padding-top: 10px; border-top: 1px dashed rgba(90, 60, 40, .25); text-align: center; font-size: 13.5px; line-height: 1.55; color: var(--ink-soft); }
:root .dy-pair > div { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 0 6px; min-width: 0; }
:root .dy-pair > div + div { border-left: 1px dashed rgba(90, 60, 40, .25); }
:root .dy-pair b { margin-bottom: 4px; }
:root .dy-pair span { text-wrap: balance; }
:root .dy-pair span[hidden] { display: none; }
:root .dy-pair em { display: flex; flex-direction: column; align-items: center; gap: 2px; font-style: normal; min-width: 0; }
:root .dy-pair b { flex: none; }
/* narrow phones: no room for two halves, so 宜 and 忌 become two rows, tags in line on the left, the block centred */
@media (max-width: 400px) {
  :root .dy-pair { grid-template-columns: auto; justify-content: center; gap: 6px; }
  :root .dy-pair > div { flex-direction: row; align-items: baseline; gap: 8px; padding: 0; }
  :root .dy-pair > div + div { border-left: 0; }
  :root .dy-pair b { margin-bottom: 0; align-self: flex-start; margin-top: 1px; }
  :root .dy-pair em { display: block; text-align: left; }
  :root .dy-pair .is-on ~ .is-on::before { content: '、'; }
  html:not([lang^="zh"]) .dy-pair .is-on ~ .is-on::before { content: ', '; }
}
:root .cl.eol, :root .dy-cl.eol { margin-right: -.5em; }
:root #ls-canvas { cursor: pointer; }
/* 五行消消乐 太极 bomb: a gold-rimmed tile that pulses, then a blast that throws the tiles round it outward */
:root .mt-sp-taiji .mt-g { box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .15), 0 0 0 2px #fff6dc, 0 0 12px 3px rgba(240, 196, 92, .9); animation: mt-tj-pulse 1.2s ease-in-out infinite; }
:root .mt-sp-taiji.mt-big .mt-g { box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .15), 0 0 0 2.5px #fff, 0 0 18px 6px rgba(255, 170, 60, .95); }
:root .mt-sp-taiji.mt-big .mt-taiji svg { animation-duration: 2.4s; }
@keyframes mt-tj-pulse { 50% { transform: scale(1.07); filter: brightness(1.12); } }
:root .mt-t.mt-fly { z-index: 3; pointer-events: none; }
:root .mt-t.mt-fly .mt-g { animation: mt-fly .52s cubic-bezier(.15, .7, .4, 1) var(--fd) forwards; }
@keyframes mt-fly {
  0% { transform: scale(1); filter: brightness(1); }
  14% { transform: scale(1.25); filter: brightness(1.8); }
  100% { transform: translate(var(--fx), var(--fy)) rotate(var(--fr)) scale(.35); opacity: 0; filter: brightness(1.3); }
}
:root .mt-flash { position: absolute; inset: 0; background: radial-gradient(circle at var(--x) var(--y), rgba(255, 255, 255, .95), rgba(255, 236, 180, .55) 30%, rgba(255, 220, 140, 0) 70%); animation: mt-flash .5s ease-out forwards; z-index: 4; }
@keyframes mt-flash { from { opacity: 1; } to { opacity: 0; } }
:root .mt-wave { position: absolute; width: calc(var(--s) * 6); height: calc(var(--s) * 6); margin: calc(var(--s) * -3) 0 0 calc(var(--s) * -3); border-radius: 50%; z-index: 4;
  border: 6px solid rgba(255, 250, 235, .95); box-shadow: 0 0 22px 6px rgba(245, 190, 80, .85), inset 0 0 22px 6px rgba(245, 190, 80, .7); animation: mt-wave .62s cubic-bezier(.2, .7, .3, 1) forwards; }
:root .mt-wave2 { border-width: 3px; animation-delay: .1s; transform: scale(.1); box-shadow: 0 0 16px 3px rgba(255, 255, 255, .8); }
:root .mt-wave-big { width: calc(var(--s) * 10); height: calc(var(--s) * 10); margin: calc(var(--s) * -5) 0 0 calc(var(--s) * -5); }
@keyframes mt-wave { from { transform: scale(.1); opacity: 1; } to { transform: scale(1); opacity: 0; } }
:root .mt-tj-boom { position: absolute; width: var(--s); height: var(--s); margin: calc(var(--s) * -.5) 0 0 calc(var(--s) * -.5); z-index: 5; animation: mt-tj-boom .66s cubic-bezier(.2, .8, .3, 1) forwards; }
:root .mt-tj-boom svg { width: 100%; height: 100%; filter: drop-shadow(0 0 10px rgba(255, 215, 120, .95)); }
@keyframes mt-tj-boom { 0% { transform: scale(.8) rotate(0); opacity: 1; } 35% { transform: scale(2.4) rotate(220deg); opacity: 1; } 100% { transform: scale(3.6) rotate(400deg); opacity: 0; } }
:root .mt-ring-born { --k: #f0c45c; width: calc(var(--s) * 2.2); height: calc(var(--s) * 2.2); margin: calc(var(--s) * -1.1) 0 0 calc(var(--s) * -1.1); }
:root .mt-board.mt-quake { animation: mt-quake .45s cubic-bezier(.36, .07, .19, .97); }
:root .mt-board.mt-quake-big { animation: mt-quake-big .5s cubic-bezier(.36, .07, .19, .97); }
@keyframes mt-quake { 10% { transform: translate(-5px, 3px) rotate(-.6deg); } 25% { transform: translate(6px, -4px) rotate(.6deg); } 40% { transform: translate(-4px, -3px); } 55% { transform: translate(4px, 3px); } 70% { transform: translate(-2px, 1px); } 85% { transform: translate(1px, -1px); } }
@keyframes mt-quake-big { 10% { transform: translate(-9px, 5px) rotate(-1deg) scale(1.02); } 25% { transform: translate(10px, -6px) rotate(1deg); } 40% { transform: translate(-7px, -5px); } 55% { transform: translate(6px, 5px); } 70% { transform: translate(-3px, 2px); } 85% { transform: translate(2px, -1px); } }
:root .mt-say-boom { background: linear-gradient(135deg, #b8392a, #e0892f); font-size: 22px; letter-spacing: .1em; box-shadow: 0 6px 18px -6px rgba(120, 40, 10, .6); animation-name: mt-say-boom; }
:root .mt-say-born { background: rgba(176, 122, 18, .92); }
@keyframes mt-say-boom { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.4); } 18% { opacity: 1; transform: translate(-50%, -50%) scale(1.25); } 32% { transform: translate(-50%, -50%) scale(1); } 75% { opacity: 1; transform: translate(-50%, -60%); } 100% { opacity: 0; transform: translate(-50%, -80%); } }
@media (prefers-reduced-motion: reduce) { :root .mt-board.mt-quake, :root .mt-board.mt-quake-big { animation: none; } }
/* the day pillar panel, under the Day Master card */
:root .area-card { display: flex; flex-direction: column; gap: 16px; }
:root .area-card > .dm-panel { height: auto; }
:root .area-card > .dm-panel:first-child { flex: 1 1 auto; }
:root .pl-gz { font: 600 22px/1 var(--f-display, var(--f-body)); letter-spacing: .08em; }
:root .pl-body { padding: 4px 20px 18px; }
:root .pl-facts { margin: 0 0 14px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--r); background: rgba(255, 253, 248, .7); overflow: hidden; }
:root .pl-facts div { padding: 10px 12px; border-right: 1px solid var(--line-soft); min-width: 0; text-align: center; }
:root .pl-facts div:last-child { border-right: 0; }
:root .pl-facts dt { font-size: 12px; color: var(--ink-faint); letter-spacing: .06em; margin-bottom: 4px; }
:root .pl-facts dd { margin: 0; font-size: 15px; }
:root .pl-row { display: grid; grid-template-columns: 4.2em minmax(0, 1fr); gap: 12px; align-items: baseline; padding: 10px 0; border-top: 1px dashed var(--line-soft); }
:root .pl-row:first-of-type { border-top: 0; }
:root .pl-row b { font-weight: 600; color: var(--seal); font-size: 14px; letter-spacing: .08em; }
:root:lang(en) .pl-row { grid-template-columns: 5.6em minmax(0, 1fr); }
:root:lang(en) .pl-row b { letter-spacing: .02em; }
:root .pl-row p { margin: 0; line-height: 1.75; }
@media (max-width: 640px) {
  :root .pl-body { padding: 2px 14px 14px; }
  :root .pl-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  :root .pl-facts div:nth-child(2n) { border-right: 0; }
  :root .pl-facts div:nth-child(-n+2) { border-bottom: 1px solid var(--line-soft); }
}
:root .pl-row p { text-align: left; } :root .pl-row .dy-cl { display: inline-block; }
/* both mini-games in faded traditional pigments (竹青, 胭脂, 驼色, 缃黄, 黛蓝) on light paper, so they sit quietly with the site */
:root .mg-board { background: #d8ccb5; }
:root .mg-board > i { background: rgba(250, 246, 236, .55); }
:root .mg-l0 { background: #e9efe2; color: #5e8768; } :root .mg-l1 { background: #9bb7a0; color: #fbf8f1; }
:root .mg-l2 { background: #f6e6df; color: #b06a5c; } :root .mg-l3 { background: #cf968a; color: #fffaf5; }
:root .mg-l4 { background: #f2eadb; color: #8f7558; } :root .mg-l5 { background: #bba380; color: #fffaf2; }
:root .mg-l6 { background: #f6efd9; color: #a08548; } :root .mg-l7 { background: #d2b67f; color: #fffbf0; }
:root .mg-l8 { background: #e5ebf2; color: #5c7795; } :root .mg-l9 { background: #98abc2; color: #f8fafc; }
:root .mg-l10 { background: #716659; color: #f6ead0; }
:root .mt-board { background: linear-gradient(#efe7d8, #e5d9c3); }
:root .mt-e0 { background: radial-gradient(circle at 34% 26%, #d4e5c6, #b3cfa3 60%, #9cbd8c); }
:root .mt-e1 { background: radial-gradient(circle at 34% 26%, #f6d1c6, #eab0a1 60%, #dc988a); }
:root .mt-e2 { background: radial-gradient(circle at 34% 26%, #faecc4, #f0d79f 60%, #e3c47f); }
:root .mt-e3 { background: radial-gradient(circle at 34% 26%, #ffffff, #f7f4ee 60%, #e6e0d4); }
:root .mt-e4 { background: radial-gradient(circle at 34% 26%, #d3dff0, #b2c5e2 60%, #9bb2d6); }
:root .mt-g { box-shadow: inset 0 -3px 0 rgba(90, 60, 30, .1), inset 0 2px 0 rgba(255, 255, 255, .55), 0 2px 3px rgba(90, 60, 30, .14); }
:root .mt-g svg { filter: drop-shadow(0 1px 0 rgba(60, 40, 20, .18)); }
/* ---------- 锦鲤池 koi pond: the game-page pond drawn large, with the day's food above it ---------- */
:root body:has(.pond-page) .bg-pond { height: max(62vh, 420px) !important; bottom: 0 !important; }
@media (max-width: 760px) { :root body:has(.pond-page) .bg-pond { height: max(360px, calc(100vh - 470px)) !important; bottom: calc(60px + env(safe-area-inset-bottom, 0px)) !important; } }
:root .pond-page .daily-box { max-width: 520px; margin: 0 auto; padding: 0; background: none; box-shadow: none; border: 0; display: grid; justify-items: center; gap: 12px; }
:root .pd-bar { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px 10px; }
:root .pd-stat { display: inline-flex; align-items: baseline; gap: 6px; padding: 5px 12px; border-radius: 999px; background: rgba(255, 252, 245, .9); box-shadow: inset 0 0 0 1px var(--line); }
:root .pd-stat i { font-style: normal; font-size: 12.5px; color: var(--ink-faint); letter-spacing: .06em; }
:root .pd-stat b { font-weight: 600; font-size: 15px; color: var(--ink); font-variant-numeric: tabular-nums; }
:root .pd-sound { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; background: rgba(255, 252, 245, .9); box-shadow: inset 0 0 0 1px var(--line); font-size: 13.5px; color: var(--ink-soft); }
:root .pd-feed { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-width: 220px; padding: 14px 28px; border-radius: 999px; font-size: 17px; letter-spacing: .12em; box-shadow: 0 10px 22px -10px rgba(140, 50, 30, .55); }
:root:lang(en) .pd-feed { letter-spacing: .02em; }
:root .pd-feed svg { width: 22px; height: 22px; flex: none; }
:root .pd-feed:active { transform: scale(.97); }
:root .pd-feed:disabled { opacity: .5; box-shadow: none; }
:root .pd-tip { margin: 0; text-align: center; color: var(--ink-soft); font-size: 13.5px; }
:root .pd-tip.is-flash { animation: pd-flash 1.6s ease; }
@keyframes pd-flash { 0%, 100% { color: var(--ink-soft); } 20% { color: var(--seal); } }
/* phones: the pond sits just above the tab bar, which grows by the home-indicator inset when the browser has no bar of its own */
@media (max-width: 760px) { :root .bg-pond { bottom: calc(60px + env(safe-area-inset-bottom, 0px)); } }
/* the 锦鲤池 card spans both columns under the daily stick and the wooden fish: the scene on the left, words on the right */
:root .play-card.play-card-wide { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); align-items: center; gap: 22px; }
:root .play-card-wide .play-art { height: 100%; min-height: 180px; margin: 0; aspect-ratio: auto; }
:root .pa-pond { padding: 0 !important; overflow: hidden; border-radius: 10px; background: #e6dfcf; }
:root .pa-pond img { width: 100%; height: 100%; object-fit: cover; display: block; }
@media (max-width: 640px) {
  :root .play-card.play-card-wide { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  :root .play-card-wide .play-art { min-height: 0; height: 132px; }
}
/* the 锦鲤池 card: its own full row under both groups on wide screens; on one-column phones it follows the daily stick and the wooden fish */
:root .play-group-wide { grid-column: 1 / -1; }
@media (max-width: 1040px) { :root .play-groups > .play-group:nth-child(1) { order: 1; } :root .play-group-wide { order: 2; } :root .play-groups > .play-group:nth-child(2) { order: 3; } }
:root .play-group-wide .play-card-wide { height: auto; }
:root .pond-page .daily-box { position: relative; }
:root .pd-plus { position: absolute; top: 52px; transform: translateX(-50%); pointer-events: none; color: var(--seal); font: 600 15px/1 var(--f-body); letter-spacing: .08em; animation: pd-plus 1.2s ease-out forwards; }
@keyframes pd-plus { 0% { opacity: 0; transform: translate(-50%, 10px); } 20% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -28px); } }
