/* Shared game layout; simulation and saved state stay in the game modules. */
#cliff-tool,#marble-tool,#horse-tool{--game-sidebar:300px;--game-gap:18px;padding-bottom:0;min-width:0}
#cliff-tool{--game-sidebar:340px;--cliff-ink:var(--cw-text);--cliff-muted:var(--cw-muted);--cliff-line:var(--cw-line);--cliff-card:var(--cw-surface);--cliff-mint:var(--cw-selected)}
#cliff-tool .cliff-heading,#marble-tool .marble-heading,#horse-tool .horse-heading{position:static;clip-path:none;overflow:visible;width:auto;height:auto;display:flex;align-items:center;justify-content:space-between;gap:16px;margin:0 0 18px}
#cliff-tool .cliff-heading h1,#marble-tool .marble-heading h1,#horse-tool .horse-heading h1{font-size:26px;line-height:1.3;letter-spacing:-.8px;margin:0 0 5px;color:var(--cw-text)}
#cliff-tool .cliff-heading p:last-child,#marble-tool .marble-heading p,#horse-tool .horse-heading p{font-size:12px;line-height:1.6;color:var(--cw-muted);margin:0}
#cliff-tool .cliff-heading h1 span,.cliff-heading .cliff-eyebrow,.cliff-heading-badge,.cliff-roster-heading .cliff-eyebrow{display:none}
.game-heading-actions{display:flex;gap:8px;align-items:center;flex:none}
.game-heading-actions .guide-button{white-space:nowrap}
#cliff-tool .cliff-layout,#marble-tool .marble-layout,#horse-tool .horse-layout{display:grid;grid-template-columns:var(--game-sidebar) minmax(0,1fr);gap:var(--game-gap);align-items:start}
#cliff-tool .cliff-roster-panel{grid-column:1;grid-row:1}
#cliff-tool .cliff-arena-card{grid-column:2;grid-row:1;padding:0}
html[data-theme] :is(.cliff-arena-card,.cliff-roster-panel,.marble-card,.horse-card){border:1px solid var(--cw-line);border-radius:12px;background:var(--cw-surface);box-shadow:0 3px 14px #172b3a04}
#cliff-tool .cliff-roster-panel,#marble-tool .marble-settings,#horse-tool .horse-settings{padding:18px;min-width:0}
#cliff-tool .cliff-roster-heading,#marble-tool .marble-section-title,#horse-tool .horse-section-title{min-height:0;margin-bottom:14px;gap:8px}
#cliff-tool .cliff-roster-heading{flex-wrap:wrap}
#cliff-tool .cliff-roster-heading h2,#marble-tool .marble-section-title h2,#horse-tool .horse-section-title h2{font-size:16px;letter-spacing:-.4px;margin:0;color:var(--cw-text)}
#cliff-tool .cliff-count-controls{grid-template-columns:42px 34px 34px;background:var(--cw-page);margin:0}
#cliff-tool .cliff-count-controls input{height:34px;min-height:34px;font-size:13px;padding:4px}
#cliff-tool .cliff-count-controls button{width:34px;height:34px;min-height:34px;font-size:19px;color:var(--cw-primary)}
#cliff-tool .cliff-roster{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px 10px;max-height:480px;overflow:auto;padding:1px 2px 2px 0;scrollbar-width:thin}
#cliff-tool .cliff-fighter-card{grid-template-columns:28px minmax(0,1fr) 15px;gap:4px;padding:3px 0;min-height:38px;border:0;background:transparent}
#cliff-tool .cliff-avatar{width:28px;height:30px;border-radius:6px;background:transparent;object-fit:contain}
html[data-theme] #cliff-tool .cliff-fighter-card input[type=text]{height:34px;min-height:34px;padding:5px 6px;font-size:12px;background:var(--cw-surface);border-color:var(--cw-line);border-radius:7px}
#cliff-tool .cliff-fighter-card input[type=checkbox]{width:15px;height:15px;accent-color:var(--cw-primary)}
#cliff-tool .cliff-fighter-card.is-champion{background:var(--cw-selected);outline:1px solid var(--cw-primary)}
#cliff-tool .cliff-fair-note{background:var(--cw-selected);text-align:left;padding:10px 12px;border-radius:7px;margin:15px 0 0;line-height:1.6;font-size:12px}
#marble-tool .race-count-row,#horse-tool .race-count-row{margin-bottom:14px}
#marble-tool .race-count-stepper,#horse-tool .race-count-stepper{grid-template-columns:32px 45px 32px;padding:0;border-radius:7px;background:var(--cw-surface)}
#marble-tool .race-count-stepper button,#horse-tool .race-count-stepper button{height:34px;width:32px;min-height:34px;font-size:20px;box-shadow:none}
#marble-tool .race-count-stepper output,#horse-tool .race-count-stepper output{font-size:12px}
#marble-tool .marble-roster,#horse-tool .horse-roster{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;max-height:360px;padding:1px 2px 2px 0}
#marble-tool .marble-person,#horse-tool .horse-person{gap:4px}
#marble-tool .marble-person>span,#horse-tool .horse-person>span{width:20px;height:20px;font-size:10px;box-shadow:none}
html[data-theme] #marble-tool .marble-person input,html[data-theme] #horse-tool .horse-person input{height:34px;min-height:34px;padding:5px 6px;font-size:12px;border-color:var(--cw-line);background:var(--cw-surface);border-radius:7px}
#marble-tool .marble-person button,#horse-tool .horse-person button{width:18px;min-width:18px;height:32px;padding:0;font-size:16px}
#marble-tool #marble-fields>label,#horse-tool #horse-fields>label{font-size:12px;font-weight:500;color:var(--cw-muted);margin:16px 0 6px}
#marble-tool .marble-equal,#horse-tool .horse-equal{margin-top:14px;padding:10px 12px;border-radius:7px}
#marble-tool .marble-equal>span,#horse-tool .horse-equal>span{display:none}
#marble-tool .marble-equal p,#horse-tool .horse-equal p{font-size:12px;line-height:1.65}
#marble-tool .marble-hint,#horse-tool .horse-hint{font-size:12px;line-height:1.6}
#cliff-tool .cliff-arena-card>.cliff-scorebar,#marble-tool .marble-race-card>.marble-scorebar,#horse-tool .horse-race-card>.horse-scorebar{position:static;inset:auto;min-height:44px;padding:11px 16px;flex:none;display:flex;align-items:center;justify-content:space-between;gap:10px;z-index:auto;background:var(--cw-surface);color:var(--cw-text);font-size:12px;border-bottom:1px solid var(--cw-line);box-sizing:border-box;pointer-events:auto}
#cliff-tool .cliff-scorebar>div:first-child{position:static;clip-path:none;width:auto;height:auto;overflow:visible;display:flex;align-items:center;gap:8px;font-size:12px}
#cliff-tool .cliff-score{display:flex;align-items:center;gap:12px;color:var(--cw-muted)}
#cliff-tool .cliff-score>span,#cliff-tool .cliff-score time{display:inline-flex;min-height:0;padding:0;border:0;border-radius:0;background:none;box-shadow:none;backdrop-filter:none;color:var(--cw-muted);gap:4px;font-size:12px}
#cliff-tool .cliff-score strong{font-size:12px;margin-left:3px;color:var(--cw-text)!important}
#cliff-tool .cliff-score small{font-size:12px;color:var(--cw-muted)}
#cliff-tool .cliff-score time{font-size:13px;font-weight:650}
#cliff-tool .cliff-score>span::before,#cliff-tool .cliff-score time::before{display:none}
#marble-tool #marble-time,#horse-tool #horse-time{font-size:13px;color:var(--cw-text)}
#marble-tool #marble-selection,#horse-tool #horse-selection{padding:3px 6px;background:var(--cw-page);border:0;color:var(--cw-muted);font-size:10px;border-radius:5px}
body[data-tool=cliff]:not(.cliff-only) #cliff-stage,body[data-tool=marble]:not(.marble-only) #marble-stage,body[data-tool=horse]:not(.horse-only) #horse-stage{height:clamp(360px,51vh,500px);min-height:0;flex:none;border-radius:0}
#cliff-tool .cliff-arena-footer,#marble-tool .marble-race-footer,#horse-tool .horse-race-footer{display:flex;flex-direction:row;align-items:center;justify-content:space-between;gap:12px;padding:14px 16px;min-height:70px;border-top:1px solid var(--cw-line);background:var(--cw-surface);flex:none;box-sizing:border-box}
#cliff-tool #cliff-announcement,#marble-tool #marble-announcement,#horse-tool #horse-announcement{margin:0;min-width:0;text-align:left;line-height:1.6;font-size:12px;color:var(--cw-muted);overflow-wrap:anywhere}
#cliff-tool .cliff-actions,#marble-tool .marble-actions,#horse-tool .horse-actions{display:flex;gap:8px;width:auto;flex:none;margin-left:auto;justify-content:flex-end}
#cliff-tool .cliff-actions button,#marble-tool .marble-actions button,#horse-tool .horse-actions button{min-height:42px;min-width:110px;padding:9px 18px;font-size:14px;border-radius:8px;white-space:nowrap;box-shadow:none}
html[data-theme] #cliff-tool .cliff-actions #cliff-start{min-width:130px;background:var(--cw-primary);border-color:var(--cw-primary);color:var(--cw-surface);box-shadow:none}
html[data-theme] #cliff-tool .cliff-actions #cliff-pause{background:var(--cw-primary);border-color:var(--cw-primary);color:var(--cw-surface)}
#cliff-tool .cliff-actions #cliff-reset{min-width:0;padding:9px 10px;font-size:12px;background:var(--cw-surface);color:var(--cw-muted)}
#marble-tool .marble-ranking,#horse-tool .horse-ranking{display:flex;align-items:center;gap:12px;padding:11px 16px;border-top:1px solid var(--cw-line);min-height:49px}
#marble-tool .marble-ranking>.marble-section-title,#horse-tool .horse-ranking>.horse-section-title{margin:0;flex:none;max-width:90px}
#marble-tool .marble-ranking h2,#horse-tool .horse-ranking h2{font-size:12px;line-height:1.4;color:var(--cw-muted);font-weight:500}
#marble-ranking-note,#horse-ranking-note{display:none}
#marble-ranking-list,#horse-ranking-list{display:flex;gap:6px;flex:1;min-width:0;max-height:none;overflow-x:auto;overflow-y:hidden;padding:0 0 2px;scrollbar-width:thin}
#marble-ranking-list li,#horse-ranking-list li{flex:0 0 auto;max-width:175px;min-width:0;padding:5px 7px;border-radius:5px;font-size:11px;gap:5px;background:var(--cw-page)}
#marble-ranking-list b,#horse-ranking-list b{font-size:11px;min-width:auto}
#marble-ranking-list small,#horse-ranking-list small{font-size:9px}
#marble-ranking-empty,#horse-ranking-empty{margin:0;font-size:12px}
#cliff-tool .cliff-history,#marble-tool .marble-history,#horse-tool .horse-history{margin:16px 0 0 calc(var(--game-sidebar) + var(--game-gap));padding:16px 18px;border-radius:12px;min-width:0}
#cliff-tool .cliff-history h2{position:static;width:auto;height:auto;clip-path:none;overflow:visible;font-size:15px;margin:0 0 10px}
#cliff-tool .cliff-history-filters{margin:0 0 10px;background:var(--cw-page)}
#cliff-tool .cliff-history-filters button{padding:6px 12px;font-size:12px;min-height:32px}
#marble-tool .marble-history summary,#horse-tool .horse-history summary{font-size:12px;padding:11px 0;gap:10px}
#marble-tool .marble-history summary time,#horse-tool .horse-history summary time{font-size:12px}
#cliff-tool .cliff-name{font-size:10px;padding:3px 6px;max-width:120px;border-radius:5px;box-shadow:0 2px 4px #203c3b15}
#cliff-tool .cliff-name::after{display:none}
#horse-tool .cat-behavior{display:none!important}
#horse-tool .cat-label-lines{opacity:.45}
#marble-minimap{top:14px;right:12px;width:40px;height:184px;opacity:.7;box-shadow:none;border-radius:3px}
#marble-tool .marble-camera-note,#horse-tool .horse-camera-note{left:14px;bottom:12px;transform:none;border-radius:8px;font-size:10px}
.game-mobile-settings{display:none}
.game-help-dialog{max-width:480px;width:calc(100vw - 36px);box-sizing:border-box;padding:24px;background:var(--cw-surface);color:var(--cw-text);border:1px solid var(--cw-line);border-radius:12px}
.game-help-dialog h2{font-size:20px;margin:0 0 16px}.game-help-dialog ol{padding-left:22px;line-height:1.9;font-size:14px}.game-help-dialog p{font-size:13px;line-height:1.7;color:var(--cw-muted)}.game-help-dialog::backdrop{background:#172b3a66}.game-help-dialog button{min-height:40px;padding:8px 20px;border-radius:8px}
@media(min-width:1600px){#cliff-tool{--game-sidebar:360px}#marble-tool,#horse-tool{--game-sidebar:320px}}
@media(max-width:1100px){#cliff-tool{--game-sidebar:310px;--game-gap:14px}#marble-tool,#horse-tool{--game-sidebar:260px;--game-gap:14px}#cliff-tool .cliff-roster-panel,#marble-tool .marble-settings,#horse-tool .horse-settings{padding:14px}#cliff-tool .cliff-fighter-card{grid-template-columns:24px minmax(0,1fr) 14px;gap:3px}#cliff-tool .cliff-avatar{width:24px;height:28px}#marble-tool .marble-person>span,#horse-tool .horse-person>span{width:18px;height:18px}}
@media(max-width:800px){
 #cliff-tool .cliff-layout,#marble-tool .marble-layout,#horse-tool .horse-layout{display:flex;flex-direction:column;gap:14px}
 #cliff-tool .cliff-arena-card,#marble-tool .marble-race-card,#horse-tool .horse-race-card{order:0;width:100%}
 #cliff-tool .cliff-roster-panel,#marble-tool .marble-settings,#horse-tool .horse-settings{order:1;width:100%;box-sizing:border-box}
 .game-mobile-settings{display:inline-flex;align-items:center;justify-content:center;min-height:40px;padding:8px 11px;border:1px solid var(--cw-line);background:var(--cw-surface);color:var(--cw-text);border-radius:8px;font-size:12px;white-space:nowrap}
 .game-layout-ready:not([data-settings-open=true])>.cliff-layout>.cliff-roster-panel,.game-layout-ready:not([data-settings-open=true])>.marble-layout>.marble-settings,.game-layout-ready:not([data-settings-open=true])>.horse-layout>.horse-settings{display:none}
 #cliff-tool .cliff-heading,#marble-tool .marble-heading,#horse-tool .horse-heading{gap:10px;flex-wrap:wrap;margin-bottom:14px}
 #cliff-tool .cliff-heading h1,#marble-tool .marble-heading h1,#horse-tool .horse-heading h1{font-size:23px}
 #cliff-tool .cliff-heading p:last-child,#marble-tool .marble-heading p,#horse-tool .horse-heading p{font-size:12px}
 .game-heading-actions{gap:6px;margin-left:auto}
 #cliff-tool .cliff-history,#marble-tool .marble-history,#horse-tool .horse-history{margin-left:0;padding:14px}
 #cliff-tool .cliff-roster,#marble-tool .marble-roster,#horse-tool .horse-roster{max-height:360px;grid-template-columns:repeat(2,minmax(0,1fr));gap:9px 12px}
 #cliff-tool .cliff-fighter-card{grid-template-columns:28px minmax(0,1fr) 18px;gap:4px}
 #cliff-tool .cliff-avatar{width:28px;height:30px}
 html[data-theme] #cliff-tool .cliff-fighter-card input[type=text],html[data-theme] #marble-tool .marble-person input,html[data-theme] #horse-tool .horse-person input{height:40px;min-height:40px;font-size:16px;padding:6px}
 #cliff-tool .cliff-fighter-card input[type=checkbox]{width:18px;height:18px}
 #cliff-tool .cliff-count-controls{grid-template-columns:48px 42px 42px}
 #cliff-tool .cliff-count-controls input,#cliff-tool .cliff-count-controls button{height:42px;min-height:42px}#cliff-tool .cliff-count-controls button{width:42px}
 #marble-tool .race-count-stepper,#horse-tool .race-count-stepper{grid-template-columns:42px 52px 42px}#marble-tool .race-count-stepper button,#horse-tool .race-count-stepper button{width:42px;height:42px;min-height:42px}
 #marble-tool .marble-person button,#horse-tool .horse-person button{width:24px;min-width:24px;height:40px}
 body[data-tool=cliff]:not(.cliff-only) #cliff-stage{height:380px}body[data-tool=marble]:not(.marble-only) #marble-stage{height:390px}body[data-tool=horse]:not(.horse-only) #horse-stage{height:340px}body[data-tool=horse]:not(.horse-only) #horse-stage[data-large-roster=true]{height:450px}
 #cliff-tool .cliff-arena-footer,#marble-tool .marble-race-footer,#horse-tool .horse-race-footer{padding:11px 12px;min-height:62px;gap:8px;flex-wrap:wrap}
 #cliff-tool #cliff-announcement,#marble-tool #marble-announcement,#horse-tool #horse-announcement{font-size:12px;flex:1 1 110px}
 #cliff-tool .cliff-actions button,#marble-tool .marble-actions button,#horse-tool .horse-actions button{min-height:42px;min-width:100px;padding:9px 12px;font-size:13px}
 #marble-tool .marble-ranking,#horse-tool .horse-ranking{padding:9px 12px;gap:8px}
 #cliff-tool .cliff-name{font-size:9px;padding:2px 4px;max-width:90px}
}
@media(max-width:430px){#cliff-tool .cliff-arena-card>.cliff-scorebar,#marble-tool .marble-race-card>.marble-scorebar,#horse-tool .horse-race-card>.horse-scorebar{padding:10px;font-size:10px;gap:6px;min-height:41px}#cliff-tool .cliff-score{gap:8px}#cliff-tool .cliff-score>span{font-size:10px}#cliff-tool .cliff-scorebar>div:first-child{font-size:10px;gap:5px}#marble-tool .marble-scorebar>div,#horse-tool .horse-scorebar>div{gap:5px}#marble-minimap{width:30px;height:138px;right:8px;top:10px}body[data-tool=cliff]:not(.cliff-only) #cliff-stage{height:330px}}
body.cliff-only #cliff-tool .cliff-arena-card,body.marble-only #marble-tool .marble-race-card,body.horse-only #horse-tool .horse-race-card{display:flex;flex-direction:column;padding:0;border:0;border-radius:0}
body.cliff-only #cliff-stage,body.marble-only #marble-stage,body.horse-only #horse-stage{flex:1;min-height:0;height:auto;border-radius:0}
body.cliff-only #cliff-tool .cliff-arena-footer,body.marble-only #marble-tool .marble-race-footer,body.horse-only #horse-tool .horse-race-footer{min-height:50px;padding:7px 12px;flex-wrap:nowrap}
body.cliff-only .game-mobile-settings,body.marble-only .game-mobile-settings,body.horse-only .game-mobile-settings{display:none!important}
body.cliff-only #cliff-tool .cliff-actions button,body.marble-only #marble-tool .marble-actions button,body.horse-only #horse-tool .horse-actions button{min-height:34px;padding:6px 14px;font-size:13px}
body.cliff-only #cliff-tool .cliff-heading,body.marble-only #marble-tool .marble-heading,body.horse-only #horse-tool .horse-heading{display:none!important}
body.marble-only #marble-tool .marble-ranking,body.horse-only #horse-tool .horse-ranking{display:none!important}
@media(max-height:350px){body.cliff-only #cliff-tool .cliff-arena-card>.cliff-scorebar,body.marble-only #marble-tool .marble-race-card>.marble-scorebar,body.horse-only #horse-tool .horse-race-card>.horse-scorebar{min-height:30px;padding:6px 10px}body.cliff-only #cliff-tool .cliff-arena-footer,body.marble-only #marble-tool .marble-race-footer,body.horse-only #horse-tool .horse-race-footer{min-height:42px;padding:4px 10px}}
