*{box-sizing:border-box}
html,body{margin:0;height:100%;background:#1d2a2a;color:#f3ead7;font-family:"Avenir Next","Trebuchet MS",system-ui,sans-serif;overflow:hidden}
button{font:inherit;cursor:pointer;border:0;border-radius:10px;padding:.45em .8em;background:#e0c277;color:#2b2112;font-weight:700}
button:hover{filter:brightness(1.08)} button:disabled{opacity:.4;cursor:default}
button.ghost{background:#3b4b4b;color:#f3ead7} button.danger{background:#b9473b;color:#fff} button.good{background:#5aa66a;color:#fff}
#app{display:flex;flex-direction:column;height:100%}
.top{display:flex;align-items:center;gap:14px;padding:8px 14px;background:#142020;border-bottom:2px solid #3a2f1a}
.top h1{font-size:1.15rem;margin:0;flex:1;font-family:Georgia,serif;letter-spacing:.5px}
.pill{background:#2d3d3d;border-radius:999px;padding:.3em .9em;font-weight:700}
.pill.heroes{background:#2c6b3f}.pill.monsters{background:#8c3a2f}
.main{flex:1;display:flex;min-height:0}
.stage{flex:1;display:flex;align-items:center;justify-content:center;min-width:0;min-height:0;padding:8px;position:relative}
#map{position:relative;background:#000 center/100% 100% no-repeat;box-shadow:0 6px 30px #000a;border-radius:6px;touch-action:none;user-select:none;-webkit-user-select:none}
#map.spawning{cursor:crosshair;outline:3px dashed #e0c277}
.gridlines{position:absolute;inset:0;pointer-events:none}
.token{position:absolute;transition:left .12s,top .12s;touch-action:none;cursor:grab}
.token.dragging{transition:none;z-index:50;cursor:grabbing;filter:drop-shadow(0 8px 6px #000a)}
.token .plate{position:absolute;left:8%;right:8%;bottom:2%;height:34%;border-radius:50%;background:var(--c,#999);opacity:.85;box-shadow:0 2px 4px #0008}
.token .spr{position:absolute;left:50%;bottom:14%;transform:translateX(-50%);max-width:105%;max-height:125%;object-fit:contain;filter:drop-shadow(0 2px 2px #000a);pointer-events:none}
.token.size2 .spr{max-height:110%}
.token .hearts{position:absolute;left:0;right:0;bottom:-14%;text-align:center;font-size:calc(var(--cw)*.2);line-height:1;letter-spacing:1px;text-shadow:0 1px 2px #000}
.token .badge{position:absolute;right:2%;top:6%;min-width:1.5em;height:1.5em;border-radius:50%;background:#222;color:#fff;border:2px solid #fff;font-size:calc(var(--cw)*.2);display:flex;align-items:center;justify-content:center;font-weight:800}
.token.monster .plate{--c:#b9473b}
.token.selected .plate{outline:3px solid #fff}
.token.hidden{opacity:.5;filter:saturate(.6)} .token.hidden .plate{outline:2px dashed #fff}
.token.ko .spr{transform:translateX(-50%) rotate(88deg) scale(.8);filter:grayscale(1) drop-shadow(0 2px 2px #000a);bottom:10%}
.token.ko .plate{opacity:.3}
.token.ko::after{content:"KO";position:absolute;left:0;right:0;top:20%;text-align:center;font-weight:900;color:#fff;font-size:calc(var(--cw)*.28);text-shadow:0 0 6px #000,0 0 3px #c00}
.token.gone{opacity:.28;filter:grayscale(1)}
.heroes-bar{display:flex;gap:10px;padding:8px 12px;background:#142020;border-top:2px solid #3a2f1a;overflow-x:auto}
.hp{flex:1;min-width:230px;max-width:360px;background:#2a3939;border-radius:14px;padding:8px 10px;display:flex;gap:10px;align-items:center;border:3px solid var(--c)}
.hp .face{width:64px;height:84px;object-fit:contain;cursor:pointer}
.hp .nm{font-weight:800;font-size:1.05rem}
.hp .bigh{font-size:1.8rem;letter-spacing:3px;line-height:1.1}
.hp .row{display:flex;gap:6px;align-items:center;margin-top:3px}
.hp.ko{opacity:.65}
.pot{font-size:1.7rem;cursor:pointer;filter:grayscale(0)} .pot.used{filter:grayscale(1) opacity(.35)}
.story{position:absolute;inset:0;background:#000a;display:flex;align-items:center;justify-content:center;z-index:100;padding:3%}
.story .scroll{max-width:900px;max-height:100%;overflow:auto;background:#f2e5c4 url() ;color:#2b2112;border-radius:14px;padding:26px 34px;font-family:Georgia,serif;font-size:1.35rem;line-height:1.45;box-shadow:0 10px 40px #000;border:6px double #8a6b2c}
.story h2{margin:.1em 0 .4em;font-size:1.5rem}.story p{margin:.6em 0;white-space:pre-wrap}
.story button{margin-top:10px}
.modal{position:fixed;inset:0;background:#000b;z-index:200;display:flex;align-items:center;justify-content:center}
.modal img{max-width:92vw;max-height:88vh;border-radius:14px}
.side{width:400px;max-width:42vw;background:#182424;border-left:2px solid #3a2f1a;display:flex;flex-direction:column;min-height:0}
.tabs{display:flex;gap:4px;padding:8px 8px 0}
.tabs button{flex:1;background:#2a3939;color:#cdbf9b;border-radius:10px 10px 0 0;padding:.5em .2em;font-size:.85rem}
.tabs button.on{background:#e0c277;color:#2b2112}
.pane{flex:1;overflow:auto;padding:12px;font-size:.95rem;line-height:1.4}
.pane h3{margin:.8em 0 .3em;color:#e0c277;font-size:1rem} .pane h3:first-child{margin-top:0}
.pane p{margin:.4em 0;white-space:pre-wrap}
.box{background:#243333;border-radius:10px;padding:8px 10px;margin:6px 0}
.read{background:#f2e5c4;color:#2b2112;font-family:Georgia,serif;border-radius:10px;padding:10px 12px;margin:6px 0;white-space:pre-wrap}
.sel{margin:8px;padding:8px;background:#2a3b3b;border:2px solid #e0c277;border-radius:12px}
.sel img.card{width:100%;border-radius:8px;margin-top:6px;cursor:zoom-in}
.btnrow{display:flex;flex-wrap:wrap;gap:6px;margin:6px 0}
.list .r{display:flex;align-items:center;gap:6px;padding:4px 2px;border-bottom:1px solid #2d3d3d}
.list .r img{width:34px;height:34px;object-fit:contain}.list .r .n{flex:1}.list .r.hid{opacity:.55}
.palette{display:grid;grid-template-columns:repeat(3,1fr);gap:6px}
.palette .c{background:#243333;border-radius:10px;padding:4px;text-align:center;font-size:.75rem;cursor:pointer;border:2px solid transparent}
.palette .c.on{border-color:#e0c277;background:#3a4a3a}.palette img{height:54px;object-fit:contain}
.party{display:grid;grid-template-columns:repeat(2,1fr);gap:6px}
.party .c{display:flex;align-items:center;gap:6px;background:#243333;border-radius:10px;padding:4px;border:2px solid transparent;cursor:pointer;font-size:.85rem}
.party .c.on{border-color:var(--c);background:#2f4a3a}.party img{width:34px;height:42px;object-fit:contain}
.log div{padding:3px 0;border-bottom:1px solid #2d3d3d;font-size:.85rem;color:#cdbf9b}
.launch{display:flex;flex-direction:column;align-items:center;justify-content:center;height:100%;gap:22px;text-align:center}
.launch a{display:block;background:#e0c277;color:#2b2112;padding:22px 50px;border-radius:18px;font-size:1.6rem;font-weight:800;text-decoration:none}
.launch p{max-width:560px;color:#cdbf9b;line-height:1.5}
@media (max-width:900px){.side{width:340px}}

.notrans .token{transition:none}

/* dice (kids' screens) */
.dicebox{background:#142020;border-top:2px solid #3a2f1a;padding:6px 12px;display:flex;gap:14px;align-items:flex-start;flex-wrap:wrap}
.dicehead{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.dicehead .sep{width:14px}
.rollbtn{font-size:1.05rem;padding:.55em 1em;background:#e0c277;color:#2b2112;border-radius:12px;min-width:3em}
.rollbtn .n{background:#2b2112;color:#e0c277;border-radius:999px;padding:0 .5em;margin-left:.3em}
.rollbtn.ghost{background:#3b4b4b;color:#f3ead7}
#diceout{min-width:220px;text-align:center}
.rolling{display:flex;gap:6px;justify-content:center}
.die{font-size:3.2rem;line-height:1;color:#f3ead7;text-shadow:0 2px 3px #000}.die.top{color:#ffd54a;text-shadow:0 0 12px #ff9800}
.die.spin{animation:spin .5s linear infinite}@keyframes spin{from{transform:rotate(0)}to{transform:rotate(360deg)}}
.rl{color:#cdbf9b}
.rolllog{flex:1;min-width:240px;max-height:6.2em;overflow:auto;font-size:.9rem}
.rolllog .mini,.log .mini{font-size:1.3rem;letter-spacing:2px}
.party .c.on{outline:3px solid #fff}

.die{display:inline-flex;align-items:center;justify-content:center;width:1.35em;height:1.35em;border-radius:.22em;background:#f3ead7;color:#2b2112;font-weight:900;font-size:2.4rem;text-shadow:none;box-shadow:0 3px 6px #000a}
.die.top{background:#ffd54a;color:#2b2112;text-shadow:none;box-shadow:0 0 14px #ff9800}
.md{display:inline-flex;align-items:center;justify-content:center;width:1.4em;height:1.4em;margin-right:3px;border-radius:.25em;background:#f3ead7;color:#2b2112;font-weight:800;font-size:.95rem;letter-spacing:0}
