/* SoloBorg - mobile app styles.
   Fonts: system stacks that follow the design (condensed headings, mono numbers, serif story).
   To use the exact design fonts, self-host them and add @font-face rules here (do not hotlink Google Fonts: GDPR). */

/* THEMES:BEGIN (generated by tools/gen_themes.py from tools/themes_palettes.py: do not edit by hand) */
:root {
  color-scheme: dark;
  --bg: #17130f;
  --panel: #201b16;
  --card: #2a241d;
  --line: #3d352b;
  --line2: #51463a;
  --line3: #6d5f4e;
  --text: #e6dcc8;
  --muted: #b5a995;
  --dim: #9a8e7b;
  --amber: #c8782a;
  --amber-hi: #eaa85e;
  --on-amber: #1a0f05;
  --red: #d65a49;
  --red-hi: #ff9a88;
  --red-bg: #2a1612;
  --red-line: #5a2a22;
  --green: #8fd19a;
  --green-bg: #17261a;
  --green-line: #2d4a33;
  --rad: #a8c44f;
  --erid: #b39cf0;
  --gold: #f0c35a;
  --gold-bg: #3a2c0c;
  --gold-line: #6a5316;
  --bad: #ff7a65;
  --bad-soft: #ff9a88;
  --crit-bg: #3a0f0a;
  --crit-line: #8a2a20;
  --bar-bg: #2d2720;
  --foe-pr: #d3b3ab;
  --foe-bar-bg: #3a1f1a;
  --foe-bar: #ff7a65;
  --player-bg: #3a2412;
  --player-fg: #f6e8d4;
  --disabled-fg: #9b9082;
  --pill-small: #1a0f05;
  --dot-on: #7fc97f;
  --ok-text: #8fd48f;
  --overlay: rgba(0,0,0,.6);
  --map-bg: #ffffff;
}
:root[data-sb-theme="carta"] {
  color-scheme: light;
  --bg: #f6eed9;
  --panel: #eee3c8;
  --card: #e8dcbd;
  --line: #d3c4a0;
  --line2: #bba97f;
  --line3: #9d8a62;
  --text: #2e2920;
  --muted: #594e3d;
  --dim: #6f6350;
  --amber: #a5560e;
  --amber-hi: #87420a;
  --on-amber: #fffaf0;
  --red: #a63320;
  --red-hi: #8f2212;
  --red-bg: #f4dcd1;
  --red-line: #d9a898;
  --green: #2b6636;
  --green-bg: #dde9d4;
  --green-line: #a9c79e;
  --rad: #566f0d;
  --erid: #5f40ad;
  --gold: #7c5800;
  --gold-bg: #f2e3b4;
  --gold-line: #cfb25f;
  --bad: #a63320;
  --bad-soft: #8f2212;
  --crit-bg: #f1cfc6;
  --crit-line: #c98474;
  --bar-bg: #d9ccaa;
  --foe-pr: #6d3f35;
  --foe-bar-bg: #e6c4b8;
  --foe-bar: #b8452f;
  --player-bg: #ead3b0;
  --player-fg: #33260f;
  --disabled-fg: #6f6350;
  --pill-small: #ffeccc;
  --dot-on: #2f8a3d;
  --ok-text: #2b6636;
  --overlay: rgba(40,30,10,.45);
  --map-bg: #ffffff;
}
:root[data-sb-theme="seppia"] {
  color-scheme: light;
  --bg: #e9dbb9;
  --panel: #e0d0a9;
  --card: #d9c799;
  --line: #c3ae7c;
  --line2: #ab956a;
  --line3: #8c7648;
  --text: #34281a;
  --muted: #4a3c26;
  --dim: #65553a;
  --amber: #9f520c;
  --amber-hi: #7e3d08;
  --on-amber: #fff8e8;
  --red: #9c2f1c;
  --red-hi: #85200f;
  --red-bg: #ecd0bd;
  --red-line: #cf9d86;
  --green: #285f33;
  --green-bg: #d3e0c4;
  --green-line: #9fbf92;
  --rad: #4f670b;
  --erid: #5a3ca3;
  --gold: #744f00;
  --gold-bg: #ead8a3;
  --gold-line: #c4a553;
  --bad: #9c2f1c;
  --bad-soft: #85200f;
  --crit-bg: #e8c4b6;
  --crit-line: #c07a68;
  --bar-bg: #cdb98a;
  --foe-pr: #66382e;
  --foe-bar-bg: #dfb9a8;
  --foe-bar: #a8402a;
  --player-bg: #dcc294;
  --player-fg: #2e2210;
  --disabled-fg: #65553a;
  --pill-small: #ffeccc;
  --dot-on: #2a7d38;
  --ok-text: #285f33;
  --overlay: rgba(40,28,8,.45);
  --map-bg: #fff8e8;
}
:root[data-sb-theme="contrasto"] {
  color-scheme: dark;
  --bg: #000000;
  --panel: #0b0b0b;
  --card: #161616;
  --line: #5a5a5a;
  --line2: #8a8a8a;
  --line3: #b0b0b0;
  --text: #ffffff;
  --muted: #e0e0e0;
  --dim: #c8c8c8;
  --amber: #ffb347;
  --amber-hi: #ffc870;
  --on-amber: #000000;
  --red: #ff6b5a;
  --red-hi: #ffb0a5;
  --red-bg: #2a0000;
  --red-line: #ff6b5a;
  --green: #7dff94;
  --green-bg: #002a0c;
  --green-line: #4bc464;
  --rad: #d4f060;
  --erid: #cdb8ff;
  --gold: #ffe066;
  --gold-bg: #2e2400;
  --gold-line: #c8a800;
  --bad: #ff8f80;
  --bad-soft: #ffb0a5;
  --crit-bg: #3a0000;
  --crit-line: #ff6b5a;
  --bar-bg: #333333;
  --foe-pr: #ffd0c8;
  --foe-bar-bg: #3a0000;
  --foe-bar: #ff8f80;
  --player-bg: #303030;
  --player-fg: #ffffff;
  --disabled-fg: #b0b0b0;
  --pill-small: #2a1500;
  --dot-on: #7dff94;
  --ok-text: #7dff94;
  --overlay: rgba(0,0,0,.8);
  --map-bg: #ffffff;
}
/* THEMES:END */

