/* Kadro visual system: dark iOS-inspired materials, spacing, and interaction states. */
:root {
  color-scheme: dark;
  accent-color: var(--accent);
  --app-bg: #09090b;
  --app-bg-elevated: #111114;
  --surface: rgba(28, 28, 30, 0.62);
  --surface-raised: rgba(44, 44, 46, 0.74);
  --surface-soft: rgba(28, 28, 30, 0.48);
  --material: rgba(18, 18, 20, 0.5);
  --material-strong: rgba(20, 20, 22, 0.66);
  --text: #f5f5f7;
  --text-secondary: #aeaeb2;
  --text-tertiary: #8e8e93;
  --separator: rgba(235, 235, 245, 0.16);
  --separator-strong: rgba(235, 235, 245, 0.28);
  --accent: #0a84ff;
  --accent-hover: #409cff;
  --accent-press: #0071e3;
  --accent-ink: #00172e;
  --accent-faint: rgba(10, 132, 255, 0.08);
  --accent-soft: rgba(10, 132, 255, 0.16);
  --accent-strong: rgba(10, 132, 255, 0.26);
  --accent-border: rgba(64, 156, 255, 0.58);
  --accent-ambient: rgba(10, 132, 255, 0.18);
  --accent-glow: rgba(10, 132, 255, 0.24);
  --success: #30d158;
  --warning: #ff9f0a;
  --danger: #ff453a;
  --shadow-elevation: 0 20px 52px rgba(0, 0, 0, 0.3), 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-float: 0 28px 72px rgba(0, 0, 0, 0.42), 0 1px 0 rgba(255, 255, 255, 0.06) inset;
  --tg-content-safe-area-top: 0px;
  --tg-content-safe-area-bottom: 0px;
  --app-safe-area-top: max(env(safe-area-inset-top), var(--tg-content-safe-area-inset-top, var(--tg-content-safe-area-top)));
  --app-safe-area-bottom: max(env(safe-area-inset-bottom), var(--tg-content-safe-area-inset-bottom, var(--tg-content-safe-area-bottom)));
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

:root[data-accent="violet"] {
  --accent: #bf5af2;
  --accent-hover: #d4a0ff;
  --accent-press: #9c42cf;
  --accent-ink: #250033;
  --accent-faint: rgba(191, 90, 242, 0.08);
  --accent-soft: rgba(191, 90, 242, 0.16);
  --accent-strong: rgba(191, 90, 242, 0.26);
  --accent-border: rgba(212, 160, 255, 0.58);
  --accent-ambient: rgba(191, 90, 242, 0.18);
  --accent-glow: rgba(191, 90, 242, 0.24);
}

:root[data-accent="pink"] {
  --accent: #ff375f;
  --accent-hover: #ff8aa2;
  --accent-press: #d72d4e;
  --accent-ink: #2a020c;
  --accent-faint: rgba(255, 55, 95, 0.08);
  --accent-soft: rgba(255, 55, 95, 0.16);
  --accent-strong: rgba(255, 55, 95, 0.26);
  --accent-border: rgba(255, 138, 162, 0.58);
  --accent-ambient: rgba(255, 55, 95, 0.18);
  --accent-glow: rgba(255, 55, 95, 0.24);
}

:root[data-accent="green"] {
  --accent: #30d158;
  --accent-hover: #7ae68e;
  --accent-press: #20ad46;
  --accent-ink: #03250e;
  --accent-faint: rgba(48, 209, 88, 0.08);
  --accent-soft: rgba(48, 209, 88, 0.16);
  --accent-strong: rgba(48, 209, 88, 0.26);
  --accent-border: rgba(122, 230, 142, 0.58);
  --accent-ambient: rgba(48, 209, 88, 0.18);
  --accent-glow: rgba(48, 209, 88, 0.24);
}

:root[data-accent="orange"] {
  --accent: #ff9f0a;
  --accent-hover: #ffca72;
  --accent-press: #d67e00;
  --accent-ink: #2b1800;
  --accent-faint: rgba(255, 159, 10, 0.08);
  --accent-soft: rgba(255, 159, 10, 0.16);
  --accent-strong: rgba(255, 159, 10, 0.26);
  --accent-border: rgba(255, 202, 114, 0.58);
  --accent-ambient: rgba(255, 159, 10, 0.18);
  --accent-glow: rgba(255, 159, 10, 0.24);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  min-height: 100%;
  margin: 0;
  background: var(--app-bg);
  color: var(--text);
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  font-family: inherit;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  background:
    radial-gradient(110% 42% at 50% -12%, var(--accent-ambient), transparent 52%),
    radial-gradient(64% 30% at 100% 45%, rgba(48, 209, 88, 0.045), transparent 68%),
    var(--app-bg);
}

body::before {
  position: fixed;
  z-index: -1;
  inset: 0;
  content: "";
  pointer-events: none;
  opacity: 0.32;
  background-image: radial-gradient(rgba(255, 255, 255, 0.065) 0.55px, transparent 0.55px);
  background-size: 5px 5px;
  mask-image: linear-gradient(to bottom, black, transparent 70%);
}

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

button {
  border: 0;
  color: inherit;
}

button:not(:disabled) {
  cursor: pointer;
}

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

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

:where(a, button, input, select):focus-visible {
  outline: 3px solid var(--accent-border);
  outline-offset: 3px;
}

:where(h1, h2, h3)[tabindex="-1"]:focus {
  outline: 0;
}

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 0.75rem;
  left: 0.75rem;
  transform: translateY(-160%);
  border-radius: 0.75rem;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 0.875rem;
  font-weight: 700;
  padding: 0.75rem 1rem;
  transition: transform 180ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

#app {
  height: 100dvh;
  overflow: hidden;
}

