/* ═══════════════════════════════ glass ═══════════════════════════════ */
.glass { background: var(--surface); border: 1px solid var(--line);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(140%); backdrop-filter: blur(var(--blur)) saturate(140%); }
.glass-strong { background: var(--surface-2); border: 1px solid var(--line-2);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(160%); backdrop-filter: blur(var(--blur)) saturate(160%); }

.card { border-radius: var(--r-lg); padding: 22px; position: relative; }
.card.pad-lg { padding: 28px; }
.card.pad-sm { padding: 16px; }
.card.hover { transition: transform var(--med) var(--ease), border-color var(--med), background var(--med); }
.card.hover:hover { transform: translateY(-3px); border-color: var(--line-2); background: var(--surface-2); }

/* ═══════════════════════════════ buttons ═══════════════════════════════ */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 9px; height: 44px; padding: 0 20px;
  border-radius: var(--pill); font-weight: 600; font-size: 14.5px; letter-spacing: -0.005em; white-space: nowrap;
  border: 1px solid transparent; transition: transform var(--fast) var(--ease), background var(--fast), border-color var(--fast), opacity var(--fast); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn-primary { background: #fff; color: var(--text-inverse); }               /* ref: "Play Now" white pill */
.btn-primary:hover { background: #e9ecf3; }
.btn-accent { background: var(--accent); color: #fff; box-shadow: 0 10px 30px -12px var(--accent-glow); }
.btn-accent:hover { background: var(--accent-strong); }
.btn-ghost { background: var(--surface); border-color: var(--line); color: var(--text); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--line-2); }
.btn-danger { background: rgba(255,93,115,.14); color: var(--danger); border-color: rgba(255,93,115,.3); }
.btn-sm { height: 36px; padding: 0 14px; font-size: 13px; }
.btn-sm svg { width: 15px; height: 15px; }
.btn-lg { height: 52px; padding: 0 26px; font-size: 15.5px; }
.btn-icon { width: 44px; height: 44px; padding: 0; border-radius: 50%; }
.btn-icon.btn-sm { width: 36px; height: 36px; }
.btn-block { width: 100%; }

.play-fab { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: #fff; color: var(--text-inverse);
  box-shadow: 0 12px 30px -10px rgba(0,0,0,.7); transition: transform var(--fast) var(--ease); }
.play-fab:hover { transform: scale(1.06); }
.play-fab svg { width: 22px; height: 22px; margin-left: 3px; }

/* ═══════════════════════════════ chips & badges ═══════════════════════════════ */
.chips { display: flex; gap: 10px; overflow-x: auto; scrollbar-width: none; padding: 2px; margin: -2px; }
.chips::-webkit-scrollbar { display: none; }
.chip { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: var(--pill);
  background: var(--surface); border: 1px solid var(--line); color: var(--text-2); font-weight: 500; font-size: 13.5px; white-space: nowrap;
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  transition: background var(--fast), color var(--fast), border-color var(--fast), transform var(--fast) var(--ease); }
.chip svg { width: 16px; height: 16px; opacity: .8; }
.chip:hover { background: var(--surface-2); color: var(--text); }
.chip.active { background: rgba(255,255,255,.92); color: var(--text-inverse); border-color: transparent; }
.chip.active svg { opacity: 1; }
.chip.sm { height: 32px; padding: 0 12px; font-size: 12.5px; }

.badge { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; height: 24px; padding: 0 10px; border-radius: var(--pill);
  font-size: 11.5px; font-weight: 600; letter-spacing: .02em; text-transform: uppercase; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--line); }
.badge svg { width: 12px; height: 12px; }
.badge-accent { background: var(--accent-soft); color: #c7bfff; border-color: rgba(123,108,246,.35); }
.badge-coral { background: var(--accent-2-soft); color: #ffb39f; border-color: rgba(255,123,92,.35); }
.badge-lime { background: var(--accent-3-soft); color: #d6ffa3; border-color: rgba(182,243,106,.35); }
.badge-gold { background: rgba(255,207,112,.16); color: var(--gold); border-color: rgba(255,207,112,.35); }
.badge-success { background: rgba(95,217,154,.14); color: var(--success); border-color: rgba(95,217,154,.3); }
.badge-warn { background: rgba(255,191,71,.14); color: var(--warn); border-color: rgba(255,191,71,.3); }
.badge-danger { background: rgba(255,93,115,.14); color: var(--danger); border-color: rgba(255,93,115,.3); }
.badge-live { background: var(--live); color: #fff; border-color: transparent; }
.badge-live::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: #fff; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; display: inline-block; }

/* ═══════════════════════════════ segmented (ref: Movie | Series | Originals) ═══════════════════════════════ */
.segmented { display: inline-flex; align-items: center; padding: 4px; border-radius: var(--pill); background: rgba(0,0,0,.35); border: 1px solid var(--line); gap: 2px; }
.segmented a, .segmented button { position: relative; height: 38px; padding: 0 18px; border-radius: var(--pill); font-weight: 600; font-size: 14px; color: var(--text-2);
  display: inline-flex; align-items: center; gap: 8px; transition: color var(--fast), background var(--fast); }
.segmented a svg, .segmented button svg { width: 16px; height: 16px; }
.segmented a:hover { color: var(--text); }
.segmented a.active { background: #fff; color: var(--text-inverse); box-shadow: 0 6px 18px -8px rgba(0,0,0,.6); }

/* ═══════════════════════════════ forms ═══════════════════════════════ */
.field { display: grid; gap: 7px; }
.field > label, .label { font-size: 12.5px; font-weight: 600; letter-spacing: .02em; color: var(--text-2); text-transform: uppercase; }
.input, .select, .textarea { width: 100%; height: 46px; padding: 0 16px; border-radius: 14px; background: rgba(0,0,0,.28); border: 1px solid var(--line);
  color: var(--text); transition: border-color var(--fast), box-shadow var(--fast), background var(--fast); }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); background: rgba(0,0,0,.4); }
.textarea { height: auto; min-height: 120px; padding: 14px 16px; resize: vertical; line-height: 1.5; }
.select { appearance: none; -webkit-appearance: none; padding-right: 40px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23aab1c2' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='m6 9 6 6 6-6'/></svg>");
  background-repeat: no-repeat; background-position: right 14px center; }
.select option { background: var(--surface-solid); }
.hint { font-size: 12.5px; color: var(--text-3); }
.form-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.form-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }

.search { position: relative; }
.search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--text-3); pointer-events: none; }
.search .input { padding-left: 44px; height: 44px; border-radius: var(--pill); background: var(--surface); }
.search .input:focus { background: rgba(0,0,0,.35); }

.switch { position: relative; width: 44px; height: 26px; border-radius: 99px; background: var(--surface-3); border: 1px solid var(--line-2); transition: background var(--fast); flex: none; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform var(--fast) var(--ease); }
.switch[aria-checked="true"] { background: var(--accent); }
.switch[aria-checked="true"]::after { transform: translateX(18px); }

/* ═══════════════════════════════ tables ═══════════════════════════════ */
.table-wrap { overflow-x: auto; border-radius: var(--r-md); border: 1px solid var(--line); background: rgba(0,0,0,.2); }
.table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 620px; }
.table th { text-align: left; font-size: 11.5px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--text-3); padding: 14px 16px; border-bottom: 1px solid var(--line); }
.table td { padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: rgba(255,255,255,.025); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* ═══════════════════════════════ stats (ref: Achievements / Hours played) ═══════════════════════════════ */
.stats { display: flex; gap: 14px; flex-wrap: wrap; }
.stat { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); min-width: 150px; }
.stat-ic { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); flex: none; }
.stat-ic svg { width: 17px; height: 17px; }
.stat-v { font-family: var(--font-display); font-weight: 600; font-size: 17px; line-height: 1.1; }
.stat-l { font-size: 12px; color: var(--text-3); margin-top: 2px; }

