/* Reference layout uses a 1672 × 941 stage; cqw keeps its typography proportional. */
:root{--front-stage-width:min(100vw,177.69dvh);--front-brand-unit:min(1vw,1.7769dvh)}
.front-button-gold{--front-button-art:url('../../assets/front/selection-enter-button.svg');--front-button-glow:drop-shadow(0 0 12px #e2b25950)}
.front-button-dark{--front-button-art:url('../../assets/front/selection-logout-button.svg');--front-button-glow:drop-shadow(0 3px 6px #0006)}
body #select{--select-type:'Leelawadee UI',Tahoma,sans-serif;padding:0;border:0;align-items:center;background:linear-gradient(#03080c18,#03080c18),url('../../assets/theme/character-hall.png') center/cover no-repeat;color:#f1e6d0;font-family:var(--select-type)}
body #select .select-inner{position:relative;container-type:inline-size;display:block;width:min(100%,177.69dvh);height:auto;aspect-ratio:1672/941;min-height:0;margin:auto;padding:0;background:none;border:0;box-shadow:none}
body #select .select-header{position:absolute;inset:2.6% 7.6% auto 9.6%;height:8.2%;display:flex;align-items:center;gap:2cqw;border:0;padding:0}
body #select .select-wordmark{font:2cqw Georgia,serif;letter-spacing:.3cqw;color:#f7d795;text-shadow:0 2px 15px #000;padding-left:5cqw;min-height:4cqw;white-space:nowrap}
body #select .select-wordmark>span{display:block;margin-top:.4cqw;font:600 .6cqw var(--select-type);letter-spacing:.34cqw;color:#e6c790}
body #select .select-dragon-crest{width:4cqw;height:4.4cqw}
body #select .select-save-status{display:none}
body #select #select-logout{order:1;flex:none;display:inline-flex;align-items:center;justify-content:center;gap:.8cqw;width:10cqw;min-height:3.2cqw;margin:0 0 0 auto;padding:.6cqw 1cqw;color:#f2d899;font:600 .85cqw var(--select-type);border:0;border-radius:0;box-shadow:0 3px 12px #0006;white-space:nowrap}
body #select #select-logout[hidden]{display:none}
body #select #select-logout::before{content:'';flex:none;width:1.25cqw;height:1.25cqw;background:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23f2d899' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10 5V3h11v18H10v-2M3 12h12m-4-4 4 4-4 4'/%3E%3C/svg%3E") center/contain no-repeat}
body #select .language-picker{order:2;flex:none}
body #select #select-logout:not([hidden])~.language-picker{margin-left:0}
body #select .select-heading{position:absolute;left:9.6%;top:14.4%;width:16%;display:flex;justify-content:center;margin:0;text-align:center}
body #select h2{position:relative;margin:0;color:#ffe4ac;font:600 1.8cqw/1.5 var(--select-type);letter-spacing:.15cqw;text-align:center;text-shadow:0 2px 8px #000}
body #select h2::before,body #select h2::after{content:'';position:absolute;top:55%;width:2.5cqw;height:1px;background:linear-gradient(90deg,transparent,#e3be78)}
body #select h2::before{right:calc(100% + 1cqw)}body #select h2::after{left:calc(100% + 1cqw);transform:rotate(180deg)}
body #select .select-heading-caption{display:block;margin-top:.2cqw;color:#d7b477;font:.68cqw var(--select-type);letter-spacing:.27cqw}
body #select #select-slot-count{display:none}
body #select .select-stage{position:absolute;inset:23.1% 9.6% 31.5%;display:block;min-height:0;padding:0;isolation:isolate}
body #select #slot-list{height:100%;display:grid;grid-template-columns:26% 26%;grid-template-rows:1fr 1fr;justify-content:space-between;gap:6% 0;margin:0;padding:0;pointer-events:none}
body #select .slot,body #select .slot.last,body #select .slot:nth-child(n+3){align-self:stretch;min-height:0;padding:0;border:0;border-radius:0;background:none;box-shadow:none}
body #select .slot button{position:relative;isolation:isolate;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:0;width:100%;height:100%;min-height:0;padding:.8cqw 1cqw;border:0;border-radius:0;background:linear-gradient(115deg,#10171bec,#0b1115de);box-shadow:none;color:#f0e9dc;text-align:center;pointer-events:auto;transition:background .2s,filter .2s}
body #select .slot button::before{content:'';position:absolute;inset:0;left:0;top:0;width:auto;height:auto;z-index:-1;border:12px solid transparent;border-image:url('../../assets/front/selection-frame.svg') 20 stretch;pointer-events:none;opacity:.75}
body #select .slot button::after{content:'✥';position:absolute;inset:auto 1cqw 1.5cqw auto;width:auto;height:auto;border:0;z-index:-1;color:#bd985316;font:7cqw Georgia,serif;pointer-events:none}
body #select .slot button:hover{background:linear-gradient(115deg,#332c20ed,#11191ee8)}
body #select .slot.last button{outline:0;border:0;background:radial-gradient(ellipse at 50% 0,#8f744239,transparent 80%),linear-gradient(115deg,#29271fed,#151a1be8);box-shadow:inset 0 0 30px #eac16d16,0 0 8px #f5bd5880,0 0 23px #f5bd5840}
body #select .slot.last button::before{opacity:1;filter:brightness(1.6) drop-shadow(0 0 3px #ffc45a) drop-shadow(0 0 7px #ffad24)}
body #select .slot-number{left:1.3cqw;top:1cqw;font:1.05cqw var(--select-type);letter-spacing:.12cqw;color:#c6aa75}
body #select .slot.last .slot-number{color:#ffe9ac}
body #select .slot .slot-miniature{width:6cqw;height:6cqw;max-height:52%;filter:drop-shadow(0 5px 9px #0008)}
body #select .slot-copy{gap:.35cqw}
body #select .slot b{font:400 1.65cqw Georgia,var(--select-type);color:#ffe6b0;overflow-wrap:anywhere}
body #select .slot-copy>span{font:.9cqw var(--select-type);color:#e0ded7}
body #select .slot-copy em{font-style:normal;margin:0 .5cqw;color:#d0b078}
body #select .slot-indicator{right:1.1cqw;top:1cqw;font-size:1cqw;color:#a99a78}
body #select .slot.last .slot-indicator{color:#fff3c9;text-shadow:0 0 4px #fff,0 0 10px #ffb536,0 0 18px #ff9b16}
body #select .slot.empty button{border:0;background:linear-gradient(115deg,#10171beb,#0b1115dc)}
body #select .slot-add{width:3.6cqw;height:3.6cqw;margin-bottom:.8cqw;border:1px solid #be995d;font:2.6cqw Georgia,serif;color:#f0d299;background:#080e1338}
body #select .slot.empty b{font:1.05cqw var(--select-type);color:#f0ede7}
body #select .slot.empty .slot-add,body #select .slot.empty .slot-copy{transform:translateY(.8cqw)}
body #select .select-showcase{position:absolute;left:50%;top:-8%;transform:translateX(-50%);width:41cqw;min-height:0;margin:0;pointer-events:none}
body #select .select-preview-stage{aspect-ratio:10/7.2;overflow:clip}
body #select .select-aura{inset:0 0 5%;background:radial-gradient(ellipse at 50% 65%,#e6ba5a25,transparent 65%)}
body #select .select-pedestal{border:3px double #e7c480b0;background:repeating-conic-gradient(from 0deg,#d5ad6040 0deg 1deg,transparent 1deg 30deg),radial-gradient(ellipse,#cba04b29,#0b111bb8 66%,#d6a84a66 68%,#14171ce8 72%);box-shadow:0 0 0 10px #151716c9,0 0 0 12px #d9b76c88,0 15px 0 10px #080c10b0,0 0 55px #d2a14828,inset 0 0 40px #e2bf6740}
body #select #select-character-detail{position:relative;margin-top:-1.2cqw;padding:.7cqw 0 .6cqw;background:linear-gradient(90deg,transparent,#080f17b3 30%,#080f17b3 70%,transparent);border-block:1px solid #c99e506b}
body #select #select-character-detail::before{content:'◇';position:absolute;top:-.9cqw;left:calc(50% - .6cqw);color:#ffdc96;font:1.2cqw Georgia,serif;text-shadow:0 0 7px #dba443}
body #select #select-character-detail h3{margin:0 0 .4cqw;font:400 2.4cqw/1.3 Georgia,var(--select-type);letter-spacing:.12cqw;color:#ffe4a4;text-shadow:0 3px 15px #000}
body #select #select-character-detail>p{margin:0;font:1.05cqw var(--select-type);color:#eee9dd}
body #select #select-character-detail>p>span{margin:0 .7cqw;color:#c7a463}
body #select .select-footer{position:absolute;top:81.4%;left:35.5%;width:29%;display:flex;flex-direction:column;justify-content:center;align-items:center;gap:.6cqw;margin:0;padding:0 0 1cqw;border-bottom:1px solid #b68a4a80;z-index:3}
body #select .select-footer::after{content:'◇';position:absolute;bottom:-.65cqw;left:calc(50% - .55cqw);color:#e3bc77;font:1.1cqw Georgia,serif;text-shadow:0 0 8px #e9b85d}
body #select #select-ok,body #select #select-delete{position:relative;flex:none;min-width:0;margin:0;border:0;border-radius:0;letter-spacing:.03cqw;cursor:pointer}
body #select #select-ok{width:19.2cqw;min-height:3.85cqw;padding:.6cqw 1.6cqw;box-shadow:none;filter:drop-shadow(0 0 12px #e2b25950);color:#211b13;font:600 1.4cqw var(--select-type);text-shadow:0 1px #fff5}
body #select #select-delete{width:auto;min-height:24px;padding:.2cqw .6cqw;background:none;box-shadow:none;color:#c7b799;font:.85cqw var(--select-type)}
body #select #select-delete:hover{background:none;color:#ffe7ad;text-decoration:underline;text-underline-offset:3px}
body #select button:disabled{opacity:.45;cursor:default}
body #select-notice{top:12%}
@media(max-width:700px) and (orientation:portrait){
 body #select{padding:16px 12px;align-items:flex-start}
 body #select .select-inner{width:100%;aspect-ratio:auto;min-height:850px}
 body #select .select-header{inset:0 0 auto;height:90px;flex-wrap:wrap;justify-content:space-between;gap:8px}
 body #select .select-wordmark{width:100%;font-size:24px;padding-left:48px;min-height:42px;letter-spacing:3px}
 body #select .select-wordmark>span{font-size:8px;letter-spacing:3px}
 body #select .select-dragon-crest{width:38px;height:42px}
 body #select #select-logout{width:140px;margin:0;min-height:44px;padding:8px 14px;font-size:12px;gap:10px}
 body #select #select-logout::before{width:18px;height:18px}
 body #select .select-heading{top:118px;left:0;width:100%}
 body #select h2{font-size:24px;letter-spacing:1px}
 body #select .select-heading-caption{font-size:9px;letter-spacing:3px}
 body #select .select-stage{inset:190px 0 auto;height:540px}
 body #select #slot-list{grid-template-columns:repeat(2,minmax(0,1fr));grid-template-rows:150px 150px;align-content:space-between;gap:16px}
 body #select .slot button{padding:10px 6px}
 body #select .slot-number{left:12px;top:10px;font-size:12px;letter-spacing:1px}
 body #select .slot .slot-miniature{width:78px;height:78px}
 body #select .slot b{font-size:20px}body #select .slot-copy{gap:4px}body #select .slot-copy>span{font-size:11px}
 body #select .slot-indicator{right:12px;top:10px;font-size:14px}
 body #select .slot-add{width:42px;height:42px;margin-bottom:12px;font-size:30px}
 body #select .slot.empty b{font-size:14px}
 body #select .slot.empty .slot-add,body #select .slot.empty .slot-copy{transform:none}
 body #select .select-showcase{top:130px;width:270px}
 body #select #select-character-detail{margin-top:-12px;padding:8px 0}
 body #select #select-character-detail h3{font-size:28px}body #select #select-character-detail>p{font-size:13px}
 body #select #select-character-detail::before{top:-10px;font-size:14px}
 body #select .select-footer{top:755px;left:0;width:100%;gap:8px;padding-bottom:18px}
 body #select #select-ok{width:85%;min-height:62px;font-size:20px}
 body #select #select-delete{width:auto;min-height:28px;padding:4px 12px;font-size:13px}
 body #select .select-footer::after{bottom:-8px;font-size:16px}
}
@media(prefers-reduced-motion:reduce){body #select .slot button{transition:none}}

/* One button component; screens provide only dimensions and placement. */
body :is(#select #select-ok,#select #select-logout,#create.creation-hall .front-button){border:0;border-radius:0;background:var(--front-button-art) center/100% 100% no-repeat;box-shadow:none;filter:var(--front-button-glow);outline:none}
body :is(#select #select-ok,#select #select-logout,#create.creation-hall .front-button):hover:not(:disabled){background:var(--front-button-art) center/100% 100% no-repeat;box-shadow:none;filter:brightness(1.15) var(--front-button-glow);transform:none}
body :is(#select #select-ok,#select #select-logout,#create.creation-hall .front-button):focus-visible{outline:none;filter:brightness(1.15) drop-shadow(0 0 3px #fff0bd) drop-shadow(0 0 12px #e2b25990)}

/* Both screens use the same wordmark markup and viewport-based scale. */
body :is(#select .select-wordmark,#create.creation-hall .creation-face-brand){display:block;box-sizing:border-box;width:max-content;min-height:calc(4 * var(--front-brand-unit));padding:0 0 0 calc(5 * var(--front-brand-unit));font:calc(2 * var(--front-brand-unit)) Georgia,serif;letter-spacing:calc(.3 * var(--front-brand-unit));color:#f7d795;text-shadow:0 2px 15px #000;white-space:nowrap}
body :is(#select .select-wordmark,#create.creation-hall .creation-face-brand)>span{display:block;margin-top:calc(.4 * var(--front-brand-unit));font:600 calc(.6 * var(--front-brand-unit)) 'Leelawadee UI',Tahoma,sans-serif;letter-spacing:calc(.34 * var(--front-brand-unit));color:#e6c790}
body :is(#select .select-wordmark,#create.creation-hall .creation-face-brand)>.select-dragon-crest{position:absolute;left:0;top:50%;transform:translateY(-50%);width:calc(4 * var(--front-brand-unit));height:calc(4.4 * var(--front-brand-unit));object-fit:contain}
body #create.creation-hall .creation-face-brand{position:fixed;left:calc((100vw - var(--front-stage-width)) / 2 + .096 * var(--front-stage-width));top:calc((100dvh - var(--front-stage-width) * 941 / 1672) / 2 + .067 * var(--front-stage-width) * 941 / 1672);transform:translateY(-50%)}
@media(max-width:700px) and (orientation:portrait){
 body :is(#select .select-wordmark,#create.creation-hall .creation-face-brand){min-height:42px;padding-left:48px;font-size:24px;letter-spacing:3px}
 body #select .select-wordmark{width:100%}
 body #select .select-header{align-content:flex-start}
 body :is(#select .select-wordmark,#create.creation-hall .creation-face-brand)>span{margin-top:.4cqw;font-size:8px;letter-spacing:3px}
 body :is(#select .select-wordmark,#create.creation-hall .creation-face-brand)>.select-dragon-crest{width:38px;height:42px}
 body #create.creation-hall .creation-face-brand{left:12px;top:16px;transform:none}
}

/* MOBILE-FRONT-FIT: allocate content and actions from the actual available viewport. */
@media (max-width:700px), (max-height:500px) and (pointer:coarse) {
 body:not(.game-ready){overflow:hidden}
 body #loading{position:fixed;inset:0;overflow:hidden;padding-bottom:max(20px,env(safe-area-inset-bottom))}
 body #connecting{overflow:hidden;padding:env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);box-sizing:border-box}
 body #select{box-sizing:border-box;height:100dvh;min-height:0;overflow:hidden;padding:max(12px,env(safe-area-inset-top)) max(12px,env(safe-area-inset-right)) max(12px,env(safe-area-inset-bottom)) max(12px,env(safe-area-inset-left))}
 body #select .select-inner,body #select.line-select-with-controls .select-inner{height:100%;min-height:0;aspect-ratio:auto;display:grid;grid-template-rows:auto auto minmax(0,1fr) auto;gap:8px}
 body #select .select-header{position:relative;inset:auto;height:auto;min-height:0;gap:6px}
 body #select .select-heading{position:static;width:100%;margin:0}
 body #select h2{font-size:20px}
 body #select .select-heading-caption{display:none}
 body #select .select-stage{position:relative;inset:auto;height:auto;min-height:0;padding:0}
 body #select #slot-list{position:absolute;inset:0;grid-template-columns:repeat(2,minmax(0,1fr));grid-template-rows:repeat(2,minmax(0,1fr));gap:10px;align-content:stretch}
 body #select .slot button{height:100%;padding:12px 8px}
 body #select .slot .slot-miniature{width:64px;height:64px}
 body #select .slot b{font-size:16px}
 body #select .slot-copy>span{font-size:11px}
 body #select .select-showcase{display:none}
 body #select .select-footer{position:static;width:100%;gap:4px;padding:0;border:0}
 body #select .select-footer::after{display:none}
 body #select #select-ok{width:min(100%,320px);min-height:48px;font-size:18px}
 body #select #select-delete{min-height:32px;font-size:12px}
 body #select .line-account-controls{position:static;grid-row:5;margin:0;max-width:100%}
 body #select.line-select-with-controls .select-inner{grid-template-rows:auto auto minmax(0,1fr) auto auto}
 body #create.class-stage,body #create.creation-hall{position:fixed;inset:0;box-sizing:border-box;width:100%;height:100dvh;min-height:0;max-height:100dvh;margin:0;padding:max(12px,env(safe-area-inset-top)) max(14px,env(safe-area-inset-right)) max(12px,env(safe-area-inset-bottom)) max(14px,env(safe-area-inset-left));overflow:hidden;grid-template-rows:auto minmax(0,1fr) auto;gap:8px}
 body #create.creation-hall .creation-face-brand,body #create.creation-hall::after{display:none}
 body #create.creation-hall .creation-stage-header>.eyebrow{flex-wrap:nowrap;font-size:9px;letter-spacing:1px;min-height:32px;padding-bottom:4px;gap:4px}
 body #create.creation-hall h2,body #create.class-stage h2{font-size:32px;line-height:1.15;margin:4px 0}
 body #create.creation-hall #creation-subtitle{font-size:11px;line-height:1.5;min-height:0;margin:2px 0 6px}
 body #create.creation-hall .create-actions{grid-template-columns:1fr 1fr 1.5fr;gap:6px;padding-top:8px}
 body #create.creation-hall .create-actions button,body #create.creation-hall .create-actions #create-back{min-height:44px;font-size:12px;padding:6px}
 body #create.creation-hall #create-confirm{grid-column:auto;grid-row:auto;min-height:44px;font-size:16px}
 body #create.creation-hall .creation-step-panel .face-options{grid-template-columns:repeat(3,minmax(0,1fr));grid-template-rows:repeat(2,minmax(0,1fr));gap:12px;padding:6px;width:100%}
 body #create.creation-hall .face-options button{height:100%;max-height:180px;min-height:0;width:auto;max-width:100%;aspect-ratio:4/5;justify-self:center;padding:5px}
 body #create.creation-hall .face-pagination{flex:none;height:44px;margin:4px 0;gap:16px}
 body #create.creation-hall .face-pagination button{min-width:44px;min-height:44px}
 body #create.job-stage .job-layout{grid-template-rows:minmax(132px,.85fr) minmax(180px,1fr);gap:8px;padding:0;overflow:visible}
 body #create.job-stage .job-options{min-height:0;gap:6px}
 body #create.job-stage .job-card{padding:8px 10px;min-height:44px;gap:0}
 body #create.job-stage .job-card strong{font-size:12px}
 body #create.job-stage .job-tool{height:20px}
 body #create.job-stage .job-detail{min-height:0;padding:12px}
 body #create.job-stage .job-description p{height:auto;min-height:0;overflow:visible;font-size:11px;line-height:1.5;margin:0 0 6px}
 body #create.job-stage .job-description h4{font-size:11px;padding-top:5px;margin-bottom:5px}
 body #create.job-stage .job-products{gap:5px}
 body #create.job-stage .job-product-icon{aspect-ratio:auto;height:32px;min-height:32px}
 body #create.job-stage .job-product-name{font-size:8px;margin-top:3px}
 body #create.name-stage .name-step-panel{overflow-y:auto;overflow-x:hidden;gap:10px;grid-template-rows:max-content max-content;align-items:start;align-content:start}
 body #create.name-stage .name-character-card,body #create.name-stage .name-entry-panel{flex-shrink:0}
 body #create.name-stage .name-character-card{min-height:96px}
 body #create.name-stage .name-entry-description{font-size:11px;line-height:1.5;margin-top:8px}
 body #create.name-stage .name-save-note{font-size:10px;line-height:1.5;margin-top:8px}
 body #create #create-error{flex:none;font-size:11px;line-height:1.4;margin:4px 0}
 body #login{box-sizing:border-box;max-height:calc(100dvh - 16px);padding:16px 20px;overflow:auto}
 body #login h2{font-size:22px;margin:6px 0}
 body #login #login-form{gap:4px;margin-top:8px}
 body #login #login-form input{font-size:16px;padding:8px 10px}
 body #login #login-form .create-actions{margin-top:8px;padding-top:8px}
 body #login .line-login-section{margin:10px 0 6px}
 body #login #login-google{margin-top:10px}
 body #login #login-google-status{margin:6px 0;font-size:11px}
}
@media(max-width:700px) and (max-height:650px){
 body #select .select-wordmark{font-size:20px;min-height:36px;padding-left:42px}
 body #select .select-wordmark>span{font-size:7px}
 body #select .select-dragon-crest{width:32px;height:36px}
 body #select .slot .slot-miniature{width:48px;height:48px}
 body #select .slot-number{top:8px;left:10px}
 body #select .slot-indicator{top:8px;right:10px}
 body #create.spell-stage .spell-school-card{padding:12px 8px;gap:6px}
 body #create.spell-stage .spell-school-sigil{width:44px;height:44px;max-height:44px;min-height:0;font-size:30px;margin:2px}
 body #create.spell-stage .spell-school-card strong{font-size:17px}
 body #create.spell-stage .spell-school-caption{font-size:8px}
 body #create.spell-stage .spell-school-selection,body #create.spell-stage .spell-school-hint{font-size:10px}
 body #create.name-stage .name-entry-caption{margin-bottom:5px}
 body #create.name-stage .name-character-card{min-height:80px;grid-template-columns:60px minmax(0,1fr)}
 body #create.name-stage .name-portrait-frame{width:60px}
}
@media(max-height:500px) and (orientation:landscape) and (pointer:coarse){
 body #select .select-inner{width:100%;grid-template-columns:1fr;gap:4px}
 body #select .select-header{flex-wrap:nowrap;height:44px}
 body #select .select-wordmark{width:auto;font-size:20px;min-height:36px;padding-left:42px}
 body #select .select-wordmark>span{font-size:7px}
 body #select .select-dragon-crest{width:32px;height:36px}
 body #select #select-logout{width:130px;min-height:44px;font-size:12px}
 body #select .select-heading{display:none}
 body #select #slot-list{grid-template-columns:repeat(4,minmax(0,1fr));grid-template-rows:1fr}
 body #select .select-inner{grid-template-rows:auto minmax(0,1fr) auto}
 body #select .select-footer{flex-direction:row;justify-content:center;gap:14px}
 body #select .slot-number,body #select .slot-indicator{font-size:11px}
 body #select .slot.empty b{font-size:12px}
 body #select .slot-add{width:32px;height:32px;font-size:24px}
 body #create.class-stage,body #create.creation-hall{gap:4px;padding-block:8px}
 body #create.creation-hall .creation-stage-header{grid-template-columns:1fr auto;align-items:center;gap:0 12px}
 body #create.creation-hall .creation-stage-header>.eyebrow{grid-column:2;grid-row:1/3;border:0}
 body #create.creation-hall h2{grid-column:1;grid-row:1;font-size:26px}
 body #create.creation-hall #creation-subtitle{grid-column:1;grid-row:2;margin:0;font-size:10px}
 body #create.creation-hall .creation-step-panel .face-options{grid-template-columns:repeat(6,minmax(0,1fr));grid-template-rows:minmax(0,1fr);gap:12px}
 body #create.creation-hall .face-pagination{height:44px;margin:0}
 body #create.job-stage .job-layout{grid-template-columns:1fr 1.1fr;grid-template-rows:minmax(0,1fr)}
 body #create.job-stage .job-tool{display:none}
 body #create.name-stage .name-step-panel{grid-template-rows:minmax(0,1fr);grid-template-columns:.8fr 1.2fr;gap:20px}
 body #create.name-stage #create-name{min-height:44px;font-size:16px}
 body #create.name-stage .creation-main{padding-bottom:0}
}
@media(max-width:700px),(max-height:500px) and (pointer:coarse){
 body #select .select-header{display:grid;grid-template-columns:1fr auto;align-items:center}
 body #select .select-wordmark{grid-column:1/-1}
 body #select .select-header .language-picker{grid-column:2;grid-row:2;margin:0;justify-self:end}
 body #select #select-logout{grid-column:1;grid-row:2}
 body #select-notice{top:auto;bottom:92px;width:max-content;max-width:calc(100% - 24px);padding:6px 12px;font-size:11px;pointer-events:none}
 body #create.creation-hall #create-confirm{white-space:nowrap;font-size:14px}
}
@media(max-height:500px) and (orientation:landscape) and (pointer:coarse){
 body #select .select-header{grid-template-columns:1fr auto auto}
 body #select .select-wordmark{grid-column:1}
 body #select #select-logout{grid-column:2;grid-row:1}
 body #select .select-header .language-picker{grid-column:3;grid-row:1}
 body #select.line-select-with-controls .select-inner{grid-template-rows:auto minmax(0,1fr) auto auto}
 body #select .line-account-controls{grid-row:4}
}
@media(max-width:350px){
 body #create.creation-hall .create-actions{grid-template-columns:.8fr .9fr 1.8fr}
 body #create.creation-hall #create-confirm{font-size:13px}
}
@media(max-height:500px) and (pointer:coarse){
 body #login.login-landscape[open]{display:grid;grid-template-columns:1.2fr 1fr;gap:4px 20px;width:min(720px,calc(100% - 24px));max-width:720px;padding:12px 18px}
 body #login.login-landscape>.eyebrow,body #login.login-landscape>h2{grid-column:1/-1;margin:0}
 body #login.login-landscape #login-form{grid-column:1;grid-row:3/6;margin:0}
 body #login.login-landscape .login-home{grid-column:2;grid-row:5;margin:4px 0 0}
 body #login.login-landscape .line-login-section{grid-column:2;grid-row:6;align-self:start;margin:8px 0 0}
 body #login.login-landscape #login-google{grid-column:2;grid-row:3;align-self:end;margin:0}
 body #login.login-landscape #login-google-status{grid-column:2;grid-row:4;margin:0}
 body #login.login-landscape #login-form label{margin:0}
 body #login.login-landscape #login-form .create-actions{margin:0;padding:0}
 body #login.login-landscape #login-form .create-actions button{min-height:44px}
}

/* Logged-in pages add a server message and put LINE controls inside the footer.
   Name the rows explicitly so an asynchronous message cannot take the roster row. */
@media(max-width:700px),(max-height:500px) and (pointer:coarse){
 body #select .select-inner,body #select.line-select-with-controls .select-inner{
  grid-template-columns:minmax(0,1fr);
  grid-template-areas:'header' 'heading' 'message' 'feedback' 'roster' 'actions';
  grid-template-rows:auto auto auto auto minmax(0,1fr) auto;
 }
 body #select .select-header{grid-area:header}
 body #select .select-heading{grid-area:heading}
 body #select .login-motd{grid-area:message;min-width:0;max-height:3lh;overflow:auto;margin:0;text-align:center;font-size:11px;line-height:1.4;overflow-wrap:anywhere}
 body #select .login-motd:empty{display:none}
 body #select-notice{grid-area:feedback;position:static;transform:none;width:auto;max-width:100%;margin:0;padding:4px 8px}
 body #select .select-stage{grid-area:roster}
 body #select .select-footer{grid-area:actions;min-width:0}
 body #select .select-footer .line-account-controls{position:static;grid-row:auto;grid-column:auto;margin:0;min-width:0;width:100%}
 body #select .select-footer .line-login-button{max-width:100%;white-space:normal}
}
@media(max-height:500px) and (orientation:landscape) and (pointer:coarse){
 body #select .select-inner,body #select.line-select-with-controls .select-inner{
  grid-template-areas:'header' 'message' 'feedback' 'roster' 'actions';
  grid-template-rows:auto auto auto minmax(0,1fr) auto;
 }
 body #select.line-select-with-controls .select-footer{display:grid;grid-template-columns:minmax(0,1fr) auto minmax(0,1fr);gap:8px;align-items:center}
 body #select.line-select-with-controls #select-ok{width:100%;font-size:16px}
 body #select.line-select-with-controls #select-delete{padding-inline:4px}
 body #select .select-footer .line-account-controls{grid-column:3;grid-row:1}
}
/* Navigation remains available when the installed app has no browser toolbar. */
body .front-home-link{display:inline-flex;align-items:center;justify-content:center;min-height:44px;padding:8px 12px;color:#f2d899;font-size:13px;text-decoration:underline;text-underline-offset:3px}
body #login .login-home{margin:4px 0 0;text-align:center}
body #select .select-footer .front-home-link{flex:none;grid-column:1/-1}
/* Only the row layout needs wrapping; wrapping a column moves Home off-screen. */
@media(max-height:500px) and (orientation:landscape) and (pointer:coarse){
 body #select .select-footer{flex-wrap:wrap}
 body #select .select-footer .front-home-link{flex-basis:100%}
}

/* Keep local GM controls outside the character summary and entry button. */
body #select #select-gm-controls{position:absolute;right:calc(100% + 12px);top:0;width:max-content;max-width:30cqw}
body #select #select-gm-controls[hidden]{display:none}
body #select #select-gm-controls button{min-height:44px;max-width:100%;padding:8px 12px;font:12px/1.4 var(--select-type);white-space:normal}
@media(max-width:700px),(max-height:500px) and (pointer:coarse){
 body #select #select-gm-controls{position:static;width:auto;max-width:100%;flex:none;grid-column:1/-1}
}
