/* ==========================================================================
   MSX VIDEO // ANTIGRAVITY EDITION — Samsung Smart TV (Tizen / MSX) Styles
   Deep Dark Theme (#0a0a0c, #121216) + Glassmorphism + Soft Neon Accents
   ========================================================================== */

:root {
  --bg-deep: #0a0a0c;
  --bg-surface: #121216;
  --bg-elevated: #181920;
  --bg-glass: rgba(18, 18, 22, 0.72);
  --bg-glass-heavy: rgba(12, 13, 18, 0.88);
  --bg-glass-card: rgba(24, 26, 34, 0.65);

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-glass: rgba(255, 255, 255, 0.14);
  --border-focus: #00e5ff;

  --accent-cyan: #00e5ff;
  --accent-cyan-glow: rgba(0, 229, 255, 0.38);
  --accent-cyan-soft: rgba(0, 229, 255, 0.14);

  --accent-emerald: #00f5a0;
  --accent-emerald-glow: rgba(0, 245, 160, 0.32);

  --accent-gold: #ffb74d;
  --accent-gold-glow: rgba(255, 183, 77, 0.35);

  --accent-live: #ff4d6d;

  --text-primary: #f5f7fa;
  --text-secondary: #a0a8b8;
  --text-muted: #646d7e;

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --radius-xl: 28px;

  --transition-fast: 180ms cubic-bezier(0.22, 1, 0.36, 1);
  --transition-smooth: 280ms cubic-bezier(0.22, 1, 0.36, 1);
  --sidebar-width: 250px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  -webkit-font-smoothing: antialiased;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-deep);
  color: var(--text-primary);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  font-size: 16px;
  line-height: 1.45;
}

/* Background Canvas & Ambient Vignette */
#antigravity-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  pointer-events: none;
}

.ambient-vignette {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  transition: background 500ms ease;
  background:
    radial-gradient(circle at 18% 15%, rgba(0, 229, 255, 0.08) 0%, transparent 48%),
    radial-gradient(circle at 82% 80%, rgba(0, 245, 160, 0.055) 0%, transparent 52%),
    radial-gradient(circle at 50% 50%, transparent 50%, rgba(5, 5, 8, 0.84) 100%);
}

/* Warm Winter Visual Theme ("Зима") */
body.theme-winter {
  --bg-deep: #0c0b0e;
  --bg-glass: rgba(24, 21, 20, 0.74);
  --bg-glass-card: rgba(30, 26, 25, 0.68);
  --border-glass: rgba(255, 205, 140, 0.18);
  --border-focus: #ffbe5c;
  --accent-cyan: #ffbe5c;
  --accent-cyan-glow: rgba(255, 190, 92, 0.38);
  --accent-cyan-soft: rgba(255, 190, 92, 0.15);
  --accent-emerald: #7ce8ff;
}

body.theme-winter .ambient-vignette {
  background:
    radial-gradient(circle at 20% 18%, rgba(255, 183, 77, 0.095) 0%, transparent 48%),
    radial-gradient(circle at 82% 78%, rgba(124, 232, 255, 0.065) 0%, transparent 52%),
    radial-gradient(circle at 50% 50%, transparent 52%, rgba(8, 7, 10, 0.82) 100%);
}

/* App Shell */
#app-root {
  position: relative;
  z-index: 2;
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ==========================================================================
   UNIVERSAL TV REMOTE FOCUS SYSTEM (.focusable)
   Smooth glow, gentle scale, zero layout shift
   ========================================================================== */
.focusable {
  position: relative;
  outline: none;
  cursor: pointer;
  transition:
    transform var(--transition-smooth),
    box-shadow var(--transition-smooth),
    background-color var(--transition-fast),
    border-color var(--transition-fast),
    color var(--transition-fast);
  will-change: transform, box-shadow;
}

