/* ==========================================================================
   MONOTV — Monochrome Dark Design System
   Clean obsidian surfaces, hairline borders, high-contrast white typography,
   smooth animations, responsive for desktop & mobile Safari/Chrome.
   ========================================================================== */

:root {
  --bg-canvas: #08080a;
  --bg-surface: #111114;
  --bg-elevated: #17171c;
  --bg-hover: #1f1f26;
  --bg-active: #272730;
  --bg-glass: rgba(12, 12, 16, 0.82);

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-medium: rgba(255, 255, 255, 0.15);
  --border-strong: rgba(255, 255, 255, 0.28);

  --text-primary: #f5f5f7;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;

  --accent-white: #fafafa;
  --accent-ink: #09090b;

  --warn-bg: rgba(245, 158, 11, 0.09);
  --warn-border: rgba(245, 158, 11, 0.34);
  --warn-text: #fcd34d;

  --danger-bg: rgba(239, 68, 68, 0.09);
  --danger-border: rgba(239, 68, 68, 0.32);
  --danger-text: #fca5a5;

  --live-dot: #ef4444;

  --radius-xs: 6px;
  --radius-sm: 9px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-pill: 999px;

  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  --header-h: 60px;
  --sidebar-w: 268px;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg-canvas);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

[hidden] {
  display: none !important;
}

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.65);
  outline-offset: 2px;
}

/* Custom Monochrome Scrollbars */
::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.14);
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* ==========================================================================
   Shared Buttons & Inputs
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  padding: 9px 15px;
  font-weight: 500;
  font-size: 13px;
  transition: background 160ms var(--ease-out), border-color 160ms var(--ease-out),
    color 160ms var(--ease-out), transform 140ms var(--ease-out), opacity 160ms;
  white-space: nowrap;
}

.btn svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.btn:active:not(:disabled) {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-lg {
  padding: 11px 20px;
  font-size: 14px;
  border-radius: var(--radius-md);
}

.btn-sm {
  padding: 6px 11px;
  font-size: 12.5px;
}

.btn-xs {
  padding: 5px 10px;
  font-size: 12px;
}

.btn-full {
  width: 100%;
}

.btn-primary {
  background: var(--accent-white);
  color: var(--accent-ink);
  font-weight: 600;
}

.btn-primary:hover:not(:disabled) {
  background: #e4e4e7;
}

.btn-subtle {
  background: var(--bg-elevated);
  border-color: var(--border-subtle);
  color: var(--text-primary);
}

.btn-subtle:hover:not(:disabled) {
  background: var(--bg-hover);
  border-color: var(--border-medium);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
}

.btn-danger-outline {
  background: transparent;
  border-color: var(--danger-border);
  color: var(--danger-text);
}

.btn-danger-outline:hover:not(:disabled) {
  background: var(--danger-bg);
}

.btn-link {
  background: none;
  border: none;
  padding: 0;
  color: var(--text-secondary);
  font-size: 12.5px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.btn-link:hover {
  color: var(--text-primary);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  transition: background 150ms, color 150ms, border-color 150ms;
}

.icon-btn svg {
  width: 17px;
  height: 17px;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-primary);
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.pill--solid {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
}

/* ==========================================================================
   Login View
   ========================================================================== */

.login-view {
  position: relative;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  animation: fadeIn 320ms var(--ease-out);
}

.login-bg-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: radial-gradient(circle at 50% 35%, rgba(0, 0, 0, 0.85), transparent 72%);
  -webkit-mask-image: radial-gradient(circle at 50% 35%, rgba(0, 0, 0, 0.85), transparent 72%);
}

.login-card {
  position: relative;
  width: 100%;
  max-width: 470px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 30px 28px 24px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.03) inset;
  animation: slideUp 380ms var(--ease-out);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border-medium);
  color: var(--accent-white);
  flex-shrink: 0;
}

.brand-mark svg {
  width: 22px;
  height: 22px;
}

.brand-mark--sm {
  width: 30px;
  height: 30px;
  border-radius: 8px;
}

.brand-mark--sm svg {
  width: 16px;
  height: 16px;
}

.brand-title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.brand-subtitle {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--text-muted);
}

.login-description {
  margin: 16px 0 0;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.55;
}

.login-form {
  margin-top: 22px;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.field-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-primary);
}

.field-hint {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-muted);
}

.field-input {
  width: 100%;
  background: var(--bg-canvas);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13.5px;
  color: var(--text-primary);
  transition: border-color 150ms, background 150ms;
}

