:root {
  /* Phase 1: brand, colour, line, panel, ink, font ALL inherit from
     ridecast-theme.css. Only display-layout-specific tokens stay here. */
  --ink: var(--rc-text);
  --muted: var(--rc-text-secondary);
  --accent: var(--rc-brand);
  --spotify-green: var(--rc-brand);
  --panel: var(--rc-surface-1);
  --line: var(--rc-line);
  /* Reference layout: 14" roof player, landscape ~1920×1080 */
  --display-min: 1024;
  --display-max: 1920;
  --shell-pad-x: clamp(16px, 2.4vw, 40px);
  --shell-pad-y: clamp(12px, 1.8vh, 24px);
  --chrome-height: clamp(96px, 11vh, 132px);
  --content-max: min(96vw, 1680px);
  --radius-lg: clamp(14px, 1.2vw, 22px);
  --radius-xl: clamp(18px, 1.6vw, 28px);
}

* {
  box-sizing: border-box;
}

html {
  font-size: clamp(15px, calc(0.28vw + 0.62vh), 20px);
}

body.media-app {
  margin: 0;
  min-height: 100dvh;
  height: 100dvh;
  overflow: hidden;
  font-family: var(--rc-font-body);
  background: var(--rc-platform-gradient);
  color: var(--rc-text);
  -webkit-font-smoothing: antialiased;
}

body.media-app :focus-visible {
  outline: none;
  box-shadow: var(--rc-focus-ring);
  border-radius: var(--rc-radius-sm);
}

.media-loader {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: max(24px, env(safe-area-inset-top, 0px)) max(24px, env(safe-area-inset-right, 0px)) max(24px, env(safe-area-inset-bottom, 0px)) max(24px, env(safe-area-inset-left, 0px));
  background:
    radial-gradient(circle at 50% 48%, rgba(22, 224, 214, 0.12), transparent 30%),
    #030b13;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.45s ease, visibility 0.45s ease;
}

.media-loader--hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.media-loader-inner {
  display: grid;
  justify-items: center;
  gap: clamp(16px, 2.5vh, 26px);
  transform: translateY(-1vh);
}

.media-loader-mark {
  width: clamp(320px, min(44vw, 66vh), 560px);
  height: clamp(320px, min(44vw, 66vh), 560px);
  border-radius: clamp(64px, 8vw, 120px);
  gap: clamp(7px, 0.75vw, 12px);
  box-shadow:
    0 22px 56px rgba(0, 0, 0, 0.34),
    0 0 52px rgba(22, 224, 214, 0.18);
}

.media-loader-mark .brand-bar {
  flex-basis: clamp(4px, 0.48vw, 8px);
  width: clamp(4px, 0.48vw, 8px);
  box-shadow:
    0 0 10px rgba(22, 224, 214, 0.86),
    0 0 24px rgba(22, 224, 214, 0.34);
}

.brand-wordmark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: clamp(0.18em, 0.85vw, 0.32em);
  direction: ltr;
  unicode-bidi: isolate;
  letter-spacing: 0;
}

.media-loader-wordmark {
  color: #ffffff;
  font-family: Inter, var(--rc-font-body);
  font-size: clamp(2.1rem, 7.2vw, 5.2rem);
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0;
  text-align: center;
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.16),
    0 12px 30px rgba(0, 0, 0, 0.48);
  max-width: 92vw;
  overflow-wrap: anywhere;
}

.media-loader-wordmark.brand-wordmark {
  gap: clamp(0.2em, 1vw, 0.42em);
}

.media-shell {
  width: 100%;
  max-width: none;
  min-height: 100dvh;
  height: 100dvh;
  margin: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding:
    env(safe-area-inset-top, 0)
    env(safe-area-inset-right, 0)
    env(safe-area-inset-bottom, 0)
    env(safe-area-inset-left, 0);
}

.media-shell--chrome-hidden {
  grid-template-rows: 1fr;
  --chrome-height: 0px;
}

.media-shell--chrome-hidden .media-header,
.media-shell--chrome-hidden .media-footer {
  display: none;
}

.media-header,
.media-footer {
  transition: opacity 0.2s ease;
}

.media-header,
.media-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(10px, 1.5vw, 16px);
  padding: var(--shell-pad-y) var(--shell-pad-x);
  background: var(--rc-surface-glass);
  backdrop-filter: blur(8px);
  flex-shrink: 0;
}

