:root {
  --ht-web-touch: 44px;
  --ht-web-focus: #fff;
  --ht-web-focus-ring: rgba(124, 92, 255, .75);
  color-scheme: dark;
}

html.ht-web-platform {
  min-width: 320px;
  text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
  scrollbar-gutter: stable;
}

.ht-web-platform body { min-width: 0; overflow-x: clip; overscroll-behavior-y: none; }
.ht-web-platform #root { min-width: 0; max-width: 100%; }
.ht-web-platform :is(img, video, canvas, svg) { max-width: 100%; }
.ht-web-platform :is(button, a[href], input, textarea, select, [role="button"], [tabindex]):focus-visible {
  outline: 3px solid var(--ht-web-focus) !important;
  outline-offset: 3px !important;
  box-shadow: 0 0 0 6px var(--ht-web-focus-ring) !important;
}
.ht-web-platform :is(button, a[href], [role="button"]) { touch-action: manipulation; -webkit-tap-highlight-color: rgba(124, 92, 255, .28); }
.ht-web-platform [title] { cursor: help; }
.ht-web-platform a[download] { cursor: progress; }

.ht-web-menu-toggle,
.ht-web-nav-backdrop { display: none; }

@media (hover: hover) and (pointer: fine) {
  .ht-web-platform :is(button, a[href], [role="button"]):hover { filter: brightness(1.08); }
}

@media (pointer: coarse) {
  .ht-web-platform :is(button, a[href], input, select, [role="button"]) { min-height: var(--ht-web-touch); min-width: var(--ht-web-touch); }
  .ht-web-platform * { scrollbar-width: auto; }
}

