/* Dedicated game shell at every size; there is no desktop website layout. */
html,body{margin:0;width:100%;height:100%;overflow:hidden;overscroll-behavior:none;background:#14251d}
body{position:fixed;inset:0;padding:0;touch-action:manipulation;-webkit-tap-highlight-color:transparent;user-select:none}
.masthead,.game-heading,.page-footer,.sidebar,.map-toolbar,.map-footer{display:none!important}
main{position:absolute;inset:0;padding:0!important;margin:0;max-width:none;height:100%!important;display:block}
.game-layout,.map-panel,.canvas-wrap{position:absolute;inset:0;width:100%;height:100%!important;display:block;min-height:0;border:0;border-radius:0;margin:0;overflow:hidden}
#board{position:absolute;inset:0;width:100%;height:100%;aspect-ratio:auto}
.game-hud{position:absolute;top:max(10px,env(safe-area-inset-top));left:max(12px,env(safe-area-inset-left));right:max(12px,env(safe-area-inset-right));display:flex;align-items:center;gap:8px;pointer-events:none}
.game-hud>*{pointer-events:auto}.player-chip{display:grid;grid-template-columns:40px auto;column-gap:8px;background:#11251ee8;border:1px solid #d6c49160;border-radius:14px;padding:6px 13px 6px 6px;box-shadow:0 3px 12px #0005}
#turnPortrait{grid-row:1/4;width:40px;height:44px}#turnName{font-size:17px;line-height:18px;margin:0}#turnSub{font-size:10px;margin:0;color:#e0e4ce}#turnFloor{font-size:8px;padding:0;border:0;margin:2px 0 0}
.game-hud button{min-height:48px;border:1px solid #d6c49160;background:#11251ee8;color:#f2e8c8;border-radius:14px;padding:8px 14px;box-shadow:0 3px 12px #0004;font-size:12px}
.pouch-button{margin-right:auto}.pouch-button .gold-count{margin:0;gap:6px}.pouch-button .gold-count>span:last-child{display:none}.pouch-button strong{font-size:18px}.game-hud .game-menu-button{font-size:22px;width:48px;padding:0}
.thumb-controls{position:absolute;left:max(16px,env(safe-area-inset-left));right:max(16px,env(safe-area-inset-right));bottom:max(14px,env(safe-area-inset-bottom));display:flex;justify-content:space-between;align-items:end;pointer-events:none;gap:20px}
.thumb-left,.thumb-right{display:flex;gap:8px;align-items:center;pointer-events:auto}.thumb-controls button{min-height:56px;min-width:100px;border-radius:17px;padding:12px 18px;font-size:14px;font-weight:700;box-shadow:0 4px 0 #10231a,0 6px 18px #0005;border:1px solid #f0ddaa70}
#searchBtn{background:#214d3e;color:#fff4cf}#endBtn{background:#172f28ec;color:#e2e5d1;min-width:80px;font-size:12px}#rollBtn{background:#eac579;color:#26301b;min-width:145px}#rollBtn span{display:none}.thumb-controls button:disabled{opacity:.45;box-shadow:none}.thumb-controls button:active:enabled{transform:translateY(3px);box-shadow:none}
.thumb-right .die{width:48px;height:48px;background:#142a22e8;color:#f2dd9d;border:1px solid #ead59a70;border-radius:13px}.die i{background:#f2dd9d}
.turn-status{position:absolute;top:max(82px,calc(env(safe-area-inset-top) + 72px));left:16px;max-width:220px;padding:7px 10px;border-radius:10px;background:#11251ebd;pointer-events:none;color:#f4ebcc}.turn-status .eyebrow{font-size:9px}.turn-status .turn-prompt{font-size:10px;line-height:1.35;min-height:0;margin:3px 0 0}
.map-hint{bottom:85px;max-width:50%;white-space:normal;text-align:center;background:#11251ed9;font-size:11px;border-radius:9px}.hover-tip{top:145px;max-width:250px}
.discovery-overlay{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;pointer-events:none}.discovery-overlay:has(.decision:not(.hidden)){background:#07130e80;pointer-events:auto}.discovery-overlay .decision:not(.hidden){width:min(400px,70vw);max-height:65vh;overflow:auto;background:#172e25;border:1px solid #d9ba76;border-radius:18px;padding:20px;box-shadow:0 16px 60px #0009;pointer-events:auto}.decision-buttons button{min-height:46px}
.game-sheet{width:440px;max-height:85dvh;border-radius:20px;padding:22px}.game-sheet h2{font-size:25px}.sheet-tools{display:flex;flex-wrap:wrap;gap:8px;margin:18px 0}.sheet-tools button{min-height:44px;min-width:44px}.game-sheet section{padding:12px 0;border:0;border-top:1px solid #d9ba7633;border-radius:0}.game-sheet .card-top{margin-bottom:8px}.game-sheet .journal{max-height:none}.game-sheet .slots{display:flex}
dialog{max-height:calc(100dvh - 24px);border-radius:20px}dialog::backdrop{background:#081a13b8;backdrop-filter:blur(7px)}.toast{bottom:90px}
.rotate-screen{display:none}
@media (orientation:portrait){.rotate-screen{position:fixed;inset:0;z-index:10000;display:flex;flex-direction:column;align-items:center;justify-content:center;padding:30px;text-align:center;background:radial-gradient(ellipse at top,#335640,#101e18);color:#efdb9f}.rotate-screen span{font-size:80px}.rotate-screen strong{font-size:22px}.rotate-screen p{font-size:14px;color:#bcc7ac}}
@media (max-height:360px){.turn-status{top:75px;max-width:190px}.turn-status .turn-prompt{display:none}.thumb-controls button{min-height:48px;padding:10px 13px;min-width:90px}#rollBtn{min-width:125px}.thumb-controls{bottom:10px}.game-hud{top:8px}.map-hint{bottom:72px}}

@media (orientation:portrait){dialog[open]{visibility:hidden}}
.thumb-controls button{white-space:nowrap}
/* Only currently available actions occupy the thumb zones. */
.thumb-controls button:disabled{display:none}
.thumb-right:has(#rollBtn:disabled) .die{display:none}
/* Resolved discoveries use the cave message; only choices need a modal panel. */
.discovery-overlay:not(:has(.decision:not(.hidden) button)){background:none;pointer-events:none}
.discovery-overlay .decision:not(:has(button)){display:none}
/* The die itself is the roll control, in a stable right-thumb position. */
.thumb-right #rollBtn{min-width:88px;width:88px;height:88px;padding:7px;background:none;border:0;box-shadow:none;display:grid;place-items:center;border-radius:20px;transform:none}
.thumb-right #rollBtn:disabled{display:none}
.thumb-right #rollBtn.show-roll{display:grid;opacity:1}
.thumb-right #rollBtn .die{display:grid!important;place-items:center;width:72px;height:72px;background:linear-gradient(145deg,#fff3cb,#d9b76d);border:2px solid #fff1bf;border-radius:17px;box-shadow:0 5px 0 #937338,0 9px 20px #0006;transform-origin:center}
.thumb-right #rollBtn .die-pips{display:grid;grid-template-columns:repeat(3,1fr);grid-template-rows:repeat(3,1fr);gap:6px;width:45px;height:45px}
.thumb-right #rollBtn .die i{display:block;width:11px;height:11px;background:#263a2d;border-radius:50%;box-shadow:inset 0 1px 2px #0007}
.thumb-right #rollBtn:focus-visible{outline:3px solid #fff4cc;outline-offset:4px}
.thumb-right #rollBtn:active:enabled .die{transform:scale(.94)}
.thumb-right #rollBtn.rolling:not(.still-roll) .die{animation:die-tumble 260ms ease-in-out infinite}
@keyframes die-tumble{0%{transform:rotate(0) scale(1)}25%{transform:rotate(-16deg) scale(.94,1.06)}75%{transform:rotate(16deg) scale(1.06,.94)}100%{transform:rotate(0) scale(1)}}
@media(prefers-reduced-motion:reduce){.thumb-right #rollBtn.rolling .die{animation:none}}
@media(max-height:360px){.thumb-right #rollBtn{width:70px;height:70px;min-width:70px}.thumb-right #rollBtn .die{width:60px;height:60px;border-radius:14px}.thumb-right #rollBtn .die-pips{width:39px;height:39px;gap:4px}}
/* Make the turn's die the central, generously sized tap target. */
.thumb-right #rollBtn{position:fixed;left:50%;top:50%;transform:translate(-50%,-50%);width:150px;height:150px;min-width:150px;padding:12px;z-index:5}
.thumb-right #rollBtn:active:enabled{transform:translate(-50%,-50%)}
.thumb-right #rollBtn .die{width:126px;height:126px;border-radius:27px;border-width:3px;box-shadow:0 8px 0 #937338,0 18px 35px #0007}
.thumb-right #rollBtn .die-pips{width:81px;height:81px;gap:9px}
.thumb-right #rollBtn .die i{width:21px;height:21px}
@media(max-height:360px){.thumb-right #rollBtn{width:130px;height:130px;min-width:130px}.thumb-right #rollBtn .die{width:108px;height:108px;border-radius:24px}.thumb-right #rollBtn .die-pips{width:69px;height:69px;gap:6px}.thumb-right #rollBtn .die i{width:19px;height:19px}}
/* Six persistent faces tumble as one cube, then land on the actual result. */
.thumb-right #rollBtn .die{--cube-size:100px;position:relative;display:block!important;width:126px;height:126px;border:0;border-radius:0;background:none;box-shadow:none;perspective:650px;overflow:visible;animation:none!important;transform:none!important}
.dice-lift{position:absolute;left:50%;top:50%;width:var(--cube-size);height:var(--cube-size);margin-left:calc(var(--cube-size) / -2);margin-top:calc(var(--cube-size) / -2);transform-style:preserve-3d}
.dice-angle{width:100%;height:100%;transform-style:preserve-3d;transform:rotateX(-13deg) rotateY(-18deg)}
.dice-cube{position:relative;width:100%;height:100%;transform-style:preserve-3d}
.dice-face{position:absolute;inset:0;display:grid;place-items:center;border:2px solid #f9e5ad;border-radius:9px;backface-visibility:hidden;background:linear-gradient(135deg,#fff2cf,#e0bc76);box-shadow:inset 0 0 10px #a2743540}
.dice-face.face-1{transform:translateZ(calc(var(--cube-size) / 2))}
.dice-face.face-6{transform:rotateY(180deg) translateZ(calc(var(--cube-size) / 2))}
.dice-face.face-2{transform:rotateY(90deg) translateZ(calc(var(--cube-size) / 2));background:linear-gradient(135deg,#e7c580,#c59d55)}
.dice-face.face-5{transform:rotateY(-90deg) translateZ(calc(var(--cube-size) / 2))}
.dice-face.face-3{transform:rotateX(90deg) translateZ(calc(var(--cube-size) / 2));background:linear-gradient(135deg,#fff6db,#ebd59f)}
.dice-face.face-4{transform:rotateX(-90deg) translateZ(calc(var(--cube-size) / 2))}
.dice-spots{width:69%;height:69%;display:grid;grid-template-columns:repeat(3,1fr);grid-template-rows:repeat(3,1fr);gap:10%;place-items:center}
.thumb-right #rollBtn .die .dice-spots i{width:100%;height:100%;border-radius:50%;background:#263a2d;box-shadow:inset 1px 2px 3px #000a,0 1px 0 #fff8}
.dice-shadow{position:absolute;left:5%;bottom:-16px;width:90%;height:22px;border-radius:50%;background:#071a10;filter:blur(7px);opacity:.45;pointer-events:none}
@media(max-height:360px){.thumb-right #rollBtn .die{--cube-size:84px;width:108px;height:108px}}
