/* The launcher is document content; it must never be clipped by the canvas. */
[hidden]{display:none!important}
button,.button,select,input{min-height:44px;font-size:15px}
button,.button{touch-action:manipulation;-webkit-tap-highlight-color:transparent}
input[type=range],input[type=checkbox]{min-height:0}
.game-page header{min-height:72px;padding:12px 4vw;gap:12px}
.toolbar{flex-wrap:nowrap;gap:8px}
#status{margin-right:4px}
.game-page main{padding-top:20px}
#stage:has(#cover:not([hidden])){height:auto;min-height:0;aspect-ratio:auto}
#stage:has(#cover:not([hidden])) #canvas{display:none}
#cover{position:relative;display:block}
.intro{max-width:860px;margin:auto;padding:42px 24px 28px}
.intro .eyebrow{margin:0 0 12px;letter-spacing:2px}
.intro h1{margin:0 0 12px}
.intro .intro-note{margin:0 0 20px;line-height:1.5}
.characters{margin:0}
#character-cards{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}
.character-card{min-width:0;gap:10px;padding:10px}
.character-card .portrait{width:48px;height:48px}
.card-text strong{font-size:15px}
.card-text small{font-size:11px}
#start{min-width:230px;margin:22px 0 8px}
#loading{font-size:12px!important;line-height:1.6;margin:4px 0 12px}
.phone-note{display:none}
.launch-files{text-align:left;border-top:1px solid var(--line);margin:22px auto 0;max-width:580px;padding-top:8px;color:var(--muted);font-size:13px}
summary{padding:12px 0;cursor:pointer;min-height:44px;color:var(--text)}
.launch-files summary span{color:var(--muted);font-size:12px;margin-left:8px}
.pak-label{margin:12px 0;font-size:13px}
.pak-label input{margin:6px 0;width:100%;max-width:100%;font-size:13px}
input::file-selector-button{padding:10px;font:inherit;cursor:pointer}
#stage.expanded,#stage:fullscreen{height:100dvh;aspect-ratio:auto}
#stage:where(:not(:has(#cover:not([hidden])))) #canvas{position:absolute;inset:0;width:100%;height:100%;object-fit:fill}
#view-exit{font-size:12px;min-height:36px;padding:6px 12px}
.touch-top button{min-height:36px}
.game-page .touch-actions{bottom:calc(max(18px,env(safe-area-inset-bottom)) + 48px)}
.touch-rotate{top:54px;left:max(12px,env(safe-area-inset-left))}
dialog{color:var(--text);background:var(--panel);border:1px solid var(--line);border-radius:10px;padding:0}
dialog::backdrop{background:#080705c9;backdrop-filter:blur(4px)}
#game-menu{width:min(680px,calc(100% - 32px));max-width:100%;max-height:calc(100dvh - 32px);overflow:hidden}
.menu-shell{display:flex;flex-direction:column;max-height:calc(100dvh - 34px)}
.menu-header{display:flex;align-items:center;gap:12px;padding:16px 20px;border-bottom:1px solid var(--line);flex:none}
.menu-header h2{font:400 24px Georgia,serif;margin:0;flex:1}
#menu-close{padding:6px;width:44px;flex:none}
.menu-body{overflow-y:auto;overscroll-behavior:contain;padding:18px 20px;min-height:0;scrollbar-gutter:stable}
.menu-body p{font-size:14px;line-height:1.6}
.menu-note{color:var(--muted);margin:0 0 16px}
.menu-actions{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin:16px 0}
.menu-actions button{text-align:left;min-height:76px;padding:14px 16px;font-size:16px}
.menu-actions button span{display:block;font-size:12px;color:var(--muted);margin-top:6px;line-height:1.4}
.menu-footer{display:flex;gap:16px;align-items:center;justify-content:space-between;padding:12px 20px;border-top:1px solid var(--line);flex:none}
.menu-footer span{font-size:12px;line-height:1.5;color:var(--muted)}
.menu-footer .primary{margin:0;min-width:160px;padding:12px 16px;font-size:14px}
.menu-open{overflow:hidden}
.field{display:flex;flex-direction:column;gap:7px;font-size:14px;margin:0 0 18px;color:var(--text);min-width:0}
.field input,.field select{width:100%;padding:11px 12px;background:#100f0d;color:var(--text);border:1px solid var(--line);border-radius:4px;font-size:16px}
.field input:focus-visible,.field select:focus-visible{outline-offset:2px}
.menu-row{display:flex;gap:12px;flex-wrap:wrap;align-items:center;margin:12px 0}
.menu-row .field{flex:1;margin:0;min-width:150px}
.menu-row .primary{margin:0}
.character-label{display:flex;align-items:center;gap:10px}
.settings-grid{display:grid;grid-template-columns:1fr 1fr;gap:20px;margin:24px 0}
.slider{display:grid;grid-template-columns:1fr auto;gap:10px;font-size:14px}
.slider input{grid-column:1/-1;width:100%;margin:0;height:32px;accent-color:var(--accent)}
.slider output{color:var(--accent);font-variant-numeric:tabular-nums}
.check{display:flex;align-items:center;gap:8px;min-height:44px;font-size:14px}
.check input{width:20px;height:20px;accent-color:var(--accent)}
#network-status{font-size:14px;margin:16px 0;min-height:24px;overflow-wrap:anywhere}
#multiplayer-summary{font-size:13px;line-height:1.6;margin:0 0 18px}
#server-url{max-width:100%;margin:0}
#chat-form{border-top:1px solid var(--line);padding-top:16px;margin-top:20px}
#chat-status:empty,#binding-result:empty{display:none}
.save-slot{display:grid;grid-template-columns:minmax(0,1fr) auto auto;gap:8px;align-items:center;padding:14px 0;border-bottom:1px solid var(--line)}
.save-slot strong,.save-slot small{display:block}
.save-slot small{font-size:12px;color:var(--muted);margin-top:5px;overflow-wrap:anywhere}
.save-slot button{font-size:13px;padding:9px}
#save-result{color:var(--accent);min-height:24px}
.music-row{display:block;font-size:14px}
.music-row>p{margin:6px 0;line-height:1.6}
#command-form{margin-top:24px}
#command-form .field{margin-bottom:10px}
#binding-form{margin-top:24px}
.install-content{padding:8px 24px 24px;max-width:500px}
.install-header{position:sticky;top:0;display:flex;align-items:center;gap:14px;padding:18px 24px;background:var(--panel);border-bottom:1px solid var(--line)}
.install-header h2{font:400 23px Georgia,serif;margin:0;flex:1}
#install-close{width:44px;padding:8px;flex:none}
.install-content p{font-size:15px;line-height:1.7;color:var(--muted)}
.install-content .primary{display:block;margin:20px 0}
#install-dialog{max-width:calc(100% - 24px);max-height:calc(100dvh - 24px);overflow-y:auto}
@media(max-width:760px){
  .game-page header{padding:10px 12px;min-height:64px;align-items:center}
  .wordmark{font-size:22px;letter-spacing:3px}
  .wordmark span{font-size:8px;letter-spacing:1px}
  .toolbar{gap:6px}
  .toolbar button{padding:8px 10px;font-size:13px;white-space:nowrap}
  #status{display:none}
  .game-page main{padding:12px}
  .intro{padding:28px 14px 20px}
  .intro h1{font-size:32px}
  .intro .intro-note{font-size:14px;margin-bottom:20px}
  .intro .eyebrow{font-size:9px;letter-spacing:1px}
  #character-cards{gap:6px}
  .character-card{flex-direction:column;gap:6px;padding:10px 6px;text-align:center}
  .character-card .portrait{width:48px;height:48px}
  .card-text small{display:none}
  #start{width:100%;margin:20px 0 8px;min-height:52px}
  #loading{margin:4px 0;font-size:12px!important}
  .intro .phone-note{display:block;font-size:12px;line-height:1.6;margin:10px 0 0}
  .launch-files{margin-top:16px}
  #stage:where(:not(:has(#cover:not([hidden])))){height:calc(100svh - 100px);min-height:300px;aspect-ratio:auto}
  #stage.expanded,#stage:fullscreen{height:100dvh;min-height:0}
  .keyboard-hint{display:none}
  .below{margin:12px 0}
  .below-links{justify-content:space-between;width:100%;gap:12px}
  #game-menu{width:100%;height:100dvh;max-width:100%;max-height:100dvh;margin:0;border:0;border-radius:0}
  .menu-shell{height:100%;max-height:100dvh;padding:env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left)}
  .menu-header{padding:12px 14px;gap:8px}
  .menu-header h2{font-size:22px}
  .menu-body{padding:16px 14px;flex:1}
  .menu-footer{padding:10px 14px;gap:10px}
  .menu-footer .primary{min-width:140px}
  .menu-actions{gap:8px}
  .menu-actions button{padding:12px;min-height:82px;font-size:15px}
  .menu-actions button span{font-size:12px}
  .settings-grid{grid-template-columns:1fr;gap:16px}
  .game-page footer{padding:14px 12px;letter-spacing:.5px}
}
@media(max-width:370px){
  .wordmark{font-size:18px}
  .wordmark span{display:none}
  .toolbar button{padding:7px;font-size:12px}
  .intro{padding:22px 12px 16px}
  .intro h1{font-size:28px}
  .menu-footer span{font-size:11px}
}
@media(orientation:landscape) and (max-height:540px){
  .game-page header{min-height:52px;padding:6px 16px}
  .game-page main{padding:8px 16px}
  .intro{padding:12px 20px;max-width:760px}
  .intro .eyebrow{margin-bottom:5px}
  .intro h1{font-size:28px;margin:0 0 6px}
  .intro .intro-note{margin:0 0 10px;line-height:1.4}
  .intro .intro-note br{display:none}
  .characters legend{margin-bottom:6px}
  .character-card{flex-direction:row;text-align:left;padding:6px 10px}
  .character-card .portrait{width:34px;height:34px}
  #start{width:auto;min-height:44px;margin:10px 0 4px;padding:10px 24px}
  .intro .phone-note{display:none}
  #loading{margin:2px 0;font-size:11px!important}
  #stage:where(:not(:has(#cover:not([hidden])))){height:calc(100svh - 70px);min-height:0}
  #stage.expanded,#stage:fullscreen{height:100dvh}
  #game-menu{max-height:calc(100dvh - 16px)}
  .menu-shell{max-height:calc(100dvh - 18px)}
  .menu-header{padding:8px 16px}
  .menu-body{padding:12px 16px}
  .menu-actions{grid-template-columns:repeat(3,minmax(0,1fr));margin:8px 0}
  .menu-actions button{min-height:66px;padding:10px 12px;font-size:14px}
  .menu-actions button span{font-size:11px;margin-top:4px}
  .menu-footer{padding:8px 16px}
  .menu-footer .primary{min-height:40px;padding:8px 14px}
  .settings-grid{grid-template-columns:1fr 1fr}
}
@media(display-mode:standalone),(display-mode:fullscreen){
  .game-page header{padding-top:max(10px,env(safe-area-inset-top))}
}