.focusable.tv-focused,
.focusable:focus-visible {
  z-index: 15;
  border-color: var(--border-focus) !important;
  box-shadow:
    0 0 0 2px rgba(0, 229, 255, 0.9),
    0 12px 32px -6px rgba(0, 0, 0, 0.75),
    0 0 26px 0 var(--accent-cyan-glow) !important;
}

/* ==========================================================================
   TOP STATUS & PROFILE BAR
   ========================================================================== */
.tv-topbar {
  height: 74px;
  padding: 0 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(180deg, rgba(10, 10, 12, 0.92) 0%, rgba(10, 10, 12, 0.45) 100%);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
  z-index: 20;
}

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

.brand-logo {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(0, 229, 255, 0.22), rgba(0, 245, 160, 0.12));
  border: 1px solid rgba(0, 229, 255, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 20px rgba(0, 229, 255, 0.22);
}

.brand-logo svg {
  width: 24px;
  height: 24px;
  color: var(--accent-cyan);
}

.brand-title {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 12px;
}

.neon-brand-main {
  color: #f0fcff;
  text-shadow:
    0 0 8px rgba(0, 229, 255, 0.85),
    0 0 18px rgba(0, 229, 255, 0.55),
    0 0 32px rgba(0, 245, 160, 0.35);
}

.brand-title span.sub,
.neon-brand-sub {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 4px 11px;
  border-radius: 999px;
  background: rgba(0, 229, 255, 0.14);
  color: #00f5a0;
  border: 1px solid rgba(0, 245, 160, 0.55);
  text-shadow:
    0 0 8px rgba(0, 245, 160, 0.85),
    0 0 16px rgba(0, 229, 255, 0.55);
  box-shadow:
    0 0 14px rgba(0, 245, 160, 0.28),
    inset 0 0 8px rgba(0, 229, 255, 0.18);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.ambient-toggle-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  background: var(--bg-glass-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.84rem;
  font-weight: 500;
}

.ambient-toggle-btn.tv-focused {
  transform: scale(1.04);
  color: var(--text-primary);
  background: rgba(0, 229, 255, 0.14);
}

.profile-pill {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 16px 6px 8px;
  border-radius: 999px;
  background: var(--bg-glass-card);
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
}

.profile-pill.tv-focused {
  transform: scale(1.05);
  background: rgba(0, 229, 255, 0.16);
}

.profile-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.92rem;
  color: #06080c;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-emerald));
}

.profile-meta {
  display: flex;
  flex-direction: column;
  text-align: left;
}

.profile-name {
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.15;
}

.profile-email {
  font-size: 0.74rem;
  color: var(--text-secondary);
}

.profile-switch-hint {
  font-size: 0.72rem;
  padding: 3px 8px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--accent-cyan);
  font-weight: 600;
}

.tv-clock {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  padding-left: 8px;
  border-left: 1px solid var(--border-subtle);
}

.tv-clock-time {
  font-size: 1.15rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.03em;
}

.tv-clock-date {
  font-size: 0.72rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ==========================================================================
   SCREEN 1: AUTHENTICATION & PROFILE LOGIN SCREEN (First Screen)
   ========================================================================== */
.auth-screen {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 48px;
  overflow-y: auto;
}

.auth-container {
  width: 100%;
  max-width: 1380px;
  display: grid;
  grid-template-columns: 1.05fr 1.15fr;
  gap: 32px;
  align-items: stretch;
}

.auth-panel {
  background: var(--bg-glass);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-xl);
  padding: 32px 34px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.65);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.auth-header-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent-cyan);
  margin-bottom: 10px;
}

.auth-title {
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.auth-subtitle {
  font-size: 0.92rem;
  color: var(--text-secondary);
  margin-bottom: 22px;
}

/* Email Input Box for TV Remote */
.email-input-group {
  margin-bottom: 20px;
}

.email-input-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}