.field-input::placeholder {
  color: #52525b;
}

.field-input:hover {
  border-color: var(--border-medium);
}

.field-input:focus {
  border-color: var(--border-strong);
  background: #0c0c0f;
  outline: none;
}

.password-wrap {
  position: relative;
}

.password-wrap .field-input {
  padding-right: 40px;
}

.password-toggle {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
}

.inline-alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  line-height: 1.45;
}

.inline-alert--error {
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  color: var(--danger-text);
}

.alert-icon {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  margin-top: 1px;
}

.login-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}

.login-actions .btn-primary {
  flex: 1;
}

.btn-spinner {
  display: none;
  width: 15px;
  height: 15px;
  border: 2px solid rgba(9, 9, 11, 0.25);
  border-top-color: var(--accent-ink);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

.btn.is-loading .btn-spinner {
  display: inline-block;
}

.login-footer {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-size: 11.5px;
  color: var(--text-muted);
}

.login-footer svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  margin-top: 2px;
}

/* ==========================================================================
   Main App Shell & Header
   ========================================================================== */

.app-view {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  animation: fadeIn 260ms var(--ease-out);
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 0 18px;
  background: var(--bg-glass);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border-subtle);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-shrink: 0;
}

.header-brand-name {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.nav-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.nav-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  transition: background 180ms var(--ease-out), color 180ms var(--ease-out);
}

.nav-tab:hover {
  color: var(--text-primary);
}

.nav-tab.is-active {
  background: var(--accent-white);
  color: var(--accent-ink);
  font-weight: 600;
}

.tab-count {
  font-size: 11px;
  padding: 1px 6px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
}

.nav-tab.is-active .tab-count {
  background: rgba(9, 9, 11, 0.12);
  color: var(--accent-ink);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  justify-content: flex-end;
  min-width: 0;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 310px;
}

.search-icon {
  position: absolute;
  left: 11px;
  width: 15px;
  height: 15px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 7.5px 34px 7.5px 33px;
  font-size: 13px;
  color: var(--text-primary);
  transition: border-color 160ms, background 160ms;
}

.search-input::-webkit-search-cancel-button {
  display: none;
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-input:focus {
  outline: none;
  border-color: var(--border-strong);
  background: var(--bg-elevated);
}

.search-kbd {
  position: absolute;
  right: 9px;
  padding: 1px 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: 5px;
  pointer-events: none;
}

.search-box.has-value .search-kbd {
  display: none;
}

.search-clear {
  position: absolute;
  right: 7px;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.09);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.search-clear svg {
  width: 12px;
  height: 12px;
}

.search-clear:hover {
  background: rgba(255, 255, 255, 0.18);
  color: var(--text-primary);
}

.account-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 500;
  transition: border-color 150ms, color 150ms, background 150ms;
  flex-shrink: 0;
}

.account-pill:hover {
  border-color: var(--border-medium);
  color: var(--text-primary);
  background: var(--bg-elevated);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-white);
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.55);
}

