/*
 * css/screens.css — layouts of every screen (DESIGN §11). Desktop ≥ 720 px (designed at 1280 × 800),
 * phone < 720 px (designed at 375 wide, 16 px gutters). No horizontal scroll; targets ≥ 44 px.
 * A lacquer cabinet come to life: black and gold, ornament doing the framing, generous space, calm motion.
 */
#app { min-height: 100vh; }

/* ================================================================ shell + top bar */
.shell { display: grid; grid-template-rows: 56px minmax(0, 1fr); height: 100vh; height: 100dvh; }
.topbar {
  position: relative; z-index: 10; display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 14px;
  padding: 0 14px 0 20px; background: linear-gradient(180deg, #150F0B, #0C0907); border-bottom: 1px solid var(--gold-0);
  box-shadow: 0 1px 0 #000, 0 8px 22px rgba(0, 0, 0, .55);
}
.topbar::after { content: ""; position: absolute; left: 0; right: 0; bottom: -4px; height: 3px; background: linear-gradient(90deg, transparent, rgba(201, 161, 59, .35), transparent); pointer-events: none; }
/* ribbon: the bilingual month label on top; the month's title and the phase lotuses beneath it */
.tb-month { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "l l" "t p"; align-items: center; column-gap: 14px; min-width: 0; line-height: 1.25; }
.tb-month-l { display: contents; }
.tb-long { grid-area: l; font-family: var(--f-head); font-size: .98rem; color: var(--gold-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-short { grid-area: l; display: none; font-family: var(--f-head); color: var(--gold-2); font-size: 1rem; white-space: nowrap; }
.tb-title { grid-area: t; font-size: .76rem; color: var(--ivory-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.phases { grid-area: p; display: flex; align-items: center; gap: 2px; margin: 0; padding: 0; list-style: none; min-width: 0; }
.ph { display: flex; align-items: center; gap: 4px; }
.ph .ayu-bullet { width: 14px; height: 14px; }
.ph-l { display: none; font-size: .74rem; color: var(--gold-2); white-space: nowrap; }
.ph-current .ph-l { display: inline; }
.ph-skip { opacity: .3; }
.tb-res { display: flex; gap: 6px; }
.res {
  position: relative; display: flex; align-items: center; gap: 6px; min-height: 36px; padding: 2px 12px 2px 8px; border: 1px solid rgba(138, 106, 30, .45);
  background: linear-gradient(180deg, rgba(31, 23, 18, .9), rgba(15, 11, 8, .9)); border-radius: 2px; white-space: nowrap;
}
.res-ic { width: 22px; height: 22px; color: var(--gold-1); }
.res-v { font-family: var(--f-en-body); font-weight: 600; font-size: 1.05rem; color: var(--ivory); font-variant-numeric: tabular-nums; }
.res-short { display: none; }
.res-u { font-size: .72rem; color: var(--ivory-dim); }
.res.warn { border-color: var(--vermilion); } .res.warn .res-v, .res.warn .res-ic { color: var(--down); }
.res-fx { position: absolute; left: 50%; top: 100%; transform: translateX(-50%); pointer-events: none; font-size: .86rem; white-space: nowrap; opacity: 0; z-index: 3; }
.res-fx.go { animation: fx-rise 1.6s var(--ease) both; }
@keyframes fx-rise { 0% { opacity: 0; transform: translate(-50%, 6px); } 15% { opacity: 1; } 70% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -2px); } }
.pulse { animation: pulse 1s var(--ease); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(246, 227, 161, .7); } 100% { box-shadow: 0 0 0 10px rgba(246, 227, 161, 0); } }
.tb-nav { display: flex; align-items: center; justify-content: flex-end; gap: 2px; }
.nav-btn {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 10px; border: 1px solid transparent; background: none; color: var(--gold-1);
  cursor: pointer; font-family: var(--f-head); font-size: .98rem; font-weight: 600;
}
.nav-btn .ayu-icon { width: 20px; height: 20px; }
.nav-btn:hover { color: var(--gold-3); border-color: rgba(138, 106, 30, .5); }
.lang-btn {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; margin: 0 4px; border: 1px solid rgba(138, 106, 30, .6);
  border-radius: 999px; background: rgba(11, 9, 7, .6); color: var(--ivory-dim); cursor: pointer; font-size: .9rem;
}
.lang-btn .on { color: var(--gold-3); font-weight: 600; }
.lang-btn i { color: var(--gold-0); font-style: normal; }
.lang-btn:hover { border-color: var(--gold-1); }
.nav-menu { display: none; }
/* ================================================================ the stage */
.stage { display: grid; grid-template-columns: minmax(0, 62fr) minmax(0, 38fr); gap: 22px; padding: 18px 22px 0; min-height: 0; overflow: hidden; }
.stage-main { min-height: 0; overflow-y: auto; padding: 0 4px 28px 0; scroll-behavior: smooth; }
.context { min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; padding: 0 4px 22px 0; }
.context-body { flex: none; }
.context-foot { flex: none; }
.scene-panel {
  position: relative; height: clamp(170px, 33vh, 300px); overflow: hidden; background: var(--lacquer-1);
  box-shadow: inset 0 0 0 1px var(--gold-0), 0 14px 30px rgba(0, 0, 0, .5);
}
.ctx-inline .scene-panel { height: clamp(220px, 46vh, 400px); }
.btn-go .kbd-word { font-size: .62rem; letter-spacing: .04em; padding: 0 4px; }
.scene-art, .scene-art svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.scene-shade { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(180deg, rgba(11, 9, 7, 0) 55%, rgba(11, 9, 7, .7) 100%), radial-gradient(120% 90% at 50% 40%, transparent 60%, rgba(11, 9, 7, .55)); }
.scene-panel .corners .ayu-corner { width: 26px; height: 26px; }
.dialogue { position: relative; z-index: 2; margin: -44px 22px 0; padding: 0 30px 26px; }
.dialogue::before { content: ""; position: absolute; left: 50%; top: -1px; width: 120px; height: 2px; transform: translateX(-50%); background: linear-gradient(90deg, transparent, var(--gold-2), transparent); }
.dlg-head { display: flex; align-items: flex-end; gap: 22px; margin-bottom: 14px; }
.arch { flex: none; width: 148px; margin-top: -104px; filter: drop-shadow(0 12px 18px rgba(0, 0, 0, .65)); position: relative; z-index: 3; }
.arch-none { width: 92px; margin-top: -40px; padding: 10px 6px 6px; background: radial-gradient(circle at 50% 60%, rgba(107, 26, 20, .55), rgba(21, 16, 12, .95) 70%); border-radius: 50% 50% 8px 8px / 60% 60% 8px 8px; box-shadow: inset 0 0 0 1px var(--gold-0); }
.arch-emblem { width: 100%; height: auto; display: block; }
.plate { flex: 1; min-width: 0; padding-top: 18px; }
.ev-title { font-size: 1.85rem; margin: 2px 0 6px; color: var(--gold-2); text-shadow: 0 1px 0 #000; }
html[lang="th"] .ev-title { font-size: 1.55rem; }
.speaker-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.sp-name { font-family: var(--f-head); font-weight: 600; color: var(--ivory); font-size: 1.05rem; }
.sp-title { color: var(--ivory-dim); font-size: .88rem; }
.ev-text { max-width: 66ch; cursor: text; }
.para { margin: 0 0 .8em; }
.narr { color: var(--ivory-dim); }
.speech { color: var(--ivory); font-size: 1.04em; }
.aside-speech { display: flex; gap: 12px; align-items: flex-start; margin: 0 0 .9em; padding: 10px 12px; border-left: 2px solid rgba(201, 161, 59, .45); background: rgba(31, 23, 18, .5); }
.aside-face { flex: none; width: 46px; }
.aside-body { min-width: 0; }
.aside-name { font-family: var(--f-head); font-weight: 600; color: var(--gold-2); margin-right: 8px; }
.aside-body .badge { transform: scale(.9); transform-origin: left center; }
.aside-body p { margin: 2px 0 0; color: var(--ivory); }
.tw-off { visibility: hidden; }
.typing-wait { visibility: hidden; }
.after.pending { visibility: hidden; opacity: 0; }
.after.shown { animation: rise .5s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.shown-chips { margin: -2px 0 14px; }

/* ---- choices ---- */
.choices { list-style: none; margin: 18px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.choice {
  position: relative; display: flex; align-items: flex-start; gap: 14px; width: 100%; min-height: 58px; padding: 12px 16px 12px 12px; text-align: left; cursor: pointer;
  border: 1px solid rgba(138, 106, 30, .55); background: linear-gradient(90deg, rgba(36, 26, 19, .96), rgba(22, 16, 12, .96)); color: var(--ivory);
  transition: border-color .2s, background .2s, transform .2s var(--ease), box-shadow .2s;
}
.choice::before { content: ""; position: absolute; left: -1px; top: -1px; bottom: -1px; width: 3px; background: var(--gold-1); transform: scaleY(0); transition: transform .25s var(--ease); }
button.choice:hover { border-color: var(--gold-1); background: linear-gradient(90deg, rgba(52, 36, 24, .98), rgba(26, 19, 14, .98)); box-shadow: 0 6px 18px rgba(0, 0, 0, .35); }
button.choice:hover::before, button.choice:focus-visible::before { transform: scaleY(1); }
.choice-n {
  flex: none; display: grid; place-items: center; width: 32px; height: 32px; margin: 2px 2px 0 4px; color: var(--gold-3); font-family: var(--f-en-head); font-weight: 700; font-size: 1.05rem;
  position: relative; z-index: 0;
}
.choice-n::before { content: ""; position: absolute; inset: 3px; transform: rotate(45deg); border: 1px solid var(--gold-1); background: linear-gradient(135deg, #5A1712, #2A0C09); z-index: -1; }
.choice-n .ayu-icon { width: 18px; height: 18px; color: var(--ivory-dim); }
.choice-b { display: flex; flex-direction: column; gap: 7px; min-width: 0; flex: 1; }
.choice-l { font-size: 1.06rem; line-height: 1.4; }
html[lang="th"] .choice-l { line-height: 1.65; }
.choice.locked { cursor: not-allowed; border-style: dashed; border-color: rgba(191, 180, 154, .3); background: rgba(21, 16, 12, .7); }
.choice.locked .choice-l { color: var(--ivory-dim); }
.choice.locked .chips { opacity: .55; filter: saturate(.4); }
.choice.locked .choice-n::before { border-color: rgba(191, 180, 154, .4); background: #1A1410; }
.lock-lines { list-style: none; margin: 0; padding: 0; font-size: .86rem; color: #CDBFA0; }
.lock-lines li { position: relative; padding-left: 16px; }
.lock-lines li::before { content: ""; position: absolute; left: 2px; top: .7em; width: 7px; height: 7px; transform: rotate(45deg); border: 1px solid var(--down); }
.choices.climax .lock-lines { columns: 2; column-gap: 26px; }
.choices.climax .lock-lines li { break-inside: avoid; margin-bottom: 2px; }
/* the court's voices below the roads (last council, phone): one line each, tap for the whole */
.voices { margin: 18px 0 0; }
.voices-hint { font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--ivory-dim); }
.voice-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.voice { display: flex; gap: 10px; align-items: flex-start; padding: 6px 8px; background: rgba(31, 23, 18, .55); border-left: 2px solid rgba(201, 161, 59, .4); }
.voice-face { flex: none; width: 36px; }
.voice-b { flex: 1; min-width: 0; min-height: 44px; display: flex; flex-direction: column; gap: 1px; padding: 0; border: 0; background: none; color: var(--ivory); text-align: left; cursor: pointer; font: inherit; }
.voice-top { display: flex; align-items: center; gap: 6px; }
.voice-top .badge { font-size: .7rem; min-height: 18px; }
.voice-t { font-size: .92rem; line-height: 1.5; overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 1; line-clamp: 1; }
html[lang="th"] .voice-t { line-height: 1.7; }
.voice.open .voice-t { -webkit-line-clamp: unset; line-clamp: none; display: block; }
.more-btn { display: none; align-self: flex-start; min-height: 36px; padding: 4px 10px; border: 1px solid rgba(138, 106, 30, .5); background: transparent; color: var(--gold-2); cursor: pointer; font-size: .82rem; }
.more-off { display: none; }
.choice.expanded .more-on { display: none; } .choice.expanded .more-off { display: inline; }
/* ---- result: your word → what happened → the price lands → who now thinks what ---- */
.your-word { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin: 0 0 12px; padding: 8px 14px; border-left: 2px solid var(--gold-1); background: rgba(201, 161, 59, .06); }
.your-word q { color: var(--gold-2); font-family: var(--f-head); font-size: 1.08rem; }
.result-text .para { font-size: 1.12em; color: var(--ivory); }
.res-chips { margin: 4px 0 16px; }
.res-chips .chip { font-size: .9rem; padding: 3px 11px 3px 8px; }
.chip-ghost { position: fixed; z-index: 70; pointer-events: none; margin: 0; box-shadow: 0 0 16px rgba(230, 199, 106, .45); background: #1B140F; }
.reactions { margin: 8px 0 16px; padding: 14px 16px 6px; background: linear-gradient(180deg, rgba(59, 13, 11, .35), rgba(21, 16, 12, .2)); box-shadow: inset 0 0 0 1px rgba(138, 106, 30, .35); }
.react-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px 18px; }
.react { display: flex; gap: 12px; align-items: flex-start; padding-bottom: 10px; transition: opacity .55s var(--ease), transform .55s var(--ease); }
.react.wait { opacity: 0; transform: translateY(10px) scale(.98); }
.react.in { opacity: 1; transform: none; }
.react-face { flex: none; width: 58px; }
.react-b { min-width: 0; }
.react-top { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; }
.react-name { font-family: var(--f-head); font-weight: 600; color: var(--ivory); font-size: 1.05rem; }
.react-now { font-size: .8rem; color: var(--band, var(--ivory-dim)); }
.react-why { margin: 3px 0 0; color: var(--ivory); font-style: italic; font-size: .96rem; line-height: 1.45; }
html[lang="th"] .react-why { font-style: normal; line-height: 1.7; }
.chron-line { margin: 0 0 14px; padding: 10px 14px; background: linear-gradient(90deg, rgba(217, 201, 163, .1), transparent); border-left: 2px solid var(--palm); }
.chron-line p { margin: 4px 0 0; color: var(--palm); font-family: var(--f-head); font-size: 1.04rem; }
.chron-line .kicker .ayu-icon { width: 16px; height: 16px; }
.hist { margin: 0 0 14px; }
.tab-lacquer {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 6px 14px; border: 1px solid var(--gold-0); border-bottom: 0; cursor: pointer;
  background: linear-gradient(180deg, var(--red-1), var(--red-0)); color: var(--gold-3); font-family: var(--f-head); font-weight: 600; border-radius: 6px 6px 0 0;
}
.tab-lacquer .ayu-icon { width: 18px; height: 18px; }
.tog-ic { transition: transform .25s; }
.toggle-root.open .tog-ic { transform: rotate(180deg); }
.hist-body { display: none; padding: 12px 16px; border: 1px solid var(--gold-0); background: rgba(59, 13, 11, .3); }
.hist.open .hist-body { display: block; animation: rise .35s var(--ease) both; }
.hist-body h4 { font-size: 1.1rem; margin-bottom: 4px; }
.hist-body p { color: var(--ivory); font-size: .96rem; }
.codex-new { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin: 0 0 8px; color: var(--ivory-dim); }
.codex-new .ayu-icon { width: 18px; height: 18px; color: var(--gold-1); }

/* ================================================================ context: month card, factions */
.realm { padding: 18px 20px 16px; }
.realm-month { display: flex; align-items: center; gap: 12px; margin: 10px 0 6px; }
.season-ic { width: 40px; height: 40px; color: var(--gold-2); flex: none; }
.realm-name { font-family: var(--f-head); font-size: 1.35rem; color: var(--gold-2); line-height: 1.2; }
.realm-approx { font-size: .86rem; color: var(--ivory-dim); }
.realm-title { font-family: var(--f-head); color: var(--ivory); font-size: 1.1rem; margin: 8px 0 2px; }
.realm-of { font-size: .82rem; color: var(--ivory-dim); }
.realm-inc ul { list-style: none; margin: 6px 0 0; padding: 0; }
.realm-inc li { display: flex; align-items: center; gap: 8px; font-size: .9rem; padding: 3px 0; border-bottom: 1px dotted rgba(138, 106, 30, .3); }
.realm-inc li span { flex: 1; min-width: 0; color: var(--ivory-dim); }
.realm-inc, .realm-traits { margin-top: 14px; }
.realm-traits .kicker { display: flex; margin-bottom: 6px; }
.roads-cta {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 48px; margin-top: 14px; padding: 8px 12px; cursor: pointer; text-align: left;
  border: 1px solid var(--gold-0); background: linear-gradient(90deg, rgba(107, 26, 20, .55), rgba(21, 16, 12, .8)); color: var(--gold-2); font-family: var(--f-head); font-weight: 600;
}
.roads-cta:hover { border-color: var(--gold-1); color: var(--gold-3); }
.roads-cta span:nth-child(2) { flex: 1; }
.roads-cta .ayu-icon { width: 20px; height: 20px; }
.roads-cta-n { font-family: var(--f-en-body); color: var(--ivory-dim); }
.factions { padding: 14px 16px 10px; background: rgba(15, 11, 8, .8); box-shadow: inset 0 0 0 1px rgba(138, 106, 30, .4); }
.factions .kicker { display: flex; margin-bottom: 6px; }
.fbar { position: relative; display: grid; grid-template-columns: 20px minmax(0, 1fr) minmax(70px, 1.3fr) 30px; grid-template-areas: "ic l track v" ". b b b"; align-items: center; column-gap: 8px; padding: 4px 0; }
.fbar-ic { grid-area: ic; width: 20px; height: 20px; color: var(--gold-1); }
.fbar-l { grid-area: l; font-size: .88rem; color: var(--ivory); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fbar-track { grid-area: track; position: relative; height: 8px; background: #0B0907; box-shadow: inset 0 0 0 1px rgba(138, 106, 30, .55); }
.fbar-fill { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(90deg, var(--gold-0), var(--fb, var(--gold-1))); transition: width .8s var(--ease); }
.fbar-mark { position: absolute; top: -2px; bottom: -2px; width: 1px; background: rgba(239, 230, 207, .25); }
.fbar-mark.m20 { left: 20%; } .fbar-mark.m40 { left: 40%; } .fbar-mark.m70 { left: 70%; }
.fbar-v { grid-area: v; text-align: right; font-family: var(--f-en-body); font-weight: 600; font-variant-numeric: tabular-nums; }
.fbar-b { grid-area: b; font-size: .72rem; color: var(--fb, var(--ivory-dim)); line-height: 1.2; display: none; }
.fbar.band-hostile { --fb: var(--vermilion); } .fbar.band-uneasy { --fb: #C9876A; } .fbar.band-content { --fb: var(--gold-1); } .fbar.band-devoted { --fb: var(--gold-3); }
.fbar.band-hostile .fbar-v, .fbar.band-hostile .fbar-b { color: var(--down); }
.fbar .res-fx { left: auto; right: 0; top: -6px; transform: none; }
.fbar .res-fx.go { animation-name: fx-rise-r; }
@keyframes fx-rise-r { 0% { opacity: 0; } 20% { opacity: 1; } 75% { opacity: 1; } 100% { opacity: 0; transform: translateY(-6px); } }
/* ================================================================ audience: who waits outside */
.queue-hint { color: var(--ivory-dim); margin: 0 0 6px; max-width: 60ch; }
.queue-hint:empty { display: none; }
.hours { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 6px; }
.buds { display: inline-flex; gap: 3px; }
.buds .ayu-bullet { width: 20px; height: 20px; }
.hours-n { font-size: .84rem; color: var(--ivory-dim); }
.queue { display: flex; flex-direction: column; gap: 10px; }
.sheet-handle { display: none; }
.queue-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; }
.queue-head .hours { margin: 0; }
.ctx-inline .queue-head .hours { display: none; }
.queue-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.pet {
  position: relative; display: flex; flex-direction: column; gap: 6px; padding: 14px 14px 12px; min-width: 0;
  background: var(--panel); box-shadow: inset 0 0 0 1px rgba(138, 106, 30, .5), 0 8px 18px rgba(0, 0, 0, .35); transition: box-shadow .25s, opacity .25s;
}
.pet .corners .ayu-corner { width: 16px; height: 16px; }
.pet-waiting:hover { box-shadow: inset 0 0 0 1px var(--gold-1), 0 10px 22px rgba(0, 0, 0, .45); }
.pet-current { box-shadow: inset 0 0 0 1px var(--gold-2), inset 0 0 0 3px rgba(230, 199, 106, .2), 0 0 26px rgba(201, 161, 59, .22); }
.pet-heard, .pet-refused { opacity: .62; }
.pet-heard .face, .pet-refused .face { filter: grayscale(.5); }
.pet-top { display: flex; gap: 10px; align-items: center; }
.pet-face { flex: none; width: 54px; }
.pet-who { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; }
.pet-name { font-family: var(--f-head); font-weight: 600; color: var(--ivory); font-size: 1.04rem; line-height: 1.25; }
.pet-role { font-size: .78rem; color: var(--ivory-dim); line-height: 1.3; }
.pet-who .badge { margin-top: 2px; font-size: .74rem; min-height: 20px; }
.pet-t { font-size: 1.08rem; color: var(--gold-2); margin-top: 2px; }
html[lang="th"] .pet-t { font-size: 1rem; }
.pet-teaser { margin: 0; font-size: .9rem; color: var(--ivory); line-height: 1.45; flex: 1; }
html[lang="th"] .pet-teaser { line-height: 1.7; }
.pet-unheard { display: flex; flex-direction: column; gap: 4px; padding-top: 6px; border-top: 1px dotted rgba(138, 106, 30, .4); }
.pet-unheard .chip { font-size: .78rem; }
.no-cost { font-size: .8rem; color: var(--ivory-dim); font-style: italic; }
html[lang="th"] .no-cost { font-style: normal; }
.pet-out { display: flex; flex-direction: column; gap: 4px; padding-top: 6px; border-top: 1px dotted rgba(138, 106, 30, .4); font-size: .84rem; }
.pet-out q { color: var(--ivory-dim); }
.pet-out .pet-heard { display: inline-flex; align-items: center; gap: 4px; color: var(--gold-1); }
.pet-status { display: inline-flex; align-items: center; gap: 6px; padding-top: 6px; color: var(--gold-3); font-size: .86rem; }
.hear-btn { width: 100%; margin-top: 6px; min-height: 44px; }
.hear-btn span { overflow: hidden; text-overflow: ellipsis; }
/* end-of-audience summary */
.sum-sec + .sum-sec { margin-top: 18px; }
.sum-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.sum-row { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; background: rgba(31, 23, 18, .55); box-shadow: inset 0 0 0 1px rgba(138, 106, 30, .3); }
.sum-row.refused { background: rgba(59, 13, 11, .25); }
.sum-face { flex: none; width: 46px; }
.sum-b { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.sum-t { font-family: var(--f-head); color: var(--gold-2); font-weight: 600; display: flex; flex-wrap: wrap; gap: 2px 8px; align-items: baseline; }
.sum-who { font-family: var(--f-body); font-weight: 400; color: var(--ivory-dim); font-size: .84rem; }
.sum-label, .sum-note { margin: 0; color: var(--ivory); font-size: .92rem; }

/* ================================================================ the evening picker */
.evening-opts { display: flex; flex-direction: column; gap: 10px; }
.eve-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.eve { display: flex; gap: 16px; padding: 16px 18px; align-items: flex-start; }
.eve-people { flex: none; display: flex; gap: 6px; }
.eve-person { width: 88px; display: flex; flex-direction: column; align-items: center; gap: 3px; text-align: center; }
.eve-people.n2 .eve-person, .eve-people.n3 .eve-person { width: 64px; }
.eve-face { width: 100%; }
.eve-name { font-family: var(--f-head); font-weight: 600; font-size: .9rem; color: var(--ivory); line-height: 1.2; }
.eve-person .badge { font-size: .7rem; min-height: 20px; padding: 0 6px 0 4px; }
.eve-b { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.eve-t { font-size: 1.2rem; }
.eve-teaser { margin: 0; color: var(--ivory); font-size: .95rem; }
.eve-know { margin-top: 18px; padding-top: 14px; border-top: 1px solid rgba(138, 106, 30, .35); }
.know-list { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.know { display: flex; gap: 16px; align-items: flex-start; }
.know-face { flex: none; width: 76px; }
.know-b { min-width: 0; flex: 1; }
.know-top { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.know-name { font-family: var(--f-head); font-weight: 600; font-size: 1.1rem; color: var(--gold-2); }
.know-title { font-size: .82rem; color: var(--ivory-dim); margin-bottom: 4px; }
.know-want, .know-secret { margin: 2px 0 0; font-size: .92rem; color: var(--ivory); }
.know-secret { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; color: #BFE0C6; }
.know-secret .mini-ic { color: #8FC29C; }
.screen-picker .scene-shade { background: linear-gradient(180deg, rgba(11, 9, 7, .1), rgba(11, 9, 7, .75)), radial-gradient(120% 90% at 50% 40%, transparent 55%, rgba(11, 9, 7, .6)); }
/* ================================================================ month end: time passes over the river */
.mode-centre .stage { grid-template-columns: minmax(0, 1fr); }
.mode-centre .context { display: none; }
.mode-centre .stage-main { width: 100%; max-width: 820px; margin: 0 auto; }
.mode-centre .scene-panel { height: clamp(140px, 24vh, 220px); }
.me-head { padding-top: 18px; text-align: center; }
.me-head .kicker { justify-content: center; }
.me-sub { color: var(--ivory-dim); margin: 0 0 14px; }
.me-cards { display: flex; flex-direction: column; gap: 12px; }
.me-card { position: relative; padding: 14px 18px; background: rgba(21, 16, 12, .85); box-shadow: inset 0 0 0 1px rgba(138, 106, 30, .4); }
.me-card.land { animation: me-land .6s var(--ease) both; animation-delay: calc(var(--i, 0) * 550ms + 200ms); }
.samut.land, .me-go.land { animation: me-land .6s var(--ease) both; animation-delay: calc(var(--i, 0) * 550ms + 200ms); }
@keyframes me-land { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.me-ev { display: flex; gap: 14px; align-items: flex-start; }
.me-face { flex: none; width: 64px; }
.me-face.sm { width: 46px; }
.me-ev-b { min-width: 0; flex: 1; }
.me-t { font-size: 1.2rem; margin: 2px 0 6px; }
.me-ev-b > p { color: var(--ivory); margin-bottom: .5em; }
.me-ev-b .chips { margin: 6px 0 4px; }
.me-ev-b .reactions { margin: 10px 0 4px; }
.me-result-t { color: var(--ivory); font-style: italic; }
.me-result-t > .para { margin: 0 0 .5em; }
.me-result-t .aside-speech { font-style: normal; margin: 0 0 .5em; padding: 6px 10px; }
.me-result-t .aside-face { width: 34px; flex: none; }
html[lang="th"] .me-result-t { font-style: normal; }
.me-econ .kicker { display: flex; margin-bottom: 6px; }
.econ-lines { list-style: none; margin: 0 0 8px; padding: 0; }
.econ-lines li { display: flex; align-items: center; gap: 8px; padding: 3px 0; border-bottom: 1px dotted rgba(138, 106, 30, .3); }
.econ-l { flex: 1; min-width: 0; color: var(--ivory-dim); font-size: .92rem; }
.me-note { display: flex; gap: 12px; align-items: center; }
.me-note p { margin: 0; color: var(--ivory); }
.note-ic { width: 26px; height: 26px; color: var(--gold-1); flex: none; }
.me-trait { color: var(--gold-3); }
.me-trait .note-ic { color: var(--gold-2); }
.me-warning { box-shadow: inset 0 0 0 1px rgba(210, 85, 63, .6); background: linear-gradient(90deg, rgba(107, 26, 20, .35), rgba(21, 16, 12, .85)); }
.me-warn .note-ic { color: var(--down); }
.me-live { margin-top: 12px; padding: 18px 20px; }
.me-live .dlg-head { gap: 16px; }
.me-live .arch { width: 96px; margin-top: 0; }
.me-live .arch-none { width: 72px; margin-top: 0; }
.me-live .plate { padding-top: 0; }
/* the samut khoi page: Rueang writes the month down, ink on palm-paper */
.samut {
  position: relative; margin: 18px 0 6px; padding: 16px 26px 20px; color: #2A1D12;
  background: linear-gradient(180deg, #E4D6B2, #D6C49B 60%, #CDB98D); box-shadow: 0 10px 24px rgba(0, 0, 0, .5), inset 0 0 0 1px rgba(90, 60, 25, .35), inset 0 0 36px rgba(120, 86, 40, .25);
}
.samut::before, .samut::after { content: ""; position: absolute; top: 0; bottom: 0; width: 8px; background: repeating-linear-gradient(180deg, rgba(90, 60, 25, .25) 0 2px, transparent 2px 9px); }
.samut::before { left: 8px; } .samut::after { right: 8px; }
.samut-head { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.samut-head .kicker { color: #6B4A1E; }
.samut-head .mini-ic { color: #6B4A1E; }
.samut-text { margin: 0; font-family: var(--f-head); font-size: 1.22rem; line-height: 1.55; color: #24180E; }
html[lang="th"] .samut-text { font-size: 1.1rem; line-height: 1.8; }
.me-unlocks { margin-top: 18px; display: flex; flex-direction: column; gap: 10px; }
.unlock { padding: 12px 14px 12px 16px; }
.unlock-top { display: flex; align-items: center; gap: 10px; position: relative; z-index: 2; }
.unlock-t { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; }
.unlock-t b { font-family: var(--f-head); color: var(--gold-2); font-size: 1.08rem; }
.roman { font-style: italic; color: var(--ivory-dim); font-size: .86rem; }
html[lang="th"] .roman { display: none; }   /* romanisation helps English readers only */
.unlock-text { display: none; margin: 10px 0 0; color: var(--ivory); position: relative; z-index: 2; }
.unlock.open .unlock-text { display: block; animation: rise .35s var(--ease) both; }
.me-go { justify-content: center; }
/* ================================================================ the character sheet */
.sheet { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 28px; }
.sheet-l { display: flex; flex-direction: column; gap: 12px; }
.sheet-portrait { width: 200px; margin: 0 auto; filter: drop-shadow(0 10px 18px rgba(0, 0, 0, .6)); }
.sheet-portrait .ayu-portrait { width: 100%; height: auto; display: block; }
.sheet-names { text-align: center; }
.sheet-name { font-size: 1.5rem; }
.other-name { color: var(--gold-1); font-size: .95rem; }
.sheet-title { color: var(--ivory); font-size: .92rem; margin-top: 2px; }
.sheet-age { color: var(--ivory-dim); font-size: .82rem; }
.sheet-traits { display: flex; flex-wrap: wrap; justify-content: center; }
.sheet-traits .trait-chip { margin: 0 4px 6px; }
.regard { padding: 12px 14px; background: rgba(11, 9, 7, .55); box-shadow: inset 0 0 0 1px rgba(138, 106, 30, .4); }
.regard-big { display: flex; align-items: center; gap: 8px; margin: 4px 0 8px; color: var(--band, var(--ivory)); }
.regard-big b { font-family: var(--f-en-head); font-size: 2rem; line-height: 1; font-variant-numeric: tabular-nums; }
.regard-big span { font-family: var(--f-head); font-size: 1.05rem; }
.regard-ic { width: 28px; height: 28px; }
.meter { position: relative; display: flex; height: 8px; gap: 2px; }
.meter .seg { flex: 1; display: block; opacity: .75; }
.s-hostile { background: var(--band-hostile); } .s-cold { background: var(--band-cold); } .s-neutral { background: #6E6553; } .s-friendly { background: var(--band-friendly); } .s-devoted { background: var(--band-devoted); }
.meter-pin { position: absolute; top: -5px; width: 4px; height: 18px; margin-left: -2px; background: var(--ivory); box-shadow: 0 0 0 1px #000, 0 0 8px rgba(255, 255, 255, .5); }
.sheet-r { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.bio { color: var(--ivory); font-style: italic; margin: 0; }
html[lang="th"] .bio { font-style: normal; }
.why-list { list-style: none; margin: 6px 0 0; padding: 0; }
.why-row { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 4px 10px; align-items: baseline; padding: 6px 0; border-bottom: 1px dotted rgba(138, 106, 30, .35); }
.why-v { text-align: right; font-weight: 600; color: var(--ivory-dim); }
.why-r { color: var(--ivory); }
.kind-mod .why-r { font-style: italic; }
html[lang="th"] .kind-mod .why-r { font-style: normal; }
.kind-base .why-r, .kind-trait .why-r { color: var(--ivory-dim); }
.why-f { display: inline-flex; align-items: center; gap: 4px; font-size: .78rem; color: var(--gold-1); white-space: nowrap; }
.why-f .mini-ic { width: 14px; height: 14px; }
.wf { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.wf-box { padding: 10px 12px; background: rgba(31, 23, 18, .6); box-shadow: inset 0 0 0 1px rgba(138, 106, 30, .3); }
.wf-box p { margin: 4px 0 0; color: var(--ivory); font-size: .94rem; }
.wf-box.locked p { display: flex; align-items: center; gap: 6px; color: var(--ivory-dim); }
.known ul, .recent ul { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.secret-row { display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 2px 8px; padding: 8px 10px; background: rgba(94, 140, 106, .08); box-shadow: inset 0 0 0 1px rgba(94, 140, 106, .4); }
.secret-row .mini-ic { color: #8FC29C; margin-top: 3px; }
.secret-row b { color: #BFE0C6; font-family: var(--f-head); }
.secret-row p { grid-column: 2; margin: 0; color: var(--ivory); font-size: .92rem; }
.secret-row .mini-ic + p { grid-column: 2; }
.recent li { display: flex; flex-wrap: wrap; gap: 2px 10px; align-items: baseline; font-size: .92rem; }
.rec-m { color: var(--gold-1); font-size: .8rem; min-width: 70px; }
.recent q { color: var(--ivory-dim); }
/* ================================================================ the court */
.court-group + .court-group { margin-top: 18px; }
.court-grid { list-style: none; margin: 8px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 12px; }
.court-btn {
  width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 10px 6px 10px; cursor: pointer; text-align: center;
  border: 1px solid rgba(138, 106, 30, .35); background: linear-gradient(180deg, rgba(36, 26, 19, .8), rgba(18, 13, 10, .9)); transition: border-color .2s, transform .25s var(--ease);
}
.court-btn:hover { border-color: var(--gold-1); transform: translateY(-2px); }
.court-face { width: 84px; display: block; line-height: 0; }
.court-face .ayu-portrait { width: 100%; height: auto; }
.court-name { font-family: var(--f-head); font-weight: 600; color: var(--ivory); font-size: 1rem; line-height: 1.25; margin-top: 4px; }
.court-role { font-size: .74rem; color: var(--ivory-dim); line-height: 1.3; min-height: 2.6em; }
.court-btn .badge { margin-top: auto; }
.tab-factions .factions { background: none; box-shadow: none; padding: 0; }
.tab-factions .fbar { grid-template-columns: 22px minmax(0, 1fr) minmax(120px, 2fr) 34px; padding: 7px 0; }
.tab-factions .fbar-b { display: block; }
.tab-factions .fbar-l { font-size: 1rem; }
.secret-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.secret-card { display: flex; gap: 14px; padding: 14px 16px; }
.secret-card > div { position: relative; z-index: 2; min-width: 0; }
.secret-face { flex: none; width: 52px; }
.secret-card h4 { display: flex; align-items: center; gap: 6px; font-size: 1.1rem; color: #BFE0C6; }
.secret-card h4 .mini-ic { color: #8FC29C; }
.secret-about { font-size: .82rem; color: var(--ivory-dim); }
.secret-card p { margin: 6px 0 0; color: var(--ivory); }
.king-traits { list-style: none; margin: 8px 0 18px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.king-traits p { margin: 2px 0 0 4px; color: var(--ivory-dim); font-size: .9rem; }
.counters { list-style: none; margin: 8px 0 8px; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px 18px; }
.counter { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: rgba(31, 23, 18, .55); box-shadow: inset 0 0 0 1px rgba(138, 106, 30, .3); }
.counter-l { flex: 1; min-width: 0; color: var(--ivory); }
.counter b { color: var(--gold-2); font-variant-numeric: tabular-nums; }
.pips { display: inline-flex; gap: 4px; }
.pips i, .road-pips i { display: block; width: 10px; height: 10px; transform: rotate(45deg); border: 1px solid var(--gold-0); background: transparent; }
.pips i.on { background: var(--gold-1); border-color: var(--gold-2); }
.counter.full { box-shadow: inset 0 0 0 1px var(--gold-1); }
/* ---- the roads of the year (owner ruling: from month 6) ---- */
.roads-note { display: flex; gap: 14px; align-items: center; margin-bottom: 16px; padding: 12px 14px; background: linear-gradient(90deg, rgba(217, 201, 163, .12), transparent); border-left: 2px solid var(--palm); }
.roads-face { flex: none; width: 54px; }
.roads-note p { margin: 0; color: var(--palm); font-family: var(--f-head); font-size: 1.04rem; font-style: italic; }
html[lang="th"] .roads-note p { font-style: normal; }
.road-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.road { display: flex; flex-direction: column; gap: 8px; padding: 16px 16px 14px; }
.road > * { position: relative; z-index: 2; }
.road-head { display: flex; align-items: center; gap: 10px; }
.road-head h4 { flex: 1; min-width: 0; font-size: 1.15rem; }
.road-seal { flex: none; width: 34px; height: 34px; display: grid; place-items: center; color: var(--ivory-dim); }
.road-seal .ayu-icon { width: 22px; height: 22px; }
.road-seal-svg { width: 34px; height: 34px; }
.road-state { font-size: .76rem; color: var(--ivory-dim); white-space: nowrap; }
.road.open { box-shadow: inset 0 0 0 1px var(--gold-2), inset 0 0 0 4px #120D0A, inset 0 0 0 5px var(--gold-2), 0 0 30px rgba(201, 161, 59, .2); }
.road.open .road-state { color: var(--gold-3); }
.road-meta { display: flex; align-items: center; gap: 10px; }
.road-pips { display: inline-flex; gap: 5px; }
.road-pips i.ok { background: var(--gold-2); border-color: var(--gold-3); }
.road-pips i.no { border-color: rgba(210, 85, 63, .7); }
.road-met { font-size: .84rem; color: var(--ivory-dim); }
.gate-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.gate { display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 0 8px; font-size: .9rem; line-height: 1.4; }
html[lang="th"] .gate { line-height: 1.6; }
.gate-ic { width: 16px; height: 16px; margin-top: 3px; }
.gate.ok .gate-ic { color: var(--gold-2); } .gate.no .gate-ic { color: var(--down); }
.gate.ok .gate-t { color: var(--ivory); } .gate.no .gate-t { color: #CDBFA0; }
.gate-now { grid-column: 2; font-size: .78rem; color: var(--ivory-dim); }
.gate-now b { color: var(--gold-2); font-weight: 600; }
/* ================================================================ chronicle: a samut khoi folding book */
.chron-sub { display: flex; align-items: center; gap: 8px; color: var(--ivory-dim); margin: 0 0 14px; }
.samut-book { display: flex; flex-direction: column; box-shadow: 0 14px 30px rgba(0, 0, 0, .55); }
.samut-page {
  position: relative; padding: 18px 30px 18px 66px; color: #2A1D12;
  background: linear-gradient(180deg, #E6D8B5, #D8C79F); border-bottom: 1px solid rgba(90, 60, 25, .35);
  box-shadow: inset 0 0 40px rgba(120, 86, 40, .2);
}
.samut-page:nth-child(even) { background: linear-gradient(180deg, #DECFA9, #D2C095); }
.samut-page::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 6px; background: linear-gradient(180deg, transparent, rgba(90, 60, 25, .18)); pointer-events: none; }
.samut-month { display: flex; align-items: baseline; gap: 10px; font-size: 1.2rem; color: #5A2D12; }
.samut-n {
  position: absolute; left: 18px; top: 18px; width: 32px; height: 32px; display: grid; place-items: center; font-family: var(--f-en-head); font-size: 1rem;
  color: #F4E2A8; background: radial-gradient(circle at 40% 35%, #8E2A1E, #5A150F); border-radius: 50%; box-shadow: 0 0 0 2px rgba(90, 60, 25, .25);
}
.samut-sum { margin: 4px 0 6px; font-family: var(--f-head); font-size: 1.08rem; color: #24180E; line-height: 1.5; }
html[lang="th"] .samut-sum { line-height: 1.8; font-size: 1rem; }
.samut-lines { margin: 0; padding: 0 0 0 18px; color: #3A2A1A; font-size: .94rem; }
.samut-lines li { margin: 2px 0; }
.samut-lines li::marker { color: #8E2A1E; }
/* ================================================================ codex */
.terms { margin: 0; display: flex; flex-direction: column; gap: 2px; }
.term { padding: 10px 12px; border-bottom: 1px dotted rgba(138, 106, 30, .35); }
.term dt { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; }
.term-t { font-family: var(--f-head); font-size: 1.15rem; color: var(--gold-2); font-weight: 600; }
.term dd { margin: 4px 0 0; color: var(--ivory); }
.term.focus, .note-card.focus { background: rgba(201, 161, 59, .1); box-shadow: inset 2px 0 0 var(--gold-2); animation: focus-glow 1.6s var(--ease) 1; }
@keyframes focus-glow { 0% { background: rgba(230, 199, 106, .3); } 100% { background: rgba(201, 161, 59, .1); } }
.notes { display: flex; flex-direction: column; gap: 12px; }
.note-card { padding: 14px 16px; background: rgba(59, 13, 11, .25); box-shadow: inset 0 0 0 1px rgba(138, 106, 30, .4); }
.note-card h4 { display: flex; align-items: center; gap: 8px; font-size: 1.12rem; margin-bottom: 6px; }
.note-card p { margin: 0; color: var(--ivory); }
.locked-n { display: flex; align-items: center; gap: 6px; margin-top: 14px; }
/* ================================================================ settings + phone menu */
.set-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 18px; align-items: center; padding: 14px 0; border-bottom: 1px dotted rgba(138, 106, 30, .35); }
.set-l { font-family: var(--f-head); font-size: 1.08rem; color: var(--ivory); }
.set-l p { font-family: var(--f-body); margin: 2px 0 0; }
.seg-ctl { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--gold-0); border-radius: 2px; overflow: hidden; }
.seg-btn { min-height: 44px; min-width: 64px; padding: 6px 12px; border: 0; border-left: 1px solid rgba(138, 106, 30, .45); background: rgba(11, 9, 7, .6); color: var(--ivory-dim); cursor: pointer; }
.seg-btn:first-child { border-left: 0; }
.seg-btn:hover { color: var(--gold-2); }
.seg-btn.on { background: linear-gradient(180deg, #7C2219, #561410); color: var(--gold-3); font-weight: 600; }
.set-row { grid-template-columns: minmax(150px, 1fr) auto; }
.set-save { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; max-width: 300px; text-align: right; }
.set-save p { display: flex; align-items: center; gap: 6px; margin: 0; }
.keys-help { margin-top: 16px; }
.keys-help p { color: var(--ivory-dim); margin-top: 4px; }
.menu-list { display: flex; flex-direction: column; gap: 6px; }
.menu-btn {
  display: flex; align-items: center; gap: 14px; width: 100%; min-height: 52px; padding: 8px 14px; cursor: pointer; text-align: left;
  border: 1px solid rgba(138, 106, 30, .45); background: linear-gradient(90deg, rgba(36, 26, 19, .9), rgba(18, 13, 10, .9)); color: var(--gold-2); font-family: var(--f-head); font-size: 1.08rem; font-weight: 600;
}
.menu-btn .ayu-icon { width: 24px; height: 24px; }
.menu-lang { margin-top: 16px; display: flex; justify-content: center; }
/* ================================================================ title: the cabinet doors open */
.title-screen { position: relative; min-height: 100vh; min-height: 100dvh; display: grid; justify-items: center; align-items: start; padding: max(64px, 10vh) 20px 40px; overflow: hidden; perspective: 1600px; }
.title-screen::before { content: ""; position: absolute; inset: 0; z-index: 1; background: radial-gradient(40% 36% at 50% 42%, rgba(201, 161, 59, .10), transparent 70%); pointer-events: none; }
/* the river at night, full strength from the first frame (no fade-in): sky above, spires + lanterns below the card */
.title-scene { position: fixed; inset: 0; z-index: 0; pointer-events: none; background: linear-gradient(180deg, #07060A 0%, #0D0B10 45%, #120E0B 100%); }
.title-scene > svg { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 74vh; display: block; }
.title-scene::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, #07060A 0%, rgba(7, 6, 10, 0) 34%), radial-gradient(46% 42% at 50% 44%, rgba(11, 9, 7, .38), transparent 100%); }
.doors { position: fixed; inset: 0; z-index: 5; pointer-events: none; display: grid; grid-template-columns: 1fr 1fr; }
.door {
  position: relative; height: 100%; background: linear-gradient(180deg, #1A120D, #0E0A07); box-shadow: inset 0 0 0 1px var(--gold-0), inset 0 0 0 8px #0E0A07, inset 0 0 0 9px rgba(201, 161, 59, .5);
  display: flex; flex-direction: column; align-items: center; justify-content: space-between; padding: 30px 0; transition: transform 1.5s cubic-bezier(.55, .05, .25, 1), opacity 1.5s;
}
.door-l { transform-origin: left center; } .door-r { transform-origin: right center; }
.door-band { width: 70%; opacity: .7; line-height: 0; } .door-band svg { width: 100%; height: auto; }
.door-medal { width: min(180px, 40%); opacity: .9; } .door-emblem { width: 100%; height: auto; }
.door-ring { position: absolute; top: 50%; width: 40px; height: 40px; margin-top: -20px; }
.door-l .door-ring { right: 14px; } .door-r .door-ring { left: 14px; }
.door-knob { width: 40px; height: 40px; }
.doors.open .door-l { transform: rotateY(-100deg); opacity: 0; }
.doors.open .door-r { transform: rotateY(100deg); opacity: 0; }
.doors.open { visibility: hidden; transition: visibility 0s linear 1.5s; }
.title-panel { position: relative; z-index: 2; width: min(620px, 100%); padding: 40px 44px 30px; text-align: center; transition: opacity 1.2s var(--ease) .5s, transform 1.2s var(--ease) .5s; }
.title-panel.rising { opacity: 0; transform: translateY(18px) scale(.98); }
.title-panel > * { position: relative; z-index: 2; }
.title-emblem { width: 92px; margin: -78px auto 10px; filter: drop-shadow(0 6px 14px rgba(0, 0, 0, .7)); }
.title-emblem svg { width: 100%; height: auto; display: block; }
.game-title { display: flex; flex-direction: column; gap: 6px; }
.gt-main { font-size: 2.7rem; line-height: 1.15; color: var(--gold-2); text-shadow: 0 2px 0 #000, 0 0 30px rgba(201, 161, 59, .25); }
html[lang="th"] .gt-main { font-size: 2.35rem; line-height: 1.45; }
.gt-sub { font-size: 1.15rem; color: var(--gold-1); font-weight: 500; }
.gt-sub[lang="th"] { font-family: var(--f-th-head); line-height: 1.6; }
.gt-sub[lang="en"] { font-family: var(--f-en-head); letter-spacing: .06em; }
.title-div { margin: 14px auto 10px; width: min(360px, 90%); line-height: 0; } .title-div svg { width: 100%; height: auto; }
.chapter { color: var(--ivory); font-family: var(--f-head); font-size: 1.1rem; margin: 0 0 4px; }
.chapter .ch-o { color: var(--ivory-dim); }
.chapter > span:not(.dot) { display: inline-block; }   /* each title wraps whole, never mid-word */
.title-panel { background: linear-gradient(180deg, rgba(27, 20, 16, .86), rgba(18, 13, 10, .9)); backdrop-filter: blur(1.5px); }
.tagline { color: var(--ivory-dim); font-size: .95rem; max-width: 44ch; margin: 0 auto 22px; }
.title-btns { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.btn-title { flex-direction: column; gap: 0; width: min(340px, 100%); min-height: 56px; font-size: 1.2rem; }
.bt-sub { font-family: var(--f-body); font-size: .8rem; font-weight: 400; color: var(--gold-1); letter-spacing: 0; }
.btn-primary .bt-sub { color: #E9CF8E; }
.title-row { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px; margin-top: 6px; }
.save-note { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 18px 0 0; font-size: .8rem; color: var(--ivory-dim); }
/* ================================================================ accession: how the king came to the throne */
.acc-screen { position: relative; max-width: 1280px; margin: 0 auto; padding: 26px 24px 40px; }
.acc-top, .end-top { position: absolute; top: 14px; right: 18px; display: flex; align-items: center; gap: 4px; z-index: 3; }
.acc-head { text-align: center; margin: 6px auto 26px; max-width: 760px; }
.acc-div { width: min(320px, 80%); margin: 0 auto 10px; line-height: 0; } .acc-div svg { width: 100%; height: auto; }
.acc-head h1 { font-size: 2.2rem; }
html[lang="th"] .acc-head h1 { font-size: 1.9rem; }
.acc-head p { color: var(--ivory-dim); margin: 6px 0 0; }
.acc-track { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; align-items: stretch; }
.acc-card { display: flex; flex-direction: column; gap: 12px; padding: 22px 22px 20px; min-width: 0; }
.acc-card > * { position: relative; z-index: 2; }
.acc-portrait { width: 150px; margin: 0 auto -2px; filter: drop-shadow(0 10px 16px rgba(0, 0, 0, .6)); }
.acc-portrait .ayu-portrait { width: 100%; height: auto; display: block; }
.acc-title { text-align: center; font-size: 1.5rem; }
html[lang="th"] .acc-title { font-size: 1.3rem; }
.acc-trait { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 4px 8px; }
.acc-trait .trait-chip { margin: 0; }
.acc-story { color: var(--ivory); font-size: .96rem; margin: 0; flex: 1; }
.acc-stats .kicker, .acc-mods .kicker { display: flex; margin-bottom: 6px; }
.acc-res, .acc-stand { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.acc-res { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 6px; }
.acc-stand { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.acc-n { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 6px 2px 5px; background: rgba(11, 9, 7, .5); box-shadow: inset 0 0 0 1px rgba(138, 106, 30, .3); text-align: center; min-width: 0; }
.acc-n.best { box-shadow: inset 0 0 0 1px var(--gold-1); } .acc-n.best .acc-v { color: var(--gold-3); }
.acc-n.least .acc-v { color: var(--down); }
.acc-ic { width: 20px; height: 20px; color: var(--gold-1); }
.acc-v { font-family: var(--f-en-body); font-weight: 600; font-size: 1rem; color: var(--ivory); line-height: 1.2; }
.acc-k { font-size: .68rem; color: var(--ivory-dim); line-height: 1.25; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-mods ul { list-style: none; margin: 0; padding: 0; font-size: .88rem; color: var(--ivory); }
.acc-mods li { padding: 2px 0; }
.acc-go { display: flex; justify-content: center; margin-top: 4px; }
.acc-go .btn-go { width: 100%; }
.acc-nav { display: none; }
.acc-screen.enter .acc-card { animation: rise .7s var(--ease) both; }
.acc-screen.enter .acc-card:nth-child(2) { animation-delay: .12s; } .acc-screen.enter .acc-card:nth-child(3) { animation-delay: .24s; }
/* ================================================================ the ending */
.ending-screen { position: relative; padding: 0 0 60px; overflow-x: clip; }
.ending-screen > .end-sec, .ending-screen > .end-go { width: min(932px, calc(100% - 48px)); margin-left: auto; margin-right: auto; }
.end-scene { position: relative; height: clamp(220px, 42vh, 380px); overflow: hidden; }
.end-scene > svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.end-scene .scene-shade { background: linear-gradient(180deg, rgba(11, 9, 7, 0) 40%, var(--lacquer-0) 100%); }
.is-failure .end-scene { filter: saturate(.55) brightness(.8); }
.end-hero { margin: -110px auto 0; width: min(800px, calc(100% - 48px)); padding: 34px 44px 30px; text-align: center; }
.end-hero > * { position: relative; z-index: 2; }
.end-hero .kicker { justify-content: center; }
.end-title { font-size: 2.6rem; margin: 6px 0 4px; text-shadow: 0 2px 0 #000; }
html[lang="th"] .end-title { font-size: 2.1rem; }
.is-failure .end-title { color: #E9B7A6; }
.end-div { width: min(320px, 80%); margin: 6px auto 16px; line-height: 0; } .end-div svg { width: 100%; height: auto; }
.end-text { text-align: left; max-width: 64ch; margin: 0 auto; }
.end-text p { color: var(--ivory); }
.end-text .lead { font-size: 1.14em; color: var(--ivory); }
.end-text .lead::first-letter { font-family: var(--f-en-head); font-size: 2.6em; float: left; line-height: .9; margin: 4px 8px 0 0; color: var(--gold-2); }
html[lang="th"] .end-text .lead::first-letter { font-size: inherit; float: none; margin: 0; line-height: inherit; color: inherit; font-family: inherit; }
.end-hook { margin: 18px auto 0; max-width: 56ch; padding: 12px 18px; border-left: 2px solid var(--gold-1); background: rgba(107, 26, 20, .3); color: var(--gold-3); font-family: var(--f-head); font-size: 1.1rem; text-align: left; }
.end-sec { margin-top: 36px; }
.end-sec > .kicker, .sec-head .kicker { display: flex; margin-bottom: 12px; font-size: .86rem; }
html[lang="th"] .end-sec > .kicker, html[lang="th"] .sec-head .kicker { font-size: 1rem; }
.sec-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.sec-head .kicker { margin-bottom: 0; }
.track-nav { display: flex; gap: 4px; }
.epi-track { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(280px, 31%); gap: 16px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 12px 2px 14px; overscroll-behavior-x: contain; }
.epi { scroll-snap-align: start; display: flex; flex-direction: column; gap: 10px; padding: 18px 18px 16px; position: relative; background: var(--panel); box-shadow: inset 0 0 0 1px rgba(138, 106, 30, .5), var(--shadow); }
.epi > * { position: relative; z-index: 2; }
.epi-face { width: 96px; margin: 0 auto; }
.epi-b { text-align: center; }
.epi-name { font-size: 1.2rem; }
.epi-role { font-size: .8rem; color: var(--ivory-dim); margin-bottom: 6px; }
.epi-text { margin: 0; text-align: left; color: var(--ivory); font-size: .95rem; }
.people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.epi-sm { flex-direction: row; align-items: flex-start; padding: 12px 14px; box-shadow: inset 0 0 0 1px rgba(138, 106, 30, .35); }
.epi-sm .epi-face { width: 56px; margin: 0; flex: none; }
.epi-sm .epi-b { text-align: left; }
.epi-sm .epi-name { font-size: 1.02rem; }
.end-chron .samut-book { max-height: none; }
.end-real { padding: 22px 26px; }
.end-real > * { position: relative; z-index: 2; }
.end-real h3 { font-size: 1.3rem; margin-bottom: 6px; }
.end-real p { color: var(--ivory); margin: 0; }
.stats { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.stat { display: grid; grid-template-columns: 18px 1fr; grid-template-areas: "ic v" "l l"; gap: 0 8px; align-items: center; padding: 10px 12px; background: rgba(21, 16, 12, .85); box-shadow: inset 0 0 0 1px rgba(138, 106, 30, .35); }
.stat .mini-ic { grid-area: ic; }
.stat b { grid-area: v; font-family: var(--f-en-body); font-size: 1.25rem; color: var(--ivory); font-variant-numeric: tabular-nums; }
.stat span { grid-area: l; font-size: .78rem; color: var(--ivory-dim); }
.stat.down b, .stat.band-hostile b { color: var(--down); }
.end-names { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 14px; }
.end-names .kicker { margin-right: 6px; }
.end-go { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 14px; margin-top: 40px; }
.end-go .btn-go { min-width: 260px; }
.ending-screen.enter .end-hero { animation: rise 1s var(--ease) .3s both; }
/* ================================================================ in-between widths */
@media (max-width: 1440px) { .nav-btn .nav-l { display: none; } .nav-btn { padding: 0 10px; } }
@media (max-width: 1100px) {
  .stage { grid-template-columns: minmax(0, 58fr) minmax(0, 42fr); gap: 16px; padding: 14px 14px 0; }
  .res-u { display: none; }
  .tb-title { display: none; }
  .ph .ph-l { display: none !important; }
  .dialogue { margin: -40px 12px 0; padding: 0 22px 22px; }
  .arch { width: 120px; margin-top: -86px; }
  .acc-track { grid-template-columns: minmax(0, 1fr); max-width: 640px; margin: 0 auto; }
  .acc-card { display: grid; grid-template-columns: 150px minmax(0, 1fr); column-gap: 20px; align-items: start; }
  .acc-card > * { grid-column: 2; }
  .acc-card > .acc-portrait { grid-column: 1; grid-row: 1 / span 4; margin: 0; }
  .acc-card > .corners { grid-column: auto; grid-row: auto; }
  .acc-title, .acc-trait { text-align: left; justify-content: flex-start; }
}
@media (max-width: 900px) and (min-width: 720px) {
  .res { padding: 2px 8px 2px 6px; }
  .res-long { display: none; } .res-short { display: inline; }
  .tb-long { display: none; } .tb-short { display: inline; }
  .queue-list { grid-template-columns: minmax(0, 1fr); }
}
/* ================================================================ phone (< 720 px, designed at 375) */
@media (max-width: 719px) {
  body { font-size: 16px; }
  .kbd { display: none; }
  .shell { display: block; height: auto; min-height: 100dvh; }
  .topbar {
    position: sticky; top: 0; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "m n" "r r"; gap: 0 6px;
    padding: 4px 4px 6px 12px;
  }
  .tb-month { grid-area: m; grid-template-areas: "l p"; column-gap: 8px; min-height: 44px; }
  .tb-nav { grid-area: n; }
  .tb-res { grid-area: r; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; padding-right: 8px; }
  .tb-long, .tb-title { display: none; } .tb-short { display: inline; font-size: .95rem; }
  .ph .ayu-bullet { width: 12px; height: 12px; }
  .res { min-height: 32px; padding: 1px 6px 1px 4px; gap: 4px; justify-content: center; min-width: 0; }
  .res-ic { width: 18px; height: 18px; flex: none; }
  .res-v { font-size: .92rem; }
  .res-long, .res-u { display: none; } .res-short { display: inline; }
  .nav-btn, .nav-set { display: none; }
  .nav-menu { display: inline-grid; }
  .lang-btn { min-height: 36px; padding: 0 9px; margin: 0 2px; font-size: .84rem; }
  .stage { display: block; padding: 0; overflow: visible; }
  .stage-main { overflow: visible; padding: 0 0 18px; }
  .scene-panel { height: 150px; box-shadow: inset 0 -1px 0 var(--gold-0); }
  .is-climax .scene-panel { height: 96px; }
  .ctx-inline .scene-panel { height: 150px; }
  .scene-panel .corners { display: none; }
  .dialogue { margin: -26px 8px 0; padding: 0 16px 20px; }
  .dlg-head { gap: 12px; margin-bottom: 10px; }
  .arch { width: 76px; margin-top: -54px; }
  .arch-none { width: 58px; margin-top: -24px; padding: 6px 4px 4px; }
  .plate { padding-top: 12px; }
  .ev-title { font-size: 1.35rem; } html[lang="th"] .ev-title { font-size: 1.22rem; }
  .speaker-line { gap: 2px 8px; } .sp-name { font-size: .98rem; } .sp-title { font-size: .8rem; }
  .choice { padding: 10px 12px 10px 8px; gap: 10px; min-height: 52px; }
  .choice-n { width: 28px; height: 28px; margin: 0; }
  .choice-l { font-size: 1rem; }
  .choices.climax .lock-lines { columns: 1; }
  .choices.climax .lock-lines li:nth-child(n+2) { display: none; }
  .choices.climax .choice.expanded .lock-lines li { display: block; }   /* must out-rank the nth-child hide above */
  .more-btn { display: inline-flex; align-items: center; }
  .go-row { justify-content: stretch; } .go-row .btn-go { flex: 1; }
  .react-list { grid-template-columns: minmax(0, 1fr); }
  .react-face { width: 50px; }
  .context { overflow: visible; padding: 0 12px 24px; gap: 12px; }
  .context-foot { display: none; }
  .realm { padding: 14px 14px 12px; }
  .queue-list { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .pet { padding: 12px 12px 10px; }
  .eve { flex-direction: column; align-items: stretch; gap: 10px; padding: 14px; }
  .eve-people { justify-content: center; }
  .eve-know { display: none; }
  /* while a petitioner is heard, the queue waits in a bottom sheet */
  .ctx-sheet .context {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; max-height: 78dvh; overflow-y: auto; padding: 0 12px 20px;
    background: linear-gradient(180deg, #1B1410, #0F0B08); box-shadow: 0 -1px 0 var(--gold-0), 0 -14px 30px rgba(0, 0, 0, .6);
    transform: translateY(calc(100% - 56px)); transition: transform .35s var(--ease);
  }
  .ctx-sheet.sheet-open .context { transform: none; }
  .ctx-sheet .sheet-handle {
    display: flex; align-items: center; justify-content: center; gap: 10px; position: sticky; top: 0; z-index: 2; width: calc(100% + 24px); min-height: 56px; margin: 0 -12px;
    border: 0; border-bottom: 1px solid rgba(138, 106, 30, .4); background: #17110C; color: var(--gold-2); font-family: var(--f-head); font-weight: 600; cursor: pointer;
  }
  .ctx-sheet .sheet-handle .ayu-icon { width: 20px; height: 20px; }
  .sheet-open .sheet-handle .tog-ic { transform: rotate(180deg); }
  .ctx-sheet .stage-main { padding-bottom: 72px; }
  .ctx-sheet .queue-head { display: none; }
  /* panels: full screen on a phone */
  .modal-wrap { padding: 0; place-items: stretch; }
  .modal, .w420 .modal, .w560 .modal, .w760 .modal, .w800 .modal, .w900 .modal { width: 100%; max-height: none; height: 100dvh; }
  .w420.confirm .modal { height: auto; align-self: end; }
  .modal-head { padding: 8px 6px 6px 18px; min-height: 56px; }
  .modal-title { font-size: 1.25rem; } html[lang="th"] .modal-title { font-size: 1.15rem; }
  .modal-body { padding: 14px 16px 28px; flex: 1; }
  .tabs { flex-wrap: nowrap; overflow-x: auto; margin: -4px -16px 14px; padding: 0 10px; scrollbar-width: none; }
  .tab { flex: none; padding: 8px 10px; font-size: .94rem; }
  .sheet { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .sheet-portrait { width: 150px; }
  .wf { grid-template-columns: minmax(0, 1fr); }
  .why-row { grid-template-columns: 44px minmax(0, 1fr); }
  .why-f { grid-column: 2; }
  .court-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .court-face { width: 72px; }
  .road-list { grid-template-columns: minmax(0, 1fr); }
  .samut-page { padding: 14px 16px 14px 54px; }
  .samut-n { left: 12px; top: 14px; width: 30px; height: 30px; }
  .set-row { grid-template-columns: minmax(0, 1fr); }
  .set-save { align-items: flex-start; }
  .seg-btn { min-width: 0; flex: 1; padding: 6px 10px; }
  .seg-ctl { display: flex; width: 100%; }
  .mode-centre .scene-panel { height: 110px; }
  .me-head { padding-top: 14px; }
  .me-card { padding: 12px 14px; }
  .me-face { width: 50px; }
  .samut { padding: 14px 22px 16px; }
  .samut-text { font-size: 1.1rem; }
  /* title */
  .title-screen { padding: 64px 12px 28px; align-items: start; }
  .title-panel { padding: 34px 18px 22px; }
  .title-emblem { width: 76px; margin-top: -70px; }
  .gt-main { font-size: 2rem; } html[lang="th"] .gt-main { font-size: 1.75rem; }
  .gt-sub { font-size: 1rem; }
  .door-medal { width: 50%; }
  .title-scene > svg { height: 58vh; }
  .title-row .btn { padding: 8px 12px; }
  /* accession: one card at a time on a swipe track */
  .acc-screen { padding: 56px 0 26px; }
  .acc-top, .end-top { top: 8px; right: 8px; }
  .acc-head { margin: 0 16px 14px; }
  .acc-head h1 { font-size: 1.6rem; } html[lang="th"] .acc-head h1 { font-size: 1.45rem; }
  .acc-track { display: grid; grid-auto-flow: column; grid-auto-columns: 100%; grid-template-columns: none; max-width: none; gap: 0; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior-x: contain; }
  .acc-track::-webkit-scrollbar { display: none; }
  .acc-track { align-items: start; scroll-padding-inline: 14px; }
  .acc-card { display: flex; align-items: stretch; scroll-snap-align: start; margin: 0 14px; padding: 18px 16px 16px; }
  .acc-card > * { grid-column: auto; }
  .acc-story { flex: none; }
  .acc-title, .acc-trait { text-align: center; justify-content: center; }
  .acc-card > .acc-portrait { width: 116px; margin: 0 auto; }
  .acc-nav { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 12px; }
  .acc-dots { display: inline-flex; gap: 8px; }
  .acc-dots i { width: 9px; height: 9px; transform: rotate(45deg); border: 1px solid var(--gold-1); }
  .acc-dots i.on { background: var(--gold-2); }
  /* ending */
  .ending-screen { padding: 0 0 40px; }
  .ending-screen > .end-sec, .ending-screen > .end-go { width: calc(100% - 24px); }
  .end-scene { height: 200px; }
  .end-hero { margin-top: -60px; width: calc(100% - 24px); padding: 26px 18px 22px; }
  .end-title { font-size: 1.8rem; } html[lang="th"] .end-title { font-size: 1.55rem; }
  .epi-track { grid-auto-columns: 86%; }
  .people-grid { grid-template-columns: minmax(0, 1fr); }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .end-go { flex-direction: column; align-items: stretch; }
  .end-go .btn-go { min-width: 0; }
}
@media (max-width: 380px) {
  .lang-btn { padding: 0 7px; }
  .res-v { font-size: .86rem; }
  .ph .ayu-bullet { width: 10px; height: 10px; }
}
