/* Layout: full-screen canvas with parchment panels floating over it. */
/* fonts: stored locally (assets/fonts, SIL OFL), latin subset; each face loads only when used */
@font-face { font-family: "Cinzel"; font-style: normal; font-weight: 600; font-display: swap; src: url("../assets/fonts/cinzel-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Cinzel"; font-style: normal; font-weight: 700; font-display: swap; src: url("../assets/fonts/cinzel-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "EB Garamond"; font-style: normal; font-weight: 400; font-display: swap; src: url("../assets/fonts/eb-garamond-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "EB Garamond"; font-style: italic; font-weight: 400; font-display: swap; src: url("../assets/fonts/eb-garamond-latin-400-italic.woff2") format("woff2"); }
@font-face { font-family: "EB Garamond"; font-style: normal; font-weight: 600 700; font-display: swap; src: url("../assets/fonts/eb-garamond-latin-600-normal.woff2") format("woff2"); }
/* the in-world labels and speech bubbles (render/renderer.js) keep their sans */
@font-face { font-family: "Alegreya Sans"; font-style: normal; font-weight: 400 500; font-display: swap; src: url("../assets/fonts/alegreya-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Alegreya Sans"; font-style: normal; font-weight: 600 900; font-display: swap; src: url("../assets/fonts/alegreya-sans-latin-700-normal.woff2") format("woff2"); }
:root {
  /* papyrus, ink, bronze and wax (the UI redesign); every colour is a variable */
  --parchment: #e9dcc0;
  --parchment-2: #d9c69e;
  --parchment-3: #c9b285;
  --parchment-dark: #cdb88d;
  --ink: #3b2a1a;
  --ink-soft: #5a4128;
  --bronze: #8a6a2f;
  --bronze-light: #c29d55;
  --bronze-dark: #5a4119;
  --seal: #8e2a1e;
  --seal-dark: #6a1d14;
  --seal-text: #f2d68a;
  --gold: #c9993a;
  --olive: #4a5a1e;
  --wash-water: #93b9ae;
  --warn-ink: #7a1f12;
  --stone: #d8ccb2;
  --terracotta: var(--seal);
  --terracotta-dark: var(--seal-dark);
  --line: rgba(90, 65, 40, 0.32);
  --panel: var(--parchment);
  --shade: 0 8px 24px rgba(15, 8, 3, 0.42), 0 1px 2px rgba(15, 8, 3, 0.3);
  --display: "Cinzel", "Trajan Pro", Georgia, serif;
  --body: "EB Garamond", "Alegreya", Garamond, Georgia, serif;
  --sans: "Alegreya Sans", system-ui, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: #2b3a22; color: var(--ink); font: 16px/1.35 var(--body); overflow: hidden; }
#app { position: fixed; inset: 0; }
#view { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
button { font: inherit; cursor: pointer; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
[hidden] { display: none !important; }

.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shade);
  background-image: radial-gradient(circle at 20% 0%, rgba(255,255,255,0.45), transparent 60%);
}
.btn {
  border: 1px solid var(--terracotta-dark); background: var(--terracotta); color: #fbf1dc;
  padding: 8px 14px; border-radius: 7px; font-weight: 600; letter-spacing: 0.02em;
}
.btn:hover { background: var(--terracotta-dark); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { background: rgba(176, 77, 44, 0.08); }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn:disabled { opacity: 0.45; cursor: default; }
h1, h2, h3 { font-family: var(--display); font-weight: 600; margin: 0; letter-spacing: 0.04em; }

/* ---------- title ---------- */
#title { position: absolute; inset: 0; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(ellipse at center, rgba(30,20,10,0.35), rgba(15,10,5,0.8)); }
#title .card { width: min(520px, 100%); padding: 32px 28px; text-align: center; }
#title h1 { font-size: clamp(30px, 6vw, 44px); color: var(--terracotta-dark); }
#title .sub { color: var(--ink-soft); margin: 6px 0 22px; }
#title .row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
#title .notice { background: #f6dfd2; border: 1px solid #d8a58f; color: #6b2a17; padding: 8px 10px; border-radius: 7px; margin: 0 0 14px; }
#title .fine { margin-top: 18px; font-size: 13px; color: var(--ink-soft); }

/* ---------- creator ---------- */
#creator { position: absolute; inset: 0; display: grid; place-items: center; padding: 16px; background: rgba(15,10,5,0.72); overflow: auto; }
#creator .card { width: min(980px, 100%); max-height: calc(100vh - 32px); display: grid; grid-template-columns: 340px 1fr; overflow: hidden; }
#creator .preview { background: linear-gradient(#8fb35f, #6f9445); position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 18px; gap: 12px; }
#creator canvas { width: 280px; height: 340px; max-width: 100%; }
#creator .rot { display: flex; gap: 8px; }
#creator .controls { padding: 20px 22px; overflow: auto; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
#creator .namefield { display: flex; flex-direction: column; gap: 4px; }
#creator .namefield label { font-weight: 600; }
#creator input[type=text] { font: inherit; padding: 9px 11px; border: 1px solid var(--line); border-radius: 7px; background: #fffaf0; }
#creator .rows { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 18px; }
.opt { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.opt .lbl { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-soft); }
.stepper { display: flex; align-items: center; gap: 6px; }
.stepper button { width: 28px; height: 28px; border-radius: 6px; border: 1px solid var(--line); background: #fffaf0; color: var(--ink); }
.stepper span { flex: 1; text-align: center; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.swatches { display: flex; flex-wrap: wrap; gap: 4px; }
.swatches button { width: 20px; height: 20px; border-radius: 50%; border: 2px solid rgba(0,0,0,0.15); padding: 0; }
.swatches button[aria-pressed=true] { border-color: var(--ink); transform: scale(1.15); }
#creator .actions { display: flex; gap: 10px; justify-content: space-between; align-items: center; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 12px; }
#creator .count { font-size: 13px; color: var(--ink-soft); }

/* ---------- HUD ---------- */
#hud { position: absolute; inset: 0; pointer-events: none; }
#hud > * { pointer-events: auto; }
.hud-top { position: absolute; top: calc(10px + env(safe-area-inset-top, 0px)); left: 10px; right: 10px; display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: flex-start; pointer-events: none; }
.hud-top > * { pointer-events: auto; }
#hud > .hud-top, #hud .hud-left { pointer-events: none; }
.chip { padding: 7px 12px; display: flex; align-items: center; gap: 10px; }
.clock b { font-family: var(--display); font-size: 18px; }
.clock span { color: var(--ink-soft); }
.zone { font-size: 13px; color: var(--ink-soft); }
.zone.danger { color: var(--terracotta-dark); font-weight: 600; }
.purse { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.coin { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-variant-numeric: tabular-nums; }
.coin::before { content: ""; width: 14px; height: 14px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #f5d77a, #b8862a); border: 1px solid #8a6420; }
.item { display: inline-flex; align-items: center; gap: 5px; font-variant-numeric: tabular-nums; }
.item i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.toolset { font-size: 12px; color: var(--olive); }
#prompt { position: absolute; left: 50%; bottom: calc(26px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); padding: 8px 14px; font-weight: 600; }
#prompt kbd { font-family: var(--display); background: var(--ink); color: var(--parchment); padding: 1px 7px; border-radius: 4px; margin-right: 6px; }
#side { position: absolute; right: 10px; top: 74px; width: 290px; max-height: calc(100% - 150px); display: flex; flex-direction: column; overflow: hidden; }
#side.collapsed .side-body { display: none; }
.tabs { display: flex; border-bottom: 1px solid var(--line); }
.tabs button { flex: 1; background: none; border: 0; padding: 8px 4px; font-weight: 600; color: var(--ink-soft); border-bottom: 2px solid transparent; }
.tabs button[aria-selected=true] { color: var(--terracotta-dark); border-bottom-color: var(--terracotta); }
.side-body { overflow: auto; padding: 10px 12px; font-size: 14px; }
.side-body ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.side-body li small { display: block; color: var(--ink-soft); font-size: 12px; }
.news li { border-left: 3px solid var(--gold); padding-left: 8px; }
.news li.coin-log { border-color: var(--olive); }
.news li.skill { border-color: var(--terracotta); }
.skill-row { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; }
.bar { grid-column: 1 / -1; height: 6px; background: var(--parchment-2); border-radius: 3px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--olive); }
.empty { color: var(--ink-soft); font-style: italic; }
#toasts { position: absolute; left: 50%; top: 74px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; width: min(520px, calc(100% - 20px)); }
.toast { padding: 8px 14px; font-size: 14px; text-align: center; animation: toast 5s forwards; }
@keyframes toast { 0% { opacity: 0; transform: translateY(-6px); } 8%, 85% { opacity: 1; transform: none; } 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .toast { animation: none; } }
.iconbtn { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; padding: 0; border: 1px solid var(--line); background: var(--panel); }

#crew { position: absolute; left: 10px; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); padding: 10px 12px; font-size: 14px; max-width: 260px; }
#crew ul { list-style: none; padding: 0; margin: 4px 0 8px; }
#crew .keys { font-size: 12px; color: var(--ink-soft); line-height: 2; }
#crew kbd, #help kbd { font-family: var(--display); background: var(--ink); color: var(--parchment); padding: 0 6px; border-radius: 4px; }
#shop { width: min(560px, calc(100% - 20px)); }
#shop small { color: var(--ink-soft); }


.hp { display: flex; align-items: center; gap: 6px; font-size: 13px; font-variant-numeric: tabular-nums; margin-top: 3px; }
.hp small { color: var(--ink-soft); }
.hpbar { width: 80px; height: 7px; border-radius: 4px; background: var(--parchment-2); overflow: hidden; display: inline-block; }
.hpbar > span { display: block; height: 100%; }

/* ---------- dialog ---------- */
#dialog { position: absolute; left: 50%; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); width: min(720px, calc(100% - 20px)); max-height: min(70vh, 560px); display: flex; flex-direction: column; }
.dlg-head { display: flex; gap: 14px; padding: 12px 14px; border-bottom: 1px solid var(--line); align-items: center; }
.dlg-head canvas { width: 64px; height: 80px; background: linear-gradient(#cfe0a8, #9cbc6c); border-radius: 8px; flex: none; }
.dlg-who { flex: 1; min-width: 0; }
.dlg-who h2 { font-size: 20px; }
.dlg-who p { margin: 2px 0 0; color: var(--ink-soft); font-size: 14px; }
.pill { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--parchment-2); margin-right: 6px; font-weight: 600; }
.pill.ai { background: #e5ecd6; color: #3c5422; }
.pill.ai.off { background: #efe1d3; color: #7a4a2a; }
.dlg-log { flex: 1; overflow: auto; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; min-height: 90px; }
.msg { max-width: 82%; padding: 8px 11px; border-radius: 10px; }
.msg.npc { background: #fffaf0; border: 1px solid var(--line); align-self: flex-start; }
.msg.me { background: #e4ecd4; align-self: flex-end; }
.msg.sys { align-self: center; font-size: 13px; color: var(--ink-soft); font-style: italic; text-align: center; max-width: 100%; }
.msg.typing { color: var(--ink-soft); font-style: italic; }
.dlg-actions { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 14px 0; }
.dlg-input { display: flex; gap: 8px; padding: 10px 14px 12px; }
.dlg-input input { flex: 1; min-width: 0; font: inherit; padding: 9px 11px; border: 1px solid var(--line); border-radius: 7px; background: #fffaf0; }

/* ---------- shop ---------- */
#shop { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); padding: 16px 18px; max-height: calc(100% - 20px); overflow: auto; }
#shop table { width: 100%; border-collapse: collapse; margin: 10px 0; font-variant-numeric: tabular-nums; }
#shop th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-soft); padding: 4px; }
#shop td { padding: 6px 4px; border-top: 1px solid var(--line); }
#shop .trend-up { color: var(--olive); font-weight: 700; }
#shop .trend-down { color: var(--terracotta-dark); font-weight: 700; }
#shop .head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }

/* ---------- help ---------- */
#help { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(520px, calc(100% - 20px)); max-height: calc(100% - 24px); overflow-y: auto; padding: 18px 20px; box-sizing: border-box; }
#help li { margin-bottom: 3px; }
#help ul { padding-left: 18px; }
#help kbd { font-family: var(--display); background: var(--ink); color: var(--parchment); padding: 0 6px; border-radius: 4px; }

/* ---------- touch controls ---------- */
#touch { position: absolute; left: 0; right: 0; bottom: 0; height: 0; pointer-events: none; }
#touch .pad { position: absolute; left: 18px; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); width: 120px; height: 120px; border-radius: 50%; background: rgba(244,234,210,0.35); border: 1px solid rgba(255,255,255,0.4); pointer-events: auto; touch-action: none; }
#touch .pad i { position: absolute; left: 50%; top: 50%; width: 48px; height: 48px; margin: -24px; border-radius: 50%; background: rgba(244,234,210,0.85); }
#touch .act { position: absolute; right: 18px; bottom: calc(26px + env(safe-area-inset-bottom, 0px)); width: 72px; height: 72px; border-radius: 50%; pointer-events: auto; font-family: var(--display); font-size: 22px; }

#touch .strike { right: 100px; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); width: 60px; height: 60px; background: #7a2e1f; }
#touch .dodge { right: 34px; bottom: calc(110px + env(safe-area-inset-bottom, 0px)); width: 52px; height: 52px; background: var(--panel); }

@media (max-width: 760px) {
  #creator { place-items: start center; }
  #creator .card { grid-template-columns: 1fr; max-height: none; margin: 0 auto; }
  .item .nm, .toolset { display: none; }
  .chip { padding: 6px 9px; gap: 8px; }
  #toasts { top: auto; bottom: 230px; }
  #creator canvas { width: 180px; height: 220px; }
  #creator .rows { grid-template-columns: 1fr; }
  #side { top: 146px; right: 10px; width: min(290px, calc(100% - 20px)); max-height: 45%; }
  #dialog { max-height: 78vh; }
  #prompt { bottom: 160px; }
  #tutorial { bottom: 215px; width: min(260px, calc(100% - 20px)); font-size: 13px; }
  #toasts { bottom: 300px; }
}

/* stacking: the world, then HUD and touch controls, then panels, then full-screen menus */
#hud { z-index: 4; }
#touch { z-index: 5; }
#dialog, #shop, #help { z-index: 20; }
#title, #creator { z-index: 30; }

/* keep the start button visible while the creator scrolls */
#creator .actions { position: sticky; bottom: -20px; background: var(--panel); margin: 0 -22px -20px; padding: 12px 22px 16px; box-shadow: 0 -6px 12px rgba(60, 40, 25, 0.08); }
#creator .card { grid-template-rows: minmax(0, 1fr); }
#creator .controls { min-height: 0; }
@media (max-width: 760px) { #creator .card { grid-template-rows: auto auto; } }
#creator .controls { padding-bottom: 0; }
#creator .actions { bottom: 0; margin-bottom: 0; background: var(--parchment); }

/* v0.5 town panel */
span.pill.tier { margin-left: 6px; font-size: 11px; }
small.tierinfo { color: var(--olive); }
ul.chronicle { font-size: 12.5px; gap: 4px !important; }
ul.chronicle small { color: var(--ink-soft); }
#tutorial { position: absolute; left: 10px; bottom: 10px; width: min(330px, calc(100% - 20px)); padding: 10px 12px; font-size: 14px; z-index: 6; }
#tutorial p { margin: 4px 0 0; }
#tutorial .tut-head { display: flex; justify-content: space-between; align-items: center; }
.linkbtn { font: inherit; font-size: 12px; background: none; border: none; color: var(--ink-soft); text-decoration: underline; cursor: pointer; }
.stars { display: flex; gap: 4px; margin: 4px 0 8px; }
.star { font-size: 26px; line-height: 1; background: none; border: none; cursor: pointer; color: #cbbd9f; padding: 0 2px; }
.star.on { color: #d9a52e; }
#fbtext, #help textarea { width: 100%; box-sizing: border-box; font: inherit; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: #fffaf0; }
.postrow { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.postrow select, .postrow input[type=number] { font: inherit; padding: 2px 4px; border: 1px solid var(--line); border-radius: 6px; background: #fffaf0; }
#shop .notice, p.notice { color: #9a3a22; }
table.mini { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
table.mini th { text-align: left; font-weight: 600; color: var(--ink-soft); border-bottom: 1px solid var(--line); padding: 2px 4px; }
table.mini td { padding: 2px 4px; border-bottom: 1px solid rgba(0,0,0,0.05); }
.tabs button { padding-left: 6px; padding-right: 6px; }
table.mini .trend-up { color: #b0482c; font-weight: 600; }
table.mini .trend-down { color: var(--olive); }

/* v0.5 goals */
.chipbtn { font: inherit; font-size: 12px; border: 1px solid var(--line); background: transparent; border-radius: 999px; padding: 1px 8px; margin: 2px 3px 2px 0; cursor: pointer; color: var(--ink); }
.chipbtn.on { background: var(--terracotta); border-color: var(--terracotta); color: #fff7e8; }
ol.ladder { margin: 4px 0 0; padding-left: 20px; font-size: 13px; }
ol.ladder li { margin: 2px 0; color: var(--ink-soft); }
ol.ladder li.done { color: var(--olive); }
ol.ladder li.done b::after { content: ' \2713'; }
ol.ladder li.next { color: var(--ink); }
ol.ladder li.next small { display: block; color: var(--ink-soft); }
ol.ladder li.locked { opacity: 0.6; }
ul.rivals { font-size: 13px; }
.news li.rival { border-color: #7a4f8b; }
.news li.local { border-color: #8aa2ad; }
.news li.warn { border-color: #b0482c; }
.lordbox { border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; margin: 0 0 8px; font-size: 13px; display: flex; flex-direction: column; gap: 4px; }
.lordbox small { color: var(--ink-soft); }
.chipbtn:disabled { opacity: 0.5; cursor: default; }
button.item.use { font: inherit; border: none; background: rgba(176,77,44,0.12); border-radius: 6px; padding: 1px 5px; cursor: pointer; color: inherit; display: inline-flex; align-items: center; gap: 4px; }

/* v0.9 health bar, minimap, region map */
.hud-left { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; pointer-events: none; }
.hud-left > * { pointer-events: auto; }
.vitals { gap: 8px; padding: 6px 10px; min-width: 190px; box-sizing: border-box; }
.vitals .heart { color: #b0302a; font-size: 20px; line-height: 1; }
.vitals .vbody { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.vitals .vbar { position: relative; height: 16px; border-radius: 8px; background: #3a2a1c; overflow: hidden; box-shadow: inset 0 1px 2px rgba(0,0,0,0.4); }
.vitals .vbar > span { display: block; height: 100%; transition: width 0.25s ease; }
.vitals .vbar > b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 12px; color: #fff8e6; text-shadow: 0 1px 2px rgba(0,0,0,0.8); font-variant-numeric: tabular-nums; }
.vitals small { font-size: 11.5px; color: var(--ink-soft); }
.vitals.low .heart { animation: heartbeat 0.9s infinite; }
@keyframes heartbeat { 0%, 100% { transform: scale(1); } 40% { transform: scale(1.25); } }
@media (prefers-reduced-motion: reduce) { .vitals.low .heart { animation: none; } }
.mapbox { padding: 5px; display: flex; flex-direction: column; gap: 4px; }
.minimap { width: 170px; height: 170px; display: block; border-radius: 6px; cursor: pointer; background: #2c3d22; }
.minicap { display: flex; justify-content: space-between; align-items: center; font-size: 12px; font-weight: 600; padding: 0 2px; gap: 6px; }
.minicap span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.minicap kbd, #worldmap kbd { font-family: var(--display); background: var(--ink); color: var(--parchment); padding: 0 6px; border-radius: 4px; font-size: 11px; }

#worldmap { position: absolute; inset: 14px; max-width: 1180px; margin: 0 auto; display: flex; flex-direction: column; padding: 12px 14px; box-sizing: border-box; z-index: 20; }
#worldmap[hidden] { display: none; }
.wm-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.wm-head h2 { margin: 0; font-family: var(--display); font-size: 22px; }
.wm-hint { flex: 1; font-size: 13px; color: var(--ink-soft); }
.wm-body { flex: 1; display: flex; gap: 12px; min-height: 0; }
.wm-wrap { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.wm-canvas { width: 100%; height: 100%; display: block; cursor: pointer; }
.wm-list { width: 270px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.wm-place { text-align: left; font: inherit; background: transparent; border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; cursor: pointer; color: var(--ink); }
.wm-place b { display: block; font-family: var(--display); }
.wm-place small { color: var(--ink-soft); font-size: 12px; }
.wm-place p { margin: 6px 0 0; font-size: 13px; line-height: 1.35; }
.wm-place.on { border-color: var(--terracotta); background: rgba(240, 200, 80, 0.18); }
.wm-place.here b::after { content: ' (here)'; font-family: var(--body, inherit); font-weight: 400; font-size: 12px; color: var(--olive); }
.wm-note { font-size: 12px; color: var(--ink-soft); margin: 4px 2px; }

@media (max-width: 760px) {
  .vitals { min-width: 150px; padding: 5px 8px; }
  .vitals .vbar { height: 13px; }
  .minimap { width: 112px; height: 112px; }
  #worldmap { inset: 6px; padding: 8px; }
  .wm-hint { display: none; }
  .wm-body { flex-direction: column; }
  .wm-list { width: auto; max-height: 34%; }
}
@media (max-width: 760px) {
  .hud-left { max-width: 50%; }
  .hud-left .clock { max-width: 100%; box-sizing: border-box; }
  .hud-left .clock .zone { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .hud-left .clock > div { min-width: 0; max-width: 100%; }
  .vitals { min-width: 0; width: 100%; }
  .mapbox { position: fixed; left: 10px; top: calc(196px + env(safe-area-inset-top, 0px)); }
  .minicap span { max-width: 80px; }
}
@media (max-width: 760px) {
  .hud-top { flex-wrap: nowrap; }
  .hud-top > div:last-child { max-width: 48%; flex-wrap: wrap; justify-content: flex-end; }
  .hud-top .purse { max-width: 100%; box-sizing: border-box; }
}

/* ---------- inventory (I) and the gear shop ---------- */
#inv { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(720px, calc(100% - 20px)); max-height: calc(100% - 20px); overflow: auto; padding: 14px 16px; z-index: 21; --cell: 42px; }
#inv .head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
#inv h2 { margin: 0; }
#inv h3 { margin: 0 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-soft); }
.invstats { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--ink-soft); margin: 6px 0 10px; align-items: center; }
.invstats .load { display: flex; align-items: center; gap: 6px; }
.invstats .load .bar { width: 90px; height: 7px; border-radius: 4px; background: rgba(0,0,0,0.12); overflow: hidden; display: inline-block; }
.invstats .load .bar i { display: block; height: 100%; background: #6f9a3c; }
.invstats .load.over .bar i { background: #c0392b; }
.invstats .load.over { color: #9b2c20; font-weight: 600; }
.invstats .warn { color: #9b2c20; font-weight: 600; }
.invwrap { display: flex; gap: 16px; align-items: flex-start; }
.doll { display: grid; grid-template-columns: 96px 150px 96px; gap: 6px; align-items: center; flex: none; }
.doll .col { display: flex; flex-direction: column; gap: 8px; }
.doll-canvas { width: 150px; height: 210px; background: radial-gradient(circle at 50% 60%, #f6ecd6, #e6d6b4); border-radius: 10px; border: 1px solid var(--line); }
.slot { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-height: 58px; padding: 5px 7px; border-radius: 8px; border: 1px dashed var(--line); background: rgba(255,250,240,0.6); text-align: left; color: var(--ink); font: inherit; cursor: default; }
.slot.full { border-style: solid; background: #fffaf0; cursor: pointer; }
.slot small { font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-soft); }
.slot b { font-size: 12px; line-height: 1.2; }
.slot.q-good b { color: #6a4d22; }
.slot.q-fine b { color: #9a6a10; }
.slot.broken b { color: #9b2c20; text-decoration: line-through; }
.slot .cond, .bagitem .cond { width: 100%; height: 4px; background: rgba(0,0,0,0.1); border-radius: 2px; overflow: hidden; display: block; }
.slot .cond i { display: block; height: 100%; }
.bag { flex: 1; min-width: 0; }
.baggrid { display: grid; gap: 2px; background-color: rgba(60,40,20,0.08); background-image: linear-gradient(rgba(60,40,20,0.12) 1px, transparent 1px), linear-gradient(90deg, rgba(60,40,20,0.12) 1px, transparent 1px); background-size: calc(var(--cell) + 2px) calc(var(--cell) + 2px); border-radius: 6px; padding: 2px; width: max-content; }
.bagitem { position: relative; border-radius: 5px; border: 1px solid rgba(40,26,18,0.35); background: linear-gradient(160deg, color-mix(in srgb, var(--tint) 55%, #fff8ea), color-mix(in srgb, var(--tint) 85%, #000)); color: #fff; font: 600 10px/1.15 var(--body); padding: 3px; overflow: hidden; text-align: left; text-shadow: 0 1px 1px rgba(0,0,0,0.6); }
button.bagitem { cursor: pointer; }
button.bagitem:hover, button.bagitem:focus-visible { outline: 2px solid var(--terracotta); }
.bagitem.q-good { box-shadow: inset 0 0 0 2px #b08a4a; }
.bagitem.q-fine { box-shadow: inset 0 0 0 2px #e6b53c; }
.bagitem.broken { filter: grayscale(0.8); }
.bagitem .qty { position: absolute; right: 3px; bottom: 2px; font-size: 11px; }
.baglist { list-style: none; margin: 0; padding: 0; }
.baglist li { display: grid; grid-template-columns: 12px 1fr auto auto; gap: 8px; align-items: center; padding: 6px 2px; border-top: 1px solid var(--line); font-size: 14px; }
.baglist li i { width: 12px; height: 12px; border-radius: 3px; }
.baglist .w { color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.invmsg { margin: 8px 0 0; padding: 6px 10px; background: #fff3d6; border-radius: 6px; font-size: 13px; }
#inv.phone .invwrap { flex-direction: column; }
#inv.phone .doll { grid-template-columns: 1fr 120px 1fr; width: 100%; }
#inv.phone .doll-canvas { width: 120px; height: 168px; }
#inv.phone .bag { width: 100%; }
.shoptabs { margin-top: 6px; }
#shop tr.q-fine b { color: #9a6a10; }
#shop .fine { font-size: 12px; color: var(--ink-soft); margin: 0 0 6px; }
.bagbtn { font-size: 17px; }

/* ---------- city-states (Town tab, vote pop-up) ---------- */
.govbox { background: rgba(255,250,240,0.7); border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; margin: 0 0 6px; font-size: 13px; }
.govbox small { display: block; color: var(--ink-soft); }
.standing b.good { color: var(--olive); }
.standing b.bad { color: #b0482c; }
.warn { color: #9b2c20; }
.uprising { background: #f6d9cf; border: 1px solid #c56a52; border-radius: 8px; padding: 7px 9px; margin: 0 0 8px; font-size: 13px; }
ul.diplo { list-style: none; margin: 0 0 6px; padding: 0; font-size: 13px; }
ul.diplo li { padding: 3px 0; }
.dstate { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 9px; background: #e4ddcd; color: #5b4636; }
.dstate.pact { background: #d4e8c8; color: #2f6a2a; }
.dstate.war { background: #f2c9bf; color: #9b2c20; }
table.books { font-size: 12px; }
#vote { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(460px, calc(100% - 20px)); max-height: calc(100% - 20px); overflow: auto; padding: 14px 16px; z-index: 30; }
#vote h2 { margin: 0 0 4px; }
#vote .fine { font-size: 13px; color: var(--ink-soft); margin: 0 0 8px; }
#vote .agenda { padding-left: 20px; margin: 0 0 10px; }
#vote .agenda li { margin: 0 0 10px; }
#vote .agenda p { margin: 0 0 6px; }
#vote .row { display: flex; gap: 8px; }

/* ---------- chat and groups ---------- */
#chat { position: absolute; left: 10px; bottom: 10px; width: min(380px, calc(100% - 20px)); height: 220px; display: flex; flex-direction: column; padding: 0; z-index: 7; overflow: hidden; background: rgba(250,243,228,0.88); }
#chat.closed { display: none; }
#chat[hidden] { display: none; }
.chat-tabs { display: flex; border-bottom: 1px solid var(--line); flex: none; }
.chat-tabs button { flex: 1; background: none; border: 0; padding: 5px 2px; font: 600 12px var(--body); color: var(--ink-soft); border-bottom: 2px solid transparent; }
.chat-tabs button[aria-selected=true] { color: var(--terracotta-dark); border-bottom-color: var(--terracotta); }
.chat-tabs .unread { display: inline-block; margin-left: 4px; min-width: 15px; padding: 0 4px; border-radius: 8px; background: var(--terracotta); color: #fff; font-size: 10px; }
.chat-list { list-style: none; margin: 0; padding: 4px 8px; flex: 1; overflow-y: auto; font-size: 13px; line-height: 1.3; }
.chat-list li { margin: 1px 0; overflow-wrap: anywhere; }
.chat-list .ch-group, .chat-list .ch-group b { color: #2c7a35; }
.chat-list .ch-town .pfx { color: #9a6a10; }
.chat-list .ch-whisper, .chat-list .ch-whisper b { color: #7a3b8f; }
.chat-list .ch-system { color: var(--ink-soft); font-style: italic; }
.chat-input { flex: none; border: 0; border-top: 1px solid var(--line); padding: 7px 9px; font: inherit; font-size: 14px; background: #fffaf0; }
.chat-input:focus { outline: 2px solid var(--terracotta); outline-offset: -2px; }
#chatbtn { position: absolute; left: 10px; bottom: 10px; z-index: 8; display: none; }
#chatbtn .dot { position: absolute; top: 2px; right: 2px; width: 9px; height: 9px; border-radius: 50%; background: var(--terracotta); }
#chatbtn[hidden] { display: none !important; }
body.has-chat #tutorial { bottom: 240px; }
.party { display: flex; flex-direction: column; gap: 4px; padding: 6px 9px; min-width: 150px; }
.party[hidden] { display: none; }
.party .pm { display: grid; grid-template-columns: 1fr 70px; gap: 6px; align-items: center; font-size: 12px; }
.party .pm .nm { color: #1f6a2c; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.party .pm .vbar { height: 6px; background: rgba(0,0,0,0.12); border-radius: 3px; overflow: hidden; display: block; }
.party .pm .vbar span { display: block; height: 100%; background: #6f9a3c; }
.party .pm.away { opacity: 0.55; }
#ginvite { position: absolute; left: 50%; top: 22%; transform: translateX(-50%); padding: 12px 16px; z-index: 31; }
#ginvite p { margin: 0 0 8px; }
#ginvite .row { display: flex; gap: 8px; justify-content: flex-end; }
#pmenu { position: fixed; z-index: 32; padding: 8px 10px; display: flex; flex-direction: column; gap: 4px; min-width: 150px; }
#pmenu[hidden] { display: none; }
#pmenu .linkbtn { text-align: left; }
.grouplist { list-style: none; padding: 0; margin: 0 0 6px; }
.grouplist li { padding: 3px 0; }
.mate { color: #2c7a35; font-weight: 700; }
@media (max-width: 720px), (hover: none) and (pointer: coarse) {
  #chatbtn { display: grid; left: auto; right: 10px; bottom: 170px; }
  #chat { left: 10px; right: 10px; width: auto; bottom: 170px; height: 40%; z-index: 9; }
}

/* ---------- learning (Goals tab) ---------- */
.learnnote { margin: 0 0 6px; font-size: 12px; padding: 4px 8px; border-radius: 6px; }
.learnnote.rested { background: #e2efd6; color: #2f6a2a; }
.learnnote.tired { background: #f3e2c8; color: #8a5a1a; }
.skill-row.tired b { color: #8a5a1a; }
.mastery { font-size: 13px; margin-top: 8px; }
.mastery ul { margin: 0; padding-left: 18px; }

/* ---------- WebGL effects layer (src/render/fx.js) ---------- */
#viewgl, #viewui { position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; }
#view.under-gl { opacity: 0; }
.helpfoot { display: flex; justify-content: space-between; align-items: center; gap: 8px; }

/* ---------- goal panel and celebrations ---------- */
#goals { width: 230px; padding: 7px 9px; font-size: 13px; pointer-events: auto; }
#goals .ghead { display: flex; align-items: center; gap: 4px; }
#goals .gtitle { flex: 1; text-align: left; background: none; border: 0; padding: 0; font: inherit; color: var(--ink); cursor: pointer; line-height: 1.25; }
#goals .gtitle small { color: var(--ink-soft); font-size: 11px; }
#goals .iconbtn.small { width: 24px; height: 24px; font-size: 12px; flex: none; }
#goals .glist { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
#goals .goal { padding: 5px 7px; border-radius: 7px; cursor: pointer; border: 1px solid transparent; line-height: 1.3; }
#goals .goal.main { background: rgba(240,200,80,0.18); font-weight: 600; }
#goals .goal.hint { background: rgba(255,250,240,0.6); font-size: 12px; color: var(--ink-soft); }
#goals .goal.on { border-color: #d9a83a; box-shadow: inset 3px 0 0 #e6b53c; }
#goals .goal small { display: block; font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; color: #8a6a1a; font-weight: 700; }
#goals .gbar { display: flex; align-items: center; gap: 6px; margin-top: 3px; }
#goals .gbar i { display: block; height: 6px; background: #d9a83a; border-radius: 3px; }
#goals .gbar { background: none; }
#goals .gbar b { font-size: 11px; color: var(--ink-soft); }
#goals .gone { margin: 4px 0 0; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#goals .linkbtn { display: block; margin-top: 2px; }
#tutorial { display: none !important; }
#celebrate { position: fixed; left: 50%; top: 18%; transform: translate(-50%, -10px); opacity: 0; pointer-events: none; z-index: 40; text-align: center; background: linear-gradient(180deg, #fff6dc, #f2dfae); border: 2px solid #d9a83a; border-radius: 12px; padding: 10px 22px; box-shadow: 0 8px 30px rgba(60,30,0,0.25); transition: opacity .35s, transform .35s; max-width: calc(100% - 40px); }
#celebrate.show { opacity: 1; transform: translate(-50%, 0); }
#celebrate b { font-family: var(--display); font-size: 22px; color: #8a4a12; }
#celebrate p { margin: 4px 0 0; }
#celebrate small { color: var(--ink-soft); }
@media (max-width: 720px) { #goals { width: auto; max-width: calc(100vw - 20px); } #goals .gtitle small { display: none; } #side { top: calc(186px + env(safe-area-inset-top, 0px)); } }
@media (prefers-reduced-motion: reduce) { #celebrate { transition: none; } }
body.has-chat #goals { max-height: max(110px, calc(100vh - 560px)); overflow-y: auto; }
#goals .gsel { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; }

/* scenes */
#scenepop { position: fixed; left: 50%; top: 30%; transform: translateX(-50%); padding: 10px 14px; z-index: 31; max-width: min(420px, calc(100vw - 32px)); }
#scenepop[hidden] { display: none; }
#scenepop b { font-family: var(--display); color: #8a3a12; }
#scenepop p { margin: 4px 0 8px; font-size: 14px; }
#scenepop .row { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
/* warboard */
.warboard { background: rgba(255,250,240,0.7); border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; margin: 6px 0 8px; font-size: 13px; }
.warboard .wb-title { margin: 0 0 4px; font-weight: 600; }
.warboard .wb-sec { margin: 4px 0 6px; }
.warboard .wb-sec > b { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-soft); }
.warboard ul { margin: 2px 0 0; padding-left: 16px; }
.warboard p { margin: 2px 0; }
.warboard small { color: var(--ink-soft); }
.warboard .wb-on { font-size: 12px; color: var(--olive); font-weight: 600; }

/* art */
/* painted still art (src/render/art.js); every rule here only touches the art elements */
.art-ico { display: inline-block; flex: none; object-fit: contain; vertical-align: middle; filter: drop-shadow(0 1px 1px rgba(40,25,15,0.35)); }
.art-wait { display: inline-flex; align-items: center; vertical-align: middle; }
.art-wait:empty { display: none; }
.item .art-ico { width: 20px; height: 20px; margin: -3px 0; }
.art-item { display: inline-flex; align-items: center; gap: 6px; }
td > .art-ico, td > .art-wait { margin-right: 6px; }
.baglist li { grid-template-columns: minmax(12px, auto) 1fr auto auto; }
.baglist li .art-ico { width: 24px; height: 24px; }
.bagitem .art-ico { position: absolute; left: 50%; top: 54%; transform: translate(-50%, -50%); max-width: 82%; max-height: 72%; width: auto; height: auto; pointer-events: none; }
.bagitem:has(.art-ico) { background: linear-gradient(160deg, color-mix(in srgb, var(--tint) 18%, #f4ead2), color-mix(in srgb, var(--tint) 35%, #cdb994)); }
.bagitem .nm { position: relative; z-index: 1; }
.bagitem .qty { z-index: 1; }
.dlg-head canvas[data-art="portrait"] { background: #e6d6b4; box-shadow: 0 1px 3px rgba(40,25,15,0.35); }
#title.art-bg { background: radial-gradient(ellipse at center, rgba(244,234,210,0.15), rgba(30,20,10,0.55)), var(--art-title) center / cover no-repeat, #2a1d12; }
#title.art-bg .card { background: rgba(244,234,210,0.9); backdrop-filter: blur(2px); }
.art-gap { display: inline-block; flex: none; vertical-align: middle; }
td > .art-gap { margin-right: 6px; }
.bagitem .art-gap { display: none; }
.dlg-head canvas[data-art="portrait"] { width: 88px; height: 110px; }
@media (max-width: 720px) { .dlg-head canvas[data-art="portrait"] { width: 64px; height: 80px; } }

/* resources */
.art-item i.sw { display: inline-block; flex: none; width: 14px; height: 14px; border-radius: 3px; margin: 0 7px 0 5px; vertical-align: -2px; box-shadow: inset 0 0 0 1px rgba(40,26,18,0.3); }
#prompt.info { font-weight: 500; }
#prompt.gated { opacity: 0.82; font-style: italic; color: var(--ink-soft); }
#pmenu.plantmenu .linkbtn { padding: 4px 2px; }
@media (pointer: coarse), (max-width: 720px) { #pmenu .linkbtn { min-height: 40px; padding: 8px 4px; font-size: 15px; } }

/* ---------- painted figures: creator picker, title "Continue as", name prompt (CHARACTERS) ---------- */
#creator .cast-wait { padding: 30px; display: block; width: auto; }
#creator .cast-creator .preview { gap: 8px; }
#creator .cast-preview { width: 260px; height: 316px; }
#creator .cast-caption { font-family: var(--display); font-weight: 600; color: #fbf1dc; text-shadow: 0 1px 2px rgba(0,0,0,0.6); min-height: 1.4em; }
#creator .rot { flex-wrap: wrap; justify-content: center; }
#creator .rot .btn.ghost { background: rgba(244,234,210,0.85); }
#creator .rot .btn[aria-pressed="true"] { background: var(--terracotta); color: #fbf1dc; border-color: var(--terracotta-dark); }
.cast-tabs { display: flex; gap: 6px; }
.cast-tab { border: 1px solid var(--line); background: transparent; color: var(--ink); padding: 6px 14px; border-radius: 999px; font-weight: 600; min-height: 36px; }
.cast-tab[aria-selected="true"] { background: var(--olive); border-color: var(--olive); color: #fbf1dc; }
.cast-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 8px; }
.cast-thumb { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 4px 4px; border: 2px solid transparent; border-radius: 9px;
  background: linear-gradient(#a9c47e, #7f9f55); color: #fbf1dc; font-size: 12px; font-weight: 600; text-shadow: 0 1px 2px rgba(0,0,0,0.55); min-height: 44px; }
.cast-thumb img { height: 84px; width: 100%; object-fit: contain; pointer-events: none; }
.cast-thumb:hover { border-color: rgba(201,153,58,0.6); }
.cast-thumb[aria-selected="true"] { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(201,153,58,0.45); background: linear-gradient(#c3d79a, #8fb35f); }
#title .continue-as { display: inline-flex; align-items: center; gap: 10px; text-align: left; padding: 6px 14px 6px 8px; }
#title .continue-as .title-fig { height: 54px; width: 30px; object-fit: contain; }
#title .continue-as .ca-text { display: flex; flex-direction: column; }
#title .continue-as small { font-weight: 400; opacity: 0.85; font-size: 12px; }
#title .retire-confirm p { margin: 0 0 8px; font-weight: 600; }
#askname { position: absolute; left: 50%; top: 22%; transform: translateX(-50%); z-index: 40; padding: 18px 20px; width: min(360px, calc(100% - 32px)); display: flex; flex-direction: column; gap: 10px; }
#askname input { font: inherit; padding: 9px 11px; border: 1px solid var(--line); border-radius: 7px; background: #fffaf0; }
#askname .row { display: flex; justify-content: flex-end; }
@media (max-width: 760px) {
  #creator .cast-preview { width: 150px; height: 182px; }
  .cast-grid { grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 6px; }
  .cast-thumb img { height: 64px; }
}

/* economy */
.supply { margin: 8px 0; padding: 8px; border: 1px solid rgba(93,62,46,0.25); border-radius: 8px; background: rgba(255,248,230,0.55); }
.supply-head { margin: 0 0 6px; display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; }
.supbadge { display: inline-block; padding: 1px 7px; border-radius: 9px; font-size: 12px; font-weight: 700; background: #e3d6b6; color: #4a3424; }
.supbadge.good { background: #cfe2b4; color: #2f4a17; }
.supbadge.ok { background: #e6dcb2; color: #5a4a1a; }
.supbadge.warn { background: #f1cf8f; color: #6a3d0c; }
.supbadge.bad { background: #e7a596; color: #6a160c; }
.supwarn { margin: 0 0 6px; padding-left: 18px; color: #8a2a18; font-size: 13px; }
.bstate { display: inline-block; margin: 0 4px 2px 0; padding: 0 5px; border-radius: 6px; background: #ece2c8; white-space: nowrap; }
.bstate.running { background: #d6e6c0; }
.bstate.stopped { background: #f0b9aa; color: #6a160c; font-weight: 600; }
.bstate.idle { background: #e9e1cd; color: #6b5a44; }
.sgood { display: inline-flex; align-items: center; gap: 2px; margin-right: 6px; white-space: nowrap; }
.suptools .chipbtn { margin: 2px 4px 2px 0; }
.services { margin-top: 10px; }
.svc-h { margin: 10px 0 4px; }
.svc-row { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.svc-note { display: block; color: var(--ink-soft); font-size: 12px; margin-top: 4px; }
.tradepick { display: inline-flex; align-items: center; gap: 2px; padding: 1px 6px; border-radius: 8px; background: #efe5cc; font-size: 13px; }
.tradepick.on { background: #d6e6c0; font-weight: 600; }
.tradepick.decay { background: #f3d9b0; }
.bstate-line { margin: 4px 0; font-weight: 600; }
.bstate-line.stopped { color: #9a2a18; }
.bstate-line.running { color: var(--olive); }
.chainbtn { border-style: dashed; }
.pricein { white-space: nowrap; font-size: 13px; }
@media (max-width: 760px) {
  .svc-row .chipbtn { flex: 1 1 auto; }
}
.supply-chains .chainrow { padding: 4px 0; border-top: 1px solid rgba(93,62,46,0.15); font-size: 12px; }
.supply-chains .chainname { display: flex; flex-wrap: wrap; gap: 3px; align-items: baseline; }
.supply-chains .chainname b { margin-right: 4px; font-size: 13px; }
.supply-chains .chaingoods { display: flex; flex-wrap: wrap; gap: 2px 8px; margin-top: 2px; color: var(--ink-soft); }
.supkey { display: block; color: var(--ink-soft); font-size: 11px; margin-bottom: 2px; }
.supply { overflow-wrap: anywhere; }

/* bugs 11-16 */
.msg.heard { align-self: flex-start; font-size: 13px; color: var(--ink-soft); font-style: italic; background: rgba(255,250,240,0.6); border: 1px dashed var(--line); }
.chat-list li.npc b { color: #7a4a1c; }
.chat-list li.npc { color: #3b2a1c; }
#vote .btn.chosen { outline: 2px solid #c9a13b; outline-offset: 1px; }
#vote .btn[disabled] { opacity: 0.5; cursor: not-allowed; }
#vote .votemsg { margin: 0 0 8px; padding: 6px 9px; border-radius: 8px; background: #e9f1da; font-size: 14px; }
#vote .votemsg.bad { background: #f8dcd2; color: #7a1f10; font-weight: 600; }
#vote .results li { margin: 0 0 6px; }
.joblist { list-style: none; padding: 0; margin: 0 0 6px; }
.jobrow { display: flex; align-items: stretch; gap: 4px; margin: 0 0 4px; }
.jobrow .jobsel { flex: 1; text-align: left; background: transparent; border: 1px solid transparent; border-radius: 8px; padding: 5px 7px; font: inherit; color: inherit; cursor: pointer; display: flex; flex-direction: column; gap: 1px; }
.jobrow .jobsel:hover { border-color: var(--line); background: rgba(255,250,235,0.6); }
.jobrow.on .jobsel { border-color: #c9a13b; background: #fbf0cf; box-shadow: inset 3px 0 0 #e2b74f; }
.jobrow .jobsel small { color: var(--ink-soft); }
.jobrow .jobwhere { color: #8a5a10; font-weight: 600; }
.jobrow .jobx { border: 1px solid var(--line); background: #fff6e2; border-radius: 8px; width: 30px; font-size: 18px; line-height: 1; cursor: pointer; color: #7a3a12; }

/* ai life */
/* overheard villager lines in the chat log: dimmed, italic */
.chat-list li.npc.overheard { color: #6b5a48; font-style: italic; opacity: 0.85; }
.chat-list li.npc.overheard b { color: #8a6a44; font-weight: 600; }
/* clickable toast (the morning paper) */
.toast.toastbtn { pointer-events: auto; display: block; width: 100%; font: inherit; font-size: 14px; color: var(--ink); cursor: pointer; }
.toast.toastbtn:hover { background: #fbf0cf; }
/* the HUD button for the Acta Diurna */
.actabtn { position: relative; font-size: 17px; }
.actabtn .dot { position: absolute; top: 1px; right: 1px; width: 9px; height: 9px; border-radius: 50%; background: var(--terracotta, #b5532f); }
.actabtn .dot[hidden] { display: none; }
/* the Acta Diurna: a parchment sheet */
#acta { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; background: rgba(30, 20, 10, 0.45); padding: 16px; }
#acta[hidden] { display: none; }
.acta-sheet { position: relative; width: min(560px, 100%); max-height: min(86vh, 720px); overflow: auto; padding: 22px 28px 16px; color: #2b1d13;
  background: radial-gradient(ellipse at 30% 20%, #fbf3dc 0%, #f1e2bd 55%, #e2cc9a 100%); border: 1px solid #b89a63; border-radius: 4px;
  box-shadow: 0 18px 40px rgba(0,0,0,0.45), inset 0 0 40px rgba(120, 80, 30, 0.25); font-family: Georgia, "Times New Roman", serif; }
.acta-close { position: absolute; top: 6px; right: 10px; border: 0; background: none; font-size: 26px; line-height: 1; color: #5b4636; cursor: pointer; padding: 4px 8px; }
.acta-mast { text-align: center; }
.acta-title { font-family: var(--display); font-size: 34px; letter-spacing: 0.18em; margin: 6px 0 2px; color: #3a2414; }
.acta-sub { margin: 0 0 6px; font-size: 13px; letter-spacing: 0.06em; color: #6b5640; font-variant: small-caps; }
.acta-rule { height: 3px; border-top: 1px solid #7a5a32; border-bottom: 1px solid #7a5a32; margin: 4px 0; }
.acta-headline { font-family: var(--display); font-size: 22px; text-align: center; margin: 14px 0 10px; line-height: 1.25; }
.acta-items { list-style: none; margin: 0; padding: 0; columns: 1; }
.acta-item { display: flex; gap: 8px; padding: 7px 0; border-bottom: 1px dotted rgba(90, 60, 30, 0.35); font-size: 15px; line-height: 1.45; }
.acta-item:last-child { border-bottom: 0; }
.acta-item:first-child .acta-text::first-letter { font-family: var(--display); font-size: 1.6em; float: left; line-height: 1; margin: 2px 4px 0 0; color: #7a3a12; }
.acta-mark { flex: none; width: 18px; text-align: center; color: #8a5a10; }
.acta-text small { color: #6b5640; font-size: 12px; }
.acta-empty { font-style: italic; text-align: center; color: #5b4636; margin: 18px 0; }
.acta-nav { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 12px; padding-top: 8px; border-top: 1px solid rgba(90, 60, 30, 0.35); }
.acta-nav .btn[disabled] { opacity: 0.4; cursor: default; }
.acta-count { font-size: 12px; color: #6b5640; }
@media (min-width: 900px) { .acta-items { columns: 2; column-gap: 26px; column-rule: 1px solid rgba(90, 60, 30, 0.3); } .acta-item { break-inside: avoid; } .acta-sheet { width: min(760px, 100%); } }
@media (max-width: 520px) { #acta { padding: 8px; } .acta-sheet { padding: 16px 14px 12px; max-height: 92vh; } .acta-title { font-size: 26px; letter-spacing: 0.12em; } .acta-headline { font-size: 19px; } .acta-item { font-size: 14px; } }
/* the Diary tab in the dialogue window */
.dlg-tabs { display: flex; border-bottom: 1px solid var(--line); padding: 0 14px; }
.dlg-tabs button { flex: none; padding: 6px 14px; }
.dlg-diary { flex: 1; overflow: auto; padding: 10px 16px 14px; min-height: 120px; font-family: Georgia, "Times New Roman", serif; background: linear-gradient(#fbf3dc, #f3e6c4); }
.dlg-diary[hidden], .dlg-log[hidden], .dlg-actions[hidden], .dlg-input[hidden] { display: none; }
.diary-dec { margin: 0 0 8px; font-size: 14px; color: #5b4636; }
.diary-list { list-style: none; margin: 0; padding: 0; }
.diary-entry { padding: 6px 0; border-bottom: 1px dotted rgba(90, 60, 30, 0.35); display: grid; grid-template-columns: 82px 1fr; gap: 2px 10px; }
.diary-day { font-size: 12px; color: #7a5a32; font-variant: small-caps; padding-top: 2px; }
.diary-text { font-style: italic; }
.diary-secret { letter-spacing: 0.1em; color: #8a6a44; }
.diary-secret.open { letter-spacing: 0; color: #7a3a12; }
.diary-hint { grid-column: 2; font-size: 12px; color: #8a6a44; }
.diary-entry.private .diary-text { color: #5a2a10; }
.diary-note { font-size: 12px; color: #6b5640; margin: 8px 0 0; }
/* the Local chat (bottom left, above #app) covers the left of the dialogue window: on wide screens the window moves right of it */
@media (min-width: 1360px) { body.has-chat #dialog { left: max(50%, 760px); } }

/* ---------- words with effects (words.js): the outcome line, coins and gifts ---------- */
.msg.outcome { align-self: flex-start; max-width: 100%; font-size: 13px; color: #5a4a1e; background: transparent; padding: 1px 2px 1px 9px; border-radius: 0; border-left: 3px solid #c9a24a; font-style: italic; }
.dlg-dealwrap { padding: 0 14px 10px; margin-top: -4px; }
.dlg-deal, .dlg-give { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.dlg-give { margin-top: 6px; }
.dlg-give[hidden], .dlg-dealwrap[hidden] { display: none; }
.dlg-amt { width: 64px; font: inherit; font-size: 14px; padding: 5px 7px; border: 1px solid var(--line); border-radius: 7px; background: #fffaf0; }
.dlg-gsel { font: inherit; font-size: 14px; padding: 5px 7px; border: 1px solid var(--line); border-radius: 7px; background: #fffaf0; max-width: 60%; }

/* =====================================================================================
   ROMAN THEME (UI redesign): papyrus, ink, bronze, wax. Painted textures from
   assets/art/ui.json override the CSS fallbacks (src/ui/theme.js sets --ui-* and .ui-art-*).
   ===================================================================================== */
:root {
  /* fibrous papyrus noise, drawn once by the browser (no image files) */
  --tex-noise: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='f'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.012 0.55' numOctaves='2' seed='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.36 0 0 0 0 0.25 0 0 0 0 0.11 0 0 0 0.16 0'/%3E%3C/filter%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' seed='8' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.3 0 0 0 0 0.2 0 0 0 0 0.1 0 0 0 0.09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23f)'/%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  /* small meander (Greek key) corners in bronze */
  --corner-tl: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M1 15V1h14M4 15V4h8v5H7V7' fill='none' stroke='%238a6a2f' stroke-width='1.4'/%3E%3C/svg%3E");
  --corner-tr: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M15 15V1H1M12 15V4H4v5h5V7' fill='none' stroke='%238a6a2f' stroke-width='1.4'/%3E%3C/svg%3E");
  --corner-bl: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M1 1v14h14M4 1v11h8V7H7v2' fill='none' stroke='%238a6a2f' stroke-width='1.4'/%3E%3C/svg%3E");
  --corner-br: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M15 1v14H1M12 1v11H4V7h5v2' fill='none' stroke='%238a6a2f' stroke-width='1.4'/%3E%3C/svg%3E");
  --coin-img: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='9' fill='%23d8b04e' stroke='%237a5a1c' stroke-width='1.6'/%3E%3Ccircle cx='12' cy='12' r='6.2' fill='none' stroke='%239a7426'/%3E%3Cpath d='M9.5 9.5h5M12 9.5v5.5M9.5 15h5' stroke='%236b4c12' stroke-width='1.4' fill='none'/%3E%3C/svg%3E");
  --rod: radial-gradient(circle at 7px 50%, #d8b06a 0 4px, #7a5424 5px, transparent 6px), radial-gradient(circle at calc(100% - 7px) 50%, #d8b06a 0 4px, #7a5424 5px, transparent 6px), linear-gradient(#5e3f1a, #b8864c 40%, #8a6233 70%, #4e3414);
  --paper-layers: var(--tex-noise), radial-gradient(ellipse at 28% 12%, rgba(255, 250, 232, 0.55), transparent 62%), linear-gradient(172deg, var(--parchment) 0%, var(--parchment-2) 100%);
  --burn: inset 0 0 0 1px rgba(255, 244, 214, 0.45), inset 0 0 24px rgba(110, 70, 25, 0.32);
}
body { font-family: var(--body); }
.ico { display: inline-flex; width: 16px; height: 16px; flex: none; vertical-align: -3px; color: var(--ink); }
.ico svg, .ico img { width: 100%; height: 100%; display: block; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- panels: a papyrus sheet, thin bronze frame, meander corners, burnt edges ---------- */
.panel {
  background-color: var(--parchment);
  background-image: var(--corner-tl), var(--corner-tr), var(--corner-bl), var(--corner-br), var(--paper-layers);
  background-position: left 3px top 3px, right 3px top 3px, left 3px bottom 3px, right 3px bottom 3px, 0 0, 0 0, 0 0;
  background-size: 13px 13px, 13px 13px, 13px 13px, 13px 13px, 180px 180px, 100% 100%, 100% 100%;
  background-repeat: no-repeat, no-repeat, no-repeat, no-repeat, repeat, no-repeat, no-repeat;
  border: 1px solid var(--bronze); border-radius: 3px;
  box-shadow: var(--burn), var(--shade);
  color: var(--ink);
}
.chip.panel { background-size: 9px 9px, 9px 9px, 9px 9px, 9px 9px, 180px 180px, 100% 100%, 100% 100%; background-position: left 2px top 2px, right 2px top 2px, left 2px bottom 2px, right 2px bottom 2px, 0 0, 0 0, 0 0; }
h1, h2, h3 { font-family: var(--display); font-weight: 600; color: var(--ink); }
h2 { letter-spacing: 0.05em; }
small, .empty { color: var(--ink-soft); }
input[type=text], input[type=number], input[type=search], select, textarea { font-family: var(--body); color: var(--ink); background: #f5ecd5; border: 1px solid var(--bronze); border-radius: 3px; }
::selection { background: rgba(142, 42, 30, 0.25); }

/* painted textures, when assets/art/ui.json has them */
.ui-art-parchment .panel { background-image: var(--ui-parchment); background-size: 512px auto; background-repeat: repeat; background-position: 0 0; }
.ui-art-frame .panel { border-style: solid; border-width: var(--ui-frame-width); border-image-source: var(--ui-frame); border-image-slice: var(--ui-frame-slice) fill; border-image-width: var(--ui-frame-width); border-image-repeat: round; }
.ui-art-frameThin .chip.panel, .ui-art-frameThin .sumcard { border-image-source: var(--ui-frame-thin); border-image-slice: var(--ui-frame-thin-slice) fill; border-image-width: var(--ui-frame-thin-width); border-image-repeat: round; }
.ui-art-parchmentDark #chat { background-image: var(--ui-parchment-dark); background-size: 384px auto; }
.ui-art-tablet .dlg-log { background-image: var(--ui-tablet); background-size: 384px auto; }
.ui-art-medallion .medallion { background: var(--ui-medallion) center / 100% 100% no-repeat; }
.ui-art-seal .btn.seal { background: var(--ui-seal) center / 100% 100% no-repeat; border-color: transparent; }
.ui-art-ribbon #side .tabs button[aria-selected=true] { background: var(--ui-ribbon) center top / 100% 100% no-repeat; }
.ui-art-scrollRod .scrollpop::before, .ui-art-scrollRod .scrollpop::after, .ui-art-scrollRod #help::before, .ui-art-scrollRod #help::after { background: var(--ui-scroll-rod) center / 100% 100% no-repeat; }
.ui-art-laurel .sum-head::after { content: ""; width: 44px; height: 16px; background: var(--ui-laurel) center / contain no-repeat; }

/* ?gfx=simple: plain flat paper, no texture or ornaments */
.gfx-simple .panel, .gfx-simple .sumcard, .gfx-simple #chat { background-image: none !important; background-color: var(--parchment); }
.gfx-simple .panel { box-shadow: var(--shade); }

/* ---------- buttons: bronze and stone tablets that sink when pressed; the primary one is a wax seal ---------- */
.btn {
  font-family: var(--display); font-weight: 600; font-size: 13px; letter-spacing: 0.04em; line-height: 1.2;
  color: var(--seal-text); border: 1px solid #4a120a; border-radius: 5px; padding: 7px 14px;
  background: radial-gradient(ellipse at 50% 25%, #b5473a 0%, var(--seal) 55%, var(--seal-dark) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 210, 170, 0.35), inset 0 -2px 0 rgba(0, 0, 0, 0.22), 0 2px 0 #3f0f08, 0 3px 5px rgba(0, 0, 0, 0.22);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.35); transition: transform 0.06s, box-shadow 0.06s, filter 0.1s;
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
}
.btn:hover { background: radial-gradient(ellipse at 50% 25%, #b5473a 0%, var(--seal) 55%, var(--seal-dark) 100%); filter: brightness(1.1); }
.btn:active:not(:disabled) { transform: translateY(2px); box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.4), 0 0 0 #3f0f08; }
.btn.ghost { color: var(--ink); border-color: var(--bronze); text-shadow: none;
  background: linear-gradient(#efe4c8, #d5c197); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55), 0 2px 0 var(--bronze-dark), 0 3px 4px rgba(0, 0, 0, 0.16); }
.btn.ghost:hover { background: linear-gradient(#f4ead2, #dccaa2); filter: none; }
.btn.ghost:active:not(:disabled) { box-shadow: inset 0 2px 3px rgba(60, 40, 15, 0.35), 0 0 0 var(--bronze-dark); }
.btn.small { padding: 4px 9px; font-size: 11.5px; }
.btn:disabled { opacity: 0.5; filter: grayscale(0.35); cursor: default; box-shadow: none; }
.btn .ico { width: 14px; height: 14px; }
.btn.seal { border-radius: 48% 52% 46% 54% / 55% 47% 53% 45%; min-width: 72px; min-height: 36px; padding: 7px 16px; }
.btn.seal.small { min-width: 0; min-height: 0; padding: 4px 11px; border-radius: 40% 46% 42% 48% / 55% 50% 52% 46%; }
.sealrow { text-align: center; margin-top: 10px; }
.chipbtn { font: 600 13px/1.2 var(--body); color: var(--ink); border: 1px solid var(--bronze); border-radius: 3px; padding: 2px 8px; margin: 2px 4px 2px 0;
  background: linear-gradient(#f0e6cc, #d9c8a0); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 1px 0 var(--bronze-dark); }
.chipbtn:hover { background: linear-gradient(#f6eed8, #e0d0aa); }
.chipbtn:active:not(:disabled) { transform: translateY(1px); box-shadow: inset 0 1px 2px rgba(60, 40, 15, 0.35); }
.chipbtn.on { background: linear-gradient(#a8392a, var(--seal)); border-color: var(--seal-dark); color: var(--seal-text); }
.iconbtn { width: 36px; height: 36px; border-radius: 50%; color: var(--ink); font: 700 16px var(--display);
  border: 1px solid #4a3510; background: radial-gradient(circle at 40% 32%, #f3dc9c, #c29d55 55%, #7a5a22 100%);
  box-shadow: inset 0 0 0 2px rgba(255, 240, 200, 0.35), 0 2px 4px rgba(0, 0, 0, 0.35); }
.iconbtn:active { transform: translateY(1px); box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.35); }
.iconbtn .ico { width: 20px; height: 20px; }
.linkbtn { color: var(--ink-soft); font-family: var(--body); }
.pill { background: var(--parchment-2); border: 1px solid rgba(138, 106, 47, 0.45); color: var(--ink); }
.pill.ai { background: #dfe2c2; color: #2f3f12; }
.pill.ai.off { background: #ead3bb; color: #6a2e12; }
kbd { font-family: var(--display); }

/* ---------- HUD: bronze-framed chips, ink bars, coin and weight with numbers, bronze sockets ---------- */
.clock b { font-family: var(--display); }
.clock span, .zone { color: var(--ink-soft); }
.zone.danger { color: var(--warn-ink); }
.vitals .heart { display: inline-flex; }
.vitals .heart .ico { width: 20px; height: 20px; }
.vitals .vbar { background: #2a1d10; border: 1px solid var(--bronze); border-radius: 3px; height: 15px; box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.6); }
.vitals .vbar > span.hp-ok { background: linear-gradient(#7f8d42, #4a5a1e); }
.vitals .vbar > span.hp-mid { background: linear-gradient(#c9a044, #8a6a1c); }
.vitals .vbar > span.hp-low { background: linear-gradient(#bd4a34, #7a1f12); }
.vitals .vbar > span.hp-regen { animation: hp-regen 1.6s ease-in-out infinite; } /* FAMA #35: healing by itself in a match */
@keyframes hp-regen { 0%, 100% { filter: none; } 50% { filter: brightness(1.35) saturate(1.2); box-shadow: 0 0 6px rgba(150, 200, 90, 0.7); } }
.vitals .vbar > b { font-family: var(--sans); color: #fbf0d6; }
.coin { gap: 5px; }
.coin::before { width: 16px; height: 16px; border: 0; border-radius: 0; background: var(--coin-img) center / contain no-repeat; }
.weight { display: inline-flex; align-items: center; gap: 4px; font-variant-numeric: tabular-nums; font-size: 14px; color: var(--ink-soft); }
.weight.over { color: var(--warn-ink); font-weight: 700; }
.purse .item { padding: 1px 7px 1px 2px; border-radius: 12px; border: 1px solid rgba(138, 106, 47, 0.75);
  background: radial-gradient(circle at 50% 35%, #f3e6c6, #d5c096); box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.22); }
.purse button.item.use { background: radial-gradient(circle at 50% 35%, #f6e2c8, #dcb998); border-color: var(--seal); }
.item i.swl { width: 17px; height: 17px; border-radius: 50%; }
.item i.swl::after { font-size: 10px; }
.toolset { color: var(--olive); font-style: italic; }
#prompt kbd, #crew kbd, #help kbd, .minicap kbd, #worldmap kbd { background: var(--ink); color: var(--parchment); }

/* ---------- the minimap: a round papyrus sheet in a bronze ring, with a ribbon under it ---------- */
.mapbox { padding: 0; display: flex; flex-direction: column; align-items: center; gap: 0; background: none; border: 0; box-shadow: none; width: 178px; }
.minimap-wrap { width: 170px; height: 170px; border-radius: 50%; box-shadow: 0 6px 14px rgba(10, 6, 2, 0.55); flex: none; }
.minimap { width: 170px; height: 170px; border-radius: 50%; background: transparent; display: block; }
.minicap.place-ribbon { position: relative; z-index: 1; margin-top: -12px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0;
  width: 176px; padding: 3px 20px 4px; color: var(--seal-text); font-weight: 400;
  background: linear-gradient(#ad3d2d, var(--seal) 55%, var(--seal-dark));
  clip-path: polygon(0 0, 100% 0, calc(100% - 10px) 50%, 100% 100%, 0 100%, 10px 50%); }
.place-ribbon .pr-name { font: 700 12px/1.25 var(--display); letter-spacing: 0.12em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.place-ribbon .pr-day { font: italic 12.5px/1.15 var(--body); color: #f8e6b8; white-space: nowrap; }
.place-ribbon kbd { position: absolute; right: 13px; top: 50%; transform: translateY(-50%); font-size: 10px; padding: 0 4px; background: rgba(40, 10, 5, 0.55); color: var(--seal-text); border-radius: 3px; }

/* ---------- the side panel: bookmark ribbons, summary card, collapsible sections ---------- */
#side { width: 304px; }
#side .tabs { display: flex; gap: 3px; padding: 0 6px; border-bottom: 1px solid var(--bronze); background: linear-gradient(rgba(90, 60, 25, 0.14), rgba(90, 60, 25, 0)); }
#side .tabs button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 5px 2px 10px; margin-bottom: -1px;
  font: 600 10.5px/1.1 var(--display); letter-spacing: 0.04em; color: var(--ink); border: 1px solid rgba(138, 106, 47, 0.7); border-top: 0;
  background: linear-gradient(#e2d2ab, #c9b285); clip-path: polygon(0 0, 100% 0, 100% 100%, 50% calc(100% - 6px), 0 100%); }
#side .tabs button .ico { width: 17px; height: 17px; }
#side .tabs button:hover { background: linear-gradient(#ecdfbd, #d6c197); }
#side .tabs button[aria-selected=true] { color: var(--seal-text); border-color: var(--seal-dark); background: linear-gradient(#a2372a, var(--seal) 60%, var(--seal-dark)); /* review r2: #a2372a (was #b0402f): the gold label reaches 4.5:1 */ }
#side .tabs button[aria-selected=true] .ico { filter: drop-shadow(0 0 1px rgba(255, 230, 170, 0.9)); }
.side-body { font-size: 15px; padding: 8px 10px 10px; }
.side-body ul { gap: 6px; }
.tabwrap { display: flex; flex-direction: column; }
.sumcard { display: flex; flex-direction: column; gap: 3px; margin: 0 0 6px; padding: 7px 9px; border: 1px solid rgba(138, 106, 47, 0.55); border-radius: 3px;
  background: rgba(255, 249, 230, 0.42); box-shadow: inset 0 0 0 2px rgba(255, 250, 235, 0.35); }
.sum-head { display: flex; align-items: center; gap: 6px; margin: 0; }
.sum-head b { font: 600 15px/1.2 var(--display); letter-spacing: 0.03em; }
.sum-head .lvl { margin-left: auto; font-size: 13px; color: var(--ink-soft); white-space: nowrap; }
.sum-head .crest { width: 20px; height: 20px; }
.sum-label { margin: 0; display: flex; align-items: center; gap: 6px; font: 600 12px var(--display); letter-spacing: 0.05em; text-transform: uppercase; }
.sum-line { margin: 0; font-size: 14px; line-height: 1.3; }
.sum-line.main { font-weight: 600; }
.sum-line.hint { color: var(--ink-soft); font-size: 13.5px; }
.stats { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.stat { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; font-variant-numeric: tabular-nums; }
.gov .ico { margin-right: 3px; }
.popline { display: flex; align-items: center; gap: 6px; }
.popline .lbl { font-size: 13.5px; color: var(--ink-soft); }
.popline b { font-variant-numeric: tabular-nums; font-size: 13.5px; }
.meter { flex: 1; min-width: 50px; height: 8px; border-radius: 4px; overflow: hidden; display: inline-block; background: rgba(59, 42, 26, 0.16); border: 1px solid rgba(90, 65, 40, 0.45); box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.25); }
.meter > i { display: block; height: 100%; background: var(--olive); }
.meter.low > i { background: linear-gradient(90deg, #7a1f12, var(--seal)); }
.meter.mid > i { background: linear-gradient(90deg, #8a6a1c, #c49a2a); }
.meter.good > i { background: linear-gradient(90deg, #5d6b2a, #4a5a1e); }
.meter.ink > i { background: linear-gradient(90deg, #6b5032, #3b2a1a); }
.standing b.good { color: var(--olive); }
.standing b.bad, .warn { color: var(--warn-ink); }
.today { border-top: 1px dotted rgba(90, 65, 40, 0.5); padding-top: 3px; margin-top: 2px; }
.today-h { display: block; font: 600 10.5px var(--display); letter-spacing: 0.12em; text-transform: uppercase; color: var(--bronze-dark); }
.urgent { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 6px; padding: 4px 6px; margin: -1px -2px 3px; border-radius: 3px;
  border: 1px solid rgba(142, 42, 30, 0.55); border-left: 3px solid var(--seal); background: linear-gradient(90deg, rgba(142, 42, 30, 0.17), rgba(142, 42, 30, 0.05));
  color: var(--warn-ink); font-weight: 600; font-size: 14px; line-height: 1.25; }
.urgent .urgent-seal { width: 20px; height: 20px; }
.urgent-text { flex: 1 1 140px; min-width: 0; }
.urgent-act { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.urgent small { color: var(--warn-ink); font-weight: 400; }

details.sec { border-top: 1px solid rgba(138, 106, 47, 0.4); }
details.sec:last-child { border-bottom: 1px solid rgba(138, 106, 47, 0.25); }
details.sec > summary { list-style: none; display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; align-items: center; gap: 0 6px; padding: 6px 2px 6px 1px; cursor: pointer; user-select: none; border-radius: 2px; }
details.sec > summary::-webkit-details-marker { display: none; }
details.sec > summary::after { content: ""; width: 6px; height: 6px; margin: 0 5px 2px 2px; border-right: 1.6px solid var(--bronze-dark); border-bottom: 1.6px solid var(--bronze-dark); transform: rotate(-45deg); transition: transform 0.15s; }
details.sec[open] > summary::after { transform: rotate(45deg); margin-bottom: 4px; }
details.sec > summary:hover { background: rgba(255, 248, 228, 0.45); }
details.sec > summary:hover .sec-title { color: var(--seal); }
details.sec > summary:focus-visible { outline: 2px solid var(--gold); outline-offset: 0; }
details.sec > summary .ico { width: 16px; height: 16px; }
.sec-title { font: 600 12px/1.2 var(--display); letter-spacing: 0.06em; text-transform: uppercase; white-space: nowrap; }
.sec-sum { font-size: 13.5px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.sec-body { padding: 2px 2px 9px 4px; font-size: 14px; }
.sec-body > p { margin: 2px 0 6px; }
details.sec[open] > .sec-body { animation: unroll 0.18s ease-out; }
.subhead { margin: 8px 0 3px; font: 600 12px var(--display); letter-spacing: 0.05em; text-transform: uppercase; }
.pathpick { margin: 0 0 6px; font-size: 13.5px; color: var(--ink-soft); }
details.qhint { display: inline-block; vertical-align: middle; margin-left: 4px; }
details.qhint > summary { list-style: none; display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; cursor: help;
  font: 700 10.5px/1 var(--display); color: var(--bronze-dark); background: var(--parchment-2); border: 1px solid var(--bronze); }
details.qhint > summary::-webkit-details-marker { display: none; }
details.qhint[open] { display: block; margin: 3px 0 0; }
.qtext { display: block; margin-top: 3px; padding: 3px 7px; font-size: 13px; font-style: italic; color: var(--ink-soft); border-left: 2px solid var(--bronze); background: rgba(255, 249, 230, 0.55); }
.side-body table.mini { font-size: 13px; }
table.mini tr.cat-row th { padding-top: 6px; font: 600 11px var(--display); letter-spacing: 0.06em; text-transform: uppercase; color: var(--bronze-dark); border-bottom: 1px solid rgba(138, 106, 47, 0.4); }
table.mini tr.cat-row .ico { width: 13px; height: 13px; vertical-align: -2px; }
table.mini .trend-up { color: var(--warn-ink); }
.poolline { font-size: 12.5px; margin: 6px 0 0; color: var(--ink-soft); }
.news li { border-left: 3px solid var(--bronze-light); padding-left: 8px; }
.news li.coin-log { border-color: var(--olive); }
.news li.skill, .news li.warn { border-color: var(--seal); }
.jobprog { display: flex; align-items: center; gap: 6px; margin: 2px 0; }
.jobprog b { font-size: 12px; font-variant-numeric: tabular-nums; color: var(--ink-soft); }
.reward { display: inline-flex; align-items: center; gap: 3px; font-weight: 600; color: var(--ink); }
.reward .ico { width: 13px; height: 13px; }
.rest { margin-top: 4px; padding-top: 4px; border-top: 1px dotted rgba(90, 65, 40, 0.45); }
.rest .svc-h { margin: 0 0 3px; }
.services .sumcard .btn.ghost { align-self: flex-start; margin-top: 4px; }
.lordbox, .govbox, .warboard, .supply, .supply-body { background: rgba(255, 249, 230, 0.35); border-color: rgba(138, 106, 47, 0.45); border-radius: 3px; }
.warboard { margin: 0; }
.dstate { background: var(--stone); color: var(--ink); }
.dstate.pact { background: #d5dfbc; color: #2f4a12; }
.dstate.war { background: #ecc3b6; color: var(--warn-ink); }
.bar { background: rgba(59, 42, 26, 0.14); }
.bar > span { background: linear-gradient(90deg, #5d6b2a, var(--olive)); }
.online-list .grouplist li { padding: 2px 0; }

/* ---------- the dialogue: a wax tablet in a frame, the villager in a bronze medallion ---------- */
.dlg-head { border-bottom: 1px solid var(--bronze); background: linear-gradient(rgba(255, 250, 235, 0.35), rgba(255, 250, 235, 0)); }
.dlg-who h2 { font-size: 21px; }
.medallion { flex: none; display: inline-block; padding: 4px; border-radius: 50%; line-height: 0;
  background: radial-gradient(ellipse at 35% 28%, #f2d891, #b88f45 45%, #6b4e1c 80%, #3e2c0c);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4), inset 0 0 0 1px rgba(255, 240, 200, 0.4); }
.medallion canvas { border-radius: 50%; display: block; box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.4); }
.dlg-head .medallion canvas, .dlg-head canvas[data-art="portrait"] { border-radius: 50%; }
.dlg-log { background: linear-gradient(rgba(120, 85, 40, 0.08), rgba(120, 85, 40, 0.16)); box-shadow: inset 0 2px 6px rgba(70, 45, 15, 0.28); margin: 0 10px; border-radius: 2px; border: 1px solid rgba(138, 106, 47, 0.4); }
.msg { font-size: 15.5px; line-height: 1.38; border-radius: 3px; }
.msg.npc { background: #f6eedb; border: 1px solid rgba(138, 106, 47, 0.45); box-shadow: 0 1px 2px rgba(60, 40, 15, 0.15); }
.msg.me { background: #e1e2c4; border: 1px solid rgba(74, 90, 30, 0.35); }
.msg.sys { color: var(--ink-soft); }
.msg.outcome { color: #5a3d0e; border-left-color: var(--bronze); }
.msg.typing { display: inline-flex; align-items: center; min-width: 76px; min-height: 30px; }
.quillwrite { position: relative; display: inline-block; width: 66px; height: 22px; }
.msg.npc.streaming::after { content: ''; display: inline-block; width: 7px; height: 0.95em; margin-left: 2px; vertical-align: -0.12em; background: var(--ink); opacity: 0.55; animation: inkblink 0.9s steps(2) infinite; } /* bug #20: the reply is still being written */
@keyframes inkblink { 50% { opacity: 0; } }
.quillwrite .inkline { position: absolute; left: 2px; bottom: 4px; height: 1.6px; width: 0; border-radius: 1px; background: var(--ink); animation: inkline 1.5s ease-in-out infinite; }
.quillwrite .quill { position: absolute; left: 0; bottom: 3px; width: 20px; height: 20px; animation: quill 1.5s ease-in-out infinite; transform-origin: 0 100%; }
.msg.typing .thinking { margin-left: 6px; font-size: 0.86em; color: var(--ink-soft); font-style: italic; } /* bug #20: no words after 1.2 s */
@keyframes inkline { 0% { width: 0; opacity: 1; } 78% { width: 50px; opacity: 1; } 100% { width: 50px; opacity: 0; } }
@keyframes quill { 0% { transform: translate(0, 0) rotate(0); } 15% { transform: translate(8px, -2px) rotate(-7deg); } 32% { transform: translate(17px, 0) rotate(3deg); } 48% { transform: translate(26px, -2px) rotate(-6deg); } 64% { transform: translate(36px, 0) rotate(3deg); } 78% { transform: translate(50px, -1px) rotate(-3deg); } 100% { transform: translate(52px, -6px) rotate(-12deg); } }
.dlg-tabs { border-bottom: 1px solid var(--bronze); }
.tabs button { font-family: var(--display); font-size: 12.5px; letter-spacing: 0.04em; color: var(--ink-soft); }
.tabs button[aria-selected=true] { color: var(--seal); border-bottom-color: var(--seal); }
.dlg-diary { font-family: var(--body); background: linear-gradient(#f3e9d0, #e6d6b2); }
.dlg-input input, .dlg-amt, .dlg-gsel { background: #f5ecd5; border-color: var(--bronze); }

/* ---------- chat: darker, see-through papyrus; channel colours kept ---------- */
#chat { background: rgba(214, 196, 152, 0.9); border: 1px solid var(--bronze); background-image: var(--tex-noise); backdrop-filter: blur(2px); }
.chat-tabs { border-bottom-color: var(--bronze); }
.chat-tabs button { font-family: var(--display); font-size: 11px; color: var(--ink-soft); }
.chat-tabs button[aria-selected=true] { color: var(--seal); border-bottom-color: var(--seal); }
.chat-list { font-size: 14px; color: var(--ink); }
.chat-list .ch-group, .chat-list .ch-group b { color: #1a5222; }
.chat-list .ch-town .pfx { color: #5e3f05; }
.chat-list .ch-whisper, .chat-list .ch-whisper b { color: #5e2a72; }
.chat-input { background: rgba(245, 236, 213, 0.92); font-family: var(--body); }

/* ---------- shop, bag, workbench: a papyrus sheet with tables and categories ---------- */
#shop, #inv { padding: 14px 16px; }
#shop .head, #inv .head { border-bottom: 1px solid rgba(138, 106, 47, 0.45); padding-bottom: 6px; }
#shop th, .goodshead th { font: 600 10.5px var(--display); letter-spacing: 0.07em; text-transform: uppercase; color: var(--bronze-dark); }
#shop td { border-top: 1px solid rgba(90, 65, 40, 0.2); }
.shopnote { margin: 4px 0 0; color: var(--ink-soft); font-size: 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.shopnote details.qhint[open] { flex-basis: 100%; }
.shopfilter { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 8px 0 4px; }
.segbtn { font: 600 13px/1.2 var(--body); color: var(--ink); border: 1px solid var(--bronze); border-radius: 3px; padding: 3px 9px;
  background: linear-gradient(#f0e6cc, #d9c8a0); box-shadow: 0 1px 0 var(--bronze-dark); }
.segbtn.on { background: linear-gradient(#a8392a, var(--seal)); color: var(--seal-text); border-color: var(--seal-dark); }
.segbtn:active { transform: translateY(1px); box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.3); }
.goodsearch { flex: 1 1 110px; max-width: 210px; margin-left: auto; font-size: 14px; padding: 4px 8px; }
table.goodstable, table.crafttable { width: 100%; table-layout: fixed; border-collapse: collapse; margin: 0; font-variant-numeric: tabular-nums; }
table.goodshead { margin-top: 4px; }
table.goodshead th { padding: 2px 4px; border-bottom: 1px solid var(--bronze); }
#shop table.goodstable td, #shop table.crafttable td { padding: 4px; vertical-align: middle; }
col.c-num { width: 48px; } col.c-act { width: 166px; } col.c-make { width: 34%; } col.c-needs { width: auto; }
#shop details.cat > summary { padding: 6px 2px; }
#shop details.cat > .sec-body { padding: 0 0 6px; }
#shop tr.dim > td { opacity: 0.55; }
#shop tr.dim:hover > td { opacity: 0.85; }
td.price::before, .price-coin::before { content: ""; display: inline-block; width: 12px; height: 12px; margin-right: 3px; vertical-align: -1px; background: var(--coin-img) center / contain no-repeat; }
button.nobuy { font: inherit; padding: 0 9px; color: #6b6052; background: #d9d1bf; border: 1px solid #b7a98c; border-radius: 3px; cursor: help; }
.needs .need { display: inline-block; margin-right: 6px; color: var(--warn-ink); }
.needs .need.ok { color: var(--olive); }
.art-item i.sw { width: 22px; height: 22px; margin: 0 6px 0 2px; }
i.swl { position: relative; display: inline-grid; place-items: center; flex: none; border-radius: 6px; box-shadow: inset 0 0 0 1px rgba(40, 26, 18, 0.35), inset 0 -3px 0 rgba(0, 0, 0, 0.16), inset 0 2px 0 rgba(255, 255, 255, 0.18); }
i.swl::after { content: attr(data-l); font: 700 12px/1 var(--display); color: rgba(255, 251, 238, 0.96); text-shadow: 0 1px 1px rgba(0, 0, 0, 0.55); }
.baglist li i.swl { width: 22px; height: 22px; }
.baglist li.cat { display: flex; gap: 6px; align-items: center; padding: 8px 2px 3px; border-top: 1px solid var(--bronze); font: 600 11px var(--display); letter-spacing: 0.06em; text-transform: uppercase; color: var(--bronze-dark); }
.baglist li.cat b { font-weight: 600; }
.bag h3 { display: flex; align-items: center; gap: 5px; }
.baggrid, .catgrid { display: grid; gap: 2px; border-radius: 3px; padding: 2px; width: max-content; border: 1px solid rgba(138, 106, 47, 0.55);
  background-color: rgba(120, 85, 40, 0.1); background-image: linear-gradient(rgba(90, 65, 40, 0.16) 1px, transparent 1px), linear-gradient(90deg, rgba(90, 65, 40, 0.16) 1px, transparent 1px); background-size: calc(var(--cell) + 2px) calc(var(--cell) + 2px); }
.bag details.cat .sec-body { padding: 2px 0 6px; }
.bagitem { border-color: rgba(90, 65, 40, 0.5); border-radius: 3px; }
.slot { border-color: rgba(138, 106, 47, 0.6); background: rgba(255, 249, 230, 0.5); border-radius: 3px; }
.slot.full { background: #f6eedb; }
.doll-canvas { background: radial-gradient(circle at 50% 60%, #f3e8cf, #dcc89e); border: 1px solid var(--bronze); border-radius: 3px; }
.invmsg { background: #f2e3bd; border: 1px solid rgba(138, 106, 47, 0.5); }

/* ---------- pop-ups as unrolled scrolls: a rod above and below, a wax-seal button ---------- */
.scrollpop::before, .scrollpop::after, #help::before, #help::after, #ginvite::before, #ginvite::after, #askname::before, #askname::after {
  content: ""; display: block; height: 11px; border-radius: 6px; background: var(--rod); box-shadow: 0 2px 3px rgba(0, 0, 0, 0.3); }
.scrollpop::before, #help::before, #ginvite::before, #askname::before { margin: -8px -12px 10px; }
.scrollpop::after, #help::after, #ginvite::after, #askname::after { margin: 10px -12px -8px; }
#askname::before, #askname::after { margin-left: -16px; margin-right: -16px; }
#vote h2, #scenepop b, #help h2 { font-family: var(--display); color: var(--seal-dark); }
#vote .agenda li p { font-size: 15.5px; }
#celebrate { background-image: var(--paper-layers); background-color: var(--parchment); border: 1px solid var(--bronze); box-shadow: var(--burn), 0 8px 30px rgba(60, 30, 0, 0.3); border-radius: 3px; }
#celebrate b { color: var(--seal-dark); }
/* the Acta Diurna joins the same paper and type */
.acta-sheet { font-family: var(--body); background-color: var(--parchment); background-image: var(--paper-layers); border: 1px solid var(--bronze); box-shadow: var(--burn), 0 18px 40px rgba(0, 0, 0, 0.45); color: var(--ink); border-radius: 3px; }
.acta-sheet::before, .acta-sheet::after { content: ""; display: block; height: 11px; border-radius: 6px; background: var(--rod); margin: -14px -20px 8px; box-shadow: 0 2px 3px rgba(0, 0, 0, 0.3); }
.acta-sheet::after { margin: 10px -20px -8px; }
.acta-item { font-size: 16px; }
.gfx-simple .scrollpop::before, .gfx-simple .scrollpop::after, .gfx-simple #help::before, .gfx-simple #help::after, .gfx-simple .acta-sheet::before, .gfx-simple .acta-sheet::after { background: var(--bronze); height: 3px; box-shadow: none; }

/* the region map: a large unrolled scroll */
#worldmap { padding: 0 16px 12px; }
#worldmap::before, #worldmap::after { content: ""; display: block; flex: none; height: 13px; border-radius: 7px; background: var(--rod); margin: -6px -22px 8px; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.35); }
#worldmap::after { margin: 8px -22px -6px; }
.wm-head h2 { color: var(--ink); letter-spacing: 0.12em; }
.wm-wrap { border: 1px solid var(--bronze); border-radius: 2px; box-shadow: inset 0 0 0 1px rgba(255, 240, 200, 0.4), 0 1px 3px rgba(0, 0, 0, 0.25); }
.wm-place { border-color: rgba(138, 106, 47, 0.55); background: rgba(255, 249, 230, 0.35); border-radius: 3px; }
.wm-place b { letter-spacing: 0.05em; }
.wm-place.on { border-color: var(--seal); background: rgba(216, 176, 78, 0.22); }

/* ---------- panels open like a scroll unrolling (no flashing) ---------- */
@keyframes unroll { from { clip-path: inset(0 0 calc(100% - 18px) 0); opacity: 0.6; } to { clip-path: inset(0 0 0 0); opacity: 1; } }
@keyframes sheetup { from { transform: translateY(24px); opacity: 0.6; } to { transform: none; opacity: 1; } }
#shop, #inv, #help, #vote, #scenepop, #worldmap, #dialog, #ginvite, #askname, .acta-sheet, #pmenu { animation: unroll 0.18s ease-out; }
@media (prefers-reduced-motion: reduce) {
  #shop, #inv, #help, #vote, #scenepop, #worldmap, #dialog, #ginvite, #askname, .acta-sheet, #pmenu, details.sec[open] > .sec-body { animation: none; }
  .quillwrite .quill, .quillwrite .inkline { animation: none; }
  .quillwrite .inkline { width: 30px; }
}

/* ---------- phones: panels come up from the bottom ---------- */
@media (max-width: 720px) {
  #shop, #inv, #help, #vote, #scenepop { left: 0; right: 0; top: auto; bottom: 0; transform: none; width: 100%; max-width: 100%; max-height: 86vh; max-height: 86dvh;
    border-radius: 12px 12px 0 0; border-bottom: 0; padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px)); animation: sheetup 0.18s ease-out; }
  #dialog { left: 0; right: 0; bottom: 0; transform: none; width: 100%; border-radius: 12px 12px 0 0; border-bottom: 0; animation: sheetup 0.18s ease-out; }
  #side:not(.collapsed) { position: fixed; left: 0; right: 0; top: auto; bottom: 0; width: 100%; max-height: 62vh; max-height: 62dvh; border-radius: 12px 12px 0 0; border-bottom: 0;
    padding-bottom: env(safe-area-inset-bottom, 0px); animation: sheetup 0.18s ease-out; z-index: 2; }
  #side:not(.collapsed) .tabs { padding-top: 6px; }
  #side:not(.collapsed) .tabs::before { content: ""; position: absolute; left: 50%; top: 2px; width: 40px; height: 4px; margin-left: -20px; border-radius: 2px; background: rgba(90, 65, 40, 0.45); }
  body:has(#side:not(.collapsed)) #touch { visibility: hidden; }
  /* review r2: the collapsed tab strip starts right of the minimap column (it covered the minimap's top at 360-390 px) */
  #side.collapsed { left: 136px; right: 10px; width: auto; }
  #side.collapsed .tabs { padding: 0 3px; gap: 2px; }
  #side.collapsed .tabs button { min-width: 0; font-size: 9px; letter-spacing: 0; overflow: hidden; text-overflow: ellipsis; }
  .side-body { max-height: calc(62vh - 60px); }
  col.c-act { width: 128px; } col.c-num { width: 36px; }
  .goodsearch { max-width: none; flex-basis: 100%; margin-left: 0; }
  .minicap.place-ribbon { width: 118px; padding: 2px 14px 3px; margin-top: -9px; }
  .place-ribbon .pr-name { font-size: 10px; letter-spacing: 0.06em; }
  .place-ribbon .pr-day { font-size: 11px; }
  .place-ribbon kbd { display: none; }
  .mapbox { width: 120px; }
  .minimap-wrap { width: 112px; height: 112px; }
  @media (prefers-reduced-motion: reduce) { #shop, #inv, #help, #vote, #scenepop, #dialog, #side:not(.collapsed) { animation: none; } }
}
details.sec.supply { margin: 0; padding: 0; border-radius: 0; background: none; border-width: 1px 0 0; border-style: solid; border-color: rgba(138, 106, 47, 0.4); overflow-wrap: normal; }
.supply-body { margin: 2px 0 0; padding: 6px; border: 1px solid rgba(138, 106, 47, 0.45); }
.today .today-h { display: inline; margin-right: 5px; }
.today .sum-line:first-of-type { display: inline; }
.today .sum-line:nth-of-type(2) { margin-top: 1px; }
.chat-list li.npc { color: var(--ink); }
.chat-list li.npc b { color: #6a3e14; }
.chat-list li.npc.overheard { color: #4e3c2a; font-style: italic; opacity: 0.82; } /* overheard: still dimmed and italic in the papyrus theme */
.chat-list li.npc.overheard b { color: #6a4e2c; }
.chat-list .ch-system { color: var(--ink-soft); }
ul.skills { display: grid; grid-template-columns: 1fr 1fr; gap: 5px 14px; }
ul.skills .skill-row { font-size: 13.5px; gap: 1px 4px; }
ul.skills .skill-row b { font-weight: 600; font-size: 12.5px; color: var(--ink-soft); }
ul.skills .bar { height: 4px; }
.mastery { font-size: 13px; }
.mastery .empty { font-size: 12.5px; }
.sumcard { gap: 2px; padding: 6px 8px; }
@media (max-width: 720px) {
  #shop table.goodstable td, #shop table.crafttable td { padding: 3px 2px; font-size: 14px; }
  #shop table.goodstable td:last-child { white-space: normal !important; text-align: right; }
  #shop table.goodstable td:last-child .btn { margin: 1px 0; }
  td.price::before { display: none; }
  col.c-act { width: 104px; } col.c-num { width: 33px; }
  table.goodshead th { font-size: 9px; letter-spacing: 0; padding: 2px; }
  .art-item { gap: 3px; }
  .art-item .art-ico, .art-item i.sw { width: 20px; height: 20px; margin: 0 3px 0 0; }
}
@media (max-width: 760px) { .minimap { width: 112px; height: 112px; } .minimap-wrap { width: 112px; height: 112px; } .mapbox { width: 120px; } .minicap.place-ribbon { width: 118px; } }

/* ---------------------------------------------------------------- FAMA match mode (ui/match.js) */
#title .match-row { margin: 4px 0 14px; }
.btn.match-btn { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 11px 22px; min-width: min(340px, 100%);
  background: linear-gradient(180deg, var(--seal), var(--seal-dark)); color: var(--seal-text); border: 1px solid var(--bronze-dark); box-shadow: inset 0 0 0 2px rgba(242, 214, 138, 0.25); }
.btn.match-btn b { font: 700 17px var(--display); letter-spacing: 0.06em; }
.btn.match-btn small { font: 400 13px var(--body); color: #f4e6c4; opacity: 0.9; }
.match-tab .m-card { gap: 6px; border-left: 4px solid var(--house, var(--bronze)); }
.match-tab .m-row { display: flex; align-items: center; gap: 12px; }
.match-tab .m-timer { font: 700 24px var(--display); letter-spacing: 0.04em; font-variant-numeric: tabular-nums; color: var(--ink); }
.match-tab .m-timer.late { color: var(--warn-ink); }
.match-tab .m-phase { display: flex; flex-direction: column; line-height: 1.1; }
.match-tab .m-phase b { font: 600 14px var(--display); letter-spacing: 0.05em; }
.match-tab .m-phase small, .match-tab .m-house small, .match-tab .m-role small { color: var(--ink-soft); font-size: 12px; }
.match-tab .m-money { margin-left: auto; display: flex; align-items: center; gap: 4px; font-size: 16px; }
.match-tab .m-house { display: flex; align-items: center; gap: 8px; }
.match-tab .m-house > div, .match-tab .m-role { display: flex; flex-direction: column; }
.match-tab .m-crest { width: 36px; height: 36px; object-fit: contain; }
.match-tab .m-house-name { font: 700 15px var(--display); color: var(--house, var(--ink)); letter-spacing: 0.04em; }
.match-tab .m-role-name { font-weight: 600; }
.match-tab .m-partner, .match-tab .m-heads, .match-tab .m-over { margin: 0; font-size: 14px; }
.match-tab .m-wreaths { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; text-align: center; }
.match-tab .m-wreath { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 12px; min-width: 0; }
.match-tab .m-wreath b { font: 600 11px var(--display); letter-spacing: 0.03em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.match-tab .m-ring { width: 52px; height: 52px; border-radius: 50%; background: url("../assets/art/match/wreath_ring_64.webp") center / contain no-repeat; filter: grayscale(1); opacity: 0.8; }
.match-tab .m-famas { display: flex; gap: 4px; }
.match-tab .m-fama { min-width: 18px; padding: 0 3px; border-radius: 3px; background: var(--house); color: #fbf1dc; font-weight: 600; font-variant-numeric: tabular-nums; }
.match-tab .m-notes { margin: 0; padding-left: 16px; font-size: 14px; }
.match-tab .m-notes small { color: var(--ink-soft); }

/* match: lobby, reveal, wreaths (FAMA F1/F2: ui/matchscreens.js, ui/match.js WreathStrip) */
.match-tab canvas.m-ring { width: 52px; height: 52px; background: none; filter: none; opacity: 1; border-radius: 0; }
.m-hudwreaths { display: flex; gap: 2px; padding: 3px 4px; max-width: 200px; }
.m-hw { display: flex; flex-direction: column; align-items: center; width: 60px; min-width: 0; cursor: help; border-radius: 6px; outline-offset: 1px; }
.m-hw canvas { width: 48px; height: 48px; display: block; }
.m-hw-name { font: 600 10px var(--display); letter-spacing: 0.02em; color: var(--ink); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-hw.pulse .m-hw-name { color: var(--seal); }
@media (max-width: 760px) { .m-hudwreaths { padding: 2px; } .m-hw { width: 40px; } .m-hw canvas { width: 36px; height: 36px; } .m-hw-name { font-size: 8px; } }

.m-screen { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 16px; overflow: auto; background: rgba(15, 10, 5, 0.72); }
.m-screen .card { position: relative; }
.m-screen .row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.m-screen h1 { font-family: var(--display); margin: 0; }
.m-screen .sub { color: var(--ink-soft); margin: 4px 0 12px; }
.m-lobby, .m-reveal { background-color: #2b1d12; background-position: center; background-size: cover; background-repeat: no-repeat; }
.m-lobby-card { width: min(560px, 100%); padding: 22px 24px; text-align: center; background: rgba(233, 220, 192, 0.95); }
.m-lobby-card h1 { font-size: clamp(34px, 7vw, 52px); letter-spacing: 0.12em; color: var(--seal-dark); }
.m-crests { display: flex; justify-content: center; gap: 14px; }
.m-crests img { width: 44px; height: 44px; object-fit: contain; }
.m-lobby-body { display: flex; flex-direction: column; gap: 10px; text-align: left; margin: 6px 0 10px; }
.m-opt { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 10px; align-items: start; }
.m-lbl { font: 600 12px var(--display); letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-soft); padding-top: 6px; }
.m-val { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.m-val small { color: var(--ink-soft); font-size: 13px; }
.m-check .m-val { flex-direction: row; align-items: center; gap: 6px; }
.m-seg { display: flex; flex-wrap: wrap; gap: 4px; }
.m-segbtn { font: 600 14px var(--sans); padding: 5px 10px; border: 1px solid var(--line); border-radius: 6px; background: #fffaf0; color: var(--ink); cursor: pointer; min-height: 32px; }
.m-segbtn[aria-checked=true] { background: var(--seal); border-color: var(--seal-dark); color: var(--seal-text); }
.m-rules { font-size: 14px; color: var(--ink-soft); margin: 4px 0; }
.m-rules.m-ai { font-style: italic; color: var(--ink); font-weight: 600; }
.m-warn { color: var(--warn-ink); font-size: 14px; }

.m-rolecard { width: min(760px, 100%); display: grid; grid-template-columns: minmax(0, 260px) minmax(0, 1fr); gap: 0; overflow: hidden; border-top: 6px solid var(--house); }
.m-card-art { position: relative; background: #2b1d12; display: flex; align-items: center; justify-content: center; }
.m-card-img { width: 100%; height: 100%; max-height: 420px; object-fit: cover; display: block; border: 6px solid var(--bronze); box-shadow: inset 0 0 0 2px var(--bronze-light); }
.m-card-name { position: absolute; left: 0; right: 0; bottom: 12px; text-align: center; font: 700 22px var(--display); letter-spacing: 0.1em; color: var(--seal-text); text-shadow: 0 2px 4px #000; text-transform: uppercase; }
.m-card-text { padding: 18px 20px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.m-card-text p { margin: 2px 0; }
.m-card-text h3 { margin: 8px 0 0; font-family: var(--display); }
.m-kicker { font: 600 12px var(--display); letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-soft); }
.m-house-line { display: flex; align-items: center; gap: 10px; }
.m-house-line h2 { margin: 0; font-family: var(--display); color: var(--house); }
.m-card-crest { width: 72px; height: 72px; object-fit: contain; }
@media (max-width: 600px) { .m-rolecard { grid-template-columns: 1fr; } .m-card-art { max-height: 220px; } .m-card-img { max-height: 220px; object-position: center 20%; } }

.m-phasebanner { position: fixed; left: 50%; top: 22%; transform: translateX(-50%); z-index: 35; pointer-events: none; text-align: center; padding: 14px 34px; background: rgba(233, 220, 192, 0.96); border: 2px solid var(--bronze); border-bottom: 4px solid var(--house, var(--seal)); border-radius: 6px; box-shadow: var(--shade); animation: m-in 0.5s ease-out; transition: opacity 0.9s, transform 0.9s; max-width: calc(100vw - 32px); }
.m-phasebanner b { display: block; font: 700 clamp(22px, 5vw, 34px) var(--display); letter-spacing: 0.08em; color: var(--seal-dark); }
.m-phasebanner small { color: var(--ink-soft); font-size: 15px; }
.m-phasebanner.out { opacity: 0; transform: translateX(-50%) translateY(-12px); }
@keyframes m-in { from { opacity: 0; transform: translateX(-50%) scale(0.9); } }

.m-reveal { align-items: start; }
.m-reveal-card { width: min(980px, 100%); padding: 0 0 18px; background: rgba(233, 220, 192, 0.97); overflow: hidden; }
.m-reveal-card > h2 { font: 600 16px var(--display); letter-spacing: 0.06em; margin: 14px 20px 6px; color: var(--ink); border-bottom: 1px solid var(--line); padding-bottom: 3px; }
.m-reveal-card > p, .m-reveal-card > ul { margin-left: 20px; margin-right: 20px; }
.m-rv-hero { position: relative; aspect-ratio: 16 / 6; background: #2b1d12; overflow: hidden; }
.m-rv-hero.none { aspect-ratio: auto; height: 56px; background: var(--parchment-2); }
.m-rv-heroimg { width: 100%; height: 100%; object-fit: cover; display: block; }
.m-rv-herotitle { position: absolute; left: 0; right: 0; bottom: 10px; text-align: center; font: 700 clamp(26px, 6vw, 46px) var(--display); letter-spacing: 0.14em; text-transform: uppercase; color: var(--seal-text); text-shadow: 0 2px 8px #000; }
.m-rv-hero.none .m-rv-herotitle { color: var(--ink); text-shadow: none; bottom: 8px; font-size: 28px; }
.m-rv-head { display: flex; align-items: center; gap: 12px; padding: 12px 20px 0; position: relative; }
.m-rv-head h1 { color: var(--house); font-size: clamp(22px, 4.5vw, 32px); }
.m-rv-victory { width: 84px; height: 84px; object-fit: contain; }
.m-rv-crest { width: 56px; height: 56px; object-fit: contain; position: absolute; left: 34px; top: 26px; }
.m-rv-towns { padding: 0 20px; }
.m-rv-wreaths { width: 100%; height: 96px; display: block; }
.m-rv-townnames { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; font: 600 13px var(--display); }
.m-rv-tablewrap { padding: 0 20px; overflow-x: auto; }
.m-rv-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.m-rv-table th { text-align: left; font: 600 12px var(--sans); text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-soft); border-bottom: 1px solid var(--line); padding: 4px; }
.m-rv-table td { padding: 5px 4px; border-bottom: 1px solid rgba(90, 65, 40, 0.15); vertical-align: middle; }
.m-rv-table tr td:first-child { border-left: 4px solid var(--house); padding-left: 8px; }
.m-rv-table tr.me { background: rgba(201, 153, 58, 0.18); }
.m-rv-table tr.dead td { color: #7a5a45; }
.m-rv-house { white-space: nowrap; }
.m-rv-house img { width: 22px; height: 22px; object-fit: contain; vertical-align: middle; margin-right: 4px; }
.m-rv-chart { display: block; width: calc(100% - 40px); height: 160px; margin: 0 20px; }
.m-rv-lies small { color: var(--ink-soft); }
.m-rv-acta { font-style: italic; background: rgba(255, 248, 230, 0.6); border-left: 3px solid var(--bronze); padding: 8px 12px; }
.m-rv-actions { margin-top: 16px; padding: 0 20px; }
.m-rv-status { display: block; text-align: center; color: var(--olive); font-size: 14px; min-height: 18px; margin-top: 6px; }
.m-rv-sharetext { display: block; width: calc(100% - 40px); margin: 6px 20px; height: 120px; font: 12px var(--sans); }
@media (max-width: 600px) {
  .m-screen { padding: 8px; }
  .m-rv-table thead { display: none; }
  .m-rv-table, .m-rv-table tbody, .m-rv-table tr, .m-rv-table td { display: block; width: 100%; }
  .m-rv-table tr { border-left: 4px solid var(--house); margin-bottom: 8px; padding: 4px 6px; background: rgba(255, 248, 230, 0.5); }
  .m-rv-table tr td:first-child { border-left: 0; padding-left: 4px; }
  .m-rv-table td { border: 0; padding: 1px 4px; }
  .m-rv-table td::before { content: attr(data-l) ": "; color: var(--ink-soft); font-size: 12px; }
  .m-rv-table td:first-child::before { content: ""; }
  .m-rv-chart { height: 300px; }
  .m-opt { grid-template-columns: 1fr; gap: 2px; }
  .m-lbl { padding-top: 0; }
}

/* K2 title: FAMA: Whispers of Rome over the lobby art; two equal main buttons; readable text everywhere */
#title.fama-bg { background: linear-gradient(rgba(20, 12, 6, 0.1), rgba(20, 12, 6, 0.5)), var(--art-title) center / cover no-repeat, #2a1d12; }
#title .title-card { width: min(600px, 100%); background: rgba(240, 228, 200, 0.94); }
#title h1.fama-title { display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--seal-dark); }
#title .ft-main { font: 700 clamp(40px, 9vw, 64px) var(--display); letter-spacing: 0.16em; line-height: 1; }
#title .ft-sub { font: 600 clamp(16px, 3.6vw, 22px) var(--display); letter-spacing: 0.22em; text-transform: uppercase; color: var(--bronze-dark); }
#title .title-card .sub { color: var(--ink); font-size: 17px; font-style: italic; margin: 10px 0 18px; }
#title .title-mains { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 0 0 12px; }
#title .btn.title-main { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 12px 14px; min-width: 0; min-height: 64px; }
#title .btn.title-main b { font: 700 18px var(--display); letter-spacing: 0.05em; }
#title .btn.title-main small { font: 400 13px var(--body); }
#title .btn.match-btn small, #title .btn.wander-btn small { color: #f6e8c6; opacity: 1; }
#title .btn.wander-btn { background: linear-gradient(180deg, #4f5e24, #36421a); border-color: #2a3312; color: #f6ecd0; }
#title .btn.wander-btn[aria-expanded=true] { box-shadow: inset 0 0 0 2px rgba(246, 236, 208, 0.5); }
#title .wander-opts { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 2px; }
#title .wander-note { margin: 0 0 10px; color: var(--ink); font-size: 14px; }
#title .btn:not(.ghost) small, #title .continue-as small { color: #fbf1dc; opacity: 0.95; }
#title .btn.ghost small { color: var(--ink-soft); }
#title .fine { color: var(--ink); }
@media (max-width: 460px) { #title .title-mains { grid-template-columns: 1fr; } }
/* K2 lobby price, K21 names */
.m-price { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 2px 10px; text-align: left; margin: 8px 0 12px; align-items: baseline; }
.m-price #mPrice { font: 700 16px var(--display); color: var(--olive); }
.m-price-why { grid-column: 2; font-size: 12.5px; color: var(--ink-soft); line-height: 1.35; }
.m-myname { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.m-myname b { font: 700 17px var(--display); color: var(--ink); }
.m-namenote { margin: -4px 0 4px; font-size: 13px; color: var(--ink-soft); }
/* K7 death choices + fast-forward */
.m-deathchoices { display: flex; flex-direction: column; gap: 6px; margin: 6px 0; }
.m-speed { display: flex; gap: 4px; justify-content: center; }
.m-speedbtn[aria-checked=true] { background: var(--seal); color: var(--seal-text); border-color: var(--seal-dark); }
.m-skipping { position: fixed; left: 50%; top: 40%; transform: translateX(-50%); z-index: 45; padding: 16px 22px; text-align: center; display: flex; flex-direction: column; gap: 6px; width: min(360px, calc(100% - 32px)); }
.m-skipbar { height: 8px; background: rgba(90, 65, 40, 0.2); border-radius: 4px; overflow: hidden; }
.m-skipbar i { display: block; height: 100%; width: 0; background: var(--gold); transition: width 0.2s; }
/* K11b podium (drawn in CSS until the G11 art) */
.m-podium { position: relative; padding: 16px 16px 8px; background: radial-gradient(ellipse at 50% 0%, rgba(255, 236, 170, 0.5), transparent 70%), linear-gradient(#3a2716, #23170c); color: #f6ecd0; overflow: hidden; }
.m-podium > h2 { font: 600 15px var(--display); letter-spacing: 0.2em; text-transform: uppercase; text-align: center; color: var(--bronze-light); margin: 0 0 8px; }
.m-pd-tier { display: flex; flex-direction: column; align-items: center; margin: 0 auto; }
.m-pd-tier.t1 { width: min(380px, 100%); } .m-pd-tier.t2 { width: min(560px, 100%); } .m-pd-tier.t3 { width: min(740px, 100%); }
.m-pd-people { display: flex; justify-content: center; gap: 14px; flex-wrap: wrap; padding: 0 6px; }
.m-pd-step { width: 100%; display: flex; align-items: baseline; justify-content: center; gap: 10px; padding: 6px 0 7px; margin-bottom: 8px;
  background: linear-gradient(180deg, #f3ece0, #cfc3ad 60%, #b0a28a); border-top: 3px solid var(--house); color: #3b2a1a; box-shadow: 0 4px 10px rgba(0, 0, 0, 0.45); border-radius: 2px; }
.m-pd-step span { font: 700 20px var(--display); letter-spacing: 0.1em; }
.m-pd-step small { font: 600 12px var(--display); letter-spacing: 0.08em; text-transform: uppercase; }
.m-pd-tier.out .m-pd-step { filter: grayscale(0.6) brightness(0.8); }
.m-pd-card { position: relative; width: 150px; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 4px 4px 6px; text-align: center; transition: opacity 0.45s, transform 0.45s; }
.m-pd-fig { position: relative; height: 104px; display: flex; align-items: flex-end; justify-content: center; }
.m-pd-fig img { height: 100px; width: auto; object-fit: contain; filter: drop-shadow(0 3px 3px rgba(0, 0, 0, 0.5)); }
.m-pd-q { display: none; position: absolute; inset: 0; place-items: center; font: 700 42px var(--display); color: var(--bronze-light); }
.m-pd-fig img.m-pd-portrait { height: 84px; width: 84px; border-radius: 50%; margin-bottom: 8px; } /* G13: a mode A head on the podium */
.m-pd-card.veiled > :not(.m-pd-fig) { visibility: hidden; }
.m-pd-card.veiled .m-pd-fig img { filter: brightness(0) opacity(0.55); }
.m-pd-card.veiled .m-pd-q { display: grid; }
.m-pd-card.shown { animation: m-pd-in 0.5s ease-out; }
@keyframes m-pd-in { from { opacity: 0.2; transform: translateY(8px) scale(0.96); } }
.m-pd-name { font: 700 15px var(--display); color: #fff6dc; line-height: 1.15; }
.m-pd-real { font-size: 12px; color: #e7d6ae; }
.m-pd-house { display: inline-flex; align-items: center; gap: 4px; font: 600 12px var(--display); color: #fff; background: var(--house); padding: 1px 7px; border-radius: 9px; margin-top: 2px; }
.m-pd-house img { width: 16px; height: 16px; }
.m-pd-role { font-size: 12px; color: #f0e2bf; }
.m-pd-kind { font: 700 10.5px var(--sans); letter-spacing: 0.08em; text-transform: uppercase; padding: 0 6px; border-radius: 6px; background: #e9dcc0; color: #3b2a1a; }
.m-pd-kind.ai { background: #9fb7c9; color: #10202c; }
.m-pd-fate { font-size: 11px; color: #e3b9a6; }
.m-pd-tier.win .m-pd-name { color: #ffd76a; text-shadow: 0 0 8px rgba(255, 200, 80, 0.6); }
.m-pd-wreath { position: absolute; left: 50%; top: -6px; width: 72px; height: 72px; margin-left: -36px; object-fit: contain; animation: m-pd-wreath 1.4s cubic-bezier(.2, .8, .3, 1) both; pointer-events: none; filter: drop-shadow(0 0 8px rgba(255, 215, 100, 0.7)); }
@keyframes m-pd-wreath { from { transform: translateY(-140px) rotate(-20deg); opacity: 0; } 60% { opacity: 1; } to { transform: translateY(0) rotate(0); opacity: 1; } }
.m-pd-banner { text-align: center; font: 700 clamp(16px, 3.4vw, 22px) var(--display); letter-spacing: 0.04em; margin: 6px 8px 4px; color: #f6ecd0; }
.m-pd-banner.gold { color: #ffd76a; text-shadow: 0 0 10px rgba(255, 190, 60, 0.55); }
.m-pd-skip { position: absolute; right: 10px; top: 10px; color: #f6ecd0; border-color: rgba(246, 236, 208, 0.4); }
.m-podium[data-revealed] .m-pd-skip { opacity: 0.7; }
.m-pd-sparkles { position: absolute; inset: 0; pointer-events: none; }
.m-pd-sparkles i { position: absolute; width: 6px; height: 6px; background: #ffe08a; border-radius: 50%; box-shadow: 0 0 8px 2px rgba(255, 215, 100, 0.8); animation: m-spark 1.6s ease-in-out infinite; }
@keyframes m-spark { 0%, 100% { opacity: 0; transform: scale(0.3) translateY(0); } 50% { opacity: 1; transform: scale(1) translateY(-10px); } }
@media (prefers-reduced-motion: reduce) { .m-pd-wreath, .m-pd-sparkles i, .m-pd-card.shown { animation: none; } }
@media (max-width: 600px) { .m-pd-card { width: 128px; } .m-pd-fig { height: 80px; } .m-pd-fig img { height: 76px; } .m-pd-fig img.m-pd-portrait { height: 66px; width: 66px; margin-bottom: 6px; } }
/* K11b moments, support ask, share picture */
.m-moments { padding: 0 20px; }
.m-moments h2 { font: 600 16px var(--display); letter-spacing: 0.06em; margin: 14px 0 6px; border-bottom: 1px solid var(--line); padding-bottom: 3px; }
.m-mo-frame { position: relative; max-width: 640px; margin: 0 auto; aspect-ratio: 16 / 9; background: #2b1d12; border: 3px solid var(--bronze); }
.m-mo-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.m-mo-prev, .m-mo-next { position: absolute; top: 50%; transform: translateY(-50%); width: 36px; height: 48px; border: 0; background: rgba(20, 12, 6, 0.55); color: #fff; font-size: 28px; cursor: pointer; }
.m-mo-prev { left: 0; } .m-mo-next { right: 0; }
.m-mo-cap { text-align: center; font-style: italic; margin: 6px 0 0; color: var(--ink); }
.m-mo-meta { display: block; text-align: center; color: var(--ink-soft); font-size: 12px; }
.m-mo-dots { display: flex; justify-content: center; gap: 6px; margin-top: 6px; }
.m-mo-dots button { width: 10px; height: 10px; padding: 0; border-radius: 50%; border: 1px solid var(--bronze-dark); background: transparent; cursor: pointer; }
.m-mo-dots button[aria-current=true] { background: var(--bronze); }
.m-ask { margin: 14px 20px 0; padding: 10px 14px; border: 1px solid var(--bronze); border-radius: 8px; background: rgba(255, 248, 230, 0.7); text-align: center; }
.m-ask p { margin: 0 0 8px; }
.m-rv-summary { margin: 8px 20px 0; text-align: center; }
.m-rv-summary img { max-width: 100%; border: 2px solid var(--bronze); display: block; margin: 0 auto 6px; }

/* match: talk & notebook (FAMA F3/F4, workstream B: ui/match_talk.js, the dialogue's whisper and deliveries, the HUD load) */
.dlg-input .dlg-whisper { flex: none; align-self: center; }
.dlg-input .dlg-whisper.on, .dlg-input .dlg-whisper[aria-pressed="true"] { background: var(--ink-soft); color: var(--parchment); border-color: var(--ink); font-style: italic; }
.dlg-actions .dlg-deliver[disabled] { opacity: 0.55; }
.purse .m-load { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.purse .m-load.full { color: var(--warn-ink); font-weight: 600; }
.m-notebook .nb-list, .m-notebook .nb-entries { list-style: none; margin: 0; padding: 0; }
.m-notebook .nb-npc { padding: 6px 0 7px; border-bottom: 1px solid var(--line); }
.m-notebook .nb-npc:last-child { border-bottom: 0; }
.m-notebook .nb-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; }
.m-notebook .nb-head small { color: var(--ink-soft); }
.m-notebook .nb-flag { margin-left: auto; font: 600 11px/1.6 var(--sans); letter-spacing: 0.04em; text-transform: uppercase; color: var(--parchment); background: var(--seal); border-radius: 4px; padding: 0 6px; }
.m-notebook .nb-entry { font-size: 13px; line-height: 1.4; padding: 2px 0 2px 8px; border-left: 2px solid transparent; overflow-wrap: anywhere; }
.m-notebook .nb-entry.contra { border-left-color: var(--seal); background: rgba(142, 42, 30, 0.07); }
.m-notebook .nb-t { color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.m-notebook .nb-entry q { font-style: italic; color: var(--ink); }
.m-notebook .nb-claim { display: inline-block; font: 600 11px/1.6 var(--sans); padding: 0 6px; border-radius: 4px; color: #fff; background: var(--house, var(--bronze)); }
.m-notebook .nb-claim.evasive, .m-notebook .nb-claim.none { color: var(--ink); background: var(--parchment-dark); }
.m-market p { margin: 4px 0; font-size: 13px; line-height: 1.4; }
.m-market .mk-short b { color: var(--seal-dark); }
.m-market .mk-next { color: var(--ink-soft); }

/* match: murder (FAMA F5, workstream C: ui/murder.js, render/murder.js) */
@keyframes m-poison-pulse { 0%, 100% { box-shadow: inset 0 0 0 rgba(90,200,70,0); filter: none; } 50% { box-shadow: inset 0 0 10px rgba(90,200,70,0.9); filter: hue-rotate(70deg) saturate(1.4); } }
.vitals.m-poisoned .vbar { animation: m-poison-pulse 1.1s ease-in-out infinite; }
.vitals.m-poisoned .vbar > span { background: linear-gradient(90deg, #3f8f2f, #7fcf4a) !important; }
.vitals.m-poisoned .heart { filter: hue-rotate(95deg) saturate(1.3); }
.m-attack { position: fixed; right: 330px; bottom: 26px; z-index: 40; display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; background: #7a1e18; border-color: #4e100c; color: #fff3e6; }
.m-attack[hidden] { display: none; }
.m-attack kbd { font: 600 11px/1 var(--sans, system-ui); padding: 2px 5px; border-radius: 4px; background: rgba(255,255,255,0.18); }
.m-attack-ico { width: 14px; height: 14px; display: inline-block; background: linear-gradient(45deg, transparent 44%, currentColor 44% 56%, transparent 56%), linear-gradient(-45deg, transparent 44%, currentColor 44% 56%, transparent 56%); }
@media (max-width: 900px) { .m-attack { right: 16px; bottom: 76px; } }
@media (pointer: coarse) { .m-attack { display: none; } } /* touch: the pad's own strike button is the Attack */
.m-arrest { position: fixed; left: 50%; top: 84px; transform: translateX(-50%); z-index: 56; max-width: calc(100vw - 32px); padding: 8px 16px; border-radius: 8px; background: #2a1410; color: #ffe3d0; font-weight: 600; box-shadow: 0 4px 14px rgba(0,0,0,0.35); }
.m-pick { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 60; width: min(360px, calc(100vw - 32px)); max-height: 70vh; overflow: auto; padding: 14px 16px; }
.m-pick h3 { margin: 0 0 8px; font-size: 17px; }
.m-pick-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.m-pick-list .btn { text-align: left; justify-content: flex-start; }
.m-pick-h { font: 600 11px/1.4 var(--sans, system-ui); letter-spacing: 0.06em; text-transform: uppercase; opacity: 0.7; margin-top: 4px; }
.m-pick .m-price { opacity: 0.8; }
.m-body { position: fixed; left: 50%; bottom: 120px; transform: translateX(-50%); z-index: 40; }
.m-death { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 55; width: min(420px, calc(100vw - 32px)); padding: 12px 18px; text-align: center; }
.m-death h2 { margin: 0 0 4px; font-size: 24px; letter-spacing: 0.04em; }
.m-death.m-executed h2, .m-death.m-died h2 { color: #8e1f17; }
.m-death p { margin: 4px 0 8px; font-size: 14px; }
.m-death .m-spec { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 6px 0 10px; }
.m-death .m-watch { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
/* the chat panel (a later body child) painted over the dialogue's lower rows (Whisper, the deliveries, Offer coins) below 1360 px:
   hide it while a conversation is open (what was said nearby is repeated inside the dialogue) */
@media (max-width: 1359px) { body:has(#dialog:not([hidden])) #chat { display: none; } }
/* match: items & events (FAMA F7/F8: ui/match_items.js, render/items.js) */
.m-shop { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 60; width: min(440px, calc(100vw - 32px)); max-height: 80vh; overflow: auto; padding: 14px 16px; }
.m-shop .mi-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.m-shop h3 { margin: 0 0 8px; font-size: 18px; }
.m-shop .mi-purse { font-weight: 600; white-space: nowrap; }
.m-shop .mi-sub { font: 600 11px/1.4 var(--sans, system-ui); letter-spacing: 0.06em; text-transform: uppercase; opacity: 0.7; margin: 8px 0 4px; }
.mi-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.mi-row { display: grid; grid-template-columns: 44px 1fr auto auto; align-items: center; gap: 8px; padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px; background: rgba(255, 250, 235, 0.5); }
.mi-row.off { opacity: 0.72; }
.mi-row .mi-txt { min-width: 0; display: flex; flex-direction: column; }
.mi-row .mi-txt small { color: var(--ink-soft); font-size: 12px; line-height: 1.25; }
.mi-row .mi-price { font-weight: 700; white-space: nowrap; display: inline-flex; align-items: center; gap: 3px; }
.mi-coin { display: inline-block; width: 11px; height: 11px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #f6dc8a, #b8892c); border: 1px solid #7a5a1c; }
.mi-ico { display: block; object-fit: contain; }
.mi-row .mi-outfit { margin: 0 auto; }
.mi-refuse { margin: 0 0 8px; padding: 6px 8px; border-left: 3px solid #8e1f17; background: rgba(142, 31, 23, 0.08); font-size: 14px; }
.mi-msg { margin: 8px 0 0; font-size: 14px; }
.mi-foot { text-align: right; margin-top: 10px; }
.m-items { display: flex; gap: 4px; padding: 4px 6px; align-items: center; }
.m-items[hidden] { display: none; }
.m-items .mi-tog { position: relative; width: 38px; height: 38px; padding: 3px; border-radius: 8px; border: 1px solid var(--line); background: rgba(255, 250, 235, 0.65); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.m-items .mi-tog.static { cursor: default; }
.m-items .mi-tog.on { border-color: var(--gold); background: rgba(240, 205, 120, 0.85); box-shadow: inset 0 0 0 1px var(--gold); }
.m-items .mi-tog.urgent { border-color: #3f8f2f; animation: m-poison-pulse 1.1s ease-in-out infinite; }
.m-items .mi-tog[disabled] { opacity: 0.55; cursor: default; }
.m-items .mi-n { position: absolute; right: 1px; bottom: 0; font-size: 11px; line-height: 1; background: var(--ink); color: #fff; border-radius: 6px; padding: 1px 3px; }
.mi-inv { margin: 6px 0 8px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; }
.mi-inv h3 { margin: 0 0 4px; font-size: 15px; }
.mi-invlist { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 12px; }
.mi-invlist li { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; }
.mi-clothesline { margin: 4px 0 0; font-size: 13px; color: var(--ink-soft); }
.mi-offer { margin: 0 0 6px; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; font-size: 13px; }
.mi-chip { display: inline-flex; align-items: center; gap: 3px; padding: 1px 6px 1px 3px; border: 1px solid var(--line); border-radius: 10px; }
.mi-shops { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.mi-shops > li { margin-bottom: 6px; }
.mi-shops ul { list-style: none; margin: 2px 0 0; padding-left: 10px; }
.mi-shops small { color: var(--ink-soft); }
.m-event { position: fixed; left: 50%; top: 24%; transform: translateX(-50%); z-index: 36; pointer-events: none; text-align: center; padding: 10px 26px 12px; width: min(520px, calc(100vw - 32px)); box-sizing: border-box;
  background: rgba(240, 228, 200, 0.97); border: 2px solid var(--bronze); border-top: 5px solid #8e1f17; border-radius: 6px; box-shadow: var(--shade); animation: m-in 0.5s ease-out; transition: opacity 0.9s, transform 0.9s; }
.m-event.m-ev-famine { border-top-color: #a8772a; }
.m-event.m-ev-scandal { border-top-color: #5a2d6e; }
.m-event.end { border-top-color: var(--bronze); }
.m-event .mi-acta { display: block; font: 600 11px/1.4 var(--sans, system-ui); letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-soft); }
.m-event b { display: block; font: 700 clamp(20px, 4.5vw, 30px) var(--display); letter-spacing: 0.06em; color: var(--seal-dark); }
.m-event p { margin: 4px 0 0; font-size: 15px; }
.m-event.out, .m-spike.out { opacity: 0; transform: translateX(-50%) translateY(-10px); }
.m-spike { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); z-index: 36; pointer-events: none; text-align: center; padding: 8px 18px; max-width: calc(100vw - 32px); box-sizing: border-box;
  background: rgba(30, 22, 14, 0.9); color: #f3e6c4; border: 1px solid var(--gold); border-radius: 6px; transition: opacity 0.8s, transform 0.8s; }
.m-spike b { display: block; font-size: 16px; }
.m-spike small { opacity: 0.75; font-size: 12px; }

/* match: rivals (FAMA F6: the reveal's AI cost line, the rival dialogue) */
.m-rv-aicost { font-size: 11px; opacity: 0.6; margin: 6px 0 0; text-align: center; }
#dialog .dlg-rival-ally { border-style: dashed; }

/* match: tutorial (K11: ui/match_tutorial.js — coach marks, the offer, one-time tips, the "?" in the Match tab) */
.mt-root { position: fixed; inset: 0; z-index: 50; pointer-events: none; font-family: var(--body); }
.mt-root .mt-block { position: absolute; inset: 0; pointer-events: auto; background: transparent; }
.mt-root .mt-block.dim { background: rgba(20, 12, 4, 0.58); }
.mt-spot { position: fixed; border-radius: 10px; box-shadow: 0 0 0 200vmax rgba(20, 12, 4, 0.58), 0 0 0 3px var(--gold), 0 0 18px 4px rgba(201, 153, 58, 0.7); pointer-events: none; transition: left .25s, top .25s, width .25s, height .25s; }
.mt-card { position: fixed; width: min(360px, calc(100vw - 32px)); padding: 12px 14px 10px; pointer-events: auto; border: 2px solid var(--bronze); border-radius: 8px; background-color: var(--parchment); }
.mt-card.center { left: 50% !important; top: 50% !important; transform: translate(-50%, -50%); }
.mt-card .mt-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.mt-kicker { font-family: var(--sans); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); }
.mt-title { display: block; font-family: var(--display); font-size: 18px; margin: 4px 0 2px; color: var(--ink); }
.mt-text p, .mt-tip p { margin: 4px 0; font-size: 15px; line-height: 1.35; }
.mt-house { color: var(--house); border-bottom: 3px solid var(--house); }
.mt-dots { display: inline-flex; gap: 5px; }
.mt-dots i { width: 8px; height: 8px; border-radius: 50%; border: 1px solid var(--bronze); background: transparent; }
.mt-dots i.done { background: var(--bronze-light); }
.mt-dots i.on { background: var(--seal); border-color: var(--seal-dark); transform: scale(1.2); }
.mt-btns { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.mt-btns .mt-gap { flex: 1; }
.mt-offer { text-align: left; }
.mt-offer .mt-title { font-size: 21px; }
.mt-demo-say { position: fixed; left: 50%; bottom: 22%; transform: translateX(-50%); width: min(460px, calc(100vw - 32px)); display: flex; gap: 8px; align-items: center; padding: 8px; background: var(--parchment); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shade); }
.mt-demo-in { flex: 1; padding: 7px 10px; border: 1px solid var(--line); border-radius: 6px; background: #fffaf0; color: var(--ink-soft); font-style: italic; }
.mt-demo-wh { padding: 5px 10px; border: 1px solid var(--line); border-radius: 7px; font-size: 13px; font-weight: 600; }
.mt-root.phone .mt-card:not(.center) { left: 0 !important; right: 0; top: auto !important; bottom: 0; width: 100%; border-radius: 14px 14px 0 0; border-width: 2px 0 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); max-height: 50vh; overflow: auto; }
.mt-root.phone .mt-card.top:not(.center) { top: 0 !important; bottom: auto; border-radius: 0 0 14px 14px; border-width: 0 0 2px; }
.mt-tip { position: fixed; left: 50%; bottom: 120px; transform: translateX(-50%); z-index: 36; width: min(340px, calc(100vw - 32px)); padding: 10px 14px 8px; border: 2px solid var(--bronze); border-left: 5px solid var(--gold); animation: m-in 0.4s ease-out; }
.mt-tip .mt-title { font-size: 16px; }
.mt-tip.phone { left: 0; right: 0; bottom: 0; transform: none; width: 100%; border-radius: 14px 14px 0 0; border-width: 2px 0 0; }
.m-tut-help { width: 28px; height: 28px; border-radius: 50%; font-family: var(--display); font-weight: 700; font-size: 15px; line-height: 1; padding: 0; border: 1px solid var(--bronze); background: rgba(255, 250, 240, 0.6); color: var(--ink); margin-left: auto; flex: none; }
.mt-spot.round { border-radius: 50%; }
.mt-root.live .mt-block { pointer-events: none; background: transparent; }
.mt-root.live .mt-spot { box-shadow: 0 0 0 3px var(--gold), 0 0 18px 4px rgba(201, 153, 58, 0.7); }
.mt-root.live .mt-card { box-shadow: var(--shade); }
.mt-btns .mt-back { min-width: 30px; padding-left: 8px; padding-right: 8px; }
.mrbar .mr-help { min-width: 26px; font-family: var(--display); font-weight: 700; }

/* ---- K10: match art wiring (status icons, podium art, frames) ---- */
.st-ico { display: inline-block; vertical-align: -3px; object-fit: contain; flex: none; }
.nb-entry .st-ico { margin-right: 4px; }
.dlg-log .msg.outcome .st-ico { margin-right: 6px; vertical-align: -4px; }
.dlg-whisper .st-ico { margin-right: 4px; vertical-align: -3px; }
.sec-head > .st-ico { margin-right: 6px; }
.m-podium { background: linear-gradient(rgba(35, 23, 12, 0.5), rgba(35, 23, 12, 0.78)), url("../assets/art/match/podium_bg.webp") center / cover no-repeat, #23170c; }
.m-pd-kind .m-pd-badge { vertical-align: -4px; margin-right: 3px; }
.m-mo-framed { position: relative; max-width: 680px; margin: 0 auto; aspect-ratio: 1600 / 940; }
.m-mo-framed .m-mo-wideframe { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 2; pointer-events: none; }
.m-mo-framed .m-mo-frame { position: absolute; left: 7.5%; top: 14.89%; right: 7.81%; bottom: 18.94%; max-width: none; margin: 0; aspect-ratio: auto; border: 0; }
.m-mo-framed .m-mo-prev, .m-mo-framed .m-mo-next { z-index: 3; }
.m-rv-tablet { position: relative; width: min(560px, 100%); aspect-ratio: 1200 / 930; margin: 4px auto 8px; background: url("../assets/art/match/frame_tablet.webp") center / 100% 100% no-repeat; }
.m-rv-tablet .m-rv-acta { position: absolute; left: 10.58%; top: 18.82%; right: 12.58%; bottom: 18.82%; margin: 0; overflow: auto; font-size: 14px; line-height: 1.45; color: var(--ink); }

/* ---- K13: sound settings ---- */
.snd-btn svg { display: block; }
.snd-btn.muted { opacity: 0.55; }
.snd-btn.muted svg path:not(:first-child) { display: none; }
.title-card { position: relative; }
.title-card > .title-snd { position: absolute; top: 10px; right: 10px; }
#sound.snd-panel { position: fixed; z-index: 60; top: 64px; right: 16px; width: min(320px, calc(100vw - 32px)); padding: 14px 16px 12px; }
#sound h2 { margin: 0 0 8px; font: 600 17px var(--display); letter-spacing: 0.06em; }
.snd-row { display: grid; grid-template-columns: 72px 1fr 34px; align-items: center; gap: 8px; margin: 6px 0; }
.snd-row input[type="range"] { width: 100%; accent-color: var(--bronze, #9a6b2f); }
.snd-row output { text-align: right; font-variant-numeric: tabular-nums; font-size: 13px; }
.snd-mute { display: flex; align-items: center; gap: 6px; margin: 8px 0 4px; }
.snd-credits { font-size: 11px; line-height: 1.35; color: var(--ink-soft, #6b5a44); margin: 8px 0; }
.snd-foot { justify-content: flex-end; }
@media (max-width: 600px) { #sound.snd-panel { top: auto; bottom: 12px; left: 16px; right: 16px; width: auto; } }

/* FAMA MVP rule 9: the podium reveal: black bars over the real data, all dissolving into smoke on one beat */
.m-pd-sec { position: relative; display: inline-flex; align-items: center; gap: 4px; }
.m-pd-sec.m-pd-house { display: inline-flex; }
.m-pd-bar { position: absolute; inset: -1px -4px; background: #0b0806; border-radius: 3px; box-shadow: 0 0 0 1px rgba(255, 240, 200, 0.12); pointer-events: none; }
.m-pd-bar.smoke { animation: m-pd-smoke 1.1s ease-out forwards; }
@keyframes m-pd-smoke {
  0% { opacity: 1; filter: blur(0); transform: none; background: #0b0806; }
  35% { opacity: 0.85; filter: blur(3px); background: #5a5550; transform: translateY(-3px) scale(1.08); }
  100% { opacity: 0; filter: blur(10px); background: #b9b2a8; transform: translateY(-16px) scale(1.5); }
}
.m-podium[data-stage="bars"] .m-pd-fig img { filter: drop-shadow(0 3px 3px rgba(0, 0, 0, 0.5)) saturate(0.85); }
@media (prefers-reduced-motion: reduce) { .m-pd-bar.smoke { animation: none; opacity: 0; } }

/* match: rooms */
.mroom { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 60; width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow: auto; padding: 16px 18px; }
.mroom h2 { margin: 0 0 4px; } .mroom h3 { margin: 0 0 6px; font-size: 15px; }
.mroom .mr-x { position: absolute; right: 10px; top: 10px; }
.mr-sub, .mr-fine { font-size: 12px; opacity: .8; margin: 4px 0 10px; }
.mr-box { border: 1px solid rgba(120, 90, 50, .35); border-radius: 10px; padding: 10px 12px; margin: 10px 0; }
.mr-field { display: flex; flex-direction: column; gap: 3px; margin: 6px 0; font-size: 13px; }
.mr-field input, .mr-field select, .mr-field textarea, #mrCode { font: inherit; padding: 6px 8px; border-radius: 6px; border: 1px solid rgba(120, 90, 50, .5); background: rgba(255, 250, 238, .9); color: #2b1d13; }
.mr-settings { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0 10px; }
.mr-check { display: block; font-size: 13px; margin: 6px 0; }
.mr-practice { text-align: center; font-size: 12px; margin: 8px 0 0; }
.mr-err { color: #8b1d16; } .mr-note { font-size: 13px; }
.mr-code { display: flex; align-items: baseline; gap: 10px; } .mr-code b { font-size: 30px; letter-spacing: .18em; }
.mr-link input { flex: 1; min-width: 0; font: inherit; font-size: 12px; padding: 5px; }
.mr-members li, .mr-recent li { margin: 3px 0; } .mr-recent .on { font-weight: 600; color: #2f6a2a; }
.mrbar { position: fixed; top: 8px; left: 50%; transform: translateX(-50%); z-index: 30; display: flex; gap: 10px; align-items: center; padding: 4px 12px; font-size: 13px; white-space: nowrap; max-width: calc(100vw - 32px); overflow: hidden; }
.mrbar .mr-time { font-size: 16px; font-variant-numeric: tabular-nums; }
.mrbar .mr-house, .mrpodium li { border-left: 4px solid var(--house, #888); padding-left: 6px; }
.mrbar .mr-dead { color: #8b1d16; font-weight: 600; }
.mrwreaths { position: fixed; top: 44px; left: 50%; transform: translateX(-50%); z-index: 29; display: flex; gap: 6px; padding: 2px 6px; }
.mrwreaths .m-hw { display: flex; flex-direction: column; align-items: center; font-size: 11px; } .mrwreaths canvas { width: 48px; height: 48px; }
.mrlayer { position: fixed; inset: 0; pointer-events: none; z-index: 25; }
.mr-emote, .mr-ping { position: fixed; transform: translate(-50%, -100%); display: flex; flex-direction: column; align-items: center; background: rgba(255, 248, 230, .92); border: 1px solid rgba(120, 90, 50, .6); border-radius: 12px; padding: 2px 8px; font-size: 20px; animation: mr-pop .35s ease-out; }
.mr-emote small, .mr-ping small { font-size: 10px; }
.mr-ping { color: #1d4f8c; border-color: #1d4f8c; animation: mr-pulse 1.2s ease-in-out infinite; }
@keyframes mr-pop { from { transform: translate(-50%, -60%) scale(.5); opacity: 0; } }
@keyframes mr-pulse { 50% { transform: translate(-50%, -100%) scale(1.15); } }
.mrwheel { position: fixed; left: 50%; top: 50%; width: 260px; height: 260px; transform: translate(-50%, -50%); border-radius: 50%; z-index: 55; }
.mrwheel[hidden] { display: none; }
.mr-wbtn, .mr-wcenter { position: absolute; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; min-width: 64px; padding: 4px; border-radius: 12px; border: 1px solid rgba(120, 90, 50, .5); background: rgba(255, 250, 238, .95); cursor: pointer; font-size: 22px; }
.mr-wbtn small { font-size: 10px; } .mr-wcenter { font-size: 14px; opacity: .6; cursor: default; }
body.mr-pinging #view { cursor: crosshair; }
.mrrole, .mrdeath, .mrpodium, .mrfeedback { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 61; width: min(460px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow: auto; padding: 16px 18px; text-align: center; }
.mrpodium, .mrfeedback { text-align: left; }
.mr-card-art { width: 120px; border-radius: 10px; }
.mr-podium { padding-left: 18px; } .mr-podium ul { padding-left: 14px; } .mr-nick { font-size: 15px; }
.mr-scale { display: flex; gap: 12px; flex-wrap: wrap; margin: 4px 0 8px; }
.mr-notes .contra > b { color: #8b1d16; } .mr-heard { font-size: 12px; }
.mr-pick { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px 0; }
@media (max-width: 600px) { .mrbar { top: 4px; font-size: 12px; gap: 6px; } .mrwreaths { top: 41px; } }
/* review r2: a room on a phone: the room's time bar and wreaths own the top 104 px; the HUD (vitals, purse, buttons, the
   minimap, the tab strip) moves below them, and the Wander clock steps aside (the room bar has the match clock) */
@media (max-width: 720px) {
  body.mr-in-room .hud-top { top: calc(108px + env(safe-area-inset-top, 0px)); }
  body.mr-in-room .hud-left .clock { display: none; }
  body.mr-in-room .hud-left { min-width: min(160px, 45vw); }
  body.mr-in-room .mapbox { top: calc(162px + env(safe-area-inset-top, 0px)); }
  body.mr-in-room #side.collapsed { top: calc(262px + env(safe-area-inset-top, 0px)); }
}
.mrpodium.mr-has-reveal { width: min(860px, calc(100vw - 32px)); }
.m-podium:not([data-stage="crowned"]) .m-pd-tier.win .m-pd-name { color: #fff6dc; text-shadow: none; } /* gold only once the wreath comes down */
.m-podium[data-stage="crowned"] .m-pd-tier.win .m-pd-name { transition: color 0.6s, text-shadow 0.6s; }

/* ---------- FAMA: the rival bar (Tisztázások 29; ui/rivalbar.js) ---------- */
.m-rivalbar { --rb: 46px; position: fixed; z-index: 28; display: flex; gap: 4px; padding: 3px 5px 2px; pointer-events: auto; background: rgba(233, 220, 192, 0.82); border: 1px solid rgba(138, 106, 47, 0.55); border-radius: 8px; box-shadow: 0 2px 6px rgba(40, 25, 10, 0.25); }
.m-rivalbar[hidden] { display: none; }
.m-rb { position: relative; width: var(--rbw, var(--rb)); padding: 0; border: 0; background: none; cursor: pointer; display: flex; flex-direction: column; align-items: center; font: inherit; color: var(--ink, #2b1d13); -webkit-touch-callout: none; user-select: none; }
.m-rb-face { position: relative; display: block; width: var(--rb); height: var(--rb); box-sizing: border-box; border-radius: 7px; border: 2px solid #8a6a2f; background-color: #e8d6ad; background-repeat: no-repeat; background-size: 192% auto; background-position: 50% 1%; overflow: hidden; transition: filter 0.4s; }
.m-rb-face.portrait { background-size: cover; background-position: 50% 50%; } /* G13: a public mode A head's portrait medallion */
.m-rb:hover .m-rb-face, .m-rb:focus-visible .m-rb-face { border-color: #c99a2e; }
.m-rb.ally .m-rb-face { border: 3px solid var(--ally); box-shadow: 0 0 0 1px rgba(255, 245, 220, 0.9); }
.m-rb.near .m-rb-face { box-shadow: 0 0 0 2px rgba(240, 200, 80, 0.75); }
.m-rb.following .m-rb-face { box-shadow: 0 0 0 2px #f0c850, 0 0 8px #f0c850; }
.m-rb.dead .m-rb-face { filter: grayscale(1) brightness(0.85); }
.m-rb-x { display: none; position: absolute; left: calc((var(--rbw, var(--rb)) - var(--rb)) / 2); top: 0; width: var(--rb); height: var(--rb); pointer-events: none; }
.m-rb.dead .m-rb-x { display: block; }
.m-rb-x::before, .m-rb-x::after { content: ""; position: absolute; left: 8%; right: 8%; top: 50%; height: 3px; margin-top: -1.5px; background: #c0241b; border-radius: 2px; box-shadow: 0 0 1px rgba(0, 0, 0, 0.6); transform: rotate(45deg); }
.m-rb-x::after { transform: rotate(-45deg); }
.m-rb-seal { position: absolute; right: calc((var(--rbw, var(--rb)) - var(--rb)) / 2 - 4px); top: calc(var(--rb) - 15px); width: 16px; height: 16px; line-height: 0; pointer-events: none; }
.m-rb-sym { position: absolute; left: calc((var(--rbw, var(--rb)) - var(--rb)) / 2 + 2px); top: 1px; font-size: 10px; line-height: 1; color: #fdf6e3; text-shadow: 0 0 2px #000, 0 0 2px #000; pointer-events: none; }
.m-rb-crest { position: absolute; right: calc((var(--rbw, var(--rb)) - var(--rb)) / 2 - 3px); top: -2px; width: 16px; height: 16px; pointer-events: none; }
.m-rb-crest[hidden] { display: none; }
.m-rb-ally { position: absolute; left: 0; right: 0; bottom: 0; font: 700 9px/12px var(--display, serif); letter-spacing: 0.04em; text-transform: uppercase; text-align: center; color: #fff8e6; background: var(--ally); }
.m-rb-timer { position: absolute; left: calc((var(--rbw, var(--rb)) - var(--rb)) / 2); width: var(--rb); top: calc(var(--rb) - 13px); border-radius: 0 0 6px 6px; font: 700 10px/13px system-ui, sans-serif; text-align: center; color: #fff; background: rgba(120, 20, 15, 0.85); font-variant-numeric: tabular-nums; }
.m-rb-ally[hidden], .m-rb-timer[hidden], .m-rb-guess[hidden] { display: none; }
.m-rb-guess { position: absolute; left: calc((var(--rbw, var(--rb)) - var(--rb)) / 2 - 3px); top: calc(var(--rb) - 12px); width: 11px; height: 11px; border-radius: 50%; border: 1.5px solid #fff8e6; box-shadow: 0 0 2px rgba(0, 0, 0, 0.7); pointer-events: none; }
.m-rb-name { display: block; max-width: var(--rbw, var(--rb)); margin-top: 1px; font-size: 10.5px; line-height: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center; }
.m-rb.dead .m-rb-name { color: #7a2a20; text-decoration: line-through; }
.m-rivalbar.compact .m-rb-name { font-size: 9.5px; line-height: 12px; }
.m-rb-tip { position: fixed; z-index: 31; max-width: 260px; padding: 5px 9px; font-size: 13px; pointer-events: none; }
.m-rb-tip[hidden] { display: none; }

/* bug #24: the full-screen loading sheet (src/ui/loader.js) */
#loader { position: fixed; inset: 0; z-index: 10000; display: grid; place-items: center; padding: 16px; background: var(--parchment); color: var(--ink); opacity: 1; transition: opacity 0.45s ease; }
#loader[hidden] { display: none; }
#loader.done { opacity: 0; pointer-events: none; }
#loader .ld-inner { width: min(760px, 100%); display: flex; flex-direction: column; align-items: center; gap: 18px; text-align: center; }
#loader .ld-title { font-family: var(--display); font-weight: 600; font-size: clamp(24px, 5.4vw, 40px); letter-spacing: 0.06em; color: var(--ink); line-height: 1.2; }
#loader .ld-bar { width: min(360px, 100%); height: 3px; border-radius: 2px; background: rgba(142, 42, 30, 0.14); overflow: hidden; }
#loader .ld-bar i { display: block; height: 100%; width: 0; background: var(--seal); transition: width 0.25s ease-out; }
#loader .ld-status { margin: 0; min-height: 1.4em; font: italic 16px/1.4 var(--body); color: var(--ink-soft); opacity: 0.7; }
#loader .ld-slow { margin: -8px 0 0; font: 14px/1.4 var(--body); color: var(--seal-dark); opacity: 0.85; }
@media (prefers-reduced-motion: reduce) { #loader, #loader .ld-bar i { transition: none; } }

/* ---------- FAMA hibalista #28: the town unit beside the minimap (name + wreath + shares), never over the disc ---------- */
.mapbox .m-miniunit { position: absolute; left: calc(100% + 4px); top: 92px; z-index: 2; width: 84px; padding: 3px 4px 4px; display: flex; flex-direction: column; align-items: center; gap: 0;
  background: rgba(240, 228, 196, 0.94); border: 1px solid #8a6a2f; border-radius: 4px; box-shadow: 0 3px 8px rgba(10, 6, 2, 0.35); cursor: pointer; font: inherit; color: #2b1d12; }
.mapbox .m-miniunit[hidden] { display: none; }
.m-miniunit .m-mu-name { font: 700 10.5px/1.2 var(--display); letter-spacing: 0.06em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.m-miniunit .m-mu-ring { width: 36px; height: 36px; display: block; }
.m-miniunit .m-mu-cap { display: flex; flex-direction: column; align-items: center; font: 600 10px/1.15 var(--body); text-shadow: 0 0 2px #fbf3dc; }
@media (max-width: 760px) { /* a phone: under the place ribbon (beside the disc there is the side tab bar), wreath and shares in a row */
  .mapbox .m-miniunit { left: 0; top: calc(100% + 3px); width: 120px; display: grid; grid-template-columns: 30px 1fr; grid-template-rows: auto auto; column-gap: 4px; align-items: center; padding: 2px 4px; }
  .m-miniunit .m-mu-name { grid-column: 1 / 3; }
  .m-miniunit .m-mu-ring { width: 30px; height: 30px; }
  .m-miniunit .m-mu-cap { font-size: 9.5px; align-items: flex-start; } }

/* ---------- k14b #51 / #40: the match panel, the waiting room, invitations ---------- */
.mroom-bg { position: fixed; inset: 0; z-index: 59; background-color: #2a1d12; background-position: center; background-size: cover; background-repeat: no-repeat; }
.mroom { background-color: rgba(240, 228, 200, 0.96); }
.mroom.mr-wide { width: min(1040px, calc(100vw - 32px)); padding: 14px 18px 12px; }
.mr-lbl { display: inline-flex; align-items: center; gap: 2px; }
.mr-info { display: inline-grid; place-items: center; width: 20px; height: 20px; padding: 0; border-radius: 50%; border: 1px solid rgba(120, 90, 50, .55); background: rgba(255, 250, 238, .9); color: var(--bronze-dark); font: 700 13px/1 var(--sans); cursor: help; vertical-align: middle; }
.mr-info:hover, .mr-info:focus-visible { background: var(--bronze); color: #fff6dc; }
.mr-tip { position: fixed; z-index: 90; padding: 8px 10px; border-radius: 8px; background: #2b1d13; color: #f6ecd0; font: 14px/1.35 var(--body); box-shadow: var(--shade); pointer-events: none; }
.mr-practice { margin: 12px 0 0; }
.mr-practice-link { display: inline-flex; flex-direction: column; align-items: center; gap: 0; padding: 6px 16px; border: 1px solid var(--bronze); border-radius: 8px; color: var(--ink); text-decoration: none; font: 600 14px var(--display); letter-spacing: .04em; background: rgba(255, 250, 238, .55); }
.mr-practice-link small { font: 400 12px var(--body); letter-spacing: 0; color: var(--ink-soft); }
.mr-practice-link:hover, .mr-practice-link:focus-visible { background: rgba(194, 157, 85, .25); color: var(--seal-dark); }
.mr-friends h3 { font-size: 17px; }
/* the waiting room */
.mr-wr-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding-right: 40px; }
.mr-wr-title { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.mr-wr-title h2 { margin: 0; }
.mr-wr-head .mr-code b { font-size: 24px; }
.mr-joined { margin: 0; font-size: 15px; } .mr-joined b { font: 700 20px var(--display); }
.mr-invitebtn { margin-left: auto; font-size: 16px; padding: 10px 18px; box-shadow: 0 0 0 3px rgba(201, 153, 58, .45); }
.mr-invite { background: rgba(255, 250, 238, .7); }
.mr-invite h4 { margin: 8px 0 4px; font-size: 14px; }
.mr-invite .row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.mr-invite .mr-field .row input { flex: 1; min-width: 160px; }
.mr-chips { display: flex; flex-wrap: wrap; gap: 4px; margin: 2px 0 6px; }
.mr-chip { display: inline-flex; align-items: center; gap: 2px; padding: 1px 4px 1px 9px; border-radius: 999px; background: var(--parchment-2); font-size: 13px; }
.mr-chip button { border: 0; background: none; padding: 0 4px; color: var(--seal-dark); }
.mr-recentpick { list-style: none; padding: 0; margin: 0 0 6px; display: flex; flex-wrap: wrap; gap: 2px 14px; }
.mr-invnotes { list-style: none; padding: 0; margin: 6px 0 0; font-size: 13px; } .mr-invnotes .ok { color: #2f6a2a; } .mr-invnotes .no { color: var(--warn-ink); }
.mr-stagewrap { position: relative; }
.mr-stage { position: relative; border-radius: 10px; overflow: hidden; background-color: #3a2716; background-size: cover; background-position: center 62%; min-height: 230px; display: flex; align-items: flex-end; box-shadow: inset 0 0 0 1px rgba(60, 40, 20, .5); }
.mr-seats { list-style: none; margin: 0; padding: 10px 12px 12px; width: 100%; display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; align-items: end; }
.mr-seats.s3 { grid-template-columns: repeat(3, minmax(0, 150px)); justify-content: center; gap: 30px; }
.mr-seat { position: relative; display: flex; flex-direction: column; align-items: center; gap: 1px; min-width: 0; text-align: center; color: #fff6dc; }
.mr-seat::before { content: ''; position: absolute; bottom: 30px; left: 50%; width: 70px; height: 14px; margin-left: -35px; border-radius: 50%; background: radial-gradient(rgba(0, 0, 0, .45), transparent 70%); }
.mr-seatfig { position: relative; height: 128px; display: flex; align-items: flex-end; justify-content: center; }
.mr-seatfig img { height: 124px; width: auto; filter: drop-shadow(0 3px 3px rgba(0, 0, 0, .55)); transform-origin: 50% 100%; animation: mr-idle 3.4s ease-in-out infinite; animation-delay: var(--d, 0s); }
.mr-seat.away .mr-seatfig img { filter: grayscale(1) brightness(.7); opacity: .7; }
@keyframes mr-idle { 0%, 100% { transform: rotate(0) translateY(0); } 30% { transform: rotate(-1.2deg) translateY(-1px); } 70% { transform: rotate(1deg) translateY(0); } }
.mr-ghost { display: block; width: 46px; height: 112px; border: 2px dashed rgba(255, 246, 220, .55); border-radius: 23px 23px 8px 8px; background: rgba(255, 246, 220, .07); }
.mr-seat.empty .mr-seatnick { font-style: italic; opacity: .8; font-weight: 400; }
.mr-seatnick { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 700 14px var(--display); padding: 1px 8px; border-radius: 7px; background: rgba(30, 20, 10, .72); }
.mr-seat.you .mr-seatnick { background: rgba(142, 42, 30, .85); }
.mr-hostmark { color: #ffd76a; }
.mr-seatstate { font-size: 11.5px; max-width: 100%; padding: 0 6px; border-radius: 6px; background: rgba(30, 20, 10, .55); }
.mr-seat.ready .mr-seatstate { background: rgba(47, 106, 42, .9); color: #fff; }
.mr-kick { position: absolute; top: 2px; right: 6px; width: 22px; height: 22px; padding: 0; border-radius: 50%; border: 1px solid rgba(255, 246, 220, .6); background: rgba(30, 20, 10, .6); color: #fff6dc; font-size: 12px; line-height: 1; opacity: .75; }
.mr-kick:hover, .mr-kick:focus-visible { opacity: 1; background: var(--seal); }
.mr-seatemote { position: absolute; top: -4px; left: 50%; transform: translateX(-50%); z-index: 2; display: flex; flex-direction: column; align-items: center; padding: 2px 8px; border-radius: 12px; background: rgba(255, 248, 230, .95); border: 1px solid rgba(120, 90, 50, .6); color: var(--ink); font-size: 22px; animation: mr-emote 3.6s ease-out forwards; }
.mr-seatemote small { font-size: 10px; }
@keyframes mr-emote { 0% { opacity: 0; transform: translate(-50%, 10px) scale(.6); } 8% { opacity: 1; transform: translate(-50%, 0) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; } }
.mr-countdown { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; background: rgba(20, 12, 6, .55); color: #ffd76a; border-radius: 10px; pointer-events: none; }
.mr-countdown b { font: 700 92px/1 var(--display); text-shadow: 0 0 18px rgba(255, 190, 60, .6); }
.mr-countdown small { font: 600 18px var(--display); letter-spacing: .1em; text-transform: uppercase; color: #f6ecd0; }
.mr-wr-gestures { display: flex; flex-wrap: wrap; gap: 2px; margin: 6px 0 0; }
.mr-wr-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 8px 0 4px; }
.mr-readybtn { min-width: 150px; }
.mr-wr-actions #mrStart, .mr-wr-actions #mrStart3Now { font-size: 16px; padding: 9px 18px; }
.mr-why { font-size: 14px; color: var(--ink-soft); }
.mr-wr-actions #mrLeave { margin-left: auto; }
.mr-wr-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.mr-wr-cols .mr-box { margin: 6px 0; }
.mr-setlist { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; margin: 0; font-size: 14px; }
.mr-setlist dt { color: var(--ink-soft); } .mr-setlist dd { margin: 0; font-weight: 600; }
.mr-chatlog { list-style: none; margin: 0 0 6px; padding: 4px 6px; height: 110px; overflow-y: auto; font-size: 14px; background: rgba(255, 250, 238, .65); border-radius: 6px; border: 1px solid var(--line); }
.mr-chatlog li { margin: 1px 0; overflow-wrap: anywhere; } .mr-chatlog .empty { color: var(--ink-soft); font-style: italic; }
.mr-chatrow { display: flex; gap: 6px; } .mr-chatrow input { flex: 1; min-width: 0; font: inherit; padding: 5px 8px; border-radius: 6px; border: 1px solid rgba(120, 90, 50, .5); background: rgba(255, 250, 238, .95); }
.mr-wr-note { margin: 4px 0 0; }
@media (max-width: 760px) {
  .mr-seats { grid-template-columns: repeat(3, 1fr); row-gap: 10px; }
  .mr-seatfig { height: 92px; } .mr-seatfig img { height: 88px; } .mr-ghost { height: 80px; width: 36px; }
  .mr-seat::before { bottom: 30px; width: 54px; margin-left: -27px; }
  .mr-wr-cols { grid-template-columns: 1fr; }
  .mr-invitebtn { margin-left: 0; width: 100%; }
  .mroom.mr-wide { width: calc(100vw - 16px); padding: 12px 10px; }
  .mr-countdown b { font-size: 64px; }
}
/* an invitation in the Wander world */
.mr-invitenote { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 70; display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 14px; max-width: calc(100vw - 24px); animation: mr-pop-in .4s ease-out; }
.mr-invitenote .mr-in-text { font-size: 15px; }
.mr-invitenote .mr-in-x { width: 28px; height: 28px; }
@keyframes mr-pop-in { from { opacity: 0; transform: translate(-50%, -12px); } }
@media (prefers-reduced-motion: reduce) { .mr-seatfig img, .mr-invitenote { animation: none; } }

/* ---------- k14b #41: the podium on the painted podium (one screen at 1366×768, 1280×720 and on phones) ---------- */
/* the stage: 6cqw of dusk above the 16:9 picture; the people stand on its surfaces (the top block 29.5% down the picture,
   the wings 50%), their name plates over their heads, so the garlands on the wings and the bottom step stay free */
.m-podium { --pd-reserve: 170px; container: pd / inline-size; padding: 8px 10px 8px; background: radial-gradient(ellipse at 50% 0%, rgba(255, 236, 170, 0.35), transparent 70%), linear-gradient(#3a2716, #23170c); }
.m-podium > h2 { margin: 0 0 4px; }
.m-pd-stage { position: relative; container: pdstage / inline-size; width: min(100%, calc((100vh - var(--pd-reserve)) / 0.6225)); aspect-ratio: 1 / 0.6225; margin: 0 auto; border-radius: 8px; overflow: hidden;
  background: var(--pd-art) center bottom / 100% auto no-repeat, linear-gradient(#2c1b0e, #6b4426 9%, #b7834a 15%); box-shadow: inset 0 0 0 1px rgba(255, 230, 170, 0.18); }
.m-pd-stage .m-pd-tier { position: absolute; width: auto; margin: 0; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; }
.m-pd-stage .m-pd-tier.t1 { left: 50%; bottom: 39.66cqw; z-index: 2; }
.m-pd-stage .m-pd-tier.t2 { left: 23.5%; bottom: 28.12cqw; }
.m-pd-stage .m-pd-tier.t3 { left: 76.2%; bottom: 28.12cqw; }
.m-pd-stage .m-pd-people { flex-wrap: nowrap; gap: 0.6cqw; padding: 0; align-items: flex-end; }
.m-pd-stage .m-pd-card { width: 11.4cqw; padding: 0; gap: 0.3cqw; }
.m-pd-plate { display: flex; flex-direction: column; align-items: center; gap: 1px; width: 100%; padding: 0.3cqw 0.3cqw 0.4cqw; border-radius: 6px; background: rgba(22, 13, 6, 0.74); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45); }
.m-pd-stage .m-pd-name { font-size: clamp(11px, 1.32cqw, 17px); }
.m-pd-stage .m-pd-real, .m-pd-stage .m-pd-role { font-size: clamp(9.5px, 1.02cqw, 13px); line-height: 1.2; }
.m-pd-stage .m-pd-house { font-size: clamp(9.5px, 1cqw, 12.5px); padding: 0 5px; margin-top: 1px; }
.m-pd-stage .m-pd-kind { font-size: clamp(8.5px, 0.92cqw, 11px); }
.m-pd-stage .m-pd-fate { font-size: clamp(9px, 0.95cqw, 12px); }
.m-pd-stage .m-pd-badge, .m-pd-stage .m-pd-house img { width: clamp(11px, 1.2cqw, 16px); height: clamp(11px, 1.2cqw, 16px); }
.m-pd-stage .m-pd-fig { height: 10.8cqw; }
.m-pd-stage .m-pd-fig img { height: 10.8cqw; }
.m-pd-stage .m-pd-fig img.m-pd-portrait { height: 7.6cqw; width: 7.6cqw; margin-bottom: 0.8cqw; }
.m-pd-stage .m-pd-step { position: absolute; top: 100%; left: 50%; transform: translateX(-50%); width: auto; min-width: 12cqw; margin: 0.3cqw 0 0; padding: 0.15cqw 1cqw 0.2cqw; gap: 0.6cqw; border-top-width: 2px; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4); white-space: nowrap; }
.m-pd-stage .m-pd-step span { font-size: clamp(11px, 1.3cqw, 17px); }
.m-pd-stage .m-pd-step small { font-size: clamp(9px, 0.95cqw, 12px); }
.m-pd-stage .m-pd-tier.t1 .m-pd-step { margin-top: 9.6cqw; } /* below the laurel relief of the top block */
.m-pd-stage .m-pd-sparkles { z-index: 3; }
/* the winners: gold names, the golden wreath on the head (its leaves only: the bow stays behind the head) */
.m-podium[data-stage="crowned"] .m-pd-tier.win .m-pd-name { color: #ffd76a; text-shadow: 0 0 6px rgba(255, 190, 60, 0.75), 0 1px 1px #000; }
.m-podium .m-pd-fig img.m-pd-wreath { position: absolute; left: 50%; top: -9%; width: 88%; height: auto; aspect-ratio: 1; margin-left: -44%; clip-path: inset(0 0 46% 0); z-index: 2;
  animation: m-pd-crown 1.3s cubic-bezier(.2, .8, .3, 1) both; filter: none; } /* (a drop-shadow with the clip-path draws a dark box in Chromium) */
@keyframes m-pd-crown { from { transform: translateY(-160%) rotate(-12deg); opacity: 0; } 55% { opacity: 1; } to { transform: none; opacity: 1; } }
.m-podium.victory .m-pd-tier.win .m-pd-fig img:not(.m-pd-wreath) { filter: drop-shadow(0 0 6px rgba(255, 215, 100, 0.55)) drop-shadow(0 3px 3px rgba(0, 0, 0, 0.5)); }
.m-pd-banner { margin: 6px 8px 0; }
.mrpodium.mr-has-reveal { width: min(1120px, calc(100vw - 24px)); max-height: calc(100vh - 16px); padding: 10px 12px; }
.mrpodium.mr-has-reveal > h2 { margin: 0 0 4px; font-size: 18px; }
.mrpodium .m-podium { --pd-reserve: 230px; margin: 0 -2px 8px; }
/* phones and narrow panels: the houses under each other, the painted podium dimmed behind */
@container pd (max-width: 620px) {
  .m-pd-stage { width: 100%; aspect-ratio: auto; background: linear-gradient(rgba(25, 15, 8, 0.55), rgba(25, 15, 8, 0.7)), var(--pd-art) center / cover no-repeat; padding: 6px 4px 4px; display: flex; flex-direction: column; gap: 4px; }
  .m-pd-stage .m-pd-tier { position: relative; left: auto !important; bottom: auto !important; transform: none; }
  .m-pd-stage .m-pd-people { gap: 6px; }
  .m-pd-stage .m-pd-card { width: 150px; flex-direction: row; align-items: flex-end; gap: 4px; }
  .m-pd-stage .m-pd-card .m-pd-fig { order: -1; height: 74px; flex: none; }
  .m-pd-stage .m-pd-fig img { height: 74px; }
  .m-pd-stage .m-pd-fig img.m-pd-portrait { height: 52px; width: 52px; margin-bottom: 4px; }
  .m-pd-stage .m-pd-plate { align-items: flex-start; text-align: left; padding: 3px 5px; }
  .m-pd-stage .m-pd-name { font-size: 13px; } .m-pd-stage .m-pd-real, .m-pd-stage .m-pd-role { font-size: 11px; } .m-pd-stage .m-pd-house { font-size: 10.5px; }
  .m-pd-stage .m-pd-step, .m-pd-stage .m-pd-tier.t1 .m-pd-step { position: static; transform: none; margin: 2px 0 0; min-width: 0; width: 100%; padding: 1px 6px; }
}
/* #41: the loser's own defeat picture (eliminated, darkened), with a title that reads */
.m-rv-hero.lost .m-rv-heroimg { filter: brightness(0.62) saturate(0.75); }
.m-rv-herotitle { bottom: 50%; transform: translateY(50%); left: 50%; right: auto; translate: -50% 0; padding: 4px 26px 6px; border-radius: 6px; background: rgba(18, 10, 5, 0.66); box-shadow: 0 0 24px 10px rgba(18, 10, 5, 0.45); color: #f6e7c1; }
.m-rv-hero.won .m-rv-herotitle { color: #ffd76a; }
.m-rv-hero.none .m-rv-herotitle { position: static; transform: none; translate: none; display: block; background: none; box-shadow: none; color: var(--ink); }
/* k14b #40: the house name on the role card reads on the parchment (Crassus' gold was too light): a darker shade + a thin outline */
.m-house-line h2 { color: color-mix(in srgb, var(--house) 45%, #1e1208); text-shadow: 0 0 1px rgba(255, 248, 230, 0.9), 0 1px 0 rgba(255, 248, 230, 0.7); }
.match-tab .m-house-name, .mrrole .mr-house { color: color-mix(in srgb, var(--house, #5a4128) 45%, #1e1208); }
/* k14b #51: the waiting room fits 1366×768 without scrolling */
.mroom.mr-wide .mr-box { margin: 6px 0; padding: 7px 10px; }
.mroom.mr-wide h3 { margin: 0 0 3px; }
.mroom.mr-wide .mr-fine { margin: 2px 0 4px; }
.mr-invite { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 4px 16px; align-items: start; }
.mr-invite .mr-invrecent, .mr-invite .mr-invnotes { grid-column: 1 / -1; }
.mr-invite .mr-invnick .mr-field { margin: 0 0 4px; }
.mr-invite .mr-invnick { padding-top: 20px; }
.mr-stage { min-height: 196px; }
.mr-seatfig { height: 112px; } .mr-seatfig img { height: 108px; } .mr-ghost { height: 96px; }
.mr-wr-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 12px; margin: 6px 0 2px; }
.mr-wr-bar .mr-wr-actions { margin: 0; flex: 1 1 auto; }
.mr-wr-bar .mr-wr-gestures { margin: 0; }
.mr-wr-actions #mrLeave { margin-left: 0; }
.mr-chatlog { height: 84px; }
.mr-wr-cols .mr-settings .mr-field { margin: 2px 0; }
@media (max-width: 760px) {
  .mr-invite { grid-template-columns: 1fr; } .mr-invite .mr-invnick { padding-top: 0; }
  .mr-seatfig { height: 92px; } .mr-seatfig img { height: 88px; } .mr-ghost { height: 80px; }
}
@media (min-width: 761px) {
  .mr-wr-settings .mr-settings { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0 6px; }
  .mr-wr-settings .mr-settings select { padding: 5px 4px; font-size: 13px; }
  .mr-team.mr-box { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 12px; }
  .mr-team .mr-field { flex-direction: row; align-items: center; gap: 6px; margin: 0; }
}
