/* Owner UX consolidation: scoped home, authentication and waiting-room layout.
   This layer changes presentation only; room authority and plugin geometry stay intact. */

/* Compact platform chrome. A medium-width desktop keeps one horizontal row
   instead of stretching a wrapped navigation row to the header's full height. */
.app-shell:not([data-route=waiting]):not([data-route=playing])>.topbar{
  display:grid;grid-template-columns:clamp(168px,15vw,220px) minmax(0,1fr) auto;
  align-items:center;height:66px;min-height:66px;padding:6px clamp(14px,2.2vw,34px);gap:12px
}
.app-shell:not([data-route=waiting]):not([data-route=playing])>.topbar .brand{width:100%;min-width:0;max-width:220px}
.app-shell:not([data-route=waiting]):not([data-route=playing])>.topbar .mainnav{
  min-width:0;width:100%;height:54px;justify-content:flex-start;overflow-x:auto;overflow-y:hidden;
  scrollbar-width:none;overscroll-behavior-inline:contain
}
.app-shell:not([data-route=waiting]):not([data-route=playing])>.topbar .mainnav::-webkit-scrollbar{display:none}
.app-shell:not([data-route=waiting]):not([data-route=playing])>.topbar .mainnav a{
  flex:0 0 auto;min-height:50px;height:50px;padding:6px 9px;gap:5px;font-size:12px
}
.app-shell:not([data-route=waiting]):not([data-route=playing])>.topbar .mainnav svg{width:16px;height:16px}
.app-shell:not([data-route=waiting]):not([data-route=playing])>.review-strip{
  min-height:30px;padding:4px clamp(14px,2.2vw,34px);flex-wrap:nowrap;line-height:1.35
}
.review-strip .audio-quick{display:flex;gap:6px;margin-left:auto}
.review-strip .audio-quick button{min-height:25px;padding:2px 9px;border-radius:6px;font-size:10px}

/* A game card has one content surface, without a detached CTA bar. */
.game-card-entry{
  width:auto!important;min-height:0!important;margin-top:auto;padding:0!important;border:0!important;
  display:inline-flex!important;justify-content:flex-start!important;gap:7px
}

/* Authentication: the card is compact enough for normal viewports. If the
   keyboard or accessibility zoom reduces the viewport, the auth page itself
   is the single scroll container; the form never gets a nested scrollbar. */
.auth-shell>.app-scroll{overflow:hidden}
.auth-shell .auth-page.fixed-page{display:grid;place-items:center end;overflow-y:auto;overflow-x:hidden;padding:16px clamp(18px,6vw,86px)}
.auth-shell .auth-panel{width:min(430px,100%);max-height:none;overflow:visible;padding:18px 26px}
.auth-shell .auth-panel>.page-heading{padding:0;display:contents}
.auth-shell .auth-panel>.page-content-scroll{display:contents;overflow:visible;padding:0}
.auth-shell .r2-auth-brand{width:min(270px,72%);margin:0 auto 8px}
.auth-shell .auth-utilities{display:flex;align-items:center;justify-content:flex-end;gap:8px;margin-bottom:8px}
.auth-shell .auth-utilities .input{width:142px;min-height:36px;padding:6px 30px 6px 10px;font-size:13px}
.auth-shell .auth-music-toggle{min-height:36px!important;padding:6px 10px;white-space:nowrap}
.auth-shell .auth-panel .tabs{margin:0 0 8px}
.auth-shell .auth-panel .tabs button{min-height:38px;padding:7px 18px}
.auth-shell .auth-panel h1{font-size:23px;line-height:1.25}
.auth-shell .auth-panel p.subtitle{margin:4px 0 10px}
.auth-shell .auth-panel label.field{margin-bottom:10px}
.auth-shell .auth-panel .input{min-height:41px;padding-top:8px;padding-bottom:8px}
.auth-shell .auth-forgot{display:flex;justify-content:flex-end;margin:-2px 0 8px}
.auth-shell .auth-password-rule{margin:-3px 0 8px}
.auth-shell .remember-login{display:flex;align-items:center;gap:9px;margin:2px 0 2px;line-height:1.25}
.auth-shell .remember-login input{width:18px;height:18px;flex:none}
.auth-shell .remember-login span{display:flex;align-items:baseline;gap:8px;flex-wrap:wrap}
.auth-shell .remember-login small{display:inline;font-size:10px}
.auth-shell .remember-help{margin:0 0 8px;font-size:10px;color:var(--text-muted)}
.auth-shell .remember-help summary{cursor:pointer;width:max-content;color:var(--accent-primary)}
.auth-shell .remember-help p{margin:3px 0 0;line-height:1.4}
.auth-shell .auth-consent{margin:0 0 8px;gap:8px}
.auth-shell .auth-panel form>.btn[type=submit]{min-height:42px}
.auth-shell .auth-panel .or{margin:9px 0}
.auth-shell .auth-panel>.page-content-scroll>.btn[data-action=guest],
.auth-shell .auth-panel>.btn[data-action=guest]{min-height:42px}
.auth-shell .auth-note{margin-top:7px;line-height:1.4}
.auth-shell .auth-guest-note{margin-bottom:0}

