/* BP workbench. Use the shared theme tokens; never fall back to a fixed dark panel. */
.m4Main { width:100%; max-width:1480px; min-width:0; margin:0 auto; padding:24px; }
.m4Main h1 { font-size:clamp(28px,4vw,46px); line-height:1.25; letter-spacing:-.03em; }
.m4Main h2 { font-size:22px; line-height:1.4; }
.m4Main :is(h2,h3,p,small,strong) { overflow-wrap:anywhere; }
.m4Main .muted,.m4Main small { color:var(--muted); }
.m4Main .topbar { flex-wrap:wrap; padding:12px 0; }
.m4Main .topbarActions { min-width:0; display:flex; align-items:center; flex-wrap:wrap; gap:10px; }
.m4Main details.championNameControl { margin:0; padding:0; }
.m4Main :is(select,input,button) { max-width:100%; font:inherit; color:var(--text); }
.m4Main :is(select,input:not([type=file]),button):not([data-theme-toggle]):not([data-champion-name-style]):not([data-home-language-select]) { border:1px solid var(--line); border-radius:9px; background:var(--surface); padding:10px 13px; }
.m4Main button { cursor:pointer; }
.m4Main button:hover:not(:disabled) { border-color:var(--accent); }
.m4Main :is(button,select):disabled { opacity:.5; cursor:default; }
.m4Main :is(button,select,input):focus-visible { outline:2px solid var(--accent); outline-offset:3px; }
.m4Main [hidden] { display:none!important; }
.m4Main section,.m4Box { min-width:0; margin:20px 0; }
.m4Main .m4Panel { padding:22px; border:1px solid var(--line); border-radius:16px; background:var(--surface); }
.m4Controls,.m4Actions { display:flex; flex-wrap:wrap; gap:12px; align-items:end; }
.m4Controls { display:grid; grid-template-columns:repeat(2,minmax(180px,2fr)) repeat(4,minmax(100px,1fr)); }
.m4Controls label { min-width:0; display:flex; flex-direction:column; gap:6px; color:var(--muted); font-size:12px; }
.m4Controls select { width:100%; min-width:0; font-size:14px; }
.m4Main :is(#rosters,#tendencies,#roleTeams) { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:22px; }
.m4Players { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:8px; }
.m4Players label { min-width:0; display:flex; flex-direction:column; align-items:center; gap:6px; }
.m4Players img { width:100%; max-width:80px; height:68px; object-fit:contain; }
.m4Players select { width:100%; min-width:0; font-size:12px; padding:6px!important; }
.m4Players span { font-size:12px; }
.m4Workbench { display:grid; grid-template-columns:minmax(0,1.15fr) minmax(0,1fr); gap:18px 24px; align-items:start; margin-top:24px; }
.m4Workbench > .broadcastStage { grid-column:1; grid-row:1; margin:0; }
.m4Workbench > #next { grid-column:2; grid-row:1 / span 3; margin:0; }
.m4Workbench > .m4Timeline { grid-column:1; grid-row:2; }
.m4Workbench > .m4Actions { grid-column:1; grid-row:3; }
.m4Workbench > :is(#roleConfirmation,#winner) { grid-column:1 / -1; margin:0; scroll-margin-top:24px; }
.broadcastStage { padding:20px; border:1px solid var(--line); border-radius:20px; background:linear-gradient(140deg,var(--notice-bg),var(--surface) 45%); }
.stageMasthead { display:flex; justify-content:space-between; gap:8px 14px; flex-wrap:wrap; font-size:10px; letter-spacing:.1em; color:var(--muted); }
.stageMasthead strong { color:var(--amber); }
.m4Score { text-align:center; padding:24px 0 18px; }
.m4Score #score { display:grid; grid-template-columns:minmax(0,1fr) auto minmax(0,1fr); gap:14px; align-items:center; }
.scoreTeam { font-size:14px; font-weight:600; line-height:1.5; }
.scoreNumbers { font-size:32px; line-height:1; white-space:nowrap; font-variant-numeric:tabular-nums; }
.m4Score #game { display:block; margin-top:12px; font-size:12px; color:var(--muted); }
.m4Main #board { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:20px; margin:18px 0 0; }
.m4Main #board .m4Side { min-width:0; margin:0; }
#board .mapBlue { order:0; --side-color:#5293d5; }
#board .mapRed { order:1; --side-color:#cc697b; }
.teamIdentity { display:flex; gap:10px; align-items:center; min-height:76px; padding-bottom:12px; }
.teamIdentity h3 { min-width:0; margin:0; font-size:14px; line-height:1.5; }
.teamIdentity h3 small { display:block; margin-top:4px; font-size:11px; font-weight:400; }
.teamMonogram,.teamLogo { width:40px; height:40px; flex:none; object-fit:contain; }
.teamMonogram { display:grid; place-items:center; border:1px solid var(--line); border-radius:50%; background:var(--raised); font-size:12px; font-weight:800; }
.m4Picks { display:grid; grid-template-columns:minmax(0,1fr); gap:9px; }
.m4Picks > div { display:grid; grid-template-columns:54px minmax(0,1fr); grid-template-rows:auto auto; gap:0 10px; min-width:0; min-height:76px; padding:0 10px 0 0; border:1px solid var(--line); border-left:3px solid var(--side-color); border-radius:10px; background:var(--surface); overflow:hidden; }
.m4Picks img { grid-row:1 / 3; width:54px; height:100%; min-height:76px; object-fit:cover; }
.m4Picks span { align-self:end; padding-top:8px; font-size:14px; font-weight:600; }
.m4Picks small { align-self:start; padding:3px 0 8px; font-size:11px; line-height:1.55; }
.m4Picks .empty { grid-template-rows:1fr; align-items:center; color:var(--muted); font-size:22px; }
.m4Picks .empty span { align-self:center; padding:0; font-size:18px; text-align:center; opacity:.5; }
.m4Bans { display:flex; flex-wrap:wrap; gap:6px; min-height:32px; margin-top:12px; }
.m4Bans img { width:30px; height:30px; object-fit:cover; filter:grayscale(.6); border:1px solid var(--side-color); border-radius:5px; }
.m4Main details:not(.championNameControl) { min-width:0; margin:16px 0; padding:14px 16px; border:1px solid var(--line); border-radius:10px; background:var(--surface); }
.m4Main summary { cursor:pointer; overflow-wrap:anywhere; font-size:13px; }
.m4Main .logoSettings { margin-bottom:12px!important; }
.logoSettings p { font-size:12px; }
.logoControls { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; margin-top:12px; }
.logoField { display:flex; flex-wrap:wrap; align-items:center; gap:8px; font-size:12px; }
.logoField > span { flex-basis:100%; color:var(--muted); }
.logoUpload { display:inline-flex; align-items:center; padding:6px 10px; border:1px solid var(--line); border-radius:7px; cursor:pointer; background:var(--raised); }
.logoField button { padding:6px 10px!important; font-size:12px; }
.logoUpload:focus-within { outline:2px solid var(--accent); outline-offset:3px; }
.m4Locked { display:flex; flex-wrap:wrap; gap:6px; padding-top:10px; color:var(--muted); font-size:12px; }
.m4Locked img { width:28px; height:28px; filter:grayscale(.6); border:1px solid var(--line); border-radius:5px; }
.m4Timeline { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:6px; }
.m4Main .m4Step { min-width:0; min-height:74px; display:flex; flex-direction:column; align-items:center; gap:4px; padding:7px 2px!important; text-align:center; }
.m4Step small,.m4Step span { font-size:11px; line-height:1.4; }
.m4Step img { width:28px; height:28px; }
.m4Main .m4Step.current { border-color:var(--accent)!important; background:var(--hover)!important; }
.m4Timeline button:disabled { opacity:1; }
.m4Actions button { flex:1 1 40%; min-width:0; font-size:12px; }
.m4NextHeader { display:flex; flex-wrap:wrap; justify-content:space-between; gap:12px; align-items:center; }
.m4NextHeader > div { min-width:0; }
.m4NextHeader h2 { margin:0 0 8px; font-size:20px; }
.m4NextHeader input { width:100%; min-width:0; }
.m4CandidateList { display:grid; grid-template-columns:minmax(0,1fr); gap:9px; max-height:680px; overflow:auto; margin-top:16px; padding:3px; scrollbar-gutter:stable; }
.m4Main .m4Candidate { min-width:0; display:grid; grid-template-columns:20px 44px minmax(0,1fr) 72px; gap:10px; align-items:center; padding:12px; text-align:left; background:var(--raised)!important; }
.m4Candidate > div { min-width:0; }
.m4Candidate img { width:44px; height:44px; object-fit:cover; border-radius:7px; }
.m4Candidate strong { display:block; font-size:14px; }
.m4Candidate small { display:block; font-size:11px; line-height:1.6; margin-top:5px; }
.m4Rank { font-size:11px; color:var(--muted); }
.m4Probability { text-align:right; }
.m4Probability b { font-size:16px; white-space:nowrap; font-variant-numeric:tabular-nums; }
.m4Probability i { display:block; height:4px; max-width:100%; margin:6px 0 0 auto; background:var(--accent); border-radius:3px; }
.m4Note { min-width:0; border-left:3px solid var(--amber); padding:8px 14px; font-size:12px; line-height:1.8; color:var(--muted); }
.editionGate { max-width:900px; margin:30px auto!important; padding:32px!important; }
.editionGate p { line-height:1.8; }
.editionChoices { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:18px; margin-top:24px; }
.editionChoices button { min-width:0; min-height:110px; padding:22px!important; text-align:left; border-color:var(--amber)!important; }
.editionChoices strong,.editionChoices span { display:block; }
.editionChoices strong { font-size:20px; margin-bottom:12px; }
.editionChoices span { color:var(--muted); font-size:13px; }
#roleTeams > section { margin:0; }
.roleSlot { display:grid; grid-template-columns:50px 40px minmax(0,1fr) 100px; gap:10px; align-items:center; padding:10px; border:1px solid var(--line); border-radius:10px; margin:8px 0; background:var(--raised); }
.roleSlot[draggable=true] { cursor:grab; }
.roleSlot img { width:40px; height:40px; border-radius:7px; }
.roleSlot select { min-width:0; width:100%; font-size:12px; padding:7px!important; }
.roleNumber { font-size:12px; color:var(--muted); }
.roleSlot strong { min-width:0; font-size:14px; }
#roleConfirmation > button { margin:8px 8px 0 0; }
#roleStatus { color:var(--muted); }
.m4Main #winner { padding:24px; text-align:center; border:1px solid var(--accent); border-radius:15px; background:var(--surface); }
#winnerButtons { display:flex; justify-content:center; flex-wrap:wrap; gap:12px; }
#winnerButtons button { min-width:0; max-width:100%; }
.m4Main #finish { text-align:center; font-size:20px; background:var(--hover); padding:18px; border-radius:10px; }
.m4History { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:9px; padding-top:12px; font-size:12px; }
.m4Main #metrics { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:18px; }
#metrics strong { font-size:25px; }
#tendencies ul { padding-left:20px; line-height:1.9; font-size:13px; }
#pastDialog { background:var(--surface); color:var(--text); border:1px solid var(--line); border-radius:16px; width:min(90vw,650px); max-height:85vh; overflow:auto; padding:24px; }
#pastDialog::backdrop { background:#0009; }
#closePast { float:right; padding:8px 15px; border:1px solid var(--line); border-radius:8px; color:var(--text); background:var(--raised); cursor:pointer; }
.m4PastRow { display:grid; grid-template-columns:30px 38px minmax(0,1fr) 80px; gap:10px; align-items:center; padding:8px 0; border-bottom:1px solid var(--line); font-size:13px; }
.m4PastRow img { width:35px; height:35px; }
.m4PastRow span { overflow-wrap:anywhere; }
@media(max-width:1150px) {
 .m4Controls { grid-template-columns:repeat(3,minmax(0,1fr)); }
 .m4Workbench { grid-template-columns:minmax(0,1fr); }
 .m4Workbench > :is(.broadcastStage,#next,.m4Timeline,.m4Actions,#roleConfirmation,#winner) { grid-column:1; grid-row:auto; }
 .m4CandidateList { grid-template-columns:repeat(2,minmax(0,1fr)); max-height:580px; }
 .m4Picks > div { grid-template-columns:64px minmax(0,1fr); }
 .m4Picks img { width:64px; }
}
@media(max-width:720px) {
 .m4Main { padding:14px; }
 .m4Main .m4Panel { padding:16px; }
 .m4Main .topbar { gap:12px; }
 .m4Controls { grid-template-columns:repeat(2,minmax(0,1fr)); }
 .m4Main :is(#rosters,#tendencies,#roleTeams,#metrics) { grid-template-columns:minmax(0,1fr); }
 .broadcastStage { padding:14px; }
 .m4Main #board { gap:12px; }
 .m4CandidateList { grid-template-columns:minmax(0,1fr); max-height:560px; }
 .m4Timeline { grid-template-columns:repeat(5,minmax(0,1fr)); }
 .teamIdentity { gap:6px; min-height:86px; }
 .teamIdentity h3 { font-size:12px; }
 .teamMonogram,.teamLogo { width:30px; height:30px; }
 .m4Picks > div { grid-template-columns:40px minmax(0,1fr); column-gap:6px; padding-right:5px; }
 .m4Picks img { width:40px; }
 .m4Picks span { font-size:12px; }
 .m4Picks small { font-size:10px; }
 .m4Bans { gap:4px; }
 .m4Bans img { width:24px; height:24px; }
 .m4Score #score { gap:8px; }
 .scoreTeam { font-size:12px; }
 .scoreNumbers { font-size:27px; }
 .stageMasthead { font-size:9px; }
 .editionChoices,.logoControls,.m4History { grid-template-columns:minmax(0,1fr); }
 .editionGate { padding:20px!important; }
 .roleSlot { grid-template-columns:40px 32px minmax(0,1fr) 88px; gap:7px; padding:8px; }
 .roleSlot img { width:32px; height:32px; }
 .roleSlot strong { font-size:12px; }
 .m4Main .m4Candidate { grid-template-columns:16px 36px minmax(0,1fr) 64px; gap:8px; padding:10px; }
 .m4Candidate img { width:36px; height:36px; }
 .m4Probability b { font-size:14px; }
}

.logoUpload{position:relative}.logoUpload input[type=file]{position:absolute;inset:0;width:100%;height:100%;opacity:0;cursor:pointer}.m4Workbench:has(#next[hidden]){grid-template-columns:minmax(0,1fr)}
