/* MorFM live-room responsive layer. Loaded as an extra stylesheet; specificity intentionally beats legacy inline layout rules. */
:root{--morfm-room-mobile-dock-height:70px;--morfm-room-keyboard-offset:0px;--morfm-room-mobile-vh:100dvh;--morfm-room-safe-bottom:env(safe-area-inset-bottom,0px)}

/* JS may prepare sheet controls before a device breakpoint is active. Never expose native buttons outside tablet/mobile mode. */
.morfm-room-sheet-close{display:none!important}

@media (max-width:1180px){
  html body .live-room-wrapper.room-reference-composition{min-width:0!important;max-width:100%!important;overflow:visible!important}
  html body .live-room-wrapper.room-reference-composition .room-premium-header,
  html body .live-room-wrapper.room-reference-composition .room-chat-card,
  html body .live-room-wrapper.room-reference-composition .room-participants-card,
  html body .live-room-wrapper.room-reference-composition .room-stage-card,
  html body .live-room-wrapper.room-reference-composition .room-request-card,
  html body .live-room-wrapper.room-reference-composition .room-my-requests-card,
  html body .live-room-wrapper.room-reference-composition .room-dj-activity-card,
  html body .live-room-wrapper.room-reference-composition .room-reference-dj-hero{min-width:0!important;max-width:100%!important}
}

