body.site-page { margin: 0; height: auto; min-height: 100svh; overflow: auto; color: var(--text); background: var(--surface-page); font-family: var(--font-body); }
body.site-page .app-shell { display: block; width: 100%; max-width: none; height: auto; min-height: 100svh; margin: 0; padding: 0; overflow: visible; background: none; }
body.site-page .hub-header { position: relative; z-index: 60; display: flex; align-items: center; justify-content: space-between; gap: 22px; width: 100%; min-height: 78px; padding: 18px 28px; margin: 0; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; color: var(--text); background: var(--surface); box-shadow: none; }
.site-page .hub-brand { display: flex; align-items: center; gap: 9px; white-space: nowrap; font-size: 23px; font-weight: 850; letter-spacing: -.8px; text-decoration: none; color: var(--text); }
.hub-brand-logo { width: 30px; height: 30px; flex: none; transition: transform .25s ease; }
.hub-brand:hover .hub-brand-logo { transform: rotate(-8deg); }
.hub-brand-name em { font-style: normal; font-weight: 600; color: var(--text-muted); }
.site-page .site-navigation { display: flex; flex: 1; align-items: center; justify-content: center; gap: 20px; white-space: nowrap; font-weight: 650; }
.site-navigation a { padding: 8px 0; text-decoration: none; color: var(--text); border-bottom: 2px solid transparent; font-size: 14px; }
.site-navigation a[aria-current] { color: var(--accent); border-color: var(--accent); }
.site-account-actions { display: flex; gap: 12px; align-items: center; }
.site-settings-link { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; color: var(--text); font-size: 17px; text-decoration: none; }
.site-settings-link:hover { background: var(--surface-soft); }
.site-theme-menu { position: relative; }
.site-theme-menu > summary { display: flex; gap: 5px; align-items: center; list-style: none; cursor: pointer; color: var(--text); font-size: 13px; }
.site-theme-menu > summary::-webkit-details-marker { display: none; }
.site-theme-menu > .theme-switcher { position: absolute; top: calc(100% + 15px); right: 0; display: grid; gap: 5px; width: 144px; padding: 10px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); z-index: 2; }
.site-page .site-theme-menu .theme-button { display: block; width: 100%; height: auto; padding: 10px; font: inherit; font-size: 13px; border-radius: 8px; }
.site-page .account-menu { position: relative; }
.site-page .account-menu-button { display: flex; gap: 7px; align-items: center; min-height: 38px; width: auto; padding: 4px 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-soft); color: var(--text); font-size: 13px; cursor: pointer; }
.site-page .account-menu-button .avatar { width: 28px; height: 28px; min-width: 28px; }
.mahjong-portal body.site-page .site-theme-menu .theme-switcher { display: grid; }
#mahjongResumeRooms { margin-top: 18px; }
.site-page #topAccountName { max-width: 90px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.account-level-chip { padding: 1px 7px; border-radius: 999px; background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); font-size: 11px; font-weight: 750; font-variant-numeric: tabular-nums; white-space: nowrap; }
.account-level-chip[hidden] { display: none; }
.profile-guest-note { margin: 0 2px; color: var(--text-muted); font-size: 12px; line-height: 1.55; word-break: keep-all; }
.profile-guest-note[hidden] { display: none; }
.profile-title-slot { display: block; margin-top: 5px; }
.profile-title-slot[hidden] { display: none; }
.site-page .account-popover { position: absolute; inset: calc(100% + 12px) 0 auto auto; width: min(430px, calc(100vw - 32px)); max-height: calc(100svh - var(--site-header-height, 78px) - 24px); overflow: hidden auto; z-index: 3; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); padding: 14px; }
.site-page :focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.site-page .stage-title[hidden], .site-page #profileArea, .site-page .mobile-dock { display: none !important; }
body.site-page #playArea { display: block; width: 100%; min-width: 0; min-height: calc(100svh - var(--site-header-height, 78px)); height: auto; max-height: none; padding: 24px; margin: 0; overflow: visible; }
body.site-page #gameSurface { width: 100%; min-width: 0; height: auto; max-height: none; margin: 0; padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; overflow: visible; }
body.site-page #gameSurface .game-layout { width: 100%; max-width: none; margin: 0; }
body.site-page #gameSurface .game-main-panel { min-width: 0; }
.site-page .play-navigation { margin: 0 0 18px; }
.site-page .play-action-row[hidden] { display: none; }
.game-room-page .connect4-clock,
.solo-inline-layout .connect4-clock { flex: 0 0 auto; white-space: nowrap; }
.site-page #contextPanel { z-index: 65; }
.site-page #contextToggle { z-index: 61; }
.site-page .stage:has(.shop-surface), .site-page .stage:has(.settings-surface) { max-width: 1440px; margin: auto !important; }
.site-page .hub-notice { z-index: 120; bottom: 90px; }