.media-header {
  border-bottom: 1px solid var(--rc-line);
}

.media-footer {
  border-top: 1px solid var(--rc-line);
  border-bottom: 0;
  font-size: clamp(0.72rem, 0.85vw + 0.2vh, 0.92rem);
  color: var(--muted);
  flex-wrap: wrap;
  align-items: center;
}

.media-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-left: auto;
}

.media-tool-btn {
  border: 1px solid var(--rc-line-strong);
  background: transparent;
  color: var(--rc-text-secondary);
  border-radius: 999px;
  padding: 8px 14px;
  font: inherit;
  font-size: clamp(0.72rem, 0.75vw + 0.1vh, 0.85rem);
  font-weight: 700;
  cursor: pointer;
  transition:
    border-color var(--rc-motion-base) var(--rc-ease),
    color var(--rc-motion-base) var(--rc-ease);
}

.media-tool-btn:hover {
  border-color: var(--rc-brand);
  color: var(--rc-brand);
  background: transparent;
}

.media-tool-btn--danger {
  border-color: rgba(248, 113, 113, 0.35);
  color: #fca5a5;
}

.media-dashboard {
  text-align: center;
  max-width: min(640px, 94vw);
}

.media-dashboard-ring {
  width: clamp(72px, 10vh, 96px);
  height: clamp(72px, 10vh, 96px);
  margin: 0 auto 16px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 2px solid var(--rc-line-strong);
  background: var(--rc-surface-2);
}

.media-dashboard-ring--live {
  border-color: var(--rc-brand);
  box-shadow: none;
}

.media-dashboard-glyph {
  font-weight: 900;
  font-size: clamp(1.1rem, 2vh, 1.35rem);
  color: var(--rc-brand);
}

.media-dashboard h1 {
  margin: 8px 0 10px;
  font-size: clamp(1.5rem, 2.4vw, 2rem);
}

.media-dashboard-copy {
  margin: 0 auto 18px;
  max-width: 36ch;
  line-height: 1.5;
}

.media-status-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.media-status-chip {
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--rc-line-strong);
  background: transparent;
  text-align: left;
}

.media-status-chip span {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 4px;
}

.media-status-chip strong {
  font-size: 0.95rem;
}

.media-status-chip.live {
  border-color: var(--rc-brand);
}

.media-status-chip.warn {
  border-color: var(--rc-brand-border);
}

.media-dashboard-action {
  width: 100%;
  margin-bottom: 12px;
}

.media-dashboard-settings {
  margin-top: 8px;
  text-align: left;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.media-dashboard-settings summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 12px;
}

.media-dashboard-settings .session-line {
  margin: 12px 0;
  font-size: 0.82rem;
  word-break: break-all;
}

.mount-options--compact {
  margin-top: 0;
}

.media-controls {
  position: fixed;
  left: 50%;
  bottom: max(clamp(12px, 2vh, 20px), env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 40;
  width: min(94vw, 560px);
  pointer-events: auto;
}

.admin-pin {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: clamp(16px, 4vw, 48px);
  background: rgba(3, 7, 18, 0.76);
  backdrop-filter: blur(10px);
  pointer-events: auto;
}

.admin-pin-card {
  width: min(92vw, 420px);
  padding: clamp(18px, 3vh, 28px);
  border-radius: var(--radius-lg);
  border: 1px solid var(--rc-line);
  background: var(--rc-surface-1);
  box-shadow: none;
}

.admin-pin-card h2 {
  margin: 4px 0 8px;
  font-size: clamp(1.35rem, 2.1vw, 1.8rem);
}

.admin-pin-label {
  display: grid;
  gap: 8px;
  margin: 18px 0 8px;
  font-weight: 800;
  color: var(--rc-text-secondary);
}

.admin-pin-input {
  width: 100%;
  min-height: 52px;
  border: 1px solid var(--rc-line-strong);
  border-radius: 12px;
  background: var(--rc-surface-2);
  color: var(--rc-text);
  padding: 10px 14px;
  font: inherit;
  font-size: clamp(1.2rem, 2vw, 1.5rem);
  font-weight: 900;
  letter-spacing: 0.16em;
}

.admin-pin-input:focus {
  border-color: var(--rc-brand);
  box-shadow: var(--rc-focus-ring);
  outline: none;
}

.admin-pin-status {
  min-height: 1.25em;
  margin: 8px 0 14px;
  font-size: clamp(0.78rem, 0.8vw + 0.1vh, 0.9rem);
}

body.media-touch-locked {
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: none;
}

body.media-touch-locked .media-main {
  overscroll-behavior: none;
}

.media-shell:not(.media-shell--chrome-hidden) .media-controls {
  bottom: calc(var(--chrome-height) + clamp(8px, 1.2vh, 14px));
}

.media-controls-inner {
  padding: clamp(14px, 2vh, 20px);
  border-radius: var(--radius-lg);
  background: var(--rc-surface-1);
  border: 1px solid var(--rc-line);
  box-shadow: none;
  backdrop-filter: blur(10px);
}

.media-controls-hint {
  margin: 0 0 12px;
  font-size: clamp(0.78rem, 0.8vw + 0.1vh, 0.88rem);
}

.media-controls-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 10px;
}

