/* Combat layout uses panel/card widths, independently of the PC split ratio. */
.magica-map-tabs{display:flex;align-items:center;gap:6px;flex:none;min-height:34px;box-sizing:border-box;padding:4px 10px;margin-bottom:8px;border-radius:10px;background:var(--panel2)}
.magica-map-tabs[hidden],.magica-battle[hidden],.magica-map-status[hidden]{display:none!important}
.magica-map-tabs>[data-tab]{height:26px;min-height:26px;padding:0 10px;font-size:11px;line-height:1;display:inline-flex;align-items:center;justify-content:center;border-radius:8px}
.magica-combat-open>.stage{display:none!important}
#sessionScreen.mobile-compact:not(.scene-collapsed) #sceneChatColumn:not(.map-fold)>.stagewrap.magica-map-wrap{display:block}
.magica-map-wrap>.stage{flex:none}
.magica-battle{container:magica-board / inline-size;box-sizing:border-box;min-width:0;padding:12px;border:1px solid var(--line);border-radius:14px;background:var(--panel);color:var(--text)}
.magica-battle-head{display:flex;align-items:center;justify-content:space-between;gap:8px;flex-wrap:wrap;font-size:12px;min-height:28px}
.magica-battle-head label{display:flex;align-items:center;gap:5px;font-size:11px}.magica-battle-head input{width:64px;height:27px;padding:3px 7px;box-sizing:border-box}
.magica-battle-steps{display:flex;flex-wrap:wrap;gap:5px;margin:10px 0 12px}.magica-battle-steps .btn{height:27px;min-height:27px;padding:0 8px;font-size:10px;line-height:1}
.magica-battle-arena{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;align-items:stretch}
.magica-battle-side{display:grid;grid-row:span 3;grid-template-rows:subgrid;min-width:0;gap:8px}
.magica-battle select,.magica-battle textarea{width:100%;min-width:0;box-sizing:border-box}.magica-battle-side>select{height:40px;margin:0;padding:6px 10px;font-size:13px}
.magica-combat-card{container:magica-card / inline-size;min-width:0;padding:10px;border:1px solid var(--line);border-radius:11px;background:var(--panel);box-sizing:border-box}
.magica-combat-top{display:grid;grid-template-columns:minmax(0,1fr);gap:10px;align-items:start}
.magica-combat-name{display:flex;align-items:center;gap:10px;min-width:0;margin:0}.magica-combat-name>div{min-width:0}.magica-combat-name strong{display:block;font-size:18px;line-height:1.3;overflow-wrap:anywhere}.magica-combat-name .small{font-size:10px;line-height:1.4;margin-top:3px;overflow-wrap:anywhere}
.magica-combat-avatar{display:grid;place-items:center;flex:0 0 56px;width:56px;height:64px;background:var(--panel2);font-size:12px;overflow:hidden}.magica-combat-avatar img{width:100%;height:100%;object-fit:cover}
.magica-combat-meters{display:grid;gap:7px;min-width:0}.magica-power{min-width:0;margin:0}
.magica-power-head{display:flex;align-items:baseline;gap:4px;height:22px;min-width:0;white-space:nowrap;font-size:11px;line-height:22px;font-variant-numeric:tabular-nums}
.magica-power-head>span{height:22px;line-height:22px}
.magica-power-head>span:first-child{flex:0 0 62px}
.magica-power-head .magica-power-controls{align-self:center}
.magica-power-head>input{width:35px;min-width:0;height:22px;box-sizing:border-box;padding:0 2px;border:0;border-radius:4px;background:transparent;font:inherit;line-height:22px;text-align:center;appearance:textfield}.magica-power-head>input::-webkit-inner-spin-button{appearance:none}.magica-power-head>input:focus{outline:1px solid var(--accent)}
.magica-power-controls{display:flex;gap:4px;margin-left:auto}.magica-power-controls .btn{display:inline-flex;align-items:center;justify-content:center;width:25px;height:20px;min-height:20px;padding:0;font-size:12px;line-height:1}
.magica-power progress{display:block;width:100%;height:8px;margin:3px 0 0;border:0;border-radius:8px;overflow:hidden;appearance:none}.magica-power progress::-webkit-progress-bar{background:var(--panel2)}.magica-power progress::-webkit-progress-value{background:var(--accent)}.magica-power progress::-moz-progress-bar{background:var(--accent)}.magica-power progress.temporary{opacity:.65}
.magica-combat-meta{display:flex;align-items:center;justify-content:space-between;gap:6px;min-height:22px;margin:5px 0 2px}.magica-combat-stats{margin:0;font-size:11px;line-height:1.4}.magica-combat-meta>.btn{height:22px;min-height:22px;padding:0 6px;font-size:10px;white-space:nowrap;line-height:1}
.magica-combat-books{margin:0;font-size:11px}.magica-combat-books summary{cursor:pointer;line-height:20px}.magica-book-list{display:grid;gap:5px;max-height:180px;margin-top:3px;overflow:auto;scrollbar-gutter:stable}
.magica-book-name{display:flex;align-items:flex-start;gap:7px;min-width:0;padding:7px 8px;border:1px solid var(--line);border-radius:7px;font-size:11px;line-height:1.4;overflow-wrap:anywhere}.magica-book-name>span:first-child{color:var(--accent);flex:none}
.magica-origins{min-width:0;padding:10px;border:1px solid var(--line);border-radius:11px;font-size:12px}.magica-origins>strong{display:block;font-size:12px;line-height:18px}.magica-origins>input{width:100%;height:30px;box-sizing:border-box;margin:6px 0 8px;padding:5px 8px;font-size:12px}.magica-origins>.btn{height:30px;min-height:30px;padding:0 10px;font-size:11px}.magica-origin{display:flex;align-items:center;justify-content:space-between;gap:6px;min-height:28px;overflow-wrap:anywhere}.magica-origin .btn{padding:3px 6px;font-size:10px}
.magica-combat-memo{margin-top:12px;font-size:12px}.magica-combat-memo textarea{margin-top:6px}.magica-support-list{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;max-height:430px;overflow:auto}.magica-support-list select{height:32px;margin-bottom:8px;padding:4px 8px;font-size:12px}.magica-map-status{padding:4px 10px}
@container magica-card (min-width:400px){.magica-combat-top{grid-template-columns:minmax(0,36fr) minmax(0,64fr);gap:14px;min-height:72px}.magica-combat-avatar{flex-basis:72px;width:72px;height:72px}.magica-book-list{width:60%}}
@container magica-board (max-width:520px){.magica-battle-arena,.magica-support-list{grid-template-columns:minmax(0,1fr)}.magica-support-list{max-height:400px}}