.music-dock { position: fixed; right: 10px; bottom: max(10px, env(safe-area-inset-bottom)); z-index: 90; padding: 12px; color: var(--text); }
.music-dock-toggle { display: grid; place-items: center; width: 52px; height: 52px; margin-left: auto; border: 1px solid var(--line); border-radius: 50%; background: var(--surface); color: var(--text); box-shadow: 0 6px 24px #0002; font: inherit; font-size: 26px; cursor: pointer; transition: transform .2s, background .2s; }
.music-dock-toggle.is-playing { color: var(--on-accent); background: var(--accent); border-color: var(--accent); }
.music-dock.is-open .music-dock-toggle { transform: scale(.94); }
.music-dock-popup { position: absolute; right: 12px; bottom: 74px; display: grid; gap: 15px; width: min(330px, calc(100vw - 40px)); padding: 20px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); box-shadow: 0 14px 44px #0003; opacity: 0; visibility: hidden; pointer-events: none; transform: translateY(12px) scale(.96); transform-origin: bottom right; transition: opacity .2s ease, transform .22s ease, visibility .22s; }
.music-dock-popup::after { content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 24px; }
.music-dock.is-open .music-dock-popup { opacity: 1; visibility: visible; pointer-events: auto; transform: none; }
.music-dock .global-music-copy { display: grid; gap: 5px; min-width: 0; }
.music-dock .global-music-copy strong { font-size: 14px; white-space: normal; overflow-wrap: anywhere; }
.music-dock small { color: var(--text-muted); font-size: 11px; }
.music-dock-controls { display: flex; gap: 10px; align-items: center; }
.music-dock-controls button { width: 38px; height: 38px; flex: none; padding: 0; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-soft); color: var(--text); cursor: pointer; }
.music-dock-controls button:disabled { opacity: .45; }
.music-dock-controls label { display: grid; gap: 4px; flex: 1; font-size: 11px; color: var(--text-muted); }
.music-dock-controls input { width: 100%; min-width: 0; min-height: 24px; padding: 0; accent-color: var(--accent); }
.mahjong-portal body.site-page #globalMusicPanel { display: grid !important; }

