/* MultiCraft — LOBBY ("Altın Saat", round 6; owner: lobby; SPEC PART 9): Mini Oyunlar tab (mode stage + posters + open
   rooms + mode sheet), Kodla Katıl, Oda Kur / Kuralları Düzenle, the room (title card, teams, cast cards / player rows, invite
   slots, rule chips, chat column / chat sheet, dock), ranking sheet. Components come from components.css (.btn*, .seg,
   .switch, .rcard, .mcard, .chip, .tag, .pips, .av, .dlg, .prow, .prow2, .srow, .code-cells …): this file is LAYOUT only,
   on the tokens of tokens.css (no new colours; team tones = the --team-* tokens). Tiers (SPEC 2.5): base = phone portrait ·
   land = (min-width 600px) and (max-height 500px) · wide = (min-width 840px) and (min-height 501px) · lg 1200 · xl 1600/700.
   Hover styles live only in the hover query at the end (P12). Match HUD + results screen: css/match.css. */

/* ================================================================ 0. team tones (fill / text / soft) */
.tone-red    { --tc: var(--team-red);    --tc-text: var(--team-red-text);    --tc-soft: rgba(229, 72, 77, .1); }
.tone-blue   { --tc: var(--team-blue);   --tc-text: var(--team-blue-text);   --tc-soft: rgba(61, 139, 255, .1); }
.tone-green  { --tc: var(--team-green);  --tc-text: var(--team-green-text);  --tc-soft: rgba(63, 182, 90, .1); }
.tone-yellow { --tc: var(--team-yellow); --tc-text: var(--team-yellow-text); --tc-soft: rgba(242, 194, 48, .1); }
.tone-orange { --tc: var(--team-orange); --tc-text: var(--team-orange-text); --tc-soft: rgba(242, 138, 28, .1); }
.tone-purple { --tc: var(--team-purple); --tc-text: var(--team-purple-text); --tc-soft: rgba(155, 107, 255, .1); }
.tone-cyan   { --tc: var(--team-cyan);   --tc-text: var(--team-cyan-text);   --tc-soft: rgba(34, 184, 207, .1); }
.tone-pink   { --tc: var(--team-pink);   --tc-text: var(--team-pink-text);   --tc-soft: rgba(240, 101, 149, .1); }
.tone-none   { --tc: var(--line-3);      --tc-text: var(--text-0);           --tc-soft: rgba(255, 236, 214, .04); }
.tone-amber  { --tc: var(--accent);      --tc-text: var(--amber-200);        --tc-soft: var(--accent-soft); }
/* player names in team text colours (chat, ranking): components read var(--tt, their default) */
.t-red { --tt: var(--team-red-text); } .t-blue { --tt: var(--team-blue-text); } .t-green { --tt: var(--team-green-text); }
.t-yellow { --tt: var(--team-yellow-text); } .t-orange { --tt: var(--team-orange-text); } .t-purple { --tt: var(--team-purple-text); }
.t-cyan { --tt: var(--team-cyan-text); } .t-pink { --tt: var(--team-pink-text); }

/* künye = ONE line; items that do not fit are DROPPED from the end, never cut mid-word (SPEC 3.5): the overflowing items
   wrap onto a second line that the fixed height hides (their separator dots go with them) */
.mgl .kunye.one, .mgl-room .kunye.one, .mgl-msheet .kunye.one, .mgl-create .kunye.one { flex-wrap: wrap; row-gap: 0; height: 1.2em; overflow: hidden; }

/* ================================================================ 1. tab root (the pane gets .bleed: stage layouts run edge to edge).
   Nothing here is positioned: the room frame and the landscape page use the hub body as their containing block. */
.mgl { color: var(--text-1); min-width: 0; }
.mgl-browse { display: flex; flex-direction: column; min-height: 100%; }

/* ================================================================ 2. mode stage (wide + land; phones portrait open the mode sheet) */
.mgl-stage { display: none; background: var(--band); }
.mgl-stage .mgl-art { position: absolute; top: 0; right: 0; height: min(100%, 562px); aspect-ratio: 16 / 9; max-width: 64%; z-index: -2; }   /* ≤ 1.25x of the 800 px painting */
.mgl-stage .mgl-art > img { display: block; width: 100%; height: 100%; object-fit: cover; }
.mgl-stage .mgl-art::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(to right, var(--band) 0%, rgba(10, 8, 6, .9) 8%, rgba(10, 8, 6, .66) 20%, rgba(10, 8, 6, .34) 34%, rgba(10, 8, 6, .1) 48%, rgba(10, 8, 6, 0) 60%),
              linear-gradient(to top, var(--band) 0%, rgba(10, 8, 6, .5) 12%, rgba(10, 8, 6, 0) 34%); }
.mgl-stage .mgl-art.enter { animation: fadeIn var(--dur-4) var(--ease-inout) both; }
.mgl-stage .mgl-art.leave { animation: fadeOut var(--dur-4) var(--ease-inout) forwards; }
.mgl-stage .stage-copy { max-width: 42rem; padding: 1.5rem var(--pad-x) 1.75rem; gap: .625rem; }
.mgl-stage .display { max-width: 100%; }
.mgl-stage .hook { max-width: 36rem; }
.mgl-roomline { display: inline-flex; align-items: center; gap: .625rem; max-width: 100%; margin: .125rem 0 0; padding: .375rem .75rem .375rem .5rem;
  border-radius: var(--r-sm); background: rgba(91, 210, 122, .08); border: 1px solid rgba(91, 210, 122, .22); color: var(--text-1);
  font-size: var(--fs-sm); line-height: 1.3; }
.mgl-roomline > span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mgl-roomline b { color: var(--text-0); font-weight: 600; }
.mgl-roomline > .ico { flex: none; color: var(--success-text); }
.mgl-roomline.none { background: rgba(255, 236, 214, .05); border-color: var(--line-2); color: var(--text-2); padding-left: .625rem; }
.mgl-roomline.none > .ico { color: var(--text-3); flex: none; }
.mgl-gate { display: none; }
.mgl-gate > i { left: 0; width: 0; }
.mgl-stage .howto-ico { display: none; }

/* ================================================================ 3. open rooms on phones (portrait: the screen's one primary) */
.mgl-live { display: flex; flex-direction: column; gap: .5rem; padding: 1rem var(--pad-x) 0; }
.mgl-live.many { flex-direction: row; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; scroll-snap-type: x mandatory;
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 2rem), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 2rem), transparent); }
.mgl-live.many::-webkit-scrollbar { display: none; }
.mgl-liveroom { display: flex; align-items: center; gap: .875rem; min-width: 0; padding: .625rem .75rem .625rem .625rem; border-radius: var(--r-md);
  background: var(--surface-1); border: 1px solid rgba(91, 210, 122, .25); box-shadow: inset 3px 0 0 var(--online); }