.media-controls-grid .ghost-btn,
.media-controls-grid .primary-btn {
  flex: 1 1 auto;
  min-width: min(140px, 42vw);
}

#controlsStatus {
  margin: 0;
  text-align: center;
  font-size: clamp(0.75rem, 0.78vw + 0.1vh, 0.85rem);
}

.brand-row {
  display: flex;
  align-items: center;
  gap: clamp(10px, 1.2vw, 14px);
  min-width: 0;
}

.brand-row strong {
  display: inline-flex;
  font-size: clamp(0.95rem, 1vw + 0.35vh, 1.15rem);
  font-family: Inter, var(--rc-font-body);
  font-weight: 600;
  letter-spacing: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-mark {
  position: relative;
  width: clamp(40px, 4.8vh, 54px);
  height: clamp(40px, 4.8vh, 54px);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(2px, 0.28vh, 3px);
  border-radius: 12px;
  background:
    radial-gradient(circle at 50% 48%, rgba(22, 224, 214, 0.14), transparent 46%),
    linear-gradient(180deg, #0e182a, #07121e);
  border: 1px solid rgba(96, 124, 148, 0.45);
  overflow: hidden;
  box-shadow:
    0 10px 28px rgba(0, 0, 0, 0.22),
    0 0 22px rgba(22, 224, 214, 0.1);
}

.brand-mark::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    inset 0 -1px 0 rgba(0, 0, 0, 0.35);
  pointer-events: none;
}

.brand-bar {
  flex: 0 0 clamp(2px, 0.4vh, 4px);
  width: clamp(2px, 0.4vh, 4px);
  border-radius: 999px;
  background: linear-gradient(180deg, #26fff0, #00bfb4);
  box-shadow:
    0 0 7px rgba(22, 224, 214, 0.75),
    0 0 16px rgba(22, 224, 214, 0.32);
  animation: ryd-brand-wave 1.25s ease-in-out infinite;
  transform-origin: center;
}

.brand-bar:nth-child(1),
.brand-bar:nth-child(9) {
  height: 18%;
  animation-delay: -0.48s;
}

.brand-bar:nth-child(2),
.brand-bar:nth-child(8) {
  height: 34%;
  animation-delay: -0.36s;
}

.brand-bar:nth-child(3),
.brand-bar:nth-child(7) {
  height: 52%;
  animation-delay: -0.24s;
}

.brand-bar:nth-child(4),
.brand-bar:nth-child(6) {
  height: 70%;
  animation-delay: -0.12s;
}

.brand-bar:nth-child(5) {
  height: 86%;
  animation-delay: 0s;
}

@keyframes ryd-brand-wave {
  0%,
  100% {
    transform: scaleY(0.78);
    opacity: 0.72;
    filter: saturate(0.85);
  }

  50% {
    transform: scaleY(1.12);
    opacity: 1;
    filter: saturate(1.25);
  }
}

.brand-row span {
  display: block;
  font-size: clamp(0.72rem, 0.75vw + 0.15vh, 0.85rem);
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-pill {
  flex-shrink: 0;
  padding: clamp(5px, 0.6vh, 7px) clamp(10px, 1.2vw, 14px);
  border-radius: 999px;
  font-size: clamp(0.68rem, 0.7vw + 0.15vh, 0.8rem);
  font-weight: 700;
  border: 1px solid var(--rc-line-strong);
  background: transparent;
  color: var(--rc-text-secondary);
}

.status-pill.paired {
  border-color: var(--rc-brand);
  background: transparent;
  color: var(--rc-brand);
}

.status-pill.paired.offline {
  background: var(--rc-brand-soft);
  color: var(--rc-brand);
}

.media-main {
  padding: var(--shell-pad-y) var(--shell-pad-x);
  display: grid;
  place-items: center;
  align-content: center;
  min-height: 0;
  overflow: auto;
  transition: opacity 0.45s ease, transform 0.45s ease;
}

.media-main.media-fade-out {
  opacity: 0;
  transform: scale(0.98);
}

.media-main.media-fade-in {
  opacity: 1;
  transform: scale(1);
}

.media-main--ambient,
.media-main--player {
  padding: clamp(8px, 1vh, 14px) clamp(12px, 2vw, 32px);
}

.media-main--ambient.media-main--fullscreen,
.media-main--fullscreen {
  padding: 0 !important;
}

.media-shell--chrome-hidden .media-main--ambient:not(.media-main--fullscreen),
.media-shell--chrome-hidden .media-main--player:not(.media-main--fullscreen) {
  padding: clamp(6px, 0.8vh, 12px) clamp(10px, 1.5vw, 24px);
}

.panel {
  width: 100%;
  max-width: min(560px, 92vw);
  padding: clamp(20px, 3vh, 32px);
  border-radius: var(--radius-lg);
  background: var(--rc-surface-1);
  border: 1px solid var(--rc-line);
  text-align: center;
  box-shadow: none;
}

.media-main--setup {
  --setup-stack-gap: clamp(14px, 2vh, 20px);
  display: grid;
  gap: var(--setup-stack-gap);
  justify-items: center;
  align-content: start;
  padding-block: var(--setup-stack-gap);
  overflow-y: auto;
}

.media-player-setup {
  text-align: left;
  max-width: min(720px, 96vw);
}

.media-player-setup h2 {
  margin: 6px 0 8px;
  font-size: clamp(1.35rem, 2.2vw, 1.75rem);
}

.mount-options {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.mount-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--rc-line-strong);
  border-radius: 14px;
  background: transparent;
  cursor: pointer;
  text-align: left;
  color: var(--rc-text-secondary);
  transition:
    border-color var(--rc-motion-base) var(--rc-ease),
    color var(--rc-motion-base) var(--rc-ease);
}

.mount-option:hover {
  border-color: var(--rc-brand);
  color: var(--rc-brand);
}

.mount-option.selected {
  border-color: var(--rc-brand);
  background: transparent;
  color: var(--rc-brand);
  box-shadow: none;
}

.mount-option.selected strong {
  color: var(--rc-text);
}

.mount-option input[type="radio"] {
  margin-top: 4px;
}

.mount-option-copy {
  min-width: 0;
}

.mount-option-copy strong {
  display: block;
  font-size: 1rem;
  margin-bottom: 4px;
}

.mount-option-copy .muted {
  margin: 0;
  line-height: 1.45;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}

.server-banner {
  max-width: min(720px, 96vw);
  padding-block: clamp(18px, 2.4vh, 28px);
  border-color: rgba(207, 77, 63, 0.45);
  margin: 0;
}

.mic-panel {
  margin-bottom: clamp(12px, 2vh, 18px);
  text-align: left;
  border: 1px solid var(--rc-line);
  background: var(--rc-surface-1);
}

.mic-panel--granted {
  border-color: var(--rc-brand);
}

.mic-panel--denied {
  border-color: rgba(248, 113, 113, 0.45);
}

.mic-help {
  font-size: clamp(0.82rem, 0.55vw + 0.35vh, 0.92rem);
  line-height: 1.45;
  margin-top: 10px;
}

.mic-device {
  margin-top: 6px;
  font-size: 0.85rem;
}

.eyebrow {
  margin: 0 0 6px;
  font-size: clamp(0.68rem, 0.7vw + 0.12vh, 0.78rem);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--rc-brand);
}

h1,
h2 {
  margin: 0 0 10px;
}

h1 {
  font-size: clamp(1.45rem, 2vw + 0.6vh, 2.1rem);
}

h2 {
  font-size: clamp(1.15rem, 1.4vw + 0.4vh, 1.65rem);
}

.muted {
  color: var(--muted);
  line-height: 1.5;
  font-size: clamp(0.88rem, 0.9vw + 0.2vh, 1.02rem);
}

.route-pill {
  display: inline-block;
  margin-top: clamp(10px, 1.5vh, 14px);
  padding: clamp(6px, 0.8vh, 9px) clamp(12px, 1.4vw, 16px);
  border-radius: var(--rc-radius-pill);
  background: var(--rc-brand-soft);
  font-size: clamp(0.78rem, 0.85vw + 0.15vh, 0.92rem);
}

.hidden {
  display: none !important;
}

.code-label {
  display: grid;
  gap: 8px;
  margin: clamp(14px, 2vh, 20px) 0;
  text-align: left;
  font-size: clamp(0.82rem, 0.85vw + 0.15vh, 0.92rem);
  color: var(--muted);
}

.code-input {
  width: 100%;
  padding: clamp(14px, 2vh, 20px);
  font-size: clamp(1.85rem, 4vw + 0.5vh, 3rem);
  letter-spacing: 0.35em;
  text-align: center;
  border-radius: 12px;
  border: 1px solid var(--rc-line-strong);
  background: var(--rc-surface-2);
  color: var(--rc-brand);
  font-family: ui-monospace, monospace;
}


.setup-permission-panel {
  text-align: left;
  max-width: min(720px, 96vw);
}

.setup-permission-panel h1 {
  text-align: left;
}

.setup-permission-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(10px, 1.4vw, 16px);
  margin-top: clamp(16px, 2vh, 22px);
}