/* Waiting room: fixed summary + stage + command bar. Only dialogs and chat
   history scroll. The approved plugin still owns seat coordinates and tokens. */
.app-shell[data-route=waiting] .fixed-page{padding:0!important}
.app-shell[data-route=waiting] .fixed-page>.page-content-scroll{overflow:hidden;padding:0;scrollbar-gutter:auto}
.waiting-room-shell{--room-chat-bottom:92px;height:100%;min-height:0;position:relative;display:grid;grid-template-rows:auto minmax(0,1fr)}
.room-summary{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:1px;border-bottom:1px solid var(--border-subtle);background:var(--surface-secondary)}
.room-summary>span{min-width:0;padding:6px 10px;text-align:center;border-right:1px solid var(--border-subtle)}
.room-summary>span:last-child{border-right:0}.room-summary b,.room-summary small{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.room-summary b{font-size:12px}.room-summary small{font-size:9px;color:var(--text-muted)}
.waiting-main{min-height:0;display:grid;grid-template-rows:minmax(0,1fr) auto;gap:7px;padding:7px clamp(8px,1.4vw,20px) max(7px,env(safe-area-inset-bottom,0px))}
.waiting-stage-shell{min-height:0;display:grid;place-items:center;overflow:hidden}
.waiting-stage-shell>.r2-waiting{width:min(100%,1420px)!important;max-width:none!important;height:100%!important;min-height:220px;margin:0 auto!important}
.waiting-commandbar{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:8px;padding:7px;border:1px solid var(--border-primary);border-radius:11px;background:color-mix(in srgb,var(--surface-primary) 94%,transparent);box-shadow:var(--shadow-soft)}
.room-primary-actions,.room-secondary-actions{display:flex;align-items:center;gap:7px;min-width:0}
.room-primary-actions .btn{min-width:150px}.room-secondary-actions{justify-content:flex-end}
.room-secondary-actions>.btn{min-height:38px;padding:6px 12px}
.practice-opponent-control{display:grid;grid-template-columns:auto minmax(130px,160px);align-items:center;gap:2px 7px;padding:3px 7px;border-left:1px solid var(--border-subtle)}
.practice-opponent-control>span{font-size:10px;color:var(--text-secondary)}
.practice-opponent-control .input{grid-row:1/3;grid-column:2;min-height:38px;padding:5px 25px 5px 8px;font-size:11px}
.practice-opponent-control small{font-size:8px;color:var(--text-muted)}
.room-detail-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px}.room-detail-grid .panel{box-shadow:none}