.app-header {
  position: fixed;
  z-index: 50;
  top: 0;
  right: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(4.25rem + var(--app-safe-area-top));
  padding: calc(0.5rem + var(--app-safe-area-top)) 1rem 0.5rem;
  border-bottom: 1px solid var(--separator);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.11), rgba(18, 18, 20, 0.44) 42%, rgba(18, 18, 20, 0.56));
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.15) inset, 0 12px 30px rgba(0, 0, 0, 0.14);
  backdrop-filter: blur(42px) saturate(185%) brightness(1.08);
  -webkit-backdrop-filter: blur(42px) saturate(185%) brightness(1.08);
}

.app-header::before {
  position: absolute;
  inset: 1px;
  border-radius: inherit;
  content: "";
  pointer-events: none;
  background: linear-gradient(112deg, rgba(255, 255, 255, 0.16), transparent 36%, rgba(255, 255, 255, 0.025) 68%);
}

.app-header::after {
  position: absolute;
  right: 0;
  bottom: -1.25rem;
  left: 0;
  height: 1.25rem;
  content: "";
  pointer-events: none;
  background: linear-gradient(to bottom, rgba(9, 9, 11, 0.18), transparent);
}

.app-wordmark {
  margin: 0;
  max-width: calc(100% - 8rem);
  overflow: hidden;
  color: var(--text);
  font-size: 1.0625rem;
  font-weight: 760;
  line-height: 1.1;
  letter-spacing: -0.025em;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-optical-sizing: auto;
}

.app-toolbar-button {
  position: absolute;
  top: calc(0.75rem + var(--app-safe-area-top));
  display: inline-grid;
  width: 2.75rem;
  height: 2.75rem;
  place-items: center;
  border-radius: 50%;
  background: transparent;
  color: var(--accent-hover);
  transition: transform 160ms ease-out, background-color 160ms ease-out, color 160ms ease-out;
  will-change: transform;
}

#backButton {
  left: 1rem;
}

#refreshButton {
  right: 1rem;
}

.app-toolbar-button .material-symbols-outlined {
  font-size: 1.375rem;
  font-variation-settings: "wght" 520, "GRAD" 0, "opsz" 24;
}

.app-toolbar-button:active {
  transform: scale(0.92);
  background: rgba(255, 255, 255, 0.1);
}

.app-view {
  display: flex;
  height: 100%;
  flex-direction: column;
  gap: 1.5rem;
  overflow-x: hidden;
  overflow-y: auto;
  padding: calc(5rem + var(--app-safe-area-top)) 1rem calc(6.9rem + var(--app-safe-area-bottom));
  overscroll-behavior: contain;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-color: rgba(174, 174, 178, 0.62) transparent;
  scrollbar-width: thin;
}

#view > * {
  animation: kadro-surface-in 280ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

#view > .reader-layout {
  animation: none;
  transform: none;
}

@keyframes kadro-surface-in {
  from {
    opacity: 0;
    transform: translateY(0.5rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.app-tabbar {
  position: fixed;
  z-index: 50;
  right: 0.5rem;
  bottom: 0.5rem;
  left: 0.5rem;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: center;
  min-height: calc(4.25rem + var(--app-safe-area-bottom));
  padding: 0.38rem 0.3rem calc(0.38rem + var(--app-safe-area-bottom));
  overflow: hidden;
  border: 1px solid rgba(235, 235, 245, 0.2);
  border-radius: 1.65rem;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.13), rgba(20, 20, 22, 0.5) 46%, rgba(20, 20, 22, 0.58));
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.16) inset, var(--shadow-float);
  backdrop-filter: blur(44px) saturate(190%) brightness(1.08);
  -webkit-backdrop-filter: blur(44px) saturate(190%) brightness(1.08);
}

