:root {
  color-scheme: dark;
  --bg: #07070a;
  --bg-elevated: #0d0d12;
  --surface: rgba(23, 23, 30, 0.66);
  --surface-strong: rgba(30, 30, 38, 0.84);
  --surface-soft: rgba(255, 255, 255, 0.055);
  --surface-hover: rgba(255, 255, 255, 0.09);
  --line: rgba(255, 255, 255, 0.12);
  --line-strong: rgba(255, 255, 255, 0.22);
  --text: #f8f8fb;
  --text-soft: #d9d9e0;
  --muted: #9696a3;
  --faint: #6f6f7c;
  --primary: #ffffff;
  --primary-text: #0a0a0d;
  --danger: #ffb8b8;
  --danger-bg: rgba(255, 90, 90, 0.11);
  --success: #c4ffd6;
  --success-bg: rgba(70, 230, 130, 0.12);
  --shadow: 0 28px 90px rgba(0, 0, 0, 0.42);
  --shadow-soft: 0 16px 50px rgba(0, 0, 0, 0.25);
  --blur: 28px;
  --radius-xl: 34px;
  --radius-lg: 26px;
  --radius-md: 20px;
  --radius-sm: 14px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #f2f3f7;
  --bg-elevated: #ffffff;
  --surface: rgba(255, 255, 255, 0.64);
  --surface-strong: rgba(255, 255, 255, 0.86);
  --surface-soft: rgba(255, 255, 255, 0.56);
  --surface-hover: rgba(255, 255, 255, 0.88);
  --line: rgba(20, 22, 32, 0.1);
  --line-strong: rgba(20, 22, 32, 0.18);
  --text: #111218;
  --text-soft: #353642;
  --muted: #6e707c;
  --faint: #989aa4;
  --primary: #111218;
  --primary-text: #ffffff;
  --danger: #9f3434;
  --danger-bg: rgba(200, 55, 55, 0.09);
  --success: #176b38;
  --success-bg: rgba(30, 165, 80, 0.1);
  --shadow: 0 28px 90px rgba(55, 57, 74, 0.15);
  --shadow-soft: 0 16px 50px rgba(55, 57, 74, 0.11);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  min-height: 100svh;
  margin: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  transition: background 360ms var(--ease), color 360ms var(--ease);
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button,
input,
textarea,
select {
  -webkit-tap-highlight-color: transparent;
}

:where(button, input, textarea, select, [tabindex]):focus-visible {
  outline: 3px solid color-mix(in srgb, var(--text) 72%, transparent);
  outline-offset: 3px;
}

button:disabled {
  cursor: default;
  opacity: 0.46;
}

.hidden {
  display: none !important;
}

.liquid-background {
  position: fixed;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  pointer-events: none;
}

.liquid-background::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, transparent, color-mix(in srgb, var(--bg) 76%, transparent)),
    radial-gradient(circle at 50% 115%, color-mix(in srgb, var(--bg) 76%, transparent), var(--bg) 67%);
  backdrop-filter: blur(3px);
}

.liquid-orb {
  position: absolute;
  border-radius: 999px;
  filter: blur(12px);
  opacity: 0.48;
  mix-blend-mode: screen;
  animation: float-orb 17s var(--ease) infinite alternate;
}

html[data-theme="light"] .liquid-orb {
  opacity: 0.24;
  mix-blend-mode: multiply;
}

.liquid-orb-a {
  width: 32rem;
  height: 32rem;
  left: -12rem;
  top: -13rem;
  background: radial-gradient(circle at 35% 35%, rgba(170, 145, 255, 0.92), rgba(77, 62, 210, 0.05) 70%);
}

.liquid-orb-b {
  width: 28rem;
  height: 28rem;
  right: -12rem;
  top: 18%;
  background: radial-gradient(circle at 40% 40%, rgba(72, 179, 255, 0.8), rgba(0, 120, 255, 0.03) 72%);
  animation-delay: -6s;
}

.liquid-orb-c {
  width: 24rem;
  height: 24rem;
  left: 26%;
  bottom: -14rem;
  background: radial-gradient(circle at 45% 40%, rgba(255, 120, 195, 0.57), rgba(255, 100, 170, 0.02) 70%);
  animation-delay: -10s;
}

@keyframes float-orb {
  from {
    transform: translate3d(-2%, -2%, 0) scale(0.94) rotate(-8deg);
  }
  to {
    transform: translate3d(7%, 6%, 0) scale(1.08) rotate(8deg);
  }
}

.shell {
  width: 100%;
  max-width: 1120px;
  min-height: 100svh;
  margin: 0 auto;
  padding: max(14px, env(safe-area-inset-top)) 18px calc(110px + env(safe-area-inset-bottom));
}

.center-view {
  min-width: 0;
  min-height: calc(100svh - 54px);
  display: grid;
  place-items: center;
  animation: view-enter 520ms var(--ease) both;
}

.app-view {
  animation: view-enter 520ms var(--ease) both;
}

@keyframes view-enter {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.992);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.glass-panel {
  border: 1px solid var(--line);
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--surface-strong) 72%, transparent), color-mix(in srgb, var(--surface) 88%, transparent));
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(var(--blur)) saturate(1.28);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.28);
}

.liquid-panel {
  position: relative;
  overflow: hidden;
}

.liquid-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    radial-gradient(circle at 18% 0%, rgba(255, 255, 255, 0.22), transparent 30%),
    linear-gradient(120deg, transparent 10%, rgba(255, 255, 255, 0.08) 45%, transparent 70%);
  opacity: 0.7;
  pointer-events: none;
}

.liquid-panel::after {
  content: "";
  position: absolute;
  width: 12rem;
  height: 12rem;
  top: -8rem;
  right: -5rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  filter: blur(18px);
  pointer-events: none;
}