:root {
  --f-head: "Barlow Condensed", "Roboto Condensed", "Arial Narrow", "Helvetica Neue Condensed", "Arial Nova Condensed", sans-serif-condensed, "Segoe UI", sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, "Roboto Mono", monospace;
  --f-body: "Source Serif 4", "Iowan Old Style", "Palatino Linotype", Georgia, "Noto Serif", serif;
  --rs: 1;
  --rl: 1.55;
  --rls: 0em;
  --rws: 0em;
  --f-read: var(--f-body);
  --f-choice: var(--f-head);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); }
body { color: var(--text); font-family: var(--f-body); -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; overscroll-behavior: none; }
button { font-family: inherit; cursor: pointer; color: inherit; }
button:disabled { cursor: default; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; }

#sb-app { height: 100vh; height: 100dvh; max-width: 520px; margin: 0 auto; display: flex; flex-direction: column; position: relative; overflow: hidden; background: var(--bg); }
@media (min-width: 560px) { #sb-app { border-left: 1px solid var(--line); border-right: 1px solid var(--line); } }

/* generic bits */
.head { font-family: var(--f-head); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.mono { font-family: var(--f-mono); }
.muted { color: var(--muted); }
.screen { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.pad { padding: 4px 16px 28px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.eyebrow { font-family: var(--f-mono); font-size: 12px; letter-spacing: .12em; color: var(--muted); text-transform: uppercase; }
.section-title { font-family: var(--f-head); font-weight: 600; font-size: 20px; letter-spacing: .1em; color: var(--muted); text-transform: uppercase; }

.btn { min-height: 52px; padding: 8px 16px; border-radius: 10px; border: 1px solid var(--line2); background: var(--card); color: var(--text); font-family: var(--f-head); font-weight: 600; font-size: 20px; letter-spacing: .06em; display: flex; align-items: center; justify-content: center; gap: 8px; text-align: center; }
.btn:active:not(:disabled) { transform: translateY(1px); filter: brightness(1.15); }
.btn.primary { background: var(--amber); border-color: var(--amber); color: var(--on-amber); font-weight: 700; letter-spacing: .1em; }
.btn.ghost { background: transparent; }
.btn.dashed { background: transparent; border: 1px dashed var(--line3); color: var(--amber-hi); font-weight: 700; letter-spacing: .1em; }
.btn.danger { background: transparent; color: var(--bad-soft); border-color: var(--red-line); }
.btn:disabled { background: var(--line); border-color: var(--line); color: var(--disabled-fg); }
.btn.big { min-height: 72px; font-size: 28px; flex-direction: column; gap: 2px; border-radius: 12px; }
.btn.big .sub { font-family: var(--f-mono); font-weight: 500; font-size: 13px; letter-spacing: 0; }
.btn.small { min-height: 44px; font-size: 17px; padding: 6px 14px; }
.btn:focus-visible, .iconbtn:focus-visible, .row:focus-visible { outline: 2px solid var(--amber-hi); outline-offset: 2px; }

.iconbtn { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; background: transparent; border: 0; color: var(--text); }
.chip { height: 44px; padding: 0 12px; display: flex; align-items: center; gap: 6px; background: var(--panel); border: 1px solid var(--line); border-radius: 22px; color: var(--amber-hi); font-family: var(--f-mono); font-weight: 600; font-size: 15px; }

.topbar { display: flex; align-items: center; justify-content: space-between; padding: 6px 8px 6px 4px; flex: 0 0 auto; }
.topbar .title { font-family: var(--f-head); font-weight: 600; font-size: 19px; letter-spacing: .1em; text-transform: uppercase; text-align: center; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.card.hl { border-color: var(--amber); }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; min-height: 56px; width: 100%; text-align: left; }
button.row:active { filter: brightness(1.2); }

/* lobby */
.logo { font-family: var(--f-head); font-weight: 700; font-size: 34px; letter-spacing: .14em; color: var(--amber-hi); line-height: 1; }
.seg { display: flex; border: 1px solid var(--line2); border-radius: 8px; overflow: hidden; }
.seg button { min-width: 52px; min-height: 40px; background: transparent; border: 0; font-family: var(--f-head); font-weight: 600; font-size: 17px; letter-spacing: .08em; }
.seg button.on { background: var(--amber); color: var(--on-amber); font-weight: 700; }

/* progress (creation) */
.steps { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.steps i { height: 6px; border-radius: 3px; background: var(--line); display: block; }
.steps i.done { background: var(--amber); }
.steps i.now { background: var(--amber-hi); }

.abrow { display: flex; align-items: center; gap: 12px; padding: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.abrow.active { background: var(--card); border-color: var(--amber); }
.abrow.locked { opacity: .55; }
.abrow .nm { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.abrow .nm b { font-family: var(--f-head); font-weight: 700; font-size: 19px; letter-spacing: .05em; text-transform: uppercase; overflow-wrap: anywhere; }
.abrow .nm span { font-size: 13px; color: var(--muted); line-height: 1.3; }
.dice { flex: 0 0 auto; display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; max-width: 150px; }
.die { width: 30px; height: 30px; border: 1px solid var(--line3); border-radius: 6px; display: flex; align-items: center; justify-content: center; font-family: var(--f-mono); font-weight: 600; font-size: 16px; }
.die.drop { opacity: .35; text-decoration: line-through; }
.die.spin { animation: sbspin .6s linear infinite; border-color: var(--amber-hi); }
.score { width: 72px; text-align: right; display: flex; flex-direction: column; }
.score b { font-family: var(--f-mono); font-weight: 600; font-size: 24px; }
.score span { font-family: var(--f-mono); font-size: 12px; color: var(--muted); }
.pos { color: var(--green); } .neg { color: var(--red-hi); } .zero { color: var(--text); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { min-height: 44px; padding: 6px 12px; border-radius: 22px; border: 1px solid var(--line2); background: transparent; font-family: var(--f-head); font-weight: 600; font-size: 17px; letter-spacing: .04em; display: inline-flex; align-items: center; gap: 6px; }
.pill small { font-family: var(--f-mono); font-size: 12px; color: var(--muted); font-weight: 400; }
.pill.on { background: var(--amber); border-color: var(--amber); color: var(--on-amber); }
.pill.on small { color: var(--pill-small); }
.pill:disabled { opacity: .4; }

input.text { width: 100%; min-height: 52px; padding: 8px 14px; background: var(--bg); color: var(--text); border: 1px solid var(--line2); border-radius: 10px; font-family: var(--f-body); font-size: 18px; }
input.text:focus { outline: 2px solid var(--amber); border-color: var(--amber); }

/* play screen */
.hdr { display: flex; align-items: center; justify-content: space-between; padding: 4px 4px 4px 4px; flex: 0 0 auto; background: var(--bg); }
.hdr .mid { display: flex; flex-direction: column; align-items: center; gap: 1px; min-width: 0; padding: 0 6px; }
.hdr .mid .clk { font-family: var(--f-mono); font-size: 12px; letter-spacing: .08em; color: var(--muted); }
.hdr .mid .loc { font-family: var(--f-head); font-weight: 600; font-size: 18px; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 62vw; }
.hdr .credit { height: 44px; min-width: 44px; padding: 0 10px; display: flex; align-items: center; gap: 6px; color: var(--amber-hi); font-family: var(--f-mono); font-weight: 600; font-size: 14px; background: transparent; border: 0; }

.status { display: flex; flex-direction: column; gap: 8px; padding: 10px 14px 12px; background: var(--panel); border: 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); flex: 0 0 auto; width: 100%; text-align: left; color: inherit; }
.bar { flex: 1; height: 12px; background: var(--bar-bg); border-radius: 3px; overflow: hidden; }
.bar > div { height: 100%; background: var(--red); transition: width .6s; }
.status .line1 { display: flex; align-items: center; gap: 10px; }
.status .line1 b.l { font-family: var(--f-head); font-weight: 700; font-size: 18px; letter-spacing: .08em; width: 28px; }
.status .line1 b.v { font-family: var(--f-mono); font-weight: 600; font-size: 18px; min-width: 56px; text-align: right; }
.status .line2 { display: flex; justify-content: space-between; font-family: var(--f-head); font-weight: 600; font-size: 15px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.status .line2 em { font-style: normal; font-family: var(--f-mono); }
.hpwarn .bar > div { background: var(--bad); }

.enemy { display: flex; align-items: center; gap: 10px; padding: 8px 14px; background: var(--red-bg); border-bottom: 1px solid var(--red-line); flex: 0 0 auto; flex-wrap: wrap; }
.enemy .en { display: flex; align-items: center; gap: 10px; width: 100%; }
.enemy .en.dead { opacity: .45; }
.enemy .nm { font-family: var(--f-head); font-weight: 700; font-size: 17px; letter-spacing: .08em; text-transform: uppercase; color: var(--red-hi); }
.enemy .pr { font-family: var(--f-mono); font-size: 12px; color: var(--foe-pr); }
.enemy .eb { flex: 1; height: 8px; background: var(--foe-bar-bg); border-radius: 3px; overflow: hidden; }
.enemy .eb div { height: 100%; background: var(--foe-bar); transition: width .6s; }
.enemy .hp { font-family: var(--f-mono); font-weight: 600; font-size: 15px; width: 52px; text-align: right; }

.feed { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 16px 14px 8px; display: flex; flex-direction: column; gap: 14px; -webkit-overflow-scrolling: touch; }
.feed > .spacer { flex: 1 1 auto; }
.gm .lab { font-family: var(--f-mono); font-size: 12px; letter-spacing: .12em; color: var(--muted); margin-bottom: 4px; }
.gm .tx { font-family: var(--f-read); font-size: calc(17px * var(--rs)); line-height: var(--rl); letter-spacing: var(--rls); word-spacing: var(--rws); white-space: pre-line; text-align: left; }
.rd { font-family: var(--f-read); font-size: calc(17px * var(--rs)); line-height: var(--rl); letter-spacing: var(--rls); word-spacing: var(--rws); text-align: left; }
.player { align-self: flex-end; max-width: 84%; background: var(--player-bg); color: var(--player-fg); padding: 10px 14px; border-radius: 14px 14px 4px 14px; font-family: var(--f-read); font-size: calc(16px * var(--rs)); line-height: calc(var(--rl) - .1); letter-spacing: var(--rls); word-spacing: var(--rws); }
.info { font-family: var(--f-mono); font-size: 12px; letter-spacing: .08em; color: var(--muted); text-align: center; text-transform: uppercase; }
.typing { display: flex; align-items: center; gap: 8px; color: var(--muted); font-family: var(--f-mono); font-size: 13px; }
.typing span.d { width: 6px; height: 6px; border-radius: 3px; background: var(--amber-hi); animation: sbblink 1.2s infinite; display: inline-block; }
.typing span.d:nth-child(2) { animation-delay: .2s; } .typing span.d:nth-child(3) { animation-delay: .4s; }

.delta { display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; animation: sbfade .25s ease-out; }
.delta .m { font-family: var(--f-mono); font-weight: 600; font-size: 18px; white-space: nowrap; }
.delta .d { font-family: var(--f-read); font-size: calc(14px * var(--rs)); line-height: calc(var(--rl) - .15); letter-spacing: var(--rls); color: var(--muted); }
.delta.bad .m { color: var(--bad); } .delta.good .m { color: var(--green); } .delta.rad .m { color: var(--rad); } .delta.erid .m { color: var(--erid); }
.delta.info .m { color: var(--amber-hi); } .delta.dead { border-color: var(--red-line); background: var(--red-bg); } .delta.dead .m { color: var(--red-hi); }

.combatcard { padding: 12px 14px; background: var(--red-bg); border: 1px solid var(--red-line); border-radius: 8px; }
.combatcard .t { font-family: var(--f-head); font-weight: 700; font-size: 20px; letter-spacing: .1em; color: var(--red-hi); }
.combatcard .x { font-family: var(--f-read); font-size: calc(15px * var(--rs)); line-height: calc(var(--rl) - .1); letter-spacing: var(--rls); margin-top: 4px; }
.endcard { padding: 14px; background: var(--card); border: 1px solid var(--amber); border-radius: 10px; display: flex; flex-direction: column; gap: 6px; }
.endcard .t { font-family: var(--f-head); font-weight: 700; font-size: 22px; letter-spacing: .1em; color: var(--amber-hi); }
.endcard .x { font-family: var(--f-read); font-size: calc(15px * var(--rs)); line-height: calc(var(--rl) - .1); letter-spacing: var(--rls); }
.endcard ul { margin: 2px 0 0; padding: 0; list-style: none; font-family: var(--f-mono); font-size: 13px; color: var(--muted); display: flex; flex-direction: column; gap: 3px; }

.roll { padding: 14px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; display: flex; flex-direction: column; gap: 10px; }
.roll .top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.roll .ti { font-family: var(--f-head); font-weight: 700; font-size: 19px; letter-spacing: .08em; text-transform: uppercase; color: var(--amber-hi); }
.roll .dr { font-family: var(--f-mono); font-weight: 600; font-size: 16px; white-space: nowrap; }
.roll .cx { font-family: var(--f-read); font-size: calc(15px * var(--rs)); line-height: calc(var(--rl) - .1); letter-spacing: var(--rls); color: var(--muted); }
.roll .pend, .roll .rolling, .roll .num { display: flex; align-items: center; gap: 14px; }
.roll .pend { color: var(--muted); font-family: var(--f-mono); font-size: 14px; }
.roll .box { width: 72px; height: 72px; flex: 0 0 auto; border: 2px solid var(--line2); border-radius: 10px; background: var(--bg); display: flex; align-items: center; justify-content: center; font-family: var(--f-mono); font-weight: 600; font-size: 38px; }
.roll .box.q { width: 64px; height: 64px; border: 2px dashed var(--line3); font-size: 28px; color: var(--muted); }
.roll .box.ok { border-color: var(--green); } .roll .box.ko { border-color: var(--red); } .roll .box.crit { border-color: var(--gold); color: var(--gold); } .roll .box.fumble { border-color: var(--bad); color: var(--bad); }
.roll .rolling { color: var(--amber-hi); font-family: var(--f-mono); font-size: 14px; }
.roll .rolling svg { animation: sbspin .7s linear infinite; }
.roll .eq { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.roll .eq .a { font-family: var(--f-mono); font-size: 15px; color: var(--muted); }
.roll .eq .b { font-family: var(--f-mono); font-weight: 600; font-size: 22px; }
.roll .eq .b small { font-size: 14px; font-weight: 400; color: var(--muted); }
.roll .out { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 14px; border-radius: 8px; animation: sbpop .35s ease-out; }
.roll .out b { font-family: var(--f-head); font-weight: 700; font-size: 24px; letter-spacing: .1em; }
.roll .out span { font-family: var(--f-mono); font-size: 14px; text-align: right; }
.roll .out.success { background: var(--green-bg); color: var(--green); border: 1px solid var(--green-line); }
.roll .out.failure { background: var(--red-bg); color: var(--red-hi); border: 1px solid var(--red-line); }
.roll .out.crit_success { background: var(--gold-bg); color: var(--gold); border: 1px solid var(--gold-line); }
.roll .out.crit_failure { background: var(--crit-bg); color: var(--bad); border: 1px solid var(--crit-line); }
.roll .note { font-size: 14px; color: var(--muted); }
.roll .brk { font-family: var(--f-mono); font-size: 12px; color: var(--dim); }

.dock { flex: 0 0 auto; padding: 12px 14px calc(14px + env(safe-area-inset-bottom)); background: var(--panel); border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.dock .choice { min-height: 50px; padding: 10px 14px; text-align: left; justify-content: flex-start; font-family: var(--f-choice); font-size: calc(21px * var(--rs)); line-height: calc(var(--rl) - .25); letter-spacing: var(--rls); }
.dock .grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
/* the player's own d20: a keypad 1-20 (SPEC 29) */
.dgrid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin: 12px 0; }
.dgrid .btn { min-height: 56px; font-size: 22px; font-family: var(--f-mono); padding: 0; }
.dock .wait { min-height: 50px; display: flex; align-items: center; justify-content: center; color: var(--muted); font-family: var(--f-mono); font-size: 13px; }
.dock .btn .sub { font-family: var(--f-mono); font-weight: 400; font-size: 11px; letter-spacing: 0; }
.dock .btn.tall { min-height: 64px; flex-direction: column; gap: 0; }

/* bottom sheet */
.overlay { position: absolute; inset: 0; z-index: 20; background: var(--overlay); display: flex; flex-direction: column; justify-content: flex-end; animation: sbfade .2s; }
.sheet { background: var(--bg); border-top: 1px solid var(--line2); border-radius: 16px 16px 0 0; max-height: 92%; display: flex; flex-direction: column; animation: sbup .25s ease-out; }
.sheet.full { height: 94%; }
.sheet .grab { width: 40px; height: 4px; border-radius: 2px; background: var(--line2); margin: 8px auto 0; flex: 0 0 auto; }
.sheet .sh { display: flex; align-items: center; justify-content: space-between; padding: 6px 8px 6px 18px; flex: 0 0 auto; }
.sheet .sh h2 { font-family: var(--f-head); font-weight: 700; font-size: 24px; letter-spacing: .08em; text-transform: uppercase; }
.sheet .sb { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 8px 16px calc(24px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 12px; }
.tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; padding: 8px 14px 12px; flex: 0 0 auto; }
.tabs button { min-height: 44px; background: transparent; border: 1px solid var(--line2); border-radius: 8px; font-family: var(--f-head); font-weight: 600; font-size: 16px; letter-spacing: .06em; color: var(--text); }
.tabs button.on { background: var(--amber); border-color: var(--amber); color: var(--on-amber); font-weight: 700; }
.hpbig { display: flex; align-items: baseline; justify-content: space-between; }
.hpbig b { font-family: var(--f-mono); font-weight: 600; font-size: 40px; }
.stat3 { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.stat3 div { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px 4px; text-align: center; }
.stat3 b { display: block; font-family: var(--f-mono); font-weight: 600; font-size: 24px; }
.stat3 span { font-family: var(--f-head); font-weight: 600; font-size: 14px; letter-spacing: .08em; color: var(--muted); }
.kv { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.kv .k { font-family: var(--f-head); font-weight: 600; font-size: 16px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.kv .v { font-family: var(--f-mono); font-weight: 600; font-size: 18px; }
.note { font-size: 13px; line-height: 1.4; color: var(--muted); }
.item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; min-height: 52px; }
.item .n { font-size: 17px; line-height: 1.25; }
.item .s { font-family: var(--f-mono); font-size: 12px; color: var(--muted); margin-top: 2px; line-height: 1.35; }
.item .w { min-width: 0; }

.toast { position: absolute; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 40; background: var(--card); border: 1px solid var(--amber); color: var(--text); padding: 10px 16px; border-radius: 22px; font-family: var(--f-mono); font-size: 13px; max-width: 86%; text-align: center; animation: sbfade .2s; }

.center { text-align: center; align-items: center; justify-content: center; }
.hero { padding: 40px 24px; gap: 14px; }

@keyframes sbspin { from { transform: rotate(0); } to { transform: rotate(360deg); } }
@keyframes sbpop { 0% { transform: scale(.6); opacity: 0; } 70% { transform: scale(1.12); opacity: 1; } 100% { transform: scale(1); } }
@keyframes sbblink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
@keyframes sbfade { from { opacity: 0; } to { opacity: 1; } }
@keyframes sbup { from { transform: translateY(40px); opacity: .6; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---- game page hygiene: nothing from the shop or the cookie plugin may cover the controls ---- */
.wcc-btn-revisit-wrapper, .cky-btn-revisit-wrapper { opacity: 0 !important; pointer-events: none !important; width: 1px !important; height: 1px !important; overflow: hidden !important; }
.grecaptcha-badge { visibility: hidden !important; }
.woocommerce-store-notice, .demo_store { display: none !important; }

.dock .sayrow { display: flex; gap: 8px; align-items: stretch; }
.dock .sayrow input.text { flex: 1; min-width: 0; }
.dock .sayrow .btn { flex: 0 0 auto; }

.abrow .nm .calc { display: block; margin-top: 4px; font-family: var(--f-mono); font-size: 12px; color: var(--amber); }

/* own AI key + AI voice */
select.text { width: 100%; min-height: 52px; padding: 8px 14px; background: var(--bg); color: var(--text); border: 1px solid var(--line2); border-radius: 10px; font-family: var(--f-body); font-size: 18px; }
select.text:focus { outline: 2px solid var(--amber); border-color: var(--amber); }
.toggle { display: flex; align-items: flex-start; gap: 12px; padding: 8px 2px; cursor: pointer; }
.toggle .n { font-size: 16px; line-height: 1.3; }
.toggle .s { font-size: 13px; line-height: 1.35; }
.chip .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--line2); display: inline-block; }
.chip .dot.on { background: var(--dot-on); }
.note.okmsg { color: var(--ok-text); }
.note.errmsg { color: var(--bad-soft); }

/* lobby: two labelled entries (credits, AI narration) */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile { text-align: left; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; color: var(--text); font: inherit; cursor: pointer; display: flex; flex-direction: column; gap: 4px; min-height: 92px; }
.tile:active { border-color: var(--amber-hi); }
.tile .tl { display: flex; align-items: center; gap: 8px; font-family: var(--f-mono); font-size: 11px; letter-spacing: .12em; color: var(--muted); }
.tile .tv { font-size: 24px; font-weight: 700; color: var(--amber-hi); line-height: 1.1; }
.tile .ts { font-size: 12px; opacity: .75; line-height: 1.3; }
.tile .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--line2); display: inline-block; }
.tile .dot.on { background: var(--dot-on); }
@media (max-width: 340px) { .tiles { grid-template-columns: 1fr; } }

.mapwrap { background: var(--map-bg); border-radius: 6px; padding: 8px; }
.planmap { width: 100%; height: auto; display: block; max-height: 60vh; }
.mapbtn[hidden] { display: none; }

/* ---- reading comfort: the player's own choices (panel "Lettura"), applied on <html> as data attributes + custom properties ---- */
:root[data-sb-font="chiaro"] {
  --f-read: "Atkinson Hyperlegible", Lexend, Verdana, Tahoma, "Segoe UI", system-ui, sans-serif;
  --f-choice: "Atkinson Hyperlegible", Lexend, Verdana, Tahoma, "Segoe UI", system-ui, sans-serif;
}
:root[data-sb-font="dislessia"] {
  --f-read: OpenDyslexic, "Open Dyslexic", Lexend, "Comic Sans MS", "Comic Neue", Verdana, Tahoma, sans-serif;
  --f-choice: OpenDyslexic, "Open Dyslexic", Lexend, "Comic Sans MS", "Comic Neue", Verdana, Tahoma, sans-serif;
}
/* Self-hosting the fonts (optional): put the files in assets/fonts/ and add, for example,
   @font-face { font-family: "Atkinson Hyperlegible"; src: url("fonts/AtkinsonHyperlegible-Regular.woff2") format("woff2"); font-display: swap; } */
.readprev { padding: 14px; border: 1px solid var(--line2); border-radius: 10px; background: var(--bg); }
.readprev .gm-tx { font-family: var(--f-read); font-size: calc(17px * var(--rs)); line-height: var(--rl); letter-spacing: var(--rls); word-spacing: var(--rws); }
.optrow { display: flex; flex-direction: column; gap: 6px; }
.optrow .ol { font-family: var(--f-head); font-weight: 600; font-size: 16px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.optrow .seg { flex-wrap: wrap; }
.optrow .seg button { flex: 1 1 0; min-width: 0; padding: 0 6px; color: inherit; }

/* ---- SoloRPG: mode switch, numbers typed from real dice, the printable sheet */
.modeseg { width: 100%; }
.modeseg button { flex: 1 1 0; min-width: 0; padding: 0 10px; font-size: 16px; color: inherit; }
.modeseg button.on { color: var(--on-amber); }
.abrow .rollin { display: flex; flex-direction: column; align-items: center; gap: 4px; flex: 0 0 auto; }
.abrow .rollin .how { font-size: 12px; color: var(--amber-hi); letter-spacing: .06em; white-space: nowrap; }
input.text.num { width: 76px; min-height: 52px; padding: 4px 6px; text-align: center; font-family: var(--f-mono); font-size: 22px; }
input.text.num.off, input.text.num.bad { border-color: var(--red-hi); outline: 2px solid var(--red-hi); }
.rollin-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rollin-line .how { font-size: 13px; color: var(--amber-hi); }
.tbl { border: 1px solid var(--line); border-radius: 10px; background: var(--panel); padding: 0 12px; }
.tbl summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; font-family: var(--f-head); font-weight: 600; font-size: 16px; letter-spacing: .06em; color: var(--amber-hi); }
/* the drop-downs (tables to open) must look openable: a visible chevron box, a border that stands out, a clear focus ring (display:flex had removed the browser's own marker) */
.tbl, .xdet { border-color: var(--line2); }
.xdet { border: 1px solid var(--line2); border-radius: 10px; background: var(--panel); padding: 0 12px; }
.tbl summary, .xdet summary { list-style: none; justify-content: space-between; gap: 12px; color: var(--amber-hi); }
.tbl summary::-webkit-details-marker, .xdet summary::-webkit-details-marker { display: none; }
.tbl summary::after, .xdet summary::after { content: '+'; flex: 0 0 auto; width: 28px; height: 28px; line-height: 24px; text-align: center; font-family: var(--f-mono); font-size: 22px; font-weight: 700; color: var(--amber-hi); border: 2px solid var(--amber-hi); border-radius: 8px; }
.tbl[open] summary::after, .xdet[open] summary::after { content: '\2212'; background: var(--amber); color: var(--on-amber); border-color: var(--amber); }
.tbl summary:focus-visible, .xdet summary:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; border-radius: 6px; }
.tbl[open] summary, .xdet[open] summary { border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.tbl-rows { display: flex; flex-direction: column; gap: 6px; padding: 4px 0 12px; font-size: 15px; }
.tbl-rows .kv { justify-content: flex-start; }
.tbl-rows .kv .mono { min-width: 44px; color: var(--amber-hi); }
.dim { color: var(--dim); }
.psheet .pname { font-size: 32px; overflow-wrap: anywhere; }
.psheet .stat3 span.dim { display: block; font-size: 11px; letter-spacing: 0; font-weight: 400; margin-top: 2px; }
.pgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.pbox { border: 1px solid var(--line2); border-radius: 8px; padding: 6px 8px; min-height: 56px; display: flex; flex-direction: column; justify-content: space-between; }
.pbox .k { font-family: var(--f-head); font-weight: 600; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.pbox b { font-family: var(--f-mono); font-size: 22px; font-weight: 600; min-height: 26px; }
.plines div { height: 30px; border-bottom: 1px solid var(--line2); }

/* the table's diary */
.dday { font-family: var(--f-head); font-weight: 600; font-size: 14px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-top: 6px; }
.dentry { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; }
.dentry.ok { border-color: var(--green-line); }
.dentry.bad { border-color: var(--red-line); }
.dentry.note-e { background: transparent; border-style: dashed; }
.dentry .dk { display: flex; align-items: center; gap: 8px; font-family: var(--f-mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.dentry .dk .mono { margin-left: auto; letter-spacing: 0; }
.dentry .dtitle { font-size: 18px; font-weight: 600; overflow-wrap: anywhere; }
.dentry .dtitle.big { font-size: 28px; color: var(--amber-hi); }
.dentry .dtitle.big.long { font-size: 21px; text-transform: none; letter-spacing: .02em; }
textarea.text { width: 100%; padding: 10px 14px; background: var(--bg); color: var(--text); border: 1px solid var(--line2); border-radius: 10px; font-family: var(--f-body); font-size: 17px; }
textarea.text:focus { outline: 2px solid var(--amber); border-color: var(--amber); }
.dentry .dh { font-size: 14px; line-height: 1.4; color: var(--muted); }
.dentry .dl { font-family: var(--f-mono); font-size: 13px; line-height: 1.5; color: var(--dim); overflow-wrap: anywhere; }
.dentry .dnote { white-space: pre-wrap; font-size: 16px; line-height: 1.5; overflow-wrap: anywhere; }
.dentry .dx { background: transparent; border: 0; color: var(--muted); min-width: 36px; min-height: 36px; display: flex; align-items: center; justify-content: center; margin: -8px -8px -8px 0; }
.dentry .dx svg { width: 16px; height: 16px; }

/* ---- expedition (SoloRPG) */
.modeseg.four { flex: 0 0 auto; }
.modeseg.four button { font-size: 14px; min-width: 0; flex: 1 1 0; padding: 0 2px; letter-spacing: .02em; }
.dentry .dtext { white-space: pre-wrap; font-size: 15px; line-height: 1.45; overflow-wrap: anywhere; }
.dentry.twist { border-color: var(--amber); }
.dentry.doc .dtitle { color: var(--amber-hi); }
.dchips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.dchips .chip { font-family: var(--f-mono); font-size: 13px; padding: 2px 8px; border-radius: 12px; border: 1px solid var(--line2); }
.dchips .chip.hp, .dchips .chip.rad { border-color: var(--red-line); color: var(--bad-soft); }
.dchips .chip.heal, .dchips .chip.erid { border-color: var(--green-line); color: var(--ok-text); }
.xclocks { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.xclock { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; min-width: 0; }
.xclock .xl { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-family: var(--f-mono); overflow-wrap: anywhere; }
.xclock .xv { font-size: 24px; color: var(--amber-hi); }
.xpips { display: flex; gap: 6px; margin-top: 4px; }
.xpips i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line2); display: block; }
.xpips i.on { background: var(--bad-soft); border-color: var(--bad-soft); }
.xsigns { font-size: 14px; line-height: 1.4; color: var(--dim); }
.xmission summary { cursor: pointer; font-family: var(--f-mono); font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); min-height: 32px; display: flex; align-items: center; }
.xmission summary::after { content: '  +'; }
.xmission[open] summary::after { content: '  −'; }
.xmission .xl2 { font-size: 15px; line-height: 1.45; margin-top: 4px; }
.xend.ok { border-color: var(--green-line); }
.xend.ko, .xend.abandoned { border-color: var(--red-line); }
.xenemy { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; display: flex; flex-direction: column; gap: 4px; }
.xenemy.down { opacity: .55; }
.xenemy .xen { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.xenemy .xen b { font-family: var(--f-head); font-size: 19px; letter-spacing: .04em; text-transform: uppercase; overflow-wrap: anywhere; }
.xbar { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.xbar i { display: block; height: 100%; background: var(--bad-soft); }
.xenemy .xes { font-size: 12px; color: var(--muted); }
.xenemy .xsp { font-size: 14px; line-height: 1.4; color: var(--dim); }
.xacts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.xcalc { font-family: var(--f-mono); color: var(--amber); font-size: 14px; }
.xteach { border-left: 3px solid var(--amber); padding-left: 10px; }

.xtbl { max-height: 240px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); position: relative; }
.xtbl .xrow { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 8px; padding: 5px 10px; font-size: 14px; line-height: 1.35; border-bottom: 1px solid var(--line); }
.xtbl .xrow:last-child { border-bottom: 0; }
.xtbl .xr { color: var(--amber-hi); font-size: 13px; }
.xtbl .xt { overflow-wrap: anywhere; }
.xtbl .xrow.hit { background: var(--amber); color: var(--on-amber); font-weight: 600; }
.xtbl .xrow.hit .xr { color: var(--on-amber); }
.xdet { margin-bottom: 8px; }
.xdet summary { cursor: pointer; min-height: 40px; display: flex; align-items: center; font-family: var(--f-head); font-size: 18px; letter-spacing: .04em; }
.xdet .xtbl { max-height: none; }
.xlore:hover { border-color: var(--amber); }

@media print {
  html.sb-printing, html.sb-printing body { height: auto !important; background: white !important; }
  html.sb-printing #sb-app { height: auto !important; max-height: none !important; overflow: visible !important; border: 0 !important; position: static !important; }
  html.sb-printing #sb-app > :not(.overlay) { display: none !important; }
  html.sb-printing .overlay { position: static !important; display: block !important; background: white !important; animation: none !important; }
  html.sb-printing .sheet, html.sb-printing .sheet.full { position: static !important; height: auto !important; max-height: none !important; border: 0 !important; border-radius: 0 !important; background: white !important; animation: none !important; display: block !important; }
  html.sb-printing .sheet .sb { overflow: visible !important; padding: 0 !important; display: block !important; }
  html.sb-printing .sheet .grab, html.sb-printing .sheet .sh, html.sb-printing .noprint { display: none !important; }
  html.sb-printing .psheet { color: black !important; --text: black; --muted: black; --dim: black; --line: gray; --line2: dimgray; --panel: white; --card: white; --green: black; --red-hi: black; }
  html.sb-printing .psheet * { color: black !important; background: transparent !important; }
  html.sb-printing .psheet .stat3 div, html.sb-printing .psheet .pbox { border: 1px solid black !important; }
  html.sb-printing .psheet .pbox.blank { min-height: 70px; }
  html.sb-printing .psheet { break-inside: avoid-page; }
}