.mgl-live.many .mgl-liveroom { flex: 0 0 86%; scroll-snap-align: start; }
.mgl-liveroom.busy { border-color: var(--line-1); box-shadow: inset 3px 0 0 var(--line-3); }   /* a running match: watch only */
.mgl-liveroom .thumb { width: 4.5rem; aspect-ratio: 16 / 9; border-radius: var(--r-xs); overflow: hidden; flex: none; background: var(--carbon-0); }
.mgl-liveroom .thumb > img { display: block; width: 100%; height: 100%; object-fit: cover; }
.mgl-liveroom .grow { display: grid; gap: .1875rem; min-width: 0; }
.mgl-liveroom .kicker { display: flex; align-items: center; gap: .4375rem; }
.mgl-liveroom .kicker .dot { width: .4375rem; height: .4375rem; }
.mgl-liveroom .lr-title { margin: 0; font-size: var(--fs-md); font-weight: 600; color: var(--text-0); line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ================================================================ 4. shelf + posters (phones: 2 columns 4:3, never an orphan) */
.mgl-shelf { padding: 1rem var(--pad-x) 1.5rem; }
.mgl-shelf .shelf-head { margin-bottom: .75rem; }
.mgl-shelf .shelf-head .count { margin-left: -.25rem; }
.mgl-posters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); }
.mgl-posters .mcard { aspect-ratio: 4 / 3; width: 100%; }
.mgl-posters .mcard > img { pointer-events: none; }
.mgl-posters .mcard .mcopy { left: .75rem; right: .75rem; bottom: .625rem; }
.mgl-posters .mcard .mtitle { font-size: 1.25rem; }
.mgl-posters .mcard .kunye { color: var(--paper-1); }
/* phones portrait: no stage, so no "selected" poster either */
.mgl-posters .mcard.sel { border-color: var(--line-1); box-shadow: none; }
.mgl-posters .mcard.sel .mtitle { color: var(--text-0); }
@media (min-width: 600px) and (max-width: 839px) and (min-height: 501px) {
  .mgl-posters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .mgl-live, .mgl-shelf { max-width: 44rem; width: 100%; margin-inline: auto; }
}

/* ================================================================ 5. landscape phones: stage column left, posters right (each scrolls on its own) */
@media (min-width: 600px) and (max-height: 500px) {
  .mgl-browse { position: absolute; inset: 0; min-height: 0; display: grid; grid-template-columns: 21rem minmax(0, 1fr); padding-right: var(--safe-r); }
  .mgl-live, .mgl-gate { display: none; }
  .mgl-stage { display: flex; flex-direction: column; justify-content: flex-start; height: 100%; min-height: 0; border-right: 1px solid var(--line-1); overflow: hidden; }
  .mgl-stage .mgl-art { position: relative; width: 100%; height: auto; max-width: none; flex: none; z-index: 0; }
  .mgl-stage .mgl-art.leave { position: absolute; top: 0; left: 0; z-index: 1; }
  .mgl-stage .mgl-art::after { background: linear-gradient(to top, var(--band) 0%, rgba(10, 8, 6, 0) 45%); }
  .mgl-stage .stage-copy { position: relative; z-index: 2; margin-top: -1.75rem; padding: 0 1.25rem 1rem; gap: .5rem; max-width: none; }
  .mgl-stage .display { font-size: 2rem; -webkit-line-clamp: 1; }
  .mgl-stage .hook, .mgl-stage .howto, .mgl-stage .kicker, .mgl-roomline .expl { display: none; }
  .mgl-stage .howto-ico { display: inline-flex; position: absolute; top: .625rem; right: .625rem; z-index: 3; }
  .mgl-stage .mgl-k { font-size: var(--fs-k2); }
  .mgl-roomline { font-size: var(--fs-xs); padding-block: .25rem; }
  .mgl-stage .stage-actions { width: 100%; margin-top: .25rem; flex-wrap: nowrap; gap: .625rem; }
  .mgl-stage .stage-actions .btn { --b-h: var(--ctl-md); flex: 1 1 0; min-width: 0; padding: 0 .75rem; font-size: var(--fs-md); }
  .mgl-shelf { overflow-y: auto; overscroll-behavior: contain; padding: .75rem var(--pad-x) 1rem; min-height: 0; }
  .mgl-shelf .shelf-head { margin-bottom: .5rem; }
  .mgl-posters .mcard { aspect-ratio: 2 / 1; }   /* 3 rows (6 posters) inside 390 px */
  .mgl-posters .mcard .kunye { display: none; }
  .mgl-posters .mcard .mtitle { font-size: 1.125rem; }
  .mgl-posters .mcard.sel { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--elev-2); }
  .mgl-posters .mcard.sel .mtitle { color: var(--amber-100); }
}

/* ================================================================ 6. wide / lg / xl: stage + gate + 5 x 2 posters above the fold (SPEC 5.28) */
@media (min-width: 840px) and (min-height: 501px) {
  .mgl-live { display: none; }
  .mgl-stage { display: flex; flex: none; height: clamp(12rem, calc(100dvh - var(--band-h) - 24.5rem), 24rem); }
  .mgl-stage .display { font-size: var(--fs-d3); }
  .mgl-gate { display: block; }
  .mgl-shelf { padding: 1rem var(--pad-x) 1.25rem; }
  .mgl-posters { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .mgl-posters .mcard { aspect-ratio: 16 / 9; }
  .mgl-posters .mcard.sel { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--elev-2); }
  .mgl-posters .mcard.sel .mtitle { color: var(--amber-100); }
}
@media (min-width: 840px) and (max-width: 1199px) and (min-height: 501px) {
  .mgl-posters .mcard .kunye { display: none; }
  .mgl-posters .mcard .mtitle { font-size: 1.125rem; }
}
@media (min-width: 1200px) and (min-height: 501px) {
  .mgl-stage .display { font-size: var(--fs-d2); }
  .mgl-posters .mcard .mtitle { font-size: 1.5rem; }
}
@media (min-width: 1600px) and (min-height: 700px) {
  .mgl-stage { height: clamp(18rem, calc(100dvh - var(--band-h) - 27rem), 38rem); }
}
/* the minimised room's bar (shell, 3 rem) sits above the page: the stage shrinks so both poster rows stay above the fold */
@media (min-width: 840px) and (min-height: 501px) {
  .mgl-browse.has-roombar .mgl-stage { height: clamp(12rem, calc(100dvh - var(--band-h) - 24.5rem - 3rem), 24rem); }
}
@media (min-width: 1600px) and (min-height: 700px) {
  .mgl-browse.has-roombar .mgl-stage { height: clamp(18rem, calc(100dvh - var(--band-h) - 27rem - 3rem), 38rem); }
}
/* the minimised room bar takes 3 rem: up to 768 px tall the stage copy goes compact (it would be clipped at its top) */
@media (min-width: 840px) and (min-height: 501px) and (max-height: 768px) {
  .mgl-browse.has-roombar .mgl-stage .hook, .mgl-browse.has-roombar .mgl-roomline { display: none; }
  .mgl-browse.has-roombar .mgl-stage .stage-copy { padding-block: 1rem 1.125rem; gap: .5rem; }
  .mgl-browse.has-roombar .mgl-stage .display { font-size: var(--fs-d3); }
  .mgl-browse.has-roombar .mgl-stage .stage-actions .btn-lg { --b-h: var(--ctl-md); font-size: var(--fs-md); }
}
/* short laptop viewports (a 768 px screen minus the browser chrome): kicker + title + künye + actions only */
@media (min-width: 840px) and (min-height: 501px) and (max-height: 720px) {
  .mgl-stage .hook, .mgl-stage .mgl-roomline { display: none; }
  .mgl-stage .stage-copy { padding-block: 1rem 1.125rem; gap: .5rem; }
  .mgl-stage .display { font-size: var(--fs-d3); }
  .mgl-stage .stage-actions { margin-top: .25rem; }
  .mgl-stage .stage-actions .btn-lg { --b-h: var(--ctl-md); font-size: var(--fs-md); }
}