.loading-logo,
.brand-mark,
.install-icon,
.wordmark-logo {
  position: relative;
  display: inline-grid;
  place-items: center;
}

.loading-logo {
  width: 84px;
  height: 84px;
  margin-bottom: 18px;
  animation: loading-breathe 1.6s var(--ease) infinite alternate;
}

.loading-logo span,
.brand-mark span,
.install-icon span,
.wordmark-logo i {
  position: absolute;
  display: block;
  border-radius: 12px;
  background: var(--primary);
  box-shadow: 0 10px 30px color-mix(in srgb, var(--primary) 14%, transparent);
}

.loading-logo span:nth-child(1),
.brand-mark span:nth-child(1),
.install-icon span:nth-child(1) {
  width: 44px;
  height: 18px;
  transform: translateY(-19px) translateX(-8px);
}

.loading-logo span:nth-child(2),
.brand-mark span:nth-child(2),
.install-icon span:nth-child(2) {
  width: 50px;
  height: 18px;
  transform: translateY(0) translateX(7px);
}

.loading-logo span:nth-child(3),
.brand-mark span:nth-child(3),
.install-icon span:nth-child(3) {
  width: 44px;
  height: 18px;
  transform: translateY(19px) translateX(-8px);
}

@keyframes loading-breathe {
  from { transform: scale(0.94); opacity: 0.72; }
  to { transform: scale(1.05); opacity: 1; }
}

.subtle,
.legal-note,
.install-footnote {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
  text-align: center;
}

.auth-card,
.install-card {
  width: 100%;
  max-width: 480px;
  min-width: 0;
  border-radius: var(--radius-xl);
  padding: 26px;
}

.brand-mark {
  width: 86px;
  height: 86px;
  margin: 0 auto 26px;
  border-radius: 27px;
  background: color-mix(in srgb, var(--surface-strong) 84%, transparent);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
}

.auth-title,
.install-title {
  margin: 4px 0 10px;
  font-size: clamp(46px, 13vw, 72px);
  line-height: 0.96;
  letter-spacing: -0.075em;
  text-align: center;
}

.auth-copy,
.install-copy {
  max-width: 390px;
  margin: 0 auto 24px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.55;
  text-align: center;
}

.overline {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.auth-card > .overline,
.install-card > .overline {
  text-align: center;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: color-mix(in srgb, var(--surface-soft) 82%, transparent);
}

.segment {
  min-height: 42px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  transition: transform 180ms var(--ease), background 240ms var(--ease), color 240ms var(--ease), box-shadow 240ms var(--ease);
}

.segment.active {
  background: var(--primary);
  color: var(--primary-text);
  box-shadow: 0 8px 24px color-mix(in srgb, var(--primary) 16%, transparent);
}

.segment:active {
  transform: scale(0.97);
}

#authForm {
  margin-top: 20px;
}

.field-label {
  display: block;
  margin: 14px 4px 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.input-shell {
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: color-mix(in srgb, var(--surface-soft) 72%, transparent);
  transition: border-color 220ms var(--ease), background 220ms var(--ease), transform 220ms var(--ease);
}

.input-shell:focus-within {
  border-color: var(--line-strong);
  background: var(--surface-hover);
  transform: translateY(-1px);
}

.input-shell input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  padding: 15px;
  background: transparent;
  color: var(--text);
}

.input-shell input::placeholder,
.search-bar input::placeholder,
textarea::placeholder {
  color: var(--faint);
}

.input-action {
  margin-right: 6px;
  border: 0;
  border-radius: 11px;
  padding: 9px 10px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.button {
  min-height: 46px;
  border-radius: 16px;
  padding: 12px 16px;
  font-weight: 780;
  transition: transform 180ms var(--ease), box-shadow 240ms var(--ease), opacity 180ms var(--ease), background 240ms var(--ease);
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button:active:not(:disabled) {
  transform: scale(0.975);
}

.button-primary {
  border: 0;
  background: var(--primary);
  color: var(--primary-text);
  box-shadow: 0 12px 30px color-mix(in srgb, var(--primary) 16%, transparent);
}

.button-secondary {
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--text);
}

.button-danger {
  border: 1px solid color-mix(in srgb, var(--danger) 24%, transparent);
  background: var(--danger-bg);
  color: var(--danger);
}

.button-wide {
  width: 100%;
  margin-top: 16px;
}

.compact-button {
  min-height: 42px;
  white-space: nowrap;
}

.text-button {
  border: 0;
  padding: 7px;
  background: transparent;
  color: var(--muted);
  font-weight: 720;
}

.text-button:hover {
  color: var(--text);
}

.form-message {
  min-height: 22px;
  margin: 14px 4px 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.form-message.error {
  color: var(--danger);
}

.form-message.success {
  color: var(--success);
}

.legal-note {
  margin: 16px 8px 0;
}

.install-card {
  text-align: center;
}

.theme-fab,
.icon-button,
.avatar-button,
.sheet-close {
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--text);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.theme-fab {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border-radius: 14px;
}

.install-visual {
  position: relative;
  width: 178px;
  height: 178px;
  margin: 6px auto 22px;
  display: grid;
  place-items: center;
}

.install-icon {
  z-index: 2;
  width: 96px;
  height: 96px;
  border-radius: 30px;
  background: var(--primary);
  box-shadow: 0 22px 65px color-mix(in srgb, var(--primary) 20%, transparent);
  animation: install-float 3.8s var(--ease) infinite alternate;
}

.install-icon span {
  background: var(--primary-text);
  box-shadow: none;
}

.install-ring {
  position: absolute;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  animation: install-ring 3.2s ease-out infinite;
}

.install-ring-one {
  width: 132px;
  height: 132px;
}

.install-ring-two {
  width: 168px;
  height: 168px;
  animation-delay: 1.2s;
}

@keyframes install-float {
  from { transform: translateY(4px) rotate(-1deg); }
  to { transform: translateY(-7px) rotate(1deg); }
}

@keyframes install-ring {
  0% { opacity: 0.7; transform: scale(0.76); }
  75%, 100% { opacity: 0; transform: scale(1.1); }
}

.install-button {
  min-height: 54px;
  font-size: 16px;
}

.install-steps {
  display: grid;
  gap: 10px;
  margin-top: 16px;
  text-align: left;
}

.install-step {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 12px;
  align-items: start;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--surface-soft);
}

.install-step-number {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: var(--primary);
  color: var(--primary-text);
  font-size: 12px;
  font-weight: 850;
}

.install-step strong {
  display: block;
  margin: 2px 0 4px;
}

.install-step p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.install-footnote {
  margin: 15px 6px 0;
}

.app-header {
  position: sticky;
  top: max(0px, env(safe-area-inset-top));
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: -2px -6px 24px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: color-mix(in srgb, var(--surface-strong) 82%, transparent);
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.16);
  backdrop-filter: blur(26px) saturate(1.2);
  -webkit-backdrop-filter: blur(26px) saturate(1.2);
}