/* ═══════════════════════════════ media cards ═══════════════════════════════ */
.poster { position: relative; display: block; border-radius: var(--r-md); overflow: hidden; background: var(--bg-3); aspect-ratio: 16/9; isolation: isolate;
  border: 1px solid var(--line); transition: transform var(--med) var(--ease), border-color var(--med), box-shadow var(--med); }
.poster.tall { aspect-ratio: 9/16; }
.poster img { width: 100%; height: 100%; object-fit: cover; transition: transform 600ms var(--ease); }
.poster::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,0) 40%, rgba(0,0,0,.85) 100%); }
.poster:hover { transform: translateY(-4px) scale(1.01); border-color: var(--line-2); box-shadow: var(--shadow-md); }
.poster:hover img { transform: scale(1.06); }
.poster-body { position: absolute; left: 14px; right: 14px; bottom: 12px; z-index: 1; display: grid; gap: 4px; }
.poster-title { font-family: var(--font-display); font-weight: 600; font-size: 15px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.poster-meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-2); }
.poster-meta .sep { width: 3px; height: 3px; border-radius: 50%; background: var(--text-3); }
.poster-play { position: absolute; right: 12px; bottom: 12px; z-index: 2; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.22); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); opacity: 0; transform: translateY(6px); transition: all var(--med) var(--ease); }
.poster-play svg { width: 16px; height: 16px; margin-left: 2px; }
.poster:hover .poster-play { opacity: 1; transform: none; }
.poster .badge { position: absolute; top: 12px; left: 12px; z-index: 2; }
.poster .duration { position: absolute; top: 12px; right: 12px; z-index: 2; font-size: 11.5px; font-weight: 600; padding: 3px 8px; border-radius: 8px; background: rgba(0,0,0,.6); }