.email-display-box {
  width: 100%;
  min-height: 58px;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  background: rgba(8, 9, 13, 0.85);
  border: 1.5px solid var(--border-glass);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-primary);
}

.email-display-box.tv-focused {
  background: rgba(0, 229, 255, 0.07);
}

.email-text-wrap {
  display: flex;
  align-items: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.email-placeholder {
  color: var(--text-muted);
  font-weight: 400;
}

.email-caret {
  display: inline-block;
  width: 2.5px;
  height: 24px;
  background-color: var(--accent-cyan);
  margin-left: 3px;
  animation: caretBlink 1s infinite;
}

@keyframes caretBlink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

.email-status-badge {
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 99px;
  font-weight: 600;
}

.email-status-badge.valid {
  background: rgba(0, 245, 160, 0.15);
  color: var(--accent-emerald);
  border: 1px solid rgba(0, 245, 160, 0.35);
}

.email-status-badge.hint {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
}

/* Profile Role / Preset Chips */
.profile-role-row {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.role-chip {
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.role-chip.active {
  background: var(--accent-cyan-soft);
  border-color: rgba(0, 229, 255, 0.45);
  color: var(--accent-cyan);
}

.role-chip.tv-focused {
  transform: scale(1.05);
}

/* Saved Profiles Section (Quick Switch) */
.saved-profiles-section {
  margin-top: 14px;
  padding-top: 18px;
  border-top: 1px solid var(--border-subtle);
}

.saved-profiles-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.saved-profiles-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.saved-profile-card {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
}

.saved-profile-card.tv-focused {
  transform: scale(1.04) translateY(-2px);
  background: rgba(0, 229, 255, 0.12);
}

.saved-profile-avatar {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.05rem;
  color: #08090c;
  flex-shrink: 0;
}

.saved-profile-info {
  overflow: hidden;
  flex: 1;
}

.saved-profile-name {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.saved-profile-email {
  font-size: 0.75rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.saved-profile-stats {
  font-size: 0.7rem;
  color: var(--accent-cyan);
  margin-top: 2px;
}

/* On-Screen TV Keyboard */
.keyboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.keyboard-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.keyboard-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.domain-shortcuts {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}

.domain-key {
  padding: 8px 6px;
  border-radius: var(--radius-sm);
  background: rgba(0, 229, 255, 0.08);
  border: 1px solid rgba(0, 229, 255, 0.22);
  color: var(--accent-cyan);
  font-size: 0.82rem;
  font-weight: 600;
  text-align: center;
}

.domain-key.tv-focused {
  transform: scale(1.06);
  background: var(--accent-cyan);
  color: #06080c;
}

.tv-keyboard-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 7px;
  margin-bottom: 12px;
}

.kb-key {
  height: 44px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

.kb-key.tv-focused {
  transform: scale(1.12);
  background: var(--accent-cyan);
  color: #06080c;
  font-weight: 800;
}

.kb-actions-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1.8fr;
  gap: 10px;
}

.kb-action-btn {
  height: 50px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.kb-action-btn.primary-submit {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-emerald));
  color: #05080c;
  border-color: transparent;
  font-size: 0.96rem;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.kb-action-btn.tv-focused {
  transform: scale(1.05);
}

/* ==========================================================================
   SCREEN 2: MAIN MEDIA CENTER WORKSPACE (Sidebar + Content Stage)
   ========================================================================== */
.main-workspace {
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* Left Navigation Sidebar */
.tv-sidebar {
  width: var(--sidebar-width);
  background: rgba(14, 15, 20, 0.78);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--border-subtle);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex-shrink: 0;
  z-index: 18;
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-item {
  height: 48px;
  padding: 0 16px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.95rem;
  font-weight: 600;
}

.nav-item-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.08rem;
}

.nav-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(0, 229, 255, 0.18) 0%, rgba(0, 229, 255, 0.03) 100%);
  color: var(--text-primary);
  border-color: rgba(0, 229, 255, 0.32);
}

.nav-item.active .nav-icon {
  color: var(--accent-cyan);
}

.nav-item.active .nav-badge {
  background: var(--accent-cyan-soft);
  color: var(--accent-cyan);
}

.nav-item.tv-focused {
  transform: translateX(6px) scale(1.02);
  background: rgba(0, 229, 255, 0.22);
  color: #ffffff;
}

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

.logout-btn {
  height: 44px;
  padding: 0 14px;
  border-radius: var(--radius-md);
  background: rgba(255, 77, 109, 0.09);
  border: 1px solid rgba(255, 77, 109, 0.25);
  color: #ff8fa3;
  font-size: 0.86rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}

.logout-btn.tv-focused {
  transform: scale(1.03);
  background: rgba(255, 77, 109, 0.22);
  border-color: #ff4d6d !important;
  box-shadow: 0 0 20px rgba(255, 77, 109, 0.4) !important;
  color: #ffffff;
}

/* Main Content Stage */
.content-stage {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 26px 38px 90px 38px;
  scroll-behavior: smooth;
}

.content-stage::-webkit-scrollbar {
  width: 6px;
}

.content-stage::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.14);
  border-radius: 99px;
}