.wordmark {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 27px;
  font-weight: 860;
  letter-spacing: -0.055em;
}

.wordmark-logo {
  width: 31px;
  height: 31px;
}

.wordmark-logo i {
  height: 6px;
  border-radius: 5px;
}

.wordmark-logo i:nth-child(1) {
  width: 20px;
  transform: translate(-3px, -8px);
}

.wordmark-logo i:nth-child(2) {
  width: 23px;
  transform: translate(4px, 0);
}

.wordmark-logo i:nth-child(3) {
  width: 20px;
  transform: translate(-3px, 8px);
}

.header-actions {
  display: flex;
  gap: 8px;
}

.icon-button,
.avatar-button {
  width: 42px;
  height: 42px;
  border-radius: 15px;
  font-weight: 800;
  transition: transform 180ms var(--ease), background 220ms var(--ease);
}

.icon-button:active,
.avatar-button:active {
  transform: scale(0.94);
}

.avatar-button {
  background: var(--primary);
  color: var(--primary-text);
}

.app-screen {
  display: none;
}

.app-screen.active {
  display: block;
  animation: screen-enter 420ms var(--ease) both;
}

@keyframes screen-enter {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

.screen-heading,
.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
}

.screen-heading {
  margin: 8px 0 24px;
}

.compact-heading {
  margin-bottom: 16px;
}

.screen-heading h1 {
  margin: 5px 0 7px;
  font-size: clamp(46px, 9vw, 78px);
  line-height: 0.95;
  letter-spacing: -0.075em;
}

.screen-description {
  max-width: 570px;
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
}

.section-heading {
  margin: 30px 2px 13px;
}

.section-heading h2 {
  margin: 5px 0 0;
  font-size: 27px;
  letter-spacing: -0.05em;
}

.up-next-card {
  position: relative;
  min-height: 590px;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  border-radius: 38px;
  border: 1px solid var(--line);
  background: var(--bg-elevated);
  box-shadow: var(--shadow);
  isolation: isolate;
}

.up-next-card::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(180deg, transparent 20%, rgba(0, 0, 0, 0.1) 43%, rgba(4, 4, 8, 0.92) 100%),
    linear-gradient(90deg, rgba(4, 4, 8, 0.24), transparent 64%);
}

.up-next-backdrop {
  position: absolute;
  inset: -20px;
  z-index: 0;
  background-position: center;
  background-size: cover;
  filter: saturate(1.08);
  transform: scale(1.04);
  animation: hero-drift 16s ease-in-out infinite alternate;
}

@keyframes hero-drift {
  from { transform: scale(1.04) translate3d(-0.7%, 0, 0); }
  to { transform: scale(1.09) translate3d(0.7%, -0.6%, 0); }
}

.up-next-content {
  position: relative;
  z-index: 2;
  width: 100%;
  display: grid;
  grid-template-columns: 142px minmax(0, 1fr);
  gap: 23px;
  align-items: end;
  padding: 28px;
  color: #fff;
}

.up-next-poster {
  width: 142px;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: 20px;
  background: #1a1a20;
  box-shadow: 0 24px 65px rgba(0, 0, 0, 0.48);
  transition: transform 420ms var(--ease);
}

.up-next-card:hover .up-next-poster {
  transform: translateY(-5px) rotate(-0.8deg);
}

.up-next-title {
  max-width: 720px;
  margin: 7px 0 9px;
  font-size: clamp(36px, 7vw, 66px);
  line-height: 0.94;
  letter-spacing: -0.065em;
}

.up-next-meta,
.up-next-overview {
  color: rgba(255, 255, 255, 0.72);
}

.up-next-meta {
  margin: 0;
  font-size: 13px;
}

.up-next-overview {
  max-width: 620px;
  margin: 12px 0 0;
  display: -webkit-box;
  overflow: hidden;
  font-size: 14px;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.up-next-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 18px;
}

.up-next-actions .button-secondary {
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.13);
  color: #fff;
}

.empty-state {
  min-height: 430px;
  display: grid;
  place-items: center;
  padding: 32px;
  border-radius: 36px;
  text-align: center;
}

.empty-state-icon {
  width: 90px;
  height: 90px;
  margin: 0 auto 22px;
  display: grid;
  place-items: center;
  border-radius: 28px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  font-size: 38px;
}

.empty-state h2 {
  margin: 0 0 9px;
  font-size: 36px;
  letter-spacing: -0.055em;
}

.empty-state p {
  max-width: 420px;
  margin: 0 auto 18px;
  color: var(--muted);
  line-height: 1.55;
}

.stats-strip,
.profile-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.stat-card {
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface-soft);
  transition: transform 220ms var(--ease), background 220ms var(--ease);
}

.stat-card:hover {
  transform: translateY(-2px);
  background: var(--surface-hover);
}

