.map-main{padding:14px 20px}.map-page{height:calc(100dvh - 105px);min-height:480px;display:flex;flex-direction:column;gap:8px;position:relative;min-width:0}.map-heading{display:flex;align-items:center;justify-content:space-between;gap:8px}.map-heading strong{font-size:18px}.map-heading small{display:block}.map-toolbar,.map-editbar,.map-director{display:flex;align-items:center;gap:6px;flex-wrap:wrap;margin:0}.map-toolbar .btn,.map-editbar .btn,.map-director .btn,.map-heading .btn{min-height:44px;flex-shrink:0}.map-toolbar select,.map-editbar select,.map-director select{width:auto;max-width:230px;min-height:44px}.map-director{padding:8px;background:var(--cream,#f7f4eb);border:1px solid var(--line);border-radius:10px;font-size:13px}.map-director label{font-weight:700}.map-audience{flex:1;min-width:160px}.map-layout{flex:1;min-height:0;position:relative;grid-template-columns:minmax(0,1fr) 260px;gap:12px}.map-stage{display:flex;flex-direction:column;min-width:0;min-height:0;gap:5px}.map-canvas{flex:1;height:auto;min-height:200px;touch-action:none;overscroll-behavior:contain;background:#b6c1af}.map-canvas svg{display:block;width:100%;height:100%;touch-action:none;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none}.map-canvas .pawn{filter:none;cursor:grab}.map-canvas .pawn circle{vector-effect:non-scaling-stroke;stroke-width:2px}.map-canvas .pawn .pawn-hit{stroke:none;pointer-events:all}.map-canvas .pawn.selected .pawn-disc{stroke:#d8ad57;stroke-width:4px}.map-canvas .pawn .label{fill:#172d24;stroke:#fff;stroke-width:3px;vector-effect:non-scaling-stroke;paint-order:stroke;pointer-events:none}.map-canvas .pawn-letter{fill:white;pointer-events:none}.map-grid{stroke:#354832;stroke-opacity:.22;stroke-width:1px;fill:none}.map-grid path{vector-effect:non-scaling-stroke}.wall-line{stroke:#654a40;stroke-width:3px;vector-effect:non-scaling-stroke;pointer-events:none}.wall-line.selected{stroke:#b47721;stroke-width:5px}.wall-hit{stroke:transparent;stroke-width:24px;vector-effect:non-scaling-stroke;pointer-events:stroke;cursor:move}.movement-range{fill:#d5bc63;fill-opacity:.09;stroke:#8c702f;stroke-width:2px;stroke-dasharray:6 5;vector-effect:non-scaling-stroke;pointer-events:none}.map-path{stroke:#b77923;stroke-width:3px;stroke-dasharray:6 5;vector-effect:non-scaling-stroke;pointer-events:none}.map-zoom{position:absolute;right:8px;bottom:8px;padding:3px 7px;background:#fffdf2e8;border-radius:5px;font-size:12px;pointer-events:none}.map-hint{font-size:13px;line-height:1.35;min-height:19px;overflow-wrap:anywhere}.map-hint.error{color:#94342d}.map-quick{display:flex;align-items:center;gap:6px;flex-wrap:wrap}.map-quick .btn{min-height:44px}.map-side{display:block;min-height:0;overflow:auto}.map-details{height:100%}.map-details summary{padding:12px;border:1px solid var(--line);border-radius:10px;font-weight:700;cursor:pointer;background:#fffdf7}.map-details summary span{float:right;font-size:12px;font-weight:400}.map-details-body{display:grid;gap:10px;padding-top:8px}.map-details .card{margin:0;padding:14px}.map-editbar label{white-space:nowrap;font-size:13px}.map-editbar input{width:auto}.map-page.is-expanded{position:fixed;inset:0;z-index:80;height:100dvh;min-height:0;background:#f6f4ec;padding:10px;padding-bottom:max(10px,env(safe-area-inset-bottom))}.map-page[aria-busy=true] .map-hint::before{content:'Speichere … ';font-weight:700}.map-page[aria-busy=true] .map-canvas{cursor:wait}
@media(max-width:980px){.map-layout{display:flex;flex-direction:column;gap:5px}.map-stage{flex:1}.map-side{flex:none;overflow:visible}.map-details:not([open]){height:auto}.map-details[open]{position:absolute;bottom:0;left:0;right:0;z-index:4;max-height:75%;overflow:auto;height:auto;background:#faf8ef;border:1px solid var(--line);border-radius:12px;box-shadow:0 -8px 30px #0003}.map-details-body{padding:8px;grid-template-columns:1fr 1fr}.map-details summary{min-height:44px}.map-director{flex-wrap:nowrap;overflow-x:auto}.map-audience{min-width:155px}.map-director select{min-width:130px}}
@media(max-width:760px){.map-main{padding:6px!important}.map-page{height:calc(100dvh - 127px);min-height:400px;gap:5px}.map-heading strong{font-size:15px}.map-heading small{font-size:11px}.map-toolbar,.map-editbar{flex-wrap:nowrap;overflow-x:auto;padding-bottom:3px;flex-shrink:0}.map-toolbar select{min-width:150px}.map-canvas{border-radius:8px;min-height:160px}.map-hint{font-size:12px}.map-details-body{grid-template-columns:1fr}.map-director{padding:4px;flex-shrink:0}.map-director label{display:none}.map-heading{flex-shrink:0}.map-page.is-expanded{height:100dvh;min-height:0;padding:6px;padding-top:max(6px,env(safe-area-inset-top));padding-bottom:max(6px,env(safe-area-inset-bottom))}.map-quick span{font-size:12px}.map-details summary{padding:10px}.map-editbar select{min-width:170px}}
@media print{.map-page{height:auto}.map-canvas{height:600px;flex:none}.map-toolbar,.map-editbar,.map-director,.map-quick,.map-side,.map-hint,.map-heading .actions{display:none}}
.map-canvas svg[data-tool="wall"] #map-tokens{pointer-events:none}

.map-page[aria-busy=true] .map-director button,.map-page[aria-busy=true] .map-editbar button,.map-page[aria-busy=true] .map-quick button{pointer-events:none;opacity:.6}

/* Map fills the workspace beside the desktop sidebar. */
.shell:has(.map-full) .topbar{display:none}.shell:has(.map-full) .workspace{position:relative;height:100dvh}
.map-full{position:absolute;inset:0;padding:0!important;max-width:none!important}
@media(max-width:800px){
.shell:has(.map-full) .sidebar{position:fixed;inset:auto 0 0;height:auto;padding:0 4px env(safe-area-inset-bottom);z-index:90;background:#fafbf7;border-top:1px solid var(--line)}
.shell:has(.map-full) .sidebar>.brand,.shell:has(.map-full) .sidebar>label,.shell:has(.map-full) .sidebar>select,.shell:has(.map-full) .sidebar>.account{display:none}
.shell:has(.map-full) .nav{display:flex;justify-content:space-around;gap:0}.shell:has(.map-full) .nav a{flex:1;display:flex;flex-direction:column;align-items:center;gap:3px;padding:9px 3px 8px;font-size:11px;border-radius:0}.shell:has(.map-full) .nav .icon{font-size:22px}
.map-full{position:fixed;inset:0 0 calc(64px + env(safe-area-inset-bottom))}
}
.map-full .map-page{height:100%;min-height:0;gap:0}.map-full .map-heading{display:none}.map-full .map-layout{display:block;height:100%}.map-full .map-stage,.map-full .map-canvas{height:100%;min-height:0;border:0;border-radius:0}.map-full .map-stage{display:block}.map-full .map-quick{position:absolute;bottom:8px;left:8px;right:8px;background:#fffdf1f2;border:1px solid var(--line);border-radius:10px;padding:6px;z-index:4;box-shadow:0 3px 14px #172f2520}.map-full .map-quick span{margin-right:auto}.map-full .map-quick .btn{padding:8px 10px;font-size:12px}
.player-roster{position:absolute;inset:0 0 auto;z-index:6;display:flex;align-items:center;gap:5px;overflow-x:auto;overscroll-behavior-x:contain;padding:calc(4px + env(safe-area-inset-top)) 7px 4px;min-height:44px;background:#fffdf3f2;border-bottom:1px solid #bbbfa9;scrollbar-width:thin}
.player-roster>[role=listitem]{flex:none}.roster-figure{display:flex;align-items:center;gap:6px;min-height:36px;padding:3px 9px 3px 4px;background:#fffdf7;border:1px solid var(--line);border-radius:8px;font:inherit;font-size:12px;color:var(--ink);white-space:nowrap}.roster-figure.is-active{background:#f8e7b4;border:2px solid #967023;padding:2px 8px 2px 3px;box-shadow:0 0 0 1px #96702340}.roster-figure.is-unseen{color:var(--muted);border-style:dashed}.roster-avatar{display:grid;place-items:center;width:25px;height:25px;border-radius:50%;background:#416250;color:#fff;font-weight:700;font-size:12px}.is-unseen .roster-avatar{background:#737970}.roster-name{max-width:150px;overflow:hidden;text-overflow:ellipsis}.roster-initiative{font-size:13px;min-width:18px;text-align:center}.roster-unseen{font-size:18px}.roster-empty{font-size:12px;color:var(--muted)}
.player-map-actions{position:absolute;top:calc(54px + env(safe-area-inset-top));left:8px;z-index:5;display:flex;gap:8px;pointer-events:none}.map-icon-group{display:flex;gap:2px;padding:3px;background:#fffdf3ed;border:1px solid var(--line);border-radius:10px;box-shadow:0 2px 10px #172f2520;pointer-events:auto}.map-icon-group .map-icon{display:grid;place-items:center;min-width:40px;min-height:40px;padding:8px;border-radius:7px;border-color:transparent;background:transparent}.map-icon-group .map-icon.primary{background:var(--forest,#294c3b);color:#fff}.map-icon svg{width:21px;height:21px}.map-icon:focus-visible,.roster-figure:focus-visible{outline:3px solid #ab7e28;outline-offset:2px}
.wall-line.transparent{stroke:#199abb;stroke-dasharray:7 5}.wall-line.door{stroke:#a469c0;stroke-width:7px}.wall-line.door.is-open{stroke:#509967;stroke-dasharray:4 7}.wall-line.selected{stroke:#e8a127}.map-canvas svg[data-tool="doors"] #map-tokens{pointer-events:none}
/* Contextual controls for the game master. */
.is-gm .map-director{display:flex;align-items:center;gap:14px;flex-wrap:wrap;overflow:visible;padding:10px 12px;flex-shrink:0}
.director-scene{min-width:180px;flex:1}.director-scene label,.map-control{display:flex;flex-direction:column;gap:3px;font-size:11px;font-weight:650;color:var(--muted)}.director-scene select{max-width:100%;width:100%;font-size:14px}.director-actions{display:flex;align-items:center;gap:6px}.is-gm .map-audience{flex:1;min-width:170px;font-size:12px}.is-gm .map-audience strong{display:block;color:var(--ink)}
.gm-map-tabs{display:flex;gap:4px;border-bottom:1px solid var(--line);flex-shrink:0;padding-bottom:5px}.gm-map-tabs .btn{min-height:42px;border-radius:8px;font-size:13px}.is-gm .map-toolbar,.is-gm .map-editbar{margin:0;min-height:60px;padding:5px 0;align-items:center;flex-wrap:wrap;overflow:visible;flex-shrink:0;gap:8px}.is-gm .map-toolbar select,.is-gm .map-editbar select{max-width:245px;min-width:155px;font-size:13px}.is-gm .map-toolbar .map-mode-label{margin-left:auto;font-size:12px;color:var(--muted)}.is-gm .map-editbar p{margin:0;font-size:12px;color:var(--muted)}.map-history{display:flex;gap:3px;margin-left:auto}.wall-selection-label{font-size:12px;font-weight:650;color:#88621f}.map-editbar label input{width:auto}.map-control select{color:var(--ink);font-weight:400}.map-menu{position:relative;flex-shrink:0}.map-menu>summary{list-style:none;cursor:pointer;min-height:44px;padding:11px 12px;border:1px solid var(--line);border-radius:8px;font-size:12px;background:#fffdf7;white-space:nowrap}.map-menu>summary::-webkit-details-marker{display:none}.map-menu>div{position:absolute;top:calc(100% + 5px);right:0;z-index:15;min-width:220px;max-width:calc(100vw - 32px);display:grid;gap:6px;padding:10px;border:1px solid var(--line);border-radius:10px;background:#fffdf7;box-shadow:0 8px 24px #172f2529}.map-menu>div>label{display:flex;align-items:center;gap:8px;font-size:12px;white-space:normal;padding:8px 0}.map-menu input{width:auto}.map-menu .btn{text-align:left;width:100%}
.is-gm.is-editing .map-layout{display:flex}.is-gm.is-editing .map-stage{flex:1}.is-gm.is-editing .map-side{display:none}.map-camera{position:absolute;right:8px;bottom:8px;display:flex;gap:3px;padding:4px;background:#fffdf2eb;border:1px solid var(--line);border-radius:10px;z-index:3}.map-camera .btn{min-height:38px;min-width:38px;font-size:11px;padding:6px 9px}.is-gm .map-zoom{bottom:auto;top:8px}.wall-junction{pointer-events:none}
@media(max-width:760px){.is-gm .map-director{gap:5px;padding:5px}.director-scene{min-width:130px;flex-basis:46%}.is-gm .director-scene label{display:none}.is-gm .map-audience{min-width:120px;flex-basis:45%;font-size:11px}.director-actions{width:100%;justify-content:flex-end}.gm-map-tabs{gap:2px}.gm-map-tabs .btn{flex:1;padding:7px 6px;font-size:11px;white-space:nowrap}.is-gm .map-editbar,.is-gm .map-toolbar{gap:5px;min-height:54px}.is-gm .map-control{font-size:10px;flex:1;min-width:120px}.is-gm .map-control select{width:100%;min-width:0;max-width:none;font-size:12px}.is-gm .map-editbar .btn{min-height:40px;font-size:11px;padding:6px 8px}.wall-selection-label{display:none}.map-history{margin-left:0}.map-menu>summary{font-size:11px;min-height:40px;padding:9px}.map-camera{right:4px;bottom:4px;gap:2px;padding:2px}.map-camera .btn{font-size:10px;min-height:36px;min-width:34px;padding:5px 7px}.is-gm .map-toolbar .map-mode-label{font-size:10px}.is-gm .map-page{min-height:0}}

@media(max-width:760px){.map-page.is-gm:not(.is-expanded){height:calc(100dvh - 140px - env(safe-area-inset-bottom));min-height:0}}
.map-canvas svg:focus:not(:focus-visible){outline:none}

/* GM controls float over the same full-size canvas as the player controls. */
.map-full .map-page.is-gm{height:100%;min-height:0}.map-full .is-gm .map-layout{display:block}.map-full .is-gm .map-side{display:none;position:absolute;right:8px;top:calc(108px + env(safe-area-inset-top));bottom:8px;width:min(340px,calc(100% - 16px));z-index:8;overflow:auto;background:var(--paper);border:1px solid var(--line);border-radius:12px;box-shadow:0 8px 32px #172f2530}.map-full .is-gm.details-open .map-side{display:block}.gm-panel-heading{position:sticky;top:0;display:flex;align-items:center;justify-content:space-between;gap:8px;padding:8px 12px;background:var(--paper);z-index:1}.map-full .map-details{height:auto}.map-full .map-details-body{padding:0 8px 8px;grid-template-columns:1fr}
.gm-map-actions{max-width:calc(100% - 16px);flex-wrap:wrap;position:absolute;top:calc(108px + env(safe-area-inset-top));left:8px;display:flex;align-items:center;gap:8px;z-index:7}.gm-tool-menu>summary{padding:8px;min-width:40px;min-height:40px;display:grid;place-items:center;border:0;background:transparent;border-radius:7px}.gm-tool-menu>summary svg{width:21px;height:21px}.gm-tool-menu>summary.active{background:var(--green);color:white}.gm-tool-menu>div{left:0;right:auto}.gm-override{font-size:11px;padding:5px;background:#fff0c8;border:1px solid #b6985c;border-radius:6px}.turn-advance{background:#fffdf3f2;min-height:44px}
.gm-scene-menu{position:absolute;right:8px;top:calc(54px + env(safe-area-inset-top));z-index:9}.gm-scene-menu>summary{width:150px;padding:5px 10px;min-height:48px;display:flex;flex-direction:column;justify-content:center}.gm-scene-menu>summary>span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:650}.gm-scene-menu>summary small{font-size:10px}.gm-scene-menu>.map-director{width:310px;max-width:calc(100vw - 32px);display:flex;flex-direction:column;align-items:stretch;gap:10px;padding:12px;max-height:calc(100dvh - 190px);overflow:auto}.gm-scene-menu .director-scene,.gm-scene-menu .map-audience{min-width:0;flex:auto}.gm-scene-menu .director-scene label{display:block}.gm-scene-menu .director-actions{display:grid;gap:5px}.gm-scene-menu .map-director select{max-width:100%;width:100%}
.map-full .is-gm .map-editbar{position:absolute;left:8px;bottom:8px;z-index:8;max-width:calc(100% - 16px);max-height:40%;overflow:auto;width:max-content;min-height:0;padding:8px;background:#fffdf3f5;border:1px solid var(--line);border-radius:10px;box-shadow:0 3px 14px #172f2520}.map-full .map-editbar .map-menu>div{position:static;margin-top:6px;min-width:0;box-shadow:none}.map-full .map-editbar .map-control{margin:0}.map-full .map-editbar .wall-selection-label{display:none}.map-full .map-editbar p{display:none}
.map-full .is-gm>.empty{margin:165px 16px 16px}
@media(max-width:800px){.gm-scene-menu>summary{width:125px;font-size:11px}.map-full .is-gm .map-editbar{width:calc(100% - 16px);gap:5px}.map-full .is-gm .map-editbar .map-control{flex:1;min-width:100px}.map-full .is-gm .map-editbar select{min-width:0;font-size:12px}.map-full .is-gm .map-editbar .btn{font-size:11px;padding:6px 8px}.gm-map-actions{gap:5px}}

@media(max-width:800px){.gm-scene-menu>summary{width:clamp(65px,calc(100vw - 260px),125px)}}

/* Combat information is independent of selection and turn outlines. */
.figure-hp{font-size:11px;white-space:nowrap}.condition-badge{display:inline-flex;align-items:center;gap:3px;padding:3px 6px;background:#eee5cb;border-radius:6px;font-size:12px}.player-roster .condition-badge span{display:none}.injury-label{font-size:11px}.injury-label.wounded{color:#816000}.injury-label.critical{color:#a62624}.pawn-status .pawn-hp-bg{fill:#172e28;stroke:#fff;stroke-width:.5}.pawn-status .pawn-hp-fill{fill:#66aa77}.pawn-status text{font-size:11px;fill:#fff;stroke:#182b24;stroke-width:3px;paint-order:stroke;stroke-linejoin:round}.pawn-status .pawn-health.wounded{fill:#ffe055;font-size:18px}.pawn-status .pawn-health.critical{fill:#ff655d;font-size:18px}.figure-portrait{display:block;width:140px;height:140px;object-fit:contain;margin:0 auto 12px}.figure-resources{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:10px}.figure-resources strong{display:block;font-size:24px}.figure-popup>section,.figure-popup>details{margin:16px 0}.figure-markers{display:flex;flex-wrap:wrap;gap:6px;margin-bottom:8px}.figure-popup .resource-stepper{justify-content:flex-start}.condition-editor-row{border-bottom:1px solid var(--line);padding:12px 0}.condition-editor-row>label{display:block;margin-top:8px}.condition-editor-row input[type=checkbox]{width:auto}.figure-popup{overflow-wrap:anywhere}.figure-popup table{min-width:0;font-size:12px}.figure-popup .actions{flex-wrap:wrap}@media(max-width:600px){#modal:has(.figure-popup){width:calc(100vw - 16px);max-height:calc(100dvh - 16px)}.figure-popup .figure-resources{grid-template-columns:1fr 1fr}.figure-resources .resource{padding:10px}.figure-resources .resource-stepper{flex-wrap:wrap}.figure-popup table{font-size:11px}}

.combat-facts{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin:12px 0}.combat-facts>div{background:#f0f3e9;border-radius:8px;padding:10px;overflow-wrap:normal}.combat-facts small,.combat-facts strong{display:block}.combat-facts strong{font-size:14px;margin-top:5px;font-weight:600}.figure-popup .resource-stepper{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:4px;margin-top:8px}.figure-popup .resource-stepper .btn:last-child{grid-column:1/-1;white-space:nowrap}.figure-popup .resource-stepper .btn{padding:6px;min-width:0}

.gm-vision-status{background:#f5e7c8;color:#684b16;border-color:#b6985c;font-size:12px}.gm-vision-status::before{content:"◉";font-size:14px}
.gm-tool-menu[data-map-menu="settingsMenu"]>div{max-height:calc(100dvh - 220px - env(safe-area-inset-top));overflow-y:auto;overscroll-behavior:contain}
@media(max-width:800px){.gm-tool-menu[data-map-menu="settingsMenu"]>div{max-height:calc(100dvh - 234px - env(safe-area-inset-top) - env(safe-area-inset-bottom))}}

.map-canvas .pawn-ghost,.map-canvas .pawn-ghost *{pointer-events:none!important}

/* Figure placement tools live with the figure, including on narrow screens. */
.figure-popup.is-gm .form-tabs{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:4px;overflow:visible}
.figure-popup.is-gm .form-tabs button{min-width:0;min-height:44px;padding:8px 4px;font-size:.78rem;white-space:normal;line-height:1.3}
.figure-map-tools>section+section{margin-top:20px;padding-top:16px;border-top:1px solid var(--line)}
.figure-map-tools h3{margin:0 0 10px}.figure-map-tools p{font-size:.9rem;line-height:1.5}.figure-map-tools .actions{gap:8px}.figure-map-tools .btn{min-height:44px}.figure-map-tools .notice{margin-top:0}.figure-map-tools .figure-remove p{color:var(--muted)}
@media(max-width:600px){.figure-popup.is-gm .form-tabs{grid-template-columns:repeat(2,minmax(0,1fr))}.figure-popup.is-gm .form-tabs button{font-size:.82rem}}

.wall-body{fill:#654a40;fill-opacity:.55;stroke:#654a40;stroke-width:1px;vector-effect:non-scaling-stroke}
.wall-body.transparent{fill:#199abb;stroke:#199abb;fill-opacity:.2}
.wall-body.door{fill:#a469c0;stroke:#a469c0}
.wall-body.door.is-open{fill:none;stroke:#509967;stroke-dasharray:4 7}
.wall-body.selected{fill:#e8a127;stroke:#b47721}
#wall-width{width:90px;min-height:42px}