.setup-permission-card {
  display: grid;
  gap: 10px;
  align-content: start;
  min-height: 100%;
  padding: clamp(14px, 1.8vh, 18px);
  border: 1px solid var(--rc-line-strong);
  border-radius: 14px;
  background: var(--rc-surface-2);
}

.setup-permission-card.ready {
  border-color: var(--rc-brand);
}

.setup-permission-card strong {
  font-size: clamp(0.98rem, 1vw + 0.15vh, 1.12rem);
}

.setup-permission-card span {
  color: var(--muted);
  line-height: 1.45;
}

.setup-permission-card .primary-btn {
  width: 100%;
  margin-top: auto;
}

.primary-btn:disabled,
.ghost-btn:disabled {
  cursor: wait;
  opacity: 0.62;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(8px, 1vw, 12px);
  justify-content: center;
  margin-top: clamp(12px, 1.8vh, 16px);
}

.primary-btn,
.ghost-btn {
  border-radius: 10px;
  padding: clamp(11px, 1.4vh, 14px) clamp(16px, 2vw, 22px);
  font-weight: 800;
  font-size: clamp(0.88rem, 0.9vw + 0.15vh, 1rem);
  cursor: pointer;
  min-height: 44px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  padding: 12px 16px;
  border-radius: 10px;
  background: var(--rc-surface-2);
  border: 1px solid var(--rc-line);
  color: var(--rc-text);
  opacity: 0;
  transition: 0.25s;
  z-index: 20;
  max-width: min(92vw, 520px);
  text-align: center;
  font-size: clamp(0.85rem, 0.9vw + 0.15vh, 0.95rem);
}

