/* Elrendezés: egyképernyős olvasó — fent sáv (menü + futófej + értékek), középen görgethető „lap”,
   lent a számozott választógombok. A vázlat színszerepei: szürke képernyő, zöldes szövegterület,
   kék választás, piros menü, zöld keret a kijelölésen. */
:root {
  --frame: #50555d;
  --frame-2: #5d636c;
  --frame-ink: #f1f3f5;
  --frame-soft: #c9ced5;
  --paper: #e9eee4;
  --paper-2: #dfe6d9;
  --ink: #1b201d;
  --ink-soft: #56615a;
  --rule: #c3cdbd;
  --choice: #2047c7;
  --choice-2: #18379c;
  --choice-ink: #ffffff;
  --pick: #1f9d4a;
  --menu: #c3382a;
  --good: #23743e;
  --bad: #b02a1f;
  --warn: #9a5a12;
  --shadow: 0 1px 0 rgba(0,0,0,.08), 0 8px 24px rgba(0,0,0,.18);
  --font-read: "EB Garamond", Garamond, "Times New Roman", serif;
  --font-ui: "IBM Plex Sans Condensed", "Arial Narrow", system-ui, sans-serif;
  --font-mark: "Uncial Antiqua", "EB Garamond", serif;
  --text: 19px;
  --fig-filter: none;
  --fig-blend: multiply;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --frame: #17191d; --frame-2: #22252b; --frame-ink: #e4e7eb; --frame-soft: #9aa1ab;
    --paper: #1d2420; --paper-2: #242d27; --ink: #e0e7dd; --ink-soft: #9ba79f; --rule: #34403a;
    --choice: #3e6cf2; --choice-2: #2c55d1; --choice-ink: #ffffff; --pick: #43cf72; --menu: #e2533f;
    --good: #5cc684; --bad: #f0715f; --warn: #e3a24b;
    --shadow: 0 1px 0 rgba(0,0,0,.3), 0 10px 28px rgba(0,0,0,.45);
    --fig-filter: invert(1) hue-rotate(180deg) brightness(.88);
    --fig-blend: screen;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --frame: #17191d; --frame-2: #22252b; --frame-ink: #e4e7eb; --frame-soft: #9aa1ab;
  --paper: #1d2420; --paper-2: #242d27; --ink: #e0e7dd; --ink-soft: #9ba79f; --rule: #34403a;
  --choice: #3e6cf2; --choice-2: #2c55d1; --choice-ink: #ffffff; --pick: #43cf72; --menu: #e2533f;
  --good: #5cc684; --bad: #f0715f; --warn: #e3a24b;
  --shadow: 0 1px 0 rgba(0,0,0,.3), 0 10px 28px rgba(0,0,0,.45);
  --fig-filter: invert(1) hue-rotate(180deg) brightness(.88);
  --fig-blend: screen;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body { margin: 0; background: var(--frame); color: var(--frame-ink); font-family: var(--font-ui); font-size: 15px; overflow: hidden; }
button { font: inherit; color: inherit; touch-action: manipulation; } /* iOS: a két gyors koppintás ne nagyítson */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid var(--pick); outline-offset: 2px; }
[hidden] { display: none !important; }

#app { height: 100%; max-width: 560px; margin: 0 auto; padding-inline: 16px; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }

/* ---- felső sáv ---- */
#bar { display: flex; align-items: center; gap: 10px; padding-block: 10px 8px; min-width: 0; }
.menu-key { flex: none; width: 44px; height: 44px; border: 0; border-radius: 6px; background: var(--menu); display: grid; place-items: center; cursor: pointer; box-shadow: var(--shadow); }
.menu-key span { display: block; width: 20px; height: 2px; background: #fff; box-shadow: 0 -6px 0 #fff, 0 6px 0 #fff; }
.runhead { font-family: var(--font-read); font-weight: 600; font-size: 20px; letter-spacing: .02em; color: var(--frame-ink); white-space: nowrap; min-width: 0; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.runhead small { font-family: var(--font-ui); font-weight: 400; font-size: 12px; color: var(--frame-soft); letter-spacing: .06em; text-transform: uppercase; margin-left: 6px; }
.stats { display: flex; gap: 6px; flex: none; background: none; border: 0; padding: 0; cursor: pointer; }
.stat { display: grid; justify-items: center; min-width: 46px; padding: 3px 6px 4px; border-radius: 6px; background: var(--frame-2); line-height: 1.05; }
.stat b { font-size: 18px; font-variant-numeric: tabular-nums; font-weight: 600; }
.stat i { font-style: normal; font-size: 9.5px; letter-spacing: .1em; color: var(--frame-soft); text-transform: uppercase; }
.stat.low b { color: #ffb4a8; }
.stat.flash { animation: flash .7s ease-out; }
/* A Vértengerek: öt érték (legénység, hajónapló) – keskenyebb dobozok */
.stats.compact { gap: 4px; }
.stats.compact .stat { min-width: 36px; padding: 3px 4px 4px; }
.stats.compact .stat b { font-size: 16px; }
.stats.compact .stat i { font-size: 8.5px; letter-spacing: .06em; }
@keyframes flash { from { background: var(--pick); } to { background: var(--frame-2); } }

/* ---- olvasólap ---- */
#page { background: var(--paper); color: var(--ink); border-radius: 4px; overflow-y: auto; overscroll-behavior: contain; box-shadow: var(--shadow); -webkit-overflow-scrolling: touch; min-height: 0; }
.sheet-inner { padding: 22px 20px 28px; max-width: 34em; margin: 0 auto; }
.secno { text-align: center; font-family: var(--font-read); font-weight: 700; font-size: calc(var(--text) * 1.15); margin: 0 0 .5em; }
.prose { font-family: var(--font-read); font-size: var(--text); line-height: 1.5; hyphens: auto; -webkit-hyphens: auto; text-wrap: pretty; }
.prose p { margin: 0 0 .7em; }
.prose p + p { text-indent: 1.2em; }
.prose p.cont { text-indent: 0; }
.sc { font-variant-caps: all-small-caps; letter-spacing: .04em; }
.opt { border-radius: 3px; box-decoration-break: clone; -webkit-box-decoration-break: clone; transition: background-color .15s; cursor: pointer; }
.opt .badge { display: inline-grid; place-items: center; min-width: 1.35em; height: 1.35em; padding: 0 .25em; margin-right: .3em; border-radius: 4px; background: var(--choice); color: var(--choice-ink); font-family: var(--font-ui); font-size: .72em; font-weight: 600; vertical-align: .12em; text-indent: 0; }
.opt.locked .badge { background: var(--ink-soft); }
.opt.sel { background: color-mix(in srgb, var(--pick) 18%, transparent); box-shadow: 0 0 0 2px var(--pick); }
.foe { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 4px 14px; align-items: baseline; font-family: var(--font-read); font-size: var(--text); margin: .3em 0 .8em; padding: .35em 0; border-block: 1px solid var(--rule); }
.foe em { font-style: italic; min-width: 0; }
.foe span { white-space: nowrap; font-variant-numeric: tabular-nums; }
.foe-head { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 4px 14px; font-family: var(--font-read); font-size: calc(var(--text) * .85); color: var(--ink-soft); margin-top: .4em; }
.foe.frow { border: 0; margin: 0; padding: .1em 0; }
/* illusztrációk: a papírba olvadnak (sötét témában invertálva) */
.fig { margin: .3em 0 1.1em; display: flex; justify-content: center; }
.figbtn { border: 0; padding: 0; background: none; cursor: zoom-in; max-width: 100%; display: block; }
.fig img { display: block; max-width: 100%; height: auto; max-height: 46vh; width: auto; filter: var(--fig-filter); mix-blend-mode: var(--fig-blend); }
.viewer { position: fixed; z-index: 80; inset: 0; background: #fff; display: grid; grid-template-rows: auto minmax(0, 1fr); }
.vbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px; background: #f1f1ef; color: #1b201d; font-size: 14px; }
.vbar .sh-close { background: #dedfdb; color: #1b201d; }
.vbody { overflow: auto; display: grid; place-items: center; padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0px)); -webkit-overflow-scrolling: touch; }
.vbody img { max-width: 100%; max-height: 100%; object-fit: contain; }
.viewer.zoom .vbody { place-items: start; }
.viewer.zoom .vbody img { max-width: none; max-height: none; width: 200%; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.gitem { border: 1px solid var(--rule); border-radius: 6px; background: #fff; padding: 6px; display: grid; gap: 4px; cursor: zoom-in; }
.gitem img { width: 100%; aspect-ratio: 1; object-fit: contain; max-width: 100%; }
.gitem span { font-family: var(--font-read); font-weight: 600; color: #1b201d; font-size: 14px; }
.book.has-cover { grid-template-columns: auto minmax(0, 1fr) auto; }
.book.has-cover .cover { grid-row: 1 / span 2; grid-column: 1; width: 48px; height: auto; border-radius: 3px; border: 1px solid var(--rule); }
.book.has-cover .t, .book.has-cover .s { grid-column: 2; }
.book.has-cover .go { grid-column: 3; }

.ending { margin-top: 1.2em; padding: 12px 14px; border-left: 4px solid var(--bad); background: var(--paper-2); font-family: var(--font-ui); font-size: 15px; }
.ending.won { border-color: var(--good); }

/* mechanika-panelek a szöveg végén */
.mech { margin-top: 18px; display: grid; gap: 12px; font-family: var(--font-ui); font-size: 14.5px; }
.panel { border: 1px solid var(--rule); border-radius: 6px; padding: 10px 12px; background: var(--paper-2); }
.panel h4 { margin: 0 0 6px; font-size: 11.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-soft); font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--rule); background: var(--paper); color: var(--ink); border-radius: 999px; padding: 5px 11px; font-size: 13.5px; cursor: pointer; }
.chip.on { border-color: var(--good); color: var(--good); }
.chip.minus { }
.chip .x { color: var(--ink-soft); font-size: 12px; }
.result { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.result .verdict { font-weight: 600; }
.result .verdict.ok { color: var(--good); }
.result .verdict.no { color: var(--bad); }
.dice { display: inline-flex; gap: 5px; }
.die { width: 26px; height: 26px; border-radius: 5px; background: var(--paper); border: 1.5px solid var(--ink); display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); padding: 3px; }
.die i { width: 5px; height: 5px; border-radius: 50%; background: var(--ink); place-self: center; visibility: hidden; }
.die[data-v="1"] i:nth-child(5), .die[data-v="2"] i:nth-child(1), .die[data-v="2"] i:nth-child(9),
.die[data-v="3"] i:nth-child(1), .die[data-v="3"] i:nth-child(5), .die[data-v="3"] i:nth-child(9),
.die[data-v="4"] i:nth-child(1), .die[data-v="4"] i:nth-child(3), .die[data-v="4"] i:nth-child(7), .die[data-v="4"] i:nth-child(9),
.die[data-v="5"] i:nth-child(1), .die[data-v="5"] i:nth-child(3), .die[data-v="5"] i:nth-child(5), .die[data-v="5"] i:nth-child(7), .die[data-v="5"] i:nth-child(9),
.die[data-v="6"] i:nth-child(1), .die[data-v="6"] i:nth-child(3), .die[data-v="6"] i:nth-child(4), .die[data-v="6"] i:nth-child(6), .die[data-v="6"] i:nth-child(7), .die[data-v="6"] i:nth-child(9) { visibility: visible; }
.die.big { width: 40px; height: 40px; border-radius: 8px; padding: 5px; }
.die.big i { width: 7px; height: 7px; }
.rolling .die { animation: shake .45s ease-in-out; }
@keyframes shake { 0%,100% { transform: rotate(0) } 25% { transform: rotate(-14deg) translateY(-2px) } 60% { transform: rotate(10deg) } }

.foes { display: grid; gap: 8px; }
.foecard { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 10px; align-items: center; padding: 8px 10px; border-radius: 6px; border: 1.5px solid var(--rule); background: var(--paper); cursor: pointer; }
.foecard.target { border-color: var(--choice); }
.foecard.dead { opacity: .5; text-decoration: line-through; cursor: default; }
.foecard .nm { font-family: var(--font-read); font-size: 17px; font-style: italic; min-width: 0; overflow-wrap: anywhere; }
.foecard .nums { font-variant-numeric: tabular-nums; white-space: nowrap; font-size: 13.5px; }
.bar { grid-column: 1 / -1; height: 6px; border-radius: 3px; background: var(--rule); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--bad); transition: width .25s; }
.adj { display: inline-flex; gap: 4px; }
.adj button, .mini { border: 1px solid var(--rule); background: var(--paper); color: var(--ink); border-radius: 5px; min-width: 30px; height: 28px; cursor: pointer; font-size: 14px; }
.roundlog { font-size: 13.5px; color: var(--ink-soft); display: grid; gap: 2px; max-height: 9.5em; overflow-y: auto; }
.roundlog b { color: var(--ink); }
.mods { display: flex; flex-wrap: wrap; gap: 8px 14px; font-size: 13px; color: var(--ink-soft); }
.mods label { display: inline-flex; align-items: center; gap: 4px; }
.mods input { width: 3.4em; font: inherit; font-size: 16px; color: var(--ink); background: var(--paper); border: 1px solid var(--rule); border-radius: 4px; padding: 2px 4px; } /* 16px alatt az iOS ránagyít */

/* ---- alsó dokk ---- */
#dock { padding-block: 10px 12px; padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px)); display: grid; gap: 9px; }
.hint { min-height: 1.3em; font-size: 13.5px; color: var(--frame-soft); text-align: center; line-height: 1.3; overflow-wrap: anywhere; }
.hint b { color: var(--frame-ink); font-weight: 600; }
.hint button { background: none; border: 0; color: var(--frame-ink); text-decoration: underline; cursor: pointer; padding: 0 2px; font-size: 13px; }
.acts { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.act { border: 0; border-radius: 999px; padding: 10px 16px; min-height: 44px; background: var(--frame-ink); color: var(--frame); font-weight: 600; font-size: 15px; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; box-shadow: var(--shadow); }
.act.quiet { background: var(--frame-2); color: var(--frame-ink); box-shadow: none; }
.act.danger { background: var(--bad); color: #fff; }
.act:disabled { opacity: .45; cursor: default; }
.act.pulse { animation: pulse 1s ease-out 2; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--pick) 70%, transparent); } 100% { box-shadow: 0 0 0 14px transparent; } }
.keys { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; }
.key { position: relative; width: 58px; height: 58px; border: 0; border-radius: 6px; background: var(--choice); color: var(--choice-ink); font-size: 24px; font-weight: 600; font-variant-numeric: tabular-nums; cursor: pointer; box-shadow: var(--shadow); transition: transform .08s; }
.key:active { transform: scale(.96); }
.key.sel { outline: 4px solid var(--pick); outline-offset: 3px; }
.key.ready { outline: 3px dashed var(--pick); outline-offset: 3px; }
.chip button.x { background: none; border: 0; padding: 0 2px; color: var(--ink-soft); text-decoration: underline; cursor: pointer; font-size: 12px; }
.key.locked { background: var(--frame-2); color: var(--frame-soft); box-shadow: none; }
.key.cond::after { content: ""; position: absolute; top: 6px; right: 6px; width: 7px; height: 7px; border-radius: 50%; background: #ffd25e; }
.key.seen::before { content: "✓"; position: absolute; left: 6px; top: 3px; font-size: 11px; opacity: .8; }
.key small { position: absolute; bottom: 3px; left: 0; right: 0; font-size: 10px; font-weight: 400; opacity: .85; }
.endbox { text-align: center; display: grid; gap: 10px; justify-items: center; }
.endbox h3 { margin: 0; font-family: var(--font-read); font-size: 26px; font-weight: 700; }
.endbox p { margin: 0; color: var(--frame-soft); font-size: 14px; }

/* ---- menü ---- */
.scrim { position: fixed; inset: 0; background: rgba(10,12,14,.45); z-index: 20; }
#drawer { position: fixed; z-index: 30; top: 0; bottom: 0; left: 0; width: min(84vw, calc(320px + env(safe-area-inset-left, 0px))); background: var(--frame-2); color: var(--frame-ink); padding: calc(16px + env(safe-area-inset-top, 0px)) 16px calc(16px + env(safe-area-inset-bottom, 0px)) calc(16px + env(safe-area-inset-left, 0px)); display: flex; flex-direction: column; gap: 4px; transform: translateX(-102%); transition: transform .22s ease; overflow-y: auto; }
#drawer.open { transform: none; }
.brand { font-family: var(--font-mark); font-size: 21px; line-height: 1.15; margin: 4px 4px 2px; }
.brand-sub { font-size: 12.5px; color: var(--frame-soft); margin: 0 4px 12px; overflow-wrap: anywhere; }
.mi { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; background: none; border: 0; border-radius: 6px; padding: 11px 10px; font-size: 16px; cursor: pointer; color: var(--frame-ink); }
.mi:hover { background: rgba(255,255,255,.06); }
.mi .ic { width: 22px; text-align: center; color: var(--frame-soft); font-size: 15px; }
.mi .ct { margin-left: auto; font-size: 12.5px; color: var(--frame-soft); font-variant-numeric: tabular-nums; }
.mi.red .ic { color: var(--menu); }
.msep { height: 1px; background: rgba(255,255,255,.1); margin: 6px 4px; }

/* ---- lapok (bottom sheet) ---- */
#sheet { position: fixed; z-index: 40; left: 0; right: 0; bottom: 0; max-height: 88%; display: flex; flex-direction: column; background: var(--paper); color: var(--ink); border-radius: 12px 12px 0 0; box-shadow: var(--shadow); max-width: 560px; margin: 0 auto; padding-bottom: env(safe-area-inset-bottom, 0px); }
.sh-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px 10px; border-bottom: 1px solid var(--rule); }
.sh-head h3 { margin: 0; font-size: 17px; font-weight: 600; flex: 1; min-width: 0; }
.sh-close { border: 0; background: var(--paper-2); color: var(--ink); width: 36px; height: 36px; border-radius: 50%; font-size: 18px; cursor: pointer; }
.sh-body { overflow-y: auto; padding: 14px 16px 18px; display: grid; gap: 14px; min-height: 0; }
.sh-body h5 { margin: 0; font-size: 11.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-soft); font-weight: 600; }
.statgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.statgrid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 8px; }
.sbox { border: 1px solid var(--rule); border-radius: 6px; padding: 8px; display: grid; gap: 4px; justify-items: center; background: var(--paper-2); }
.sbox .lbl { font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-soft); }
.sbox .val { font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1; }
.sbox .ini { font-size: 12px; color: var(--ink-soft); }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row .grow { flex: 1; min-width: 0; }
.list { display: grid; gap: 6px; }
.li { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: 1px solid var(--rule); border-radius: 6px; background: var(--paper-2); min-width: 0; }
.li .nm { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.li .meta { font-size: 12px; color: var(--ink-soft); }
.tag { font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; border-radius: 4px; padding: 2px 6px; background: var(--paper); border: 1px solid var(--rule); color: var(--ink-soft); white-space: nowrap; }
.btn { border: 1px solid var(--rule); background: var(--paper); color: var(--ink); border-radius: 6px; padding: 8px 12px; min-height: 38px; cursor: pointer; font-size: 14.5px; }
.btn.pri { background: var(--choice); color: var(--choice-ink); border-color: var(--choice); }
.btn.red { color: var(--bad); }
.btn:disabled { opacity: .45; cursor: default; }
.field { font: inherit; font-size: 16px; color: var(--ink); background: var(--paper); border: 1px solid var(--rule); border-radius: 6px; padding: 8px 10px; min-width: 0; width: 100%; }
.log { display: grid; gap: 0; font-size: 14px; }
.log .rnd { font-size: 11.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-soft); padding: 10px 0 4px; font-weight: 600; }
.log .e { display: grid; grid-template-columns: 3.2em 3em minmax(0, 1fr); gap: 8px; padding: 5px 0; border-bottom: 1px solid color-mix(in srgb, var(--rule) 60%, transparent); align-items: baseline; }
.log .e .tm { color: var(--ink-soft); font-size: 12px; font-variant-numeric: tabular-nums; }
.log .e .sn { font-family: var(--font-read); font-weight: 600; font-variant-numeric: tabular-nums; }
.log .e .m { overflow-wrap: anywhere; }
.log .e.k-death .m, .log .e.k-hurt .m { color: var(--bad); }
.log .e.k-win .m, .log .e.k-gain .m { color: var(--good); }
.prose-sm { font-family: var(--font-read); font-size: 17px; line-height: 1.5; }
.prose-sm h4 { font-family: var(--font-read); font-size: 19px; margin: 1em 0 .3em; }
.prose-sm p { margin: 0 0 .6em; }
.muted { color: var(--ink-soft); font-size: 13.5px; }
.prog { height: 8px; border-radius: 4px; background: var(--rule); overflow: hidden; }
.prog > i { display: block; height: 100%; background: var(--choice); width: 0; transition: width .3s; }
.drop { border: 2px dashed var(--rule); border-radius: 8px; padding: 16px; display: grid; gap: 8px; justify-items: start; }
.appimg { width: 100%; border-radius: 6px; border: 1px solid var(--rule); background: #fff; }
.sh-body .figbtn { width: 100%; margin-bottom: 10px; }

/* ---- könyvtár / karakteralkotás (a lapon belül) ---- */
.lib h1 { font-family: var(--font-mark); font-weight: 400; font-size: 30px; line-height: 1.1; margin: 4px 0 6px; text-wrap: balance; }
.lib .lead { font-family: var(--font-read); font-size: 18px; line-height: 1.45; margin: 0 0 16px; color: var(--ink); }
.books { display: grid; gap: 8px; margin: 10px 0 18px; }
.book { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; align-items: center; border: 1px solid var(--rule); border-radius: 8px; padding: 12px; background: var(--paper-2); }
.book .t { font-family: var(--font-read); font-size: 19px; font-weight: 400; min-width: 0; overflow-wrap: anywhere; }
/* alaptörténet: minden eszközön ott van – félkövér cím; a saját (csak az eszközön tárolt) könyv sima betűs */
.book.base .t { font-weight: 700; }
.libsec { font-family: var(--font-ui); font-size: 12.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-soft); margin: 18px 0 0; }
.libsec small { font-size: inherit; font-weight: 400; letter-spacing: .04em; text-transform: none; }
.warn { padding: 8px 10px; border-left: 3px solid var(--bad); background: var(--paper-2); }
.book .s { grid-column: 1; font-size: 13px; color: var(--ink-soft); }
.book .go { grid-row: 1 / span 2; grid-column: 2; }
.book .more { grid-column: 1 / -1; display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.setup h2 { font-family: var(--font-read); font-size: 26px; margin: 0 0 4px; }
.rollrow { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--rule); }
.rollrow .lbl { font-family: var(--font-read); font-size: 18px; }
.rollrow .lbl small { display: block; font-family: var(--font-ui); font-size: 12.5px; color: var(--ink-soft); }
.rollrow .v { font-size: 28px; font-weight: 600; font-variant-numeric: tabular-nums; min-width: 1.6em; text-align: right; }
.potions { display: grid; gap: 8px; }
.potion { text-align: left; border: 2px solid var(--rule); border-radius: 8px; padding: 10px 12px; background: var(--paper-2); color: var(--ink); cursor: pointer; display: grid; gap: 2px; }
.potion b { font-family: var(--font-read); font-size: 18px; }
.potion span { font-size: 13.5px; color: var(--ink-soft); }
.potion.sel { border-color: var(--pick); }

