[hidden] { display: none !important; }
:root {
  --wood: #2E2218; --wood2: #1C140E; --ink: #120804; --gold: #E8C27A; --gold2: #B08850; --text: #F2E6D0; --muted: #BFAE92; --line: #5A4630;
  --parch: #EDE0C4; --parch2: #CDB88E; --green: #7CC88A; --red: #E0604A; --blue: #6AB0F0; --purple: #B07AF0; --orange: #E8902A;
  --r-common: #9A9A9A; --r-uncommon: #4FAF5A; --r-rare: #3F7FD8; --r-epic: #9A4FD8; --r-legendary: #E8902A; --r-mythic: #D83A2A;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--wood2); color: var(--text); font: 500 15px/1.35 'Alegreya Sans', system-ui, sans-serif; }
body { min-height: 100vh; background: radial-gradient(ellipse at 50% 0%, #3A2A1C 0%, #1C140E 60%, #120C08 100%) fixed; }
#app { max-width: 480px; margin: 0 auto; padding: 12px 12px 104px; }
.boot { text-align: center; padding-top: 40vh; color: var(--gold); font-family: 'Alegreya SC', serif; font-size: 22px; }
h1, h2, h3 { font-family: 'Alegreya SC', serif; color: var(--gold); margin: 0 0 8px; text-shadow: 0 2px 0 #000; }
h1 { font-size: 26px; } h2 { font-size: 20px; } h3 { font-size: 16px; }
p { margin: 0 0 8px; } .muted { color: var(--muted); } .small { font-size: 13px; } .center { text-align: center; }
a { color: var(--gold); }
.row { display: flex; gap: 8px; align-items: center; } .col { display: flex; flex-direction: column; gap: 8px; } .wrap { flex-wrap: wrap; } .grow { flex: 1; } .between { justify-content: space-between; }
.card { background: linear-gradient(180deg, #33261A, #241A12); border: 2px solid var(--ink); box-shadow: 0 0 0 1.5px var(--line), 0 6px 14px rgba(0,0,0,.35); border-radius: 12px; padding: 12px; margin-bottom: 12px; }
.parch { background: linear-gradient(180deg, var(--parch), var(--parch2)); color: #2A1C0E; border: 2.5px solid var(--ink); border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; }
.parch h3 { color: #4A2A0E; text-shadow: none; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 16px; border-radius: 10px; border: 2.5px solid var(--ink); background: linear-gradient(180deg, #F2CC78, #C8902E 60%, #8A5A16); color: #2A1608; font: 900 16px 'Alegreya Sans', sans-serif; cursor: pointer; text-decoration: none; box-shadow: 0 3px 0 #000, inset 0 2px 0 rgba(255,255,255,.4); }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #000; }
.btn.sec { background: linear-gradient(180deg, #6A5038, #3A2A1A); color: var(--text); box-shadow: 0 3px 0 #000, inset 0 1px 0 rgba(255,255,255,.15); }
.btn.green { background: linear-gradient(180deg, #9AE0A0, #3E8A5A 60%, #1E5A32); color: #06200E; }
.btn.red { background: linear-gradient(180deg, #F08A6A, #B0402A); color: #2A0806; }
.btn.small { min-height: 34px; padding: 0 10px; font-size: 14px; border-width: 2px; }
.btn.block { width: 100%; } .btn[disabled] { opacity: .45; pointer-events: none; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; background: #120804; border: 1.5px solid var(--line); font-size: 13px; font-weight: 800; color: var(--muted); }
.chip.on { background: #6A4A26; border-color: var(--gold); color: #FFF6E0; }
.bar { height: 12px; border-radius: 6px; background: #120804; border: 1.5px solid var(--line); overflow: hidden; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, #E8C27A, #FFE7A8); }
.bar.hp > i { background: linear-gradient(90deg, #C8381E, #F07A4A); } .bar.xp > i { background: linear-gradient(90deg, #4A8AE8, #9AD8FF); } .bar.rest > i { background: linear-gradient(90deg, #7A4AD8, #C8A0FF); }
input, textarea, select { width: 100%; min-height: 44px; border-radius: 10px; border: 2px solid var(--line); background: #120C08; color: var(--text); font: 600 16px 'Alegreya Sans', sans-serif; padding: 8px 12px; }
textarea { min-height: 80px; resize: vertical; }
label { font-weight: 800; color: var(--muted); font-size: 13px; display: block; margin: 8px 0 4px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; } .grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; } .grid4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.pick { border: 2px solid var(--ink); box-shadow: 0 0 0 1.5px var(--line); border-radius: 10px; padding: 8px; background: #241A12; cursor: pointer; text-align: center; }
.pick.on { box-shadow: 0 0 0 2.5px var(--gold); background: #3A2A18; }
.pick b { display: block; font-size: 13px; overflow-wrap: anywhere; hyphens: auto; } .pick span { font-size: 12px; color: var(--muted); }
.stat { text-align: center; background: #120804; border: 1.5px solid var(--line); border-radius: 8px; padding: 6px 2px; }
.stat b { display: block; font-family: 'Russo One', sans-serif; font-size: 20px; color: var(--text); } .stat span { font-size: 11px; color: var(--muted); font-weight: 800; }
.stat.sel { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold); }
.hero-stage { position: relative; display: flex; justify-content: center; padding-top: 6px; border-radius: 14px; background: radial-gradient(ellipse at 50% 60%, #4A3A26 0%, #241A12 65%); border: 2px solid var(--ink); box-shadow: 0 0 0 1.5px var(--line); margin-bottom: 10px; overflow: hidden; }
.hero-stage .tag { position: absolute; left: 10px; top: 10px; }
.hero-stage .tag2 { position: absolute; right: 10px; top: 10px; }
.chibi svg { display: block; overflow: visible; }
@keyframes idle { 0%,100% { transform: translateY(0) } 50% { transform: translateY(-3px) } }
.idle { animation: idle 2.6s ease-in-out infinite; }
.slot { position: relative; aspect-ratio: 1; border-radius: 10px; border: 2px solid var(--ink); background: #1A120C; box-shadow: 0 0 0 1.5px var(--line); display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 11px; color: var(--muted); text-align: center; padding: 4px; }
.slot b { color: var(--text); font-size: 12px; line-height: 1.1; }
.slot .t { position: absolute; top: 3px; left: 5px; font-family: 'Alegreya SC', serif; font-weight: 800; font-size: 12px; color: var(--gold); }
.slot .e { position: absolute; top: 3px; right: 5px; font-weight: 900; font-size: 11px; color: #FFE7A8; }
.r-common { box-shadow: 0 0 0 2px var(--r-common) !important; } .r-uncommon { box-shadow: 0 0 0 2px var(--r-uncommon) !important; } .r-rare { box-shadow: 0 0 0 2px var(--r-rare) !important; } .r-epic { box-shadow: 0 0 0 2px var(--r-epic) !important; } .r-legendary { box-shadow: 0 0 0 2px var(--r-legendary) !important; } .r-mythic { box-shadow: 0 0 0 2px var(--r-mythic) !important; }
.c-common { color: var(--r-common) } .c-uncommon { color: var(--r-uncommon) } .c-rare { color: var(--r-rare) } .c-epic { color: var(--r-epic) } .c-legendary { color: var(--r-legendary) }
.item { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid #3A2E20; }
.item:last-child { border: 0; }
.tier { display: inline-flex; width: 28px; height: 28px; align-items: center; justify-content: center; border-radius: 6px; border: 2px solid var(--ink); font-family: 'Alegreya SC', serif; font-weight: 800; }
.tier-d { background: linear-gradient(180deg, #8A7458, #4A3A28); } .tier-c { background: linear-gradient(180deg, #B07A44, #5A3414); } .tier-b { background: linear-gradient(180deg, #8A96A2, #3E4650); } .tier-a { background: linear-gradient(180deg, #6A7690, #262E48); } .tier-s { background: linear-gradient(180deg, #8A3A1A, #3A0E06); color: #FFD8A0; }
.code { font-family: 'Russo One', sans-serif; font-size: 64px; letter-spacing: 10px; color: #FFF0C8; text-align: center; text-shadow: 0 3px 0 #000; margin: 6px 0; }
.d20 { width: 120px; height: 120px; margin: 0 auto; position: relative; }
.d20 svg { width: 100%; height: 100%; }
.d20 b { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font: 900 40px 'Russo One', sans-serif; color: #2A1608; }
@keyframes spin { from { transform: rotate(0) scale(.6) } to { transform: rotate(720deg) scale(1) } }
.d20.roll svg { animation: spin .9s cubic-bezier(.2,.8,.3,1); }
.nat20 b { color: #7A0A00; } .nat1 b { color: #555; }
#nav { position: fixed; left: 0; right: 0; bottom: 0; height: 84px; padding: 0 4px calc(10px + env(safe-area-inset-bottom)); display: flex; justify-content: space-around; align-items: flex-end; background: linear-gradient(180deg, #2A1E14, #120C08); border-top: 2px solid #6A5438; z-index: 10; }
#nav a { display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 60px; min-height: 44px; color: #9A8A74; text-decoration: none; font-size: 12px; font-weight: 800; }
#nav a svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; }
#nav a.on { color: var(--gold); }
#nav a.mid span { width: 62px; height: 62px; border-radius: 31px; background: radial-gradient(circle at 50% 35%, #F0CC80, #B07A2A 60%, #5A3A12); border: 3px solid var(--ink); box-shadow: 0 0 0 2px #8A6A3A; display: flex; align-items: center; justify-content: center; margin-top: -26px; }
#nav a.mid svg { stroke: #2A1608; width: 30px; height: 30px; stroke-width: 2.2; }
#toast { position: fixed; left: 50%; top: 14px; transform: translateX(-50%); max-width: 92vw; background: #120804; border: 2px solid var(--gold); color: var(--text); border-radius: 10px; padding: 10px 14px; z-index: 50; font-weight: 700; box-shadow: 0 6px 20px rgba(0,0,0,.5); }
#modal { position: fixed; inset: 0; background: rgba(8,4,2,.82); z-index: 40; display: flex; align-items: center; justify-content: center; padding: 16px; }
#modal > div { width: 100%; max-width: 420px; max-height: 88vh; overflow: auto; }
.log { max-height: 46vh; overflow-y: auto; font-size: 13px; display: flex; flex-direction: column; gap: 4px; }
.log div { padding: 6px 8px; border-radius: 8px; background: #1A120C; border-left: 3px solid var(--line); }
.log .crit, .log .big { border-color: var(--gold); background: #3A2A10; color: #FFE7A8; font-weight: 800; }
.log .fumble, .log .joke { border-color: #9A9A9A; font-style: italic; }
.log .hit { border-color: var(--green); } .log .miss { border-color: #6A5A48; color: var(--muted); }
.log .bhit, .log .bcrit, .log .aoe, .log .dmg, .log .fail { border-color: var(--red); }
.log .heal { border-color: #6AD4FF; } .log .skill, .log .wild { border-color: var(--purple); } .log .down, .log .death { border-color: #C83A2A; color: #FFB0A0; }
.log .round, .log .start, .log .path, .log .end, .log .phase, .log .lair, .log .legend, .log .line { border-color: var(--gold2); color: var(--gold); font-weight: 700; }
.fighters { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.fighter { min-width: 76px; text-align: center; background: #1A120C; border: 2px solid var(--ink); box-shadow: 0 0 0 1.5px var(--line); border-radius: 10px; padding: 4px; font-size: 11px; }
.fighter.turn { box-shadow: 0 0 0 2.5px var(--gold); } .fighter.down { opacity: .55; filter: grayscale(.7); } .fighter.me b { color: var(--gold); }
.timer { font-family: 'Russo One', sans-serif; color: var(--gold); }
.hint { background: #22301E; border: 2px solid #3E6A3A; border-radius: 10px; padding: 8px 10px; margin-bottom: 10px; font-size: 14px; }
.hint b { color: #B8E07A; }
.steps li { margin: 4px 0; } .steps .done { color: var(--green); text-decoration: line-through; }
.boss-art { width: 120px; height: 120px; border-radius: 60px; margin: 0 auto 6px; display: flex; align-items: center; justify-content: center; font-size: 60px; background: radial-gradient(circle, #5A2A1A, #1A0A06); border: 3px solid var(--ink); box-shadow: 0 0 0 2px #8A3A1A, 0 0 30px rgba(255,90,40,.25); }
@media (prefers-reduced-motion: reduce) { .idle, .d20.roll svg { animation: none; } }
.brew { background: #2A1708; border: 1.5px dashed var(--gold); border-radius: 10px; padding: 8px 10px; margin-top: 8px; }
/* ---------- бой: броски на экране ---------- */
.tray { min-height: 118px; margin-bottom: 10px; }
.rollcard { color: var(--text); text-align: left; display: flex; gap: 10px; align-items: center; background: linear-gradient(180deg, #2E2216, #1A120C); border: 2px solid var(--ink); box-shadow: 0 0 0 1.5px var(--line); border-radius: 12px; padding: 10px; animation: rcin .35s ease-out; }
.rollcard.good { box-shadow: 0 0 0 2px #4E8A4A; } .rollcard.bad { box-shadow: 0 0 0 2px #9A3A2A; }
.rollcard.foe { background: linear-gradient(180deg, #3A1A14, #1E0E0A); }
@keyframes rcin { from { transform: translateY(6px); opacity: .3 } to { transform: none; opacity: 1 } }
.rc-die { flex: none; }
.d20.sm { width: 74px; height: 74px; } .d20.sm b { font-size: 26px; }
.d20.dN b { color: #0A1A3A; } .d20.dN i { position: absolute; bottom: -2px; left: 0; right: 0; text-align: center; font: 800 10px 'Alegreya Sans'; color: #9AB8F0; font-style: normal; }
.rc-icon { width: 74px; height: 74px; display: flex; align-items: center; justify-content: center; font-size: 40px; }
.rc-body { min-width: 0; flex: 1; }
.rc-who { font-weight: 900; color: var(--gold); font-size: 14px; } .rc-act { font-size: 13px; color: var(--muted); }
.rc-f { font-size: 14px; margin-top: 3px; } .rc-f b { color: #FFF0C8; }
.rc-v { font: 900 17px 'Alegreya SC', serif; margin-top: 2px; } .good .rc-v { color: #9AE0A0; } .bad .rc-v { color: #F08A6A; }
.rc-note { font-size: 13px; font-style: italic; color: #E8DCC4; margin-top: 2px; }
.rc-dmg { font-size: 14px; margin-top: 3px; padding: 3px 8px; border-radius: 6px; background: #3A1A10; display: inline-block; } .rc-dmg.heal { background: #12301E; } .rc-dmg b { color: #FFE7A8; font-size: 16px; } .rc-dmg .g { color: #9AE0A0; font-size: 13px; }
.foe { background: linear-gradient(180deg, #3A241A, #1E120C); border: 2px solid var(--ink); box-shadow: 0 0 0 1.5px var(--line); border-radius: 14px; padding: 10px 12px; margin: 8px 0 10px; }
.foe.kind-elite { box-shadow: 0 0 0 2px var(--r-epic); } .foe.kind-boss, .foe.kind-barboss { box-shadow: 0 0 0 2px var(--orange); }
.foe-top { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; }
.foe-art { width: 72px; height: 72px; flex: none; border-radius: 16px; display: flex; align-items: center; justify-content: center; font-size: 44px; background: radial-gradient(circle at 50% 40%, #6A3A22, #1A0A06); border: 2.5px solid var(--ink); box-shadow: 0 0 0 2px #8A5A3A; }
.foe-info summary, details summary { cursor: pointer; color: var(--gold); font-weight: 800; font-size: 13px; margin-top: 6px; }
.chip.small { font-size: 11px; padding: 2px 7px; }
.acts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.act { text-align: left; border-radius: 10px; border: 2px solid var(--ink); background: linear-gradient(180deg, #5A4430, #33261A); color: var(--text); padding: 8px 10px; font: 500 12px/1.3 'Alegreya Sans', sans-serif; box-shadow: 0 3px 0 #000; cursor: pointer; min-height: 64px; }
.act b { display: block; font-size: 15px; color: #FFF0C8; margin-bottom: 3px; } .act span { color: var(--muted); }
.act.main { background: linear-gradient(180deg, #F2CC78, #C8902E 60%, #8A5A16); } .act.main b { color: #2A1608; } .act.main span { color: #3A2408; }
.act:active { transform: translateY(2px); box-shadow: 0 1px 0 #000; } .act[disabled] { opacity: .5; }
.act .left { font-size: 12px; color: var(--gold); } .act.main .left { color: #5A3408; }
.right { display: flex; align-items: center; }
/* ---------- карта ---------- */
.torches i { font-style: normal; font-size: 18px; filter: grayscale(1) opacity(.35); } .torches i.on { filter: none; }
.loc { border-radius: 14px; border: 2px solid var(--ink); box-shadow: 0 0 0 1.5px var(--line), 0 6px 14px rgba(0,0,0,.35); padding: 12px; margin-bottom: 12px; background: linear-gradient(160deg, color-mix(in srgb, var(--lc) 55%, #1C140E) 0%, #241A12 60%); }
.loc.locked { filter: grayscale(.6); opacity: .75; }
.loc-head { display: flex; gap: 10px; align-items: center; margin-bottom: 6px; }
.loc-icon { width: 54px; height: 54px; flex: none; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 32px; background: rgba(0,0,0,.35); border: 2px solid var(--ink); }
.lockmsg { text-align: center; font-weight: 800; color: var(--muted); padding: 6px; }
.bestiary { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.foe-mini { display: flex; gap: 10px; background: rgba(0,0,0,.3); border-radius: 10px; padding: 8px; border: 1.5px solid var(--line); text-align: left; }
.foe-mini.kind-elite { border-color: var(--r-epic); } .foe-mini.kind-boss { border-color: var(--orange); }
.fm-art { width: 46px; height: 46px; flex: none; border-radius: 10px; font-size: 28px; display: flex; align-items: center; justify-content: center; background: #120804; }
.ev-trap { box-shadow: 0 0 0 2px #9A3A2A; } .ev-elite { box-shadow: 0 0 0 2px var(--r-epic); } .ev-chest, .ev-npc { box-shadow: 0 0 0 2px #4E8A4A; }
/* ---------- подземелье ---------- */
.dg-track { display: flex; gap: 4px; margin: 8px 0 12px; }
.dg-room { flex: 1; text-align: center; padding: 8px 2px; border-radius: 10px; background: #1A120C; border: 2px solid var(--ink); box-shadow: 0 0 0 1.5px var(--line); font-size: 22px; }
.dg-room small { display: block; font-size: 10px; color: var(--muted); line-height: 1.1; margin-top: 2px; }
.dg-room.done { opacity: .5; } .dg-room.cur { box-shadow: 0 0 0 2.5px var(--gold); background: #3A2A18; }
.dg-rooms { display: flex; align-items: center; justify-content: center; gap: 4px; font-size: 22px; margin: 8px 0; } .dg-rooms i { font-style: normal; color: var(--muted); font-size: 14px; }
/* ---------- вещи ---------- */
.item[data-item] { cursor: pointer; }
.slot[data-item] { cursor: pointer; }
.itemcard .flavor { font-style: italic; color: #E8DCC4; margin: 8px 0; }
.cmp { width: 100%; border-collapse: collapse; font-size: 14px; margin-top: 8px; } .cmp th { color: var(--muted); font-weight: 700; font-size: 12px; text-align: left; } .cmp td, .cmp th { padding: 4px 6px; border-bottom: 1px solid #3A2E20; }
#nav a { min-width: 52px; font-size: 11px; }