.toast.show {
  opacity: 1;
}

.spinner {
  width: clamp(36px, 4.5vh, 48px);
  height: clamp(36px, 4.5vh, 48px);
  margin: clamp(12px, 2vh, 18px) auto;
  border: 3px solid var(--rc-line);
  border-top-color: var(--rc-brand);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Spotify-style player */
.player-shell {
  width: 100%;
  max-width: min(92vw, 520px);
  padding: clamp(18px, 2.5vh, 28px) clamp(18px, 2.5vw, 28px);
  border-radius: var(--radius-xl);
  background: var(--rc-surface-1);
  border: 1px solid var(--rc-line);
  box-shadow: none;
  text-align: center;
}

.loading-player h2 {
  margin-top: 8px;
}

.player-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: clamp(14px, 2vh, 20px);
}

.sponsored-badge {
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--rc-brand-soft);
  color: var(--rc-brand);
  font-size: clamp(0.62rem, 0.65vw + 0.1vh, 0.72rem);
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.player-live {
  color: var(--rc-brand);
  font-size: clamp(0.72rem, 0.75vw + 0.12vh, 0.85rem);
  font-weight: 700;
  white-space: nowrap;
}

.player-art {
  position: relative;
  width: min(72vw, 280px);
  aspect-ratio: 1;
  margin: 0 auto clamp(16px, 2vh, 22px);
  border-radius: var(--radius-lg);
  display: grid;
  place-items: center;
  overflow: hidden;
  background: linear-gradient(
    145deg,
    hsl(var(--art-hue, 180) 70% 45%),
    hsl(calc(var(--art-hue, 180) + 40) 65% 28%)
  );
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}