.account-pill-name {
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-logout {
  flex-shrink: 0;
}

/* Account Popover */
.account-popover {
  position: fixed;
  top: calc(var(--header-h) + 8px);
  right: 18px;
  z-index: 60;
  width: 310px;
  max-width: calc(100vw - 24px);
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: 0 22px 50px rgba(0, 0, 0, 0.72);
  animation: scaleIn 160ms var(--ease-out);
}

.popover-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.popover-title {
  margin: 0;
  font-weight: 600;
  font-size: 14px;
}

.popover-subtitle {
  margin: 2px 0 0;
  font-size: 11.5px;
  color: var(--text-muted);
  word-break: break-all;
}

.popover-meta {
  margin: 12px 0 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.popover-meta > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
}

.popover-meta dt {
  color: var(--text-muted);
  flex-shrink: 0;
}

.popover-meta dd {
  margin: 0;
  color: var(--text-primary);
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Mobile Tabs */
.mobile-tabs {
  display: none;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 8px 12px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
}

.mobile-tab {
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
}

.mobile-tab.is-active {
  background: var(--accent-white);
  color: var(--accent-ink);
  font-weight: 600;
}

/* ==========================================================================
   Workspace Split & Category Sidebar
   ========================================================================== */

.workspace {
  display: flex;
  flex: 1;
  min-height: calc(100dvh - var(--header-h));
}

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  position: sticky;
  top: var(--header-h);
  height: calc(100dvh - var(--header-h));
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  transition: transform 240ms var(--ease-out), width 240ms var(--ease-out);
}

.app-view.is-theater .sidebar {
  display: none;
}

.sidebar-top {
  padding: 14px 12px 10px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-heading {
  margin: 0;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.sidebar-search {
  width: 100%;
  background: var(--bg-canvas);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  font-size: 12.5px;
  color: var(--text-primary);
}

.sidebar-search::placeholder {
  color: #52525b;
}

.sidebar-search:focus {
  outline: none;
  border-color: var(--border-strong);
}

.category-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.category-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 6px 4px;
}

.category-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  text-align: left;
  transition: background 140ms, color 140ms, border-color 140ms;
}

.category-item:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.category-item.is-active {
  background: var(--bg-active);
  border-color: var(--border-medium);
  color: var(--text-primary);
  font-weight: 600;
}

.category-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.category-item.is-active .category-count {
  color: var(--text-secondary);
}

/* ==========================================================================
   Main Column & Video Player Stage
   ========================================================================== */

.main-column {
  flex: 1;
  min-width: 0;
  padding: 18px 22px 48px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.player-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: slideDown 260ms var(--ease-out);
}

.player-shell {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 62vh;
  background: #000;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  user-select: none;
}

.app-view.is-theater .player-shell {
  max-height: 78vh;
}

.player-shell:fullscreen,
.player-shell:-webkit-full-screen {
  max-height: none;
  border-radius: 0;
  border: none;
  width: 100vw;
  height: 100vh;
}

.video-el {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  display: block;
}

.player-overlay-top,
.player-controls {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 10;
  transition: opacity 220ms ease, transform 220ms var(--ease-out);
}

.player-overlay-top {
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 26px;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.82), transparent);
}

.player-controls {
  bottom: 0;
  padding: 24px 14px 12px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.88), rgba(0, 0, 0, 0.4) 65%, transparent);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.player-shell.controls-hidden .player-overlay-top,
.player-shell.controls-hidden .player-controls {
  opacity: 0;
  pointer-events: none;
}

.player-shell.controls-hidden {
  cursor: none;
}

.player-meta-left,
.player-meta-right {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.player-live-pill {
  padding: 2px 8px;
  border-radius: var(--radius-xs);
  background: rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(8px);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  flex-shrink: 0;
}

.player-title {
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
}

.player-tech-pill {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--text-secondary);
}

.player-center-layer {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.player-spinner {
  width: 42px;
  height: 42px;
  border: 3px solid rgba(255, 255, 255, 0.18);
  border-top-color: var(--accent-white);
  border-radius: 50%;
  animation: spin 750ms linear infinite;
}

.player-center-play {
  pointer-events: auto;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(9, 9, 11, 0.72);
  backdrop-filter: blur(10px);
  color: var(--accent-white);
  display: grid;
  place-items: center;
  transition: transform 150ms var(--ease-out), background 150ms;
}

.player-center-play svg {
  width: 26px;
  height: 26px;
  margin-left: 3px;
}

.player-center-play:hover {
  transform: scale(1.07);
  background: rgba(255, 255, 255, 0.2);
}

/* Fatal Error Overlay inside Player */
.player-error-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(8, 8, 10, 0.9);
  backdrop-filter: blur(8px);
}

.player-error-card {
  max-width: 440px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.player-error-icon {
  width: 34px;
  height: 34px;
  color: var(--warn-text);
}

.player-error-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.player-error-message {
  margin: 0;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.player-error-detail {
  margin: 2px 0 4px;
  font-size: 11px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
  padding: 4px 10px;
  border-radius: var(--radius-xs);
}

.player-error-actions {
  display: flex;
  gap: 10px;
  margin-top: 6px;
  flex-wrap: wrap;
  justify-content: center;
}

/* Player Bottom Controls */
.player-seek-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.timecode {
  font-size: 11.5px;
  color: var(--text-secondary);
  min-width: 44px;
}

.timecode:last-child {
  text-align: right;
}

.player-controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.controls-left,
.controls-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.player-icon-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 140ms, transform 120ms;
}

.player-icon-btn svg {
  width: 18px;
  height: 18px;
}

.player-icon-btn:hover {
  background: rgba(255, 255, 255, 0.14);
}

.player-icon-btn.is-active {
  background: rgba(255, 255, 255, 0.22);
}

.player-text-btn {
  height: 30px;
  padding: 0 9px;
  border-radius: var(--radius-xs);
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(0, 0, 0, 0.45);
  color: var(--text-primary);
  font-size: 11.5px;
  font-weight: 500;
}

.player-text-btn:hover {
  background: rgba(255, 255, 255, 0.16);
}

.live-edge-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 9px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(0, 0, 0, 0.45);
  color: var(--text-primary);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.live-edge-btn:hover {
  background: rgba(255, 255, 255, 0.16);
}

.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--live-dot);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.85);
  animation: pulseDot 1.8s infinite;
}