.stat-value {
  display: block;
  margin-bottom: 4px;
  font-size: 26px;
  font-weight: 850;
  letter-spacing: -0.045em;
}

.stat-label {
  color: var(--muted);
  font-size: 11px;
}

.history-row {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(138px, 168px);
  gap: 11px;
  overflow-x: auto;
  padding: 2px 2px 10px;
  scrollbar-width: none;
}

.history-row::-webkit-scrollbar {
  display: none;
}

.history-card,
.poster-card {
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  transition: transform 250ms var(--ease), border-color 250ms var(--ease), background 250ms var(--ease);
}

.history-card {
  overflow: hidden;
  border-radius: 19px;
}

.history-card:hover,
.poster-card:hover {
  transform: translateY(-4px);
  border-color: var(--line-strong);
  background: var(--surface-hover);
}

.history-card img,
.history-poster-placeholder {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  background: var(--bg-elevated);
}

.history-card-body {
  padding: 11px;
}

.history-card strong {
  display: block;
  overflow: hidden;
  font-size: 13px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-card span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
}

.queue-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 13px;
  padding: 15px 17px;
  border-radius: 20px;
}

.queue-summary strong {
  font-size: 14px;
}

.queue-summary span {
  color: var(--muted);
  font-size: 12px;
}

.queue-list,
.library-list,
.full-history {
  display: grid;
  gap: 10px;
}

.queue-item,
.library-item,
.history-list-item {
  position: relative;
  display: grid;
  grid-template-columns: 34px 66px minmax(0, 1fr) auto;
  gap: 13px;
  align-items: center;
  overflow: hidden;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  transition: transform 220ms var(--ease), opacity 220ms var(--ease), border-color 220ms var(--ease), background 220ms var(--ease);
  animation: list-enter 360ms var(--ease) both;
}

.library-item,
.history-list-item {
  grid-template-columns: 66px minmax(0, 1fr) auto;
}

@keyframes list-enter {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.queue-item:hover,
.library-item:hover,
.history-list-item:hover {
  border-color: var(--line-strong);
  background: var(--surface-hover);
}

.queue-item.dragging {
  opacity: 0.5;
  transform: scale(0.985);
}

.queue-item.drag-over {
  border-color: var(--primary);
  transform: translateY(3px);
}

.drag-handle {
  width: 34px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: var(--faint);
  font-size: 21px;
  cursor: grab;
}

.queue-position {
  position: absolute;
  top: 8px;
  left: 48px;
  z-index: 2;
  min-width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--primary);
  color: var(--primary-text);
  font-size: 10px;
  font-weight: 850;
  box-shadow: var(--shadow-soft);
}

.item-poster,
.item-poster-placeholder {
  width: 66px;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: 13px;
  background: var(--bg-elevated);
}

.item-title {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 780;
  line-height: 1.25;
}

.item-meta {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.item-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.mini-button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 7px 10px;
  background: var(--surface-soft);
  color: var(--text);
  font-size: 11px;
  font-weight: 740;
  transition: transform 160ms var(--ease), background 200ms var(--ease);
}

.mini-button:hover:not(:disabled) {
  background: var(--surface-hover);
}

.mini-button:active:not(:disabled) {
  transform: scale(0.95);
}

.mini-button.primary-mini {
  border-color: transparent;
  background: var(--primary);
  color: var(--primary-text);
}

.mini-button.danger-mini {
  border-color: color-mix(in srgb, var(--danger) 20%, transparent);
  background: var(--danger-bg);
  color: var(--danger);
}

.search-bar {
  position: sticky;
  top: 74px;
  z-index: 18;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 20px;
}

.search-symbol {
  padding-left: 4px;
  color: var(--muted);
  font-size: 22px;
}

.search-bar input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  padding: 9px 5px;
  background: transparent;
  color: var(--text);
  font-size: 16px;
}

.clear-search {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 11px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 21px;
}

.filter-row {
  display: flex;
  gap: 7px;
  margin: 12px 0 3px;
  overflow-x: auto;
  scrollbar-width: none;
}

.filter-chip {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 13px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
}

.filter-chip.active {
  border-color: transparent;
  background: var(--primary);
  color: var(--primary-text);
}

.search-section-heading {
  margin-top: 24px;
}

.inline-status {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 12px;
}

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

.poster-card {
  overflow: hidden;
  border-radius: 22px;
  animation: card-enter 420ms var(--ease) both;
}

@keyframes card-enter {
  from { opacity: 0; transform: translateY(13px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

.poster-image-wrap {
  position: relative;
  overflow: hidden;
  background: var(--bg-elevated);
}

.poster-image,
.poster-placeholder {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  transition: transform 500ms var(--ease);
}

.poster-card:hover .poster-image {
  transform: scale(1.035);
}

.poster-placeholder {
  display: grid;
  place-items: center;
  color: var(--faint);
  background: linear-gradient(145deg, var(--surface-soft), var(--bg-elevated));
  font-size: 12px;
}

.poster-type-badge,
.poster-rating-badge {
  position: absolute;
  top: 9px;
  z-index: 2;
  min-height: 27px;
  display: flex;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.17);
  border-radius: 10px;
  padding: 6px 8px;
  background: rgba(10, 10, 14, 0.55);
  color: #fff;
  backdrop-filter: blur(14px);
  font-size: 10px;
  font-weight: 760;
}

.poster-type-badge {
  left: 9px;
}

.poster-rating-badge {
  right: 9px;
}

.poster-body {
  padding: 12px;
}

.poster-title {
  margin: 0 0 5px;
  overflow: hidden;
  font-size: 14px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.poster-meta {
  color: var(--muted);
  font-size: 10px;
}

.poster-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin-top: 11px;
}

.poster-actions button {
  min-height: 36px;
  border-radius: 11px;
  padding: 7px;
  font-size: 10px;
}

.skeleton-card {
  height: 330px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface-soft);
  position: relative;
}

.skeleton-card::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);
  animation: shimmer 1.1s infinite;
}

