.media-panel { margin-bottom: 14px; padding: 14px 18px; }
.media-heading { display: flex; justify-content: space-between; align-items: start; gap: 12px; flex-wrap: wrap; }
.media-heading h2 { margin: 0; color: #d5dfee; font-size: 18px; }
.media-heading p, .media-hint { margin: 5px 0 9px; color: #ced6e2; }
.media-heading label { display: flex; gap: 7px; align-items: center; flex-wrap: wrap; font-size: 13px; }
.media-heading select { background: #13233b; border: 1px solid #5d7393; color: #eef2f9; font: inherit; padding: 6px; }
.media-buttons { display: flex; flex-wrap: wrap; gap: 7px; }
.media-buttons button { padding: 7px 11px; font-size: 13px; }
.media-buttons [aria-pressed="true"] { border-color: #9cb7e1; color: #c7d9f4; }
.media-videos { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,190px),1fr)); gap: 9px; margin-top: 10px; }
.media-attendees { display:contents; }
.media-tile { position: relative; margin: 0; overflow: hidden; aspect-ratio: 16/9; background: #091629 url('/video-city.jpg') center/cover; border: 1px solid #5d7393; }

.media-tile video, #media-preview { width: 100%; height: 100%; object-fit: contain; background: #040c17; }
.media-tile figcaption { position: absolute; inset: auto 0 0; padding: 8px; color: #f4f6fb; background: linear-gradient(transparent,#061121e8); }
#media-panel details { margin-top: 9px; }
#media-panel summary { cursor: pointer; color: #c2d0e6; padding: 5px 0; }
#media-preflight summary { width: fit-content; padding: 7px 11px; }
.media-test { display: flex; gap: 14px; flex-wrap: wrap; align-items: start; margin-top: 8px; }
.media-test p { margin: 3px 0; color: #dee3ec; }
.media-test meter { width: min(100%, 220px); }
#media-preview { max-width: 232px; aspect-ratio: 16/9; border: 1px solid #5d7393; }
#media-roster { margin-top: 12px; padding-top: 10px; border-top: 1px solid #455773; }
.roster-heading h3 { margin: 0; color: #c2d0e6; font-size: 15px; }
#media-roster-list { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,230px),1fr)); gap: 6px; max-height: 185px; overflow: auto; padding: 0; margin: 4px 0 0; list-style: none; }
#media-roster-list li { min-width: 0; background: #0c1c34; padding: 7px 9px; border: 1px solid #354865; overflow-wrap: anywhere; }
#media-roster-list small { display: block; margin-top: 4px; color: #bec8d6; }
#media-panel [hidden] { display: none; }

.media-guide {
  width: min(calc(100% - 32px),640px);
  max-height: calc(100% - 32px);
  padding: clamp(18px,4vw,29px);
  color: #e6ecf3;
  background: linear-gradient(155deg,#1c293d,#0f1b2e 68%);
  border: 1px solid #9ab08a;
  border-radius: 12px;
  box-shadow: 0 0 0 4px #1d2a3d, 0 22px 78px #000b;
}
.media-guide::backdrop { background: #050e1cb8; }
.media-guide h2 { margin: 0 0 17px; color: #d5dfee; font-size: 24px; }
.media-guide-steps { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 12px; list-style: none; padding: 0; margin: 0 0 16px; }
.media-guide-steps li {
  min-width: 0; position: relative; padding: 10px 4px;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  font-size: 12px; text-align: center; color: #d0d7e2; background: #132136;
  border: 1px solid #4d5a6e; border-radius: 6px;
}
.media-guide-steps li + li::before { content: "›"; position: absolute; left: -11px; top: 31%; color: #a2b4cf; font-size: 16px; }
.media-guide-steps [aria-current="step"] { background: #364337; border-color: #a8bbd7; color: #cfdbec; box-shadow: 0 0 12px #a4b8d720; }
.media-guide-steps svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.media-guide-description { margin: 0 0 14px; line-height: 1.5; }
.media-guide #media-device-controls .media-hint { display: none; }
.media-guide #media-device-controls .media-buttons button:not(.guide-current) { display: none; }
.media-guide .guide-current, #media-guide-connect { position: relative; margin-left: 26px; border-color: #b0c1db; }
.media-guide .guide-current::before, #media-guide-connect::before {
  content: "➜"; position: absolute; left: -25px; top: 50%; transform: translateY(-50%);
  color: #b6c8e2; font-size: 17px; text-shadow: 0 0 9px #94aed46b;
}
.media-guide:not([data-step="0"]) :is(#media-mic-result,#media-level),
.media-guide:not([data-step="1"]) #media-camera-result,
.media-guide:not([data-step="2"]) #media-speaker-result { display: none; }
.media-guide-footer { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-top: 19px; padding-top: 13px; border-top: 1px solid #4d5a6e; }
#media-guide-later { margin-right: auto; }
@media (max-width: 410px) {
  .media-guide-steps { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .media-guide-steps li:nth-child(3)::before { display: none; }
}

.media-tile.camera-off { background:linear-gradient(155deg,#17273f,#0b192d); }
.room-members { display:flex; flex-wrap:wrap; gap:7px; margin:0; padding:0 17px 14px; list-style:none; }
.room-members li { display:flex; align-items:center; gap:7px; padding:6px 9px; border:1px solid #344b6c; }
.room-members li>span:last-child { color:#bec7d3; font-size:12px; }

.annual-review .media-floor, .final-review .media-floor { display:grid; align-items:center; gap:12px; margin-top:12px; }
.annual-review .media-floor { grid-template-columns:repeat(3,minmax(0,1fr)); align-items:stretch; }
.media-presenter-title { display:none; }
.annual-review .media-presenter-title { display:block; }
.annual-review #media-stage-results { grid-column:1/-1; }
.final-review .media-floor { grid-template-columns:minmax(0,1fr); }
.final-review #media-year-right { grid-row:1; }
.media-review-card { min-width:0; font-size:14px; background:linear-gradient(135deg,#1c2c42,#0d1d34); border:1px solid #5c7292; }
.annual-review :is(.media-review-card,.media-stage-surface) {
  border:1px solid transparent; padding:4px; border-radius:10px 3px;
  background:linear-gradient(145deg,#1a293f,#0c1c34 72%) padding-box,
    linear-gradient(135deg,#9db0cc,#727f93 45%,#7899ca 72%,#7587a1) border-box;
  box-shadow:inset 0 0 0 4px #0a172b,0 8px 20px #0003;
  min-width:0; clip-path:none;
}
.annual-review :is(.media-review-card h3,.media-presenter-title) {
  margin:0; padding:10px 11px; color:#d7e1ef; font-size:17px; border-bottom:1px solid #77859983;
  background:linear-gradient(105deg,#50638043,#18305350 75%);
}
.annual-review .media-stage-surface { display:flex; flex-direction:column; }
.annual-review .media-stage-surface .media-stage { width:100%; margin:auto; padding:7px; }
.media-review-card h3 { margin:0; padding:10px 11px; color:#d7e1ef; font-size:17px; border-bottom:1px solid #4b5a70; }
.media-review-card h4 { margin:8px 11px 4px; color:#d7e1ef; font-size:14px; }
.media-review-card>p { margin:10px; }
.hall-city-total { display:flex; gap:4px 9px; align-items:baseline; flex-wrap:wrap; }
.hall-city-total strong { font-size:22px; color:#d7e1ef; }
.hall-city-total small { color:#a8c2e8; font-size:13px; }
.hall-ranking { width:100%; border-collapse:collapse; text-align:left; font-variant-numeric:tabular-nums; }
.hall-ranking td, .hall-ranking th { padding:6px 8px; border-bottom:1px solid #54637b5c; overflow-wrap:anywhere; }
.hall-ranking thead th { color:#bccee9; font-weight:500; }
.hall-ranking td span { display:block; font-size:12px; color:#cbd2de; }
.hall-ranking td:last-child { white-space:nowrap; }
.hall-stage-winners { list-style:none; padding:0 11px 8px; margin:0; }
.hall-stage-winners li { display:flex; justify-content:space-between; gap:4px 8px; border-top:1px solid #54637b5c; padding:4px 0; line-height:1.25; }
.hall-stage-winners strong { text-align:right; overflow-wrap:anywhere; }
.hall-stage-winners strong span { display:block; }
.hall-stage-winners time { color:#adc8ef; white-space:nowrap; font-variant-numeric:tabular-nums; }
.relay-report-scroll { margin:5px 7px 8px; overflow:auto; }
.relay-report-table { min-width:650px; }
.relay-report-table td,.relay-report-table th { padding:8px 11px; font-size:14px; }
.relay-report-stage { color:#d7e1ef; background:linear-gradient(90deg,#495568,#243145); }
.relay-report-table tr:not(.relay-report-stage):nth-child(odd) { background:#1b2b44; }
.relay-report-table tr.relay-report-best :is(td,th) { color:#afc9f0; }
.final-review .final-banner { min-height:clamp(190px,18vw,310px); border:0; margin:0; justify-content:end; }
.media-stage[data-room="hall-gallery"] .media-videos {
  display:grid; grid-template-columns:minmax(0,1fr); gap:8px; margin:0;
}
.media-stage[data-room="hall-gallery"] .media-annual-idle { width:min(100%,430px); margin-inline:auto; }
.media-stage[data-room="hall-gallery"] .media-presenter { width:min(100%,315px); justify-self:center; }
.media-stage[data-room="hall-gallery"] .media-attendees {
  display:flex; flex-wrap:wrap; justify-content:center; align-content:start; gap:8px;
  max-height:clamp(160px,36dvh,420px); overflow:auto; overscroll-behavior-y:contain; padding:2px 4px;
  scrollbar-gutter:stable both-edges; scrollbar-color:#5a7194 #132137;
}
.media-stage[data-room="hall-gallery"] .media-attendees-compact { --attendee-base:135px; --attendee-limit:195px; }
.media-stage[data-room="hall-gallery"] .media-attendees:focus-visible {
  outline:2px solid #d2ddee; outline-offset:-2px;
}
.media-stage[data-room="hall-gallery"] .media-tile {
  flex:1 1 var(--attendee-base,165px); min-width:0; max-width:var(--attendee-limit,315px);
  border-radius:4px; border-color:#7b90b0;
}
.media-stage[data-room="hall-gallery"] .media-tile figcaption {
  display:flex; align-items:center; gap:6px; padding:4px 6px; font-size:13px;
}
.media-stage[data-room="hall-gallery"] .media-tile:fullscreen { max-width:none; width:100vw; height:100vh; }
.final-district > button { margin:0 12px 10px; }
.final-review .final-banner.city-lost {
  background:linear-gradient(0deg,#140f11 0%,#140f11b8 30%,#1f171615 76%),url('/city-fallen.jpg') center 48%/cover;
}
.final-infrastructure strong { color:#d5dfee; }
@media(max-width:900px) {
  .annual-review .media-floor { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .annual-review .media-stage-surface { grid-column:1/-1; grid-row:1; width:min(100%,510px); justify-self:center; }
}
@media(max-width:650px) {
  .annual-review .media-floor,.final-review .media-floor { grid-template-columns:minmax(0,1fr); }
}

.playing-challenge #media-panel .media-heading>div { display:flex; flex-wrap:wrap; align-items:baseline; gap:0 9px; }
.playing-challenge #media-panel .media-floor { display:none; }
.playing-challenge #media-panel { margin-top:0; }
.district-room-layout { display:flex; flex-direction:column; align-items:stretch; gap:10px; }
.district-room-layout :is(#screen,#media-panel,#operation-bar) { width:min(100%,1100px); margin:0 auto; }
.district-room-layout:not(.discussion-room-layout) #media-panel { order:2; }
.district-room-layout .screen-stack { gap:8px; }
.district-room-layout .player-identity { min-height:54px; padding:4px 13px; }
.district-room-layout .player-identity .district-badge { width:32px; height:41px; }
.district-room-layout .player-identity .player-avatar { width:39px; height:39px; }
.district-room-layout .panel-heading { margin-bottom:7px; padding:8px 13px; }
.district-room-layout #media-panel { padding:8px 14px; }
.district-room-layout .media-heading>div { display:flex; flex-wrap:wrap; align-items:baseline; gap:0 11px; margin-bottom:5px; }
.district-room-layout .media-heading p { margin:2px 0; }
.district-room-layout .order-instructions { padding:5px 13px 10px; gap:6px; }
.district-room-layout .relay-stage { padding:10px 11px; gap:5px; }
.district-room-layout .relay-stage button { min-height:33px; }
.district-room-layout .relay-overview { padding-bottom:8px; }
.district-room-layout .room-topline { padding:6px 13px; }
.district-room-layout .room-members { padding-bottom:8px; }
.district-brief { margin:0 13px 6px; padding:9px 12px; color:#edf1f6; background:#182a45; border:1px solid #667387; }
.district-brief h4 { margin:0 0 5px; color:#d7e1ef; font-size:19px; }
.district-brief p { margin:0 0 8px; font-size:15px; }
.district-brief .district-token-rule {
  padding:7px 9px; border-left:2px solid #7b8eaa; background:#132137; color:#e2e9f4;
}
.district-brief dl { margin:0; display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:7px; }
.district-brief dl>div { border-left:1px solid #7b8eaa; padding:4px 7px; }
.district-brief dt { font-weight:700; color:#c0cfe6; }
.district-brief dd { margin:2px 0 0; font-size:14px; line-height:1.35; }

.media-stage[data-room="district"] .media-videos {
  display:flex; flex-wrap:wrap; justify-content:center; gap:8px;
  width:min(100%,var(--district-gallery,100%)); margin:10px auto 0;
}
.media-stage[data-room="district"] .media-tile { flex:0 0 var(--district-tile,100%); width:var(--district-tile,100%); height:auto; }
.media-stage[data-room="district"] .media-tile video { object-fit:contain; }
.media-stage[data-room="district"] .media-tile figcaption { padding:5px 7px; font-size:13px; }
.media-stage[data-room="hall-compact"] { width:min(100%,500px); margin:0 auto; }
.media-stage[data-room="hall-compact"] .media-tile { border-radius:3px; }
.media-annual-idle {
  min-height:0; aspect-ratio:16/9; display:grid; place-content:center; justify-items:center; gap:8px;
  border:1px solid #5c7292; background:radial-gradient(ellipse,#1d2a3d,#0b192e 78%);
}
.media-annual-idle img { width:clamp(48px,8vw,104px); }
.media-annual-idle p { color:#cdd7e7; margin:0; padding-inline:8px; text-align:center; }
.annual-review .media-stage[data-room="hall-compact"] .media-videos { margin:0; }
.annual-review .media-floor:has(#media-stage[hidden]) { grid-template-columns:repeat(2,minmax(0,1fr)); }
.final-review .media-floor:has(#media-stage[hidden]) { grid-template-columns:minmax(0,1fr); }
.media-floor:has(#media-stage[hidden]) .media-stage-surface { display:none; }
@media(max-width:650px) {
  .district-brief dl,.annual-review .media-floor:has(#media-stage[hidden]) { grid-template-columns:minmax(0,1fr); }
}

.district-room-layout .video-room-panel { min-height:0; padding-bottom:6px; }
@media(min-width:901px) and (max-height:850px) {
  .district-room-layout .district-brief { padding-block:7px; }
  .district-room-layout .district-brief p { margin-bottom:6px; font-size:14px; line-height:1.4; }
  .district-room-layout .district-brief dd { font-size:13px; line-height:1.25; }
  .district-room-layout .room-topline { padding-block:4px; }
}
@media(min-width:901px) {
  body:has(.district-room-layout) { --header-height:74px; }
  body:has(.district-room-layout) .game-header .header-brand img { max-height:66px; }
}


.media-enlarge {
  position:absolute; z-index:1; top:6px; right:6px; display:grid; place-items:center; min-width:30px; min-height:30px;
  padding:0; border-radius:4px; border:1px solid #7f8fa8; background:#09172cdc; color:#ebf0f7;
  font-size:23px; line-height:1; cursor:pointer;
}
.media-enlarge:hover,.media-enlarge:focus-visible { color:#fff; background:#293a53; }
.media-stage[data-room="district"] .media-tile:fullscreen { width:100vw; height:100vh; background:#070e13; border:0; }
.media-tile:fullscreen .media-enlarge { top:14px; right:14px; }

.media-action-icon { display:none; }

#media-panel.district-console {
  --console-chamfer:polygon(13px 0,calc(100% - 13px) 0,100% 13px,100% calc(100% - 13px),
    calc(100% - 13px) 100%,13px 100%,0 calc(100% - 13px),0 13px);
  display:grid;
  align-items:center;
  grid-template-columns:minmax(0,1fr) auto;
  grid-template-areas:"title controls" "gallery gallery";
  column-gap:12px;
  row-gap:6px;
  padding:9px;
  border:0;
  clip-path:var(--console-chamfer);
  background:linear-gradient(139deg,#748aac,#c0cfe5 19%,#4a6a99 43%,#8db2e9 66%,#38527a 81%,#97adce 100%);
}
#media-panel.district-console::before {
  z-index:-1;
  inset:1.5px;
  clip-path:var(--console-chamfer);
  background:radial-gradient(ellipse at 0 0,#6184b81f,transparent 47%),
    radial-gradient(ellipse at 86% 0,#2769cd26,transparent 55%),linear-gradient(150deg,#0e213e,#081529 70%);
}
#media-panel.district-console::after {
  top:0;
  left:4%;
  right:4%;
  height:1px;
  background:linear-gradient(90deg,transparent,#e7edf6 14%,transparent 40%,#c9dbf5 84%,transparent);
}
.district-console .media-heading { grid-area:title; padding-left:4px; min-width:0; }
.district-console .media-heading>div { margin:0; gap:0 10px; }
.district-console .media-heading h2 {
  color:#d8e2f0;
  padding:4px 15px;
  clip-path:polygon(8px 0,calc(100% - 8px) 0,100% 50%,calc(100% - 8px) 100%,8px 100%,0 50%);
  background:linear-gradient(90deg,#7e94b6,#597aab 52%,#7e94b6);
  position:relative;
  isolation:isolate;
}
.district-console .media-heading h2::before {
  content:"";
  position:absolute;
  inset:1px;
  z-index:-1;
  clip-path:inherit;
  background:linear-gradient(180deg,#142b4e,#0c1c34);
}
.district-console .media-heading p { color:#d8e1ed; font-size:13px; margin:2px 0; }
.district-console .media-call-actions { grid-area:controls; justify-content:end; gap:6px; }
.district-console .media-call-actions button:has(.media-action-icon) {
  display:grid;
  place-items:center;
  position:relative;
  min-width:35px;
  min-height:35px;
  padding:5px;
  border:1px solid #5375a8;
  border-radius:5px;
  background:linear-gradient(155deg,#12284a,#09182f);
  color:#bfd4f3;
}
.district-console .media-action-icon { display:flex; }
.district-console .media-action-icon svg { width:21px; height:21px; }
.district-console .media-action-label {
  position:absolute;
  width:1px;
  height:1px;
  overflow:hidden;
  clip-path:inset(50%);
  white-space:nowrap;
}
.district-console .media-call-actions button[aria-pressed="false"] { color:#a8b1be; }
.district-console .media-call-actions button[aria-pressed="true"] {
  border-color:#95b5e5;
  color:#cdddf6;
  box-shadow:inset 0 0 10px #4d82d21d;
}
.district-console .media-call-actions button[aria-pressed="false"]::after {
  content:"";
  position:absolute;
  width:18px;
  height:1px;
  background:#b1c4e1;
  transform:rotate(-43deg);
}
.district-console .media-call-actions button:not(:disabled):hover {
  color:#f8fafc;
  border-color:#a7bad7;
}
.district-console .media-call-actions button:focus-visible {
  outline:2px solid #e2e9f4;
  outline-offset:-3px;
}
.district-console .media-floor {
  grid-area:gallery;
  min-width:0;
}
.district-console :is(#media-preflight,#media-roster) { grid-column:1/-1; min-width:0; }
.district-console:not(.annual-review) .media-stage-surface {
  padding:5px 7px 6px;
  border:1px solid #4b6a99;
  background:radial-gradient(ellipse at 0 0,#182e4d,#081528 66%,#0e203b);
  clip-path:polygon(0 0,calc(100% - 12px) 0,100% 12px,100% calc(100% - 12px),
    calc(100% - 12px) 100%,0 100%);
}
.district-console .media-stage .media-videos { margin-top:0; }
.district-console .media-stage :is(.media-tile:not(:fullscreen),.media-annual-idle) {
  --tile-bevel:polygon(8px 0,calc(100% - 8px) 0,100% 8px,100% calc(100% - 8px),
    calc(100% - 8px) 100%,8px 100%,0 calc(100% - 8px),0 8px);
  position:relative;
  padding:1px;
  clip-path:var(--tile-bevel);
  border:0;
  background:linear-gradient(140deg,#b5c5dd,#6f819a 45%,#91b4ea 77%,#8aa1c4);
}
.district-console .media-stage :is(.media-tile:not(:fullscreen),.media-annual-idle)::before {
  content:"";
  pointer-events:none;
  position:absolute;
  z-index:-1;
  inset:1px;
  clip-path:var(--tile-bevel);
  background:radial-gradient(ellipse at top,#1a2c47,#091930 72%);
}
.district-console .media-stage .media-tile:not(:fullscreen) video {
  clip-path:var(--tile-bevel);
}
.district-console .media-stage .media-tile figcaption {
  display:flex;
  align-items:center;
  gap:6px;
  min-height:26px;
  padding:3px 5px;
  color:#eff3f9;
  background:linear-gradient(90deg,#08162bee,#08162ba6);
}
.media-tile-name { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.media-tile-indicators { display:flex; align-items:center; gap:4px; flex:none; }
.media-tile-indicators>span { position:relative; display:flex; color:#cfdef6; }
.media-tile-indicators>span[data-active="false"] { color:#9daead; }
.media-tile-indicators>span[data-active="false"]::after {
  content:"";
  position:absolute;
  inset:50% auto auto 0;
  width:14px;
  height:1px;
  background:#a6bad7;
  transform:rotate(-43deg);
}
.media-tile-indicators svg { width:14px; height:14px; }
.media-live-dot { width:7px; height:7px; margin-inline:1px 2px; border-radius:50%; background:#86ade8; box-shadow:0 0 6px #5c91e08a; }

@media(max-width:640px) {
  #media-panel.district-console { grid-template-columns:minmax(0,1fr); grid-template-areas:"title" "controls" "gallery"; }
  .district-console .media-call-actions { justify-content:start; }
  .media-stage[data-room="hall-gallery"] .media-attendees:not(.media-attendees-compact) { --attendee-base:145px; }
}

#media-roster summary { cursor:pointer; color:#bccee9; font-size:14px; line-height:1.45; }
#media-roster #copy-invite { margin-top:7px; }
#media-roster-list small { line-height:1.4; }
@media(max-width:700px) {
  .playing-challenge #media-panel:not([hidden]) { padding:4px 8px; gap:3px 8px; }
  .playing-challenge #media-panel .media-heading h2 { font-size:12px; }
  .playing-challenge #media-panel .media-heading p { font-size:11px; }
  .playing-challenge #media-panel .media-buttons button { min-height:32px; }
  .playing-challenge #media-panel .media-action-icon { display:inline-flex; }
  .playing-challenge #media-panel button:has(.media-action-icon) .media-action-label { position:absolute; clip-path:inset(50%); }
}