/* ================================================================ 7. rooms popover / list rows, mode sheet, code sheet */
.mgl-rooms-pop { width: min(26rem, calc(100vw - 1rem)); max-width: none; padding: .375rem .875rem .25rem; }
.mgl-rooms-pop .rp-title { margin: 0; padding: .5rem 0 .25rem; }
.mgl-roomlist { display: grid; }
.mgl-roomrow .rthumb { width: 4rem; aspect-ratio: 16 / 9; border-radius: var(--r-xs); overflow: hidden; flex: none; background: var(--carbon-0); }
.mgl-roomrow .rthumb > img { display: block; width: 100%; height: 100%; object-fit: cover; }
.mgl-roomrow .grow { gap: .1875rem; }
.mgl-fill { display: inline-flex; align-items: center; gap: .5rem; }
.mgl-fill .num { font-size: var(--fs-k2); color: var(--text-2); letter-spacing: .04em; }

.dlg.mgl-msheet-dlg > .dlg-body, .dlg-root.v-bottom .mgl-msheet-dlg > .dlg-body { padding: 0; }
.mgl-msheet .ms-art { position: relative; aspect-ratio: 16 / 9; background: var(--carbon-0); overflow: hidden; }
.mgl-msheet .ms-art > img { display: block; width: 100%; height: 100%; object-fit: cover; }
.mgl-msheet .ms-art::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(to top, var(--surface-1) 0%, rgba(20, 16, 13, 0) 42%); }
.mgl-msheet .ms-x { position: absolute; top: .625rem; right: .625rem; z-index: 1; }
.mgl-msheet .ms-copy { position: relative; display: grid; gap: .5rem; margin-top: -2.25rem; padding: 0 1.25rem 1rem; }
.mgl-msheet .ms-hook { font-size: var(--fs-lg); color: var(--text-0); line-height: 1.4; max-width: 40ch; }
.mgl-msheet .ms-desc { color: var(--text-2); line-height: var(--lh-body); max-width: 60ch; }
.mgl-msheet .ms-rules { display: grid; gap: .5rem; padding: .25rem 1.25rem 1rem; }
.mgl-msheet .ms-rules > .kicker { margin: .5rem 0 0; }
.mgl-msheet .ms-chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.mgl-msheet .ms-chips .chip { background: var(--surface-2); border: 1px solid var(--line-1); color: var(--text-2); }
.mgl-msheet .ms-chips .chip b { color: var(--text-0); font-weight: 600; }
.mgl-msheet .ms-rules .hint { margin: 0; font-size: var(--fs-sm); color: var(--text-3); }
.mgl-msheet .ms-rooms { display: grid; padding: .25rem 1.25rem 1rem; }
.mgl-msheet .ms-rooms > .kicker { margin: .5rem 0 .25rem; }
@media (min-width: 840px) and (min-height: 501px) {
  .mgl-msheet .ms-art { aspect-ratio: 2 / 1; }
  .mgl-msheet .ms-copy, .mgl-msheet .ms-rules, .mgl-msheet .ms-rooms { padding-inline: 1.5rem; }
}

/* landscape phones: the mode sheet is a full-screen sheet (dialogs.js "land"): art left, copy right, actions in the header */
.dlg-root.v-land .dlg.mgl-msheet-dlg > .dlg-body { padding: .75rem calc(1.25rem + var(--safe-r)) 1rem calc(1.25rem + var(--safe-l)); }
.dlg-root.v-land .mgl-msheet { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); column-gap: 1.25rem; align-items: start; }
.dlg-root.v-land .mgl-msheet .ms-art { grid-column: 1; grid-row: 1 / span 3; border-radius: var(--r-md); }
.dlg-root.v-land .mgl-msheet .ms-art::after, .dlg-root.v-land .mgl-msheet .ms-x { display: none; }
.dlg-root.v-land .mgl-msheet .ms-copy { grid-column: 2; margin-top: 0; padding: 0; gap: .375rem; }
.dlg-root.v-land .mgl-msheet .ms-copy > .kicker, .dlg-root.v-land .mgl-msheet .ms-copy > .display { display: none; }
.dlg-root.v-land .mgl-msheet .ms-hook { font-size: var(--fs-md); }
.dlg-root.v-land .mgl-msheet .ms-rules, .dlg-root.v-land .mgl-msheet .ms-rooms { grid-column: 2; padding: .5rem 0 0; }

.mgl-code { display: grid; justify-items: center; gap: 1rem; padding-top: .25rem; text-align: center; }
.mgl-code .dlg-text { max-width: 34ch; text-wrap: balance; }
.mgl-code .err { justify-content: center; text-align: left; }
.mgl-code-dlg .dlg-foot .code-go { min-width: 7.5rem; }

/* ================================================================ 8. Oda Kur / Kuralları Düzenle (SPEC 9.4) */
.mgl-create { display: grid; gap: 1.25rem; min-width: 0; }
.mgl-create .mc-left { display: grid; gap: .5rem; align-content: start; min-width: 0; }
.mgl-create .mc-lbl { margin: 0; }
.mgl-create .mc-picker { display: grid; grid-auto-flow: column; grid-auto-columns: 7.25rem; gap: .5rem; padding: .25rem .125rem .375rem; margin: 0 -.125rem;
  overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none; }
.mgl-create .mc-picker::-webkit-scrollbar { display: none; }
.mc-tile { display: grid; align-content: start; gap: .375rem; min-width: 0; margin: 0; padding: .375rem .375rem .5rem; border-radius: var(--r-md); cursor: pointer;
  border: 1px solid var(--line-2); background: var(--surface-2); color: var(--text-1); font: 600 var(--fs-sm)/1.2 var(--font-ui); text-align: center; scroll-snap-align: center;
  transition: border-color var(--dur-2) var(--ease-out), background-color var(--dur-2) var(--ease-out); }