.app-tabbar::before {
  position: absolute;
  inset: 1px;
  border-radius: inherit;
  content: "";
  pointer-events: none;
  background: linear-gradient(112deg, rgba(255, 255, 255, 0.16), transparent 42%, rgba(255, 255, 255, 0.03) 72%);
}

.offline-action-bar {
  position: fixed;
  z-index: 45;
  right: 1rem;
  bottom: calc(5.5rem + var(--app-safe-area-bottom));
  left: 1rem;
  max-width: 40rem;
  margin-inline: auto;
  padding: 0.45rem;
  border: 1px solid rgba(235, 235, 245, 0.18);
  border-radius: 1.4rem;
  background: rgba(20, 20, 22, 0.9);
  box-shadow: var(--shadow-float);
  backdrop-filter: blur(28px) saturate(170%);
  -webkit-backdrop-filter: blur(28px) saturate(170%);
}

.app-tab {
  position: relative;
  z-index: 1;
  display: flex;
  min-width: 0;
  min-height: 3.4rem;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  border-radius: 1.15rem;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.1;
  transition: transform 160ms ease-out, color 160ms ease-out, background-color 160ms ease-out, box-shadow 160ms ease-out;
  will-change: transform;
}

.app-tab .material-symbols-outlined {
  font-size: 1.35rem;
  line-height: 1;
  font-variation-settings: "wght" 500, "GRAD" 0, "opsz" 24;
}

.app-tab.nav-btn-active {
  background: var(--accent-soft) !important;
  color: var(--accent-hover) !important;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.1) inset;
}

.app-tab.nav-btn-active .material-symbols-outlined {
  font-variation-settings: "FILL" 1, "wght" 600, "GRAD" 0, "opsz" 24;
}

.app-tab:active {
  transform: scale(0.94);
}

html.tg-fullscreen .app-header {
  min-height: calc(4.25rem + var(--app-safe-area-top));
}

html.tg-fullscreen .app-view {
  padding-top: calc(5rem + var(--app-safe-area-top));
}

html.tg-fullscreen .app-tabbar {
  padding-bottom: calc(0.38rem + var(--app-safe-area-bottom));
}

/* Shared surface primitives emitted from public/app.js. */
:where(.bg-surface-container-lowest, .bg-surface-container-low, .bg-surface-container, .bg-surface-container-high, .bg-surface-container-highest, .glass-panel) {
  border-color: var(--separator) !important;
  background-color: var(--surface) !important;
  background-image: linear-gradient(135deg, rgba(255, 255, 255, 0.1), transparent 48%, rgba(255, 255, 255, 0.025)) !important;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.11) inset, 0 10px 24px rgba(0, 0, 0, 0.12);
  backdrop-filter: blur(20px) saturate(165%);
  -webkit-backdrop-filter: blur(20px) saturate(165%);
}

:where(.bg-surface-container-lowest, .bg-surface-container-low) {
  background-color: rgba(17, 17, 20, 0.66) !important;
}

:where(.bg-surface-container-high, .bg-surface-container-highest) {
  background-color: var(--surface-raised) !important;
}

:where(.bg-surface) {
  background-color: var(--app-bg-elevated) !important;
}

:where(.text-on-background, .text-on-surface) {
  color: var(--text) !important;
}

:where(.text-on-surface-variant, .text-secondary) {
  color: var(--text-secondary) !important;
}

:where(.text-primary, [class*="text-primary/"]) {
  color: var(--accent-hover) !important;
}

:where(.bg-primary, .bg-primary-container) {
  background-color: var(--accent) !important;
}

:where([class~="bg-primary/5"]) {
  background-color: var(--accent-faint) !important;
}

:where([class~="bg-primary/10"], [class~="bg-primary-container/20"]) {
  background-color: var(--accent-soft) !important;
}

:where([class~="bg-primary/20"], [class~="bg-primary-container/30"]) {
  background-color: var(--accent-strong) !important;
}

:where([class*="border-primary/"] , [class*="border-primary-container/"]) {
  border-color: var(--accent-border) !important;
}

:where([class~="from-primary"]) {
  --tw-gradient-from: var(--accent) var(--tw-gradient-from-position) !important;
  --tw-gradient-to: transparent var(--tw-gradient-to-position) !important;
}

:where([class~="to-primary-container"]) {
  --tw-gradient-to: var(--accent-hover) var(--tw-gradient-to-position) !important;
}

:where([class*="bg-primary-fixed-dim"]):hover {
  background-color: var(--accent-hover) !important;
}

:where(.text-on-primary, .text-on-primary-container) {
  color: var(--accent-ink) !important;
}