/* horizontal row (Netflix-style) */
.rail { display: grid; min-width: 0; grid-auto-flow: column; grid-auto-columns: clamp(220px, 23vw, 320px); gap: 16px; overflow-x: auto; scroll-snap-type: x mandatory;
  padding: 6px var(--gutter) 14px; margin: 0 calc(var(--gutter) * -1); scrollbar-width: none; }
.rail::-webkit-scrollbar { display: none; }
.rail > * { scroll-snap-align: start; }
.rail.reels { grid-auto-columns: clamp(150px, 15vw, 200px); }

.grid-cards { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.grid-cards.reels { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }

/* hero (ref: big rounded feature card) */
.hero { position: relative; border-radius: var(--r-xl); overflow: hidden; min-height: clamp(360px, 48vw, 520px); display: flex; align-items: flex-end;
  border: 1px solid var(--line); background: var(--bg-3); isolation: isolate; box-shadow: var(--shadow-lg); }
.hero img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -1; transform: scale(1.02); }
.hero::before { content: ''; position: absolute; inset: 0; z-index: 0;
  background: linear-gradient(180deg, rgba(7,9,14,.05) 0%, rgba(7,9,14,.35) 45%, rgba(7,9,14,.92) 100%),
              linear-gradient(90deg, rgba(7,9,14,.55) 0%, rgba(7,9,14,0) 60%); }
.hero-body { position: relative; z-index: 1; padding: clamp(22px, 4vw, 44px); display: grid; gap: 14px; max-width: 640px; width: 100%; }
.hero-title { font-size: clamp(28px, 4vw, 46px); font-weight: 700; letter-spacing: -0.025em; line-height: 1.05; }
.hero-desc { color: var(--text-2); font-size: 15px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 560px; }
.hero-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 6px; }
.hero-fab { position: absolute; right: clamp(20px, 3vw, 36px); bottom: clamp(20px, 3vw, 36px); z-index: 2; }

/* ═══════════════════════════════ misc ═══════════════════════════════ */
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--line-2); overflow: hidden; display: grid; place-items: center; font-weight: 600; font-size: 14px; color: var(--text); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.lg { width: 56px; height: 56px; font-size: 20px; }