@keyframes shimmer {
  to { transform: translateX(100%); }
}

.library-tabs {
  max-width: 430px;
  margin-bottom: 14px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.profile-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  border-radius: 27px;
}

.profile-avatar {
  width: 68px;
  height: 68px;
  flex: 0 0 68px;
  display: grid;
  place-items: center;
  border-radius: 22px;
  background: var(--primary);
  color: var(--primary-text);
  font-size: 27px;
  font-weight: 900;
}

.profile-card h2 {
  margin-top: 7px;
  overflow-wrap: anywhere;
  font-size: clamp(20px, 4vw, 30px);
}

.settings-card,
.credits-card {
  margin-top: 14px;
  overflow: hidden;
  border-radius: 25px;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 17px;
  border-bottom: 1px solid var(--line);
}

.setting-row:last-child {
  border-bottom: 0;
}

.setting-row strong {
  font-size: 14px;
}

.setting-row p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.theme-selector {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 14px;
  background: var(--surface-soft);
}

.theme-selector button {
  border: 0;
  border-radius: 10px;
  padding: 8px 9px;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  font-weight: 720;
}

.theme-selector button.active {
  background: var(--primary);
  color: var(--primary-text);
}

.status-badge {
  border-radius: 999px;
  padding: 8px 11px;
  font-size: 10px;
  font-weight: 780;
}

.status-badge.success {
  background: var(--success-bg);
  color: var(--success);
}

.history-list-item {
  grid-template-columns: 55px minmax(0, 1fr) auto;
}

.history-list-item .item-poster,
.history-list-item .item-poster-placeholder {
  width: 55px;
}

.history-rating {
  color: var(--text-soft);
  font-size: 12px;
}

.credits-card {
  padding: 17px;
}

.credits-card strong {
  font-size: 13px;
}

.credits-card p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.profile-logout {
  margin-top: 16px;
}

.app-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  width: 100%;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
  padding:
    7px
    max(12px, calc((100% - 720px) / 2))
    calc(7px + env(safe-area-inset-bottom));
  border-width: 1px 0 0;
  border-radius: 0;
  background: color-mix(in srgb, var(--surface-strong) 94%, transparent);
  box-shadow:
    0 -12px 38px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(30px) saturate(1.28);
  -webkit-backdrop-filter: blur(30px) saturate(1.28);
  isolation: isolate;
}

.nav-item {
  position: relative;
  min-width: 0;
  border: 0;
  min-height: 54px;
  border-radius: 14px;
  padding: 7px 3px 5px;
  background: transparent;
  color: var(--faint);
  transition: transform 180ms var(--ease), background 240ms var(--ease), color 240ms var(--ease);
}

.nav-icon {
  display: block;
  width: 22px;
  height: 22px;
  margin: 0 auto 3px;
  transition: transform 220ms var(--ease);
}

.nav-icon svg {
  display: block;
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-item small {
  display: block;
  font-size: 9px;
  font-weight: 720;
}

.nav-item.active {
  background: var(--surface-hover);
  color: var(--text);
  box-shadow: inset 0 1px 0 var(--line);
}

.nav-item.active::before {
  content: "";
  position: absolute;
  top: -7px;
  left: 50%;
  width: 28px;
  height: 3px;
  border-radius: 999px;
  background: var(--primary);
  transform: translateX(-50%);
  animation: nav-indicator-in 220ms var(--ease) both;
}

.nav-item.active .nav-icon {
  transform: translateY(-1px) scale(1.06);
}

.nav-item:hover:not(.active) {
  background: var(--surface-hover);
  color: var(--text-soft);
}

.nav-item:active {
  transform: scale(0.94);
}

@keyframes nav-indicator-in {
  from { opacity: 0; transform: translateX(-50%) scaleX(0.35); }
  to { opacity: 1; transform: translateX(-50%) scaleX(1); }
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  visibility: hidden;
  opacity: 0;
  transition: opacity 240ms var(--ease), visibility 240ms var(--ease);
}

.modal.open {
  visibility: visible;
  opacity: 1;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.64);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.sheet {
  position: absolute;
  left: 50%;
  bottom: 12px;
  width: min(calc(100% - 24px), 720px);
  max-height: calc(100svh - 24px);
  overflow-y: auto;
  border-radius: 32px;
  padding: 12px 20px max(22px, env(safe-area-inset-bottom));
  transform: translate(-50%, 24px) scale(0.985);
  opacity: 0;
  transition: transform 320ms var(--ease), opacity 260ms var(--ease);
}

.modal.open .sheet {
  transform: translate(-50%, 0) scale(1);
  opacity: 1;
}

.sheet-handle {
  width: 40px;
  height: 5px;
  margin: 2px auto 18px;
  border-radius: 999px;
  background: var(--line-strong);
}

.sheet-close {
  position: absolute;
  top: 13px;
  right: 13px;
  width: 37px;
  height: 37px;
  border-radius: 13px;
  font-size: 22px;
}

.details-hero {
  position: relative;
  min-height: 390px;
  overflow: hidden;
  margin: 0 -8px 18px;
  border-radius: 26px;
  display: flex;
  align-items: flex-end;
  background: var(--bg-elevated);
}

.details-backdrop {
  position: absolute;
  inset: 0;
  background-position: center;
  background-size: cover;
}

.details-backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(5, 5, 8, 0.98), rgba(5, 5, 8, 0.2) 66%);
}

.details-hero-content {
  position: relative;
  z-index: 2;
  width: 100%;
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  gap: 16px;
  align-items: end;
  padding: 18px;
  color: #fff;
}

.details-poster {
  width: 104px;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: 15px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.48);
}