:where(.border-outline-variant) {
  border-color: var(--separator-strong) !important;
}

.rail {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  padding: 0.15rem 0.05rem 0.9rem;
  scroll-padding-inline: 0.05rem;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
}

.rail::-webkit-scrollbar,
.shelf-tabs::-webkit-scrollbar {
  display: none;
}

.rail > * {
  scroll-snap-align: start;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 9.3rem), 1fr));
  gap: 0.875rem;
}

.card,
.hero,
.segmented,
.catalog-form,
.searchbar,
.filter-grid {
  min-width: 0;
}

.card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--separator);
  border-radius: 1.35rem;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.08), var(--surface) 48%, rgba(255, 255, 255, 0.02));
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.045) inset, 0 9px 22px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  transition: transform 180ms ease-out, border-color 180ms ease-out, background-color 180ms ease-out, box-shadow 180ms ease-out;
}

.rail .card {
  flex: 0 0 9.5rem;
}

.card:has(button:focus-visible) {
  border-color: var(--accent-border);
}

.card button {
  display: flex;
  width: 100%;
  min-height: 100%;
  flex-direction: column;
  background: transparent;
  text-align: start;
}

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

.card img,
.card > button > div:first-child,
.card .w-full.h-full {
  aspect-ratio: 2 / 3;
}

.card img {
  background: #17171a;
  object-position: center;
}

.card-body {
  display: flex;
  min-height: 5.45rem;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.7rem 0.75rem 0.8rem;
}

.card-title {
  display: -webkit-box;
  overflow: hidden;
  color: var(--text);
  font-size: 0.8125rem;
  font-weight: 680;
  line-height: 1.25;
  letter-spacing: -0.012em;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

.meta {
  color: var(--text-secondary);
  font-size: 0.6875rem;
  line-height: 1.3;
}

.title-with-age {
  display: inline;
}

.age-badge {
  display: inline-block;
  margin-left: 0.38rem;
  border-radius: 0.42rem;
  padding: 0.08rem 0.3rem;
  vertical-align: 0.08em;
  font-size: 0.7em;
  font-weight: 750;
  line-height: 1.3;
  letter-spacing: 0.01em;
}

.age-badge-16 {
  background: rgba(255, 159, 10, 0.18);
  color: #ffb340;
}

.age-badge-18 {
  background: rgba(255, 69, 58, 0.18);
  color: #ff8a83;
}

.shelf-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
}

.shelf-card button,
.shelf-card .card-body {
  min-height: 0;
}

.shelf-card > button {
  flex-direction: row;
  align-items: center;
  gap: 0.7rem;
  padding: 0.65rem;
}

.shelf-card > button > img:first-child,
.shelf-card > button > div:first-child {
  width: 3.25rem;
  height: 4.85rem;
  flex: 0 0 3.25rem;
  overflow: hidden;
  border-radius: 0.78rem;
}

.shelf-card .card-body {
  padding: 0;
}

.shelf-progress {
  color: var(--accent-hover);
  font-size: 0.6875rem;
  font-weight: 700;
  line-height: 1.3;
}

.shelf-controls {
  display: flex;
  min-width: 7rem;
  align-items: center;
  padding: 0.65rem;
}

.shelf-controls select,
.catalog-form input,
.catalog-form select {
  width: 100%;
  border: 1px solid var(--separator-strong);
  border-radius: 0.95rem;
  background: rgba(9, 9, 11, 0.72);
  color: var(--text);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset;
}

.shelf-controls select {
  padding: 0.55rem 0.62rem;
  font-size: 0.75rem;
}

.segmented {
  display: inline-flex;
  gap: 0.18rem;
  padding: 0.22rem;
  border: 1px solid var(--separator);
  border-radius: 999px;
  background: rgba(17, 17, 20, 0.85);
}

.segmented button {
  border-radius: 999px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.8125rem;
  font-weight: 650;
  padding: 0.46rem 0.78rem;
}

.segmented button.active {
  background: var(--surface-raised);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.38), 0 1px 0 rgba(255, 255, 255, 0.06) inset;
}

.catalog-form {
  display: grid;
  gap: 0.75rem;
  margin: 0.5rem 0 1.1rem;
}

.searchbar,
.catalog-tools {
  display: flex;
  gap: 0.5rem;
}

.searchbar input {
  flex: 1 1 auto;
}

.catalog-form input,
.catalog-form select {
  padding: 0.7rem 0.8rem;
  font-size: 1rem;
}

.catalog-form input::placeholder {
  color: var(--text-tertiary);
}

.catalog-form .filter-active {
  border-color: var(--accent-border);
  background: var(--accent-soft);
  box-shadow: 0 0 0 1px var(--accent-strong) inset;
}