/* Hero Banner */
.hero-banner {
  position: relative;
  width: 100%;
  min-height: 320px;
  border-radius: var(--radius-xl);
  overflow: hidden;
  border: 1px solid var(--border-glass);
  margin-bottom: 34px;
  display: flex;
  align-items: flex-end;
  padding: 32px 36px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.65);
  background-size: cover;
  background-position: center 25%;
}

.hero-banner::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(10, 10, 12, 0.95) 0%, rgba(10, 10, 12, 0.76) 48%, rgba(10, 10, 12, 0.2) 100%),
    linear-gradient(180deg, rgba(10, 10, 12, 0.1) 0%, rgba(10, 10, 12, 0.92) 100%);
  z-index: 1;
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: 640px;
}

.hero-tags {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.hero-tag {
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(8px);
}

.hero-tag.holiday {
  background: rgba(255, 183, 77, 0.2);
  color: var(--accent-gold);
  border: 1px solid rgba(255, 183, 77, 0.45);
}

.hero-tag.uhd {
  background: var(--accent-cyan-soft);
  color: var(--accent-cyan);
  border: 1px solid rgba(0, 229, 255, 0.35);
}

.hero-title {
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.12;
  margin-bottom: 10px;
}

.hero-desc {
  font-size: 0.94rem;
  color: var(--text-secondary);
  margin-bottom: 20px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.hero-btn {
  height: 46px;
  padding: 0 22px;
  border-radius: var(--radius-md);
  font-size: 0.92rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--border-glass);
  background: rgba(255, 255, 255, 0.09);
  color: var(--text-primary);
  backdrop-filter: blur(12px);
}

.hero-btn.primary {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-emerald));
  color: #06080c;
  border-color: transparent;
  font-weight: 800;
}

.hero-btn.tv-focused {
  transform: scale(1.06) translateY(-2px);
}

/* Section Headers & Content Rails */
.content-section {
  margin-bottom: 34px;
}

.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-title {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-subtitle {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

/* Poster Grid & Horizontal Row */
.cards-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(195px, 1fr));
  gap: 20px;
}

.cards-row.holiday-rail {
  padding: 18px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(255, 183, 77, 0.07) 0%, rgba(0, 229, 255, 0.05) 100%);
  border: 1px solid rgba(255, 183, 77, 0.22);
}

/* Glassmorphism Media Card */
.media-card {
  border-radius: var(--radius-md);
  background: var(--bg-glass-card);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.media-card.tv-focused {
  transform: scale(1.065) translateY(-6px);
  background: rgba(28, 32, 44, 0.92);
}

.poster-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 2.85;
  overflow: hidden;
  background: #14161d;
}

.poster-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 400ms ease;
}