.details-title {
  margin: 6px 0 7px;
  font-size: clamp(28px, 7vw, 44px);
  line-height: 0.98;
  letter-spacing: -0.055em;
}

.details-meta {
  color: rgba(255, 255, 255, 0.69);
  font-size: 12px;
}

.details-overview {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.58;
}

.genre-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 12px 0;
}

.genre-chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 9px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 10px;
}

.details-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin: 16px 0;
}

.episode-controls {
  margin-top: 19px;
  padding-top: 17px;
  border-top: 1px solid var(--line);
}

.select-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 9px;
}

.season-select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 12px;
  background: var(--surface-soft);
  color: var(--text);
}

.episode-list {
  display: grid;
  gap: 8px;
  max-height: 330px;
  overflow-y: auto;
  margin-top: 11px;
  padding-right: 2px;
}

.episode-item {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-soft);
}

.episode-still,
.episode-still-placeholder {
  width: 54px;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 9px;
  background: var(--bg-elevated);
}

.episode-item strong {
  display: block;
  font-size: 12px;
}

.episode-item span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
}

.complete-sheet h2 {
  margin: 6px 0 8px;
  font-size: 35px;
  letter-spacing: -0.055em;
}

.sheet-copy {
  margin: 0 0 15px;
  color: var(--muted);
}

.rating-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 7px;
  margin-bottom: 13px;
}

.rating-button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface-soft);
  color: var(--muted);
  font-weight: 780;
  transition: transform 160ms var(--ease), background 200ms var(--ease), color 200ms var(--ease);
}

.rating-button.active {
  border-color: transparent;
  background: var(--primary);
  color: var(--primary-text);
}

.rating-button:active {
  transform: scale(0.94);
}

textarea {
  width: 100%;
  min-height: 105px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 16px;
  outline: 0;
  padding: 13px;
  background: var(--surface-soft);
  color: var(--text);
}

.toast {
  position: fixed;
  left: 50%;
  top: max(14px, env(safe-area-inset-top));
  z-index: 100;
  max-width: calc(100% - 28px);
  border-radius: 999px;
  padding: 12px 16px;
  background: var(--primary);
  color: var(--primary-text);
  box-shadow: var(--shadow-soft);
  font-size: 12px;
  font-weight: 780;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -13px) scale(0.96);
  transition: opacity 220ms var(--ease), transform 260ms var(--ease);
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}

.resize-gate {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  padding: max(20px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px) saturate(0.88);
  -webkit-backdrop-filter: blur(12px) saturate(0.88);
  animation: resize-gate-in 180ms ease-out both;
}

.resize-gate-card {
  width: min(100%, 420px);
  padding: 26px;
  border-radius: 24px;
  text-align: center;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.3);
  animation: resize-card-in 240ms var(--ease) both;
}

.resize-gate-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  margin: 0 auto 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-soft);
  color: var(--text);
  box-shadow: none;
  font-size: 19px;
  font-weight: 800;
}

.resize-gate-card h2 {
  margin: 0 0 8px;
  font-size: 28px;
  line-height: 1.05;
  letter-spacing: -0.045em;
}

.resize-gate-card > p:not(.overline) {
  margin: 0 auto;
  max-width: 340px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.resize-size-readout {
  display: grid;
  grid-template-columns: 1fr auto 28px 1fr auto;
  align-items: center;
  gap: 9px;
  margin: 18px 0 14px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-soft);
  font-size: 12px;
}

.resize-size-readout span {
  color: var(--muted);
  text-align: right;
}

.resize-size-readout i {
  color: var(--faint);
  font-style: normal;
}

.resize-gate-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.resize-gate-footnote {
  margin-top: 12px !important;
  font-size: 11px !important;
}

body.window-size-locked {
  overflow: hidden;
}

body.window-size-locked .shell {
  pointer-events: none;
  user-select: none;
}