.art-glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.28), transparent 55%);
}

.art-initial {
  position: relative;
  font-size: clamp(3rem, 8vw + 1vh, 5rem);
  line-height: 1;
  color: rgba(255, 255, 255, 0.92);
  text-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.player-art-qr {
  position: relative;
  width: min(76%, 210px);
  aspect-ratio: 1;
  object-fit: contain;
  background: #ffffff;
  border-radius: 12px;
  padding: 10px;
  box-shadow: 0 10px 26px rgba(2, 6, 23, 0.45);
}

.player-meta h2 {
  margin-bottom: 8px;
}

.player-copy {
  color: var(--muted);
  line-height: 1.55;
  font-size: clamp(0.88rem, 0.95vw + 0.15vh, 1.02rem);
  margin: 0;
}

.player-progress {
  margin: clamp(16px, 2.2vh, 24px) 0 clamp(12px, 1.6vh, 18px);
}

.progress-track {
  height: clamp(5px, 0.7vh, 7px);
  border-radius: 999px;
  background: var(--rc-surface-3);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--rc-brand-deep), var(--rc-brand));
  transition: width 0.2s linear;
}

.progress-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: clamp(0.68rem, 0.72vw + 0.1vh, 0.78rem);
  color: var(--muted);
}

.player-wave {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: clamp(4px, 0.6vw, 7px);
  height: clamp(28px, 4vh, 40px);
  margin-bottom: clamp(10px, 1.4vh, 14px);
}

.wave-bar {
  width: clamp(5px, 0.5vw, 7px);
  height: 12px;
  border-radius: 999px;
  background: var(--rc-brand);
  animation: wave 0.9s ease-in-out infinite;
}

@keyframes wave {
  0%,
  100% {
    height: 12px;
    opacity: 0.55;
  }
  50% {
    height: clamp(24px, 3.5vh, 34px);
    opacity: 1;
  }
}

/* Silent visual / video ads */
.visual-shell {
  width: 100%;
  max-width: min(92vw, 560px);
  min-height: min(420px, 72vh);
  padding: clamp(16px, 2.5vh, 24px);
  border-radius: var(--radius-xl);
  background: var(--rc-surface-1);
  border: 1px solid var(--rc-line);
  box-shadow: none;
  text-align: center;
}

.visual-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: clamp(12px, 1.8vh, 18px);
}

.silent-badge {
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.2);
  color: #cbd5e1;
  font-size: clamp(0.62rem, 0.65vw + 0.1vh, 0.72rem);
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.visual-counter {
  font-size: clamp(0.72rem, 0.75vw + 0.12vh, 0.82rem);
  color: var(--muted);
  font-weight: 700;
}