@media (max-width: 1024px){
  html,body{overscroll-behavior-x:none}
  body:has(.live-room-wrapper.room-reference-composition) .morfm-main-content{padding:8px max(8px,var(--morfm-safe-right)) calc(var(--morfm-room-mobile-dock-height) + 20px + var(--morfm-safe-bottom)) max(8px,var(--morfm-safe-left))!important;max-width:none!important}
  html body .live-room-wrapper.room-reference-composition{
    display:flex!important;flex-direction:column!important;gap:10px!important;width:100%!important;max-width:100%!important;
    padding:0 0 calc(var(--morfm-room-mobile-dock-height) + var(--morfm-safe-bottom))!important;margin:0!important;overflow:visible!important;
  }
  html body .live-room-wrapper.room-reference-composition>.room-editorial-portal,
  html body .live-room-wrapper.room-reference-composition>.live-room-grid,
  html body .live-room-wrapper.room-reference-composition .live-room-stage-column.room-reference-tools-grid,
  html body .live-room-wrapper.room-reference-composition .room-left-stack{display:contents!important}

  html body .live-room-wrapper.room-reference-composition>.room-premium-header{order:1!important;display:flex!important;min-height:0!important;padding:12px!important;border-radius:16px!important;overflow:hidden!important}
  html body .live-room-wrapper.room-reference-composition .room-reference-dj-hero{order:2!important;width:100%!important;height:auto!important;min-height:0!important;max-height:none!important;margin:0!important}
  html body .live-room-wrapper.room-reference-composition .room-stage-card{order:3!important;width:100%!important;height:auto!important;min-height:0!important;max-height:none!important;margin:0!important;padding:12px!important}
  html body .live-room-wrapper.room-reference-composition .room-chat-card{order:4!important;width:100%!important;height:calc(var(--morfm-visual-viewport-height) - 180px)!important;min-height:520px!important;max-height:720px!important;margin:0!important;padding:10px!important;border-radius:16px!important;overflow:hidden!important}
  html body .live-room-wrapper.room-reference-composition .room-participants-card{order:5!important}
  html body .live-room-wrapper.room-reference-composition .room-request-card{order:6!important}
  html body .live-room-wrapper.room-reference-composition .room-my-requests-card{order:7!important}
  html body .live-room-wrapper.room-reference-composition .room-dj-activity-card{order:8!important}
  html body .live-room-wrapper.room-reference-composition .room-left-info-card{order:9!important}
  html body .live-room-wrapper.room-reference-composition .room-invite-premium-card{order:10!important}
  html body .live-room-wrapper.room-reference-composition .room-member-showcase-card{order:11!important;height:auto!important;min-height:0!important;max-height:none!important}
  html body .live-room-wrapper.room-reference-composition .room-news-ticker{order:12!important}

  html body .live-room-wrapper.room-reference-composition .room-live-cover-hero__content{gap:8px!important;align-items:flex-start!important;width:100%!important}
  html body .live-room-wrapper.room-reference-composition .room-premium-header h1{font-size:1.05rem!important;white-space:normal!important;line-height:1.2!important}
  html body .live-room-wrapper.room-reference-composition .room-premium-header>div:last-child{width:100%!important;max-width:100%!important;overflow-x:auto!important;display:flex!important;gap:6px!important;padding-bottom:2px!important}
  html body .live-room-wrapper.room-reference-composition .room-premium-header .morfm-btn,
  html body .live-room-wrapper.room-reference-composition .room-premium-header a{flex:0 0 auto!important}

  html body .live-room-wrapper.room-reference-composition .dj-hero-main{grid-template-columns:82px minmax(0,1fr)!important;gap:9px!important;padding:8px 10px!important}
  html body .live-room-wrapper.room-reference-composition .dj-hero-avatar-wrap{width:78px!important;height:78px!important}
  html body .live-room-wrapper.room-reference-composition .dj-hero-avatar-ring{width:74px!important;height:74px!important}
  html body .live-room-wrapper.room-reference-composition .dj-hero-side{display:none!important}
  html body .live-room-wrapper.room-reference-composition .dj-hero-stats{grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:6px!important}
  html body .live-room-wrapper.room-reference-composition .dj-stat-chip:last-child{grid-column:1/-1!important}
  html body .live-room-wrapper.room-reference-composition .dj-now-playing{grid-template-columns:40px minmax(0,1fr) auto!important;margin:0 8px 8px!important;padding:8px!important}
  html body .live-room-wrapper.room-reference-composition .dj-now-waveform{display:none!important}

  html body .live-room-wrapper.room-reference-composition .room-stage-card #stage-seats-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:7px!important}
  html body .live-room-wrapper.room-reference-composition .room-stage-card .stage-seat-box{min-height:92px!important;padding:7px 4px!important}

  html body .live-room-wrapper.room-reference-composition .room-chat-card #room-messages-container{min-height:0!important;max-height:none!important;overflow-y:auto!important;-webkit-overflow-scrolling:touch!important;padding-bottom:8px!important}
  html body .live-room-wrapper.room-reference-composition .room-chat-card #room-chat-form{position:sticky!important;bottom:0!important;z-index:22!important;margin-top:auto!important;padding:6px!important;background:rgba(10,14,30,.97)!important;backdrop-filter:blur(12px)!important}
  html body .live-room-wrapper.room-reference-composition .room-chat-card #room-msg-input{min-height:44px!important;font-size:16px!important}
  html body .live-room-wrapper.room-reference-composition .room-chat-card #room-chat-form>button{min-width:44px!important;min-height:44px!important}
  html body .live-room-wrapper.room-reference-composition .room-chat-card #room-live-poll{position:relative!important;inset:auto!important;width:100%!important;max-height:min(390px,48dvh)!important;margin:0 0 8px!important}
  html body .live-room-wrapper.room-reference-composition .room-chat-card.room-poll-visible #room-messages-container{padding-right:4px!important}

  /* Secondary operational cards become original-DOM bottom sheets. */
  html body .live-room-wrapper.room-reference-composition .room-participants-card,
  html body .live-room-wrapper.room-reference-composition .room-request-card,
  html body .live-room-wrapper.room-reference-composition .room-my-requests-card,
  html body .live-room-wrapper.room-reference-composition .room-dj-activity-card{
    display:none!important;position:fixed!important;left:max(8px,var(--morfm-safe-left))!important;right:max(8px,var(--morfm-safe-right))!important;
    bottom:calc(var(--morfm-room-mobile-dock-height) + 8px + var(--morfm-safe-bottom) + var(--morfm-room-keyboard-offset))!important;
    z-index:10020!important;width:auto!important;height:auto!important;min-height:0!important;max-height:min(68dvh,620px)!important;
    margin:0!important;padding:14px!important;border-radius:20px 20px 16px 16px!important;overflow:auto!important;
    background:linear-gradient(180deg,rgba(17,15,36,.995),rgba(8,10,25,.995))!important;box-shadow:0 24px 90px rgba(0,0,0,.72)!important;
  }
  html body .live-room-wrapper.room-reference-composition .room-mobile-sheet-open{display:flex!important;flex-direction:column!important}
  html body .live-room-wrapper.room-reference-composition .room-participants-card #room-participants-list{max-height:min(48dvh,430px)!important;overflow-y:auto!important}
  html body .live-room-wrapper.room-reference-composition .room-request-card,
  html body .live-room-wrapper.room-reference-composition .room-my-requests-card,
  html body .live-room-wrapper.room-reference-composition .room-dj-activity-card{max-height:min(62dvh,540px)!important}

  .morfm-room-mobile-backdrop{position:fixed;z-index:10010;inset:0;background:rgba(2,6,23,.68);backdrop-filter:blur(4px);border:0;padding:0;margin:0;width:100%;height:100%;display:none}
  .morfm-room-mobile-backdrop.is-open{display:block}
  .morfm-room-sheet-close{display:grid!important;place-items:center!important;position:sticky;top:0;z-index:4;align-self:flex-end;flex:0 0 38px!important;width:38px!important;max-width:38px!important;height:38px!important;min-height:38px!important;padding:0!important;margin:-4px -2px 4px auto!important;border:1px solid rgba(148,163,184,.22)!important;border-radius:50%!important;background:rgba(15,23,42,.96)!important;color:#e5e7eb!important;box-shadow:0 8px 20px rgba(0,0,0,.28)!important;font-size:20px!important;line-height:1!important;cursor:pointer;appearance:none!important;-webkit-appearance:none!important}
  .morfm-room-mobile-dock{position:fixed;z-index:10030;left:max(8px,var(--morfm-safe-left));right:max(8px,var(--morfm-safe-right));bottom:max(8px,var(--morfm-safe-bottom));height:var(--morfm-room-mobile-dock-height);display:grid;grid-template-columns:repeat(4,1fr);gap:6px;padding:7px;border:1px solid rgba(148,163,184,.18);border-radius:18px;background:rgba(8,10,24,.96);backdrop-filter:blur(18px);box-shadow:0 18px 50px rgba(0,0,0,.55)}
  .morfm-room-mobile-dock button{min-width:0;min-height:54px;border:1px solid rgba(148,163,184,.12);border-radius:12px;background:rgba(255,255,255,.045);color:#cbd5e1;font-size:.67rem;font-weight:850;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;padding:4px;cursor:pointer}
  .morfm-room-mobile-dock button span:first-child{font-size:1.05rem;line-height:1}
  .morfm-room-mobile-dock button.is-active{color:#fff;border-color:rgba(168,85,247,.58);background:linear-gradient(145deg,rgba(124,58,237,.34),rgba(219,39,119,.18))}
  body.morfm-room-sheet-active{overflow:hidden!important}

  /* Let informational/editorial cards remain compact below the primary experience. */
  html body .live-room-wrapper.room-reference-composition .room-left-info-card,
  html body .live-room-wrapper.room-reference-composition .room-invite-premium-card,
  html body .live-room-wrapper.room-reference-composition .room-member-showcase-card,
  html body .live-room-wrapper.room-reference-composition .room-news-ticker{width:100%!important;max-width:100%!important;margin:0!important}
}

@media(max-width:390px){
  html body .live-room-wrapper.room-reference-composition .room-chat-card{height:calc(var(--morfm-visual-viewport-height) - 165px)!important;min-height:500px!important}
  .morfm-room-mobile-dock{left:max(5px,var(--morfm-safe-left));right:max(5px,var(--morfm-safe-right));gap:4px;padding:5px}
  .morfm-room-mobile-dock button{font-size:.61rem}
}


/* =========================================================
   MORFM ROOM TABLET / MOBILE POLISH — 2026-09-14
   Stable header controls, keyboard-safe private DM and
   tablet bottom sheets. Desktop compositions stay untouched.
   ========================================================= */
@media (max-width:1500px){
  html body .live-room-wrapper.room-reference-composition>.room-premium-header.room-live-cover-hero{
    align-items:flex-start!important;
    flex-wrap:wrap!important;
    gap:10px!important;
  }
  html body .live-room-wrapper.room-reference-composition .room-live-cover-hero__content{
    flex:1 1 100%!important;
    width:100%!important;
    max-width:100%!important;
  }
  html body .live-room-wrapper.room-reference-composition .room-header-actions{
    width:100%!important;
    max-width:100%!important;
    margin-left:0!important;
    display:flex!important;
    align-items:center!important;
    justify-content:flex-start!important;
    flex-wrap:nowrap!important;
    gap:8px!important;
    overflow-x:auto!important;
    overflow-y:hidden!important;
    padding:2px 1px 6px!important;
    scroll-snap-type:x proximity;
    overscroll-behavior-inline:contain;
    scrollbar-width:none;
    -webkit-overflow-scrolling:touch;
  }
  html body .live-room-wrapper.room-reference-composition .room-header-actions::-webkit-scrollbar{display:none}
  html body .live-room-wrapper.room-reference-composition .room-header-actions>*{
    flex:0 0 auto!important;
    scroll-snap-align:start;
    min-height:40px!important;
  }
}

@media (max-width:1024px){
  /* Header becomes a compact room identity + horizontally scrollable action rail. */
  html body .live-room-wrapper.room-reference-composition>.room-premium-header{
    padding:12px!important;
    border-radius:18px!important;
  }
  html body .live-room-wrapper.room-reference-composition .room-live-cover-hero__content{
    align-items:flex-start!important;
    gap:10px!important;
  }
  html body .live-room-wrapper.room-reference-composition .room-live-cover-hero__content>a:first-child{
    flex:0 0 42px!important;
    width:42px!important;
    height:42px!important;
  }
  html body .live-room-wrapper.room-reference-composition .room-header-actions .morfm-btn,
  html body .live-room-wrapper.room-reference-composition .room-header-actions>a,
  html body .live-room-wrapper.room-reference-composition .room-header-actions>button{
    min-height:42px!important;
    height:42px!important;
    padding-left:11px!important;
    padding-right:11px!important;
    border-radius:11px!important;
    font-size:.76rem!important;
  }

  /* Floating private DM becomes a true keyboard-safe mobile/tablet surface. */
  #in-room-dm-dock{
    left:max(10px,var(--morfm-safe-left))!important;
    right:max(10px,var(--morfm-safe-right))!important;
    bottom:calc(max(10px,var(--morfm-safe-bottom)) + var(--morfm-room-keyboard-offset))!important;
    width:auto!important;
    max-width:none!important;
    height:min(690px,calc(var(--morfm-visual-viewport-height) - 20px - var(--morfm-safe-top) - var(--morfm-safe-bottom)))!important;
    max-height:calc(var(--morfm-visual-viewport-height) - 20px - var(--morfm-safe-top) - var(--morfm-safe-bottom))!important;
    border-radius:20px!important;
    z-index:10060!important;
    box-shadow:0 24px 90px rgba(0,0,0,.78),0 0 30px rgba(168,85,247,.20)!important;
  }
  #in-room-dm-dock>div:first-child{flex:0 0 auto!important;padding:11px 12px!important;gap:8px!important}
  #inroom-dm-chat-view,#inroom-dm-list-view{min-height:0!important;overflow:hidden!important}
  #inroom-dm-messages-container{min-height:0!important;overscroll-behavior:contain!important;-webkit-overflow-scrolling:touch!important;padding:12px!important}
  #inroom-dm-chat-view>div:last-child{flex:0 0 auto!important;padding:9px 10px calc(9px + var(--morfm-safe-bottom))!important}
  #inroom-dm-form{
    display:grid!important;
    grid-template-columns:44px minmax(0,1fr) 48px!important;
    align-items:center!important;
    gap:7px!important;
    width:100%!important;
  }
  #inroom-dm-form .room-action-btn{width:44px!important;min-width:44px!important;height:44px!important;min-height:44px!important;padding:0!important;display:grid!important;place-items:center!important}
  #inroom-dm-input{width:100%!important;min-width:0!important;height:44px!important;min-height:44px!important;padding:0 11px!important;font-size:16px!important;line-height:1.25!important}
  #inroom-dm-form button[type="submit"]{width:48px!important;min-width:48px!important;height:44px!important;min-height:44px!important;padding:0!important;display:grid!important;place-items:center!important}
  #inroom-dm-emoji-bar{grid-template-columns:repeat(4,1fr)!important;max-height:108px!important;overflow-y:auto!important}
  #in-room-dm-minimized-pill{right:max(10px,var(--morfm-safe-right))!important;bottom:calc(max(10px,var(--morfm-safe-bottom)) + var(--morfm-room-mobile-dock-height))!important;z-index:10070!important}
}

/* Phone-specific density: immersive chat/DM without clipped keyboard controls. */
@media (max-width: 760px){
  html body .live-room-wrapper.room-reference-composition .room-header-actions{gap:6px!important}
  html body .live-room-wrapper.room-reference-composition .room-header-actions .morfm-btn,
  html body .live-room-wrapper.room-reference-composition .room-header-actions>a,
  html body .live-room-wrapper.room-reference-composition .room-header-actions>button{font-size:.72rem!important;padding-left:10px!important;padding-right:10px!important}
  #in-room-dm-dock{
    top:calc(max(6px,var(--morfm-safe-top)))!important;
    bottom:calc(max(6px,var(--morfm-safe-bottom)) + var(--morfm-room-keyboard-offset))!important;
    height:auto!important;
    max-height:none!important;
    border-radius:17px!important;
  }
  #inroom-dm-view-switch-btn{width:40px!important;min-width:40px!important;height:40px!important;min-height:40px!important;padding:0!important;font-size:0!important;display:grid!important;place-items:center!important}
  #inroom-dm-view-switch-btn::after{content:"📋";font-size:1rem!important}
  #in-room-dm-dock>div:first-child button[title="Simge Durumuna Küçült"],
  #in-room-dm-dock>div:first-child button[title="Kapat"]{width:40px!important;height:40px!important;min-height:40px!important;padding:0!important}
  #inroom-dm-messages-container{padding:10px!important;gap:8px!important}
  .inroom-dm-bubble-me,.inroom-dm-bubble-other{max-width:88%!important;padding:9px 11px!important}
}

