/* Mobile is a fixed working surface. Optional controls occupy a compact panel. */
#mobile-dock,#mobile-panel,#mobile-aux,#mobile-status{display:none}
.mobile-layout.booting #mobile-dock{visibility:hidden}
html.mobile-viewport{height:100%;overflow:hidden;scrollbar-gutter:auto;overscroll-behavior:none}
body.mobile-layout{height:100%;overflow:hidden;overscroll-behavior:none;--safe-top:env(safe-area-inset-top,0px);--safe-bottom:env(safe-area-inset-bottom,0px);--safe-left:env(safe-area-inset-left,0px);--safe-right:env(safe-area-inset-right,0px)}
.mobile-layout .app{position:fixed;inset:0;max-width:none;margin:0;padding:0;overflow:hidden}
.mobile-layout .workspace{display:block;padding:0;height:100%;width:100%}
.mobile-layout .play-area{position:absolute;left:var(--safe-left);right:var(--safe-right);top:var(--mobile-play-top,8px);width:var(--mobile-shell,calc(100vw - 26px));max-width:none;margin:0 auto;transform-origin:top left;display:flex;flex-direction:column;gap:0}
.mobile-layout #sidebar,.mobile-layout #focus-rail,.mobile-layout #history-panel,.mobile-layout .corner-brand,.mobile-layout footer,.mobile-layout #toolbar-home,.mobile-layout .board-toolbar,.mobile-layout #mobile-review-home{display:none!important}
.mobile-layout .player-row{height:40px;min-height:40px;margin:0;gap:7px;flex-shrink:0}
.mobile-layout .bottom-player{margin:4px 0 0}
.mobile-layout .player-info{min-width:0;overflow:hidden}
.mobile-layout .player-info strong{display:block;font-size:14px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.mobile-layout .player-info>span,.mobile-layout .tag,.mobile-layout .pill-slot{display:none}
.mobile-layout .avatar{height:28px;width:28px;min-width:28px;font-size:22px;border-radius:9px}
.mobile-layout .you-avatar{font-size:16px}
.mobile-layout .player-feedback{height:36px;width:36px;min-width:36px;font-size:13px}
.mobile-layout .clock{font-size:18px;min-width:60px;padding:4px 6px;line-height:1.3;flex-shrink:0}
.mobile-layout .board-wrap{width:100%;flex-shrink:0}
.mobile-layout .board-shell{padding:3px;border-radius:9px}
.mobile-layout .evaluation{left:-11px;top:4px;bottom:4px;width:7px}
.mobile-layout #eval-value{font-size:10px}
.mobile-layout #mobile-status{display:block;margin:0;padding:3px 4px;width:100%;height:28px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;color:#d1bacb;font-size:12px;line-height:22px;text-align:center;background:transparent;border-radius:7px}
.mobile-layout #mobile-status:active{background:#f4abc918}
.mobile-layout #mobile-dock{position:fixed;display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:3px;left:max(7px,var(--safe-left));right:max(7px,var(--safe-right));top:calc(var(--mobile-visible-top,0px) + var(--mobile-visible-height,100dvh) - var(--safe-bottom) - 61px);height:54px;padding:4px;border:1px solid #f4abc933;border-radius:18px;background:#27212cf7;box-shadow:0 4px 25px #0005;z-index:450}
.mobile-layout #mobile-dock button{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;min-width:0;min-height:44px;padding:2px;border:0;border-radius:12px;background:transparent;color:#d8c3d2;touch-action:manipulation;transition:background calc(220ms * var(--motion-factor,1)),transform calc(250ms * var(--motion-factor,1)) var(--ease),color 200ms}
.mobile-layout #mobile-dock button>span:first-child{font-size:21px;line-height:20px}
.mobile-layout #mobile-dock button>span:last-child{font-size:12px;line-height:14px;white-space:nowrap}
.mobile-layout #mobile-dock button[aria-expanded=true]{background:#f4abc92b;color:#ffdaeb}
.mobile-layout #mobile-dock button:active{transform:scale(.92);background:#f4abc933}
.mobile-layout #mobile-dock button:disabled{opacity:.38}
.mobile-layout #mobile-panel{display:flex;flex-direction:column;position:fixed;left:max(10px,var(--safe-left));right:max(10px,var(--safe-right));bottom:calc(100% - var(--mobile-visible-top,0px) - var(--mobile-visible-height,100dvh) + var(--safe-bottom) + 72px);max-width:440px;height:min(440px,calc(var(--mobile-visible-height,100dvh) - var(--safe-top) - var(--safe-bottom) - 90px));margin-inline:auto;background:#2b2330fa;border:1px solid #b780a16b;border-radius:24px;box-shadow:0 16px 40px #0006;z-index:500;transform-origin:50% 100%;overflow:hidden;transition:opacity calc(140ms * var(--motion-factor,1));isolation:isolate}
.mobile-layout #mobile-panel[hidden]{display:none}
.mobile-layout #mobile-panel.placing{opacity:0!important;pointer-events:none}
.mobile-panel-heading{display:flex;align-items:center;justify-content:space-between;padding:8px 12px 2px 18px;flex-shrink:0;height:48px}
.mobile-panel-heading h2{font-size:16px;line-height:1.4}
#mobile-panel-close{background:#f4abc910;border-radius:50%;width:38px;height:38px;font-size:26px;color:#f4cadf;padding:0;transition:background 200ms,transform 220ms}
#mobile-panel-close:active{background:#f4abc930;transform:scale(.9)}
#mobile-tabs{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:4px;padding:5px 12px 9px;flex-shrink:0}
#mobile-tabs:has(>button:only-child){display:none}
#mobile-tabs button{border:1px solid #f4abc917;border-radius:11px;background:#17111b44;padding:8px 3px;min-height:36px;font-size:13px;line-height:18px;transition:background calc(240ms * var(--motion-factor,1)),border-color 220ms,color 220ms,transform 220ms}
#mobile-tabs button[aria-selected=true]{background:#f4abc92a;border-color:#f4abc963;color:#ffd8e9}
#mobile-tabs button:active{transform:scale(.95)}
#mobile-panel-content{min-height:0;overflow:auto;overflow-x:hidden;overscroll-behavior:contain;padding:0 16px 14px;scroll-padding:8px;scrollbar-width:thin;scrollbar-color:#9c6d8e transparent;overflow-anchor:none}
#mobile-panel-content>.field-label{font-size:14px;margin:9px 0 5px}
#mobile-panel-content .option-row{min-height:40px;font-size:14px;margin:0;padding:6px 0;line-height:1.5}
#mobile-panel-content input[type=checkbox]{min-width:20px;min-height:20px;accent-color:var(--pink)}
#mobile-panel-content input[type=text],#mobile-panel-content input[type=number],#mobile-panel-content textarea{font-size:16px;min-height:40px}
#mobile-panel-content .micro,#mobile-panel-content .mobile-help{font-size:12px;line-height:1.55;color:#c9b5c5}
#mobile-panel-content .mobile-help{margin:10px 0 0}
#mobile-panel-content .section-label{font-size:14px;margin-top:10px}
#mobile-panel-content .fluid-range{height:40px;margin:0}
#mobile-panel-content .morph-select{position:relative;overflow:visible;margin-bottom:5px;z-index:1}
#mobile-panel-content .morph-select.open{z-index:5}
#mobile-panel-content .select-trigger{min-height:42px;font-size:14px;padding:10px 12px}
#mobile-panel-content .select-options{position:absolute;left:-1px;right:-1px;top:100%;border-radius:0 0 14px 14px;box-shadow:0 8px 16px #0004;background:#382b3b;z-index:6}
#mobile-panel-content .opens-up .select-options{top:auto;bottom:100%;border-radius:14px 14px 0 0;transform-origin:bottom}
#mobile-panel-content .select-options>div{max-height:180px;overscroll-behavior:contain}
#mobile-panel-content .morph-select.open .select-options>div{overflow:auto}
#mobile-panel-content .select-options button{min-height:40px;font-size:14px}
#mobile-panel-content>.primary,#mobile-panel-content>.secondary,#mobile-panel-content>.icon-button{width:100%;min-height:44px;display:flex;justify-content:center;gap:8px;margin:6px 0;padding:10px;font-size:14px}
#mobile-panel-content #editor-close{display:block;width:100%;min-height:44px;font-size:14px;padding:8px;grid-column:1/-1}
#mobile-panel-content .sidebar-credit{margin:10px 0 0;padding:0;text-align:center}
#mobile-panel-content #analysis-info{font-size:12px;margin-top:8px}
#mobile-panel-content #new-game>span:last-child{margin-left:auto}
#mobile-panel-content .card-heading{padding:3px 0 12px}
#mobile-panel-content .card-heading h2{font-size:15px}
#mobile-panel-content .card-heading p{font-size:12px}
#mobile-panel-content .no-rules-option{padding:6px 0}
#mobile-panel-content .time-presets{display:grid;grid-template-columns:repeat(4,1fr);gap:5px;margin:4px 0 8px}
#mobile-panel-content .time-presets button{padding:7px 2px;min-height:44px}
#mobile-panel-content .custom-time{margin:8px 0}
#mobile-panel-content #piece-sets{grid-template-columns:repeat(2,1fr);gap:8px}
#mobile-panel-content #piece-sets button{padding:7px;min-height:80px;font-size:14px}
#mobile-panel-content #piece-sets img{height:35px;width:35px}
#mobile-panel-content .cheat-tools{display:flex;gap:8px;margin-top:8px}
#mobile-panel-content .cheat-tools button{flex:1;min-height:44px}
#mobile-panel-content .spawn-colors{margin-top:6px}
#mobile-panel-content .spawn-colors button{min-height:40px;font-size:13px}
#mobile-panel-content #spawn-shelf button{min-height:48px}
#mobile-panel-content #editor-palette{grid-template-columns:repeat(6,1fr);margin:8px 0}
#mobile-panel-content #editor-palette button{min-height:40px;padding:2px}
#mobile-panel[data-group=editor][data-page=pieces] #mobile-panel-content{display:grid;grid-template-columns:1fr 1fr;gap:5px}
#mobile-panel[data-group=editor][data-page=pieces] #editor-palette,#mobile-panel[data-group=editor][data-page=pieces] .mobile-help{grid-column:1/-1}
#mobile-panel-content #review-verdict{height:auto;min-height:160px;max-height:240px;overflow:auto;margin-top:5px;font-size:14px}
#mobile-panel-content .rating-grid{gap:8px}
#mobile-panel-content .rating-card{padding:10px 8px}
#mobile-panel-content .rating-grid strong{font-size:25px}
#mobile-panel-content #elo-estimate-status{min-height:0}
#mobile-panel-content .review-moment{min-height:44px;font-size:13px}
#mobile-panel-content #moves-settings{margin:4px 0 0;border:0}
#mobile-panel-content .moves-scroll{height:180px;max-height:40dvh}
#mobile-panel-content .status{font-size:13px}
.mobile-layout #mobile-aux{position:relative;display:flex;flex-direction:column;height:44px;flex-shrink:0;gap:4px;width:min(calc(100vw - 20px),max(var(--mobile-shell),300px));align-self:center;margin-top:4px}
.mobile-layout #mobile-aux[hidden]{display:none}
.mobile-layout #mobile-aux.review-controls{height:160px}
.mobile-layout #mobile-aux:not(.review-controls)>#review-chart,.mobile-layout #mobile-aux:not(.review-controls)>#review-transport{display:none}
.mobile-layout #mobile-aux #review-chart{width:calc(100% - 96px);height:32px;flex-shrink:0;min-height:32px;border-radius:7px}
.mobile-layout #mobile-aux #review-transport{position:static;contain:none;margin:0;padding:0;background:transparent;border:0}
.mobile-layout #mobile-aux .review-nav{gap:2px;margin:4px 0 0;height:44px}
.mobile-layout #mobile-aux .review-nav button{min-width:38px;height:44px;padding:4px 7px;flex:1;font-size:17px}
.mobile-layout #mobile-aux #review-position{min-width:46px;text-align:center;font-size:12px}
.mobile-layout #mobile-aux .fluid-range{height:28px;margin:0}
.mobile-layout #mobile-aux #mobile-review-close{display:block;position:absolute;top:48px;right:0;font-size:12px;width:91px;height:32px;margin:0;padding:3px;background:#f4abc910;border-radius:8px}
.mobile-layout #toast{bottom:calc(var(--safe-bottom) + 75px);max-width:calc(100vw - 24px);font-size:13px;z-index:1400}
.mobile-layout #result-surface{padding:14px;max-height:100%;overflow:auto}
.mobile-layout #result-surface h2{font-size:24px}
.mobile-layout #result-symbol{font-size:40px}
.mobile-layout #result-detail{font-size:13px;margin:8px 0 12px}
.mobile-layout #result-surface button{min-height:40px}
.mobile-layout.intro-reveal #mobile-dock{animation:intro-ui 650ms cubic-bezier(.22,1,.36,1) 400ms both}
.mobile-layout.mobile-landscape .play-area{left:calc(var(--safe-left) + 15px);right:auto;margin:0}
.mobile-landscape #mobile-dock{left:calc(var(--mobile-shell) + var(--safe-left) + 37px);grid-template-columns:repeat(3,minmax(0,1fr));height:108px;top:calc(var(--mobile-visible-top,0px) + var(--mobile-visible-height,100dvh) - var(--safe-bottom) - 115px)}
.mobile-landscape #mobile-panel{left:auto;right:max(8px,var(--safe-right));width:min(380px,calc(100vw - var(--mobile-shell) - var(--safe-left) - var(--safe-right) - 37px));height:calc(var(--mobile-visible-height,100dvh) - var(--safe-top) - var(--safe-bottom) - 16px);bottom:calc(100% - var(--mobile-visible-top,0px) - var(--mobile-visible-height,100dvh) + var(--safe-bottom) + 8px);border-radius:18px}
.mobile-landscape #mobile-tabs{padding-bottom:5px;gap:3px}
.mobile-landscape #mobile-tabs button{min-height:32px;padding:5px 2px;font-size:12px}
.mobile-landscape .mobile-panel-heading{height:44px}
.mobile-landscape #mobile-panel-content{padding:0 10px 10px}
.mobile-landscape #mobile-aux{position:absolute;left:calc(100% + 22px);top:0;align-self:auto;width:calc(100vw - var(--mobile-shell) - var(--safe-left) - var(--safe-right) - 45px);margin:0}
.mobile-landscape #mobile-status{position:absolute;left:calc(100% + 22px);top:calc(var(--mobile-aux-height) + 8px);width:calc(100vw - var(--mobile-shell) - var(--safe-left) - var(--safe-right) - 45px);height:40px;white-space:normal;line-height:18px}
.mobile-landscape:not(.reviewing) #mobile-status{top:56px}
.mobile-layout.no-motion #mobile-panel,.mobile-layout.no-motion #mobile-dock button,.mobile-layout.no-motion #mobile-tabs button{transition:none;animation:none}

/* Notation stays next to the board in both play and review. */
#mobile-notation{display:flex;align-items:center;gap:6px;height:44px;min-height:44px;min-width:0;width:100%}
#mobile-moves-button{flex:0 0 56px;height:44px;padding:0 5px;background:#f4abc916;border:1px solid #f4abc936;border-radius:10px;color:#f7cadd;font-size:13px;font-weight:600;touch-action:manipulation}
#mobile-move-strip{display:flex;align-items:center;gap:4px;height:44px;min-width:0;flex:1;overflow-x:auto;overflow-y:hidden;overscroll-behavior-x:contain;scrollbar-width:none;touch-action:pan-x;scroll-padding-inline:8px;-webkit-overflow-scrolling:touch}
#mobile-move-strip::-webkit-scrollbar{display:none}
#mobile-move-strip button{flex:0 0 auto;min-height:42px;padding:7px 9px;border:1px solid transparent;border-radius:10px;background:#ffffff04;color:#d9c9d6;font-size:14px;font-variant-numeric:tabular-nums;white-space:nowrap;touch-action:pan-x;transition:background calc(220ms * var(--motion-factor,1)),color calc(180ms * var(--motion-factor,1)),border-color calc(220ms * var(--motion-factor,1)),transform calc(200ms * var(--motion-factor,1)) var(--ease)}
#mobile-move-strip button[aria-current=step]{background:#f4abc92c;border-color:#f4abc968;color:#ffdaeb}
#mobile-move-strip button:active,#mobile-moves-button:active{transform:scale(.95);background:#f4abc938}
#mobile-move-strip .notation-empty{color:#ba9fb4;font-size:13px;white-space:nowrap;padding:0 8px}
#mobile-panel[data-page=moves] #mobile-panel-content{display:flex;flex:1;flex-direction:column;overflow:hidden}
#mobile-panel[data-page=moves] #moves-settings{display:flex;flex:1;flex-direction:column;min-height:0;width:100%}
#mobile-panel[data-page=moves] .moves-scroll{flex:1;height:auto;min-height:0;max-height:none;overflow:auto}
#mobile-panel[data-page=moves] .moves-heading{flex-shrink:0;padding:8px 0 12px}
#mobile-panel[data-page=moves] .status{flex-shrink:0;padding:8px 0}
#mobile-panel-content .move-row{padding:3px 2px;grid-template-columns:28px minmax(0,1fr) minmax(0,1fr);gap:4px;align-items:center}
#mobile-panel-content .move-row>.move-cell{display:flex;align-items:center;min-height:44px;padding:5px 8px;font-size:16px;white-space:nowrap;overflow-x:auto;scrollbar-width:none}
#mobile-panel-content .move-cell-current{background:#f4abc924;color:#ffd7e9}
#mobile-panel-content .move-cell[role=button]{touch-action:manipulation;cursor:pointer}
#mobile-panel-content .move-cell:focus-visible{outline:2px solid var(--pink);outline-offset:-2px}
.mobile-layout #mobile-aux .review-nav button{touch-action:manipulation}
