:root{--bg:#100d0a;--panel:#1b1611;--panel2:#241c15;--line:#65503b;--gold:#d3ad68;--text:#f3eadb;--muted:#b9aa98;--ok:#6c9a70;--bad:#b45b50}
*{box-sizing:border-box}html,body{margin:0;min-height:100%;background:#0d0a08;color:var(--text);font-family:Georgia,'Times New Roman',serif}button,input,select,textarea{font:inherit}
.screen{display:none;min-height:100vh}.screen.active{display:flex}.intro{align-items:center;justify-content:center;background:#080706;overflow:hidden}.intro-stage{position:relative;width:min(100vw,calc(100vh * 1.5));aspect-ratio:3/2;max-height:100vh}.intro-art{position:absolute;inset:0;width:100%;height:100%;object-fit:contain}.hot{position:absolute;z-index:2;background:transparent;border:0;border-radius:10px;cursor:pointer}.hot:hover,.hot:focus{box-shadow:0 0 0 2px rgba(226,197,143,.7),0 0 26px rgba(211,173,104,.35);background:rgba(211,173,104,.05)}.h-history{left:7.2%;top:40%;width:29.3%;height:9.4%}.h-universe{left:7.2%;top:51%;width:29.3%;height:9.4%}.h-chars{left:7.2%;top:61.8%;width:29.3%;height:9.4%}.h-new{left:7.2%;top:72.9%;width:29.3%;height:9.6%}
.center{align-items:center;justify-content:center;padding:24px}.panel{background:rgba(27,22,17,.98);border:1px solid var(--line);border-radius:14px;padding:20px;box-shadow:0 18px 50px #0008}.wide{width:min(1100px,95vw)}h1,h2,h3,h4{color:#e2c58f}.muted{color:var(--muted)}.topbar{display:flex;justify-content:space-between;align-items:center;gap:12px;padding:12px 18px;background:#17120e;border-bottom:1px solid var(--line)}.btn{background:linear-gradient(#3a2d20,#251c14);color:var(--text);border:1px solid #8a6a48;border-radius:8px;padding:10px 15px;cursor:pointer}.btn:hover{border-color:var(--gold)}.btn.primary{background:linear-gradient(#76552d,#4a321c);color:#fff4d8}.btn.small{padding:6px 10px}.btn:disabled{opacity:.45;cursor:not-allowed}
.row{display:flex;gap:10px;align-items:center;flex-wrap:wrap}.grid2{display:grid;grid-template-columns:1fr 1fr;gap:14px}.field{display:flex;flex-direction:column;gap:5px;margin:7px 0}.field input,.field select,.field textarea{background:#0e0c0a;color:var(--text);border:1px solid var(--line);border-radius:7px;padding:9px}.char-card{border:1px solid #4e3c2c;border-radius:10px;padding:14px;background:#14100d;margin:10px 0}.ability-grid{display:grid;grid-template-columns:repeat(6,1fr);gap:7px}.ability{border:1px solid #5e4935;border-radius:9px;padding:8px;text-align:center;background:#120f0c}.ability b{display:block;color:var(--gold);font-size:21px}.stat-grid{display:grid;grid-template-columns:repeat(6,1fr);gap:8px;margin:12px 0}.stat{background:#120f0c;border:1px solid #5e4935;border-radius:9px;padding:10px;text-align:center}.stat b{display:block;color:var(--gold);font-size:22px}.library{display:grid;grid-template-columns:repeat(auto-fit,minmax(260px,1fr));gap:12px}
.game{flex-direction:column}.gamegrid{display:grid;grid-template-columns:270px 1fr;gap:12px;padding:12px;flex:1}.party{display:flex;flex-direction:column;gap:8px}.pc{border:1px solid #574532;border-radius:10px;background:#211a14;padding:10px;cursor:pointer}.pc.selected{border-color:var(--gold);box-shadow:0 0 0 1px var(--gold) inset}.pc small{display:block;color:var(--muted)}.story{min-height:360px;max-height:54vh;overflow:auto;line-height:1.55}.entry{padding:10px 0;border-bottom:1px solid #3c3025}.master{color:#ead7b4}.system{color:#d2b26f}.rollbox{display:none;margin-top:12px;padding:12px;border:1px solid #6b533c;border-radius:10px;background:#130f0c}.rollbox.active{display:block}.die{font-size:56px;color:var(--gold);text-align:center}.pass{color:#9dc89f}.fail{color:#df9288}.modal{display:none;position:fixed;inset:0;background:#000b;z-index:20;align-items:center;justify-content:center;padding:20px}.modal.active{display:flex}.sheet{width:min(960px,96vw);max-height:90vh;overflow:auto}.sheet-cols{display:grid;grid-template-columns:1fr 1fr;gap:12px}.sheet-section{border:1px solid #4c3d2d;border-radius:10px;padding:12px;background:#14100d}.iframe-wrap{flex-direction:column}.iframe-wrap iframe{border:0;width:100%;flex:1;min-height:calc(100vh - 64px);background:#111}
#universe.active{display:flex!important;flex-direction:column!important;height:100vh;min-height:100vh;overflow:hidden}#universe>.topbar{display:flex!important;position:relative;z-index:10001;flex:0 0 auto;min-height:62px;background:#17120e!important;box-shadow:0 3px 12px rgba(0,0,0,.45)}#universe>.topbar .btn{display:inline-flex!important;align-items:center;justify-content:center;visibility:visible!important;opacity:1!important;min-width:92px}#universe>iframe{display:block;flex:1 1 auto;min-height:0;height:calc(100vh - 104px)}#universe>.compendium-fallback{flex:0 0 auto}
.slot-head{display:flex;justify-content:space-between;align-items:center;gap:12px;flex-wrap:wrap}.slot-head h3{margin:0}.empty-state{padding:20px;border:1px dashed #5e4935;border-radius:10px;background:#100d0a}.load-grid{display:grid;grid-template-columns:minmax(260px,420px) 1fr;gap:16px;align-items:end}.saved-preview{display:flex;flex-direction:column;gap:5px;padding:12px;border:1px solid #5e4935;border-radius:10px;background:#100d0a}.attribute-builder{border:1px solid #5e4935;border-radius:10px;padding:12px;background:#100d0a}.builder-head{display:flex;justify-content:space-between;gap:12px;align-items:flex-start}.builder-head h4{margin:0 0 4px}.builder-head p{margin:0 0 10px}.ability.current{border-color:var(--gold);box-shadow:0 0 0 1px var(--gold) inset}.dice-workbench{margin-top:12px;border-top:1px solid #3c3025;padding-top:12px}.roll-prompt{margin-bottom:10px;color:#e2c58f}.dice-tray{display:flex;gap:8px;min-height:58px;align-items:center;margin-bottom:10px}.mini-d6{width:48px;height:48px;display:flex;align-items:center;justify-content:center;border:2px solid #8a6a48;border-radius:9px;background:#17120e;color:#f7e6c5;font-size:21px;font-weight:bold}.mini-d6.discarded{opacity:.38;text-decoration:line-through;border-style:dashed}.roll-summary{margin-top:8px;color:var(--muted)}.checkline{display:flex;align-items:center;gap:6px;margin-top:22px}.field input[readonly]{cursor:not-allowed;color:var(--gold)}
.ai-status{padding:5px 9px;border:1px solid var(--line);border-radius:999px;color:var(--muted);font-size:13px}.ai-status.ok{color:#9dc89f}.actionbar{display:flex;gap:10px;margin-top:12px}.actionbar textarea{flex:1;min-height:78px;resize:vertical;background:#0e0c0a;color:var(--text);border:1px solid var(--line);border-radius:8px;padding:10px}.dice-row{display:flex;gap:8px;align-items:center}.dice-row select{flex:1;background:#0e0c0a;color:var(--text);border:1px solid var(--line);border-radius:7px;padding:7px}.compendium-fallback{padding:12px 18px;background:#17120e;border-top:1px solid var(--line);font-size:13px;color:var(--muted)}
.inventory-table{width:100%;border-collapse:collapse;margin:14px 0}.inventory-table th,.inventory-table td{padding:10px;border-bottom:1px solid #4c3d2d;text-align:left}.inventory-table th{color:var(--gold);background:#120f0c}.inventory-table tbody tr:hover{background:#211a14}
.mana-block{margin-top:8px}.mana-line{display:flex;justify-content:space-between;gap:8px;font-size:13px}.mana-line strong{color:#b7a7ff}.mana-track{height:8px;border:1px solid #594b75;border-radius:999px;background:#0d0b13;overflow:hidden;margin:4px 0}.mana-track span{display:block;height:100%;background:linear-gradient(90deg,#5440a1,#9b85ef)}.mana-block small{font-size:11px;color:#c6b9e7}.mana-roll-box{margin-top:12px;padding:12px;border:1px solid #66558a;border-radius:10px;background:#12101a}.mana-roll-box h3{margin-bottom:0;color:#c5b7ff}
.character-avatar{display:block;object-fit:cover;object-position:center;border:1px solid #7a6046;background:#100d0a}.party-avatar{width:48px;height:48px;border-radius:50%;float:left;margin:0 10px 5px 0}.library-avatar{width:84px;height:84px;border-radius:12px;margin:0 auto 10px}.sheet-identity{display:grid;grid-template-columns:150px 1fr;gap:18px;align-items:start}.sheet-avatar{width:150px;height:190px;border-radius:12px}.sheet-identity-body{min-width:0}
@media(max-width:800px){.gamegrid{grid-template-columns:1fr}.party{flex-direction:row;overflow:auto}.pc{min-width:180px}.grid2,.sheet-cols{grid-template-columns:1fr}.ability-grid,.stat-grid{grid-template-columns:repeat(3,1fr)}.load-grid{grid-template-columns:1fr}.slot-head{align-items:flex-start}.actionbar{flex-direction:column}.inventory-table{font-size:14px}.sheet-identity{grid-template-columns:1fr}.sheet-avatar{width:120px;height:150px;margin:0 auto}#universe>.topbar{min-height:56px;padding:9px 10px}#universe>.topbar strong{font-size:14px}#universe>.topbar .ai-status{display:none}#universe>.topbar .btn{min-width:80px;padding:7px 10px}}