.searchbar button,
.primary {
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 8px 24px var(--accent-glow), 0 1px 0 rgba(255, 255, 255, 0.22) inset;
  font-size: 0.8125rem;
  font-weight: 720;
  padding: 0.7rem 1rem;
  transition: transform 160ms ease-out, background-color 160ms ease-out, box-shadow 160ms ease-out;
}

.searchbar button:active,
.primary:active {
  transform: scale(0.97);
  background: var(--accent-press);
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}

.catalog-select-field {
  display: block;
  min-width: 0;
}

.catalog-filter-toggle,
.catalog-reset,
.catalog-chip {
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 680;
}

.catalog-filter-toggle,
.catalog-reset {
  flex: 0 0 auto;
  border: 1px solid var(--separator-strong);
  background: rgba(28, 28, 30, 0.75);
  color: var(--text);
  padding: 0.56rem 0.75rem;
}

.catalog-chip {
  border: 1px solid var(--accent-border);
  background: var(--accent-soft);
  color: var(--accent-hover);
  padding: 0.38rem 0.62rem;
}

.catalog-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.38rem;
}

.catalog-status {
  min-height: 1.125rem;
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
}

.accent-picker-card {
  border: 1px solid var(--separator);
  border-radius: 1.25rem;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(28, 28, 30, 0.46) 52%, rgba(28, 28, 30, 0.58));
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.14) inset, 0 12px 28px rgba(0, 0, 0, 0.14);
  padding: 0.6rem;
  backdrop-filter: blur(30px) saturate(175%);
  -webkit-backdrop-filter: blur(30px) saturate(175%);
}

.accent-picker {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.4rem;
}

.accent-option {
  display: flex;
  min-width: 0;
  min-height: 4.15rem;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.34rem;
  border: 1px solid transparent;
  border-radius: 0.9rem;
  background: rgba(255, 255, 255, 0.035);
  color: var(--text-secondary);
  font-size: 0.625rem;
  font-weight: 650;
  line-height: 1.15;
  text-align: center;
  transition: transform 160ms ease-out, background-color 160ms ease-out, border-color 160ms ease-out, box-shadow 160ms ease-out, color 160ms ease-out;
}

.accent-option:active {
  transform: scale(0.94);
}

.accent-option.active {
  border-color: var(--accent-border);
  background: var(--accent-soft);
  color: var(--text);
  box-shadow: 0 0 0 1px var(--accent-strong) inset, 0 8px 20px var(--accent-glow);
}

.accent-swatch {
  width: 1.25rem;
  height: 1.25rem;
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 50%;
  background: var(--accent-choice);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.28) inset, 0 5px 12px rgba(0, 0, 0, 0.28);
}

.accent-option-label {
  overflow: hidden;
  max-width: 100%;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.accent-picker-hint {
  margin: 0.55rem 0.25rem 0.08rem;
  color: var(--text-secondary);
  font-size: 0.7rem;
  line-height: 1.35;
}

.catalog-loader {
  width: 100%;
  margin: 0.25rem 0 2rem;
}

.catalog-loader:disabled {
  cursor: wait;
  opacity: 0.6;
}

.catalog-loader-auto {
  display: block;
  height: 48px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  margin: -1px;
  padding: 0;
  border: 0;
  white-space: nowrap;
}

.collection-grid,
.subscription-grid,
.paywall-grid {
  display: grid;
  gap: 0.75rem;
}

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

.subscription-grid,
.paywall-grid {
  grid-template-columns: repeat(auto-fit, minmax(9.75rem, 1fr));
}

.collection-tile,
.release-row,
.paywall-plan {
  min-width: 0;
  border: 1px solid var(--separator);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.08), var(--surface) 48%, rgba(255, 255, 255, 0.02));
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.045) inset;
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
}

.collection-tile {
  display: flex;
  min-height: 5.25rem;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  border-radius: 1.15rem;
  color: var(--text);
  font-size: 0.75rem;
  font-weight: 680;
  padding: 0.7rem;
  text-align: start;
  transition: transform 160ms ease-out, background-color 160ms ease-out;
}

.collection-tile .material-symbols-outlined {
  color: var(--accent-hover);
}

.collection-tile:active {
  transform: scale(0.97);
  background: var(--surface-raised);
}

.release-list,
.updates-day,
.season-list {
  display: grid;
  gap: 0.55rem;
}

.release-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.62rem;
  border-radius: 1rem;
  color: var(--text);
  font-size: 0.8125rem;
  font-weight: 620;
  padding: 0.75rem;
  text-align: start;
}

.release-row span:nth-child(2) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.release-row-meta,
.updates-day-title {
  color: var(--text-tertiary);
  font-size: 0.6875rem;
  font-weight: 680;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}