@keyframes resize-gate-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes resize-card-in {
  from { opacity: 0; transform: translateY(8px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

@media (min-width: 720px) {
  .poster-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .sheet {
    bottom: 50%;
    transform: translate(-50%, calc(50% + 24px)) scale(0.985);
  }

  .modal.open .sheet {
    transform: translate(-50%, 50%) scale(1);
  }

  .details-sheet {
    width: min(calc(100% - 32px), 820px);
  }
}

@media (max-width: 760px) {
  .screen-heading {
    align-items: flex-start;
  }

  .up-next-card {
    min-height: 535px;
  }

  .up-next-content {
    grid-template-columns: 102px minmax(0, 1fr);
    gap: 16px;
    padding: 19px;
  }

  .up-next-poster {
    width: 102px;
  }

  .up-next-overview {
    display: none;
  }

  .queue-item {
    grid-template-columns: 28px 56px minmax(0, 1fr);
  }

  .library-item {
    grid-template-columns: 56px minmax(0, 1fr);
  }

  .queue-item .item-actions,
  .library-item .item-actions {
    grid-column: 3;
    justify-content: flex-start;
  }

  .library-item .item-actions {
    grid-column: 2;
  }

  .item-poster,
  .item-poster-placeholder {
    width: 56px;
  }

  .queue-position {
    left: 38px;
  }

  .setting-row {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 460px) {
  .auth-card,
  .install-card {
    padding: 21px;
  }

  .stats-strip,
  .profile-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .stat-card {
    padding: 12px 9px;
  }

  .stat-value {
    font-size: 22px;
  }

  .details-actions {
    grid-template-columns: 1fr;
  }

  .details-hero-content {
    grid-template-columns: 84px minmax(0, 1fr);
  }

  .details-poster {
    width: 84px;
  }

  .poster-actions {
    grid-template-columns: 1fr;
  }
}

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

/* =========================================================
   Seqo v5 polish: premium empty states, install icon, and
   fixed desktop app canvas. Mobile remains fluid.
   ========================================================= */

.install-app-icon {
  position: relative;
  z-index: 3;
  width: 112px;
  height: 112px;
  display: block;
  border-radius: 31px;
  box-shadow:
    0 26px 70px rgba(0, 0, 0, 0.35),
    0 0 0 1px rgba(255, 255, 255, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
  animation: install-icon-float 4.8s var(--ease) infinite alternate;
}

@keyframes install-icon-float {
  from { transform: translateY(3px) rotate(-1.4deg) scale(0.985); }
  to { transform: translateY(-5px) rotate(1.4deg) scale(1.015); }
}

.install-ring {
  opacity: 0.62;
  border-color: color-mix(in srgb, var(--line-strong) 72%, transparent);
}

.home-empty {
  min-height: 330px;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(260px, 0.75fr);
  align-items: center;
  gap: 28px;
  padding: clamp(28px, 4.8vw, 54px);
  border-radius: 36px;
}

.home-empty-copy {
  position: relative;
  z-index: 2;
  text-align: left;
}

.home-empty-copy h2 {
  max-width: 610px;
  margin: 8px 0 12px;
  font-size: clamp(35px, 5.3vw, 58px);
  line-height: 0.98;
  letter-spacing: -0.066em;
}

.home-empty-copy > p:not(.overline) {
  max-width: 540px;
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.58;
}

.home-empty-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 22px;
}

.sequence-illustration {
  position: relative;
  min-height: 235px;
  perspective: 900px;
}

.sequence-card {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(250px, 86%);
  height: 150px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 27px;
  background:
    radial-gradient(circle at 18% 0%, rgba(255, 255, 255, 0.2), transparent 38%),
    linear-gradient(145deg, var(--surface-strong), var(--surface));
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(24px) saturate(1.25);
  -webkit-backdrop-filter: blur(24px) saturate(1.25);
  transform-origin: center;
}

.sequence-card > span {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 12px;
  background: var(--primary);
  color: var(--primary-text);
  font-size: 11px;
  font-weight: 850;
}

.sequence-card-back {
  transform: translate(-39%, -67%) rotate(8deg) scale(0.88);
  opacity: 0.48;
  animation: sequence-float-back 7s var(--ease) infinite alternate;
}

.sequence-card-middle {
  transform: translate(-56%, -52%) rotate(-6deg) scale(0.94);
  opacity: 0.72;
  animation: sequence-float-middle 6s var(--ease) infinite alternate;
}

.sequence-card-front {
  transform: translate(-48%, -37%) rotate(1.5deg);
  animation: sequence-float-front 5.4s var(--ease) infinite alternate;
}

.sequence-lines {
  display: grid;
  gap: 10px;
  margin-top: 19px;
}

.sequence-lines i {
  display: block;
  height: 9px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--text) 12%, transparent);
}

.sequence-lines i:nth-child(1) { width: 82%; }
.sequence-lines i:nth-child(2) { width: 62%; }
.sequence-lines i:nth-child(3) { width: 72%; }

@keyframes sequence-float-front {
  from { transform: translate(-48%, -37%) rotate(1.5deg) translateY(2px); }
  to { transform: translate(-48%, -37%) rotate(-0.6deg) translateY(-7px); }
}

@keyframes sequence-float-middle {
  from { transform: translate(-56%, -52%) rotate(-6deg) scale(0.94) translateY(2px); }
  to { transform: translate(-56%, -52%) rotate(-3deg) scale(0.96) translateY(-4px); }
}

@keyframes sequence-float-back {
  from { transform: translate(-39%, -67%) rotate(8deg) scale(0.88); }
  to { transform: translate(-39%, -67%) rotate(11deg) scale(0.9) translateY(-5px); }
}

.history-row.is-empty {
  display: block;
  overflow: visible;
  padding-bottom: 0;
}

.history-empty {
  min-height: 124px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  padding: 18px 20px;
  border-radius: 24px;
}

.history-empty-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 17px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--muted);
  font-weight: 850;
}

.history-empty h3 {
  margin: 0 0 5px;
  font-size: 19px;
  letter-spacing: -0.035em;
}

.history-empty p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.stat-card {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--surface-strong) 74%, transparent), color-mix(in srgb, var(--surface) 82%, transparent));
}

.stat-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(112deg, transparent 12%, rgba(255, 255, 255, 0.09) 48%, transparent 76%);
  transform: translateX(-120%);
  transition: transform 620ms var(--ease);
  pointer-events: none;
}

.stat-card:hover::after {
  transform: translateX(120%);
}

.app-screen {
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--muted) 42%, transparent) transparent;
}

.app-screen::-webkit-scrollbar {
  width: 7px;
}

.app-screen::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: color-mix(in srgb, var(--muted) 36%, transparent);
}

@media (max-width: 760px) {
  .home-empty {
    grid-template-columns: 1fr;
    min-height: 0;
    padding: 27px 22px;
  }

  .sequence-illustration {
    min-height: 210px;
    order: -1;
  }

  .home-empty-copy {
    text-align: center;
  }

  .home-empty-copy > p:not(.overline) {
    margin-inline: auto;
  }

  .home-empty-actions {
    justify-content: center;
  }

  .history-empty {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .history-empty .button {
    grid-column: 1 / -1;
    width: 100%;
  }
}

@media (max-width: 460px) {
  .install-app-icon {
    width: 98px;
    height: 98px;
    border-radius: 28px;
  }

  .sequence-card {
    width: min(225px, 88%);
    height: 138px;
  }
}

/* =========================================================
   Seqo v6: quiet motion and native desktop shell
   ========================================================= */

/* Keep ambient effects quiet while preserving purposeful interface motion. */
.liquid-orb,
.install-ring,
.up-next-backdrop {
  animation: none !important;
}

.liquid-orb {
  opacity: 0.16;
  filter: blur(54px);
  transform: none !important;
}

html[data-theme="light"] .liquid-orb {
  opacity: 0.09;
}

.liquid-background::after {
  backdrop-filter: none;
}

html {
  scroll-behavior: smooth;
}

body {
  transition:
    background-color 180ms ease-out,
    color 180ms ease-out;
}

button,
.input-shell,
.glass-panel,
.poster-card,
.queue-item,
.library-row,
.history-card,
.stat-card,
.nav-item,
.filter-chip,
.segment {
  transition:
    background-color 150ms ease-out,
    border-color 150ms ease-out,
    color 150ms ease-out,
    opacity 150ms ease-out,
    box-shadow 180ms ease-out,
    transform 220ms var(--ease);
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.poster-card:hover,
.queue-item:hover,
.library-item:hover,
.history-card:hover,
.stat-card:hover {
  transform: translateY(-3px);
}

.poster-card::after,
.queue-item::after,
.library-item::after,
.glass-panel::after {
  transition: none !important;
}

.app-screen.active {
  animation: seqo-screen-reveal 240ms var(--ease) both !important;
  view-transition-name: app-content;
}

@keyframes seqo-screen-reveal {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: none; }
}

::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
}