.visual-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  margin: 0 auto clamp(14px, 2vh, 20px);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: linear-gradient(145deg, var(--grad-from, #334155), var(--grad-to, #0f172a));
  display: grid;
  place-items: center;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.visual-shell--asset .visual-frame {
  background: #020617;
}

.visual-video,
.visual-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.visual-shell--asset.visual-motion .visual-frame {
  animation: none;
}

.visual-qr-card {
  position: absolute;
  right: clamp(10px, 1.4vw, 16px);
  bottom: clamp(10px, 1.4vw, 16px);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
  text-align: left;
  max-width: min(72%, 320px);
}

.visual-qr-image {
  width: clamp(72px, 10vw, 96px);
  height: clamp(72px, 10vw, 96px);
  border-radius: 10px;
  background: #fff;
  padding: 4px;
  flex-shrink: 0;
}

.visual-qr-copy {
  display: grid;
  gap: 4px;
  color: #e2e8f0;
}

.visual-qr-copy strong {
  font-size: clamp(0.78rem, 0.8vw + 0.12vh, 0.92rem);
  line-height: 1.25;
}

.visual-qr-copy small {
  color: #94a3b8;
  font-size: clamp(0.68rem, 0.65vw + 0.1vh, 0.78rem);
  line-height: 1.35;
}

/* Full-screen ambient video — fixed layer covers entire viewport */
body.media-app.media-body--video-fullscreen {
  background: #000;
}

.media-shell--video-fullscreen {
  background: #000;
}

.media-main--fullscreen {
  display: block !important;
  padding: 0 !important;
  margin: 0 !important;
  overflow: hidden !important;
  width: 100%;
  height: 100%;
  min-height: 100%;
  place-items: unset !important;
  align-content: unset !important;
}

.media-shell--chrome-hidden .media-main--fullscreen {
  min-height: 100dvh;
  height: 100%;
}

.ambient-video-stage,
.ambient-asset-stage {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: #000;
  z-index: 2;
}

.ambient-video-fullscreen,
.ambient-asset-fullscreen {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  display: block;
  background: #000;
}

.ambient-video-fullscreen,
.ambient-asset-fullscreen--video {
  object-fit: cover;
}

.ambient-asset-fullscreen--image {
  object-fit: contain;
}

.visual-fullscreen-chrome {
  position: absolute;
  top: max(clamp(10px, 1.6vh, 18px), env(safe-area-inset-top, 0px));
  left: max(clamp(10px, 1.6vw, 18px), env(safe-area-inset-left, 0px));
  right: max(clamp(10px, 1.6vw, 18px), env(safe-area-inset-right, 0px));
  z-index: 4;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  pointer-events: none;
}

.visual-fullscreen-chrome .silent-badge,
.visual-fullscreen-chrome .visual-counter {
  background: rgba(2, 6, 23, 0.72);
  backdrop-filter: blur(6px);
}

.visual-qr-card--fullscreen {
  z-index: 5;
  pointer-events: auto;
  bottom: max(clamp(10px, 1.4vw, 16px), env(safe-area-inset-bottom, 0px));
  right: max(clamp(10px, 1.4vw, 16px), env(safe-area-inset-right, 0px));
}

.visual-brand-mark {
  font-size: clamp(3rem, 10vw + 1vh, 5.5rem);
  font-weight: 900;
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
}

.visual-text-ad {
  width: min(64%, 760px);
  justify-self: start;
  margin-left: clamp(24px, 4vw, 64px);
  display: grid;
  gap: clamp(10px, 1.4vh, 18px);
  text-align: left;
  color: #f8fafc;
}

.visual-text-ad strong {
  font-size: clamp(2rem, 4vw + 1vh, 4.5rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.visual-text-ad span {
  max-width: 760px;
  color: #dbeafe;
  font-size: clamp(1rem, 1.5vw + 0.6vh, 2rem);
  line-height: 1.25;
}

.visual-motion .visual-frame {
  animation: visualKenBurns 8s ease-in-out infinite alternate;
}

@keyframes visualKenBurns {
  0% {
    transform: scale(1) translateY(0);
  }
  100% {
    transform: scale(1.06) translateY(-2%);
  }
}

.visual-meta h2 {
  margin: 0 0 8px;
}

.visual-tagline {
  color: var(--muted);
  line-height: 1.5;
  margin: 0;
  font-size: clamp(0.88rem, 0.95vw + 0.15vh, 1.02rem);
}

/* ── Landscape: primary layout for 14" roof player ── */
@media (orientation: landscape) {
  .media-main:not(.media-main--fullscreen) {
    padding: clamp(10px, 1.4vh, 18px) clamp(20px, 2.8vw, 48px);
  }

  .media-main--setup {
    place-items: center;
  }

  .media-main--setup .panel {
    max-width: min(880px, 78vw);
  }

  .media-main--player,
  .media-main--ambient {
    place-items: stretch;
    align-content: stretch;
  }

  .media-main--player > .player-shell,
  .media-main--ambient > .visual-shell:not(.visual-shell--fullscreen) {
    width: 100%;
    max-width: var(--content-max);
    margin: 0 auto;
    align-self: center;
  }

  .player-shell {
    max-width: var(--content-max);
    display: grid;
    grid-template-columns: minmax(220px, 38vh) minmax(280px, 1fr);
    grid-template-areas:
      "top top"
      "art meta"
      "art progress"
      "art wave"
      "art route";
    align-items: start;
    column-gap: clamp(24px, 3.5vw, 56px);
    row-gap: clamp(8px, 1.2vh, 16px);
    padding: clamp(20px, 2.8vh, 36px) clamp(24px, 3vw, 48px);
    text-align: left;
    min-height: min(calc(100dvh - var(--chrome-height)), 820px);
  }

  .player-shell.loading-player {
    grid-template-columns: 1fr;
    grid-template-areas: unset;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: min(60vh, 480px);
  }

  .player-top {
    grid-area: top;
    margin-bottom: clamp(6px, 1vh, 12px);
  }

  .player-art {
    grid-area: art;
    width: 100%;
    max-width: none;
    margin: 0;
    max-height: min(68vh, 520px);
    align-self: center;
  }

  .player-meta {
    grid-area: meta;
    align-self: end;
  }

  .player-meta h2 {
    font-size: clamp(1.35rem, 1.8vw + 0.5vh, 2rem);
  }

  .player-progress {
    grid-area: progress;
    margin: 0;
  }

  .player-wave {
    grid-area: wave;
    justify-content: flex-start;
    margin-bottom: 0;
  }

  .player-shell > .route-pill {
    grid-area: route;
    justify-self: start;
    margin-top: 0;
  }

  .visual-shell:not(.visual-shell--fullscreen) {
    max-width: var(--content-max);
    min-height: min(calc(100dvh - var(--chrome-height)), 900px);
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(240px, 1fr);
    grid-template-areas:
      "top top"
      "frame meta"
      "frame route";
    align-items: center;
    column-gap: clamp(24px, 3.5vw, 56px);
    row-gap: clamp(10px, 1.4vh, 18px);
    padding: clamp(18px, 2.5vh, 32px) clamp(24px, 3vw, 48px);
    text-align: left;
  }

  .visual-top {
    grid-area: top;
    margin-bottom: 0;
  }

  .visual-frame {
    grid-area: frame;
    margin: 0;
    width: 100%;
    max-height: min(72vh, 640px);
    aspect-ratio: 16 / 9;
    align-self: center;
  }

  .visual-meta {
    grid-area: meta;
    align-self: end;
  }

  .visual-meta h2 {
    font-size: clamp(1.25rem, 1.6vw + 0.4vh, 1.85rem);
  }

  .visual-shell > .route-pill {
    grid-area: route;
    justify-self: start;
    margin-top: 0;
  }
}

/* Wide landscape — typical 14" 1920×1080 and similar */
@media (orientation: landscape) and (min-width: 1200px) {
  html {
    font-size: clamp(16px, calc(0.22vw + 0.55vh), 20px);
  }

  .media-main--ambient .visual-shell {
    min-height: calc(100dvh - var(--chrome-height));
  }

  .media-main--player .player-shell:not(.loading-player) {
    min-height: calc(100dvh - var(--chrome-height));
  }

  .visual-shell {
    grid-template-columns: minmax(0, 1.75fr) minmax(280px, 0.95fr);
  }

  .player-art {
    max-height: min(74vh, 560px);
  }
}

/* Compact landscape (small height) */
@media (orientation: landscape) and (max-height: 620px) {
  :root {
    --chrome-height: 84px;
  }

  .media-header,
  .media-footer {
    padding: 8px 20px;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
  }

  .player-shell,
  .visual-shell:not(.visual-shell--fullscreen) {
    padding: 14px 20px;
    min-height: auto;
  }

  .player-art {
    max-height: 52vh;
  }

  .visual-frame {
    max-height: 58vh;
  }
}

/* Portrait fallback (setup / testing) */
@media (orientation: portrait) {
  .media-shell {
    height: auto;
    min-height: 100dvh;
  }

  body.media-app {
    height: auto;
    overflow: auto;
  }

  .player-shell,
  .visual-shell:not(.visual-shell--fullscreen),
  .panel {
    max-width: min(560px, 94vw);
  }

  .ambient-video-stage,
  .ambient-asset-stage {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100dvh;
  }
}