/* Representatives occupy the left two columns; participants stack on the right. */
.magica-battle-layout{display:grid;grid-template-columns:minmax(0,2fr) minmax(0,1fr);gap:14px;align-items:start}
.magica-battle-layout>.magica-battle-arena{min-width:0}
.magica-battle-participants{min-width:0}
.magica-battle-participants>.magica-section{font-size:14px;line-height:20px;margin:0 0 10px}
.magica-battle-participants>.magica-support-list{grid-template-columns:minmax(0,1fr);max-height:none;overflow:visible}
@container magica-board (max-width:759px){.magica-battle-layout{grid-template-columns:minmax(0,1fr)}.magica-battle-participants{margin-top:4px}}

/* Preserve the 133 board; only compact the participant card's upper row. */
.magica-support-list .magica-combat-top{grid-template-columns:64px minmax(0,1fr);gap:10px;align-items:start;min-height:0}
.magica-support-list .magica-combat-name{display:flex;flex-direction:column;align-items:flex-start;gap:5px}
.magica-support-list .magica-combat-avatar{flex:none;width:56px;height:64px}
.magica-support-list .magica-combat-name strong{font-size:14px}
.magica-support-list .magica-combat-meters{min-width:0;width:100%;max-width:280px;gap:7px}
.magica-support-list .magica-power-head{display:grid;grid-template-columns:35px minmax(0,1fr) auto;gap:0 4px;height:auto;white-space:normal}
.magica-support-list .magica-power-head>span:first-child{grid-column:1 / -1;height:auto;line-height:16px}
.magica-support-list .magica-power-head>input{grid-column:1;width:35px}
.magica-support-list .magica-power-controls{grid-column:3;margin-left:0}
.magica-support-list .magica-max-power{min-width:0}
.magica-support-list .magica-book-list{width:auto}