.mc-tile .mc-art { display: block; aspect-ratio: 16 / 9; border-radius: var(--r-sm); overflow: hidden; background: var(--carbon-0); }
.mc-tile .mc-art > img { display: block; width: 100%; height: 100%; object-fit: cover; }
.mc-tile .mc-name { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.4em; overflow-wrap: normal; word-break: normal; hyphens: manual; }   /* never "Saklamba/ç" */
@media (min-width: 840px) and (max-width: 1199px) and (min-height: 501px) {
  .mc-tile { padding: .3125rem .25rem .5rem; }
  .mc-tile .mc-name { font-size: .8125rem; }
}
.mc-tile[aria-checked="true"] { border-color: var(--accent); background: var(--sel-card-bg); color: var(--amber-100); box-shadow: 0 0 0 .5px var(--accent), inset 0 0 0 .5px var(--accent); }
.mc-tile:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--bg-app), 0 0 0 4px var(--focus); }
.mgl-create .mc-summary { display: grid; gap: .375rem; padding-top: .25rem; }
.mgl-create .mc-hook { margin: 0; color: var(--text-1); line-height: 1.45; }
.mgl-create .mc-right { display: grid; gap: 1rem; align-content: start; min-width: 0; }
.mgl-rules-fields { display: grid; gap: 1rem; min-width: 0; }
.mgl-rule .seg { width: 100%; }
@media (max-width: 389px) { .mgl-rule .seg > button { padding-inline: .375rem; } }
/* the phone mode scroller fades on both sides once it is scrolled (the centred pick never sits against a hard cut) */
.mgl-create .mc-picker.fade-r:not(.at-start):not(.at-end) { -webkit-mask-image: linear-gradient(to right, transparent, #000 2rem, #000 calc(100% - 2.5rem), transparent); mask-image: linear-gradient(to right, transparent, #000 2rem, #000 calc(100% - 2.5rem), transparent); }
.mgl-create .mc-picker.fade-r.at-end:not(.at-start) { -webkit-mask-image: linear-gradient(to right, transparent, #000 2rem); mask-image: linear-gradient(to right, transparent, #000 2rem); }
.mgl-switches { padding: 0 1rem; }
.mgl-switches .srow { padding: .75rem 0; }
.mgl-switches .srow .lbl { font-size: var(--fs-md); }
/* loadouts (Teçhizat): radio cards with a line icon */
.mgl-kits.rcards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
.mgl-kits .rcard { min-height: 4.25rem; }
.mgl-kits .rcard .rbody { grid-template-columns: auto minmax(0, 1fr); column-gap: .75rem; align-items: center; padding: .625rem 2.5rem .625rem .75rem; }
.mgl-kits .rcard .kit-ico { grid-row: 1 / span 2; width: 2.25rem; height: 2.25rem; border-radius: var(--r-sm); display: grid; place-items: center; background: rgba(255, 236, 214, .06); color: var(--text-2); }
.mgl-kits .rcard[aria-checked="true"] .kit-ico { background: var(--accent-soft); color: var(--amber-300); }
.mgl-kits .rcard .radio { top: 50%; margin-top: -.75rem; right: .625rem; }
@media (max-width: 599px) {
  .mgl-kits.rcards { grid-template-columns: minmax(0, 1fr); }
  .mgl-kits .rcard { flex-direction: row; padding-right: 0; min-height: 3.75rem; }
}
/* radio rows (5–6 options or long labels) */
.mgl-radios { display: grid; gap: .375rem; }
.mgl-radio { display: flex; align-items: center; gap: .75rem; min-height: var(--ctl-md); margin: 0; padding: .5rem .75rem; border-radius: var(--r-sm); cursor: pointer;
  border: 1px solid var(--line-2); background: var(--surface-2); color: var(--text-1); font: inherit; text-align: left; }
.mgl-radio .disc { width: 1.25rem; height: 1.25rem; border-radius: 50%; border: 1.5px solid var(--line-field); flex: none; background: var(--surface-sunken); }
.mgl-radio .rtx { display: grid; gap: .125rem; min-width: 0; }
.mgl-radio .rl { font-weight: 500; line-height: 1.25; }
.mgl-radio .rd { font-size: var(--fs-sm); color: var(--text-3); line-height: 1.3; }
.mgl-radio[aria-checked="true"] { background: var(--sel-bg); border-color: var(--sel-line); box-shadow: inset 0 0 0 .5px var(--sel-line); color: var(--sel-text); }
.mgl-radio[aria-checked="true"] .disc { border-color: var(--accent); background: radial-gradient(circle, var(--accent) 0 40%, var(--surface-sunken) 46%); }
.mgl-radio:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--bg-app), 0 0 0 4px var(--focus); }
/* two columns wherever the dialog is a sheet beside something (wide+: the posters stay put while the rules scroll) */
@media (min-width: 840px) and (min-height: 501px) {
  .mgl-create { grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr); gap: 2rem; align-items: start; }
  .mgl-create .mc-left { position: sticky; top: 0; }
  .mgl-create .mc-picker { grid-auto-flow: row; grid-template-columns: repeat(5, minmax(0, 1fr)); grid-auto-columns: auto; overflow: visible; -webkit-mask-image: none; mask-image: none; }
  .mgl-rulesdlg { min-width: min(34rem, 100%); }
}
@media (min-width: 600px) and (max-height: 500px) {
  .mgl-kits.rcards { grid-template-columns: minmax(0, 1fr); }
  .mgl-kits .rcard { min-height: 3.5rem; }
  .mgl-kits .rcard .rbody { padding-block: .5rem; }
  .mgl-create { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
  .mgl-create .mc-left { position: sticky; top: 0; }
  .mgl-create .mc-picker { grid-auto-columns: 6.5rem; }
  .mgl-rules-fields { gap: .75rem; }
}

/* ================================================================ 9. ROOM frame: header · body (scrolls) · dock. The frame fills the hub body, so the dock can
   never cover a player and the main + chat columns end on one line (SPEC 9.5) */
.mgl-room { position: absolute; inset: 0; display: flex; flex-direction: column; min-height: 0; color: var(--text-1); }
/* --- title card: the painting at <= 1.25x on the right, fading into the band; text on the band (sharp text, sharp art) */
.mgl-rhead { position: relative; isolation: isolate; overflow: hidden; flex: none; display: flex; flex-direction: column; justify-content: flex-end;
  min-height: calc(10rem + var(--safe-t)); padding: calc(3.5rem + var(--safe-t)) calc(var(--pad-x) + var(--safe-r)) 1rem calc(var(--pad-x) + var(--safe-l)); background: var(--band); }
.mgl-rhead .rh-art { position: absolute; top: 0; right: 0; bottom: 0; width: min(100%, 1000px); z-index: -2; }
.mgl-rhead .rh-art > img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 50% 40%; }
.mgl-rhead > .scrim { position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(to top, var(--bg-app) 0%, rgba(13, 10, 8, .82) 34%, rgba(13, 10, 8, .3) 70%, rgba(13, 10, 8, .6) 100%); }
.mgl-rhead .rh-top { position: absolute; top: calc(.625rem + var(--safe-t)); left: calc(var(--pad-x) + var(--safe-l)); right: calc(var(--pad-x) + var(--safe-r));
  display: flex; align-items: center; gap: .5rem; }
.mgl-rhead .rh-top .spacer { flex: 1; }
.mgl-rhead .rh-title { display: grid; gap: .375rem; min-width: 0; }
.mgl-rhead .rh-name { font-size: var(--fs-d4); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1; padding-bottom: .05em; text-shadow: 0 2px 18px rgba(0, 0, 0, .5); }
.mgl-rhead .rh-side { display: none; }
.mgl-rhead .rh-invite-ico { display: none; }
.mgl-code-chip { display: inline-flex; align-items: center; gap: .5rem; height: var(--ctl-sm); padding: 0 .1875rem 0 .75rem; border-radius: var(--r-sm); flex: none;
  background: rgba(10, 8, 6, .72); border: 1px solid var(--line-3); }
.mgl-code-chip .kicker { color: var(--text-3); font-size: var(--fs-k3); }
.mgl-code-chip .num { font-family: var(--font-display); font-weight: 800; font-size: 1.25rem; letter-spacing: .2em; color: var(--text-0); line-height: 1; -webkit-user-select: text; user-select: text; }
.mgl-code-chip .c-copy { --b-h: calc(var(--ctl-sm) - .375rem); }
/* --- body */
.mgl-rbody { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.mgl-rmain { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: .75rem; padding: .75rem calc(var(--pad-x) + var(--safe-r)) 1rem calc(var(--pad-x) + var(--safe-l)); }
.mgl-rmain > * { flex: none; min-width: 0; }
.mgl-chat { display: none; }
.mgl-side { display: none; }
/* --- result banner (after a match) */
.mgl-result { display: flex; align-items: center; gap: .875rem; padding: .75rem .75rem .75rem 1rem; border-radius: var(--r-md); background: var(--surface-1);
  border: 1px solid var(--line-1); box-shadow: inset 3px 0 0 var(--tc); }
.mgl-result .res-ico { width: 2.75rem; height: 2.75rem; border-radius: var(--r-sm); display: grid; place-items: center; flex: none; background: var(--tc-soft); color: var(--tc-text); }
.mgl-result .grow { display: grid; gap: .25rem; }
.mgl-result .kicker { margin: 0; }
.mgl-result .res-title { margin: 0; font-size: var(--fs-lg); font-weight: 600; color: var(--text-0); line-height: 1.25; }
.mgl-result .res-mvp { display: flex; align-items: center; gap: .5rem; margin: .125rem 0 0; font-size: var(--fs-sm); color: var(--text-2); }
.mgl-result .res-mvp b { color: var(--text-0); font-weight: 600; }
/* phones: no trophy tile, so "Kazanan: Kırmızı takım" stays on one line beside [Sıralama] */
@media (max-width: 599px) {
  .mgl-result { gap: .75rem; padding-left: .875rem; }
  .mgl-result .res-ico { display: none; }
  .mgl-result .res-title { font-size: var(--fs-md); }
}
/* --- teams */
.mgl-teams { display: grid; gap: .75rem; align-items: start; }
.mgl-room .team { display: flex; flex-direction: column; min-width: 0; overflow: hidden; background: var(--surface-1); border: 1px solid var(--line-1); border-radius: var(--r-md); }
.mgl-room .team-head { display: flex; align-items: center; gap: .625rem; min-height: 3rem; padding: .375rem .5rem .375rem 1rem; flex: none;
  background: var(--tc-soft); box-shadow: inset 0 3px 0 var(--tc); }
.mgl-room .team.tone-none .team-head { background: rgba(255, 236, 214, .03); box-shadow: inset 0 -1px 0 var(--line-1); }
.mgl-room .team-head .tname { font-family: var(--font-display); font-weight: 800; font-size: 1.25rem; letter-spacing: .04em; text-transform: uppercase; color: var(--tc-text); line-height: 1; }
.mgl-room .team-head .tcount { font-family: var(--font-display); font-weight: 600; font-size: var(--fs-k1); letter-spacing: .06em; color: var(--text-2); font-feature-settings: "tnum" 1; }
.mgl-room .team-head > .tag, .mgl-room .team-head > .btn { margin-left: auto; }
.mgl-room .cast { display: none; }
.mgl-room .rows { display: block; }
.mgl-room .prow2 .nl { display: flex; align-items: baseline; gap: .375rem; min-width: 0; max-width: 100%; }
.mgl-room .prow2 .nl .pn { min-width: 0; }
.mgl-room .prow2 .tags { display: flex; gap: .375rem; flex-wrap: wrap; }
.mgl-room .prow2 > .tag { flex: none; }
.mgl-room .prow2 .p-more { margin-right: -.375rem; }
.mgl-room .prow2.off { opacity: .55; }
.mgl-room button.prow2 { width: 100%; margin: 0; border: 0; border-top: 1px solid var(--line-1); background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.mgl-room button.prow2:first-child { border-top: 0; }
.mgl-room .prow2.invite .pn { color: var(--text-1); }
/* cast cards (wide+): full-body render at an integer pixel scale on a floor light; a ready player gets a green floor line (G5) */
.mgl-room .pcard { position: relative; display: flex; flex-direction: column; align-items: center; gap: .375rem; min-width: 0; padding: .875rem .5rem .75rem; border-radius: var(--r-sm);
  background: radial-gradient(70% 30% at 50% 74%, rgba(255, 236, 214, .09), rgba(255, 236, 214, 0) 70%), var(--surface-2); border: 1px solid var(--line-1); }
.mgl-room .pcard .fig { position: relative; display: flex; align-items: flex-end; justify-content: center; width: 100%; }
.mgl-room .pcard .fig > canvas { display: block; flex: none; filter: drop-shadow(0 8px 6px rgba(0, 0, 0, .55)); }
.mgl-room .pcard.ready .fig::after { content: ""; position: absolute; left: 22%; right: 22%; bottom: 2px; height: 2px; border-radius: 2px;
  background: var(--success); box-shadow: 0 0 12px rgba(91, 210, 122, .55); }
.mgl-room .pcard .pname { display: flex; align-items: baseline; justify-content: center; gap: .3125rem; max-width: 100%; font-weight: 600; color: var(--text-0); line-height: 1.2; }
.mgl-room .pcard .pname .pn { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mgl-room .pcard .pname .you { flex: none; font-weight: 400; color: var(--text-3); }
.mgl-room .pcard .pmeta { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .375rem; min-height: 1.375rem; }
.mgl-room .pcard .p-more { position: absolute; top: .25rem; right: .25rem; }
.mgl-room .pcard.mine { border-color: rgba(255, 178, 63, .4); }
.mgl-room .pcard.off { opacity: .55; }
.mgl-room .pcard.invite { justify-content: center; gap: .5rem; margin: 0; background: transparent; border: 1px dashed var(--line-3); color: var(--text-2); cursor: pointer; font: inherit; }
.mgl-room .pcard.invite .plus { width: 2.75rem; height: 2.75rem; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--amber-300); }
.mgl-room .pcard.invite b { color: var(--text-0); font-weight: 600; }
.mgl-room .pcard.invite > span:last-child { font-size: var(--fs-sm); color: var(--text-3); }
.mgl-room .pcard.invite:focus-visible, .mgl-room button.prow2:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--bg-app), 0 0 0 4px var(--focus); }
/* --- spectators, rule chips, chat row */
.mgl-specs { display: flex; align-items: center; gap: .5rem; margin: 0; font-size: var(--fs-sm); color: var(--text-2); }
.mgl-specs > .ico { color: var(--text-3); flex: none; }
.mgl-rulechips { display: flex; align-items: center; gap: .5rem; min-width: 0; }
.mgl-rulechips .rc-list { display: flex; gap: .5rem; flex: 1 1 auto; min-width: 0; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; }
.mgl-rulechips .rc-list::-webkit-scrollbar { display: none; }
.mgl-rulechips .chip { background: var(--surface-1); border: 1px solid var(--line-1); color: var(--text-2); }
.mgl-rulechips .chip b { color: var(--text-0); font-weight: 600; }
.mgl-rulechips .rc-edit { flex: none; }
.mgl-chatrow { display: flex; align-items: center; gap: .75rem; width: 100%; min-height: 3.5rem; margin: 0; padding: .625rem .875rem; border-radius: var(--r-md);
  background: var(--surface-1); border: 1px solid var(--line-1); color: inherit; font: inherit; text-align: left; cursor: pointer; }
.mgl-chatrow > .ico { color: var(--text-2); flex: none; }
.mgl-chatrow .grow { display: grid; gap: .125rem; }
.mgl-chatrow .cr-title { font-size: var(--fs-sm); font-weight: 600; color: var(--text-0); }
.mgl-chatrow .last { font-size: var(--fs-sm); color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mgl-chatrow .last b { color: var(--text-1); font-weight: 600; }
.mgl-chatrow:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--bg-app), 0 0 0 4px var(--focus); }
/* --- "Nasıl oynanır": a folding card (.disclose from components.css) with the mode's four lines (modeHowTo.js) */
.mgl-how { display: grid; }
.mgl-how-t { min-height: 3rem; padding: 0 .875rem; background: var(--surface-1); font-size: var(--fs-sm); font-weight: 600; }
.mgl-how-t > .ico:first-child { flex: none; color: var(--text-2); }
.mgl-how-t > .grow { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mgl-how-t .dim { color: var(--text-3); }
.mgl-how-t[aria-expanded="true"] { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.mgl-how-list { list-style: none; margin: 0; padding: .625rem .875rem .75rem; display: grid; gap: .5rem .875rem; background: var(--surface-1);
  border: 1px solid var(--line-1); border-top: 0; border-radius: 0 0 var(--r-md) var(--r-md); font-size: var(--fs-sm); line-height: 1.4; color: var(--text-1); }
.mgl-how-list[hidden] { display: none; }
.mgl-how-list > li { display: flex; align-items: flex-start; gap: .5rem; min-width: 0; }
.mgl-how-list > li > .ico { flex: none; margin-top: .125rem; color: var(--text-3); }
.mgl-how-list > li > span { min-width: 0; }
.mgl-how-list b { font-weight: 600; color: var(--text-0); }
/* --- connection lost: the status block of the dock / side column becomes a small banner (.banner.conn) */
.banner.mgl-conn { min-height: 0; padding: .5rem .625rem; border: 1px solid rgba(255, 107, 95, .3); border-radius: var(--r-sm); }
.mgl-dock .mgl-conn { flex: 1 1 100%; }
.mgl-side .mgl-conn { align-items: flex-start; gap: .5rem; }
.mgl-side .mgl-conn > .tx > b, .mgl-side .mgl-conn > .tx > b + span { display: block; }
.mgl-side .mgl-conn > .tx > b + span { color: var(--text-2); }
.mgl-side .mgl-conn > .tx > b + span::before { content: none; }
/* the shell's room bar: unread room chat beside the mode name (minigames.js _syncRoomBar) */
.roombar .rb-mode > .badge-n { margin-left: .375rem; vertical-align: .0625rem; }
/* --- chat (column on wide screens, sheet on phones) */
.mgl-chat { flex-direction: column; min-height: 0; overflow: hidden; background: var(--surface-1); border: 1px solid var(--line-1); border-radius: var(--r-md); }
.mgl-chat .chat-head { display: flex; align-items: center; gap: .625rem; height: 3rem; padding: 0 1rem; flex: none; border-bottom: 1px solid var(--line-1); color: var(--text-2); }
.mgl-chat .ch-title { margin: 0; font-size: var(--fs-sm); font-weight: 600; color: var(--text-0); }
.chat-log { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: .5rem; padding: .75rem 1rem; font-size: var(--fs-sm); line-height: 1.4;
  -webkit-user-select: text; user-select: text; }
.chat-log > :first-child { margin-top: auto; }
.chat-log .msg { margin: 0; color: var(--text-1); overflow-wrap: anywhere; }
.chat-log .msg b { margin-right: .375rem; font-weight: 600; color: var(--tt, var(--text-0)); }
.chat-log .msg .tag { margin-right: .375rem; }
.chat-log .msg .dim { color: var(--text-3); }
.chat-log .msg.sys { display: flex; align-items: flex-start; gap: .375rem; color: var(--text-3); }
.chat-log .msg.sys > .ico { flex: none; margin-top: .1rem; }
.chat-log .msg.empty { margin: auto 0; justify-content: center; text-align: center; }
.chat-in { display: flex; gap: .5rem; padding: .625rem; flex: none; border-top: 1px solid var(--line-1); }
.chat-in .input { height: var(--ctl-sm); }
.mgl-chat-dlg > .dlg-body { display: flex; flex-direction: column; overflow: hidden; padding-bottom: calc(.5rem + var(--safe-b)); }
.mgl-chatsheet { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; height: min(62dvh, 30rem); margin: 0 -.5rem; }
.mgl-chatsheet .chat-log { padding-inline: .5rem; }
.mgl-chatsheet .chat-in { padding-inline: .5rem; }
/* --- dock: status (2 lines) + actions; phones: two rows, the primary full width */
.mgl-dock { flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: .625rem .75rem; min-height: var(--dock-min-h);
  padding: .75rem calc(var(--pad-x) + var(--safe-r)) calc(.75rem + var(--safe-b)) calc(var(--pad-x) + var(--safe-l)); background: var(--band); border-top: 1px solid var(--line-1); }
.mgl-dock .status, .mgl-side .status { display: grid; gap: .125rem; min-width: 0; }
.mgl-dock .status { flex: 1 1 100%; }
.mgl-dock .status > b, .mgl-side .status > b { display: flex; align-items: center; gap: .5rem; color: var(--text-0); font-weight: 600; font-size: var(--fs-md); white-space: nowrap; }
.mgl-dock .status > .l2, .mgl-side .status > .l2 { display: flex; align-items: center; gap: .375rem; min-width: 0; color: var(--text-3); font-size: var(--fs-sm); line-height: 1.35; }
.mgl-dock .status > .l2 > .tx { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mgl-dock .status .av, .mgl-side .status .av { flex: none; }
.status .num.cd { font-size: 1.375rem; line-height: .9; color: var(--amber-300); min-width: 1ch; }
.status .spin { width: 1rem; height: 1rem; }
.mgl-dock .d-actions { display: flex; align-items: center; gap: .625rem; flex: 1 1 100%; min-width: 0; }
.mgl-dock .d-actions > .go { flex: 1 1 auto; }
.mgl-dock .leave { display: none; }
.mgl-dock.host .d-actions > .ready-t { flex: none; width: var(--b-h); padding: 0; }
.mgl-dock.host .d-actions > .ready-t > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* --- landscape phones: header row, two team columns of rows, a right-hand column for status + actions (no dock) */
@media (min-width: 600px) and (max-height: 500px) {
  .mgl-room { display: grid; grid-template-columns: minmax(0, 1fr) 16rem; grid-template-rows: auto minmax(0, 1fr); }
  .mgl-rhead { grid-column: 1 / -1; min-height: 0; flex-direction: row; align-items: center; gap: .75rem; padding: .375rem calc(var(--pad-x) + var(--safe-r)) .375rem calc(.5rem + var(--safe-l));
    border-bottom: 1px solid var(--line-1); }
  .mgl-rhead > .scrim { background: linear-gradient(to right, rgba(10, 8, 6, .96) 0%, rgba(10, 8, 6, .84) 55%, rgba(10, 8, 6, .6) 100%); }
  .mgl-rhead .rh-top { position: static; flex: none; }
  .mgl-rhead .rh-top .spacer, .mgl-rhead .rh-top .mgl-code-chip, .mgl-rhead .rh-top .rh-more { display: none; }
  .mgl-rhead .rh-title { flex: 1; display: flex; align-items: baseline; gap: .75rem; }
  .mgl-rhead .rh-title .kicker { display: none; }
  .mgl-rhead .rh-name { font-size: 1.625rem; flex: 0 1 auto; }
  .mgl-rhead .rh-title .kunye { flex: 0 1 auto; flex-wrap: nowrap; white-space: nowrap; overflow: hidden; }
  .mgl-rhead .rh-side { display: flex; align-items: center; gap: .5rem; }
  .mgl-rhead .rh-invite { display: none; }
  .mgl-rhead .rh-invite-ico { display: inline-flex; }
  .mgl-rbody { grid-column: 1; grid-row: 2; }
  .mgl-rmain { padding: .625rem .75rem .75rem calc(var(--pad-x) + var(--safe-l)); gap: .625rem; }
  .mgl-teams { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .625rem; }
  .mgl-teams.ffa { grid-template-columns: minmax(0, 1fr); }
  .mgl-room .team-head { min-height: 2.5rem; padding-left: .875rem; }
  .mgl-room .team-head .tname { font-size: 1.125rem; }
  .mgl-room .prow2 { min-height: 3rem; padding: .375rem .625rem; gap: .625rem; }
  .mgl-room .prow2 .av.s40 { width: 2rem; height: 2rem; }
  .mgl-room .prow2.invite .plus { width: 2rem; height: 2rem; }
  .mgl-rmain > .mgl-chatrow { display: none; }
  .mgl-rulechips { flex-wrap: wrap; }
  .mgl-rulechips .rc-list { flex-wrap: wrap; overflow: visible; }
  .mgl-rulechips .chip { height: 1.625rem; font-size: var(--fs-xs); }
  .mgl-how-t { min-height: 2.75rem; padding: 0 .75rem; }
  .mgl-how-list { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: .5rem .75rem .625rem; }
  .mgl-dock { display: none; }
  .mgl-side { grid-column: 2; grid-row: 2; display: flex; flex-direction: column; gap: .5rem; min-height: 0; overflow-y: auto;
    padding: .625rem calc(var(--pad-x) + var(--safe-r)) calc(.75rem + var(--safe-b)) .5rem; border-left: 1px solid var(--line-1); }
  .mgl-side .status { padding: .125rem .125rem .25rem; }
  .mgl-side .status > b { font-size: var(--fs-md); }
  .mgl-side .mgl-chatrow { min-height: 3rem; padding: .5rem .625rem; }
  .mgl-side .spacer { flex: 1 1 auto; }
}

/* --- wide / lg / xl: taller title card, cast cards, chat column, one dock line */
@media (min-width: 840px) and (min-height: 501px) {
  .mgl-rhead { min-height: 10rem; flex-direction: row; align-items: flex-end; gap: 1.5rem; padding: 3.5rem var(--pad-x) 1.125rem; }   /* SPEC 9.5: a low title card (~9.5rem); the roster gets the height */
  .mgl-rhead > .scrim { background: linear-gradient(to right, rgba(10, 8, 6, .55) 0%, rgba(10, 8, 6, .15) 50%, rgba(10, 8, 6, .5) 100%),
                                  linear-gradient(to top, var(--bg-app) 0%, rgba(13, 10, 8, 0) 62%); }
  .mgl-rhead .rh-art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to right, var(--band) 0%, rgba(10, 8, 6, .6) 16%, rgba(10, 8, 6, 0) 46%); }
  .mgl-rhead .rh-top { top: .875rem; right: auto; }
  .mgl-rhead .rh-top .spacer, .mgl-rhead .rh-top .mgl-code-chip, .mgl-rhead .rh-top .rh-more { display: none; }
  .mgl-rhead .rh-title { flex: 1; }
  .mgl-rhead .rh-name { font-size: var(--fs-d3); }
  .mgl-rhead .rh-side { display: flex; align-items: center; gap: .625rem; }
  .mgl-rbody { display: grid; grid-template-columns: minmax(0, 1fr) 22rem; gap: 1rem; padding: 0 var(--pad-x) 1rem; }
  .mgl-rmain { padding: .25rem .25rem .25rem 0; margin-right: -.25rem; }
  .mgl-teams { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
  .mgl-teams.ffa { grid-template-columns: minmax(0, 1fr); }
  .mgl-room .cast { display: grid; grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr)); gap: .625rem; padding: .875rem; }
  .mgl-room .rows { display: none; }
  .mgl-rulechips .rc-list { flex-wrap: wrap; overflow: visible; -webkit-mask-image: none; mask-image: none; }
  .mgl-rmain > .mgl-chatrow { display: none; }
  .mgl-chat { display: flex; }
  .mgl-how-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mgl-dock { flex-wrap: nowrap; gap: .75rem; }
  .mgl-dock .status { flex: 1 1 auto; }
  .mgl-dock .mgl-conn { flex: 1 1 auto; }
  .mgl-dock .d-actions { flex: none; }
  .mgl-dock .d-actions > .go { flex: none; min-width: 12rem; }
  .mgl-dock .leave { display: inline-flex; }
  .mgl-dock.host .d-actions > .ready-t { width: auto; padding: 0 1.125rem; }
  .mgl-dock.host .d-actions > .ready-t > span { position: static; width: auto; height: auto; overflow: visible; clip: auto; }
  .mgl-dock .d-actions > .btn { --b-h: var(--ctl-lg); }   /* one height for the whole action row (like the stage actions) */
}
/* wide (tablets, small windows): the roster gets the full width (cast 3 columns); the chat is the chat row + sheet */
@media (min-width: 840px) and (max-width: 1199px) and (min-height: 501px) {
  .mgl-rbody { grid-template-columns: minmax(0, 1fr); }
  .mgl-chat { display: none; }
  .mgl-rmain > .mgl-chatrow { display: flex; }
  .mgl-room .cast { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 1600px) and (min-height: 700px) {
  .mgl-rbody { grid-template-columns: minmax(0, 1fr) 24rem; }
  .mgl-rhead { min-height: clamp(10.5rem, 19vh, 14rem); }
}
/* portrait phones: Kuralları Düzenle and Davet Et live in the header "⋯" menu; nothing below 12 px */
@media (max-width: 839px) and (min-height: 501px) {
  .mgl-rulechips .rc-edit { display: none; }
  .mgl-rulechips .rc-list { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 2rem), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 2rem), transparent); }
  .mgl-rulechips .rc-list.at-end { -webkit-mask-image: none; mask-image: none; }
  /* the second status line says what to do next ("… kişi daha gerekiyor · Arkadaşlarını davet et"): two lines, never "…" */
  .mgl-dock .status > .l2 > .tx { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; text-overflow: clip; }
}
@media (min-width: 600px) and (max-width: 839px) and (min-height: 501px) {
  .mgl-rmain > *, .mgl-dock > * { max-width: 44rem; width: 100%; margin-inline: auto; }
}

