.map-intro{display:flex;align-items:center;justify-content:space-between;gap:20px;margin:4px 0 22px}.map-intro h2{font-size:clamp(21px,2.2vw,30px);margin:7px 0 9px;letter-spacing:-.025em}.map-intro p,.map-footnote{color:var(--muted);font-size:13px;line-height:1.6;margin:0}.map-editor{display:grid;grid-template-columns:220px minmax(0,1fr);border:1px solid var(--border);border-radius:12px;overflow:hidden;background:var(--panel-strong);box-shadow:0 16px 45px #0003}.map-controls{padding:16px;background:#0002;border-right:1px solid var(--border)}.map-editor summary{cursor:pointer;font-weight:650;font-size:13px;padding:4px 0 12px}.map-editor label{font-size:12px;color:var(--muted)}.map-fields{display:grid;gap:12px;margin:0 0 14px}.map-fields label{display:grid;gap:6px}.map-editor input:not([type=checkbox]):not([type=range]),.map-editor select{width:100%;min-width:0;background:var(--panel);color:var(--ink);border:1px solid var(--border);border-radius:6px;padding:9px;font:inherit}.map-fields input[type=range]{width:100%;accent-color:var(--accent)}.map-settings>.primary-action{width:100%}.map-secondary{display:grid;gap:7px;margin:8px 0 22px}.map-editor button{font-size:12px;min-height:38px;box-shadow:none}.map-editor button:active{box-shadow:none;filter:none;transform:translateY(1px)}.map-editor button:focus-visible,.map-editor input:focus-visible,.map-editor select:focus-visible,.map-editor canvas:focus-visible{outline:2px solid var(--accent);outline-offset:2px}.map-editor button[aria-pressed=true]{border-color:var(--accent);background:var(--soft)}.map-editor button:disabled{opacity:.4;cursor:default}.map-palette [data-map-palette]{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px}.map-prop-button{display:flex;flex-direction:column;align-items:center;gap:4px;padding:7px 2px;background:#0002}.map-prop-button canvas{width:42px;height:42px}.map-prop-button span{font-size:10px}.map-palette p,.map-help p{font-size:11px;color:var(--muted);line-height:1.6}.map-help{border-top:1px solid var(--border);margin-top:18px;padding-top:12px}.map-main{min-width:0}.map-toolbar{display:flex;align-items:center;gap:12px;padding:12px 14px;border-bottom:1px solid var(--border)}.map-title-label{flex:1;min-width:80px}.map-title-label input{font-size:15px!important;font-weight:650!important;border-color:transparent!important;background:transparent!important}.map-view-tools{display:flex;gap:5px}.map-view-tools button{padding:7px 10px;min-width:36px}.map-stage{height:clamp(400px,60vh,740px);position:relative;background:#171b1a;overflow:hidden}.map-stage>canvas{display:block;width:100%;height:100%;touch-action:none;cursor:grab}.map-stage>canvas:active{cursor:grabbing}.map-stage-tag{position:absolute;bottom:14px;left:16px;color:#d6cbb080;font-size:9px;letter-spacing:.17em;pointer-events:none}.map-stage-tag span{margin:0 8px;color:#cba877}.map-loading{position:absolute;inset:0;background:#171b1acc;display:grid;place-content:center;font-size:15px;color:#e8d4b2}.map-options{display:flex;gap:10px 18px;flex-wrap:wrap;padding:12px 16px;border-bottom:1px solid var(--border)}.map-options label{display:flex;align-items:center;gap:5px;min-height:28px}.map-options input{accent-color:var(--accent);width:15px;height:15px}.map-inspector{display:flex;flex-wrap:wrap;gap:7px;padding:12px 16px 4px;align-items:end}.map-inspector label{display:grid;gap:5px;flex:1;min-width:150px}.map-inspector button{padding:8px 10px}.map-status{font-size:12px;color:var(--muted);padding:10px 16px;min-height:38px}.map-room-notes{margin:0 16px;border-top:1px solid var(--border);padding-top:10px}.map-room-notes>div{display:grid;grid-template-columns:1fr 1fr;gap:10px;padding:0 0 14px}.map-room-notes label{display:grid;gap:5px}.map-room-notes textarea{width:100%;resize:vertical;min-height:65px;background:var(--panel);border:1px solid var(--border);color:var(--ink);padding:8px;border-radius:5px;font:inherit}.map-export{display:flex;flex-wrap:wrap;gap:8px;padding:14px 16px;border-top:1px solid var(--border)}.map-footnote{padding:0 16px 16px;font-size:11px}.map-editor:fullscreen{background:var(--panel-strong);border:0;border-radius:0;overflow:auto}.map-editor:fullscreen .map-stage{height:calc(100dvh - 270px)}.map-library-card{padding:14px;display:flex;flex-direction:column;gap:8px;border:1px solid var(--border);border-radius:8px;background:var(--panel);min-width:0}.map-library-card .map-card-actions{display:flex;gap:8px;margin-top:auto}.map-library-card span{font-size:12px;color:var(--muted)}.map-library-card strong{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.map-library-thumb{height:100px;width:100%;object-fit:contain;background:#161b1a;border-radius:5px}
@media(max-width:1100px){.map-editor{grid-template-columns:190px minmax(0,1fr)}.map-controls{padding:12px}.map-toolbar{flex-wrap:wrap}.map-title-label{flex-basis:100%}.map-view-tools{width:100%;justify-content:flex-end}.map-intro{align-items:start}.map-intro>button{flex-shrink:0}}
@media(max-width:760px){.map-intro{margin:2px 0 14px}.map-intro h2{font-size:22px}.map-intro>button{display:none}.map-editor{grid-template-columns:1fr}.map-controls{border-right:0;border-bottom:1px solid var(--border);display:grid;grid-template-columns:1fr 1fr;gap:12px;padding:12px}.map-settings{grid-column:1/-1}.map-fields{grid-template-columns:1fr 1fr;gap:10px}.map-secondary{grid-template-columns:1fr 1fr;margin-bottom:0}.map-palette{grid-column:1/-1}.map-palette [data-map-palette]{grid-template-columns:repeat(6,minmax(0,1fr))}.map-palette p{margin-bottom:0}.map-help{grid-column:1/-1;margin:0;padding-top:6px}.map-help summary{padding-bottom:2px}.map-toolbar{padding:8px}.map-title-label{flex-basis:40%}.map-view-tools{width:auto;margin-left:auto;gap:3px}.map-view-tools button{padding:6px 8px}.map-stage{height:450px;height:clamp(340px,58dvh,600px)}.map-options{gap:5px 12px;padding:8px 10px}.map-inspector{padding:10px}.map-inspector label{flex-basis:100%}.map-inspector button{flex:1;min-height:42px}.map-status{padding:4px 10px 12px}.map-export{padding:12px 10px;display:grid;grid-template-columns:1fr 1fr}.map-export .primary-action{grid-column:1/-1}.map-room-notes>div{grid-template-columns:1fr}.map-prop-button canvas{width:34px;height:34px}.map-prop-button span{font-size:9px}.map-editor button{min-height:42px}.map-editor input,.map-editor select,.map-editor textarea{font-size:16px!important}.map-footnote{padding:0 10px 12px}}

.map-title-label .sr-only{position:absolute;width:1px;height:1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
.map-mobile-only{display:none}
.map-palette-filter{display:grid;gap:6px;margin:14px 0}
.map-editor [hidden]{display:none!important}
.map-actor-add{width:100%;margin:0 0 4px;font-weight:650}
.map-token-labels{position:absolute;inset:0;pointer-events:none;overflow:hidden}
.map-token-label{position:absolute;pointer-events:none;transform:translate(-50%,-100%);max-width:160px;padding:2px 5px;border-bottom:2px solid var(--token-color);border-radius:4px;color:#fff;background:#16201cdb;font-size:11px;line-height:16px;text-shadow:0 1px 2px #000;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.map-actor-dialog{width:min(720px,calc(100% - 24px));max-height:min(85dvh,var(--map-available-height,85dvh));padding:0;border:1px solid var(--border);border-radius:12px;color:var(--ink);background:linear-gradient(var(--panel-strong),var(--panel-strong)),#151310;overscroll-behavior:contain}
.map-actor-dialog[open]{display:flex;flex-direction:column}
.map-actor-dialog::backdrop{background:#050706a0}
.map-actor-dialog .map-sheet-header button{min-height:44px;flex-shrink:0}
.map-actor-dialog .map-sheet-header h3{min-width:0;overflow-wrap:anywhere}
.map-actor-dialog .map-fields{grid-template-columns:1fr 1fr}
.map-actor-results{display:grid;gap:8px}
.map-editor .map-actor-result{text-align:left;display:flex;flex-direction:column;gap:4px;align-items:flex-start;min-height:56px;padding:10px 12px}
.map-actor-result strong,.map-actor-result span{max-width:100%;overflow-wrap:anywhere}
.map-actor-result span,.map-actor-message,.map-actor-summary{font-size:12px;color:var(--muted);line-height:1.5}
.map-actor-abilities-form{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:8px;margin-bottom:14px}
.map-actor-abilities-form label,.map-actor-notes,.map-actor-vitals label{display:grid;gap:6px}
.map-actor-notes{margin:14px 0}
.map-actor-notes textarea{width:100%;resize:vertical;color:var(--ink);background:var(--panel);border:1px solid var(--border);border-radius:6px;padding:10px;font:inherit}
.map-actor-vitals{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;align-items:end;border-bottom:1px solid var(--border);padding-bottom:14px}
.map-actor-vitals label:has([name=name],select,[name=encounterGroup]),.map-actor-vitals p{grid-column:1/-1}
.map-actor-vitals p{margin:0;color:var(--muted);font-size:12px;line-height:1.5}
.map-actor-description{white-space:pre-wrap;overflow-wrap:anywhere;line-height:1.65;font-size:14px}
.map-actor-dialog .abilities-grid{grid-template-columns:repeat(6,minmax(0,1fr));gap:6px}
@media(max-width:600px){.map-actor-dialog{width:calc(100% - 12px);max-height:min(92dvh,var(--map-available-height,92dvh));bottom:var(--map-keyboard-inset,0px)}.map-actor-dialog .map-sheet-body{padding:12px}.map-actor-dialog .map-fields{grid-template-columns:1fr}.map-actor-vitals{grid-template-columns:1fr 1fr}.map-actor-vitals button{grid-column:1/-1}.map-actor-abilities-form,.map-actor-dialog .abilities-grid{grid-template-columns:repeat(3,minmax(0,1fr))}}
.map-sheet{border:1px solid var(--border);background:var(--panel-strong);color:var(--ink);padding:0;max-width:100%;box-sizing:border-box;overscroll-behavior:contain}
.map-sheet::backdrop{background:#05070680}
.map-sheet-header{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px 16px;border-bottom:1px solid var(--border);flex-shrink:0}
.map-sheet-header h3{margin:0;font-size:17px}
.map-sheet-body{padding:16px;overflow-y:auto;overscroll-behavior:contain;min-height:0;-webkit-overflow-scrolling:touch}
/* Phones get their own bounded workspace. Desktop controls are moved into sheets,
   preserving the same fields, listeners and state rather than duplicating forms. */
@media(max-width:900px),(max-width:1100px) and (pointer:coarse){
  body.map-mobile-active{overflow:hidden;overscroll-behavior:none}
  body.map-mobile-active .sidebar,body.map-mobile-active .topbar{visibility:hidden}
  body.map-mobile-active .map-intro{display:none}
  body.map-mobile-active .map-editor{position:fixed;inset:0;z-index:16;width:100%;height:100dvh;display:block;border:0;border-radius:0;padding:env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);background:linear-gradient(var(--panel-strong),var(--panel-strong)),#151310;overflow:hidden}
  .map-editor.map-phone .map-main{height:100%;display:flex;flex-direction:column;min-height:0}
  .map-phone .map-mobile-only{display:flex}
  .map-phone .map-controls,.map-phone .map-main>.map-options,.map-phone .map-main>.map-inspector,.map-phone .map-main>.map-room-notes,.map-phone .map-main>.map-export,.map-phone .map-main>.map-footnote{display:none}
  .map-phone .map-toolbar{display:grid;grid-template-columns:44px minmax(0,1fr);gap:4px;padding:4px 8px;flex-shrink:0}
  .map-phone .map-title-label{min-width:0}
  .map-phone .map-title-label input{height:44px;font-size:16px!important;padding:8px}
  .map-phone .map-view-tools{grid-column:1/-1;display:grid;grid-template-columns:44px 44px 44px minmax(72px,1fr) 44px;width:100%;gap:6px;justify-content:normal;margin:0}
  .map-phone button{min-width:44px;min-height:44px;font-size:13px;touch-action:manipulation}
  .map-phone .map-back{align-items:center;justify-content:center;font-size:24px;padding:4px}
  .map-phone .map-touch-modes{align-items:center;gap:6px;padding:5px 8px;border-bottom:1px solid var(--border);flex-shrink:0}
  .map-touch-modes button{padding:7px 13px}
  .map-touch-modes span{margin-left:auto;color:var(--muted);font-size:10px;max-width:90px;line-height:1.4}
  .map-phone .map-stage{flex:1;min-height:100px;height:auto;overflow:hidden}
  .map-phone .map-stage>canvas{height:100%;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none}
  .map-phone .map-stage-tag{font-size:8px;bottom:8px;left:10px}
  .map-phone .map-status{flex-shrink:0;min-height:28px;max-height:40px;overflow:hidden;padding:6px 10px;font-size:11px;line-height:1.35;background:var(--panel);order:3}
  .map-phone .map-touch-selection{order:2;align-items:center;gap:6px;padding:4px 10px;min-height:52px;border-top:1px solid var(--border);flex-shrink:0}
  .map-touch-selection span{flex:1;min-width:0;font-size:12px;color:var(--muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  .map-touch-selection button{font-size:22px;padding:4px 12px}
  .map-phone .map-dock{order:4;display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:6px;padding:6px 8px;border-top:1px solid var(--border);flex-shrink:0}
  .map-dock button{padding:6px 2px;font-weight:650}
  .map-phone .map-sheet[open]{display:flex;flex-direction:column;position:fixed;inset:auto 0 var(--map-keyboard-inset,0px);margin:0 auto;width:100%;max-width:640px;max-height:min(82dvh,var(--map-available-height,82dvh));border-radius:18px 18px 0 0;padding-bottom:env(safe-area-inset-bottom);background:linear-gradient(var(--panel-strong),var(--panel-strong)),#151310}
  .map-sheet .map-settings>summary,.map-sheet .map-palette>summary{display:none}
  .map-sheet .map-fields{grid-template-columns:1fr 1fr}
  .map-sheet .map-secondary{grid-template-columns:1fr 1fr;margin:8px 0 16px}
  .map-sheet .map-palette [data-map-palette]{grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}
  .map-sheet .map-prop-button{padding:10px 6px;min-height:84px}
  .map-sheet .map-prop-button canvas{width:48px;height:48px}
  .map-sheet .map-prop-button span{font-size:12px}
  .map-sheet .map-help{margin-top:12px;padding-top:12px}
  .map-sheet .map-help p,.map-sheet .map-palette p{font-size:13px}
  .map-phone .map-desktop-help{display:none}
  .map-sheet .map-options{padding:8px 0;display:grid;grid-template-columns:1fr 1fr;gap:4px 12px}
  .map-sheet .map-options label{min-height:44px;font-size:13px;gap:8px}
  .map-sheet .map-options input{width:20px;height:20px;flex-shrink:0}
  .map-sheet .map-inspector{padding:0;display:grid;grid-template-columns:1fr 1fr;gap:10px}
  .map-sheet .map-inspector label{grid-column:1/-1}
  .map-sheet .map-room-notes{margin:16px 0 0}
  .map-sheet .map-room-notes>div{grid-template-columns:1fr}
  .map-sheet .map-export{display:grid;grid-template-columns:1fr 1fr;padding:0;border:0;gap:10px}
  .map-sheet .map-export .primary-action{grid-column:1/-1}
  .map-sheet .map-footnote{padding:14px 0 0;font-size:12px}
  .map-phone input,.map-phone select,.map-phone textarea{font-size:16px!important;min-height:44px}
  .map-sheet summary{min-height:44px;display:flex;align-items:center;padding:6px 0;font-size:14px}
  .map-sheet input[type=range]{min-height:32px}
}
@media(max-width:900px) and (max-height:500px) and (orientation:landscape),(max-width:1100px) and (max-height:500px) and (pointer:coarse) and (orientation:landscape){
  .map-phone .map-toolbar{grid-template-columns:44px minmax(110px,1fr) minmax(260px,320px)}
  .map-phone .map-view-tools{grid-column:auto}
  .map-phone .map-touch-modes{position:absolute;top:calc(56px + env(safe-area-inset-top));left:8px;z-index:1;background:var(--panel-strong);border:1px solid var(--border);border-radius:8px;padding:3px}
  .map-phone .map-touch-modes span{display:none}
  .map-phone .map-touch-selection{min-height:48px}
  .map-phone .map-status{display:none}
  .map-phone .map-sheet[open]{max-height:min(90dvh,var(--map-available-height,90dvh));max-width:560px}
}
/* Preparation keeps the canvas central; the same four drawers work on desktop and phone. */
.map-editor{grid-template-columns:minmax(0,1fr)}
.map-controls,.map-main>.map-options,.map-main>.map-inspector,.map-main>.map-room-notes,.map-main>.map-export,.map-main>.map-footnote{display:none}
.map-main>.map-dock{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px;padding:10px;border-top:1px solid var(--border)}
.map-sheet[open]{display:flex;flex-direction:column;width:min(680px,calc(100% - 24px));max-height:85dvh;border-radius:14px;background:linear-gradient(var(--panel-strong),var(--panel-strong)),#151310}
.map-sheet .map-settings>summary,.map-sheet .map-palette>summary{display:none}
.map-sheet .map-palette [data-map-palette]{grid-template-columns:repeat(4,minmax(0,1fr));gap:8px}
.map-sheet .map-options,.map-sheet .map-inspector,.map-sheet .map-export{padding:12px 0}
.map-session-bar{display:flex;align-items:center;gap:8px;padding:8px 14px;border-bottom:1px solid var(--border);flex-shrink:0}
.map-session-bar>span{margin-right:auto;min-width:0;font-size:11px;color:var(--muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.map-session-bar button{white-space:nowrap;min-height:44px}
.map-room-actions{display:flex;flex-wrap:wrap;gap:8px;margin:12px 0}
.map-room-list{display:grid;gap:8px}
.map-room-list button{text-align:left;overflow-wrap:anywhere}
[data-room-dialog] p{font-size:13px;line-height:1.6;color:var(--muted)}
[data-room-invite]>label{display:grid;gap:6px}
body.map-battle-active{overflow:hidden}
body.map-battle-active .map-editor{position:fixed;inset:0;z-index:16;border-radius:0;grid-template-columns:minmax(0,1fr) 300px;background:linear-gradient(var(--panel-strong),var(--panel-strong)),#151310}
.map-in-battle .map-main{display:flex;flex-direction:column;min-height:0;height:100dvh}
.map-in-battle .map-stage{flex:1;height:auto;min-height:120px}
.map-in-battle .map-dock,.map-in-battle .map-touch-selection{display:none!important}
.map-in-battle .map-title-label input{pointer-events:none}
.map-battle-panel{padding:16px;border-left:1px solid var(--border);overflow-y:auto;background:var(--panel-strong)}
.map-battle-heading{display:flex;justify-content:space-between;align-items:center;gap:8px;font-size:12px;color:var(--muted)}
[data-battle-current]{font-size:23px;font-weight:750;overflow-wrap:anywhere;margin:18px 0 10px}
.map-battle-turn-tools{display:flex;gap:8px}
.map-battle-hp{display:flex;align-items:end;gap:8px;margin:16px 0}
.map-battle-hp label{display:grid;gap:4px;min-width:0;flex:1}
.map-battle-hp input{max-width:150px}
.map-battle-condition{display:grid;gap:6px}
[data-battle-movement]{font-size:12px;color:var(--muted);line-height:1.5}
.map-battle-panel>[data-battle-next],.map-battle-panel>[data-battle-queue]{width:100%;margin:5px 0;min-height:44px}
.map-battle-order{display:grid;gap:5px;margin:14px 0}
.map-battle-order button{text-align:left;overflow-wrap:anywhere;padding:9px}
.map-battle-order .is-current{border-color:var(--accent);background:var(--soft)}
.map-battle-setup-row{display:grid;grid-template-columns:minmax(0,1fr) 105px 105px;gap:12px;align-items:center;padding:12px 0;border-bottom:1px solid var(--border)}
.map-battle-setup-row label{display:grid;gap:6px;min-width:0}
.map-battle-setup-row .map-battle-included{display:flex;align-items:center;font-size:14px;overflow-wrap:anywhere;color:var(--ink)}
.map-battle-included input{width:18px;min-height:18px!important;flex-shrink:0}
[data-battle-form]>.primary-action{width:100%;margin-top:14px}
@media(max-width:900px),(max-width:1100px) and (pointer:coarse){
 .map-phone .map-session-bar{padding:4px 8px;gap:6px;min-height:52px}
 .map-phone .map-session-bar>span{max-width:110px;white-space:normal;font-size:10px;line-height:1.3}
 .map-phone .map-session-bar button{padding:6px 10px}
 .map-phone .map-touch-modes{padding:3px 8px}
 .map-phone .map-sheet .map-palette [data-map-palette]{grid-template-columns:repeat(3,minmax(0,1fr))}
 body.map-battle-active .map-editor{display:flex;flex-direction:column}
 .map-in-battle.map-phone .map-main{height:auto;flex:1;min-height:0}
 .map-in-battle.map-phone .map-view-tools{display:none}
 .map-in-battle.map-phone .map-touch-modes{min-height:44px}
 .map-in-battle .map-status{display:none}
 .map-in-battle.map-phone .map-battle-panel{flex-shrink:0;display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:6px 10px;max-height:40dvh;overflow-y:auto;padding:8px 10px;border-left:0;border-top:1px solid var(--border)}
 .map-battle-heading{grid-column:1/-1}
 [data-battle-current]{font-size:16px;margin:0;align-self:center}
 .map-battle-turn-tools,.map-battle-order,.map-battle-condition,[data-battle-end]{display:none}
 .map-battle-panel [data-battle-movement]{margin:0;align-self:center;font-size:11px}
 .map-battle-hp{margin:0;grid-column:1;grid-row:3;gap:4px}
 .map-battle-hp label{font-size:10px}
 .map-battle-hp button{font-size:11px;min-width:44px;padding:6px}
 .map-battle-panel>[data-battle-next]{grid-column:2;grid-row:3;margin:0;align-self:end;font-size:12px;padding:6px}
 .map-battle-panel>[data-battle-queue]{grid-column:1/-1;margin:0;min-height:44px}
 .map-battle-setup-row{grid-template-columns:1fr 1fr}
 .map-battle-setup-row .map-battle-included{grid-column:1/-1}
}
@media(min-width:1101px),(min-width:901px) and (pointer:fine){
 .map-intro{margin:0 0 12px;gap:12px}.map-intro h2{display:none}.map-intro p{font-size:12px;margin-top:6px}
 .map-editor:not(.map-phone) .map-main{display:flex;flex-direction:column;height:calc(100dvh - 205px);min-height:460px}
 .map-editor:not(.map-phone) .map-stage{flex:1;min-height:200px;height:auto}
 .map-editor:not(.map-phone).map-in-battle .map-main{height:100dvh;min-height:0}
 .map-editor:fullscreen:not(.map-phone) .map-main{height:100dvh}
}
.map-battle-setup-condition{grid-column:1/-1}

.map-room-code{display:flex;flex-wrap:wrap;align-items:center;gap:12px;padding:16px;border:1px solid var(--border);border-radius:12px;background:var(--panel-strong)}.map-room-code>span{width:100%;font-size:12px;color:var(--muted)}.map-room-code strong{font:600 22px monospace;letter-spacing:2px;color:var(--ink)}[data-room-members] p{overflow-wrap:anywhere;padding:8px 0;border-bottom:1px solid var(--border)}.map-join-link{color:var(--accent);white-space:nowrap}.map-intro{flex-wrap:wrap}

.map-proposal{display:flex;flex-shrink:0;align-items:center;justify-content:space-between;gap:12px;padding:10px 14px;border-bottom:1px solid var(--border);background:var(--panel-strong)}.map-proposal[hidden]{display:none}.map-proposal>div{display:grid;min-width:0;gap:4px}.map-proposal strong{font-size:13px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.map-proposal span{font-size:12px;color:var(--muted)}.map-proposal button{min-height:44px;flex-shrink:0}.map-phone .map-proposal{padding:6px 8px;gap:8px}.map-phone .map-proposal button{font-size:11px;padding:6px 10px;max-width:145px}.map-phone .map-proposal span{font-size:10px}
.map-lighting {display:flex;align-items:center;flex-shrink:0}
.map-lighting .sr-only {position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}
.map-editor .map-lighting select {width:120px;min-width:120px;min-height:44px;padding:7px;font-size:12px}
.map-palette-search {display:grid;gap:5px;margin:10px 0;font-size:12px}
.map-palette-search input {width:100%;min-width:0;min-height:40px}
[data-map-palette-count] {font-size:11px!important;min-height:16px}
.map-editor.map-phone .map-session-bar>[data-map-session-status]{display:none}.map-editor.map-phone .map-session-bar{flex-wrap:nowrap}.map-editor.map-phone .map-session-bar button{flex-shrink:0}
.map-adventure-bar{grid-column:1/-1;display:flex;align-items:center;gap:12px;flex-wrap:wrap;padding:7px 12px;border-bottom:1px solid var(--border);background:var(--panel-strong);font-size:12px;flex-shrink:0}
.map-adventure-bar[hidden]{display:none}.map-adventure-bar>span{flex:1;min-width:130px;color:var(--muted)}.map-adventure-bar label{display:flex;align-items:center;gap:6px}.map-adventure-bar select{width:105px;min-height:36px}.map-adventure-bar button{min-height:36px}
.map-initiative-dialog .map-battle-setup-row{grid-template-columns:minmax(0,1fr) 100px 110px;gap:8px 12px;padding:16px 0}
.map-initiative-dialog .map-battle-included{grid-column:1/-1;font-size:16px}.map-initiative-stats{grid-column:1/-1;color:var(--muted);font-size:13px}.map-initiative-stats strong{color:var(--ink)}
.map-initiative-dialog [data-roll-actor]{min-height:44px;align-self:end}.map-initiative-dialog [data-dice-result]{grid-column:1/-1;min-height:16px;font-size:12px;color:var(--accent)}.map-initiative-options{grid-column:1/-1;color:var(--muted);font-size:12px}.map-initiative-options[open]{display:grid;gap:10px}.map-initiative-options summary{cursor:pointer;padding:4px 0}.map-initiative-options input,.map-initiative-options select{width:100%}
.map-proposals{grid-column:1/-1;max-height:180px;overflow:auto;flex-shrink:0}.map-proposals[hidden]{display:none}.map-proposals .map-proposal{border-top:0}
@media(max-width:900px){.map-phone .map-session-bar [data-battle-start]{white-space:normal;max-width:145px;line-height:1.2;font-size:12px}.map-phone .map-adventure-bar{padding:4px 8px;gap:4px 8px;font-size:10px}.map-phone .map-adventure-bar>span{flex-basis:100%}.map-phone .map-adventure-bar label{flex:1}.map-phone .map-adventure-bar select{width:100px;font-size:11px}.map-phone .map-adventure-bar button{font-size:11px;padding:4px 8px}.map-phone .map-proposals{max-height:130px}.map-in-battle.map-phone [data-battle-end]{display:block;grid-column:1/-1;min-height:36px}.map-initiative-dialog .map-battle-setup-row{grid-template-columns:1fr 1fr}.map-initiative-dialog [data-roll-actor]{grid-column:1/-1}.map-initiative-dialog .map-sheet-body{padding:12px}.map-initiative-dialog input{min-width:0}}
.map-room-entry{display:grid;grid-template-columns:1fr 1fr;gap:16px;margin:20px 0}
.map-role-card{padding:20px;border:1px solid var(--border);border-radius:14px;background:var(--panel-strong);min-width:0;display:flex;flex-direction:column;align-items:stretch}
.map-role-eyebrow{font-size:10px;letter-spacing:.12em;font-weight:700;color:var(--accent)}.map-role-card h4{font-size:18px;margin:10px 0 8px}.map-role-card p{font-size:13px;line-height:1.55;color:var(--muted);margin:0 0 16px}.map-role-card>button{margin-top:auto;min-height:46px}
.map-join-form{display:grid;grid-template-columns:minmax(90px,1fr) auto;gap:10px;align-items:end}.map-join-form label{display:grid;gap:6px;font-size:12px;color:var(--muted)}.map-join-form input{font:700 24px ui-monospace,monospace;letter-spacing:.2em;text-transform:uppercase;min-width:0;width:100%;min-height:48px}.map-join-form button{min-height:48px;padding:10px 14px}.map-join-form p{grid-column:1/-1;margin:0}.map-join-form p:empty{display:none}
.map-room-list-heading{display:flex;align-items:center;justify-content:space-between;gap:16px;margin-top:24px}.map-room-list-heading h4{margin:0}.map-room-list-heading span{font-size:12px;color:var(--muted)}.map-room-limit{font-size:13px;color:var(--accent)}
.map-room-list-row{display:flex;align-items:stretch;gap:10px}.map-room-list-open{flex:1;min-width:0;text-align:left;display:grid;gap:5px;padding:13px 16px}.map-room-list-open strong{font-size:14px;font-weight:600;overflow-wrap:anywhere}.map-room-list-open span{font-size:11px;color:var(--muted);font-family:ui-monospace,monospace}.map-room-delete{align-self:center;min-height:44px;font-size:12px;color:var(--muted);background:transparent;border:1px solid var(--border);box-shadow:none;padding:8px 12px}
.map-sight-controls{grid-column:1/-1;border:1px solid var(--border);border-radius:10px;padding:14px;display:grid;grid-template-columns:1fr 1fr;gap:18px}.map-sight-controls legend{padding:0 6px;font-weight:600}.map-sight-controls small{display:block;color:var(--muted);font-size:12px;line-height:1.45;font-weight:400}.map-sight-controls .map-light-toggle{display:flex;align-items:center;gap:10px}.map-sight-controls input[type=checkbox]{width:22px;height:22px;flex-shrink:0}
.map-lighting[hidden]{display:none!important}
.map-library-card{cursor:pointer}
.map-library-card:focus-visible{outline:2px solid var(--accent);outline-offset:3px}
[data-map-adventures]{display:grid;gap:6px;min-width:0;cursor:default}
.map-shelf-card [data-map-adventures]{margin-top:7px}
[data-map-adventures] h4{margin:0;font-size:12px;color:var(--muted)}
.map-adventure-card{display:grid;gap:5px;min-width:0;padding:8px;border:1px solid var(--border);border-radius:8px;background:var(--soft)}
.map-adventure-card strong{font-size:13px;white-space:normal;overflow-wrap:anywhere}
.map-adventure-card span{color:var(--muted);font-size:11px}
.map-adventure-card button{min-height:44px;white-space:normal;overflow-wrap:anywhere}
@media(max-width:650px){.map-room-entry{grid-template-columns:1fr;gap:12px;margin:14px 0}.map-role-card{padding:16px}.map-role-card h4{font-size:16px}.map-sight-controls{grid-template-columns:1fr}.map-room-list-row{gap:6px}.map-room-list-open{padding:11px}.map-room-delete{padding:8px}.map-join-form button{font-size:13px}}

.map-stage>.map-gm-light{position:absolute;left:10px;top:10px;z-index:3;padding:8px 12px;min-height:40px;background:var(--panel-strong);border:1px solid var(--border);border-radius:8px;color:var(--ink);box-shadow:0 2px 8px #0003}.map-stage>.map-gm-light[aria-pressed=true]{border-color:var(--accent);background:var(--panel-strong)}.map-gm-light[hidden]{display:none!important}

/* Small GM-only rarity markers and the object inspector. */
.map-chest-badges{position:absolute;inset:0;pointer-events:none;overflow:hidden;z-index:4}
.map-object-tooltip{position:absolute;z-index:6;pointer-events:none;max-width:min(220px,calc(100% - 16px));padding:7px 11px;border:1px solid var(--border);border-radius:8px;background:var(--panel-strong);color:var(--ink);box-shadow:0 3px 12px #0006;font-size:13px;line-height:1.35;white-space:pre-line}.map-object-tooltip[hidden]{display:none}
.map-chest-rarity{position:absolute!important;pointer-events:auto;width:32px!important;height:32px!important;min-height:32px!important;padding:8px!important;border:0!important;background:transparent!important;box-shadow:none!important;transform:translate(-50%,-50%);touch-action:manipulation}
.map-chest-rarity i,.map-rarity-options i{display:inline-block;width:12px;height:12px;border-radius:50%;border:1px solid #fff9;box-shadow:0 1px 3px #000b;flex-shrink:0}
.map-object-dialog{max-width:580px}.map-rarity-options{display:flex;flex-wrap:wrap;gap:8px;margin:12px 0}.map-rarity-options button{display:flex;align-items:center;gap:7px}.map-rarity-options button[aria-pressed=true]{outline:2px solid var(--accent,#d8aa62);outline-offset:1px}.map-object-dialog fieldset{padding:12px;border:1px solid var(--border,#8b7357);border-radius:10px}.map-object-dialog small{display:block;line-height:1.5;opacity:.8}.map-object-dialog [data-object-findings] article{padding:12px 0;border-bottom:1px solid #8884}.map-object-dialog [data-object-findings] p{margin:6px 0}.map-object-dialog .map-room-actions{margin-top:16px;display:flex;gap:8px;flex-wrap:wrap}
.map-actor-vitals small{font-weight:400;line-height:1.4;display:block}.map-actor-vitals select,.map-actor-vitals input{min-width:0;max-width:100%}

.map-preview-bar{display:flex;align-items:center;flex-wrap:wrap;gap:10px;padding:10px 14px;border:1px solid var(--border,#8b7357);border-radius:12px}.map-preview-bar label{display:flex;align-items:center;gap:8px;min-width:0}.map-preview-bar select{max-width:min(320px,65vw)}.map-preview-bar p{flex:1 1 240px;font-size:.85rem;margin:0}.map-preview-active .map-inspector,.map-preview-active .map-palette,.map-preview-active .map-room-notes,.map-preview-active .map-battle-panel,.map-preview-active .map-settings{display:none!important}.map-preview-active [data-battle-start],.map-preview-active [data-room-open],.map-preview-active .map-adventure-bar{visibility:hidden}.map-preview-active .map-dock{display:none!important}

.map-object-dialog{background:linear-gradient(var(--panel-strong),var(--panel-strong)),#151312}.map-object-dialog summary{padding:8px 0;cursor:pointer}.map-preview-launch{position:absolute;left:10px;top:10px;z-index:5;min-width:44px;min-height:44px;padding:8px;background:var(--panel-strong)}.map-preview-launch svg{display:block;margin:auto}.map-preview-active .map-session-bar,.map-preview-active .map-adventure-bar{display:none!important}.map-preview-active .map-stage{min-height:180px}
[data-room-actions-queue] .map-proposal{flex-wrap:wrap}[data-room-actions-queue] .map-proposal>div{flex:1 1 180px}[data-room-actions-queue] .map-proposal span{overflow-wrap:anywhere}
.map-workshop{width:min(760px,calc(100vw - 24px));max-height:90dvh;padding:0;overflow:hidden}
.map-workshop[open]{display:flex;flex-direction:column}.map-workshop>.map-sheet-header,.map-workshop>.workshop-message{flex-shrink:0}.map-workshop>.workshop-body{min-height:0;flex:1}
.workshop-tabs{display:flex;gap:6px;padding:10px 16px;overflow-x:auto;flex-shrink:0;border-bottom:1px solid var(--border)}
.workshop-tabs button{flex:0 0 auto;white-space:nowrap;min-height:42px;padding:8px 13px}
.workshop-tabs [aria-selected=true]{outline:2px solid var(--accent);outline-offset:-2px}
.workshop-body{max-height:calc(90dvh - 180px);overflow-y:auto;overscroll-behavior:contain;padding:16px;display:grid;gap:18px}
.workshop-section{display:grid;gap:10px;min-width:0;padding:16px;border:1px solid var(--border);border-radius:12px;background:var(--panel)}
.workshop-section h4{margin:0;font-size:1.05rem}.workshop-section label,.workshop-card label{display:grid;gap:5px;font-size:.9rem}
.workshop-section input,.workshop-section select,.workshop-section textarea{width:100%;max-width:100%;min-width:0;box-sizing:border-box;min-height:42px}
.workshop-section textarea{min-height:80px;resize:vertical}.workshop-section button{min-height:42px;white-space:normal}
.workshop-hint{font-size:.9rem;line-height:1.5;opacity:.8;margin:0}.workshop-message{margin:0;padding:8px 16px;color:var(--ink);min-height:20px}
.workshop-card{display:grid;gap:8px;padding:12px;border:1px solid var(--border);border-radius:8px;overflow-wrap:anywhere}
details.workshop-card{display:block}details.workshop-card>*{margin:6px 0}details.workshop-card summary{cursor:pointer;min-height:32px}
.workshop-row{display:flex;gap:8px;align-items:center;justify-content:space-between;flex-wrap:wrap}.workshop-row span{flex:1;min-width:120px}
.workshop-event{margin:0;padding:8px 0;border-bottom:1px solid #8883;font-size:.9rem;overflow-wrap:anywhere}
[data-actor-mechanics]{margin:12px 0;width:100%;white-space:normal}
@media(min-width:650px){.workshop-section{grid-template-columns:1fr 1fr}.workshop-section>h4,.workshop-section>.workshop-hint,.workshop-card,.workshop-row,.workshop-event{grid-column:1/-1}}
@media(max-width:650px){.map-workshop{width:calc(100vw - 12px);max-height:94dvh}.workshop-tabs{padding:8px}.workshop-body{max-height:calc(94dvh - 170px);padding:10px}.workshop-section{padding:12px}.workshop-tabs button{padding:6px 10px}}
.map-main>.map-toolbar{padding:10px 14px;gap:12px;background:var(--panel-strong)}
.map-main .map-title-label input{font-size:16px;font-weight:650;min-height:42px;padding:7px 10px}
.map-main .map-view-tools{gap:4px}
.map-main .map-view-tools button{min-height:38px;padding:6px 12px}
.map-main>.map-session-bar{flex-wrap:wrap;padding:10px 14px;gap:8px;background:var(--panel-strong)}
.map-main .map-session-bar>span{flex:1 1 160px;font-size:12px;line-height:1.4}
.map-main .map-session-bar button{padding:9px 14px;font-size:13px;min-height:42px}
.map-main .map-session-bar [data-battle-start]{order:2;margin-left:auto}
.map-main .map-session-bar [data-workshop-open]{order:1}
.map-main .map-session-bar .map-pending-button{order:-1;margin:0;border-color:var(--accent);color:var(--ink);background:color-mix(in srgb,var(--accent) 16%,var(--panel-strong));font-weight:650;display:flex;align-items:center;gap:8px}
.map-pending-button b{display:inline-grid;place-items:center;min-width:24px;height:24px;border-radius:50%;background:var(--accent);color:var(--bg);font-size:12px}
.map-decisions{border-block:1px solid var(--accent);border-left:3px solid var(--accent);background:var(--panel-strong);flex-shrink:0}
.map-decisions-heading{display:flex;justify-content:space-between;align-items:center;gap:12px;padding:10px 14px}
.map-decisions-heading strong{font-size:13px;color:var(--ink)}
.map-decisions-heading span{font-size:11px;color:var(--accent)}
.map-decision-list{display:flex;flex-direction:column;gap:6px;padding:0 10px 10px;max-height:240px;overflow:auto;overscroll-behavior:contain;scrollbar-gutter:stable}
.map-decisions .map-proposals{display:grid;grid-template-columns:repeat(auto-fit,minmax(330px,1fr));gap:6px;max-height:none;overflow:visible}
.map-decisions .map-proposal{border:1px solid var(--border);border-radius:9px;padding:10px;gap:8px;flex-wrap:wrap;background:color-mix(in srgb,var(--accent) 5%,var(--panel-strong));animation:map-decision-arrive .2s ease-out}
.map-decisions .map-proposal>div{flex:1 1 190px;gap:5px}
.map-decisions .map-proposal button{font-size:12px;min-height:40px;padding:7px 10px}
.map-decisions .map-proposal span{font-size:11px;line-height:1.4}
.map-decisions .map-decision-find{order:-1;background:transparent}
.map-decisions .map-proposal>div{order:-2}
.map-main .map-pending-button[hidden],.map-decisions[hidden],.map-decisions .map-proposals[hidden]{display:none}
@keyframes map-decision-arrive{from{transform:translateY(-3px);opacity:.4}to{transform:translateY(0);opacity:1}}
@media(max-width:900px){
 .map-editor.map-phone .map-session-bar{display:flex;flex-wrap:wrap;padding:6px 8px;gap:6px;min-height:0}
 .map-editor.map-phone .map-session-bar button{padding:7px 10px;min-height:40px;font-size:12px}
 .map-editor.map-phone .map-session-bar [data-battle-start]{flex:1;max-width:none;white-space:nowrap}
 .map-editor.map-phone .map-session-bar .map-pending-button{flex-basis:100%;justify-content:center}
 .map-editor.map-phone .map-decisions-heading{padding:8px 10px}
 .map-editor.map-phone .map-decisions-heading span{font-size:10px}
 .map-editor.map-phone .map-decision-list{max-height:160px;padding:0 6px 6px}
 .map-editor.map-phone .map-decisions .map-proposals{grid-template-columns:minmax(0,1fr);max-height:none}
 .map-editor.map-phone .map-decisions .map-proposal{padding:8px;gap:6px}
 .map-editor.map-phone .map-decisions .map-proposal>div{flex-basis:100%}
 .map-editor.map-phone .map-decisions .map-proposal button{flex:1;max-width:none;min-height:40px}
}
@media(prefers-reduced-motion:reduce){.map-decisions .map-proposal{animation:none}}


.map-gm-light{font-size:12px;color:var(--muted);padding:8px 10px}
.map-gm-light [data-view-master],.map-gm-light [data-view-player]{transition:color .2s,text-shadow .2s}
.map-gm-light[aria-pressed="true"] [data-view-master],.map-gm-light[aria-pressed="false"] [data-view-player]{color:var(--accent);text-shadow:0 0 10px color-mix(in srgb,var(--accent) 35%,transparent);font-weight:700}
.map-intro p{font-size:16px;line-height:1.65;max-width:95ch}
.map-launch-actions{display:flex;gap:8px;flex-wrap:wrap;margin-left:auto;align-items:center}
.map-launch-actions :is(button,.map-community-link){min-height:44px;font-size:14px;white-space:nowrap}
.map-community-link{display:inline-flex;align-items:center;justify-content:center;gap:9px;min-width:0;box-sizing:border-box;padding:10px 14px;border:1px solid color-mix(in srgb,var(--accent) 65%,var(--border));border-radius:var(--radius);background:linear-gradient(145deg,color-mix(in srgb,var(--accent) 12%,var(--soft)),rgba(0,0,0,.22));box-shadow:inset 0 1px 0 #ffffff08;color:var(--ink);font:inherit;line-height:1.15;text-decoration:none;transition:background .16s,border-color .16s,box-shadow .16s,transform .16s}
.map-community-link svg{width:20px;height:20px;flex:none;color:var(--accent)}
.map-community-link:focus-visible{outline:2px solid var(--accent);outline-offset:3px}
@media(hover:hover){.map-community-link:hover{color:var(--ink);border-color:var(--accent);background:linear-gradient(145deg,color-mix(in srgb,var(--accent) 22%,var(--soft)),rgba(0,0,0,.18));box-shadow:0 4px 16px #0003;transform:translateY(-1px)}}
.map-community-link:active{transform:translateY(1px)}
@media(prefers-reduced-motion:reduce){.map-community-link{transition:none}.map-community-link:hover,.map-community-link:active{transform:none}}
.map-main>.map-launch-actions{margin:0;padding:6px 8px;justify-content:flex-end;border-bottom:1px solid var(--border);flex-shrink:0}
.map-phone .map-launch-actions [data-map-action=fullscreen]{display:none}
.map-phone .map-launch-actions :is(button,.map-community-link){font-size:12px;min-height:36px;padding:5px 12px}
.map-intro>div:first-child{flex:1 1 600px}
.map-new-title{display:grid;gap:6px;margin:12px 0;font-size:13px}.map-new-title input{width:100%;min-height:44px;box-sizing:border-box}
.map-shelf{margin-bottom:18px}.map-shelf-heading{display:flex;justify-content:space-between;gap:12px;align-items:center}
.map-shelf-heading span{color:var(--muted);font-size:12px}.map-shelf>p{font-size:12px;line-height:1.5;color:var(--muted)}
[data-map-shelf]{display:grid;grid-template-columns:repeat(auto-fill,minmax(135px,1fr));gap:10px;max-height:320px;overflow:auto;padding:2px}
.map-shelf-card{position:relative;min-width:0}.map-shelf-open{display:grid!important;width:100%;gap:7px;padding:7px!important;text-align:left;border-radius:9px;min-width:0}
.map-shelf-open[aria-current=true]{border-color:var(--accent);outline:1px solid var(--accent)}
.map-shelf-open canvas{width:100%;height:76px;border-radius:5px;object-fit:contain;background:#202826}
.map-shelf-open span{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;max-width:100%;font-size:12px}
.map-shelf-remove{position:absolute;top:7px;right:7px;width:32px;min-height:32px!important;padding:0!important;border-radius:50%;background:var(--panel-strong)!important;font-size:20px!important}
.map-dock button[data-map-sheet=file]{white-space:normal;font-size:12px;line-height:1.25}
.map-sheet [data-map-sheet-body]{overscroll-behavior:contain}
.map-sheet .map-export{grid-template-columns:1fr}.map-sheet .map-export button{justify-content:flex-start;text-align:left}
@media(max-width:900px){.map-intro p{font-size:15px}.map-phone .map-main>.map-launch-actions{order:0}.map-phone .map-launch-actions{width:100%;box-sizing:border-box}.map-phone .map-session-bar [data-battle-start]{white-space:normal;min-width:0}.map-phone .map-main>.map-toolbar{padding:5px 8px}.map-shelf-remove{width:40px;min-height:40px!important}.map-dock button[data-map-sheet=file]{font-size:11px}}
.map-dock button[data-map-sheet=edit]{font-size:11px;word-break:normal;overflow-wrap:normal}
.chest-search-results{max-height:240px;overflow:auto;display:grid;gap:6px}
.chest-search-results button{text-align:left;font-size:13px}
.chest-browser{width:min(660px,calc(100vw - 24px));max-height:min(80dvh,48rem)}
.chest-browser label{display:grid;gap:6px}
.chest-browser input{width:100%;min-width:0}
.chest-browser-list{display:grid;gap:6px;max-height:40dvh;overflow:auto}
.chest-browser-list>div{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:6px 8px;border-bottom:1px solid var(--border)}
.chest-browser-list a{color:var(--accent)}
.chest-browser-list small{display:block;color:var(--muted)}
.chest-browser-list button{flex:none}
.chest-browser-pages{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-top:12px}
.chest-browser-pages[hidden]{display:none}
.chest-browser [data-add-status]{min-height:1.5em;color:var(--accent);margin-bottom:0}
.map-stage>.map-guide-tool{position:absolute;z-index:5;left:10px;bottom:30px;display:flex;align-items:center;gap:6px;min-height:40px;max-width:185px;padding:4px 8px;background:var(--panel-strong);border:1px solid var(--border);border-radius:8px;box-shadow:0 2px 8px #0006}
.map-stage>.map-guide-tool[aria-pressed=true]{background:linear-gradient(180deg,color-mix(in srgb,var(--accent) 24%,transparent),color-mix(in srgb,var(--accent) 11%,transparent)),var(--panel-strong);border-color:var(--accent);box-shadow:0 0 0 1px color-mix(in srgb,var(--accent) 55%,transparent),0 0 10px color-mix(in srgb,var(--accent) 24%,transparent)}
.map-stage>.map-guide-tool[hidden]{display:none}
.map-stage>.map-rotation-controls{position:absolute;right:12px;bottom:12px;z-index:6;display:flex;gap:6px}
.map-stage>.map-rotation-controls[hidden],.map-rotation-controls button[hidden]{display:none}
.map-rotation-controls button{min-width:44px;min-height:44px;padding:6px 10px;font-size:22px;background:var(--panel-strong);border:1px solid var(--border)}
.map-phone .map-stage>.map-rotation-controls{bottom:66px}
.map-immersive.map-phone .map-stage>.map-rotation-controls{bottom:12px}
.map-rotation-controls [data-map-light-open]{font-size:14px;padding-inline:12px}
.map-rotation-controls [data-map-light-open][aria-expanded=true]{border-color:var(--accent);color:var(--accent)}
.map-stage>.map-light-panel{position:absolute;right:12px;bottom:64px;z-index:7;box-sizing:border-box;width:min(355px,calc(100% - 24px));max-height:calc(100% - 76px);overflow:auto;display:grid;gap:8px;padding:10px 12px;border:1px solid var(--border);border-radius:10px;background:var(--panel-strong);box-shadow:0 4px 20px #0006}
.map-light-heading{display:flex;align-items:center;gap:8px;font-size:13px}
.map-light-heading label{display:flex;align-items:center;justify-content:space-between;gap:8px;flex:1;min-width:0}
.map-editor .map-light-panel input[type=number]{box-sizing:border-box;width:72px;min-height:36px;padding:6px 8px}
.map-light-panel [data-map-light-close]{min-width:36px;min-height:36px;padding:0;font-size:20px}
.map-editor .map-light-panel input[type=range]{width:100%;min-height:28px;margin:0;padding:0;accent-color:var(--accent);touch-action:pan-y}
.map-light-legend{display:flex;flex-wrap:wrap;gap:6px 14px;font-size:12px;line-height:1.35}
.map-light-legend span::before{content:'';display:inline-block;width:16px;margin-right:6px;vertical-align:middle;border-top:2px solid #ffda85}
.map-light-legend span:last-child::before{border-top:2px dashed #bacdff}
.map-light-legend output{white-space:nowrap;font-variant-numeric:tabular-nums}
.map-light-panel [data-map-reset-light-range]{justify-self:start;min-height:34px;padding:4px 8px;font-size:12px}
.map-phone:not(.map-immersive) .map-stage>.map-light-panel{bottom:118px;max-height:calc(100% - 130px)}
@media(max-height:500px){.map-phone .map-stage>.map-light-panel{top:8px;bottom:auto;max-height:calc(100% - 16px)}}
.map-guide-tool img{flex:none;width:25px;height:25px}
.map-guide-tool kbd{display:grid;place-items:center;flex:none;min-width:17px;height:17px;padding:0 3px;border:1px solid var(--border);border-radius:4px;background:var(--soft);color:var(--ink);font:600 10px/1 ui-monospace,monospace}
.map-guide-tool[aria-pressed=true] kbd{border-color:color-mix(in srgb,var(--accent) 65%,var(--border))}
.map-stage.map-guiding:has(>.map-guide-pointer:not([hidden]))>canvas{cursor:none}
.map-stage.map-guiding .map-chest-rarity,.map-stage.map-guiding .map-rock-handle{pointer-events:none}
.map-phone .map-stage>.map-guide-tool{top:10px;right:10px;bottom:auto;left:auto;min-height:44px;max-width:calc(50% - 12px);font-size:11px}
.map-chest-rarity.is-unprepared i{display:grid;place-items:center;background:#b72e2e!important;color:#fff;font-style:normal;font-weight:900;font-size:15px;line-height:1;width:20px;height:20px;border:1px solid #ffb5a8}
.map-chest-hint{display:none;position:absolute;left:26px;top:-8px;width:175px;padding:8px 10px;background:#2e201a;color:#fff1e4;border:1px solid #d38a6a;border-radius:8px;box-shadow:0 4px 14px #0009;font-size:12px;line-height:1.4;text-align:left;pointer-events:none}
.map-chest-rarity:focus-visible .map-chest-hint{display:block}
.chest-item-editor{display:grid;grid-template-columns:1fr 1fr;gap:8px;border:1px solid var(--border);border-radius:10px;padding:10px;margin:12px 0}
.chest-item-editor input,.chest-item-editor textarea{min-width:0;width:100%;box-sizing:border-box}.chest-item-editor input:first-of-type,.chest-item-editor textarea{grid-column:1/-1}
.map-tour{position:fixed;inset:0;padding:0;margin:0;border:0;width:100vw;height:100dvh;max-width:none;max-height:none;background:transparent;color:var(--ink);overflow:hidden;cursor:default}
.map-tour::backdrop{background:transparent;backdrop-filter:none}
.map-tour-focus{position:fixed;border:1px solid var(--accent);border-radius:6px;box-shadow:0 0 0 9999px #000c;pointer-events:none;box-sizing:border-box}
.map-tour-focus.is-empty{border:0;border-radius:0}
.map-tour-target{scroll-margin:12px}
@media(max-width:600px){.map-tour-target{scroll-margin:8px}}
.map-tour-card{position:fixed;box-sizing:border-box;width:min(400px,calc(100vw - 24px));max-height:calc(100dvh - 32px);overflow:auto;padding:20px;border:1px solid var(--accent);border-radius:16px;background:var(--panel-strong);box-shadow:0 12px 45px #000b;line-height:1.55;backdrop-filter:blur(12px)}
.map-tour-card h3{font-size:21px;margin:8px 0}.map-tour-card p{font-size:15px;margin:8px 0 14px}.map-tour-card small{font-size:12px;color:var(--muted)}
.map-tour-card nav{display:flex;gap:8px;margin-top:20px;padding-top:16px;border-top:1px solid var(--border)}.map-tour-card nav button{font:inherit;font-size:13px;font-weight:400;min-height:44px;padding:9px 14px;border-radius:10px;box-shadow:none}.map-tour-card nav [data-tour-next]{margin-left:auto;display:flex;align-items:center;gap:14px}.map-tour-card nav [data-tour-next]::after{content:'→';font-size:18px;transition:translate .18s}.map-tour-card nav [data-tour-next]:hover::after{translate:2px 0}.map-tour-card nav [data-tour-skip]{background:transparent;border-color:transparent;color:var(--muted)}.map-tour-card nav [data-tour-next]:active{box-shadow:none;filter:none;transform:translateY(1px)}
dialog.map-tour-underlay{position:fixed;top:12px;bottom:auto;margin:0 auto;max-height:max(140px,calc(100dvh - var(--tour-card-space) - 24px));display:flex;flex-direction:column;overflow:hidden}
dialog.map-tour-underlay>.map-sheet-body{min-height:0;overflow:auto;overscroll-behavior:contain}
.map-tour-demo{background:var(--panel-strong);color:var(--ink);width:min(720px,calc(100vw - 24px));border:1px solid var(--border);border-radius:16px;padding:0}
.map-tour-demo section{padding:16px;border:1px solid var(--border);border-radius:12px;margin:10px 0}
.map-tour-demo h4{margin:0 0 12px}.map-tour-demo p{font-size:14px;line-height:1.6}.map-tour-demo small{display:block;color:var(--muted);font-size:12px}
.tour-invite-code{font-size:28px;letter-spacing:.2em;color:var(--accent);margin:12px 0}.tour-player{display:flex;align-items:center;gap:12px;border-top:1px solid var(--border);padding:12px 0;overflow-wrap:anywhere}.tour-player-dot{width:8px;height:8px;flex-shrink:0;border-radius:50%;background:#78ba94}.tour-player small{margin-top:4px}
.map-editor .map-toolbar [data-map-tutorial]{display:inline-flex;align-items:center;justify-content:center;flex:none;min-height:44px;padding:7px 12px;border-color:var(--accent);background:color-mix(in srgb,var(--accent) 16%,var(--panel-strong));color:var(--ink);font-weight:650;white-space:nowrap}
.map-editor .map-toolbar [data-map-tutorial]:hover{background:color-mix(in srgb,var(--accent) 28%,var(--panel-strong))}
@media(max-width:600px){.map-tour-card{padding:16px}.map-tour-card h3{font-size:19px}.map-tour-card p{font-size:14px}.map-phone .map-launch-actions{justify-content:space-between}.map-phone .map-launch-actions :is(button,.map-community-link){font-size:11px}}
/* Every explanation has its own reserved space, including narrow phone screens. */
.map-tour-card{padding:22px;border-color:color-mix(in srgb,var(--accent) 65%,var(--border));box-shadow:0 12px 45px #0009;max-height:calc(100dvh - 24px)}
.map-tour-card h3{margin:12px 0 8px;line-height:1.3}.map-tour-card p{margin-bottom:16px}.map-tour-focus{border-radius:8px}
.map-tour-progress{display:flex;align-items:center;gap:16px}.map-tour-progress>span{height:2px;background:var(--border);flex:1;border-radius:2px;overflow:hidden}.map-tour-progress i{display:block;height:100%;background:var(--accent)}
.map-tour-card nav{gap:6px;margin-top:18px;padding-top:14px}.map-tour-card nav button{padding:9px 12px;border-radius:9px}.map-tour-card nav [data-tour-next]{gap:12px}
/* These dimensions override both desktop sheets and the fixed mobile editor. */
dialog.map-tour-underlay[open]{position:fixed!important;inset:12px 12px auto!important;margin:0 auto!important;width:calc(100vw - 24px)!important;max-width:none!important;min-height:0!important;height:auto!important;max-height:calc(100dvh - var(--tour-card-space,340px) - 12px)!important;display:flex!important;flex-direction:column!important;overflow:hidden!important;box-sizing:border-box;border-radius:14px!important;padding:0!important}
dialog.map-tour-underlay>.map-sheet-body{min-height:0;overflow:auto;overscroll-behavior:contain;padding:14px}
dialog.map-tour-underlay .map-sheet-header{padding:12px 14px;min-height:52px;box-sizing:border-box}
dialog.map-tour-underlay .map-sheet-header h3{font-size:16px}
dialog.map-tour-underlay .map-sheet-header>small{font-size:10px;color:var(--muted);white-space:nowrap}
.map-tour-demo{box-sizing:border-box}.map-tour-demo::backdrop{background:#05070680}.map-tour-demo section{padding:14px;border-radius:10px;margin:0}
.map-tour-demo h4{font-size:16px}.map-tour-demo p{font-size:13px;line-height:1.6}.map-tour-demo small{font-size:11px;line-height:1.5}
.map-tour-demo label{display:grid;gap:6px;font-size:12px;color:var(--muted);min-width:0}.map-tour-demo input:not([type=range]),.map-tour-demo select{box-sizing:border-box;width:100%;min-width:0;padding:9px;border:1px solid var(--border);border-radius:7px;background:var(--panel);color:var(--ink);font:inherit;font-size:14px;min-height:40px}
.map-tour-demo button{font-size:12px;font-weight:400;min-height:40px;padding:8px 12px;box-shadow:none}.map-tour-demo button.primary-action{font-weight:400}
.tour-demo-actions{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-top:12px}.tour-demo-actions span{font-size:12px;color:var(--muted)}.tour-demo-fields{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin:12px 0}
.tour-invite-code{font-size:32px;letter-spacing:.22em;margin:8px 0 16px;font-variant-numeric:tabular-nums}
.tour-player{padding:14px 0;font-size:13px}.tour-player i{width:8px;height:8px;flex-shrink:0;border-radius:50%;background:#78ba94}.tour-player small{margin-top:3px}
.tour-requests article{padding:12px;border:1px solid var(--border);border-radius:9px;margin-top:10px;background:var(--panel)}.tour-requests strong{font-size:13px;font-weight:500}.tour-requests .primary-action{margin-left:auto}
.tour-initiative-next{padding:12px 0;margin:12px 0;border-top:1px solid var(--border);border-bottom:1px solid var(--border);font-size:14px}
.tour-demo-tabs{display:flex;gap:8px;margin:0 0 12px}.tour-demo-tabs span{padding:8px 14px;font-size:13px;color:var(--muted);border-radius:8px}.tour-demo-tabs .is-current{color:var(--accent);background:var(--soft)}
[data-tour-participants]>button{margin-top:14px}
.tour-loot-row{display:flex;align-items:center;gap:16px;justify-content:space-between;border-top:1px solid var(--border);padding:12px 0;font-size:13px}.tour-loot-row:first-of-type{margin-top:14px}.tour-loot-row label{width:70px;flex-shrink:0}.tour-loot-row small{margin-top:4px}
.tour-example-maps{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}.tour-example-maps .map-shelf-open canvas{height:100px}.tour-example-maps .map-shelf-remove{width:30px;min-height:30px!important;padding:0!important}
.map-tour-demo[data-example=drag] .map-stage{height:min(480px,calc(100dvh - var(--tour-card-space,300px) - 108px));min-height:130px;border-radius:8px}.map-tour-demo[data-example=drag] .map-gm-light,.map-tour-demo[data-example=drag] .map-stage-tag{display:none}
@media(min-width:1000px){dialog.map-tour-underlay[open]{inset:24px auto auto 24px!important;width:calc(100vw - 472px)!important;max-width:840px!important;max-height:calc(100dvh - 48px)!important;margin:0!important}.map-tour-demo[data-example=drag] .map-stage{height:min(580px,calc(100dvh - 150px))}}
@media(max-width:600px){.map-tour-card{padding:16px}.map-tour-card p{margin-bottom:12px}.map-tour-card nav{margin-top:14px;padding-top:12px}.map-tour-card nav button{padding:8px 10px;font-size:12px}.map-tour-card nav [data-tour-next]{gap:8px}.map-tour-demo section{padding:12px}.tour-example-maps{gap:7px}.tour-example-maps .map-shelf-open{padding:5px!important}.tour-example-maps .map-shelf-open canvas{height:85px}.tour-example-maps .map-shelf-open span{font-size:11px}.tour-example-maps .map-shelf-remove{top:4px;right:4px}.tour-demo-fields{gap:8px}.tour-demo-actions{gap:6px}.map-tour-demo button{padding:8px;font-size:11px}}
@media(prefers-reduced-motion:reduce){.map-tour-card nav [data-tour-next]::after{transition:none}}
.map-tour-demo{background:linear-gradient(var(--panel-strong),var(--panel-strong)),#151310}
.map-tour-card nav button:focus-visible{outline:1px solid var(--accent);outline-offset:3px}
/* Keep the essential controls together while explaining a long settings sheet. */
.map-tour-underlay[data-tour-step=create] .map-fields>label:nth-child(n+4){display:none}
.map-tour-underlay[data-tour-step=objects] [data-map-palette]>:nth-child(n+7){display:none}
.map-tour-underlay[data-tour-step=objects] [data-water-brush-controls]{display:none}
.map-tour-underlay .map-brush-controls{display:block}
.map-tour-underlay .map-brush-controls .workshop-hint{margin:6px 0 10px;line-height:1.4}
.map-tour-underlay .map-brush-controls h4{margin:0 0 6px}
.map-tour-underlay .map-brush-controls .map-brush-actions{display:flex;margin-top:8px;gap:8px}
.map-tour-underlay .map-brush-controls .map-brush-actions button{flex:1;min-height:40px}
.map-tour-underlay [data-chest-editor]{align-items:start}
.map-tour-underlay [data-chest-editor]>button{align-self:start;min-height:38px}
@media(max-width:600px){
 .map-tour-underlay[data-tour-step=objects] .map-prop-button{padding:6px;min-height:66px}
 .map-tour-underlay[data-tour-step=objects] .map-prop-button canvas{width:32px;height:32px}
 .map-tour-underlay[data-tour-step=objects] .map-prop-button span{font-size:11px}
 .map-tour-underlay .workshop-tabs{padding:8px 14px;gap:6px}.map-tour-underlay .workshop-tabs button{min-height:36px;padding:6px 10px}
 .map-tour-underlay[data-tour-step=chests] [data-object-hint],.map-tour-underlay[data-tour-step=chests] [data-chest-rarities]>small,.map-tour-underlay[data-tour-step=chests] [data-chest-editor]>.workshop-hint{display:none}
 .map-tour-underlay[data-tour-step=chests] [data-chest-rarities]{padding:6px;margin:0 0 8px}.map-tour-underlay[data-tour-step=chests] .map-rarity-options{gap:4px}.map-tour-underlay[data-tour-step=chests] .map-rarity-options button{padding:5px 7px;min-height:30px;font-size:10px}
 .map-tour-underlay[data-tour-step=chests] [data-chest-editor]{padding:8px;display:grid;grid-template-columns:1fr 1fr;gap:6px;margin:0}
 .map-tour-underlay[data-tour-step=chests] [data-chest-editor]>h4{font-size:13px;margin:0;grid-column:1/-1}.map-tour-underlay[data-tour-step=chests] [data-chest-editor]>button:first-of-type{grid-column:1/-1}
 .map-tour-underlay[data-tour-step=chests] [data-chest-editor]>.map-fields{grid-column:1/-1;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px;margin:0}
 .map-tour-underlay[data-tour-step=chests] [data-chest-editor] input{font-size:12px!important;min-height:32px;padding:6px}.map-tour-underlay[data-tour-step=chests] [data-chest-editor] label{font-size:10px;gap:2px}
 .map-tour-underlay[data-tour-step=chests] [data-chest-editor]>button{font-size:10px;padding:5px;min-height:32px}.map-tour-underlay[data-tour-step=chests] .chest-search-results:empty{display:none}
}
dialog.map-tour-underlay .map-brush-controls label{display:grid;gap:4px;line-height:1.3;margin:0}
dialog.map-tour-underlay .map-brush-controls input[type=range]{height:24px;margin:0}
dialog.map-tour-underlay .map-brush-controls output{margin:0;font-size:12px}
dialog.map-tour-underlay .map-brush-controls .workshop-hint{font-size:13px}
@media(max-width:600px){dialog.map-tour-underlay .map-sheet-header{padding:8px 14px}dialog.map-tour-underlay .map-sheet-header button{min-height:36px;padding:6px 10px}}
[data-tour-loot] .loot-inventory-row{padding:10px 0}

/* Task-based navigation and compact chest preparation, shared by phone and desktop. */
.map-main>.map-dock{grid-template-columns:repeat(5,minmax(0,1fr));gap:6px}
.map-dock button{display:flex;align-items:center;justify-content:center;gap:8px;min-height:48px;font-size:13px!important;line-height:1.2;background:transparent}
.map-dock svg{width:20px;height:20px;flex-shrink:0}
.map-dock button[aria-expanded=true]{background:var(--soft);border-color:var(--accent)}
.map-sheet[data-sheet=settings] .map-settings{border:1px solid var(--border);border-radius:10px;padding:12px;margin-bottom:20px}
.map-sheet[data-sheet=settings] .map-settings>summary{display:list-item;list-style-position:inside;padding:4px 0;min-height:32px;color:var(--accent)}
.map-sheet[data-sheet=settings] .map-settings[open]>summary{margin-bottom:12px}
.map-sheet[data-sheet=settings] .map-settings>[data-map-action=import]{margin-bottom:16px}
.map-settings .map-fields>label:has([data-map-setting=kind]){grid-column:1/-1}
.map-sheet[data-sheet=view] .map-sheet-body{display:flex;flex-direction:column;gap:14px}
.map-sheet .map-lighting{display:flex;align-items:center;justify-content:space-between;gap:12px}
.map-sheet .map-lighting .sr-only{position:static;width:auto;height:auto;margin:0;clip:auto;clip-path:none;overflow:visible;white-space:normal}
.map-editor .map-sheet .map-lighting select{width:160px;max-width:100%;flex:0 1 160px}
.map-sheet [data-map-editor-light]{align-self:flex-start}
.map-sheet[data-sheet=file] .map-launch-actions{margin:16px 0;padding:16px 0;border-block:1px solid var(--border);justify-content:flex-start}
.map-sheet[data-sheet=file] .map-room-notes{margin:20px 0}
.map-sheet[data-sheet=file] .map-footnote{margin-top:16px;padding:0}
.map-sheet .map-export{display:grid;grid-template-columns:1fr 1fr;gap:10px;border:0}
.map-sheet .map-export [data-map-action=save]{grid-column:1/-1}
.map-sheet .map-export [data-map-action=download]{grid-column:1/-1}
.map-touch-selection.has-selection{display:flex;align-items:center;gap:8px;padding:8px 14px;border-top:1px solid var(--border)}
.map-touch-selection [data-map-selection-properties]{font-size:12px}
.map-empty{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:14px;padding:24px;text-align:center;background:radial-gradient(ellipse at center,#35413955,transparent 70%);color:#eee2ce}
.map-empty strong{font-size:clamp(20px,3vw,28px);font-weight:600;max-width:360px;line-height:1.3}
.map-empty-actions{display:flex;flex-wrap:wrap;justify-content:center;gap:8px}
.map-empty button{min-height:44px}
.map-start-dialog{max-width:480px}
.map-start-actions{display:flex;justify-content:flex-end;flex-wrap:wrap;gap:10px;margin-top:24px}
.map-start-actions button{min-height:44px}
.map-object-dialog.is-chest{width:min(860px,calc(100% - 24px));max-width:860px}
.map-object-dialog [data-object-hint]{font-size:13px;line-height:1.6;color:var(--muted);margin:0 0 18px}
.map-object-dialog [data-chest-rarities]{margin:0 0 18px;padding:10px 14px}
.map-rarity-options{gap:6px;margin:6px 0 10px}
.map-rarity-options button{min-height:40px;font-size:12px;padding:8px 10px}
.map-object-dialog [data-chest-rarities] small{font-size:12px;color:var(--muted)}
.chest-editor{display:flex;flex-direction:column;gap:18px;min-width:0}
.chest-editor h4{margin:0;font-size:15px}
.chest-editor p{line-height:1.5}
.chest-generator{display:flex;align-items:center;justify-content:space-between;gap:18px;padding:14px;border:1px solid var(--border);border-radius:10px;background:var(--panel)}
.chest-generator>div{min-width:0;flex:1}
.chest-generator .workshop-hint{margin:5px 0 0;font-size:12px}
.chest-generator>button{flex:0 0 auto;align-self:center;min-height:44px;height:auto;padding:10px 16px}
.chest-layout{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.25fr);gap:20px;align-items:start}
.chest-manual{display:flex;flex-direction:column;gap:14px}
.chest-coins{border:1px solid var(--border);border-radius:10px;padding:0 12px 12px}
.chest-coins:not([open]){padding-bottom:0}
.map-object-dialog .chest-coins>summary{padding:12px 0;font-size:14px;min-height:44px;box-sizing:border-box}
.chest-coin-fields{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin:0 0 12px}
.chest-editor label{display:grid;gap:6px;font-size:12px}
.chest-catalog{display:grid;gap:8px}
.chest-search-results:empty{display:none}
.chest-content-heading{display:flex;align-items:center;justify-content:space-between;gap:10px;margin:0 0 12px}
.chest-content-heading span{font-size:12px;color:var(--muted)}
.chest-empty{border:1px dashed var(--border);border-radius:10px;padding:24px 18px;text-align:center}
.chest-empty strong{font-size:15px;font-weight:600}
.chest-empty p{font-size:13px;color:var(--muted);margin:8px 0 0}
.chest-item-list{display:grid;gap:8px}
.map-object-dialog .chest-item-editor{display:block;margin:0;padding:0;border:1px solid var(--border);border-radius:9px;min-width:0}
.map-object-dialog .chest-item-editor>summary{padding:12px;font-size:13px;line-height:1.45;overflow-wrap:anywhere;min-height:44px;box-sizing:border-box}
.chest-item-fields{display:grid;gap:12px;border-top:1px solid var(--border);padding:12px}
.chest-item-fields textarea{background:var(--panel);color:var(--ink);border:1px solid var(--border);border-radius:6px;padding:9px;font:inherit;resize:vertical}
.chest-item-fields p{font-size:13px;margin:0}
.chest-clear{margin-top:12px;background:transparent;color:var(--muted)}
.map-object-dialog.is-chest [data-object-actions]{padding-top:14px;margin-top:20px;border-top:1px solid var(--border)}
.map-object-dialog [data-object-message]:empty,.map-object-dialog [data-object-findings]:empty{display:none}
.map-chest-rarity.is-empty i{background:var(--panel-strong)!important;border:2px solid #bbb8a8;box-shadow:0 1px 4px #0009}
.map-shelf-remove{width:44px;min-height:44px!important}
@media(max-width:900px),(max-width:1100px) and (pointer:coarse){
 .map-phone .map-main>.map-launch-actions{display:none}
 .map-phone .map-toolbar{grid-template-columns:44px minmax(0,1fr) auto auto}
 .map-phone .map-main>.map-toolbar{padding:4px 8px;gap:4px}
 .map-phone .map-toolbar [data-room-open]{padding-inline:8px}
 .map-phone .map-toolbar .map-save-status{grid-column:2/-1;margin-inline:8px}
 .map-phone.map-drawing .map-toolbar .map-save-status{grid-column:1/-1}
 .map-editor.map-phone .map-session-bar{min-height:52px;padding:4px 8px;flex-wrap:wrap;justify-content:space-between}
 .map-phone .map-session-bar>.map-lighting,.map-phone .map-session-bar>[data-map-editor-light],.map-phone .map-session-bar>[data-workshop-open]{display:none}
 .map-editor.map-phone .map-session-bar>[data-map-session-status]{display:block;max-width:none;flex:1 1 90px;font-size:11px;line-height:1.4}
 .map-editor.map-phone .map-session-bar button{min-height:44px;white-space:normal}
 .map-editor.map-phone .map-session-bar [data-battle-start]{flex:0 1 auto;max-width:none;font-size:12px;min-height:44px;white-space:normal;padding:9px 12px}
 .map-phone .map-touch-modes{position:static;padding:4px 8px;gap:4px;min-height:52px;border-radius:0;border-inline:0}
 .map-phone .map-touch-modes button{font-size:12px;padding:8px 12px}
 .map-phone .map-touch-modes span{font-size:10px;max-width:74px}
 .map-phone .map-stage>.map-view-tools{position:absolute;bottom:12px;right:10px;z-index:5;display:flex;gap:4px;width:auto;padding:4px;border:1px solid var(--border);border-radius:12px;background:var(--panel-strong);box-shadow:0 4px 16px #0005}
 .map-phone .map-view-tools button{min-height:44px;min-width:44px;padding:6px 9px;font-size:14px;background:transparent;border-color:transparent}
 .map-phone .map-view-tools [data-map-action=fit]{font-size:12px}
 .map-phone .map-stage-tag{display:none}
 .map-phone .map-stage>.map-gm-light{top:10px;left:10px;min-height:44px;font-size:11px;padding:6px 10px}
 .map-phone .map-main>.map-dock{grid-template-columns:repeat(5,minmax(0,1fr));gap:2px;padding:6px 5px}
 .map-phone .map-dock button{flex-direction:column;gap:5px;min-height:58px;min-width:0;padding:6px 1px;font-size:11px!important;border-color:transparent}
 .map-phone .map-dock button[aria-expanded=true]{border-color:var(--accent)}
 .map-phone .map-touch-selection.has-selection{display:flex;flex-wrap:wrap;gap:4px;padding:5px 8px;min-height:0}
 .map-phone .map-touch-selection span{flex:1 1 90px;font-size:11px}
 .map-phone .map-touch-selection button{padding:6px 8px}
 .map-phone .map-touch-selection [data-map-selection-properties]{font-size:11px}
 .map-phone .map-status{font-size:11px;min-height:28px;padding:5px 10px}
 .map-phone .map-sheet[open]{max-height:min(88dvh,var(--map-available-height,88dvh))}
 .map-phone .map-sheet-header{padding:12px}
 .map-phone .map-sheet[data-sheet=file] .map-launch-actions{display:grid;grid-template-columns:1fr 1fr;gap:8px}
 .map-phone .map-sheet .map-launch-actions :is(button,.map-community-link){min-height:44px;white-space:normal}
 .map-phone .map-chest-rarity{width:44px!important;height:44px!important;min-height:44px!important}
 .map-phone .map-adventure-bar{gap:4px 8px}
 .map-phone .map-adventure-bar>span{flex:1;font-size:11px;min-width:0}
 .map-phone .map-adventure-bar>label{flex:1 1 100%}
 .map-editor.map-phone .map-adventure-bar select{width:140px;min-width:140px}
 .map-phone .map-adventure-bar button{min-height:44px}
 .map-phone .map-empty{padding:20px}
}
@media(max-width:600px){
 .map-object-dialog.is-chest{width:calc(100% - 12px);max-height:min(94dvh,var(--map-available-height,94dvh))}
 .chest-layout{grid-template-columns:minmax(0,1fr);gap:20px}
 .chest-contents{grid-row:1}
 .chest-generator{flex-direction:column;align-items:flex-start;gap:12px;padding:12px}
 .chest-generator>button{align-self:stretch}
 .map-object-dialog .map-rarity-options{display:grid;grid-template-columns:1fr 1fr;gap:6px}
 .map-object-dialog .map-rarity-options button{min-width:0;min-height:44px;padding:7px 8px;font-size:11px}
 .chest-manual>button{align-self:flex-start}
 .chest-item-fields button{min-height:44px}
 .map-start-actions{flex-direction:column-reverse}
 .map-start-actions button{width:100%}
 .map-sheet .map-export{grid-template-columns:1fr}
}
@media(max-width:380px){.map-sheet:not(.map-tour-underlay) .map-fields{grid-template-columns:minmax(0,1fr)}}
@media(max-height:500px) and (orientation:landscape){
 .map-phone .map-main>.map-toolbar{padding-block:2px}
 .map-phone .map-touch-modes{position:absolute;top:104px;left:8px;z-index:6;border:1px solid var(--border);border-radius:8px;background:var(--panel-strong)}
 .map-phone .map-touch-modes span{display:none}
 .map-phone .map-stage>.map-gm-light{left:auto;right:10px}
 .map-phone .map-stage>.map-guide-tool{left:10px;right:auto}
 .map-phone .map-main>.map-dock{padding-block:3px}
 .map-phone .map-dock button{min-height:44px;flex-direction:row}
 .map-phone .map-stage>.map-view-tools{bottom:8px}
 .map-phone .map-status{display:none}
 .map-phone .map-touch-selection.has-selection{position:absolute;left:8px;bottom:56px;z-index:6;border:1px solid var(--border);border-radius:8px;background:var(--panel-strong);max-width:45%}
}
/* Tutorial highlights use the same controls in a compact, non-interactive example. */
.map-tour-underlay[data-tour-step=create] .map-fields{grid-template-columns:repeat(2,minmax(0,1fr))}
@media(max-width:380px){.map-tour-underlay[data-tour-step=create] select{font-size:14px!important;padding:7px}}
.map-tour-underlay[data-tour-step=chests] [data-chest-editor]{display:flex;gap:10px;padding:0}
.map-tour-underlay[data-tour-step=chests] .chest-generator{padding:10px;gap:8px}
.map-tour-underlay[data-tour-step=chests] .chest-generator .workshop-hint{display:none}
.map-tour-underlay[data-tour-step=chests] .chest-layout{gap:10px}
.map-tour-underlay[data-tour-step=chests] .chest-empty{padding:12px}
.map-tour-underlay[data-tour-step=chests] .chest-empty p{margin-top:4px;font-size:12px}
@media(max-width:600px){.map-tour-underlay[data-tour-step=chests] .chest-contents{display:none}}

/* Dialogs must fit their contents as well as the viewport, including long names. */
.map-actor-dialog{box-sizing:border-box;max-width:calc(100% - 12px)}
.map-actor-dialog .map-sheet-body,.map-workshop .workshop-body{min-width:0;overflow-wrap:anywhere}
.map-actor-dialog :is(label,fieldset,.map-fields,.map-actor-vitals){min-width:0}
.map-actor-dialog :is(.map-fields,.map-sight-controls){grid-template-columns:repeat(2,minmax(0,1fr))}
.map-actor-dialog legend{max-width:100%;white-space:normal}
.map-editor .map-actor-dialog button{min-width:0;max-width:100%;height:auto;white-space:normal;overflow-wrap:break-word;line-height:1.4}
.workshop-choice{grid-column:1/-1;min-width:0;border:1px solid var(--border);border-radius:8px;padding:0 12px;background:var(--panel)}
.map-workshop .workshop-choice>summary{display:list-item;list-style-position:inside;min-height:44px;padding:10px 0;line-height:1.5;overflow-wrap:anywhere}
.workshop-choice summary span{font-size:12px;color:var(--muted);font-weight:400}
.workshop-choice summary strong{font-size:14px}
.workshop-choice-list{display:grid;gap:6px;padding:0 0 12px;max-height:240px;overflow:auto}
.map-editor .workshop-choice-list button{text-align:left;overflow-wrap:anywhere;min-height:44px}
@media(max-width:650px){
 .map-actor-dialog :is(.map-fields,.map-sight-controls){grid-template-columns:minmax(0,1fr)}
 .map-join-form{grid-template-columns:minmax(0,1fr)}
 .map-join-form button{width:100%}
}
@media(max-width:900px),(max-width:1100px) and (pointer:coarse){
 .map-workshop .workshop-tabs{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));overflow:visible;gap:6px;padding:8px}
 .map-workshop .workshop-tabs button{min-width:0;min-height:44px;padding:8px;white-space:normal;line-height:1.35}
 .map-workshop .workshop-body{max-height:none}
 .map-workshop>.workshop-message:empty{display:none}
}

/* Keep initiative actions outside the scrolling participant list. */
.map-battle-form{display:flex;flex-direction:column;min-height:0;overflow:hidden;margin:0}
.map-battle-form>.map-sheet-body{flex:1;min-height:0}
.map-dialog-actions{display:flex;flex-wrap:wrap;gap:8px;align-items:center}
.map-dialog-footer{display:flex;align-items:center;justify-content:flex-end;flex-wrap:wrap;gap:10px;padding:12px 16px;border-top:1px solid var(--border);flex-shrink:0;background:var(--panel-strong)}
.map-dialog-footer [data-battle-error]{flex:1 1 220px;min-width:0;margin:0;font-size:13px;line-height:1.5;overflow-wrap:anywhere}
.map-dialog-footer [data-battle-error]:empty{display:none}
.map-dialog-footer [data-battle-confirm]{min-height:44px;padding:10px 20px}
.map-initiative-dialog [data-dice-result]:empty{display:none}
@media(max-width:600px){.map-dialog-footer{padding:10px 12px}.map-dialog-footer [data-battle-confirm]{width:100%}}

/* Desktop forms use balanced columns and compact, aligned actions. */
@media(min-width:901px) and (pointer:fine){
 .map-editor:not(.map-phone) :is(.map-sheet,.map-actor-dialog) button{font-size:14px;min-height:42px;line-height:1.4}
 .map-editor:not(.map-phone) :is(.map-sheet,.map-actor-dialog) label{font-size:13px}
 .map-editor:not(.map-phone) :is(.map-sheet,.map-actor-dialog) :is(input,select,textarea){font-size:14px}
 .map-sheet .map-fields{grid-template-columns:repeat(2,minmax(0,1fr))}
 .map-sheet .map-options{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px 16px}
 .map-sheet .map-options label{min-height:36px}
 .map-sheet .map-options input{flex-shrink:0}
 .map-sheet .map-inspector{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}
 .map-sheet .map-inspector label{grid-column:1/-1;min-width:0}
 .map-actor-vitals label:has([name=tokenIcon],[name=tokenColor]){grid-column:auto}
 .map-actor-vitals>button{grid-column:1/-1;justify-self:end;padding:10px 20px}
 .map-initiative-dialog .map-battle-setup-row{grid-template-columns:minmax(120px,1fr) minmax(140px,1fr) auto;align-items:end}
 .map-initiative-options[open]{grid-template-columns:minmax(120px,.6fr) minmax(0,1fr);align-items:end;gap:10px 16px}
 .map-initiative-options summary{grid-column:1/-1}
 .map-initiative-dialog [data-roll-actor]{padding:10px 16px}
 .map-workshop .workshop-body{align-content:start;max-height:none}
 .map-workshop>.workshop-message:empty{display:none}
 .workshop-section{grid-template-columns:repeat(2,minmax(0,1fr));align-content:start;align-items:end}
 .workshop-section>button{justify-self:start;align-self:end;padding:10px 16px}
 .workshop-section>p{grid-column:1/-1}
 .workshop-card:not(details){grid-template-columns:minmax(0,1fr) auto auto;align-items:center}
 details.workshop-card>button{margin:6px 8px 0 0}
 .map-battle-turn-tools{display:grid;grid-template-columns:repeat(2,minmax(0,1fr))}
 .map-battle-turn-tools>button{min-height:42px;white-space:normal;overflow-wrap:break-word}
 .map-battle-turn-tools>button:last-child{grid-column:1/-1}
}

.map-loading{
  z-index:10;
  justify-items:center;
  gap:14px;
  background:#171b1a;
  color:var(--ink,#e8d4b2);
  text-align:center;
  touch-action:none;
}
.map-loading-spinner{
  box-sizing:border-box;
  width:38px;
  height:38px;
  border:3px solid var(--border,#465645);
  border-top-color:var(--accent,#b6d887);
  border-radius:50%;
  animation:map-loading-spin .85s linear infinite;
}
@keyframes map-loading-spin{to{transform:rotate(360deg)}}
@media(prefers-reduced-motion:reduce){.map-loading-spinner{animation:none}}

.map-hero-preview:not([hidden]) {
  position: relative;
  display: grid;
  place-items: center;
  align-self: center;
  justify-self: start;
  width: 74px;
  height: 60px;
  border: 1px solid #ae9a634d;
  border-radius: 9px;
  background: radial-gradient(ellipse at 46% 40%, #5e4934, #24201f 72%);
}

.map-hero-preview img:first-child {
  width: 58px;
  height: 58px;
  object-fit: contain;
}

.map-hero-preview img:last-child {
  position: absolute;
  right: -7px;
  bottom: -4px;
  width: 27px;
  height: 27px;
}