.magica-battle-layout-scroll{min-width:0;max-width:100%}
@media(min-width:1000px){
 html.pc-layout .magica-battle-layout-scroll{overflow-x:auto}
 html.pc-layout .magica-battle-layout{min-width:700px;grid-template-columns:minmax(0,2fr) minmax(0,1fr)}
 html.pc-layout .magica-battle-layout>.magica-battle-arena{grid-template-columns:repeat(2,minmax(0,1fr))}
 html.pc-layout .magica-battle-participants{margin-top:0}
}

/* Two compact meter lines fit beside the participant portrait. */
.magica-support-list .magica-combat-top{grid-template-columns:48px minmax(0,1fr);gap:6px}
.magica-support-list .magica-combat-avatar{width:48px;height:64px}
.magica-support-list .magica-combat-meters{gap:6px}
.magica-support-list .magica-power-head{display:flex;align-items:center;gap:1px;height:20px;white-space:nowrap;font-size:10px;line-height:20px}
.magica-support-list .magica-power-head>span:first-child{flex:0 0 auto;height:20px;line-height:20px}
.magica-support-list .magica-power-head>input{flex:0 0 24px;width:24px;height:20px;padding:0;font-size:10px;line-height:20px}
.magica-support-list .magica-power-head>.magica-max-power{flex:0 0 auto;height:20px;line-height:20px}
.magica-support-list .magica-power-controls{display:flex;flex:0 0 auto;gap:2px;margin-left:auto}
.magica-support-list .magica-power-controls .btn{width:17px;min-width:17px;height:20px;min-height:20px;padding:0;font-size:11px}
.magica-support-list .magica-power progress{height:6px;margin-top:2px}

.magica-scene-board{display:grid;grid-template-columns:minmax(180px,40fr) minmax(0,60fr);gap:10px;width:100%;height:100%;min-height:0;box-sizing:border-box}
.magica-combat-open>.magica-scene-board{display:none!important}
.magica-scene-sidebar{display:flex;flex-direction:column;gap:8px;min-width:0;min-height:0;overflow:auto;overscroll-behavior:contain}
.magica-scene-settings{flex:none;padding:8px;border:1px solid var(--line);border-radius:10px;background:var(--panel);font-size:12px}
.magica-scene-settings summary{cursor:pointer}.magica-scene-settings label{display:flex;align-items:center;gap:6px;padding:4px;overflow-wrap:anywhere}
.magica-scene-list{display:grid;gap:10px;align-content:start}
.magica-scene-card{padding:10px;background:var(--panel);border:1px solid var(--line);border-radius:12px;min-width:0}
.magica-scene-card-head{display:flex;align-items:start;gap:8px}.magica-scene-info{flex:1;min-width:0;overflow-wrap:anywhere}.magica-scene-info strong{font-size:14px}.magica-scene-info .small{font-size:11px}
.magica-scene-avatar{display:grid;place-items:center;flex:0 0 42px;height:56px;overflow:hidden;background:var(--panel2);font-size:12px}.magica-scene-avatar img{width:100%;height:100%;object-fit:cover}
.magica-scene-card-head>.btn{padding:3px 5px;font-size:10px;min-height:24px;flex:none}
.magica-scene-books{display:grid;gap:4px;margin-top:8px;font-size:11px}.magica-scene-books .magica-book-name{padding:4px 6px}
#sessionScreen .magica-scene-board>.stage{width:100%;height:100%;min-height:0;max-height:100%;aspect-ratio:auto;margin:0;box-sizing:border-box}
#sessionScreen .stagewrap.magica-scene-wrap:not(.magica-combat-open){overflow:hidden}
@media(max-width:600px){.magica-scene-board{grid-template-columns:minmax(150px,45fr) minmax(0,55fr);gap:6px}.magica-scene-card{padding:6px}.magica-scene-card-head{flex-wrap:wrap}.magica-scene-card-head>.btn{margin-left:auto}}

.magica-scene-settings[hidden]{display:none!important}.magica-scene-visibility-actions{display:flex;gap:6px;margin:8px 0}.magica-scene-visibility-actions .btn{font-size:11px;padding:5px 8px}

.magica-scene-profile{white-space:nowrap;overflow-x:auto;max-width:100%;scrollbar-width:thin}