.volume-group {
  display: flex;
  align-items: center;
  gap: 4px;
}

.player-range {
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.24);
  cursor: pointer;
}

.player-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent-white);
  border: none;
  transition: transform 120ms;
}

.player-range::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.player-range::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent-white);
  border: none;
}

.seek-range {
  flex: 1;
}

.volume-range {
  width: 74px;
}

.player-menu-wrap {
  position: relative;
}

.player-popup-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  min-width: 145px;
  max-height: 220px;
  overflow-y: auto;
  padding: 5px;
  background: rgba(17, 17, 20, 0.96);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.65);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.popup-option {
  width: 100%;
  text-align: left;
  padding: 6px 9px;
  border: none;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.popup-option:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

.popup-option.is-active {
  background: var(--accent-white);
  color: var(--accent-ink);
  font-weight: 600;
}

/* ==========================================================================
   Unsupported Audio Codec Banner
   ========================================================================== */

.codec-alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  border-radius: var(--radius-md);
  animation: slideDown 200ms var(--ease-out);
}

.codec-alert-body {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  min-width: 0;
}

.codec-alert-icon {
  width: 19px;
  height: 19px;
  color: var(--warn-text);
  flex-shrink: 0;
  margin-top: 2px;
}

.codec-alert-copy strong {
  display: block;
  font-size: 13px;
  color: var(--warn-text);
  font-weight: 600;
}

.codec-alert-copy p {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.45;
}

.codec-alert-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* ==========================================================================
   Active Stream Info + EPG Now / Next Strip
   ========================================================================== */

.now-playing-bar {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.now-playing-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.now-playing-identity {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.active-logo {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  display: grid;
  place-items: center;
  overflow: hidden;
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
}

.active-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 4px;
}

.now-playing-titles {
  min-width: 0;
}

.active-stream-name {
  margin: 0;
  font-size: 15.5px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.active-stream-sub {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--text-muted);
}

.now-playing-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

#btn-active-favorite[aria-pressed="true"] svg {
  fill: var(--accent-white);
  stroke: var(--accent-white);
}

/* EPG Panel */
.epg-panel {
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.epg-row {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 12px;
}

.epg-slot {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  min-width: 0;
}

.epg-slot-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 5px;
}

.epg-tag {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
}

.epg-tag--now {
  background: var(--accent-white);
  color: var(--accent-ink);
}

.epg-time {
  font-size: 11px;
  color: var(--text-muted);
}

.epg-program-title {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.epg-progress-track {
  margin-top: 7px;
  height: 3px;
  width: 100%;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  overflow: hidden;
}

.epg-progress-fill {
  height: 100%;
  background: var(--accent-white);
  border-radius: 999px;
  transition: width 350ms var(--ease-out);
}

.epg-program-desc {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.epg-schedule-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 4px;
}

.epg-schedule-item {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 7px 10px;
  border-radius: var(--radius-xs);
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--border-subtle);
  font-size: 12.5px;
}

.epg-schedule-item .mono {
  color: var(--text-muted);
  font-size: 11.5px;
  flex-shrink: 0;
}

/* ==========================================================================
   Catalog Toolbar & Cards (Live TV / Movies / Series)
   ========================================================================== */

.catalog-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.catalog-toolbar-left {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}

