/* layout-stability.css */
/* Reserve real component geometry before account and lobby requests finish. */
@media(min-width:901px){
 header.top[data-member-layout]{padding-block:8px;min-height:105px}
 header.top[data-member-layout]>.account-bar{display:grid;grid-template-columns:minmax(120px,1fr) 142px 220px 98px 100px;grid-template-rows:minmax(88px,auto);gap:8px;align-items:center;min-width:0;width:100%}
 header.top[data-member-layout] .account-bar>.member-tools{grid-area:1/1;display:flex;flex-wrap:wrap;justify-content:flex-end;min-width:0;max-width:100%}
 header.top[data-member-layout] .account-bar>.site-language{grid-area:1/2}
 header.top[data-member-layout] .account-bar>#account-summary{grid-area:1/3;width:220px;min-width:0;max-width:220px;min-height:80px;align-items:center}
 header.top[data-member-layout] .account-bar>#account-summary:not([data-member]){visibility:hidden}
 header.top[data-member-layout] .account-bar>.online-pill{grid-area:1/4;justify-content:center;min-width:0;white-space:normal;font-size:10px}
 header.top[data-member-layout] .account-bar>:is(#account-open,#logout){grid-area:1/5;min-width:0;padding-inline:8px;white-space:normal;overflow-wrap:anywhere;text-align:center}
 header.top[data-member-layout] .account-bar>#account-open{visibility:hidden}
}
@media(min-width:1440px){header.top[data-member-layout]{grid-template-columns:200px minmax(0,1fr) 800px}}
@media(min-width:901px) and (max-width:1439px){header.top[data-member-layout]{grid-template-rows:64px minmax(88px,auto)}}
#profile-content,#match-content{display:flow-root}
/* One complete live-card row, then room for match history; content can grow. */
#live-rooms{min-height:320px;align-items:stretch}
#live-rooms>.empty{min-height:320px}
#recent-matches{min-height:440px}
#tab-ranking .table-wrap{min-height:440px}
#tab-ranking table{table-layout:fixed;width:100%;min-width:660px}
#tab-ranking th:first-child{width:8%}
#tab-ranking th:nth-child(2){width:32%}
#tab-ranking th:nth-child(n+3){width:10%}
.season-filters{flex:0 0 320px;min-width:0}
.season-filters>label{flex:1;min-width:0}
.season-filters select{width:100%}
@media(max-width:700px){.season-filters{flex-basis:auto;width:100%}}
#tournament-list{min-height:440px}
#season-detail{min-height:3.2em;line-height:1.6}
#season-note{min-height:3.2em;line-height:1.6}
#season-title{min-height:1.4em;line-height:1.4}
#rank-info{min-height:1.6em}
.ranking-pagination{min-height:48px}
#lobby-status{display:block;min-width:150px;text-align:end;line-height:1.5}
.lobby-placeholder{min-width:0;min-height:100%;border:1px solid #344553;border-radius:16px;background:linear-gradient(120deg,#1a2631,#141c25);padding:26px;display:flex;flex-direction:column;justify-content:center;gap:20px}
.lobby-placeholder::before,.lobby-placeholder::after{content:"";display:block;height:12px;border-radius:6px;background:#263441;width:60%;max-width:260px}
.lobby-placeholder::after{width:38%}
#recent-matches>.lobby-placeholder{min-height:440px}
/* Recent results belong below the live list. Reveal this still-empty section
   together with the first response, after the live card count is known. */
#live-rooms:has(>.lobby-placeholder)~:is(.match-history-heading,.match-history-list,.match-history-more){visibility:hidden}
/* Connecting and connected labels share a column even in long translations. */
#community>.section-heading{display:grid;grid-template-columns:minmax(0,1fr) 150px;align-items:center}
@media(max-width:640px){#community>.section-heading{grid-template-columns:minmax(0,1fr) 130px}}
#season-champion .champion-photo>a{line-height:0}
/* The featured star frame has the same headroom before its decoration loads. */
#rg-hero-legend{margin-top:33px}
@media(max-width:640px){#lobby-status{min-width:0;max-width:130px;min-height:3em}#live-rooms,#live-rooms>.empty{min-height:350px}#recent-matches,#recent-matches>.lobby-placeholder{min-height:500px}}


/* youtube-panel.css */
.yt-dock{--tab:36px;position:fixed;z-index:18;left:0;top:50%;width:clamp(264px,16vw,340px);max-width:calc(100vw - var(--tab) - 8px);transform:translate(-100%,-50%);transition:transform .22s ease;color:#f4f4ed;text-align:left}
.yt-dock.yt-open{transform:translate(0,-50%)}
.yt-dock[hidden],.yt-panel [hidden]{display:none!important}
.yt-panel,.yt-tab{box-sizing:border-box;background:#171e28;border:1px solid #685338;box-shadow:0 8px 25px #0005}
.yt-panel{display:grid;grid-template-columns:minmax(0,1fr);gap:10px;max-height:calc(100dvh - 112px);padding:12px 12px 13px max(12px,env(safe-area-inset-left));overflow-x:hidden;overflow-y:auto;overscroll-behavior:contain;border-left:0;border-radius:0 12px 12px 0}
.yt-dock .yt-tab{position:absolute;left:100%;top:50%;transform:translateY(-50%);border-left:0;border-radius:0 9px 9px 0;width:var(--tab);min-height:108px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;padding:6px 0;color:#ffce67;cursor:pointer;font:700 13px/1 system-ui}
.yt-tab svg{width:20px;height:20px}.yt-tab span:first-of-type{writing-mode:vertical-rl}.yt-chevron{font-size:19px}.yt-open .yt-chevron{transform:rotate(180deg)}
.yt-head,.yt-foot{display:flex;align-items:center;justify-content:space-between;gap:6px}
.yt-foot{flex-wrap:wrap}
.yt-head h2{margin:0;font-size:17px;color:#ffcf69}.yt-dock .yt-close{width:32px;height:32px;padding:0;border:1px solid #3f4a58;border-radius:6px;background:#202834;font-size:22px;color:#eee;line-height:1}
.yt-panel select{min-width:0;width:100%;height:35px;padding:0 7px;background:#111a23;border:1px solid #405064;color:#f6f2ea;border-radius:6px}
.yt-screen{position:relative;width:100%;min-width:0;aspect-ratio:16/9;overflow:hidden;border-radius:7px;background:radial-gradient(ellipse at 20% 15%,#304b60,transparent 70%),linear-gradient(145deg,#122230,#10161d)}
.yt-screen:has(iframe){min-height:200px}
.yt-screen iframe,.yt-dock .yt-play{position:absolute;inset:0;box-sizing:border-box;width:100%;min-width:0;height:100%;border:0}
.yt-dock .yt-play{display:grid;align-content:center;justify-items:center;gap:12px;padding:16px;color:#f4f3ed;background:transparent;cursor:pointer}
.yt-play span{display:grid;place-items:center;width:52px;height:36px;border-radius:9px;background:#efc364;color:#161d27;font-size:17px}
.yt-play strong{font-size:15px;line-height:1.3;overflow-wrap:anywhere;white-space:normal;min-width:0;max-width:100%}
.yt-play img{position:absolute;inset:0;width:100%;height:100%;object-fit:contain;opacity:.53}
.yt-play span,.yt-play strong{position:relative}.yt-play strong{text-shadow:0 1px 4px #000}
.yt-screen small:not(:empty){position:absolute;bottom:4px;left:4px;right:4px;background:#111a23;color:#fff;padding:5px;text-align:center;pointer-events:none}
.yt-foot a{font-size:12px;font-weight:650;color:#edc56c;text-decoration:none}.yt-foot a:hover{text-decoration:underline}
.yt-foot .yt-subscribe{padding:7px 10px;border-radius:6px;background:#efc364;color:#201b11}
.yt-dock :focus-visible{outline:2px solid #ffd47d;outline-offset:2px}
@media(max-width:760px){.yt-dock{--tab:44px;width:min(338px,calc(100vw - 46px - env(safe-area-inset-right)));top:49%}.yt-dock .yt-tab{min-height:104px}.yt-panel{max-height:calc(100dvh - 142px)}.yt-dock .yt-close{width:38px;height:38px}}
@media(max-height:440px){.yt-dock{top:46%}.yt-panel{max-height:72dvh}}
@media(max-width:760px) and (max-height:740px){
  body:has(#analytics-choice:not([hidden])) .yt-dock{--video-space:calc(100dvh - var(--community-bottom,0px) - 70px);--video-top:min(16dvh,104px);top:calc((var(--video-space) + var(--video-top)) / 2)}
  body:has(#analytics-choice:not([hidden])) .yt-panel{max-height:max(108px,calc(var(--video-space) - var(--video-top) - 12px))}
}
@media(prefers-reduced-motion:reduce){.yt-dock{transition:none}}


/* support-panel.css */
.support-dock {
  --tab: 36px;
  position: fixed;
  z-index: 18;
  right: 0;
  top: 50%;
  width: clamp(264px, 16vw, 340px);
  max-width: calc(100vw - var(--tab) - 8px);
  transform: translate(100%, -50%);
  transition: transform .22s ease;
  color: #f4f4ed;
  text-align: left;
}
.support-dock.is-open { transform: translate(0, -50%); }
.support-dock[hidden], #welcome[data-room-connecting] .support-dock { display: none; }
.support-dock .support-tab, #support-panel {
  background: #171e28;
  border: 1px solid #685338;
  box-shadow: 0 8px 25px #0005;
}
.support-dock .support-tab {
  position: absolute;
  right: 100%;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 6px;
  width: var(--tab);
  min-height: 108px;
  padding: 6px 0;
  border-right: 0;
  border-radius: 9px 0 0 9px;
  color: #ffce67;
  font: 700 13px/1 system-ui;
}
.support-tab span { writing-mode: vertical-rl; }
.support-tab b { font-size: 19px; }
.support-dock.is-open .support-tab b { transform: rotate(180deg); }
#support-panel {
  max-height: calc(100dvh - 112px);
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  padding: 12px max(12px, env(safe-area-inset-right)) 13px 12px;
  border-right: 0;
  border-radius: 12px 0 0 12px;
}
#support-panel header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
#support-panel h2 { margin: 0; font-size: 17px; color: #ffcf69; }
#support-panel p { margin: 5px 0 10px; color: #cdd3db; font-size: 13px; line-height: 1.4; }
#support-panel .support-close { width: 32px; min-height: 32px; background: #202834; border: 1px solid #3f4a58; color: #eee; font-size: 22px; line-height: 1; }
#support-panel fieldset { display: grid; gap: 4px; min-width: 0; margin: 0; padding: 0; border: 0; }
#support-panel .support-option {
  display: grid;
  grid-template-columns: 16px 27px minmax(0,1fr) auto;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  margin: 0;
  padding: 3px 8px;
  border: 1px solid #35404b;
  border-radius: 7px;
  cursor: pointer;
  color: #e3e7ea;
  font-size: 13px;
}
.support-option strong { font-variant-numeric: tabular-nums; white-space: nowrap; }
#support-panel .support-option:has(:checked) { border-color: #deba6c; background: #292a29; }
#support-panel .support-option:has(:focus-visible) { outline: 2px solid #ffd47d; }
#support-panel input { width: 14px; height: 14px; min-height: 0; margin: 0; padding: 0; accent-color: #f3c65b; }
.support-badge, .support-badge img { display: block; width: 27px; height: 27px; }
#support-panel .support-buy { width: 100%; margin-top: 10px; background: #efc364; color: #201b11; font-weight: 700; }
#support-panel .support-status { margin-bottom: 0; }
#support-panel .support-status { overflow-wrap: anywhere; }
#support-panel .support-status:empty { display: none; }
@media (max-width:760px) {
  .support-dock { --tab: 44px; top: 49%; width: min(338px, calc(100vw - 48px - env(safe-area-inset-left))); }
  #welcome:has(.yt-dock) .side-dock { max-width: calc(100vw - 96px - env(safe-area-inset-left) - env(safe-area-inset-right)); }
  #support-panel { max-height: calc(100dvh - 142px); }
  #support-panel .support-option, #support-panel .support-close { min-height: 44px; }
  #support-panel .support-close { width: 44px; }
}
@media (max-height:440px) {
  .support-dock { top: 46%; }
  #support-panel { max-height: 72dvh; }
}
@media (max-width:760px) and (max-height:740px) {
  body:has(#analytics-choice:not([hidden])) .support-dock {
    --space: calc(100dvh - var(--community-bottom, 0px) - 70px);
    --start: min(16dvh, 104px);
    top: calc((var(--space) + var(--start)) / 2);
  }
  body:has(#analytics-choice:not([hidden])) #support-panel { max-height: max(108px, calc(var(--space) - var(--start) - 12px)); }
}
@media (prefers-reduced-motion:reduce) { .support-dock { transition: none; } }

/* Keep each drawer reachable while both are open on narrow phones. */
@media (max-width: 575px) {
  #welcome:has(.yt-open):has(.support-dock.is-open) {
    --dock-start: max(10px, env(safe-area-inset-top));
    --dock-space: calc(100dvh - var(--dock-start) - var(--community-bottom, 16px) - 68px);
  }
  #welcome:has(.yt-open):has(.support-dock.is-open) .yt-dock {
    top: calc(var(--dock-start) + var(--dock-space) * .21);
  }
  #welcome:has(.yt-open):has(.support-dock.is-open) .support-dock {
    top: calc(var(--dock-start) + var(--dock-space) * .71);
  }
  #welcome:has(.support-dock.is-open) .yt-open .yt-panel {
    max-height: calc(var(--dock-space) * .42 - 6px);
  }
  #welcome:has(.yt-open) .support-dock.is-open #support-panel {
    max-height: calc(var(--dock-space) * .58 - 6px);
  }
}
@media (min-width: 576px) and (max-width: 760px) {
  #welcome:has(.yt-open):has(.support-dock.is-open) .side-dock {
    max-width: calc(50vw - var(--tab) - 5px);
  }
}