.shelf-tabs {
  display: flex;
  gap: 0.45rem;
  overflow-x: auto;
  padding: 0.1rem 0 0.75rem;
  scrollbar-width: none;
}

.shelf-tabs button {
  flex: 0 0 auto;
  border: 1px solid var(--separator);
  border-radius: 999px;
  background: rgba(28, 28, 30, 0.74);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 650;
  padding: 0.5rem 0.7rem;
  transition: transform 160ms ease-out, background-color 160ms ease-out, color 160ms ease-out, border-color 160ms ease-out;
}

.shelf-tabs button.active {
  border-color: var(--accent-border);
  background: var(--accent-soft);
  color: var(--accent-hover);
}

.shelf-tabs button:active {
  transform: scale(0.96);
}

.paywall-plan {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.75rem;
  border-radius: 1.3rem;
  color: var(--text);
  padding: 0.95rem;
  text-align: start;
  transition: transform 180ms ease-out, border-color 180ms ease-out, background-color 180ms ease-out;
}

.paywall-plan.primary-plan {
  border-color: var(--accent-border);
  background: linear-gradient(135deg, var(--accent-strong), rgba(28, 28, 30, 0.7) 55%);
}

.paywall-plan.best-value-plan {
  border-color: rgba(48, 209, 88, 0.54);
  background: linear-gradient(135deg, rgba(48, 209, 88, 0.15), rgba(28, 28, 30, 0.94) 55%);
}

.paywall-plan-icon {
  color: var(--accent-hover);
}

.paywall-plan-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 0.22rem;
}

.paywall-plan-copy strong {
  font-size: 0.875rem;
  line-height: 1.2;
  letter-spacing: -0.012em;
}

.paywall-plan-copy small,
.paywall-trust {
  color: var(--text-secondary);
  font-size: 0.75rem;
  line-height: 1.35;
}

.paywall-price {
  display: inline-flex;
  align-items: center;
  gap: 0.12rem;
  border-radius: 999px;
  background: rgba(48, 209, 88, 0.16);
  color: #65e57f;
  font-size: 0.75rem;
  font-weight: 720;
  padding: 0.35rem 0.52rem;
}

.paywall-trust {
  max-width: 34rem;
  margin: 1rem auto 0;
  font-weight: 580;
  text-align: center;
}

.title-paywall-cta {
  bottom: calc(5.5rem + var(--app-safe-area-bottom));
  z-index: 60;
}

.hero {
  position: relative;
  min-height: clamp(16rem, 60vw, 25rem);
  overflow: hidden;
  border: 1px solid var(--separator);
  border-radius: 1.6rem;
  background: var(--surface);
  box-shadow: var(--shadow-elevation);
}

.hero > img,
.hero > div:first-child {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero::after {
  position: absolute;
  inset: 0;
  content: "";
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.3), transparent 65%),
    linear-gradient(to top, rgba(9, 9, 11, 0.98) 0%, rgba(9, 9, 11, 0.55) 46%, transparent 78%);
}

.hero-content {
  position: absolute;
  z-index: 1;
  right: 1.05rem;
  bottom: 1.05rem;
  left: 1.05rem;
}

.hero-content h1 {
  margin: 0;
  color: #fff;
  font-size: clamp(1.45rem, 6.5vw, 2.25rem);
  font-weight: 780;
  line-height: 1.04;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

.hero-content p {
  max-width: 34rem;
  margin: 0.52rem 0 0;
  color: rgba(245, 245, 247, 0.84);
  font-size: 0.875rem;
  line-height: 1.4;
}

.hero-content button {
  margin-top: 0.85rem;
}

.continue-banner-row,
.continue-banner-copy {
  min-width: 0;
}

.continue-cta {
  max-width: 45%;
  min-width: 0;
  flex: 0 1 auto;
  white-space: nowrap;
}

.season-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.65rem;
  border: 1px solid var(--separator);
  border-radius: 1rem;
  background: var(--surface-soft);
  color: var(--text);
  padding: 0.72rem;
  text-align: start;
  transition: transform 160ms ease-out, border-color 160ms ease-out, background-color 160ms ease-out;
}

.season-row.current {
  border-color: var(--accent-border);
  background: var(--accent-soft);
}

.season-row:active {
  transform: scale(0.985);
}

.unit-list-row,
.player-episode-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  gap: 0;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--separator);
  border-radius: 1rem;
  background: var(--surface-soft);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.14);
}

.unit-list-row > button:first-child,
.player-episode-item > .player-episode-row {
  min-width: 0;
  border-radius: 1rem 0 0 1rem !important;
}