::view-transition-old(app-content) {
  animation: screen-snapshot-out 140ms ease-in both;
}

::view-transition-new(app-content) {
  animation: screen-snapshot-in 220ms var(--ease) both;
}

@keyframes screen-snapshot-out {
  to { opacity: 0; transform: translateY(-3px); }
}

@keyframes screen-snapshot-in {
  from { opacity: 0; transform: translateY(7px); }
}

/* Custom desktop titlebar. Hidden in the normal website and PWA. */
.native-titlebar {
  display: none;
}

html.native-desktop,
html.native-desktop body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  user-select: none;
}

html.native-desktop body {
  display: grid;
  grid-template-rows: 42px minmax(0, 1fr);
  padding: 0;
  background: var(--bg);
}

html.native-desktop .native-titlebar {
  position: relative;
  z-index: 1000;
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr) 108px;
  align-items: center;
  width: 100%;
  height: 42px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(
      180deg,
      color-mix(in srgb, var(--surface-strong) 92%, transparent),
      color-mix(in srgb, var(--surface) 82%, transparent)
    );
  backdrop-filter: blur(26px) saturate(1.18);
  -webkit-backdrop-filter: blur(26px) saturate(1.18);
  -webkit-app-region: drag;
}

.native-window-controls {
  display: flex;
  align-items: center;
  gap: 9px;
  -webkit-app-region: no-drag;
}

.native-window-button {
  width: 12px;
  height: 12px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  box-shadow: inset 0 0 0 0.5px rgba(0, 0, 0, 0.16);
}

.native-close {
  background: #ff5f57;
}

.native-minimize {
  background: #febc2e;
}

.native-window-button:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 3px;
}

.native-titlebar-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 720;
  letter-spacing: -0.01em;
  pointer-events: none;
}

.native-titlebar-mark {
  position: relative;
  display: inline-block;
  width: 18px;
  height: 14px;
}

.native-titlebar-mark i {
  position: absolute;
  left: 0;
  display: block;
  height: 3px;
  border-radius: 99px;
  background: currentColor;
}

.native-titlebar-mark i:nth-child(1) {
  top: 0;
  width: 11px;
}

.native-titlebar-mark i:nth-child(2) {
  top: 5px;
  width: 18px;
}

.native-titlebar-mark i:nth-child(3) {
  top: 10px;
  width: 13px;
}

html.native-desktop .shell {
  grid-row: 2;
  width: 100%;
  height: 100%;
  min-height: 0;
  margin: 0;
  padding: 12px;
  overflow-y: auto;
}

html.native-desktop .app-view {
  width: 100%;
  height: 100%;
  min-height: 0;
  border-radius: 25px;
}

html.native-desktop .app-header {
  border-top-left-radius: 0;
}

html.native-desktop .app-screen {
  overscroll-behavior: none;
}

/* The native desktop shell uses one exact window size. */
html.native-desktop .install-view,
html.native-desktop .center-view {
  min-height: 100%;
}

@media (max-width: 390px) {
  .shell {
    padding-inline: 12px;
  }

  .screen-heading {
    flex-direction: column;
  }

  .screen-heading h1 {
    font-size: clamp(40px, 14vw, 54px);
  }

  .screen-heading .compact-button {
    width: 100%;
  }

  .up-next-card {
    min-height: 500px;
  }

  .up-next-content {
    grid-template-columns: 78px minmax(0, 1fr);
    gap: 12px;
    padding: 16px;
  }

  .up-next-poster {
    width: 78px;
  }

  .up-next-title {
    font-size: clamp(26px, 9vw, 38px);
  }

  .up-next-actions {
    grid-column: 1 / -1;
  }

  .queue-summary {
    align-items: flex-start;
    flex-direction: column;
  }

  .mini-button {
    min-height: 40px;
  }

  .profile-card h2 {
    font-size: 18px;
    overflow-wrap: anywhere;
  }

}

@media (max-width: 460px) {
  .wordmark {
    font-size: 23px;
  }

  .wordmark-logo {
    transform: scale(0.9);
  }

  .app-header {
    margin-inline: -4px;
  }

  .nav-item {
    min-height: 50px;
  }
}

@media (hover: none) and (pointer: coarse) {
  .mini-button,
  .filter-chip,
  .text-button {
    min-height: 44px;
  }
}

@media (max-width: 520px) {
  .resize-gate {
    padding: 14px;
  }

  .resize-gate-card {
    padding: 24px 18px;
    border-radius: 26px;
  }

  .resize-size-readout {
    grid-template-columns: 1fr auto;
  }

  .resize-size-readout i {
    display: none;
  }

  .resize-size-readout span {
    text-align: left;
  }

  .resize-gate-actions {
    grid-template-columns: 1fr;
  }
}

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