/* ============================================================================
 * DNBSECTOR.LIVE - Welle 2: Responsive Layout fuer Laptops, Tablets & Handys
 * WICHTIG: Alle Regeln sind strikt auf body:not(.dnb-obs-clean) begrenzt,
 * damit ?obs=true exakt das 1920x1080 Broadcast-Overlay beibehaelt!
 * ============================================================================ */

/* 1. Kompakte Desktop- & Laptop-Screens (1025px - 1540px, z. B. 13"/14" Laptops) */
@media (max-width: 1540px) {
  body:not(.dnb-obs-clean) .overlay-container {
    grid-template-columns: clamp(265px, 23vw, 410px) minmax(420px, 1fr) clamp(265px, 23vw, 410px) !important;
    gap: 12px !important;
    padding: 10px !important;
  }

  body:not(.dnb-obs-clean) .building {
    padding: 8px !important;
    gap: 8px !important;
  }

  body:not(.dnb-obs-clean) .neon-sign {
    font-size: 11px !important;
    letter-spacing: 1.5px !important;
    padding: 2px 8px !important;
  }

  body:not(.dnb-obs-clean) .building-header {
    font-size: 9.5px !important;
    letter-spacing: 1.2px !important;
  }

  body:not(.dnb-obs-clean) #dnb-178bpm-window {
    right: 20px !important;
    top: 72px !important;
  }

  body:not(.dnb-obs-clean) .main-dj-booth {
    padding: 8px 72px !important;
  }
}

/* 2. Tablets & Smartphones (<= 1024px): Center-Stage + Livestream + Chat zuerst! */
@media (max-width: 1024px) {
  html:has(body:not(.dnb-obs-clean)),
  body:not(.dnb-obs-clean) {
    width: 100% !important;
    height: auto !important;
    min-height: 100dvh !important;
    max-height: none !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  body:not(.dnb-obs-clean) .overlay-container {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    height: auto !important;
    min-height: 100dvh !important;
    padding: 8px !important;
    gap: 10px !important;
  }

  /* Center-Stage (OBS Stream + Chat + DJ-Booth) direkt ganz oben */
  body:not(.dnb-obs-clean) .center-stage {
    order: 1 !important;
    width: 100% !important;
    height: auto !important;
    gap: 8px !important;
  }

  body:not(.dnb-obs-clean) .camera-frame {
    flex: none !important;
    width: 100% !important;
    min-height: 540px !important;
    height: 68dvh !important;
    max-height: 760px !important;
    border-radius: 14px !important;
  }

  body:not(.dnb-obs-clean) .dj-console-wrapper {
    height: 76px !important;
  }

  body:not(.dnb-obs-clean) .dj-hologram {
    font-size: 9px !important;
    letter-spacing: 2px !important;
    margin-bottom: 3px !important;
  }

  body:not(.dnb-obs-clean) .main-dj-booth {
    width: 100% !important;
    height: 58px !important;
    padding: 6px 66px !important;
  }

  body:not(.dnb-obs-clean) .turntable {
    top: 8px !important;
    width: 40px !important;
    height: 40px !important;
  }

  body:not(.dnb-obs-clean) .left-deck { left: 10px !important; }
  body:not(.dnb-obs-clean) .right-deck { right: 10px !important; }

  body:not(.dnb-obs-clean) .vinyl-ring {
    width: 30px !important;
    height: 30px !important;
  }

  /* Club-Gebaeude sauber scrollbar unterhalb der Mainstage */
  body:not(.dnb-obs-clean) .right-building {
    order: 2 !important;
    width: 100% !important;
    height: auto !important;
  }

  body:not(.dnb-obs-clean) .left-building {
    order: 3 !important;
    width: 100% !important;
    height: auto !important;
  }

  body:not(.dnb-obs-clean) .right-building .arena-merged-room {
    flex: none !important;
    height: 390px !important;
  }

  body:not(.dnb-obs-clean) .right-building #room-bar,
  body:not(.dnb-obs-clean) .left-building .room {
    flex: none !important;
    height: 230px !important;
  }

  /* Chat & Stage-Layer im Center-Frame mobil entschlacken */
  body:not(.dnb-obs-clean) #dnb-inframe-stage-layer {
    top: 38px !important;
    left: 10px !important;
    right: 10px !important;
    bottom: 10px !important;
    gap: 6px !important;
  }

  body:not(.dnb-obs-clean) #dnb-inframe-chat {
    width: 100% !important;
    max-width: 100% !important;
  }

  body:not(.dnb-obs-clean) #dnb-stage-screen-card {
    width: 100% !important;
    max-width: 100% !important;
  }

  body:not(.dnb-obs-clean) .dnb-chip-row {
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }

  body:not(.dnb-obs-clean) #dnb-side-drawer {
    width: min(308px, 84vw) !important;
    max-height: 84dvh !important;
  }

  body:not(.dnb-obs-clean) #dnb-obs-control-panel {
    width: min(368px, calc(100vw - 16px)) !important;
    left: 8px !important;
    right: 8px !important;
    top: 10px !important;
    margin: 0 auto !important;
    max-height: 86dvh !important;
  }

  body:not(.dnb-obs-clean) #dnb-178bpm-window {
    width: min(310px, calc(100vw - 16px)) !important;
    left: 8px !important;
    right: 8px !important;
    top: 16px !important;
    margin: 0 auto !important;
  }
}

/* 3. Kompakte Smartphone-Portrait-Ansicht (<= 640px) */
@media (max-width: 640px) {
  body:not(.dnb-obs-clean) .camera-frame {
    min-height: 460px !important;
    height: 70dvh !important;
  }

  body:not(.dnb-obs-clean) .tracking-indicator {
    font-size: 9px !important;
    top: 10px !important;
    left: 12px !important;
    letter-spacing: 0.8px !important;
    max-width: 48%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body:not(.dnb-obs-clean) .ws-status {
    font-size: 9px !important;
    top: 10px !important;
    right: 12px !important;
    letter-spacing: 0.6px !important;
  }

  body:not(.dnb-obs-clean) .cam-telemetry,
  body:not(.dnb-obs-clean) .side-meter {
    display: none !important;
  }

  body:not(.dnb-obs-clean) #dnb-obs-floating-bar {
    top: 30px !important;
    max-width: calc(100% - 14px) !important;
    padding: 3px 7px !important;
    gap: 4px !important;
    overflow-x: auto !important;
  }

  body:not(.dnb-obs-clean) #dnb-chat-log {
    height: 84px !important;
    font-size: 11px !important;
  }

  body:not(.dnb-obs-clean) .dnb-input-bar {
    gap: 4px !important;
    padding: 5px 6px !important;
  }

  body:not(.dnb-obs-clean) #dnb-user-input {
    width: 84px !important;
    font-size: 11px !important;
  }

  body:not(.dnb-obs-clean) #dnb-text-input {
    min-width: 0 !important;
    font-size: 11px !important;
  }

  body:not(.dnb-obs-clean) .dnb-chat-bar {
    font-size: 9.5px !important;
    padding: 5px 7px !important;
  }

  body:not(.dnb-obs-clean) #dnb-wanzl-stage-rig {
    transform: scale(0.76);
    transform-origin: bottom center;
  }

  body:not(.dnb-obs-clean) .speech-bubble {
    max-width: 220px !important;
    font-size: 12.5px !important;
    padding: 7px 10px !important;
  }
}