.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.section-head h2 { font-size: clamp(19px, 2vw, 23px); }
.section-head a { color: var(--text-2); font-size: 13.5px; font-weight: 500; display: inline-flex; align-items: center; gap: 4px; }
.section-head a:hover { color: var(--text); }
.section-head a svg { width: 14px; height: 14px; }

.empty { display: grid; gap: 12px; justify-items: center; text-align: center; padding: 48px 24px; border-radius: var(--r-lg); border: 1px dashed var(--line-2); color: var(--text-2); }
.empty svg { width: 34px; height: 34px; color: var(--text-3); }
.empty h3 { color: var(--text); }
.empty p { max-width: 420px; font-size: 14px; }

.skeleton { position: relative; overflow: hidden; background: var(--surface); border-radius: var(--r-md); }
.skeleton::after { content: ''; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255,255,255,.06), transparent); animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }

.toasts { position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 1000; display: grid; gap: 10px; max-width: min(380px, calc(100vw - 32px)); }
.toast { padding: 13px 16px; border-radius: 16px; background: rgba(20,24,34,.92); border: 1px solid var(--line-2); box-shadow: var(--shadow-md);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); display: flex; gap: 12px; align-items: flex-start; font-size: 14px; animation: toast-in var(--med) var(--ease); }
.toast svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.toast.success svg { color: var(--success); } .toast.error svg { color: var(--danger); } .toast.info svg { color: var(--sky); }
.toast.out { animation: toast-out var(--med) var(--ease) forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px) scale(.98); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(6px) scale(.98); } }

.menu { position: absolute; right: 0; top: calc(100% + 10px); min-width: 230px; padding: 8px; border-radius: 18px; background: rgba(18,22,32,.96); border: 1px solid var(--line-2); box-shadow: var(--shadow-md); z-index: 60; display: grid; gap: 2px; }
.menu-head { padding: 10px 12px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; display: grid; gap: 2px; }
.menu-head b { font-weight: 600; font-size: 14px; }
.menu-head span { font-size: 12.5px; color: var(--text-3); }
.menu-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; font-size: 14px; color: var(--text-2); width: 100%; text-align: left; }
.menu-item svg { width: 16px; height: 16px; }
.menu-item:hover { background: var(--surface-2); color: var(--text); }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 14px; }
.kv dt { color: var(--text-3); } .kv dd { margin: 0; }

.notice { display: flex; gap: 12px; padding: 14px 16px; border-radius: 16px; font-size: 14px; border: 1px solid; align-items: flex-start; }
.notice svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.notice.warn { background: rgba(255,191,71,.08); border-color: rgba(255,191,71,.3); color: #ffe1a3; }
.notice.info { background: rgba(111,211,255,.08); border-color: rgba(111,211,255,.3); color: #cbeeff; }
.notice.danger { background: rgba(255,93,115,.08); border-color: rgba(255,93,115,.3); color: #ffc3cc; }

.player { position: relative; aspect-ratio: 16/9; border-radius: var(--r-lg); overflow: hidden; background: #000; border: 1px solid var(--line); box-shadow: var(--shadow-lg); }
.player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.progress { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; display: flex; }
.progress > span { display: block; height: 100%; transition: width var(--med) var(--ease); }
.progress .p-sent { background: var(--success); } .progress .p-failed { background: var(--danger); } .progress .p-proc { background: var(--accent); }

/* tall (reel) posters: tighter meta so it doesn't wrap awkwardly */
.poster.tall .poster-title { font-size: 13.5px; }
.poster.tall .poster-meta { font-size: 11px; gap: 6px; }
.poster.tall .poster-meta .sep { display: none; }

/* file pickers share the text-input look */
input.input[type="file"] { padding: 9px 12px; cursor: pointer; }
input.input[type="file"]::file-selector-button { margin-right: 12px; padding: 6px 12px; border-radius: 8px; border: 1px solid var(--line, rgba(255,255,255,.14)); background: rgba(255,255,255,.06); color: inherit; font: inherit; cursor: pointer; }