/* =========================================================
   MorFM mobile sheet host v2
   Operational cards are temporarily moved out of desktop grid wrappers while
   opened. This prevents grid/height/overflow rules from collapsing their
   contents on phones and installed PWA mode.
   ========================================================= */
@media (max-width:1024px){
  .morfm-room-sheet-host[hidden]{display:none!important}
  .morfm-room-sheet-host{
    position:fixed!important;
    z-index:10025!important;
    left:max(7px,env(safe-area-inset-left,0px))!important;
    right:max(7px,env(safe-area-inset-right,0px))!important;
    bottom:calc(var(--morfm-room-mobile-dock-height,70px) + 10px + env(safe-area-inset-bottom,0px) + var(--morfm-room-keyboard-offset,0px))!important;
    max-height:min(76dvh,680px)!important;
    display:flex!important;
    align-items:flex-end!important;
    pointer-events:none!important;
    opacity:0!important;
    transform:translateY(18px)!important;
    transition:opacity .18s ease,transform .18s ease!important;
  }
  .morfm-room-sheet-host.is-open{opacity:1!important;transform:translateY(0)!important}
  .morfm-room-sheet-dialog{
    width:100%!important;
    max-height:min(76dvh,680px)!important;
    min-height:220px!important;
    display:flex!important;
    flex-direction:column!important;
    overflow:hidden!important;
    pointer-events:auto!important;
    border:1px solid rgba(192,132,252,.28)!important;
    border-radius:22px!important;
    background:linear-gradient(180deg,rgba(20,16,39,.995),rgba(7,10,25,.995))!important;
    box-shadow:0 28px 90px rgba(0,0,0,.72),inset 0 1px rgba(255,255,255,.045)!important;
    backdrop-filter:blur(22px)!important;
  }
  .morfm-room-sheet-header{
    flex:0 0 auto!important;
    min-height:52px!important;
    padding:8px 10px 8px 14px!important;
    display:grid!important;
    grid-template-columns:28px minmax(0,1fr) 38px!important;
    align-items:center!important;
    gap:8px!important;
    border-bottom:1px solid rgba(148,163,184,.12)!important;
    background:linear-gradient(180deg,rgba(255,255,255,.04),rgba(255,255,255,.015))!important;
  }
  .morfm-room-sheet-header strong{min-width:0!important;color:#fff!important;font-size:.88rem!important;font-weight:950!important;white-space:nowrap!important;overflow:hidden!important;text-overflow:ellipsis!important}
  .morfm-room-sheet-grip{width:28px!important;height:4px!important;border-radius:999px!important;background:rgba(203,213,225,.36)!important}
  .morfm-room-sheet-host .morfm-room-sheet-close{
    position:static!important;display:grid!important;place-items:center!important;
    width:36px!important;max-width:36px!important;height:36px!important;min-height:36px!important;
    margin:0!important;padding:0!important;border-radius:11px!important;
    border:1px solid rgba(148,163,184,.18)!important;background:rgba(255,255,255,.05)!important;
    color:#e5e7eb!important;font-size:20px!important;line-height:1!important;cursor:pointer!important;
  }
  .morfm-room-sheet-slot{
    min-height:0!important;flex:1 1 auto!important;overflow:auto!important;-webkit-overflow-scrolling:touch!important;
    padding:8px!important;overscroll-behavior:contain!important;
  }

  /* The actual production cards live here while a sheet is open. Reset all
     desktop positioning/height constraints without touching their internals. */
  .morfm-room-sheet-slot>.room-participants-card,
  .morfm-room-sheet-slot>.room-request-card,
  .morfm-room-sheet-slot>.room-my-requests-card,
  .morfm-room-sheet-slot>.room-dj-activity-card{
    display:flex!important;
    position:relative!important;
    inset:auto!important;
    left:auto!important;right:auto!important;top:auto!important;bottom:auto!important;
    width:100%!important;max-width:100%!important;
    height:auto!important;min-height:0!important;max-height:none!important;
    margin:0!important;padding:10px!important;
    overflow:visible!important;
    border-radius:15px!important;
    transform:none!important;
    opacity:1!important;
    visibility:visible!important;
    pointer-events:auto!important;
  }
  .morfm-room-sheet-slot>.room-participants-card{min-height:300px!important}
  .morfm-room-sheet-slot>.room-participants-card>div:first-of-type{flex:0 0 auto!important;display:block!important}
  .morfm-room-sheet-slot>.room-participants-card #room-participants-list{
    display:flex!important;flex-direction:column!important;flex:1 1 auto!important;
    min-height:180px!important;max-height:min(48dvh,430px)!important;overflow-y:auto!important;
  }
  .morfm-room-sheet-slot>.room-request-card>* ,
  .morfm-room-sheet-slot>.room-my-requests-card>* ,
  .morfm-room-sheet-slot>.room-dj-activity-card>*{visibility:visible!important;opacity:1!important}
  .morfm-room-sheet-slot .dj-request-list,
  .morfm-room-sheet-slot .dj-live-queue,
  .morfm-room-sheet-slot .dj-activity-list{max-height:min(44dvh,380px)!important;overflow:auto!important}
  .morfm-room-sheet-slot .dj-ops-grid{display:grid!important}
  .morfm-room-sheet-slot input,
  .morfm-room-sheet-slot select,
  .morfm-room-sheet-slot textarea{font-size:16px!important}

  body.morfm-room-sheet-active{overflow:hidden!important;touch-action:none!important}
  body.morfm-room-sheet-active .morfm-room-sheet-dialog,
  body.morfm-room-sheet-active .morfm-room-mobile-dock{touch-action:auto!important}
}