.catalog-heading {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.catalog-count {
  font-size: 12px;
  color: var(--text-muted);
}

.catalog-toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.segmented-mini {
  display: inline-flex;
  padding: 2px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}

.seg-btn {
  width: 30px;
  height: 28px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.seg-btn svg {
  width: 15px;
  height: 15px;
}

.seg-btn.is-active {
  background: var(--bg-active);
  color: var(--text-primary);
}

/* Live TV Grid */
.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

/* Live TV Compact List */
.catalog-grid.is-list {
  grid-template-columns: 1fr;
  gap: 6px;
}

/* Movies / Series Poster Grid */
.catalog-grid.is-posters {
  grid-template-columns: repeat(auto-fill, minmax(156px, 1fr));
  gap: 14px;
}

/* Live Channel Card */
.channel-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 150ms var(--ease-out), border-color 150ms var(--ease-out), transform 150ms var(--ease-out);
}

.channel-card:hover {
  background: var(--bg-elevated);
  border-color: var(--border-medium);
  transform: translateY(-1px);
}

.channel-card.is-playing {
  background: var(--bg-active);
  border-color: var(--accent-white);
}

.channel-card-top {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.channel-logo {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: var(--bg-canvas);
  border: 1px solid var(--border-subtle);
  display: grid;
  place-items: center;
  overflow: hidden;
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
}

.channel-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 4px;
}

.channel-info {
  flex: 1;
  min-width: 0;
}

.channel-name {
  margin: 0;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.channel-num {
  margin: 2px 0 0;
  font-size: 11px;
  color: var(--text-muted);
}

.fav-btn {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-xs);
  border: none;
  background: transparent;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: color 140ms, background 140ms;
}

.fav-btn svg {
  width: 15px;
  height: 15px;
}

.fav-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

.fav-btn.is-fav {
  color: var(--accent-white);
}

.fav-btn.is-fav svg {
  fill: var(--accent-white);
}

.channel-epg {
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 38px;
}

.channel-epg-line {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--text-secondary);
  min-width: 0;
}

.channel-epg-line.is-next {
  color: var(--text-muted);
}

.channel-epg-badge {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.09);
  color: var(--text-primary);
  flex-shrink: 0;
}

.channel-epg-line.is-next .channel-epg-badge {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
}

.channel-epg-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.channel-epg-empty {
  font-size: 11.5px;
  color: #52525b;
}

/* Compact List Mode for Live TV */
.catalog-grid.is-list .channel-card {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  gap: 14px;
}

.catalog-grid.is-list .channel-card-top {
  flex: 1;
}

.catalog-grid.is-list .channel-logo {
  width: 36px;
  height: 36px;
}

.catalog-grid.is-list .channel-epg {
  flex: 1.2;
  padding-top: 0;
  border-top: none;
  min-height: 0;
}

/* Playing Equalizer Indicator */
.playing-eq {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 12px;
  margin-right: 4px;
}

.playing-eq span {
  width: 2.5px;
  background: var(--accent-white);
  border-radius: 2px;
  animation: eqBounce 850ms ease-in-out infinite;
}

.playing-eq span:nth-child(2) {
  animation-delay: 160ms;
}

.playing-eq span:nth-child(3) {
  animation-delay: 320ms;
}

/* Poster Card (VOD & Series) */
.poster-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  transition: transform 180ms var(--ease-out), border-color 160ms, background 160ms;
}

.poster-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-strong);
  background: var(--bg-elevated);
}

.poster-media {
  position: relative;
  aspect-ratio: 2 / 3;
  background: var(--bg-canvas);
  overflow: hidden;
  display: grid;
  place-items: center;
}

.poster-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 320ms var(--ease-out);
}

.poster-card:hover .poster-media img {
  transform: scale(1.04);
}

.poster-fallback {
  padding: 12px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.poster-badges {
  position: absolute;
  top: 8px;
  left: 8px;
  right: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}

.poster-pill {
  padding: 2px 7px;
  border-radius: 5px;
  background: rgba(9, 9, 11, 0.8);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-primary);
}

.poster-fav {
  pointer-events: auto;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(9, 9, 11, 0.72);
  backdrop-filter: blur(8px);
}

.poster-body {
  padding: 10px 11px 11px;
}

.poster-title {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.35;
}

.poster-meta {
  margin: 4px 0 0;
  font-size: 11px;
  color: var(--text-muted);
}

/* Skeletons & Empty States */
.skeleton-card {
  height: 106px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: linear-gradient(
    110deg,
    var(--bg-surface) 25%,
    var(--bg-elevated) 45%,
    var(--bg-surface) 65%
  );
  background-size: 220% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}

.catalog-grid.is-posters .skeleton-card {
  height: 268px;
}

.empty-state {
  grid-column: 1 / -1;
  padding: 56px 20px;
  text-align: center;
  background: var(--bg-surface);
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-lg);
}

.empty-state h3 {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 600;
}

.empty-state p {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}

.catalog-sentinel {
  height: 24px;
}

