/* ITAHUKA Video Platform v5.0.11 — Live Realtime Overlay refinement.
   Loaded after live-overlay-core.css. */

@media (max-width: 1180px), (pointer: coarse) {
  body[data-theme="itahuka-mobile-live-overlay"].it-live-realtime-overlay {
    --lr-glass: rgba(7, 9, 14, .54);
    --lr-glass-strong: rgba(7, 9, 14, .78);
    --lr-border: rgba(255, 255, 255, .10);
    --lr-soft-border: rgba(255, 255, 255, .06);
    --lr-shadow: 0 16px 40px rgba(0, 0, 0, .30);
  }

  /* Let the picture breathe: lower opacity and smaller major trays. */
  body[data-theme="itahuka-mobile-live-overlay"].it-live-realtime-overlay .it-live-overlay-tray {
    left: max(12px, env(safe-area-inset-left)) !important;
    right: max(12px, env(safe-area-inset-right)) !important;
    border-color: var(--lr-soft-border) !important;
    background: linear-gradient(180deg, rgba(8, 10, 16, .52), rgba(7, 9, 14, .78)) !important;
    box-shadow: 0 -12px 38px rgba(0,0,0,.24) !important;
    backdrop-filter: blur(14px) saturate(1.05) !important;
  }

  body[data-theme="itahuka-mobile-live-overlay"].it-live-realtime-overlay .it-live-overlay-tray[data-overlay-panel="videos"] {
    height: min(27dvh, 286px) !important;
  }

  body[data-theme="itahuka-mobile-live-overlay"].it-live-realtime-overlay .it-live-overlay-tray[data-overlay-panel="schedule"] {
    height: min(29dvh, 306px) !important;
  }

  body[data-theme="itahuka-mobile-live-overlay"].it-live-realtime-overlay .it-live-overlay-tray__head {
    min-height: 44px !important;
    border-bottom-color: rgba(255,255,255,.05) !important;
    background: linear-gradient(180deg, rgba(255,255,255,.025), transparent) !important;
  }

  body[data-theme="itahuka-mobile-live-overlay"].it-live-realtime-overlay .it-live-overlay-tray__body {
    mask-image: linear-gradient(90deg, transparent 0, #000 10px, #000 calc(100% - 10px), transparent 100%);
  }

  /* Video cards float individually rather than becoming a second page. */
  body[data-theme="itahuka-mobile-live-overlay"].it-live-realtime-overlay .it-live-overlay-video-card {
    border-color: rgba(255,255,255,.09) !important;
    background: rgba(12, 14, 20, .50) !important;
    box-shadow: 0 12px 26px rgba(0,0,0,.18) !important;
    backdrop-filter: blur(10px) !important;
    transform: translateZ(0);
    transition: border-color .2s ease, transform .2s ease, background .2s ease !important;
  }

  body[data-theme="itahuka-mobile-live-overlay"].it-live-realtime-overlay .it-live-overlay-video-card:active {
    transform: scale(.985) !important;
  }

  body[data-theme="itahuka-mobile-live-overlay"].it-live-realtime-overlay .it-live-overlay-video-card.is-selected {
    background: rgba(36, 10, 15, .66) !important;
    border-color: rgba(239,35,60,.92) !important;
  }

  /* Schedule cards use the same floating heat language. */
  body[data-theme="itahuka-mobile-live-overlay"].it-live-realtime-overlay .it-live-overlay-schedule-card {
    border-color: rgba(255,255,255,.09) !important;
    background: rgba(12,14,20,.48) !important;
    box-shadow: 0 12px 26px rgba(0,0,0,.17) !important;
    backdrop-filter: blur(10px) !important;
  }

  body[data-theme="itahuka-mobile-live-overlay"].it-live-realtime-overlay .it-live-overlay-schedule-card.is-live,
  body[data-theme="itahuka-mobile-live-overlay"].it-live-realtime-overlay .it-live-overlay-schedule-card.is-current {
    background: linear-gradient(180deg, rgba(239,35,60,.28), rgba(42,8,15,.54)) !important;
    border-color: rgba(255,83,105,.88) !important;
    box-shadow: 0 0 0 1px rgba(239,35,60,.18) inset, 0 14px 30px rgba(239,35,60,.14) !important;
  }

  /* Major overlays suppress—but do not remove—the ambient live layer. */
  body[data-theme="itahuka-mobile-live-overlay"].it-live-realtime-overlay[data-overlay-major-open="1"] .it-community-chat__messages,
  body[data-theme="itahuka-mobile-live-overlay"].it-live-realtime-overlay[data-overlay-major-open="1"] .it-community-chat__fast-reactions,
  body[data-theme="itahuka-mobile-live-overlay"].it-live-realtime-overlay[data-overlay-major-open="1"] .it-community-chat__composer {
    opacity: .16 !important;
    filter: saturate(.7) !important;
    pointer-events: none !important;
    transition: opacity .22s ease, filter .22s ease !important;
  }

  body[data-theme="itahuka-mobile-live-overlay"].it-live-realtime-overlay[data-live-overlay-state="chat-expanded"] .it-community-chat__messages,
  body[data-theme="itahuka-mobile-live-overlay"].it-live-realtime-overlay[data-live-overlay-state="polls"] .it-community-chat__messages,
  body[data-theme="itahuka-mobile-live-overlay"].it-live-realtime-overlay[data-live-overlay-state="chat-expanded"] .it-community-chat__composer {
    opacity: 1 !important;
    filter: none !important;
    pointer-events: auto !important;
  }

  /* Realtime comment state. */
  body[data-theme="itahuka-mobile-live-overlay"].it-live-realtime-overlay .it-chat-message.is-send-pending {
    opacity: .72 !important;
    border-style: dashed !important;
  }

  body[data-theme="itahuka-mobile-live-overlay"].it-live-realtime-overlay .it-chat-message.is-send-pending::after {
    content: "Sending";
    position: absolute;
    right: 10px;
    bottom: 8px;
    color: rgba(255,255,255,.56);
    font-size: 10px;
    font-weight: 800;
  }

  body[data-theme="itahuka-mobile-live-overlay"].it-live-realtime-overlay .it-chat-message.is-send-failed {
    border-color: rgba(255,90,110,.78) !important;
    background: rgba(54,10,18,.64) !important;
  }

  body[data-theme="itahuka-mobile-live-overlay"].it-live-realtime-overlay [data-chat-retry-send] {
    min-height: 34px !important;
    padding: 0 12px !important;
    border-radius: 999px !important;
    border: 1px solid rgba(255,255,255,.14) !important;
    background: rgba(255,255,255,.06) !important;
    color: #fff !important;
    font-size: 11px !important;
    font-weight: 800 !important;
  }

  body[data-theme="itahuka-mobile-live-overlay"].it-live-realtime-overlay [data-realtime-connection="fallback"] [data-chat-status]::after {
    content: " · fallback";
    opacity: .62;
  }

  /* The passive message queue stays light and transient. */
  body[data-theme="itahuka-mobile-live-overlay"].it-live-realtime-overlay:not(.is-chat-expanded) .it-community-chat__messages {
    max-height: min(31dvh, 300px) !important;
    gap: 8px !important;
    mask-image: linear-gradient(180deg, transparent 0%, rgba(0,0,0,.55) 18%, #000 42%, #000 100%) !important;
  }

  body[data-theme="itahuka-mobile-live-overlay"].it-live-realtime-overlay:not(.is-chat-expanded) .it-chat-message {
    background: rgba(8,10,15,.54) !important;
    border-color: rgba(255,255,255,.09) !important;
    box-shadow: 0 12px 26px rgba(0,0,0,.20) !important;
    backdrop-filter: blur(13px) !important;
  }

  /* The reaction stream stays on the edge and does not cover faces. */
  body[data-theme="itahuka-mobile-live-overlay"].it-live-realtime-overlay .it-live-reaction-field {
    right: max(5px, env(safe-area-inset-right)) !important;
    width: 68px !important;
    height: min(42dvh, 340px) !important;
  }

  body[data-theme="itahuka-mobile-live-overlay"].it-live-realtime-overlay .it-live-reaction-particle {
    filter: drop-shadow(0 8px 12px rgba(0,0,0,.22)) !important;
  }

  /* Playback uses identical overlay visual language. */
  body[data-theme="itahuka-mobile-live-overlay"].it-live-realtime-overlay.broadcast-watch-page .it-live-overlay-tray,
  body[data-theme="itahuka-mobile-live-overlay"].it-live-realtime-overlay.legacy-watch-page .it-live-overlay-tray {
    background: linear-gradient(180deg, rgba(8,10,16,.50), rgba(7,9,14,.80)) !important;
  }

  body[data-theme="itahuka-mobile-live-overlay"].it-v511-player-switched .itahuka-player-stage {
    animation: itV511PlayerPulse .55s ease both;
  }

  @keyframes itV511PlayerPulse {
    0% { filter: brightness(.82); }
    100% { filter: brightness(1); }
  }

  @media (orientation: landscape) {
    body[data-theme="itahuka-mobile-live-overlay"].it-live-realtime-overlay .it-live-overlay-tray[data-overlay-panel="videos"],
    body[data-theme="itahuka-mobile-live-overlay"].it-live-realtime-overlay .it-live-overlay-tray[data-overlay-panel="schedule"] {
      height: min(33dvh, 270px) !important;
    }

    body[data-theme="itahuka-mobile-live-overlay"].it-live-realtime-overlay:not(.is-chat-expanded) .it-community-chat__messages {
      max-height: min(34dvh, 250px) !important;
      max-width: min(340px, 31vw) !important;
    }
  }
}

@media (prefers-reduced-motion: reduce) {
  body[data-theme="itahuka-mobile-live-overlay"].it-live-realtime-overlay .it-live-reaction-particle,
  body[data-theme="itahuka-mobile-live-overlay"].it-live-realtime-overlay .it-chat-message,
  body[data-theme="itahuka-mobile-live-overlay"].it-live-realtime-overlay .it-live-overlay-tray {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}

@media (max-width: 1180px), (pointer: coarse) {
  /* Polls are a compact floating card, not a blurred full-screen block. */
  body[data-theme="itahuka-mobile-live-overlay"].it-live-realtime-overlay[data-live-overlay-state="polls"] .it-live-chat-column {
    left: 50% !important;
    right: auto !important;
    bottom: calc(var(--lo-bottom-nav-height) + var(--lo-safe-bottom) + 14px) !important;
    width: min(92vw, 430px) !important;
    height: auto !important;
    max-height: min(48dvh, 470px) !important;
    transform: translateX(-50%) !important;
    border-radius: 22px !important;
    background: rgba(7,9,14,.62) !important;
    backdrop-filter: blur(14px) !important;
    box-shadow: 0 18px 44px rgba(0,0,0,.28) !important;
  }

  body[data-theme="itahuka-mobile-live-overlay"].it-live-realtime-overlay[data-live-overlay-state="polls"] .it-community-chat {
    display: block !important;
    height: auto !important;
  }

  body[data-theme="itahuka-mobile-live-overlay"].it-live-realtime-overlay[data-live-overlay-state="polls"] .it-community-chat__header,
  body[data-theme="itahuka-mobile-live-overlay"].it-live-realtime-overlay[data-live-overlay-state="polls"] .it-community-chat__pinned,
  body[data-theme="itahuka-mobile-live-overlay"].it-live-realtime-overlay[data-live-overlay-state="polls"] .it-community-chat__fast-reactions,
  body[data-theme="itahuka-mobile-live-overlay"].it-live-realtime-overlay[data-live-overlay-state="polls"] .it-community-chat__composer,
  body[data-theme="itahuka-mobile-live-overlay"].it-live-realtime-overlay[data-live-overlay-state="polls"] [data-chat-view="messages"] {
    display: none !important;
  }

  body[data-theme="itahuka-mobile-live-overlay"].it-live-realtime-overlay[data-live-overlay-state="polls"] .it-community-chat__tabs {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    min-height: 42px !important;
  }

  body[data-theme="itahuka-mobile-live-overlay"].it-live-realtime-overlay[data-live-overlay-state="polls"] [data-chat-view="polls"] {
    display: block !important;
    padding: 10px !important;
  }

  body[data-theme="itahuka-mobile-live-overlay"].it-live-realtime-overlay[data-live-overlay-state="polls"] .it-chat-poll-empty,
  body[data-theme="itahuka-mobile-live-overlay"].it-live-realtime-overlay[data-live-overlay-state="polls"] .it-chat-poll-card {
    max-width: none !important;
    background: rgba(255,255,255,.025) !important;
    box-shadow: none !important;
  }
}
