*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{margin:0;height:100%;background:#1c1914;color:#f1ead9;font-family:Inter,system-ui,sans-serif;overscroll-behavior:none;user-select:none;-webkit-user-select:none}
button{font:inherit;color:inherit;cursor:pointer;touch-action:manipulation}
[hidden]{display:none!important}
#app{position:relative;height:100vh;height:100dvh;max-width:520px;margin:0 auto;display:flex;flex-direction:column;overflow:hidden;background:#1c1914}

#hud{padding:calc(10px + env(safe-area-inset-top)) 16px 10px;display:flex;flex-direction:column;gap:8px;background:#1c1914;transition:background .6s}
.row{display:flex;justify-content:space-between;align-items:center}
.gap{gap:8px}
.title{font-family:Cinzel,serif;font-weight:800;font-size:20px;color:#f2c46b}
.info{font-size:13px;color:#d9cfb8;text-align:right}
.info b{color:#f1ead9}
.icon-btn{width:44px;height:44px;border-radius:10px;background:#2a251d;border:1px solid #3a3327;display:flex;align-items:center;justify-content:center}
.bar{height:6px;border-radius:3px;background:#3a3327;overflow:hidden}
#hudBar{height:100%;width:0;background:linear-gradient(90deg,#f2c46b,#e07a3a)}
.res{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px}
.chip{display:flex;align-items:center;gap:6px;padding:6px 8px;border-radius:10px;background:#2a251d;font-size:14px;font-weight:600}
.sw{width:12px;height:12px;border-radius:3px;flex-shrink:0}
.sw.wood{background:#a8743f}.sw.stone{background:#9aa1a8}.sw.gold{background:#f2c46b;border-radius:6px}

#stage{position:relative;flex:1;min-height:0;display:flex;align-items:center;justify-content:center;background:#16130f}
#cv{position:absolute;inset:0;display:block;touch-action:none}
#toast{position:absolute;left:50%;top:12px;transform:translateX(-50%);padding:8px 14px;border-radius:999px;background:rgba(20,18,14,.9);color:#f6e2c8;font-size:14px;font-weight:500;pointer-events:none;opacity:0;transition:opacity .25s;white-space:nowrap}
#toast.show{opacity:1}

#bottom{padding:12px 16px calc(14px + env(safe-area-inset-bottom));border-top:1px solid #3a3327;background:#1c1914;transition:background .6s}
#dayBar,#nightBar{display:flex;flex-direction:column;gap:10px}
.tools{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:6px}
.tool{min-height:72px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;border-radius:12px;background:#2a251d;border:2px solid #3a3327;padding:4px 2px}
.tool[aria-pressed=true]{background:#3d3322;border-color:#f2c46b}
.tool .ic{width:24px;height:24px;border-radius:6px}
.tool .nm{font-size:11px;font-weight:600}
.tool .ct{font-size:10px;color:#c9bfa8;white-space:nowrap}
.tool.poor .ct{color:#e0806f}
.btn{display:flex;align-items:center;justify-content:center;gap:10px;min-height:52px;padding:0 18px;border-radius:14px;border:1px solid transparent;font-weight:600;font-size:16px}
.btn.primary{background:#f2a64a;color:#1a1d2e}
.btn.dark{background:#262b42;border-color:#3a4163;justify-content:space-between}
.btn.ghost{background:transparent;border-color:#3a4163}
.btn.night{background:#2b3352;color:#f6c27a;border-color:#45507a}
.btn.brown{background:#8a4b1f;color:#fff6e8;width:100%}
.abilities{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}
.ability{min-height:88px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;border-radius:14px;background:#3a2c18;border:2px solid #f2a64a;color:#f6e2c8;font-size:13px;font-weight:600;padding:4px}
.ability small{font-size:11px;font-weight:500;color:#f6c27a;min-height:14px}
.ability:disabled{background:#1b2036;border-color:#343d63;color:#a9b0cc;cursor:default}
.ability:disabled small{color:#a9b0cc}
.ability.armed{background:#5a3a12;border-color:#ffd98f;box-shadow:0 0 0 3px rgba(255,217,143,.25)}

body.night #hud,body.night #bottom,body.night #app{background:#121626}
body.night #bottom{border-color:#2a2f47}
body.night .title{color:#f6c27a}
body.night .chip,body.night .icon-btn{background:#232a45;border-color:#343d63}
body.night #hudBar{background:#e0574a}

.screen{position:absolute;inset:0;z-index:10;display:flex;flex-direction:column;align-items:center;overflow-y:auto;background:#1a1d2e;padding-bottom:calc(24px + env(safe-area-inset-bottom))}
.screen.dim{background:rgba(14,16,28,.92);justify-content:center;padding:24px;gap:12px}
.screen h1{margin:-24px 0 0;font-family:Cinzel,serif;font-weight:800;font-size:40px;line-height:1.05;text-align:center;color:#f2c46b}
.screen h2{margin:0;font-family:Cinzel,serif;font-weight:800;font-size:28px;text-align:center;color:#f2c46b}
.hero{width:100%;height:auto;display:block}
.sub{margin:6px 24px 0;font-size:15px;color:#b9b3a5;text-align:center}
.muted{color:#b9b3a5;font-size:14px;font-weight:500}
.center{text-align:center;margin:4px 0 0}
.menu-btns{display:flex;flex-direction:column;gap:12px;width:100%;max-width:340px;padding:28px 24px 0}

.screen.paper{background:#f6e9d4;color:#2a2016;padding:calc(28px + env(safe-area-inset-top)) 20px calc(24px + env(safe-area-inset-bottom));gap:14px}
.screen.paper h2{color:#6b3714;line-height:1.15}
.screen.paper h3{margin:4px 0 0;align-self:flex-start;font-family:Cinzel,serif;font-size:18px}
.screen.paper ol{margin:0;padding-left:20px;display:flex;flex-direction:column;gap:12px;font-size:15px;line-height:1.5;max-width:420px}
.kicker{font-size:13px;font-weight:600;letter-spacing:.1em;text-transform:uppercase;color:#7a5a3c}
.stats{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px;width:100%}
.stats div{display:flex;flex-direction:column;align-items:center;gap:2px;padding:12px 6px;border-radius:12px;background:#fbf4e8;text-align:center}
.stats b{font-size:22px}.stats span{font-size:12px;color:#6b5440}
.cards{display:flex;flex-direction:column;gap:10px;width:100%}
.card{display:flex;align-items:center;gap:14px;min-height:76px;padding:12px 14px;border-radius:14px;background:#fbf4e8;border:2px solid #e6d3b6;text-align:left;color:#2a2016}
.card[aria-pressed=true]{background:#fff8ec;border-color:#8a4b1f}
.card .lt{width:44px;height:44px;flex-shrink:0;border-radius:10px;display:flex;align-items:center;justify-content:center;color:#fff;font-family:Cinzel,serif;font-weight:800;font-size:20px}
.card .tx{display:flex;flex-direction:column;gap:2px}
.card .tx b{font-size:15px}.card .tx span{font-size:13px;line-height:1.35;color:#5e4834}