/* ================================================================ 10. SUB-PAGE SHELL OVERRIDE (lobby; SPEC 6.2 / 9.5). While the room view is open on phones it
   replaces the top band + tab bar (portrait) or the rail (landscape). hub.js has no API for this yet, so the lobby toggles
   .mgl-sub on .hub-view (request to foundation: shell.setSubPage(on); then delete this block). */
@media (max-width: 839px) and (min-height: 501px) {
  .hub-view.mgl-sub > .topband, .hub-view.mgl-sub > .tabbar { display: none; }
}
@media (min-width: 600px) and (max-height: 500px) {
  .hub-view.mgl-sub { grid-template-columns: minmax(0, 1fr); }
  .hub-view.mgl-sub > .rail { display: none; }
  .hub-view.mgl-sub > .hub-main { grid-column: 1; }
}
/* xl: the room uses the full width (SPEC 6.2: "room and character use the full width instead" of the social band) */
@media (min-width: 1600px) and (min-height: 700px) {
  .hub-view.has-social.mgl-sub { grid-template-columns: minmax(0, 1fr); }
  .hub-view.has-social.mgl-sub > .social { display: none; }
}

/* ================================================================ 11. ranking sheet (SPEC 9.6) */
.mgl-rankwrap { display: grid; gap: .75rem; }
.mgl-rankwrap .rk-scroll { overflow-x: auto; }
/* fixed layout: the name column takes what the number columns leave and ellipsizes (phones never clip "Puan") */
.mgl-rank { width: 100%; table-layout: fixed; border-collapse: collapse; font-size: var(--fs-sm); }
.mgl-rank th { padding: .375rem .5rem; border-bottom: 1px solid var(--line-2); text-align: left; white-space: nowrap;
  font-family: var(--font-display); font-weight: 700; font-size: var(--fs-k3); letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.mgl-rank td { height: 3rem; padding: .25rem .5rem; border-top: 1px solid var(--line-1); color: var(--text-1); }
.mgl-rank tbody tr:first-child td { border-top: 0; }
.mgl-rank .rk-n { width: 3rem; text-align: center; padding-inline: .25rem; }
.mgl-rank .rk-place { display: inline-flex; align-items: center; gap: .1875rem; font-family: var(--font-display); font-weight: 800; font-size: 1.125rem; color: var(--text-2); font-feature-settings: "tnum" 1; }
.mgl-rank .rk-place > .ico { width: .875rem; height: .875rem; }
.mgl-rank tr.medal-1 td:first-child { box-shadow: inset 3px 0 0 var(--amber-300); } .mgl-rank tr.medal-1 .rk-place { color: var(--amber-300); }
.mgl-rank tr.medal-2 td:first-child { box-shadow: inset 3px 0 0 var(--paper-2); }   .mgl-rank tr.medal-2 .rk-place { color: var(--paper-2); }
.mgl-rank tr.medal-3 td:first-child { box-shadow: inset 3px 0 0 var(--amber-600); } .mgl-rank tr.medal-3 .rk-place { color: var(--amber-600); }
.mgl-rank tr.mine td { background: var(--accent-soft); }
.mgl-rank .rk-who { display: flex; align-items: center; gap: .625rem; min-width: 0; }
.mgl-rank .rk-id { display: flex; align-items: center; gap: .5rem; min-width: 0; }
.mgl-rank .rk-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; color: var(--tt, var(--text-0)); }
.mgl-rank .rk-meta { display: flex; align-items: center; gap: .5rem; flex: none; }
.mgl-rank .rk-meta .dim { color: var(--text-3); font-size: var(--fs-sm); }
.mgl-rank .num-c { width: 3.75rem; text-align: right; font-family: var(--font-display); font-weight: 700; font-size: 1.0625rem; font-feature-settings: "tnum" 1; color: var(--text-0); }
@media (max-width: 599px) {
  .mgl-rank .rk-n { width: 2.25rem; }
  .mgl-rank .num-c { width: 3rem; }
  .mgl-rank td, .mgl-rank th { padding-inline: .3125rem; }
  .mgl-rank .rk-who { gap: .5rem; }
  .mgl-rank .rk-id { flex-direction: column; align-items: flex-start; gap: .125rem; }
  .mgl-rank .rk-id .rk-name { max-width: 100%; }
  .mgl-rank .rk-meta .tag { height: 1.25rem; }
}

