/* Guided app shell. Court editing and export framing use separate surfaces. */
[hidden], dialog:not([open]) { display:none !important; }
body { height: 100dvh; overflow: hidden; font-family: -apple-system, BlinkMacSystemFont, 'Manrope', sans-serif; }
#librarySearchLabel { display:grid; gap:8px; margin:12px 0; font-size:14px; }
#librarySearch { min-height:44px; padding:10px 12px; border:1px solid var(--border2); border-radius:6px; background:var(--surface); color:var(--text); font:inherit; }
.text-action { min-height:44px; border:0; background:none; color:var(--accent); text-decoration:underline; font:inherit; padding:0 4px; }
.home-footer a { color:inherit; min-height:44px; display:inline-flex; align-items:center; }
:root { --bg:#111312; --surface:#191d18; --surface2:#22271f; --surface3:#2b3227; --border:#343c30; --border2:#505b49; --accent:#ff793a; --accent2:#ff793a; --text:#f1f0e9; --text2:#b0b8a9; --text3:#a0aa98; }
.header { background:var(--bg); }
.logo { background:none; -webkit-text-fill-color:currentColor; color:var(--text); letter-spacing:.03em; }
.section-title { font:600 13px -apple-system, BlinkMacSystemFont, 'Manrope', sans-serif; letter-spacing:0; text-transform:none; color:var(--text2); }
.input-field, select.sel, .tbtn { font-family:inherit; }
.input-field, select.sel { min-height:44px; font-size:16px; color:var(--text); background:var(--surface); border-color:var(--border2); padding:10px 12px; }
.tbtn { min-height:44px; padding:10px 12px; font-size:14px; font-weight:500; color:var(--text); background:var(--surface); }
.tbtn.active { color:var(--text); border-color:var(--accent); background:#382c1f; }
.export-btn, .export-all-btn { min-height:48px; background:var(--accent); color:#171b16; font:600 15px -apple-system, BlinkMacSystemFont, 'Manrope', sans-serif; letter-spacing:0; text-transform:none; box-shadow:none; border-radius:6px; }
.export-all-btn { background:var(--surface2); color:var(--text); border:1px solid var(--border2); }
button { cursor:pointer; }
button:disabled { cursor:default; opacity:.5; }
.danger-action { color:#ffb9a3 !important; }
.hint { font-size:12px; color:var(--text2); line-height:1.5; }
.slider-field { align-items:center; gap:12px; }
.slider-field input[type=range] { min-height:44px; }
.slider-field label { color:var(--text2); font-size:13px; }
.color-chips { gap:8px; flex-wrap:wrap; }
.color-chips .chip { min-width:44px; min-height:44px; width:44px; height:44px; border-radius:50%; padding:0; }
.color-chips .chip.active { transform:none; outline:2px solid var(--accent); outline-offset:2px; }
input[type=color] { min-height:44px; }

.header { min-height: 60px; height: calc(60px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 16px 0; gap: 12px; }
.header-left { gap: 12px; }
.logo { font-size: 20px; white-space: nowrap; }
.logo-sub { display: none; }
.home-back { color:var(--text); background:transparent; border:1px solid var(--border2); border-radius: 10px; padding: 10px 14px; min-height: 44px; }
body[data-screen="home"] .home-back { display: none; }
body[data-screen="home"] .header { display: none; }
.home-screen { height: 100dvh; overflow: auto; padding: calc(44px + env(safe-area-inset-top)) max(24px, calc((100vw - 1080px)/2)) calc(24px + env(safe-area-inset-bottom)); background: #111312; color: #f1f0e9; font-family: -apple-system, BlinkMacSystemFont, 'Manrope', sans-serif; }
body:not([data-screen="home"]) .home-screen { display: none; }
body[data-screen="home"] #designerLayout, body[data-screen="home"] #animatorStudio, body[data-screen="home"] #publishingStudio { display: none !important; }
.home-workspace { display: grid; grid-template-columns: 1fr 1fr; gap: 72px; align-items: center; padding: 24px 0 56px; }
.home-brand-line { display: flex; align-items: center; gap: 12px; color: #b0b5af; font-size: 10px; font-weight: 600; letter-spacing: .18em; }
.court-mark { width: 36px; height: 36px; stroke: #ff793a; stroke-width: 1.5; }
.home-wordmark { display: flex; align-items: baseline; gap: 10px; margin: 22px 0 24px; font: 600 clamp(46px, 5.3vw, 68px)/1.1 'Oswald', 'Arial Narrow', Impact, sans-serif; letter-spacing: -.045em; }
.home-wordmark > span { color: #ff793a; font-size: .38em; letter-spacing: -.025em; }
.home-brand-rule { height: 2px; background: #343933; position: relative; }
.home-brand-rule::before { content: ''; display: block; height: 2px; width: 40px; background: #ff793a; }
.home-caption { margin-top: 20px; color: #b0b5af; font-size: 14px; line-height: 1.5; }
.home-actions { display: grid; }
.home-action { width: 100%; min-height: 84px; display: flex; align-items: center; gap: 18px; text-align: left; padding: 18px 8px; color: #f1f0e9; border: 0; border-bottom: 1px solid #343933; border-radius: 0; background: transparent; font: inherit; cursor: pointer; transition: background .15s; }
.home-action > svg { width: 23px; height: 23px; flex: none; stroke: #b0b5af; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.home-action strong { font-size: 19px; font-weight: 600; letter-spacing: -.025em; }
.menu-label { display: grid; gap: 5px; }
.menu-label > span { font-size: 12px; color: #a7aea6; }
.home-action .menu-arrow { margin-left: auto; font-size: 25px; font-weight: 300; color: #a7aea6; }
.home-action.primary { min-height: 76px; padding: 20px; margin-bottom: 10px; border-radius: 6px; background: #ff793a; color: #171b16; }
.home-action.primary > svg { stroke: currentColor; }
.home-action.primary strong { font-size: 21px; }
.home-action.primary .menu-arrow { color: currentColor; }
@media (hover:hover) { .home-action:hover { background: #20261f; } .home-action.primary:hover { background: #ff905b; } .play-row:hover { background: #222820; } }
.home-screen .tbtn { min-height: 44px; min-width: 44px; padding: 10px 12px; font: 500 12px -apple-system, BlinkMacSystemFont, 'Manrope', sans-serif; background: transparent; border: 1px solid #41483f; border-radius: 5px; color: #d5d9d1; }
.home-screen .hint { font-size: 12px; line-height: 1.5; color: #a7aea6; }
.recent-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.recent-heading h2 { font-size: 17px; font-weight: 600; letter-spacing: -.02em; }
.recent-heading h3 { font-size: 17px; font-weight: 600; overflow-wrap: anywhere; }
.library-heading { padding: 0 0 18px; min-height: 62px; border-bottom: 1px solid #41483f; }
#seriesCount { color: #929b90; margin-left: 8px; font-size: 12px; font-weight: 400; }
.resume-play span { margin-left: 7px; }
.series-list { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 0 32px; }
.series-card { min-width: 0; padding: 24px 0; border-bottom: 1px solid #343933; }
.series-card .hint { margin: 4px 0 12px; }
.series-card > .tbtn { margin-top: 14px; }
.play-row { width: 100%; padding: 14px 8px; display: flex; align-items: center; justify-content: space-between; gap: 16px; background: transparent; color: #e4e7df; border: 0; border-bottom: 1px solid #2e342c; font: 500 14px -apple-system, BlinkMacSystemFont, 'Manrope',sans-serif; text-align: left; min-height: 48px; cursor: pointer; }
.play-row .play-row-name { min-width: 0; overflow-wrap: anywhere; }
.play-row .play-row-meta { color: #a7aea6; font-size: 12px; white-space: nowrap; }
.empty-state { grid-column: 1/-1; display: flex; align-items: center; gap: 18px; padding: 28px 0; }
.empty-state-icon { width: 36px; height: 42px; flex: none; border: 1px solid #565f51; border-left: 3px solid #798670; border-radius: 3px; position: relative; }
.empty-state-icon::after { content: ''; position: absolute; left: 8px; right: 6px; top: 12px; height: 10px; border-top: 1px solid #798670; border-bottom: 1px solid #798670; }
.empty-state strong { display: block; font-size: 14px; font-weight: 500; margin-bottom: 5px; }
.empty-state p { font-size: 12px; line-height: 1.5; color: #a7aea6; }
.home-footer { display: flex; justify-content: space-between; gap: 16px; border-top: 1px solid #343933; padding-top: 20px; margin-top: 28px; color: #929b90; font-size: 9px; font-weight: 500; letter-spacing: .1em; }
@media(max-width:700px) {
  .home-screen { padding: calc(26px + env(safe-area-inset-top)) 24px calc(24px + env(safe-area-inset-bottom)); }
  .home-workspace { display: block; padding: 0 0 28px; }
  .home-wordmark { font-size: clamp(42px, 13.8vw, 70px); margin: 18px 0 20px; }
  .home-caption { margin: 14px 0 28px; font-size: 13px; }
  .home-action { min-height: 74px; padding: 14px 6px; }
  .home-action.primary { min-height: 70px; padding: 18px; }
  .series-list { grid-template-columns: 1fr; }
  .home-screen .resume-play { font-size: 11px; padding: 8px; }
  .home-footer { font-size: 8px; letter-spacing: .06em; }
}
/* Home prioritizes creation and the library. Secondary tools live in Menu. */
.home-screen { padding-top:calc(20px + env(safe-area-inset-top)); }
.home-topbar { display:flex; align-items:center; justify-content:space-between; gap:16px; }
.home-identity { display:flex; align-items:center; gap:10px; min-width:0; }
.home-topbar .court-mark { width:30px; height:30px; flex:none; }
.home-topbar .home-wordmark { font-size:30px; margin:0; gap:6px; letter-spacing:-.03em; }
.home-screen .home-menu-button { font-size:14px; flex:none; display:flex; align-items:center; gap:8px; }
.home-workspace { display:block; padding:16px 0 24px; }
.home-caption { margin:0 0 18px; font-size:14px; }
.home-actions { grid-template-columns:1fr 1fr; gap:12px; }
.home-action.primary { margin:0; min-height:60px; padding:16px; }
.home-screen .resume-play { font-size:15px; text-align:left; padding:14px 16px; }
.home-actions:has(.resume-play[hidden]) { grid-template-columns:1fr; }
.home-library .library-heading { min-height:44px; padding:0 0 10px; }
.library-storage-note { display:flex; align-items:center; gap:4px; margin:0 0 8px; }
.series-card { padding:0 0 12px; align-self:start; }
.series-summary { min-height:56px; padding:12px 0; cursor:pointer; font-size:16px; }
.series-summary::marker { color:var(--accent); }
.series-name { font-weight:600; overflow-wrap:anywhere; }
.series-play-count { color:var(--text2); font-size:12px; margin-left:12px; white-space:nowrap; }
.home-menu-items .home-action { min-height:72px; }
@media(max-width:700px) {
  .home-screen { padding:calc(18px + env(safe-area-inset-top)) 18px calc(20px + env(safe-area-inset-bottom)); }
  .home-topbar .home-wordmark { font-size:26px; }
  .home-topbar .court-mark { width:26px; height:26px; }
  .home-topbar { gap:10px; }
  .home-actions { grid-template-columns:1fr; gap:10px; }
  .home-screen .resume-play { font-size:14px; padding:14px 16px; }
  .home-workspace { padding:14px 0 22px; }
}
@media (prefers-reduced-motion: reduce) { .home-action { transition: none; } }
#mobileTabBar, .mobile-sheet-scrim, .mobile-studios-sheet { display: none !important; }
.layout { height: calc(100dvh - 60px - env(safe-area-inset-top)); width: 100%; }
.layout > .panel-left, .layout > .panel-right { display: none !important; }
.layout .center { width: 100%; height: 100%; min-height: 0; padding: 8px 16px calc(12px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; justify-content: flex-start; gap: 8px; overflow: hidden; }
.editor-heading { width: min(100%,900px); flex: none; display: grid; grid-template-columns: 1fr auto; gap: 3px 12px; text-align: left; }
#editorSeriesName { grid-column: 1; justify-self: start; color: var(--accent); background: none; border: 0; min-height: 44px; font-size: 14px; text-align: left; }
#editorPlayName { grid-column: 1; color: #fff; font-size: 22px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#saveStatus { grid-column: 2; grid-row: 1/3; align-self: center; font-size: 12px; color: var(--text2); }
.layout .canvas-frame { position: relative; width: min(100%,900px); aspect-ratio: 50 / 47; flex: 0 1 auto; min-height: 0; max-height: none; max-width: 100%; display: flex; align-items: center; justify-content: center; border: none; border-radius: 0; background: transparent; box-shadow: none; overflow: hidden; }
html body .layout canvas#mainCanvas { position:absolute; left:50%; top:50%; transform:translate(-50%,-50%); flex: none; max-width: 100%; max-height: 100%; touch-action: none; border-radius: 8px; }
.editor-tools { display: grid; grid-template-columns: repeat(8, minmax(0,1fr)); gap: 6px; width: min(100%,900px); flex: none; }
.editor-tools .tbtn { min-height: 48px; font-size:14px; padding:8px 5px; border-radius:6px; color:var(--text); background:var(--surface); }
.editor-tools .active { background:var(--accent); color:#171b16; border-color:var(--accent); }
.layout .playback-bar { position: static; margin: 0; flex: none; display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; padding: 5px; max-width: 100%; }
.playback-bar .pb-btn { min-width: 44px; min-height: 44px; width: auto; padding: 8px; font-size: 13px; }
.step-label { min-width:90px; font-size:13px; color:var(--text2); }
.app-dialog { width:min(680px,calc(100vw - 40px)); max-height:calc(100dvh - 48px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); margin:auto; padding:24px; border:1px solid var(--border2); border-radius:12px; background:var(--bg); color:var(--text); overflow:hidden; }
.app-dialog[open] { display:flex; flex-direction:column; }
.app-dialog::backdrop { background:#070a07cf; }
.dialog-head { display:flex; justify-content:space-between; align-items:center; gap:16px; margin-bottom:20px; padding-bottom:16px; border-bottom:1px solid var(--border); flex:none; }
.dialog-head h2 { font-size:24px; font-weight:600; letter-spacing:-.035em; margin:0; }
.dialog-head button { min-height:44px; min-width:64px; border:1px solid var(--border2); border-radius:6px; background:transparent; color:var(--text); padding:8px 12px; font:500 14px -apple-system, BlinkMacSystemFont, sans-serif; }
#dialogBody { overflow:auto; min-height:0; padding:2px 4px 12px; }
#dialogBody > label, #dialogBody > fieldset { margin-bottom:20px; }
#dialogBody > .tbtn { display:block; width:100%; margin-bottom:14px; }
.app-dialog label { display:grid; gap:8px; font-size:14px; color:var(--text2); margin-bottom:16px; }
.app-dialog input:not([type="checkbox"]):not([type="range"]):not([type="color"]), .app-dialog select, .app-dialog textarea { width:100%; min-height:46px; font:400 16px -apple-system, BlinkMacSystemFont, 'Manrope', sans-serif; padding:11px 12px; border:1px solid var(--border2); border-radius:6px; background:var(--surface); color:var(--text); }
.app-dialog input:disabled { color:var(--text2); }
.app-dialog fieldset { padding:16px; border:1px solid var(--border); border-radius:6px; margin-bottom:16px; }
.app-dialog legend { color:var(--text2); font-size:13px; padding:0 8px; }
.app-dialog .court-fields { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:0 12px; }
.app-dialog .court-fields label:last-child { grid-column:1/-1; margin-bottom:0; }
.app-dialog .hint { font-size:13px; line-height:1.5; color:var(--text2); margin:12px 0; }
.app-dialog .tbtn, .app-dialog .export-btn, .app-dialog .export-all-btn, .app-dialog .pb-btn { min-height:44px; font-size:14px; padding:12px; margin:0; }
.app-dialog .tbtn span { display:block; margin-top:6px; font-size:13px; font-weight:400; color:var(--text2); }
.app-dialog .section-title { font-size:13px; margin-bottom:14px; }
.app-dialog .section { padding:18px 0; margin:0 0 16px; background:transparent; border:0; border-bottom:1px solid var(--border); border-radius:0; box-shadow:none; }
.app-dialog .section:first-child { padding-top:0; }
.app-dialog .panel-right { display:block; position:static; width:auto; height:auto; overflow:visible; padding:0; border:0; }
#setupForm { display:flex; flex-direction:column; min-height:0; }
.setup-body { min-height:0; overflow:auto; padding:2px 4px 8px; }
.dialog-actions { flex:none; padding-top:16px; border-top:1px solid var(--border); }
.dialog-actions .form-error:empty { display:none; }
.dialog-actions .form-error { margin-bottom:12px; }
.dialog-actions .export-btn { width:100%; }
#setupCourtPreview { max-height:120px !important; }
.settings-group { border-bottom:1px solid var(--border); padding:0 0 4px; margin:0 !important; }
.settings-group > summary { min-height:56px; padding:18px 4px; font-size:15px; color:var(--text); font-weight:500; cursor:pointer; }
.settings-group-body { padding:12px 4px 20px; }
.settings-group-body > .tbtn, .settings-group-body > .export-btn { width:100%; margin:8px 0; }
.settings-group-body .section { border:0; padding:0; margin:0; }
.settings-actions { display:grid; gap:10px; }
.settings-actions .tbtn { display:flex; align-items:center; justify-content:flex-start; text-decoration:none; }
.settings-notice { font-size:14px; line-height:1.5; color:var(--text2); margin:0 0 16px; }
.settings-notice:empty { display:none; }
#brandingSettingsSection .section-title, #sharingSettingsSection .section-title { display:none; }
#brandingSettingsSection #playbackSpeedControl { display:none; }
#dialogBody .studio-choice { text-align:left; padding:20px 16px; border:1px solid var(--border); background:var(--surface); min-height:92px; }
.studio-choice strong { font-size:18px; font-weight:600; }
.app-dialog[data-kind=tools] [data-mode=select], .app-dialog[data-kind=tools] [data-mode=pass], .app-dialog[data-kind=tools] [data-mode=handoff], .app-dialog[data-kind=tools] [data-mode=dribble], .app-dialog[data-kind=tools] [data-mode=cut], .app-dialog[data-kind=tools] [data-mode=screen] { display:none; }
#guidedExportButton { width:100%; position:sticky; bottom:0; box-shadow:0 -8px 0 var(--bg); margin:12px 0; z-index:1; }
.export-studio-link { margin-top:16px !important; }
.inline-modal { position:fixed; padding:24px; width:min(400px,calc(100vw - 32px)); box-shadow:none; }
.inline-modal form { width:100%; }
.inline-modal .export-btn { width:100%; }
.player-actions { background:var(--bg); border:1px solid var(--border2); border-radius:12px; padding:20px; width:min(360px,calc(100vw - 32px)); }
.player-actions-title { font-size:20px; font-weight:600; margin-bottom:16px; }
.player-actions button { background:var(--surface); color:var(--text); min-height:48px; margin:8px 0; font-size:15px; }
#legacyCourtSection { display:none; }
#setupCourtPreview { display:block; max-width:100%; max-height:200px; width:auto; height:auto; margin:10px auto; }
#guidedExportPreview { display:block; max-width:100%; max-height:320px; width:auto; height:auto; margin:auto; }
.form-error { color:#ffaaaa; line-height:1.5; }
:focus-visible { outline:3px solid #ffb486; outline-offset:3px; }
.header-right { display:flex; gap:6px; }
.header-right .workspace-switch { display:none; }
.editor-export { min-height:44px; padding:10px 12px; border:1px solid var(--border2); border-radius:6px; background:transparent; color:var(--text); }
body[data-screen="home"] .editor-export { display:none; }
@media(max-width:480px) {
  .editor-tools { grid-template-columns:repeat(4,minmax(0,1fr)); }
  .layout .center { padding-left:10px; padding-right:10px; }
  .header { padding-left:10px; padding-right:10px; }
  .logo { font-size:17px; letter-spacing:1px; }
  .editor-export:last-of-type { display:none; }
}
@media (orientation:landscape) and (max-height:550px) {
  .layout .center { display:grid; grid-template-columns:minmax(0,1fr) 230px; grid-template-rows:auto minmax(0,1fr) auto; gap:6px 12px; }
  .editor-heading { grid-column:1/-1; }
  .layout .canvas-frame { grid-column:1; grid-row:2/4; height:100%; }
  .editor-tools { grid-column:2; grid-row:2; grid-template-columns:repeat(3,1fr); align-self:end; }
  .layout .playback-bar { grid-column:2; grid-row:3; }
  #editorPlayName { font-size:18px; }
}

#guidedBookPreview { width:100%; height:360px; background:#fff; border:1px solid var(--border); }
.app-dialog details { margin-top:18px; }
.app-dialog summary { min-height:44px; cursor:pointer; padding:12px 0; color:var(--text2); }
.app-dialog[data-kind="export"] #brandingSettingsSection { display:none; }

.app-dialog button { min-height:44px; min-width:44px; }
.app-dialog .book-front-matter, .studio-book-field.book-front-matter { display:flex; align-items:center; gap:10px; min-height:44px; }
.book-front-matter input[type=checkbox] { flex:none; width:22px; height:22px; }

/* Studio workspaces share the editor's type, controls and safe-area geometry. */
.studio-mobile-tabs { display:none; }
.animator-studio, .publishing-studio { height:calc(100dvh - 60px - env(safe-area-inset-top)); background:var(--bg); padding-bottom:calc(14px + env(safe-area-inset-bottom)); }
.animator-studio { grid-template-columns:280px minmax(0,1fr) 280px; }
.publishing-studio { grid-template-columns:270px minmax(0,1fr) minmax(0,1fr); }
.studio-card { padding:18px; background:var(--surface); border-color:var(--border); border-radius:6px; }
.animator-stage { background:var(--bg); border:0; padding:12px; }
.animator-stage h2, .studio-fields h2 { font:600 22px -apple-system, BlinkMacSystemFont, 'Manrope', sans-serif; letter-spacing:-.025em; }
.animator-canvas-shell { background:transparent; padding:0; border:0; box-shadow:none; }
#animatorCanvas { max-height:calc(100dvh - 310px - env(safe-area-inset-top)); object-fit:contain; width:auto; height:auto; }
.animator-transport { grid-template-columns:44px 52px 44px minmax(0,1fr); padding:0; background:transparent; border:0; gap:8px; }
.animator-transport .pb-btn { min-height:44px; min-width:44px; }
.animator-transport input { min-height:44px; }
.animator-timeline { min-height:52px; border-color:var(--border); padding:4px; }
.animator-timeline { overflow-x:auto; }
.animator-timeline button { min-height:44px; min-width:64px; flex-shrink:0; border-radius:3px; color:var(--text); font-size:12px; padding:6px; }
.animator-step-item, .animator-caption-item { width:100%; min-height:52px; text-align:left; font:inherit; padding:12px; color:var(--text); }
.animator-step-name, .studio-play-name { display:block; font-size:14px; font-weight:500; line-height:1.4; overflow-wrap:anywhere; }
.animator-step-meta, .studio-play-chapter { display:block; font-size:11px; color:var(--text2); line-height:1.5; text-transform:none; letter-spacing:0; }
.animator-caption-text { font-size:13px; }
.animator-control label, .animator-field-grid label, .animator-toggle, .animator-caption-editor label, .studio-fields label { font-size:13px; font-weight:500; color:var(--text2); text-transform:none; letter-spacing:0; }
.animator-control input[type=range], .animator-toggle { min-height:44px; }
.animator-control span, .animator-timecode { font:13px -apple-system, BlinkMacSystemFont, sans-serif; }
.animator-source-meta, .video-file-name, .publishing-summary { font-size:12px; line-height:1.5; color:var(--text2); text-transform:none; letter-spacing:0; }
.studio-fields .input-field { margin-top:8px; }
.studio-play-item { display:block; padding:0; }
.studio-play-select { display:grid; grid-template-columns:28px minmax(0,1fr); align-items:center; gap:10px; width:100%; min-height:54px; padding:12px; color:inherit; background:transparent; border:0; text-align:left; font:inherit; }
.studio-play-select > span { min-width:0; }
.studio-image-grid { grid-template-columns:1fr; gap:20px; }
.studio-image-slot { grid-template-columns:1fr 1fr; gap:8px; }
.studio-image-slot > .studio-image-preview { grid-column:1/-1; height:100px; }
.studio-image-preview { font-size:12px; }
.studio-actions { gap:10px; }
.studio-actions .tbtn, .studio-actions .export-btn, .studio-actions .export-all-btn { min-height:48px; }
.preview-card { height:100%; min-height:0; }
#publishingPreviewFrame { min-height:0; background:#e9ece4; }
@media(max-width:1100px) {
  .animator-studio, .publishing-studio { grid-template-columns:minmax(0,1fr); grid-template-rows:auto minmax(0,1fr); gap:14px; overflow:hidden; padding:12px 16px calc(16px + env(safe-area-inset-bottom)); }
  .studio-mobile-tabs { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:4px; padding:4px; border:1px solid var(--border); border-radius:6px; }
  .studio-mobile-tabs button { min-height:44px; border:0; border-radius:3px; background:transparent; color:var(--text2); font:500 14px -apple-system, BlinkMacSystemFont, sans-serif; }
  .studio-mobile-tabs button[aria-pressed=true] { background:var(--surface3); color:var(--text); }
  .animator-studio > :not(nav), .publishing-studio > :not(nav) { min-height:0; overflow:auto; height:100%; }
  .animator-studio[data-panel=preview] > :is(.animator-sidebar,.animator-inspector), .animator-studio[data-panel=settings] > :is(.animator-stage,.animator-inspector), .animator-studio[data-panel=notes] > :is(.animator-stage,.animator-sidebar) { display:none; }
  .publishing-studio[data-panel=preview] > :is(.studio-sidebar,.studio-editor), .publishing-studio[data-panel=settings] > :is(.studio-preview,.studio-editor), .publishing-studio[data-panel=notes] > :is(.studio-preview,.studio-sidebar) { display:none; }
  .animator-stage { padding:0; justify-content:flex-start; gap:14px; }
  .animator-canvas-shell { flex:1; min-height:80px; width:100%; overflow:hidden; position:relative; }
  #animatorCanvas { position:absolute; inset:0; width:100%; height:100%; max-height:100%; max-width:100%; object-fit:contain; background:transparent; }
  .animator-stage-head, .animator-transport, .animator-timeline { flex:none; width:100%; }
  .animator-timeline { min-height:52px; }
  .animator-step-list, .animator-caption-list, .studio-play-list { max-height:none; overflow:visible; }
  .preview-card { padding:12px; margin:0; height:100%; display:flex; flex-direction:column; }
  #publishingPreviewFrame { flex:1; width:100%; height:100%; }
  .field-grid { gap:12px; }
}
@media(max-width:600px) {
  .app-dialog:not(.inline-modal):not([data-kind="steps"]):not([data-kind="studios"]) { width:100vw; max-width:100vw; height:100dvh; max-height:100dvh; margin:0; border:0; border-radius:0; padding:calc(16px + env(safe-area-inset-top)) 20px calc(16px + env(safe-area-inset-bottom)); }
  #setupForm { height:100%; }
  .app-dialog .dialog-head { margin-bottom:16px; }
  #dialogBody { flex:1; }
  .layout .playback-bar { display:grid; grid-template-columns:44px repeat(4,minmax(0,1fr)) 44px; width:min(100%,900px); border:0; background:transparent; padding:0; }
  .layout .playback-bar > :nth-child(n+4) { min-width:0; width:100%; }
  .layout .playback-bar > :nth-child(2) { grid-column:2 / span 4; }
  .layout .playback-bar > :nth-child(4) { grid-column:1 / span 2; }
  .layout .playback-bar > :nth-child(5) { grid-column:3 / span 2; }
  .layout .playback-bar > :nth-child(6) { grid-column:5 / span 2; }
  .layout .playback-bar .step-label { text-align:center; }
  .layout .playback-bar .pb-btn { border-radius:6px; font-size:13px; }
  .app-dialog .step-row { font-size:14px; min-height:48px; }
  .app-dialog .step-row .x { min-width:44px; min-height:44px; }
  .animator-studio, .publishing-studio { padding-left:12px; padding-right:12px; }
  .studio-fields-head { flex-wrap:wrap; }
  .studio-actions, .field-grid { grid-template-columns:1fr; }
  .studio-actions .export-btn { grid-column:auto; }
}

.pb-btn.primary { background:var(--accent); color:#171b16; border-color:var(--accent); }

.app-dialog[data-kind="steps"] .section-title { display:none; }

.animator-studio .input-field, .publishing-studio .input-field { font-size:16px; }
.studio-sidebar .book-scope { display:grid; gap:8px; font-size:13px; color:var(--text2); padding:18px; border:1px solid var(--border); border-radius:6px; background:var(--surface); }
.studio-sidebar .book-scope select { width:100%; min-height:44px; padding:10px; font-size:16px; color:var(--text); background:var(--bg); border:1px solid var(--border2); border-radius:6px; }

.studio-book-field { display:grid; gap:8px; margin-bottom:14px; color:var(--text2); font-size:13px; }

@media (max-width:1100px) and (orientation:landscape) and (max-height:550px) {
  .animator-studio, .publishing-studio { grid-template-columns:130px minmax(0,1fr); grid-template-rows:minmax(0,1fr); gap:16px; }
  .studio-mobile-tabs { grid-template-columns:1fr; align-self:start; }
  .animator-stage { display:grid; grid-template-columns:minmax(0,1fr) 180px; grid-template-rows:auto minmax(0,1fr) auto; gap:8px 16px; }
  .animator-stage-head { grid-column:1/-1; }
  .animator-canvas-shell { grid-column:1; grid-row:2/4; height:100%; }
  .animator-transport { grid-column:2; grid-row:2; grid-template-columns:44px 52px 44px; justify-content:space-between; align-self:end; }
  .animator-transport input { grid-column:1/-1; width:100%; }
  .animator-timeline { grid-column:2; grid-row:3; display:grid; grid-template-columns:1fr 1fr; gap:4px; max-height:110px; overflow:auto; }
  .animator-stage h2 { font-size:18px; }
}

.drawing-hint { min-height:2.7em; flex:none; width:min(100%,900px); margin:0; font-size:13px; line-height:1.35; color:var(--text2); }

@media (orientation:landscape) and (max-height:550px) { .drawing-hint { display:none; } }

/* Repeated editor commands must not trigger the browser double-tap zoom gesture. */
.editor-tools button, .playback-bar button { touch-action: manipulation; }