.unit-completion-control {
  display: inline-grid;
  width: 3.25rem;
  min-height: 0;
  place-items: center;
  align-self: stretch;
  border: 0;
  border-left: 1px solid var(--separator);
  border-radius: 0;
  background: transparent;
  color: var(--text-secondary);
  transition: transform 160ms ease-out, background-color 160ms ease-out, border-color 160ms ease-out, color 160ms ease-out;
}

.unit-completion-control:hover {
  background: var(--accent-faint);
  color: var(--accent-hover);
}

.unit-completion-control:active {
  transform: scale(0.92);
}

.unit-completion-control.completed {
  background: var(--accent-soft);
  color: var(--accent-hover);
}

.unit-completion-control .material-symbols-outlined {
  font-size: 1.55rem;
  font-variation-settings: "FILL" 0, "wght" 560, "GRAD" 0, "opsz" 24;
}

.unit-completion-control.loading .material-symbols-outlined {
  animation: unit-completion-spin 850ms linear infinite;
}

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

.season-row-copy,
.player-episode-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 0.18rem;
}

.season-row-copy strong,
.player-episode-copy strong {
  overflow: hidden;
  font-size: 0.8125rem;
  font-weight: 680;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.season-row-copy small,
.player-episode-copy small {
  color: var(--text-secondary);
  font-size: 0.6875rem;
}

.reader-mode-btn,
.reader-page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  border-radius: 999px;
  background: rgba(44, 44, 46, 0.9);
  color: var(--text);
  font-size: 0.7rem;
  font-weight: 650;
  padding: 0.42rem 0.62rem;
  white-space: nowrap;
}

.reader-mode-btn.active,
.reader-page-btn:active {
  background: var(--accent);
  color: var(--accent-ink);
}

.reader-bottom-bar {
  padding-bottom: calc(0.5rem + var(--app-safe-area-bottom)) !important;
}

.reader-counter {
  align-self: center;
  max-width: min(100%, 26.25rem);
}

.player-screen {
  display: flex;
  width: 100%;
  height: 100dvh;
  flex-direction: column;
  overflow: hidden;
  background:
    radial-gradient(62% 38% at 50% 0%, var(--accent-ambient), transparent 72%),
    #08080a;
}

.player-stage {
  display: flex;
  width: 100%;
  min-height: 0;
  flex: 1 1 auto;
  align-items: flex-start;
  justify-content: center;
  padding: clamp(0.4rem, 2vw, 0.9rem);
}

.artplayer-app {
  width: min(100%, 61.25rem);
  max-height: 100%;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 1.25rem;
  aspect-ratio: 16 / 9;
  background: #000;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.54);
}

.embed-player-app {
  position: relative;
}

.embed-player-frame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #000;
}

.player-toolbar,
.player-panel {
  flex: 0 0 auto;
  border-color: var(--separator) !important;
  background: var(--material) !important;
  backdrop-filter: blur(36px) saturate(180%) brightness(1.06);
  -webkit-backdrop-filter: blur(36px) saturate(180%) brightness(1.06);
}

.player-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}

.player-action {
  min-height: 2.45rem;
  border: 1px solid var(--separator);
  border-radius: 0.85rem;
  background: rgba(44, 44, 46, 0.82);
  color: var(--text);
  font-size: 0.75rem;
  font-weight: 680;
  transition: transform 160ms ease-out, background-color 160ms ease-out, border-color 160ms ease-out;
}

.player-action:active {
  transform: scale(0.97);
}

.player-action.primary-action {
  border-color: transparent;
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 8px 22px var(--accent-glow);
}

.player-panel {
  padding-top: 0.65rem !important;
}

.player-episode-list {
  display: grid;
  max-height: 34vh;
  gap: 0.45rem;
  margin-top: 0.6rem;
  overflow-y: auto;
  padding-right: 0.1rem;
}

.player-episode-list[hidden],
.catalog-advanced[hidden] {
  display: none;
}

.player-episode-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  gap: 0;
  border: 0 !important;
  border-radius: 1rem 0 0 1rem !important;
  background: transparent;
  color: var(--text);
  padding: 0.65rem 0.75rem;
  text-align: start;
}

.player-episode-item .unit-completion-control {
  min-height: 0;
  height: 100%;
  border-radius: 0;
}

.player-episode-row.current {
  border-color: var(--accent-border);
  background: var(--accent-soft);
}

.player-episode-copy small {
  font-weight: 650;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.app-toast {
  position: fixed;
  z-index: 120;
  bottom: calc(6.15rem + var(--app-safe-area-bottom));
  left: 50%;
  max-width: min(92vw, 26.25rem);
  transform: translate(-50%, 0.75rem) scale(0.98);
  border: 1px solid rgba(235, 235, 245, 0.2);
  border-radius: 1rem;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.13), rgba(44, 44, 46, 0.68));
  box-shadow: var(--shadow-float);
  color: var(--text);
  font-size: 0.8125rem;
  font-weight: 650;
  opacity: 0;
  padding: 0.7rem 0.9rem;
  pointer-events: none;
  backdrop-filter: blur(34px) saturate(175%);
  transition: opacity 180ms ease-out, transform 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

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