/* One room-chat view, backed by the existing room stream and command. */
.room-chat-launcher{position:absolute;right:max(12px,env(safe-area-inset-right,0px));bottom:var(--room-chat-bottom);z-index:7;min-width:86px;min-height:42px;display:flex;align-items:center;justify-content:center;gap:7px;padding:8px 13px;border:1px solid var(--accent-primary);border-radius:22px;background:color-mix(in srgb,var(--surface-primary) 92%,transparent);color:var(--text-primary);box-shadow:var(--shadow-strong);backdrop-filter:blur(12px)}
.room-chat-launcher svg{width:17px;height:17px}.room-chat-launcher i{min-width:18px;height:18px;padding:0 4px;display:grid;place-items:center;border-radius:9px;background:var(--danger);color:#fff;font-size:9px;font-style:normal}
.room-chat-window{position:absolute;right:max(12px,env(safe-area-inset-right,0px));bottom:var(--room-chat-bottom);z-index:7;width:min(370px,calc(100% - 24px));height:min(330px,calc(100% - var(--room-chat-bottom) - 12px));min-height:210px;display:grid;grid-template-rows:auto minmax(0,1fr) auto;border:1px solid var(--border-primary);border-radius:14px;overflow:hidden;background:color-mix(in srgb,var(--surface-primary) 88%,transparent);box-shadow:var(--shadow-strong);backdrop-filter:blur(16px)}
.room-chat-window.maximized{width:min(620px,calc(100% - 24px));height:calc(100% - var(--room-chat-bottom) - 12px)}
.room-chat-window>header{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:8px 10px;border-bottom:1px solid var(--border-subtle);background:color-mix(in srgb,var(--surface-secondary) 91%,transparent)}
.room-chat-window>header>div{display:flex;align-items:center;gap:7px}.room-chat-window>header b{font-size:12px}.room-chat-window>header small{font-size:9px;color:var(--text-muted)}
.room-chat-window>header .iconbtn{width:34px;height:32px;padding:4px;border:1px solid var(--border-subtle)}
.room-chat-log{min-height:0;overflow-y:auto;overscroll-behavior:contain;padding:9px 11px;scrollbar-gutter:stable}
.room-chat-message{display:grid;grid-template-columns:minmax(70px,.35fr) minmax(0,1fr);gap:8px;padding:7px 0;border-bottom:1px solid var(--border-subtle);font-size:11px}
.room-chat-message b{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.room-chat-message span{white-space:pre-wrap;overflow-wrap:anywhere;color:var(--text-secondary)}
.room-chat-empty{text-align:center;padding:22px 8px}
.room-chat-composer{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:7px;padding:8px;border-top:1px solid var(--border-subtle);background:color-mix(in srgb,var(--surface-secondary) 90%,transparent)}
.room-chat-composer .input{min-height:40px;font-size:16px}.room-chat-composer .btn{min-height:40px;padding:6px 12px}

@media(max-width:1100px){
 .app-shell:not([data-route=waiting]):not([data-route=playing])>.topbar{display:flex;flex-wrap:wrap;height:auto;min-height:64px;padding:7px 14px 0;gap:6px 10px}
 .app-shell:not([data-route=waiting]):not([data-route=playing])>.topbar .brand{width:180px;flex:0 0 180px}
 .app-shell:not([data-route=waiting]):not([data-route=playing])>.topbar .header-user{margin-left:auto}
 .app-shell:not([data-route=waiting]):not([data-route=playing])>.topbar .mainnav{order:3;flex:1 0 100%;height:48px}
 .app-shell:not([data-route=waiting]):not([data-route=playing])>.topbar .mainnav a{height:46px;min-height:46px;padding:4px 9px}
}

@media(max-width:700px){
 .app-shell:not([data-route=waiting]):not([data-route=playing])>.topbar{padding:6px 10px 0}
 .app-shell:not([data-route=waiting]):not([data-route=playing])>.topbar .brand{width:150px;flex-basis:150px}
 .app-shell:not([data-route=waiting]):not([data-route=playing])>.topbar .mainnav a{font-size:10px;padding-inline:7px;gap:2px;flex-direction:column}
 .app-shell:not([data-route=waiting]):not([data-route=playing])>.review-strip{padding:3px 10px;min-height:27px;font-size:9px}
 .review-strip .audio-quick button{min-height:24px;padding:2px 7px}
 .auth-shell .auth-page.fixed-page{place-items:start center;padding:10px}
 .auth-shell .auth-panel{padding:13px 16px;width:min(410px,100%);margin:auto}
 .auth-shell .r2-auth-brand{width:min(210px,62%);margin-bottom:5px}
 .auth-shell .auth-utilities{margin-bottom:5px}.auth-shell .auth-utilities .input{font-size:16px;min-height:38px}
 .auth-shell .auth-panel h1{font-size:21px}.auth-shell .auth-panel p.subtitle{margin:2px 0 7px}
 .auth-shell .auth-panel label.field{margin-bottom:7px}.auth-shell .auth-panel .input{min-height:40px;font-size:16px}
 .auth-shell .auth-panel .or{margin:6px 0}.auth-shell .auth-note{margin-top:5px}
 .waiting-room-shell{--room-chat-bottom:132px}
 .room-summary>span{padding:5px 3px}.room-summary b{font-size:10px}.room-summary small{font-size:8px}
 .waiting-main{padding:5px 7px max(5px,env(safe-area-inset-bottom,0px));gap:5px}
 .waiting-commandbar{grid-template-columns:1fr;padding:5px;gap:5px}
 .room-primary-actions,.room-secondary-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:5px}
 .room-primary-actions .btn,.room-secondary-actions>.btn{min-width:0;min-height:42px;padding:6px 8px;font-size:11px}
 .practice-opponent-control{grid-column:1/-1;border-left:0;border-top:1px solid var(--border-subtle);grid-template-columns:auto minmax(130px,1fr);padding:5px 2px 0}
 .room-detail-grid{grid-template-columns:1fr}.room-detail-grid .panel-body{padding:13px}
 .room-chat-window{width:min(300px,calc(100% - 16px));right:max(8px,env(safe-area-inset-right,0px));height:min(270px,calc(100% - var(--room-chat-bottom) - 8px));bottom:var(--room-chat-bottom)}
 .room-chat-window.maximized{width:calc(100% - 16px);height:calc(100% - var(--room-chat-bottom) - 8px)}
 .room-chat-launcher{right:max(8px,env(safe-area-inset-right,0px));bottom:var(--room-chat-bottom)}
}

@media(orientation:landscape) and (max-height:500px){
 .app-shell:not([data-route=waiting]):not([data-route=playing])>.topbar{display:grid;grid-template-columns:118px minmax(0,1fr) auto;height:48px;min-height:48px;padding:2px max(8px,env(safe-area-inset-right,0px)) 0 max(8px,env(safe-area-inset-left,0px));gap:6px}
 .app-shell:not([data-route=waiting]):not([data-route=playing])>.topbar .brand{width:118px;max-width:118px}
 .app-shell:not([data-route=waiting]):not([data-route=playing])>.topbar .mainnav{order:initial;flex:initial;height:46px}
 .app-shell:not([data-route=waiting]):not([data-route=playing])>.topbar .mainnav a{height:44px;min-height:44px;font-size:9px;padding:2px 6px}
 .app-shell:not([data-route=waiting]):not([data-route=playing])>.review-strip{min-height:20px;padding-block:1px}
 .auth-shell .auth-page.fixed-page{place-items:start end;padding:6px 12px}
 .auth-shell .auth-panel{width:min(720px,100%);display:grid;grid-template-columns:minmax(170px,.72fr) minmax(270px,1fr);gap:4px 18px;padding:8px 16px;margin:auto}
 .auth-shell .auth-panel>.page-heading,.auth-shell .auth-panel>.page-content-scroll{display:contents}
 .auth-shell .r2-auth-brand{grid-column:1;width:min(190px,100%);margin:0 auto 2px}
 .auth-shell .auth-utilities{grid-column:1;margin:0;justify-content:center;flex-wrap:wrap}
 .auth-shell .auth-panel .tabs{grid-column:1;margin:2px 0}.auth-shell .auth-panel h1{grid-column:1;font-size:18px;text-align:center}.auth-shell .auth-panel p.subtitle{grid-column:1;text-align:center}
 .auth-shell .auth-panel form{grid-column:2;grid-row:1/span 6;margin:0}
 .auth-shell .auth-panel>.page-content-scroll>.or,.auth-shell .auth-panel>.or{grid-column:1;margin:3px 0}
 .auth-shell .auth-panel>.page-content-scroll>.btn[data-action=guest],.auth-shell .auth-panel>.btn[data-action=guest]{grid-column:1;min-height:38px}
 .auth-shell .auth-guest-note{grid-column:1}
 .waiting-room-shell{--room-chat-bottom:67px}
 .room-summary>span{padding:2px 5px}.room-summary b{font-size:9px}.room-summary small{font-size:7px}
 .waiting-main{padding:3px 7px;gap:3px}
 .waiting-commandbar{grid-template-columns:minmax(0,1fr) auto;padding:3px;gap:4px}
 .room-primary-actions,.room-secondary-actions{display:flex;gap:4px}.room-primary-actions .btn,.room-secondary-actions>.btn{min-width:0;min-height:36px;padding:4px 8px;font-size:10px}
 .practice-opponent-control{display:flex;grid-column:auto;border:0;padding:0}.practice-opponent-control>span,.practice-opponent-control small{display:none}.practice-opponent-control .input{min-width:130px;min-height:36px;font-size:10px}
 .room-chat-window{width:min(320px,45%);height:min(205px,calc(100% - var(--room-chat-bottom) - 6px));right:max(7px,env(safe-area-inset-right,0px))}
 .room-chat-window.maximized{width:min(560px,calc(100% - 14px));height:calc(100% - var(--room-chat-bottom) - 6px)}
 .room-chat-window>header{padding:4px 7px}.room-chat-log{padding:5px 8px}.room-chat-composer{padding:5px}.room-chat-composer .input,.room-chat-composer .btn{min-height:36px}
}

@media(max-height:620px) and (orientation:portrait){
 .auth-shell .r2-auth-brand{width:170px}.auth-shell .auth-panel p.subtitle{display:none}
 .auth-shell .auth-panel{margin:0 auto}.auth-shell .auth-guest-note{display:none}
}

@media(prefers-reduced-motion:reduce){.room-chat-window,.room-chat-launcher{transition:none}}