.toast { position: fixed; z-index: 60; left: 50%; bottom: calc(150px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--ink); color: var(--paper); padding: 9px 14px; border-radius: 8px; font-size: 14px; max-width: calc(100% - 32px); box-shadow: var(--shadow); }
.modal { position: fixed; z-index: 70; inset: 0; display: grid; place-items: center; padding: 16px; background: rgba(10,12,14,.5); }
.modal .box { background: var(--paper); color: var(--ink); border-radius: 10px; padding: 18px; max-width: 380px; width: 100%; display: grid; gap: 12px; box-shadow: var(--shadow); }
.modal .box p { margin: 0; line-height: 1.45; }
.modal .row { justify-content: flex-end; }

@media (min-width: 700px) { #app { padding-block: 8px; } }

/* önálló webapp (főképernyőről indítva): az állapotsor és a kivágás alá nem kerülhet tartalom.
   A claude.ai-os változatban ezt a keret már elvégzi, ott nincs .pwa osztály. */
.pwa, .pwa body { overscroll-behavior: none; }
.pwa #app { padding-top: env(safe-area-inset-top, 0px); padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.install { display: grid; gap: 6px; }
.install .shr { display: inline-block; width: 15px; height: 18px; vertical-align: -3px; margin: 0 2px; border: 2px solid currentColor; border-top: 0; border-radius: 0 0 3px 3px; position: relative; }
.install .shr::before { content: ""; position: absolute; left: 50%; top: -9px; width: 2px; height: 14px; margin-left: -1px; background: currentColor; }
.install .shr::after { content: ""; position: absolute; left: 50%; top: -9px; width: 7px; height: 7px; margin-left: -4px; border-left: 2px solid currentColor; border-top: 2px solid currentColor; transform: rotate(45deg); }
/* ---- 5. kiadás: kijelölés tiltása, fordítás, mondatfordítás, 2. formátum, kalandnapló ---- */
body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
input, textarea, select { -webkit-user-select: text; user-select: text; }
.tr-key { flex: none; width: 38px; height: 44px; border: 0; border-radius: 6px; background: var(--frame-2); color: var(--frame-ink); display: grid; justify-items: center; align-content: center; gap: 1px; padding: 0; cursor: pointer; line-height: 1; }
.tr-key .globe { display: block; height: 18px; }
.tr-key i { font-style: normal; font-size: 9.5px; letter-spacing: .08em; color: var(--frame-soft); }
/* szűk fejlécben (sok érték) a fejezetpont száma látsszon, a „kör” felirat nem fontos */
#bar:has(.stats.compact) { gap: 6px; }
@media (max-width: 420px) { #bar:has(.stats.compact) .runhead small { display: none; } }
.snt { border-radius: 3px; transition: color 2s linear, background-color 2s linear; }
.snt.press { color: var(--pick); background-color: color-mix(in srgb, var(--pick) 14%, transparent); }
.langs { display: inline-flex; gap: 4px; }
.lang { border: 1px solid var(--rule); background: var(--paper); color: var(--ink); border-radius: 5px; padding: 4px 8px; font-size: 13px; cursor: pointer; }
.lang.on { background: var(--choice); color: var(--choice-ink); border-color: var(--choice); }
.trbox { max-width: 520px; max-height: 70vh; grid-template-rows: auto minmax(0, 1fr) auto; }
.trhead { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.trhead b { flex: 1; }
.trbody { overflow-y: auto; font-family: var(--font-read); font-size: 17px; line-height: 1.45; min-height: 0; }
.trbody p { margin: 0 0 .6em; }
.badge { display: inline-grid; place-items: center; min-width: 1.35em; height: 1.35em; margin-right: .3em; border-radius: 4px; background: var(--choice); color: var(--choice-ink); font-family: var(--font-ui); font-size: .72em; font-weight: 600; }
.sntbox { display: grid; gap: 10px; }
.sntbox .hu { font-family: var(--font-read); font-size: 18px; line-height: 1.4; }
.trtext { font-family: var(--font-read); font-size: 18px; line-height: 1.4; color: var(--good); }
.testline { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-family: var(--font-ui); font-size: 14px; color: var(--ink-soft); margin: .4em 0 .9em; }
.panel.inline { margin: .4em 0 .9em; font-family: var(--font-ui); font-size: 14.5px; }
.prose p.outcome { border-left: 3px solid var(--pick); padding-left: .5em; text-indent: 0; }
.prose p.alt { opacity: .45; }
.rule-note { font-family: var(--font-ui); font-size: 13.5px; color: var(--ink-soft); font-style: italic; text-indent: 0 !important; }
.actline { margin: .3em 0 .9em; font-family: var(--font-ui); font-size: 14px; }
.shop { display: grid; gap: 8px; margin: .4em 0 1em; font-family: var(--font-ui); font-size: 14px; }
.ware { border: 1px solid var(--rule); border-radius: 6px; padding: 8px 10px; background: var(--paper-2); display: grid; gap: 4px; }
.ware .wn { display: flex; justify-content: space-between; gap: 8px; }
.ware .wa, .gamble .wa { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.journal { display: grid; gap: 6px; font-size: 14px; }
.journal .jhead { display: grid; gap: 2px; }
.journal .jsec { margin-top: 8px; font-family: var(--font-read); font-size: 16px; line-height: 1.45; }
.journal .jsec p { margin: 0 0 .5em; }
.journal .jn { font-weight: 700; }
.journal .jev { color: var(--ink-soft); font-size: 13px; padding-left: 10px; }
.journal .jev.choice { color: var(--choice); font-weight: 600; }
.sv-hu { font-family: var(--font-read); font-size: 16px; }
.sv-tr { color: var(--good); font-family: var(--font-read); font-size: 15px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } .snt { transition: color 2s linear, background-color 2s linear !important; } } /* a zöldülés színváltás, nem mozgás */