body.site-page.game-room-page #playArea { display: grid; grid-template-columns: minmax(0, 1fr) 340px; grid-template-rows: auto 1fr; align-items: start; gap: 24px; }
#gameRoomBar { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; padding: 8px 0 22px; border-bottom: 1px solid var(--line); }
#gameRoomBar h1 { margin: 7px 0; font-size: clamp(22px, 3vw, 30px); letter-spacing: -.6px; color: var(--text); }
#gameRoomBar p { margin: 0; font-size: 12px; color: var(--text-muted); }
#gameRoomBar a { color: var(--text-muted); font-size: 12px; text-decoration: none; }
#gameRoomBar nav { display: flex; flex-wrap: wrap; gap: 8px; }
#gameRoomNotice:empty { display: none; }
#gameRoomWaiting { min-width: 0; grid-column: 1; grid-row: 2; }
#gameRoomWaiting #roomPanel { display: block; padding: 26px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); }
body.site-page.game-room-page[data-room-phase="idle"] #gameSurface { display: none; }
body.site-page.game-room-page[data-room-phase="idle"] #contextPanel { position: static; display: block !important; grid-column: 2; grid-row: 2; width: 100%; min-width: 0; max-width: none; height: auto; max-height: none; transform: none; opacity: 1; visibility: visible; overflow: visible; padding: 22px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: none; pointer-events: auto; }
body.site-page.game-room-page[data-room-phase="idle"] #contextPanel .context-panel-head,
body.site-page.game-room-page #contextPanel .context-tabs,
body.site-page.game-room-page #contextToggle,
body.site-page.game-room-page #contextRoom,
body.site-page.game-room-page #contextRanking { display: none !important; }
body.site-page.game-room-page #contextSettings { display: block !important; width: 100%; }
body.site-page.game-room-page[data-room-phase="running"] #gameSurface { grid-column: 1 / -1; grid-row: 2; }
body.site-page.game-room-page[data-room-phase="running"] #playArea { grid-template-columns: minmax(0, 1fr); grid-template-rows: 1fr; padding-bottom: 80px; }
body.site-page.game-room-page[data-room-phase="running"] #gameSurface { grid-row: 1; }
body.site-page.game-room-page[data-room-phase="running"] #gameRoomBar { position: fixed; left: 22px; bottom: max(22px, env(safe-area-inset-bottom)); z-index: 60; gap: 8px; padding: 6px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: 0 5px 20px #0002; }
body.site-page.game-room-page[data-room-phase="running"] #gameRoomBar h1,
body.site-page.game-room-page[data-room-phase="running"] #gameRoomHint,
body.site-page.game-room-page[data-room-phase="running"] #gameRoomShare,
body.site-page.game-room-page[data-room-phase="running"] #gameRoomLeave { display: none; }
body.site-page.game-room-page[data-room-phase="running"] #gameRoomBar nav { width: auto; }
body.site-page.game-room-page[data-room-phase="running"] #gameRoomBar button,
body.site-page.game-room-page[data-room-phase="running"] #gameRoomBack { min-height: 32px; padding: 8px 10px; font-size: 12px; }
body.site-page.game-room-page[data-room-phase="running"] #gameRoomWaiting { display: none; }
body.site-page.game-room-page[data-room-phase="running"] #contextPanel,
body.site-page.game-room-page #contextOverlayBackdrop { display: none !important; }
.game-room-page select[id$="Opponent"],
.solo-inline-layout select[id$="Opponent"] { pointer-events: none; opacity: .7; }
.game-room-page .room-config-body { display: grid !important; }
.game-room-page .room-config-toggle { display: none; }
body.site-page.game-room-page #contextSettings .room-config,
body.site-page.game-room-page #contextSettings .room-config-body > .settings-section { padding: 0; border: 0; border-radius: 0; background: transparent; }
.game-room-page #contextSettings .room-settings-section { display: none; }
.game-room-seats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.game-room-seat { display: grid; align-content: start; gap: 14px; min-height: 180px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-soft); }
.game-room-seat.is-vacant { border-style: dashed; opacity: .75; }
.game-room-seat.is-bot { background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }
.game-room-seat-label { display: flex; justify-content: space-between; gap: 8px; font-size: 11px; color: var(--text-muted); }
.game-room-seat > small { font-size: 12px; color: var(--text-muted); }
.game-room-seat .room-user { margin: 0; max-width: 100%; min-width: 0; width: 100%; padding: 8px; }
.game-room-ready-note { margin: 22px 0 12px; color: var(--text-muted); font-size: 12px; }
#gameRoomWaiting #roomPrimaryAction { width: 100%; min-height: 46px; }
.game-room-secondary { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.game-room-secondary:empty, #gameRoomWaiting #roomInviteResult:empty { display: none; }
.game-room-spectators { margin-top: 18px; font-size: 13px; }
.game-room-spectators summary { cursor: pointer; margin-bottom: 10px; }
body.site-page.game-room-page.room-closed #contextPanel { display: none !important; }
#gameRoomWaiting #roomPanel[hidden] { display: none; }

.lounge-shell .lounge-heading { align-items: center; gap: 20px; }
.lounge-shell { grid-template-rows: auto minmax(0, 1fr); }
body.site-page .lounge-surface .game-main-panel { height: max(580px, calc(100svh - var(--site-header-height, 78px) - 48px)); min-height: 580px; }
.lounge-shell .lounge-heading > div:first-child { flex: 0 1 280px; }
.lounge-shell .lounge-heading h3 { font-size: 23px; }
.lounge-shell .lounge-heading > div:first-child > p { font-size: 12px; }
.lounge-shell .lounge-heading-actions { min-width: 0; gap: 8px; }
.lounge-shell .lounge-heading-toolbar { flex-wrap: wrap; gap: 6px; }
.lounge-shell .lounge-heading .ghost-button { min-height: 30px; padding: 6px 9px; font-size: 12px; white-space: nowrap; }
.lounge-shell .lounge-presence-controls { padding: 1px; border-radius: 8px; }
.lounge-toolbar-menu { position: relative; }
.lounge-toolbar-menu > summary { padding: 7px 9px; border: 1px solid #ffffff36; border-radius: 8px; cursor: pointer; list-style: none; font-size: 12px; white-space: nowrap; }
.lounge-toolbar-menu > summary::-webkit-details-marker { display: none; }
.lounge-toolbar-menu > summary::after { content: "⌄"; margin-left: 6px; }
.lounge-toolbar-menu[open] > summary { border-color: #d7a55e; }
.lounge-toolbar-popover { position: absolute; top: calc(100% + 8px); right: 0; z-index: 5; width: 290px; max-width: calc(100vw - 56px); max-height: min(420px, calc(100svh - 240px)); overflow-y: auto; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.lounge-toolbar-popover .lounge-presence-controls, .lounge-object-controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; border: 0; }
.lounge-object-controls #loungeTakeCookie { grid-column: 1 / -1; }
.lounge-shell .lounge-toolbar-popover .ghost-button { white-space: normal; min-height: 36px; }
.lounge-shell .lounge-toolbar-popover .lounge-cookie-status { margin-top: 10px; padding: 0; border: 0; background: none; color: var(--text-muted); font-size: 11px; line-height: 1.5; }
.lounge-shell .lounge-scene-frame[data-view="2d"] .lounge-teapot-status { visibility: visible; z-index: 9; }
.lounge-shell .lounge-scene-badges { margin-top: 8px; justify-content: flex-start; gap: 4px; }
.lounge-shell .lounge-scene-badges span { padding: 3px 7px; font-size: 10px; }
.lounge-heading .lounge-community { padding: 0; border: 0; background: none; color: #f5efe4; }
.lounge-heading .lounge-community-controls { justify-content: flex-end; gap: 6px; font-size: 12px; }
.lounge-heading .lounge-community-controls label { gap: 6px; }
.lounge-heading .lounge-community-controls select { min-width: 122px; height: 31px; min-height: 31px; padding: 4px 8px; border-radius: 8px; font-size: 12px; }
.lounge-heading .lounge-community-details { position: relative; }
.lounge-community-details summary { padding: 8px 10px; border: 1px solid #ffffff36; border-radius: 8px; cursor: pointer; list-style: none; font-size: 11px; }
.lounge-community-details summary::-webkit-details-marker { display: none; }
.lounge-community-details summary span { color: #e2b779; margin-left: 4px; }
.lounge-community-popover { position: absolute; right: 0; top: calc(100% + 8px); width: min(340px, calc(100vw - 56px)); padding: 18px; border: 1px solid var(--line); border-radius: 12px; color: var(--text); background: var(--surface); box-shadow: var(--shadow); }
.lounge-community-popover .lounge-weekly-goal { margin: 0 0 10px; font-size: 12px; }
.lounge-community-popover .lounge-weekly-goal progress { width: 100%; }
.lounge-shell .lounge-community-popover .meta { color: var(--text-muted); font-size: 11px; line-height: 1.5; margin-bottom: 12px; }
.lounge-community-popover .lounge-intent-members { font-size: 11px; }
.lounge-shell #loungeCommunityStatus { font-size: 11px; max-width: 560px; margin-top: 5px; color: #c0ccdd; }
.lounge-shell .lounge-presence-nameplate { grid-template-columns: minmax(0, 1fr) auto; gap: 2px 4px; max-width: 138px; padding: 3px 6px; border-radius: 8px; }
.lounge-shell .lounge-presence-nameplate strong { max-width: 106px; font-size: 10px; line-height: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lounge-shell .lounge-presence-title { max-width: 124px; padding: 1px 5px; font-size: 8px; line-height: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lounge-shell .lounge-presence-intent { padding: 0; background: none; font-size: 10px; }
.lounge-self-marker { font-style: normal; font-size: 8px; color: #afd9ff; }

@media (max-width: 1100px) {
  body.site-page .hub-header { flex-wrap: wrap; gap: 12px; padding: 14px 22px; }
  .site-page .site-navigation { flex-basis: 100%; justify-content: flex-start; order: 3; overflow-x: auto; gap: 25px; }
  .site-account-actions { margin-left: auto; }
  body.site-page.game-room-page #playArea { grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; }
}
@media (max-width: 780px) {
  .lounge-shell .lounge-heading { display: block; padding: 12px; }
  .lounge-shell .lounge-heading-actions { margin-top: 10px; justify-items: start; }
  .lounge-shell .lounge-heading-toolbar, .lounge-heading .lounge-community-controls { justify-content: flex-start; }
  .lounge-shell .lounge-heading-toolbar { position: relative; }
  .lounge-toolbar-menu { position: static; }
  .lounge-toolbar-popover { left: 0; right: auto; width: min(290px, 100%); }
  .lounge-shell .lounge-heading > div:first-child > p { display: none; }
  .lounge-shell .lounge-scene-badges { position: absolute; top: 13px; right: 12px; margin: 0; }
  .lounge-shell .lounge-heading h3 { font-size: 18px; }
  .lounge-shell #loungeQualityBadge { display: none; }
  body.site-page.game-room-page #playArea { grid-template-columns: 1fr; }
  body.site-page.game-room-page[data-room-phase="idle"] #contextPanel { grid-column: 1; grid-row: 3; }
  #gameRoomBar nav { width: 100%; }
  #gameRoomWaiting #roomPanel { padding: 20px; }
}
@media (max-width: 560px) {
  .game-room-seats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .game-room-seat { padding: 12px; min-height: 150px; }
  .game-room-seat-label { flex-wrap: wrap; font-size: 10px; }
  body.site-page .lounge-surface .game-main-panel { height: max(600px, calc(100svh - var(--site-header-height, 78px) - 28px)); min-height: 600px; }
  body.site-page .hub-header { padding: 12px 16px; }
  .site-page .hub-brand { font-size: 20px; }
  .hub-brand-logo { width: 26px; height: 26px; }
  .site-theme-menu summary span, .site-page #topAccountName { display: none; }
  .site-account-actions { gap: 10px; }
  .site-page .site-navigation { gap: 22px; }
  body.site-page #playArea { padding: 14px 12px 85px; }
  .site-page .account-popover { position: fixed; top: 66px; right: 12px; }
  .music-dock { right: 2px; bottom: max(2px, env(safe-area-inset-bottom)); }
  .music-dock-toggle { width: 46px; height: 46px; }
}
.music-dock.is-inline { position: relative; right: auto; bottom: auto; z-index: 120; padding: 0; }
.music-dock.is-inline .music-dock-toggle { width: 34px; height: 34px; border-radius: 8px; font-size: 16px; box-shadow: none; }
.music-dock.is-inline .music-dock-popup { top: calc(100% + 10px); right: 0; bottom: auto; transform: translateY(-8px) scale(.96); transform-origin: top right; }
.music-dock.is-inline.is-open .music-dock-popup { transform: none; }
.music-dock.is-inline .music-dock-popup::after { top: auto; bottom: 100%; }
@media (prefers-reduced-motion: reduce) { .music-dock-popup, .music-dock-toggle, .hub-brand-logo { transition: none; } }