.player-native-fullscreen {
  position: fixed !important;
  z-index: 100000 !important;
  inset: 0 !important;
  width: 100dvw !important;
  height: 100dvh !important;
  max-height: none !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: #000 !important;
  padding: 0 !important;
}

.player-native-fullscreen .artplayer-app,
.player-native-fullscreen .embed-player-frame,
.player-native-fullscreen video {
  width: 100% !important;
  height: 100% !important;
  max-height: none !important;
  border-radius: 0 !important;
}

.player-native-fullscreen .player-toolbar {
  display: none !important;
}

.player-native-fullscreen .player-panel {
  display: none !important;
}

.player-native-fullscreen .player-stage {
  min-height: 0 !important;
  flex: 1 1 auto !important;
  padding: 0 !important;
}

.player-native-fullscreen .artplayer-app {
  border: 0 !important;
  border-radius: 0 !important;
  aspect-ratio: auto !important;
  box-shadow: none !important;
}

body.reader-open .app-header,
body.reader-open .app-tabbar {
  display: none;
}

body.reader-open .app-view {
  gap: 0 !important;
  padding: 0 !important;
}

#top-bar,
#bottom-bar {
  border-color: var(--separator) !important;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.11), rgba(20, 20, 22, 0.48) 48%, rgba(20, 20, 22, 0.6)) !important;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.14) inset, 0 10px 28px rgba(0, 0, 0, 0.16);
  backdrop-filter: blur(40px) saturate(185%) brightness(1.08);
  -webkit-backdrop-filter: blur(40px) saturate(185%) brightness(1.08);
  transition: transform 260ms cubic-bezier(0.22, 1, 0.36, 1) !important;
  will-change: transform;
}

#top-bar.reader-chrome-hidden {
  transform: translate3d(0, calc(-100% - var(--app-safe-area-top)), 0) !important;
}

#bottom-bar.reader-chrome-hidden {
  transform: translate3d(0, calc(100% + var(--app-safe-area-bottom) + 0.75rem), 0) !important;
}

.hide-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.hide-scrollbar::-webkit-scrollbar {
  display: none;
}

@media (hover: hover) and (pointer: fine) {
  .app-toolbar-button:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #9dd0ff;
  }

  .app-tab:hover:not(.nav-btn-active) {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
  }

  .card:hover {
    transform: translateY(-2px);
    border-color: rgba(235, 235, 245, 0.25);
    background: rgba(44, 44, 46, 0.94);
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.28), 0 1px 0 rgba(255, 255, 255, 0.06) inset;
  }

  .paywall-plan:hover,
  .season-row:hover,
  .release-row:hover {
    border-color: var(--accent-border);
  }

  .searchbar button:hover,
  .primary:hover,
  .player-action.primary-action:hover {
    background: var(--accent-hover);
  }
}

@media (max-width: 26.25rem) {
  .app-view {
    padding-inline: 0.875rem;
  }

  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .rail .card {
    flex-basis: 8.65rem;
  }

  .collection-grid {
    grid-template-columns: repeat(3, minmax(5.75rem, 1fr));
    overflow-x: auto;
  }

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

  .continue-banner-copy {
    max-width: 56% !important;
  }

  .continue-cta {
    max-width: 44%;
    font-size: 0.75rem;
    padding-inline: 0.75rem;
  }
}

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

  #view > * {
    animation: none;
  }
}

@media (prefers-reduced-transparency: reduce) {
  .app-header,
  .app-tabbar,
  .player-toolbar,
  .player-panel,
  #top-bar,
  #bottom-bar,
  .app-toast,
  .offline-action-bar,
  .accent-picker-card,
  .card,
  .collection-tile,
  .release-row,
  .paywall-plan {
    background: #1c1c1e !important;
    background-image: none !important;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}

@media (prefers-contrast: more) {
  :root {
    --separator: rgba(255, 255, 255, 0.5);
    --separator-strong: rgba(255, 255, 255, 0.72);
    --text-secondary: #d1d1d6;
  }

  .card,
  .collection-tile,
  .release-row,
  .paywall-plan,
  .season-row,
  .player-episode-row {
    border-width: 2px;
  }
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .app-header,
  .app-tabbar,
  .player-toolbar,
  .player-panel,
  #top-bar,
  #bottom-bar {
    background: #1c1c1e !important;
  }
}