.media-card.tv-focused .poster-img {
  transform: scale(1.06);
}

.poster-badges {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 2;
}

.rating-pill {
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.76rem;
  font-weight: 800;
  background: rgba(10, 10, 12, 0.84);
  color: var(--accent-emerald);
  border: 1px solid rgba(0, 245, 160, 0.35);
  backdrop-filter: blur(6px);
}

.quality-pill {
  padding: 3px 7px;
  border-radius: 6px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  background: rgba(0, 229, 255, 0.2);
  color: var(--accent-cyan);
  border: 1px solid rgba(0, 229, 255, 0.4);
  backdrop-filter: blur(6px);
}

.fav-indicator {
  position: absolute;
  bottom: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(10, 10, 12, 0.82);
  color: var(--accent-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  border: 1px solid rgba(255, 183, 77, 0.45);
}

.progress-bar-wrap {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: rgba(255, 255, 255, 0.18);
}

.progress-bar-fill {
  height: 100%;
  background: var(--accent-cyan);
}

.card-body {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.card-title {
  font-size: 0.94rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-meta {
  font-size: 0.76rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ==========================================================================
   IPTV LIVE CHANNELS GRID
   ========================================================================== */
.iptv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 18px;
}

.iptv-card {
  padding: 18px;
  border-radius: var(--radius-md);
  background: var(--bg-glass-card);
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.iptv-card.tv-focused {
  transform: scale(1.04) translateY(-4px);
  background: rgba(28, 32, 44, 0.92);
}

.iptv-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.iptv-logo {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.9rem;
  letter-spacing: 0.04em;
  color: #06080c;
  flex-shrink: 0;
}

.iptv-channel-info {
  flex: 1;
  overflow: hidden;
}

.iptv-channel-name {
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.live-dot {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 99px;
  background: rgba(255, 77, 109, 0.16);
  color: var(--accent-live);
  border: 1px solid rgba(255, 77, 109, 0.35);
}

.iptv-epg-now {
  font-size: 0.85rem;
  color: var(--text-primary);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.iptv-epg-next {
  font-size: 0.76rem;
  color: var(--text-secondary);
}

.iptv-progress {
  height: 5px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.iptv-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-emerald));
}

/* ==========================================================================
   SEARCH TAB LAYOUT
   ========================================================================== */
.search-layout {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 28px;
  align-items: start;
}

.search-box-panel {
  background: var(--bg-glass-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.search-query-display {
  height: 50px;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  background: rgba(8, 9, 13, 0.85);
  border: 1px solid var(--border-glass);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 14px;
}

.search-kb-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  margin-bottom: 10px;
}

/* ==========================================================================
   MODAL DIALOG (DETAILS & TV PLAYER)
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(6, 7, 10, 0.84);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 36px;
}

.modal-card {
  width: 100%;
  max-width: 960px;
  border-radius: var(--radius-xl);
  background: var(--bg-glass-heavy);
  border: 1px solid var(--border-glass);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.85);
  overflow: hidden;
  display: grid;
  grid-template-columns: 280px 1fr;
}

.modal-poster {
  width: 100%;
  height: 100%;
  min-height: 380px;
  object-fit: cover;
}

.modal-body {
  padding: 32px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

/* ==========================================================================
   ON-SCREEN SAMSUNG SMART REMOTE SIMULATOR (For Browser Testing)
   ========================================================================== */
.remote-widget {
  position: fixed;
  bottom: 18px;
  right: 22px;
  z-index: 80;
  background: rgba(14, 15, 20, 0.92);
  backdrop-filter: blur(18px);
  border: 1px solid var(--border-glass);
  border-radius: 22px;
  padding: 14px 16px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.75);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 186px;
  transition: transform var(--transition-smooth), opacity var(--transition-smooth);
}

.remote-widget.minimized {
  width: auto;
  padding: 8px 14px;
}

.remote-widget.minimized .remote-body {
  display: none;
}

.remote-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-cyan);
  cursor: pointer;
}

.remote-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.dpad-grid {
  display: grid;
  grid-template-columns: repeat(3, 42px);
  grid-template-rows: repeat(3, 42px);
  gap: 5px;
  justify-content: center;
}

.r-btn {
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 120ms, transform 120ms;
}

.r-btn:hover {
  background: rgba(0, 229, 255, 0.22);
  border-color: var(--accent-cyan);
}

.r-btn:active {
  transform: scale(0.92);
}

.r-btn.ok-btn {
  background: var(--accent-cyan-soft);
  color: var(--accent-cyan);
  border-color: rgba(0, 229, 255, 0.45);
  border-radius: 50%;
}

.remote-bottom-row {
  display: flex;
  gap: 6px;
  width: 100%;
}

.remote-bottom-row .r-btn {
  flex: 1;
  height: 32px;
  font-size: 0.72rem;
}

/* Toast Notification */
.tv-toast {
  position: fixed;
  top: 88px;
  right: 36px;
  z-index: 90;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  background: rgba(12, 14, 20, 0.94);
  border: 1px solid var(--accent-cyan);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.65), 0 0 20px var(--accent-cyan-glow);
  color: var(--text-primary);
  font-size: 0.88rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  transform: translateY(-20px);
  opacity: 0;
  pointer-events: none;
  transition: transform 240ms ease, opacity 240ms ease;
}

.tv-toast.visible {
  transform: translateY(0);
  opacity: 1;
}

/* Sub-Profile & Parental Control Modal inside Main Menu */
.profile-modal-card {
  width: 100%;
  max-width: 920px;
  border-radius: var(--radius-xl);
  background: var(--bg-glass-heavy);
  border: 1px solid var(--border-glass);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.88);
  padding: 32px 36px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.subprofiles-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.subprofile-card {
  padding: 16px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
}

.subprofile-card.active {
  background: rgba(0, 229, 255, 0.14);
  border-color: rgba(0, 229, 255, 0.55);
}

.subprofile-card.tv-focused {
  transform: scale(1.04) translateY(-2px);
  background: rgba(0, 229, 255, 0.2);
}

.parental-box {
  padding: 20px 22px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--border-subtle);
}