/* ================================================================ hover: only where hovering exists (P12) */
@media (hover: hover) and (pointer: fine) {
  .mgl-posters .mcard .playdisc { pointer-events: auto; cursor: pointer; }
  .mc-tile:hover:not([aria-checked="true"]) { border-color: var(--line-3); background: var(--surface-3); }
  .mgl-radio:hover:not([aria-checked="true"]) { border-color: var(--line-3); }
  .mgl-room .pcard.invite:hover { border-color: var(--accent-line); color: var(--text-1); }
  .mgl-room button.prow2.invite:hover { background: rgba(255, 236, 214, .04); }
  .mgl-chatrow:hover { border-color: var(--line-2); background: var(--surface-2); }
}

/* ---- bots in the room (minigamesRoom.js _botCard / _botRow / _botSlot; server minigames/bots/core/room.js) ---- */
.mgl-room .pcard.bot { background: repeating-linear-gradient(135deg, rgba(120, 190, 255, .07) 0 8px, rgba(120, 190, 255, .02) 8px 16px); border-style: dashed; border-color: rgba(120, 190, 255, .35); }
.mgl-room .pcard.bot .fig > canvas { filter: drop-shadow(0 8px 6px rgba(0, 0, 0, .55)) saturate(.75); }
.mgl-room .pcard.bot .pname .pn { color: #bfe0ff; }
.mgl-room .pcard.bot .bot-lvl, .mgl-room .prow2.bot .bot-lvl { min-height: 2.25rem; padding-inline: .5rem; font-size: var(--fs-sm); }
.mgl-room .pcard.bot.lvl-kolay .bot-lvl, .mgl-room .prow2.bot.lvl-kolay .bot-lvl { color: #8fe3a0; }
.mgl-room .pcard.bot.lvl-zor .bot-lvl, .mgl-room .prow2.bot.lvl-zor .bot-lvl { color: #ff9a8a; }
.mgl-room .prow2.bot { background: rgba(120, 190, 255, .05); }
.mgl-room .prow2.bot .pn { color: #bfe0ff; }
.mgl-room .bot-add .plus { background: rgba(120, 190, 255, .14); color: #bfe0ff; }
.mgl-dock .bot-fill { flex: none; }