/* ==========================================================================
   VOD / Series Detail Modal
   ========================================================================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(0, 0, 0, 0.76);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: grid;
  place-items: center;
  padding: 20px;
  animation: fadeIn 180ms ease-out;
}

.modal-card {
  position: relative;
  width: 100%;
  max-width: 760px;
  max-height: 88dvh;
  overflow-y: auto;
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-xl);
  padding: 24px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.8);
  animation: scaleIn 220ms var(--ease-out);
}

.modal-close {
  position: sticky;
  top: 0;
  float: right;
  z-index: 5;
  background: rgba(17, 17, 20, 0.88);
  border: 1px solid var(--border-subtle);
}

.detail-hero {
  display: grid;
  grid-template-columns: 165px 1fr;
  gap: 20px;
  align-items: start;
}

.detail-poster {
  width: 100%;
  aspect-ratio: 2 / 3;
  border-radius: var(--radius-md);
  background: var(--bg-canvas);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
  display: grid;
  place-items: center;
  color: var(--text-muted);
  font-size: 12px;
}

.detail-poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.detail-title {
  margin: 0;
  font-size: 21px;
  font-weight: 700;
  line-height: 1.25;
  padding-right: 36px;
}

.detail-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.detail-pill {
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  font-size: 11.5px;
  color: var(--text-secondary);
}

.detail-plot {
  margin: 12px 0 0;
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.detail-credits {
  margin-top: 12px;
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.detail-actions {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* Series Seasons & Episodes */
.series-browser {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border-subtle);
}

.season-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 10px;
}

.season-tab {
  padding: 6px 13px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
}

.season-tab.is-active {
  background: var(--accent-white);
  border-color: var(--accent-white);
  color: var(--accent-ink);
  font-weight: 600;
}

.episode-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.episode-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 13px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color 140ms, background 140ms;
}

.episode-row:hover {
  background: var(--bg-hover);
  border-color: var(--border-medium);
}

.episode-info {
  min-width: 0;
  flex: 1;
}

.episode-title {
  margin: 0;
  font-size: 13.5px;
  font-weight: 600;
}

.episode-plot {
  margin: 3px 0 0;
  font-size: 12px;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.episode-play-pill {
  flex-shrink: 0;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  background: var(--accent-white);
  color: var(--accent-ink);
  font-size: 12px;
  font-weight: 600;
}

/* ==========================================================================
   Toast Notifications
   ========================================================================== */

.toast-container {
  position: fixed;
  bottom: max(20px, env(safe-area-inset-bottom));
  right: 20px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  padding: 10px 15px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 13px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.65);
  animation: slideUp 220ms var(--ease-out);
}

/* ==========================================================================
   Responsive Breakpoints (Desktop / Tablet / Mobile Safari & Chrome)
   ========================================================================== */

.mobile-only {
  display: none;
}

@media (max-width: 1024px) {
  .epg-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .mobile-only {
    display: inline-flex;
  }

  .desktop-only {
    display: none;
  }

  .nav-tabs {
    display: none;
  }

  .mobile-tabs {
    display: grid;
  }

  .account-pill-name {
    display: none;
  }

  .btn-logout span {
    display: none;
  }

  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    height: 100dvh;
    z-index: 70;
    width: min(82vw, 300px);
    transform: translateX(-104%);
    box-shadow: 18px 0 60px rgba(0, 0, 0, 0.75);
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 65;
    background: rgba(0, 0, 0, 0.66);
    backdrop-filter: blur(4px);
  }

  .main-column {
    padding: 14px 12px calc(32px + env(safe-area-inset-bottom));
  }

  .catalog-grid.is-list .channel-card {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .catalog-grid.is-list .channel-epg {
    padding-top: 8px;
    border-top: 1px solid var(--border-subtle);
  }
}

@media (max-width: 640px) {
  .login-card {
    padding: 24px 18px 20px;
  }

  .field-row {
    grid-template-columns: 1fr;
  }

  .app-header {
    padding: 0 10px;
    gap: 8px;
  }

  .header-brand-name {
    display: none;
  }

  .search-box {
    max-width: none;
  }

  .search-kbd {
    display: none;
  }

  .volume-range {
    display: none;
  }

  .codec-alert {
    flex-direction: column;
    align-items: stretch;
  }

  .codec-alert-actions {
    justify-content: flex-end;
  }

  .detail-hero {
    grid-template-columns: 1fr;
  }

  .detail-poster {
    max-width: 150px;
  }

  .catalog-grid {
    grid-template-columns: 1fr;
  }

  .catalog-grid.is-posters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
}

/* ==========================================================================
   Keyframes & Reduced Motion
   ========================================================================== */

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

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

@keyframes pulseDot {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.45;
    transform: scale(0.82);
  }
}

@keyframes eqBounce {
  0%,
  100% {
    height: 4px;
  }
  50% {
    height: 12px;
  }
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
