/* Authoritative game layout. No fixed HUD or decision panel overlaps the scene. */
html:has(body.court-layout){height:100%;overflow:hidden}
body.court-layout{--dock:clamp(310px,27vw,380px);--ui-edge:16px;width:100%;height:100dvh;min-height:0;overflow:hidden;display:grid;grid-template-rows:auto minmax(0,1fr);font-size:14px}
body.court-layout .app-header{position:relative;inset:auto;height:auto;min-height:58px;padding:max(6px,env(safe-area-inset-top)) max(var(--ui-edge),env(safe-area-inset-right)) 6px max(var(--ui-edge),env(safe-area-inset-left));gap:16px;flex-wrap:nowrap;background:#0c1927;border-bottom:1px solid var(--line);z-index:2;box-shadow:none}
body.court-layout .brand{gap:9px;min-width:0}.court-layout .parent-logo{width:38px;height:38px}.court-layout .brand strong{font-size:17px;letter-spacing:.025em}.court-layout .product-name{font-size:7px;letter-spacing:.16em;margin-top:4px}.court-layout .header-context{font-size:11px}.court-layout nav button{min-height:44px}
body.court-layout #workspace{position:relative;inset:auto;height:100%;min-height:0;display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr) auto auto;overflow:hidden}
body.court-layout.court-session #workspace{grid-template-columns:minmax(0,1fr) var(--dock)}
body.court-layout #court-stage{position:relative;grid-column:1;grid-row:1;min-width:0;min-height:0;overflow:hidden;background:#172635}
body.court-layout #court-stage > #canvas{position:absolute;inset:0;display:block;grid-area:auto;width:100%;height:100%;min-width:0;min-height:0;touch-action:none}
body.court-layout #loading{z-index:5}
body.court-layout #scene-toolbar{grid-column:1;grid-row:2;display:flex;align-items:center;gap:6px;min-width:0;min-height:48px;padding:4px max(10px,env(safe-area-inset-left)) 4px max(10px,env(safe-area-inset-right));background:#0e2031;border-block:1px solid var(--line)}
body.court-layout #scene-toolbar button{position:static;inset:auto;display:inline-flex;align-items:center;justify-content:center;min-height:40px;padding:7px 12px;border-radius:7px;font-size:12px;background:#20364b;border:1px solid #b8c9db30;color:var(--text);box-shadow:none;white-space:nowrap}
body.court-layout #courtroom-focus[aria-pressed=true]{background:var(--gold);color:var(--ink)}
body.court-layout .scene-label{position:static;display:flex;min-width:0;margin-left:auto;padding:0;border:0;background:none;max-width:none;font-size:8px;letter-spacing:.06em;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
body.court-layout :is(#mobile-camera-tools,#mobile-hint){display:none!important}
body.court-layout #workspace>footer{position:relative;inset:auto;grid-column:1;grid-row:3;height:auto;max-height:none;min-height:0;margin:0;padding:8px max(14px,env(safe-area-inset-right)) max(8px,env(safe-area-inset-bottom)) max(14px,env(safe-area-inset-left));background:#0c1927;box-shadow:none;overflow:hidden;border-top:0}
body.court-layout .transcript{min-height:0}body.court-layout .status-row{gap:10px;align-items:center}
body.court-layout #phase{font-size:9px;letter-spacing:.06em;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
body.court-layout footer #pause{min-height:44px;padding:7px 14px;font-size:12px;flex-shrink:0}
body.court-layout #caption{font-size:14px;line-height:1.45;margin:3px 0 0;min-height:0;max-height:3em;overflow:auto;overscroll-behavior:contain;scrollbar-width:thin}
body.court-layout footer .workspace-actions{margin-top:6px;flex-wrap:wrap}
body.court-layout.court-session footer :is(.workspace-actions,.keyboard-hint){display:none!important}
body.court-layout #workspace>:is(#learning,#practice,#court-day){position:relative;inset:auto;grid-column:2;grid-row:1/4;width:auto;height:100%;min-width:0;min-height:0;max-height:none;overflow:auto;overscroll-behavior:contain;scrollbar-gutter:stable;padding:20px;background:linear-gradient(155deg,#182c40,#102132);border:0;border-left:1px solid var(--line);border-radius:0;box-shadow:none;scroll-padding:16px}
body.court-layout :is(#learning,#practice,#court-day) h1{font:400 25px/1.16 var(--serif);letter-spacing:-.015em;margin:8px 0 12px}
body.court-layout :is(#learning,#practice,#court-day) p{max-width:none}
body.court-layout :is(.learn-kicker,.practice-kicker){font-size:10px;letter-spacing:.07em;line-height:1.5;margin:0 0 6px;color:var(--gold)}
body.court-layout .learn-intro{font-size:14px;line-height:1.55;margin:10px 0;color:#cbd7e2}
body.court-layout :is(.learn-actions,.practice-choices){display:grid;grid-template-columns:1fr;position:static!important;order:initial!important;gap:8px!important;margin:14px 0!important;padding:0!important;background:none!important;box-shadow:none!important}
body.court-layout :is(.learn-actions,.practice-choices) button{min-height:48px!important;padding:12px 13px!important;line-height:1.45;font-size:14px;border-radius:8px;white-space:normal;overflow-wrap:anywhere}
body.court-layout .practice-choices button.objection-action{background:var(--gold);border-color:var(--gold);color:var(--ink);font:600 20px/1.2 var(--serif);white-space:nowrap;overflow-wrap:normal;padding-inline:8px!important}
body.court-layout .practice-steps{margin:10px 0 14px}
body.court-layout .practice-content{display:block!important}
body.court-layout .practice-content blockquote{font:17px/1.45 var(--serif);margin:12px 0;padding-left:12px}
body.court-layout .practice-prompt{font-size:13px;margin:12px 0 8px}
body.court-layout .practice-timer{font-size:12px;margin:5px 0 8px}
body.court-layout .practice-context{font-size:14px;line-height:1.6;margin:10px 0}
/* Live objections come first: do not make a player scroll past testimony to object. */
body.court-layout[data-practice-state=question] #practice .practice-content,
body.court-layout[data-practice-state=grounds] #practice .practice-content{display:flex!important;flex-direction:column}
body.court-layout[data-practice-state=question] #practice .practice-choices,
body.court-layout[data-practice-state=grounds] #practice .practice-choices{order:-1!important;margin-top:4px!important}
body.court-layout[data-practice-state=question] .practice-steps,
body.court-layout[data-practice-state=grounds] .practice-steps{display:none}
body.court-layout[data-practice-state=question] #practice .practice-choices{grid-template-columns:minmax(0,1fr) minmax(0,1fr)}
body.court-layout[data-practice-state=question] #practice .practice-choices button{min-width:0;overflow-wrap:normal}
body.court-layout[data-practice-state=question] #practice .practice-choices .key{display:none}
body.court-layout.court-session #learning :is(details,.learn-scope,.role-note,.learn-bottom){display:none}
body.court-layout #practice :is(.case-file-button,.witness-context,.practice-phase,.practice-notice){display:none}
body.court-layout[data-practice-state=brief] #practice :is(.practice-context,.jurisdiction-scope,.practice-detail){display:none}
body.court-layout #practice .practice-detail{font-size:13px;line-height:1.6;margin-top:14px;padding-top:14px}
body.court-layout #learning[data-screen=case_complete] :is(details,.learn-bottom,.learn-scope){display:block}
body.court-layout #learning[data-screen=case_complete] .learn-bottom{display:flex}
body.court-layout.court-menu #workspace{display:block;overflow:hidden}
body.court-layout.court-menu #workspace>:is(#court-stage,#scene-toolbar,footer){display:none}
body.court-layout.court-menu #workspace>#learning{position:relative;inset:auto;height:100%;overflow:auto;padding:clamp(22px,4vw,50px);border:0;background:#101d2c}
body.court-layout.court-menu #learning h1{font-size:clamp(28px,3.5vw,43px)}
body.court-layout.court-menu #learning .learn-intro{max-width:900px;font-size:16px}
body.court-layout.courtroom-focus #workspace{grid-template-columns:minmax(0,1fr)}
body.court-layout.courtroom-focus #workspace>:is(#practice,#learning,#court-day){display:none}
body.court-layout .mobile-header-actions{display:none}
body.court-layout dialog{max-height:calc(100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom));overflow:auto;overscroll-behavior:contain;border-radius:14px}
body.court-layout dialog button{min-height:44px}
body.court-layout dialog select{min-height:48px;font-size:16px}
body.court-layout .dialog-close{min-width:44px;min-height:44px}
body.court-layout #hearing-notes{width:min(700px,calc(100% - 24px))}
body.court-layout #hearing-notes-content :is(p,li){font-size:14px;line-height:1.65;white-space:pre-line}
body.court-layout #hearing-notes-content .notes-case-title{font-size:18px;color:var(--text)}
body.court-layout #hearing-notes-content a{overflow-wrap:anywhere}
body.court-layout #audio-alert{top:calc(64px + env(safe-area-inset-top))}
@media(max-width:1150px){body.court-layout .header-context{display:none}body.court-layout{--dock:320px}body.court-layout .scene-label{display:none}}
@media(max-width:950px){
 body.court-layout .app-header{gap:8px;min-height:54px}
 body.court-layout .app-header nav{display:none}
 body.court-layout .mobile-header-actions{display:flex;gap:6px;margin-left:auto}
 body.court-layout .mobile-header-actions button{min-height:44px;padding:7px 11px;font-size:12px;border-radius:8px}
 body.court-layout #mobile-quality{color:var(--gold)}
 body.court-layout{--dock:clamp(280px,38vw,340px)}
 body.court-layout #workspace>:is(#learning,#practice,#court-day){padding:15px}
 body.court-layout #scene-toolbar button{min-height:44px;padding:7px 10px}
 body.court-layout .key{display:none}
}
/* Portrait tablets and phones: real scene, caption and response rows, never overlays. */
@media(max-width:740px) and (orientation:portrait),(max-width:950px) and (min-height:900px) and (orientation:portrait){
 body.court-layout.court-session #workspace{grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(140px,1fr) auto auto minmax(160px,38%)}
 body.court-layout.court-session #workspace>:is(#learning,#practice,#court-day){grid-column:1;grid-row:4;height:100%;border-left:0;border-top:1px solid #9eb2c044;padding:14px 16px max(14px,env(safe-area-inset-bottom));scrollbar-gutter:auto}
 body.court-layout.court-session #workspace>footer{padding:4px 12px 7px}
 body.court-layout #caption{font-size:13px;max-height:2.9em;margin:0}
 body.court-layout #phase{font-size:8px}
 body.court-layout #scene-toolbar{min-height:48px;padding:2px 8px;justify-content:space-between;gap:4px}
 body.court-layout #scene-toolbar button{font-size:12px;flex:1;padding:7px 5px}
 body.court-layout :is(#learning,#practice,#court-day) h1{font-size:22px;margin:5px 0 8px}
 body.court-layout .learn-intro{font-size:14px;line-height:1.5;margin:7px 0}
 body.court-layout .practice-steps{display:none}
 body.court-layout.court-entrance #workspace{grid-template-rows:minmax(140px,1fr) auto auto auto}
 body.court-layout.court-entrance #workspace>:is(#learning,#practice,#court-day){max-height:150px}
 body.court-layout.court-entrance :is(.learn-intro,.practice-context,.learn-kicker,.practice-kicker){display:none}
 body.court-layout.court-entrance :is(.learn-actions,.practice-choices){margin:8px 0 0!important}
 body.court-layout.courtroom-focus #workspace{grid-template-rows:minmax(0,1fr) auto auto;grid-template-columns:minmax(0,1fr)}
}
@media(max-height:540px){
 body.court-layout .app-header{min-height:48px;padding-top:max(2px,env(safe-area-inset-top));padding-bottom:2px}
 body.court-layout .parent-logo{width:30px;height:30px}
 body.court-layout .brand strong{font-size:15px}.court-layout .product-name{display:none}
 body.court-layout .header-context{display:none}
 body.court-layout #scene-toolbar{min-height:44px;padding-block:0;gap:4px}
 body.court-layout #scene-toolbar button{padding:5px 6px;font-size:11px;min-height:40px}
 body.court-layout #caption{font-size:12px;max-height:2.9em}
 body.court-layout #workspace>footer{padding:2px 10px max(4px,env(safe-area-inset-bottom))}
 body.court-layout .status-row{float:right;margin:0 0 0 8px}body.court-layout #phase{display:none}
 body.court-layout #workspace>:is(#learning,#practice,#court-day){padding:12px}
 body.court-layout :is(#learning,#practice,#court-day) h1{font-size:21px}
 body.court-layout dialog{padding:24px 18px}
}
@media(max-width:360px){body.court-layout .product-name{display:none}body.court-layout .brand strong{font-size:13px}body.court-layout .parent-logo{width:32px;height:32px}body.court-layout .mobile-header-actions button{padding-inline:8px}body.court-layout #scene-toolbar button{font-size:11px}}
@media(max-width:740px) and (orientation:landscape){body.court-layout[data-practice-state=question] #practice .practice-choices{grid-template-columns:1fr}body.court-layout #practice .practice-choices button{min-height:44px!important;padding-block:8px!important}}
@media(prefers-reduced-motion:reduce){body.court-layout *,body.court-layout *::before,body.court-layout *::after{animation:none!important;transition:none!important}}

/* Notes expand only after the player opens the practice notebook. */
body.court-layout.court-session #learning[data-notebook="true"] details{display:block}

body.court-layout.court-day-active #workspace>:is(#learning,#practice){display:none!important}
body.court-layout #court-day[hidden]{display:none!important}
#court-day .day-field{display:grid;gap:8px;margin:14px 0;font-size:14px}
#court-day :is(select,textarea){width:100%;box-sizing:border-box;min-height:48px;font:16px/1.5 system-ui;padding:12px;color:#edf2f7;background:#0b1a28;border:1px solid #8395a8;border-radius:8px}
#court-day .day-feedback{border-left:3px solid #d9ba82;padding:10px 12px;background:#203449;line-height:1.6}
#court-day button{min-height:48px;white-space:normal;line-height:1.4}
#court-day :is(details,p){line-height:1.6;white-space:pre-line}
#court-day details{margin-block:18px;font-size:13px}
#court-day summary{cursor:pointer;min-height:44px;align-content:center}
#court-day a{color:#e3c991;overflow-wrap:anywhere}

body.court-layout.court-day-active #workspace>footer{display:block!important}
body.court-layout.court-day-active #workspace>footer .transcript{display:block}

.edition-summary{border-bottom:1px solid #b8c9db26;margin:0 0 16px;padding-bottom:12px;font-size:13px;color:#b6c3cf}.edition-summary summary{color:#d9ba82;cursor:pointer}.edition-summary p{line-height:1.55}

/* Always reachable outside the courtroom; a normal link also works if rendering fails. */
body.court-layout .game-exit{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;min-height:44px;padding:7px 12px;margin-left:auto;border:1px solid #9aafc4;border-radius:7px;background:#f4f8ff;color:#174d82;font:700 13px/1.2 system-ui;text-decoration:none;white-space:nowrap}
body.court-layout .game-exit:focus-visible{outline:3px solid #bb6505;outline-offset:3px}
@media(max-width:950px){body.court-layout .mobile-header-actions{margin-left:0}body.court-layout .game-exit{padding:7px 9px;font-size:12px}}
@media(max-width:430px){body.court-layout .brand strong{font-size:13px}body.court-layout .parent-logo{width:29px;height:29px}body.court-layout .product-name{font-size:6px;letter-spacing:.04em}body.court-layout .app-header{gap:5px;padding-inline:8px}body.court-layout .brand{gap:5px}}