.genre-chips-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.genre-chip {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  background: rgba(0, 245, 160, 0.12);
  border: 1px solid rgba(0, 245, 160, 0.38);
  color: var(--accent-emerald);
  font-size: 0.82rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 7px;
}

.genre-chip.blocked {
  background: rgba(255, 77, 109, 0.14);
  border-color: rgba(255, 77, 109, 0.45);
  color: #ff8fa3;
}

.genre-chip.tv-focused {
  transform: scale(1.06);
}

/* Auth Mode Switcher ("Вход" / "Регистрация") in Left Card */
.auth-mode-block {
  margin-top: 8px;
  padding-top: 20px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-mode-label {
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.auth-mode-switcher {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 6px;
  border-radius: var(--radius-md);
  background: rgba(8, 9, 13, 0.72);
  border: 1px solid var(--border-glass);
}

.auth-mode-btn {
  height: 52px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  font-size: 0.98rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
}

.auth-mode-btn.active {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-emerald));
  color: #05080c;
  font-weight: 800;
  box-shadow: 0 6px 20px rgba(0, 229, 255, 0.25);
}

.auth-mode-btn.tv-focused {
  transform: scale(1.04);
}

.auth-mode-hint {
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-align: center;
}

/* Responsive adjustments for smaller screens / 720p TVs */
@media (max-width: 1180px) {
  .auth-container {
    grid-template-columns: 1fr;
  }
  .search-layout {
    grid-template-columns: 1fr;
  }
  .subprofiles-grid {
    grid-template-columns: 1fr;
  }
  :root {
    --sidebar-width: 210px;
  }
}