/* Web tablet/phone shell. Desktop layout remains byte-for-byte inherited above 1024px. */
@media (max-width: 1024px) {
  :root { --ht-web-drawer-width: min(76vw, 320px); }
  html.ht-web-platform { scrollbar-gutter: auto; }
  .ht-web-platform body { min-height: 100dvh; }
  .ht-web-platform #root { width: 100%; min-height: 100dvh; zoom: 1; }
  .ht-web-platform .desktop-titlebar { display: none !important; }
  .ht-web-platform .app-shell { min-width: 0; min-height: 100dvh; overflow: hidden; isolation: auto !important; }
  .ht-web-platform .main-area { width: 100%; min-width: 0; height: 100dvh !important; }
  .ht-web-platform .main-composition,
  .ht-web-platform .app-shell[data-player-sidebar] .main-composition,
  .ht-web-platform .app-shell[data-player-rail-mounted] .main-composition { grid-template-columns: minmax(0, 1fr) !important; }
  .ht-web-platform .main-scroll {
    width: 100%;
    min-width: 0;
    padding: 72px clamp(14px, 3.4vw, 28px) calc(var(--footer-player-height, 80px) + 18px + env(safe-area-inset-bottom));
    overscroll-behavior: contain;
  }

  .ht-web-platform .sidebar,
  .ht-web-platform .sidebar.sidebar--psd {
    position: fixed !important;
    z-index: 1002 !important;
    inset: 0 auto 0 0;
    box-sizing: border-box;
    width: var(--ht-web-drawer-width) !important;
    height: 100dvh;
    padding: calc(14px + env(safe-area-inset-top)) 12px calc(12px + env(safe-area-inset-bottom));
    background: linear-gradient(180deg, #13091f 0%, #09040f 100%) !important;
    box-shadow: 18px 0 48px rgba(0, 0, 0, .62) !important;
    transform: translate3d(-105%, 0, 0);
    visibility: hidden;
    transition: transform 220ms ease, visibility 0s linear 220ms;
    contain: layout paint;
    overflow: hidden;
  }
  .ht-web-platform[data-web-nav-open="true"] .sidebar {
    transform: translate3d(0, 0, 0);
    visibility: visible;
    transition-delay: 0s;
  }
  .ht-web-platform .sidebar :is(.brand-text, .brand-wordmark, .brand-tagline, .nav-item span, .sidebar-nav-group-label, .sidebar-premium-copy, .sidebar-user-copy) { display: initial; }
  .ht-web-platform .sidebar-brand,
  .ht-web-platform .sidebar-premium-cta,
  .ht-web-platform .sidebar-user { justify-content: flex-start; }
  .ht-web-platform .sidebar-nav { overflow-y: auto; overscroll-behavior: contain; }

  .ht-web-menu-toggle {
    display: inline-grid;
    place-items: center;
    position: fixed;
    z-index: 1001;
    top: calc(12px + env(safe-area-inset-top));
    left: calc(12px + env(safe-area-inset-left));
    width: 46px;
    height: 46px;
    padding: 0;
    border: 1px solid rgba(255,255,255,.16);
    border-radius: 14px;
    color: #fff;
    background: rgba(12, 5, 24, .92);
    box-shadow: 0 10px 30px rgba(0,0,0,.38);
    backdrop-filter: blur(16px);
    cursor: pointer;
  }
  .ht-web-menu-toggle svg { width: 22px; height: 22px; }
  .ht-web-platform[data-web-nav-open="true"] .ht-web-menu-toggle { z-index: 1003; left: calc(var(--ht-web-drawer-width) - 58px); }
  .ht-web-nav-backdrop {
    display: block;
    position: fixed;
    z-index: 1000;
    inset: 0;
    border: 0;
    padding: 0;
    background: rgba(0, 0, 0, .64);
    opacity: 0;
    visibility: hidden;
    transition: opacity 200ms ease, visibility 0s linear 200ms;
  }
  .ht-web-platform[data-web-nav-open="true"] .ht-web-nav-backdrop { opacity: 1; visibility: visible; transition-delay: 0s; }
  .ht-web-platform[data-web-nav-open="true"] body { overflow: hidden; }

  .ht-web-platform .global-top-nav--reference {
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: none;
  }
  .ht-web-platform .global-top-nav--reference::-webkit-scrollbar { display: none; }
  .ht-web-platform .global-top-nav--reference .global-top-nav-links { min-width: max-content; }
  .ht-web-platform .conditional-player-rail { display: none !important; }
  .ht-web-platform .conditional-player-rail[data-player-surface="tv"] {
    display: block !important;
    position: fixed !important;
    z-index: 940 !important;
    inset: 66px 0 0 !important;
    box-sizing: border-box;
    width: 100vw !important;
    height: calc(100dvh - 66px) !important;
    padding: 14px clamp(14px, 3vw, 24px) calc(18px + env(safe-area-inset-bottom));
    overflow-x: hidden !important;
    overflow-y: auto !important;
    visibility: visible !important;
    opacity: 1 !important;
    transform: none !important;
    pointer-events: auto !important;
    background: linear-gradient(180deg, #09040f, #030107) !important;
  }
  .ht-web-platform .conditional-player-rail[data-player-surface="tv"] > .tv-rail {
    box-sizing: border-box;
    width: min(100%, 960px);
    min-height: 0;
    margin: 0 auto;
  }
  .ht-web-platform .conditional-player-rail[data-player-surface="tv"] .tv-video-surface,
  .ht-web-platform .conditional-player-rail[data-player-surface="tv"] .tv-video-surface-mount {
    width: 100%;
    min-height: 0;
  }
  .ht-web-platform .app-shell:has(.conditional-player-rail[data-player-surface="tv"]) + .player-bar { display: none !important; }
  .ht-web-platform .player-sidebar-toggle { display: none !important; }

  .ht-web-platform [role="dialog"],
  .ht-web-platform :is(.modal, .dialog, .settings-modal, .auth-modal, .context-menu) {
    box-sizing: border-box;
    max-width: min(680px, calc(100vw - 24px));
    max-height: calc(100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    overflow: auto;
  }

  .ht-web-platform :is(.music-home-reference-top, .music-home-mix-column, .settings-layout, .premium-grid, .tv-layout, .radio-layout, .podcast-layout, .audiobook-layout) { min-width: 0; }
}

@media (max-width: 767px) {
  :root { --ht-web-drawer-width: min(80vw, 300px); --footer-player-height: 78px; }
  html.ht-web-platform { font-size: 16px; }
  .ht-web-platform :is(input, textarea, select) { font-size: 16px; }
  .ht-web-platform .main-scroll { padding: 20px 16px calc(var(--footer-player-height) + 16px + env(safe-area-inset-bottom)); }
  .ht-web-platform .content-inner,
  .ht-web-platform .content-inner--wide,
  .ht-web-platform .content-inner--cinematic { min-width: 0; max-width: 100%; }

  .ht-web-platform :is(.music-home-reference-top, .music-home-mix-column, .music-home-quick-grid, .settings-layout, .podcast-show-episode-tools) { grid-template-columns: minmax(0, 1fr) !important; }
  .ht-web-platform :is(.music-home-world-rail, .music-home-release-rail) { grid-auto-columns: minmax(142px, 72vw); }
  .ht-web-platform :is(.card-grid, .album-grid, .artist-grid, .playlist-grid, .radio-station-grid, .podcast-grid, .audiobook-grid, .tv-channel-grid) { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .ht-web-platform .global-top-nav--reference {
    box-sizing: border-box;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: 52px 50px;
    min-height: 102px;
    padding: max(6px, env(safe-area-inset-top)) 16px 0;
    gap: 0 12px;
    overflow: visible;
  }
  .ht-web-platform .conditional-player-rail[data-player-surface="tv"] {
    inset-block-start: 102px !important;
    height: calc(100dvh - 102px) !important;
    padding: 12px 12px calc(16px + env(safe-area-inset-bottom));
  }
  .ht-web-platform .conditional-player-rail[data-player-surface="tv"] > .tv-rail {
    gap: 12px;
    padding: 12px;
    border-radius: 16px;
  }
  .ht-web-platform .conditional-player-rail[data-player-surface="tv"] .tv-video-surface-mount {
    aspect-ratio: 16 / 9;
  }
  .ht-web-platform .conditional-player-rail[data-player-surface="tv"] .tv-video-surface-volume {
    display: block;
    flex: 1 1 92px;
    width: clamp(92px, 28vw, 132px);
    min-width: 92px;
    min-height: 44px;
  }
  .ht-web-platform .global-top-nav--reference::before {
    content: 'HiddenTunes';
    grid-column: 1;
    grid-row: 1;
    align-self: center;
    margin-left: 56px;
    color: #fff;
    font-size: 17px;
    font-weight: 760;
    letter-spacing: -.02em;
  }
  .ht-web-platform .global-top-nav--reference .global-top-nav-actions {
    grid-column: 2;
    grid-row: 1;
    align-self: center;
    gap: 10px;
  }
  .ht-web-platform .global-top-nav--reference .global-top-nav-links {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
    min-width: 0;
    gap: 16px;
    flex-wrap: nowrap !important;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: none;
  }
  .ht-web-platform .global-top-nav--reference .global-top-nav-link {
    flex: 0 0 auto;
    min-width: auto;
    min-height: 44px;
    padding: 0 4px;
    font-size: 15px;
  }

  .ht-web-platform :is(.page-view h1, .music-home-product-hero-title, .psd-page-title) { font-size: clamp(25px, 7vw, 30px) !important; line-height: 1.12; }
  .ht-web-platform :is(.page-view h2, .section-heading, .music-home-section-title) { font-size: clamp(20px, 5.4vw, 22px); line-height: 1.2; }
  .ht-web-platform :is(.page-view p, .music-home-product-hero-artist, .music-home-mix-card p) { font-size: clamp(15px, 4vw, 17px); line-height: 1.5; }
  .ht-web-platform :is(.card-info h3, .music-home-song-card strong, .music-home-quick-card strong, .ht-library-row strong) { font-size: 16px; }
  .ht-web-platform :is(.card-info p, .music-home-song-card small, .page-eyebrow) { font-size: max(13px, .8125rem); }
  .ht-web-platform :is(.btn, .btn-primary, .btn-secondary, .music-home-product-hero-actions button, .music-home-quick-card) { font-size: 15px; }

  .ht-web-platform .music-home-product-hero { min-height: 250px; padding: 22px 20px; }
  .ht-web-platform .music-home-product-hero-copy { max-width: min(72%, 340px); gap: 10px; }
  .ht-web-platform .music-home-product-hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }
  .ht-web-platform .music-home-product-hero-actions button { min-height: 48px; padding-inline: 18px; }
  .ht-web-platform .music-home-mix-card { padding: 20px; }
  .ht-web-platform .music-home-mix-card-copy { max-width: 62%; }
  .ht-web-platform .music-home-mix-column .music-home-quick-grid { grid-template-columns: minmax(0, 1fr) !important; gap: 10px; }
  .ht-web-platform .music-home-mix-column .music-home-quick-card { min-height: 60px; padding: 10px 14px; }

  .ht-web-platform .player-bar {
    box-sizing: border-box;
    position: fixed !important;
    z-index: 950 !important;
    inset: auto 0 0 0;
    width: 100vw;
    grid-template-columns: minmax(0, 1fr) auto !important;
    grid-template-rows: 1fr !important;
    height: calc(var(--footer-player-height) + env(safe-area-inset-bottom));
    min-height: calc(var(--footer-player-height) + env(safe-area-inset-bottom));
    max-height: calc(var(--footer-player-height) + env(safe-area-inset-bottom));
    padding: 7px max(10px, env(safe-area-inset-right)) max(7px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
    gap: 8px;
  }
  .ht-web-platform .player-bar .player-track { min-width: 0; max-width: none; cursor: pointer; }
  .ht-web-platform .player-bar .player-artwork { width: 48px; height: 48px; flex: 0 0 48px; }
  .ht-web-platform .player-bar .player-meta { min-width: 0; }
  .ht-web-platform .player-bar .player-center { display: flex; justify-content: flex-end; min-width: 98px; }
  .ht-web-platform .player-bar .player-center .progress-wrap,
  .ht-web-platform .player-bar .player-right,
  .ht-web-platform .player-bar :is(.control-btn--shuffle, .control-btn--repeat) { display: none !important; }
  .ht-web-platform .player-bar .transport-controls { gap: 2px; }
  .ht-web-platform .player-bar .transport-controls .control-btn--skip:nth-child(2) { display: none !important; }
  .ht-web-platform .player-bar .transport-controls .control-btn--skip:nth-child(4) { display: inline-grid !important; }
  .ht-web-platform .player-bar .control-btn.play { width: 46px; height: 46px; }

  .ht-web-platform .premium-fullscreen-shell[data-media-kind] {
    inset: 0;
    max-height: 100dvh;
    --premium-shell-top-height: 56px;
    --premium-shell-dock-height: 116px;
  }
}

@media (max-width: 420px) {
  .ht-web-platform :is(.card-grid, .album-grid, .artist-grid, .playlist-grid, .radio-station-grid, .podcast-grid, .audiobook-grid, .tv-channel-grid) { grid-template-columns: minmax(0, 1fr); }
  :root { --ht-web-drawer-width: min(80vw, 288px); }
}

@media (max-height: 520px) and (orientation: landscape) {
  .ht-web-platform .main-scroll { padding-top: 62px; }
  .ht-web-platform .sidebar { padding-top: 8px; }
  .ht-web-menu-toggle { top: 8px; }
  .ht-web-platform .player-bar { height: 64px; min-height: 64px; max-height: 64px; }
}

@media (prefers-reduced-motion: reduce) {
  .ht-web-platform * { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: .01ms !important; }
}

@media (forced-colors: active) {
  .ht-web-platform :focus-visible { outline: 3px solid Highlight !important; }
  .ht-web-platform :is(button, a[href], [role="button"]) { forced-color-adjust: auto; }
}
