
/*
 * @theme   default
 * @label   OmniFlix (default)
 * @scheme  dark
 *
 * The original OmniFin look. This file also defines the fallback value of
 * EVERY token: other themes only override what they change.
 * Colours are "R G B" triplets so they work with opacity: rgb(var(--zn-bg) / 0.5).
 */
:root,
[data-theme] {
    color-scheme: dark;

    /* Backgrounds & surfaces */
    --zn-bg: 13 13 20;               /* page background */
    --zn-surface: 19 19 31;          /* cards, sidebar, panels */
    --zn-surface-2: 26 26 46;        /* inputs, selects, raised elements */
    --zn-overlay: 20 20 38;          /* popovers, modals (used with alpha) */

    /* Text. --zn-fg is the base foreground: also used with alpha for
       hairline borders, hover fills and dividers. */
    --zn-fg: 255 255 255;
    --zn-text: 243 244 246;          /* headings, primary text */
    --zn-text-soft: 229 231 235;     /* body text */
    --zn-muted: 156 163 175;         /* secondary text */
    --zn-subtle: 107 114 128;        /* hints, disabled */

    /* Accent (brand colour) */
    --zn-accent: 139 92 246;         /* icons, highlights, tints */
    --zn-accent-strong: 124 58 237;  /* buttons, active fills */
    --zn-accent-hover: 109 40 217;   /* button hover */
    --zn-accent-soft: 167 139 250;   /* accent-coloured text */
    --zn-accent-softer: 196 181 253; /* subtle accent text / badges */
    --zn-accent-2: 79 70 229;        /* second gradient stop */
    --zn-on-accent: 255 255 255;     /* text on accent buttons */
    --zn-focus: 139 92 246;          /* focus rings */

    /* Status */
    --zn-danger: 248 113 113;
    --zn-danger-strong: 239 68 68;
    --zn-danger-text: 252 165 165;
    --zn-success: 74 222 128;
    --zn-success-text: 134 239 172;
    --zn-warning: 251 191 36;
    --zn-info: 59 130 246;
    --zn-info-text: 147 197 253;

    /* Decorative */
    --zn-glow-1: 99 32 186;          /* login page glow, top right */
    --zn-glow-2: 30 58 138;          /* login page glow, bottom left */
    --zn-backdrop-gradient: radial-gradient(circle at 20% 20%, #2f1d57 0%, #120f24 50%, #09070f 100%);
    --zn-shadow: 0 0 0;              /* shadow colour */

    /* Shape & type */
    --zn-roundness: 1;               /* 0 = square corners, 1 = default, 1.5 = rounder */
    --zn-font-sans: 'Inter', sans-serif;
    --zn-font-display: 'Nunito', sans-serif;
}

/*
 * @theme   light
 * @label   Daylight
 * @scheme  light
 */
[data-theme="light"] {
    color-scheme: light;

    --zn-bg: 243 244 248;
    --zn-surface: 255 255 255;
    --zn-surface-2: 234 235 242;
    --zn-overlay: 255 255 255;

    --zn-fg: 17 17 27;
    --zn-text: 17 24 39;
    --zn-text-soft: 55 65 81;
    --zn-muted: 92 99 112;
    --zn-subtle: 140 147 160;

    --zn-accent: 124 58 237;
    --zn-accent-strong: 109 40 217;
    --zn-accent-hover: 91 33 182;
    --zn-accent-soft: 109 40 217;
    --zn-accent-softer: 91 33 182;
    --zn-accent-2: 79 70 229;
    --zn-focus: 124 58 237;

    --zn-danger: 220 38 38;
    --zn-danger-strong: 220 38 38;
    --zn-danger-text: 185 28 28;
    --zn-success: 22 163 74;
    --zn-success-text: 21 128 61;
    --zn-warning: 217 119 6;
    --zn-info: 37 99 235;
    --zn-info-text: 29 78 216;

    --zn-glow-1: 167 139 250;
    --zn-glow-2: 147 197 253;
    --zn-backdrop-gradient: radial-gradient(circle at 20% 20%, #ede9fe 0%, #f5f3ff 50%, #f3f4f8 100%);
    --zn-shadow: 15 23 42;
}

/*
 * @theme   amoled
 * @label   AMOLED Black
 * @scheme  dark
 */
[data-theme="amoled"] {
    --zn-bg: 0 0 0;
    --zn-surface: 10 10 12;
    --zn-surface-2: 22 22 26;
    --zn-overlay: 12 12 14;

    --zn-backdrop-gradient: radial-gradient(circle at 20% 20%, #1a1030 0%, #050308 50%, #000 100%);
    --zn-glow-1: 76 29 149;
    --zn-glow-2: 23 37 84;
}

/*
 * @theme   sakura
 * @label   Sakura
 * @scheme  dark
 */
[data-theme="sakura"] {
    --zn-bg: 18 12 18;
    --zn-surface: 28 19 28;
    --zn-surface-2: 40 27 40;
    --zn-overlay: 34 22 34;

    --zn-accent: 236 72 153;
    --zn-accent-strong: 219 39 119;
    --zn-accent-hover: 190 24 93;
    --zn-accent-soft: 244 114 182;
    --zn-accent-softer: 251 207 232;
    --zn-accent-2: 168 85 247;
    --zn-focus: 244 114 182;

    --zn-glow-1: 190 24 93;
    --zn-glow-2: 88 28 135;
    --zn-backdrop-gradient: radial-gradient(circle at 20% 20%, #5b1a3c 0%, #1f0d1a 50%, #0b050a 100%);

    --zn-roundness: 1.4;
    --zn-font-display: 'Nunito', sans-serif;
}

/*
 * @theme   crimson
 * @label   Crimson Black
 * @scheme  dark
 */
[data-theme="crimson"] {
    --zn-bg: 8 6 7;
    --zn-surface: 18 13 14;
    --zn-surface-2: 30 21 23;
    --zn-overlay: 22 15 16;

    --zn-accent: 239 68 68;
    --zn-accent-strong: 220 38 38;
    --zn-accent-hover: 185 28 28;
    --zn-accent-soft: 248 113 113;
    --zn-accent-softer: 254 202 202;
    --zn-accent-2: 159 18 57;
    --zn-focus: 248 113 113;

    /* Errors must still stand out from the red accent. */
    --zn-danger: 251 146 60;
    --zn-danger-strong: 234 88 12;
    --zn-danger-text: 253 186 116;

    --zn-glow-1: 153 27 27;
    --zn-glow-2: 69 10 10;
    --zn-backdrop-gradient: radial-gradient(circle at 20% 20%, #4a0d0d 0%, #160707 50%, #050303 100%);
}

/*
 * @theme   emerald
 * @label   Emerald Black
 * @scheme  dark
 */
[data-theme="emerald"] {
    --zn-bg: 6 9 8;
    --zn-surface: 12 19 16;
    --zn-surface-2: 20 31 27;
    --zn-overlay: 15 23 20;

    --zn-accent: 16 185 129;
    --zn-accent-strong: 5 150 105;
    --zn-accent-hover: 4 120 87;
    --zn-accent-soft: 52 211 153;
    --zn-accent-softer: 167 243 208;
    --zn-accent-2: 13 148 136;
    --zn-on-accent: 255 255 255;
    --zn-focus: 52 211 153;

    --zn-glow-1: 6 95 70;
    --zn-glow-2: 19 78 74;
    --zn-backdrop-gradient: radial-gradient(circle at 20% 20%, #0b3b2c 0%, #07140f 50%, #030605 100%);
}

/*
 * @theme   ember
 * @label   Ember Black
 * @scheme  dark
 */
[data-theme="ember"] {
    --zn-bg: 9 7 5;
    --zn-surface: 20 15 11;
    --zn-surface-2: 32 24 17;
    --zn-overlay: 24 18 13;

    --zn-accent: 249 115 22;
    --zn-accent-strong: 234 88 12;
    --zn-accent-hover: 194 65 12;
    --zn-accent-soft: 251 146 60;
    --zn-accent-softer: 254 215 170;
    --zn-accent-2: 220 38 38;
    --zn-focus: 251 146 60;

    --zn-glow-1: 154 52 18;
    --zn-glow-2: 87 31 10;
    --zn-backdrop-gradient: radial-gradient(circle at 20% 20%, #4a1f08 0%, #170c05 50%, #060403 100%);
}

/*
 * Theme plumbing. Theme authors do not need to touch this file:
 * see THEMES.md and app/src/css/themes/.
 */

:root {
    /* Derived tokens: themes normally only set --zn-roundness. */
    --zn-radius-sm: calc(6px * var(--zn-roundness));
    --zn-radius: calc(8px * var(--zn-roundness));
    --zn-radius-lg: calc(12px * var(--zn-roundness));
    --zn-shadow-card: 0 4px 24px rgb(var(--zn-shadow) / 0.35);
}

html {
    background-color: rgb(var(--zn-bg));
    color: rgb(var(--zn-text));
}

:focus-visible {
    outline: 2px solid rgb(var(--zn-focus) / 0.8);
    outline-offset: 2px;
}

/*
! tailwindcss v3.2.4 | MIT License | https://tailwindcss.com
*/

/*
1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4)
2. Allow adding a border to an element by just adding a border-width. (https://github.com/tailwindcss/tailwindcss/pull/116)
*/

*,
::before,
::after {
  box-sizing: border-box; /* 1 */
  border-width: 0; /* 2 */
  border-style: solid; /* 2 */
  border-color: #e5e7eb; /* 2 */
}

::before,
::after {
  --tw-content: '';
}

/*
1. Use a consistent sensible line-height in all browsers.
2. Prevent adjustments of font size after orientation changes in iOS.
3. Use a more readable tab size.
4. Use the user's configured `sans` font-family by default.
5. Use the user's configured `sans` font-feature-settings by default.
*/

html {
  line-height: 1.5; /* 1 */
  -webkit-text-size-adjust: 100%; /* 2 */
  -moz-tab-size: 4; /* 3 */
  -o-tab-size: 4;
     tab-size: 4; /* 3 */
  font-family: var(--zn-font-sans); /* 4 */
  font-feature-settings: normal; /* 5 */
}

/*
1. Remove the margin in all browsers.
2. Inherit line-height from `html` so users can set them as a class directly on the `html` element.
*/

body {
  margin: 0; /* 1 */
  line-height: inherit; /* 2 */
}

/*
1. Add the correct height in Firefox.
2. Correct the inheritance of border color in Firefox. (https://bugzilla.mozilla.org/show_bug.cgi?id=190655)
3. Ensure horizontal rules are visible by default.
*/

hr {
  height: 0; /* 1 */
  color: inherit; /* 2 */
  border-top-width: 1px; /* 3 */
}

/*
Add the correct text decoration in Chrome, Edge, and Safari.
*/

abbr:where([title]) {
  text-decoration: underline;
  -webkit-text-decoration: underline dotted currentColor;
          text-decoration: underline dotted currentColor;
}

/*
Remove the default font size and weight for headings.
*/

h1,
h2,
h3,
h4,
h5,
h6 {
  font-size: inherit;
  font-weight: inherit;
}

/*
Reset links to optimize for opt-in styling instead of opt-out.
*/

a {
  color: inherit;
  text-decoration: inherit;
}

/*
Add the correct font weight in Edge and Safari.
*/

b,
strong {
  font-weight: bolder;
}

/*
1. Use the user's configured `mono` font family by default.
2. Correct the odd `em` font sizing in all browsers.
*/

code,
kbd,
samp,
pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; /* 1 */
  font-size: 1em; /* 2 */
}

/*
Add the correct font size in all browsers.
*/

small {
  font-size: 80%;
}

/*
Prevent `sub` and `sup` elements from affecting the line height in all browsers.
*/

sub,
sup {
  font-size: 75%;
  line-height: 0;
  position: relative;
  vertical-align: baseline;
}

sub {
  bottom: -0.25em;
}

sup {
  top: -0.5em;
}

/*
1. Remove text indentation from table contents in Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=999088, https://bugs.webkit.org/show_bug.cgi?id=201297)
2. Correct table border color inheritance in all Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=935729, https://bugs.webkit.org/show_bug.cgi?id=195016)
3. Remove gaps between table borders by default.
*/

table {
  text-indent: 0; /* 1 */
  border-color: inherit; /* 2 */
  border-collapse: collapse; /* 3 */
}

/*
1. Change the font styles in all browsers.
2. Remove the margin in Firefox and Safari.
3. Remove default padding in all browsers.
*/

button,
input,
optgroup,
select,
textarea {
  font-family: inherit; /* 1 */
  font-size: 100%; /* 1 */
  font-weight: inherit; /* 1 */
  line-height: inherit; /* 1 */
  color: inherit; /* 1 */
  margin: 0; /* 2 */
  padding: 0; /* 3 */
}

/*
Remove the inheritance of text transform in Edge and Firefox.
*/

button,
select {
  text-transform: none;
}

/*
1. Correct the inability to style clickable types in iOS and Safari.
2. Remove default button styles.
*/

button,
[type='button'],
[type='reset'],
[type='submit'] {
  -webkit-appearance: button; /* 1 */
  background-color: transparent; /* 2 */
  background-image: none; /* 2 */
}

/*
Use the modern Firefox focus style for all focusable elements.
*/

:-moz-focusring {
  outline: auto;
}

/*
Remove the additional `:invalid` styles in Firefox. (https://github.com/mozilla/gecko-dev/blob/2f9eacd9d3d995c937b4251a5557d95d494c9be1/layout/style/res/forms.css#L728-L737)
*/

:-moz-ui-invalid {
  box-shadow: none;
}

/*
Add the correct vertical alignment in Chrome and Firefox.
*/

progress {
  vertical-align: baseline;
}

/*
Correct the cursor style of increment and decrement buttons in Safari.
*/

::-webkit-inner-spin-button,
::-webkit-outer-spin-button {
  height: auto;
}

/*
1. Correct the odd appearance in Chrome and Safari.
2. Correct the outline style in Safari.
*/

[type='search'] {
  -webkit-appearance: textfield; /* 1 */
  outline-offset: -2px; /* 2 */
}

/*
Remove the inner padding in Chrome and Safari on macOS.
*/

::-webkit-search-decoration {
  -webkit-appearance: none;
}

/*
1. Correct the inability to style clickable types in iOS and Safari.
2. Change font properties to `inherit` in Safari.
*/

::-webkit-file-upload-button {
  -webkit-appearance: button; /* 1 */
  font: inherit; /* 2 */
}

/*
Add the correct display in Chrome and Safari.
*/

summary {
  display: list-item;
}

/*
Removes the default spacing and border for appropriate elements.
*/

blockquote,
dl,
dd,
h1,
h2,
h3,
h4,
h5,
h6,
hr,
figure,
p,
pre {
  margin: 0;
}

fieldset {
  margin: 0;
  padding: 0;
}

legend {
  padding: 0;
}

ol,
ul,
menu {
  list-style: none;
  margin: 0;
  padding: 0;
}

/*
Prevent resizing textareas horizontally by default.
*/

textarea {
  resize: vertical;
}

/*
1. Reset the default placeholder opacity in Firefox. (https://github.com/tailwindlabs/tailwindcss/issues/3300)
2. Set the default placeholder color to the user's configured gray 400 color.
*/

input::-moz-placeholder, textarea::-moz-placeholder {
  opacity: 1; /* 1 */
  color: #9ca3af; /* 2 */
}

input::placeholder,
textarea::placeholder {
  opacity: 1; /* 1 */
  color: #9ca3af; /* 2 */
}

/*
Set the default cursor for buttons.
*/

button,
[role="button"] {
  cursor: pointer;
}

/*
Make sure disabled buttons don't get the pointer cursor.
*/

:disabled {
  cursor: default;
}

/*
1. Make replaced elements `display: block` by default. (https://github.com/mozdevs/cssremedy/issues/14)
2. Add `vertical-align: middle` to align replaced elements more sensibly by default. (https://github.com/jensimmons/cssremedy/issues/14#issuecomment-634934210)
   This can trigger a poorly considered lint error in some tools but is included by design.
*/

img,
svg,
video,
canvas,
audio,
iframe,
embed,
object {
  display: block; /* 1 */
  vertical-align: middle; /* 2 */
}

/*
Constrain images and videos to the parent width and preserve their intrinsic aspect ratio. (https://github.com/mozdevs/cssremedy/issues/14)
*/

img,
video {
  max-width: 100%;
  height: auto;
}

/* Make elements with the HTML hidden attribute stay hidden by default */

[hidden] {
  display: none;
}

*, ::before, ::after{
  --tw-border-spacing-x: 0;
  --tw-border-spacing-y: 0;
  --tw-translate-x: 0;
  --tw-translate-y: 0;
  --tw-rotate: 0;
  --tw-skew-x: 0;
  --tw-skew-y: 0;
  --tw-scale-x: 1;
  --tw-scale-y: 1;
  --tw-pan-x:  ;
  --tw-pan-y:  ;
  --tw-pinch-zoom:  ;
  --tw-scroll-snap-strictness: proximity;
  --tw-ordinal:  ;
  --tw-slashed-zero:  ;
  --tw-numeric-figure:  ;
  --tw-numeric-spacing:  ;
  --tw-numeric-fraction:  ;
  --tw-ring-inset:  ;
  --tw-ring-offset-width: 0px;
  --tw-ring-offset-color: #fff;
  --tw-ring-color: rgba(59, 130, 246, 0.5);
  --tw-ring-offset-shadow: 0 0 rgba(0,0,0,0);
  --tw-ring-shadow: 0 0 rgba(0,0,0,0);
  --tw-shadow: 0 0 rgba(0,0,0,0);
  --tw-shadow-colored: 0 0 rgba(0,0,0,0);
  --tw-blur:  ;
  --tw-brightness:  ;
  --tw-contrast:  ;
  --tw-grayscale:  ;
  --tw-hue-rotate:  ;
  --tw-invert:  ;
  --tw-saturate:  ;
  --tw-sepia:  ;
  --tw-drop-shadow:  ;
  --tw-backdrop-blur:  ;
  --tw-backdrop-brightness:  ;
  --tw-backdrop-contrast:  ;
  --tw-backdrop-grayscale:  ;
  --tw-backdrop-hue-rotate:  ;
  --tw-backdrop-invert:  ;
  --tw-backdrop-opacity:  ;
  --tw-backdrop-saturate:  ;
  --tw-backdrop-sepia:  ;
}

::backdrop{
  --tw-border-spacing-x: 0;
  --tw-border-spacing-y: 0;
  --tw-translate-x: 0;
  --tw-translate-y: 0;
  --tw-rotate: 0;
  --tw-skew-x: 0;
  --tw-skew-y: 0;
  --tw-scale-x: 1;
  --tw-scale-y: 1;
  --tw-pan-x:  ;
  --tw-pan-y:  ;
  --tw-pinch-zoom:  ;
  --tw-scroll-snap-strictness: proximity;
  --tw-ordinal:  ;
  --tw-slashed-zero:  ;
  --tw-numeric-figure:  ;
  --tw-numeric-spacing:  ;
  --tw-numeric-fraction:  ;
  --tw-ring-inset:  ;
  --tw-ring-offset-width: 0px;
  --tw-ring-offset-color: #fff;
  --tw-ring-color: rgba(59, 130, 246, 0.5);
  --tw-ring-offset-shadow: 0 0 rgba(0,0,0,0);
  --tw-ring-shadow: 0 0 rgba(0,0,0,0);
  --tw-shadow: 0 0 rgba(0,0,0,0);
  --tw-shadow-colored: 0 0 rgba(0,0,0,0);
  --tw-blur:  ;
  --tw-brightness:  ;
  --tw-contrast:  ;
  --tw-grayscale:  ;
  --tw-hue-rotate:  ;
  --tw-invert:  ;
  --tw-saturate:  ;
  --tw-sepia:  ;
  --tw-drop-shadow:  ;
  --tw-backdrop-blur:  ;
  --tw-backdrop-brightness:  ;
  --tw-backdrop-contrast:  ;
  --tw-backdrop-grayscale:  ;
  --tw-backdrop-hue-rotate:  ;
  --tw-backdrop-invert:  ;
  --tw-backdrop-opacity:  ;
  --tw-backdrop-saturate:  ;
  --tw-backdrop-sepia:  ;
}
.sr-only{
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}
.pointer-events-auto{
  pointer-events: auto;
}
.visible{
  visibility: visible;
}
.invisible{
  visibility: hidden;
}
.static{
  position: static;
}
.fixed{
  position: fixed;
}
.top-0{
  top: 0px;
}
.right-0{
  right: 0px;
}
.z-20{
  z-index: 20;
}
.mx-auto{
  margin-left: auto;
  margin-right: auto;
}
.mb-4{
  margin-bottom: 1rem;
}
.mb-8{
  margin-bottom: 2rem;
}
.mt-2{
  margin-top: 0.5rem;
}
.mb-6{
  margin-bottom: 1.5rem;
}
.mb-5{
  margin-bottom: 1.25rem;
}
.mb-2{
  margin-bottom: 0.5rem;
}
.mb-7{
  margin-bottom: 1.75rem;
}
.mr-2{
  margin-right: 0.5rem;
}
.mb-3{
  margin-bottom: 0.75rem;
}
.ml-2{
  margin-left: 0.5rem;
}
.box-content{
  box-sizing: content-box;
}
.block{
  display: block;
}
.flex{
  display: flex;
}
.grid{
  display: grid;
}
.hidden{
  display: none;
}
.h-screen{
  height: 100vh;
}
.h-4{
  height: 1rem;
}
.h-16{
  height: 4rem;
}
.h-full{
  height: 100%;
}
.min-h-screen{
  min-height: 100vh;
}
.w-full{
  width: 100%;
}
.w-auto{
  width: auto;
}
.w-4{
  width: 1rem;
}
.w-20{
  width: 5rem;
}
.w-16{
  width: 4rem;
}
.max-w-md{
  max-width: 28rem;
}
.max-w-full{
  max-width: 100%;
}
.grow{
  flex-grow: 1;
}
.cursor-pointer{
  cursor: pointer;
}
.select-none{
  -webkit-user-select: none;
     -moz-user-select: none;
          user-select: none;
}
.flex-col{
  flex-direction: column;
}
.flex-wrap{
  flex-wrap: wrap;
}
.items-center{
  align-items: center;
}
.justify-center{
  justify-content: center;
}
.justify-between{
  justify-content: space-between;
}
.gap-2{
  gap: 0.5rem;
}
.gap-5{
  gap: 1.25rem;
}
.overflow-hidden{
  overflow: hidden;
}
.truncate{
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.break-words{
  word-wrap: break-word;
}
.rounded-full{
  border-radius: 9999px;
}
.rounded-xl{
  border-radius: 0.75rem;
}
.rounded-lg{
  border-radius: 0.5rem;
}
.rounded{
  border-radius: 0.25rem;
}
.rounded-none{
  border-radius: 0px;
}
.rounded-t-lg{
  border-top-left-radius: 0.5rem;
  border-top-right-radius: 0.5rem;
}
.rounded-b-lg{
  border-bottom-right-radius: 0.5rem;
  border-bottom-left-radius: 0.5rem;
}
.border{
  border-width: 1px;
}
.border-b{
  border-bottom-width: 1px;
}
.border-none{
  border-style: none;
}
.border-zn-danger-strong\/60{
  border-color: rgb(var(--zn-danger-strong) / 0.6);
}
.border-green-400{
  --tw-border-opacity: 1;
  border-color: rgba(74, 222, 128, var(--tw-border-opacity));
}
.border-yellow-400{
  --tw-border-opacity: 1;
  border-color: rgba(250, 204, 21, var(--tw-border-opacity));
}
.border-red-500{
  --tw-border-opacity: 1;
  border-color: rgba(239, 68, 68, var(--tw-border-opacity));
}
.bg-zn-bg{
  --tw-bg-opacity: 1;
  background-color: rgb(var(--zn-bg) / var(--tw-bg-opacity));
}
.bg-zn-accent-strong{
  --tw-bg-opacity: 1;
  background-color: rgb(var(--zn-accent-strong) / var(--tw-bg-opacity));
}
.bg-zn-danger-strong\/20{
  background-color: rgb(var(--zn-danger-strong) / 0.2);
}
.bg-zanime-bg{
  --tw-bg-opacity: 1;
  background-color: rgb(var(--zn-bg) / var(--tw-bg-opacity));
}
.bg-green-500{
  --tw-bg-opacity: 1;
  background-color: rgba(34, 197, 94, var(--tw-bg-opacity));
}
.bg-yellow-500{
  --tw-bg-opacity: 1;
  background-color: rgba(234, 179, 8, var(--tw-bg-opacity));
}
.bg-red-600{
  --tw-bg-opacity: 1;
  background-color: rgba(220, 38, 38, var(--tw-bg-opacity));
}
.bg-zn-surface{
  --tw-bg-opacity: 1;
  background-color: rgb(var(--zn-surface) / var(--tw-bg-opacity));
}
.bg-clip-padding{
  background-clip: padding-box;
}
.fill-current{
  fill: currentColor;
}
.object-cover{
  -o-object-fit: cover;
     object-fit: cover;
}
.p-8{
  padding: 2rem;
}
.p-3{
  padding: 0.75rem;
}
.px-4{
  padding-left: 1rem;
  padding-right: 1rem;
}
.py-2{
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}
.py-3{
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
}
.px-3{
  padding-left: 0.75rem;
  padding-right: 0.75rem;
}
.text-center{
  text-align: center;
}
.text-6xl{
  font-size: 3.75rem;
  line-height: 1;
}
.text-xl{
  font-size: 1.25rem;
  line-height: 1.75rem;
}
.text-4xl{
  font-size: 2.25rem;
  line-height: 2.5rem;
}
.text-sm{
  font-size: 0.875rem;
  line-height: 1.25rem;
}
.text-xs{
  font-size: 0.75rem;
  line-height: 1rem;
}
.font-bold{
  font-weight: 700;
}
.font-semibold{
  font-weight: 600;
}
.uppercase{
  text-transform: uppercase;
}
.tracking-widest{
  letter-spacing: 0.1em;
}
.tracking-wider{
  letter-spacing: 0.05em;
}
.text-zn-text{
  --tw-text-opacity: 1;
  color: rgb(var(--zn-text) / var(--tw-text-opacity));
}
.text-zn-muted{
  --tw-text-opacity: 1;
  color: rgb(var(--zn-muted) / var(--tw-text-opacity));
}
.text-zn-on-accent{
  --tw-text-opacity: 1;
  color: rgb(var(--zn-on-accent) / var(--tw-text-opacity));
}
.text-zanime-muted{
  --tw-text-opacity: 1;
  color: rgb(var(--zn-muted) / var(--tw-text-opacity));
}
.text-zn-danger-text{
  --tw-text-opacity: 1;
  color: rgb(var(--zn-danger-text) / var(--tw-text-opacity));
}
.text-white{
  --tw-text-opacity: 1;
  color: rgba(255, 255, 255, var(--tw-text-opacity));
}
.text-zn-fg{
  --tw-text-opacity: 1;
  color: rgb(var(--zn-fg) / var(--tw-text-opacity));
}
.no-underline{
  text-decoration-line: none;
}
.opacity-50{
  opacity: 0.5;
}
.shadow-lg{
  --tw-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  --tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);
  box-shadow: 0 0 rgba(0,0,0,0), 0 0 rgba(0,0,0,0), var(--tw-shadow);
  box-shadow: var(--tw-ring-offset-shadow, 0 0 rgba(0,0,0,0)), var(--tw-ring-shadow, 0 0 rgba(0,0,0,0)), var(--tw-shadow);
}
.shadow{
  --tw-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
  --tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);
  box-shadow: 0 0 rgba(0,0,0,0), 0 0 rgba(0,0,0,0), var(--tw-shadow);
  box-shadow: var(--tw-ring-offset-shadow, 0 0 rgba(0,0,0,0)), var(--tw-ring-shadow, 0 0 rgba(0,0,0,0)), var(--tw-shadow);
}
.outline{
  outline-style: solid;
}
.ring-2{
  --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);
  --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);
  box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), 0 0 rgba(0,0,0,0);
  box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 rgba(0,0,0,0));
}
.ring-zn-accent{
  --tw-ring-opacity: 1;
  --tw-ring-color: rgb(var(--zn-accent) / var(--tw-ring-opacity));
}
.ring-transparent{
  --tw-ring-color: transparent;
}
.blur{
  --tw-blur: blur(8px);
  filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);
}
.filter{
  filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);
}
.transition{
  transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, -webkit-backdrop-filter;
  transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;
  transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter, -webkit-backdrop-filter;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  transition-duration: 150ms;
}
.transition-all{
  transition-property: all;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  transition-duration: 150ms;
}
.duration-200{
  transition-duration: 200ms;
}

/* @import './css/app.css'; */

.hover\:bg-zn-accent-hover:hover{
  --tw-bg-opacity: 1;
  background-color: rgb(var(--zn-accent-hover) / var(--tw-bg-opacity));
}

.hover\:text-white:hover{
  --tw-text-opacity: 1;
  color: rgba(255, 255, 255, var(--tw-text-opacity));
}

.hover\:no-underline:hover{
  text-decoration-line: none;
}

.hover\:opacity-75:hover{
  opacity: 0.75;
}

.focus\:opacity-100:focus{
  opacity: 1;
}

.focus\:shadow-none:focus{
  --tw-shadow: 0 0 rgba(0,0,0,0);
  --tw-shadow-colored: 0 0 rgba(0,0,0,0);
  box-shadow: 0 0 rgba(0,0,0,0), 0 0 rgba(0,0,0,0), var(--tw-shadow);
  box-shadow: var(--tw-ring-offset-shadow, 0 0 rgba(0,0,0,0)), var(--tw-ring-shadow, 0 0 rgba(0,0,0,0)), var(--tw-shadow);
}

.focus\:outline-none:focus{
  outline: 2px solid transparent;
  outline-offset: 2px;
}

.group:hover .group-hover\:scale-105{
  --tw-scale-x: 1.05;
  --tw-scale-y: 1.05;
  transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
}

.group:hover .group-hover\:ring-zn-fg\/40{
  --tw-ring-color: rgb(var(--zn-fg) / 0.4);
}

@media only screen and (max-width: 900px) { 

}

@media only screen and (max-width: 360px) { 

}
/* KEYFRAMES */
@keyframes animateWidth {
    0% {
        width: 0px;
    }
    100% {
        width: 100%;
    }
}

@keyframes spinCircle {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.veloz-fade-element {
    opacity: 0;
    transition: opacity 1s;
}

/* CSS class for fading from the left */
.veloz-fade-element.fade-left {
    /* transform: translateX(-100%); */
    transition: opacity 1s, transform 1s;
}

/* CSS class for fading from the right */
.veloz-fade-element.fade-right {
    /* transform: translateX(100%); */
    transition: opacity 1s, transform 1s;
}
/* ============================================================
   OmniFin — Main application layout
   ============================================================ */

.zanime-body {
    height: 100vh;
    overflow: hidden;
}

.zanime-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ============================================================
   Sidebar
   ============================================================ */

.zanime-sidebar {
    width: 260px;
    flex-shrink: 0;
    background: rgb(var(--zn-surface));
    border-right: 1px solid rgb(var(--zn-fg) / 0.06);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-header {
    padding: 1.5rem 1.25rem 1rem;
}

.sidebar-logo {
    display: flex;
    align-items: baseline;
    gap: 0;
    text-decoration: none;
}

.sidebar-logo-z {
    font-size: 1.375rem;
    font-weight: 800;
    color: rgb(var(--zn-accent));
    line-height: 1;
}

.sidebar-logo-name {
    font-size: 1.375rem;
    font-weight: 700;
    color: rgb(var(--zn-fg));
    letter-spacing: 0.04em;
}

/* Search */

.sidebar-search-wrapper {
    position: relative;
    margin: 0 1rem 0.75rem;
}

.sidebar-search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 0.875rem;
    height: 0.875rem;
    color: rgb(var(--zn-fg) / 0.3);
    pointer-events: none;
}

.sidebar-search-input {
    width: 100%;
    background: rgb(var(--zn-fg) / 0.06);
    border: 1px solid rgb(var(--zn-fg) / 0.08);
    border-radius: calc(8px * var(--zn-roundness));
    padding: 0.5rem 0.75rem 0.5rem 2.25rem;
    font-size: 0.8125rem;
    color: rgb(var(--zn-fg));
    transition: border-color 0.2s, background 0.2s;
    outline: none;
    box-sizing: border-box;
}

.sidebar-search-input::-moz-placeholder {
    color: rgb(var(--zn-fg) / 0.25);
}

.sidebar-search-input::placeholder {
    color: rgb(var(--zn-fg) / 0.25);
}

.sidebar-search-input:focus {
    border-color: rgb(var(--zn-accent) / 0.55);
    background: rgb(var(--zn-fg) / 0.08);
}

/* Navigation */

.sidebar-nav {
    flex: 1;
    padding: 0.25rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    overflow-y: auto;
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.75rem;
    border-radius: calc(8px * var(--zn-roundness));
    color: rgb(var(--zn-fg) / 0.5);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: color 0.15s, background 0.15s;
}

.sidebar-nav-item svg {
    width: 1.125rem;
    height: 1.125rem;
    flex-shrink: 0;
}

.sidebar-nav-item:hover {
    color: rgb(var(--zn-fg));
    background: rgb(var(--zn-fg) / 0.06);
}

.sidebar-nav-item.active {
    color: rgb(var(--zn-fg));
    background: rgb(var(--zn-accent) / 0.15);
}

.sidebar-nav-item.active svg {
    color: rgb(var(--zn-accent));
}

.sidebar-nav-divider {
    height: 1px;
    background: rgb(var(--zn-fg) / 0.06);
    margin: 0.5rem 0.75rem;
}

/* Footer — user + logout */

.sidebar-footer {
    padding: 0.75rem;
    border-top: 1px solid rgb(var(--zn-fg) / 0.06);
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.sidebar-account-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgb(var(--zn-fg) / 0.04);
    border: 1px solid rgb(var(--zn-fg) / 0.08);
    border-radius: calc(8px * var(--zn-roundness));
    color: rgb(var(--zn-fg) / 0.82);
    padding: 0.5rem 0.75rem;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
}

.sidebar-account-toggle:hover {
    background: rgb(var(--zn-fg) / 0.07);
}

.sidebar-account-toggle-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-account-toggle-icon {
    width: 1rem;
    height: 1rem;
    transition: transform 0.15s ease;
}

.sidebar-account-toggle.is-collapsed .sidebar-account-toggle-icon {
    transform: rotate(-90deg);
}

.sidebar-account-panel {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.sidebar-account-panel[hidden] {
    display: none;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
}

.sidebar-user-avatar {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: linear-gradient(135deg, rgb(var(--zn-accent-strong)), rgb(var(--zn-accent-2)));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: rgb(var(--zn-on-accent));
    flex-shrink: 0;
}

.sidebar-user-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: rgb(var(--zn-fg) / 0.75);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-logout {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    border-radius: calc(8px * var(--zn-roundness));
    color: rgb(var(--zn-fg) / 0.4);
    text-decoration: none;
    font-size: 0.8125rem;
    font-weight: 500;
    transition: color 0.15s, background 0.15s;
}

.sidebar-logout svg {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
}

.sidebar-logout:hover {
    color: rgb(var(--zn-danger));
    background: rgb(var(--zn-danger) / 0.08);
}

/* ============================================================
   Main content area
   ============================================================ */

.zanime-main {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    background: rgb(var(--zn-bg));
    scrollbar-width: thin;
    scrollbar-color: rgb(var(--zn-accent) / 0.3) transparent;
}

.zanime-main::-webkit-scrollbar {
    width: 6px;
}

.zanime-main::-webkit-scrollbar-track {
    background: transparent;
}

.zanime-main::-webkit-scrollbar-thumb {
    background: rgb(var(--zn-accent) / 0.25);
    border-radius: 3px;
}

.zanime-content-wrapper {
    padding: 2rem;
}

.content-section {
    margin-bottom: 3rem;
}

.section-title {
    font-size: 1.0625rem;
    font-weight: 700;
    color: rgb(var(--zn-fg));
    margin-bottom: 1.25rem;
    letter-spacing: 0.01em;
}

/* ============================================================
   Recently Added — horizontal scroll row
   ============================================================ */

.recently-added-row {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    align-items: flex-start;
    padding-bottom: 0.75rem;
    scrollbar-width: thin;
    scrollbar-color: rgb(var(--zn-accent) / 0.3) transparent;
}

.recently-added-row::-webkit-scrollbar {
    height: 4px;
}

.recently-added-row::-webkit-scrollbar-track {
    background: transparent;
}

.recently-added-row::-webkit-scrollbar-thumb {
    background: rgb(var(--zn-accent) / 0.3);
    border-radius: 2px;
}

.recently-added-row .anime-card {
    flex: 0 0 150px;
    width: 150px;
}

.recently-added-row .anime-card-poster {
    width: 150px;
    height: 225px;
    aspect-ratio: unset;
}

/* ============================================================
   Browse grid
   ============================================================ */

.anime-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(135px, 1fr));
    grid-gap: 1rem;
    gap: 1rem;
}

/* ============================================================
   Anime card
   ============================================================ */

.anime-card {
    cursor: pointer;
}

.anime-card.hidden {
    display: none;
}

.content-section.hidden {
    display: none;
}

.anime-card-poster {
    position: relative;
    width: 100%;
    aspect-ratio: 2 / 3;
    border-radius: calc(8px * var(--zn-roundness));
    overflow: hidden;
    background: rgb(var(--zn-surface));
}

.anime-card-poster img {
    width: 100%;
    height: 100%;
    -o-object-fit: cover;
       object-fit: cover;
    transition: transform 0.3s ease;
    display: block;
}

.anime-card:hover .anime-card-poster img {
    transform: scale(1.05);
}

.anime-card-overlay {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.65) 0%, transparent 50%);
    display: flex;
    align-items: flex-end;
    padding: 0.5rem;
    opacity: 0;
    transition: opacity 0.2s;
}

.anime-card:hover .anime-card-overlay {
    opacity: 1;
}

.anime-card-rating {
    font-size: 0.75rem;
    font-weight: 600;
    color: rgb(var(--zn-warning));
}

.anime-card-info {
    padding: 0.4rem 0.1rem 0;
}

.anime-card-title {
    font-size: 0.8125rem;
    font-weight: 500;
    color: rgb(var(--zn-fg) / 0.9);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.35;
    margin: 0;
}

.anime-card-meta {
    font-size: 0.6875rem;
    color: rgb(var(--zn-fg) / 0.38);
    margin: 0.1rem 0 0;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ============================================================
   Category filter bar
   ============================================================ */

.filter-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-bottom: 1.25rem;
    flex-wrap: wrap;
}

.filter-bar-label {
    color: rgb(var(--zn-muted));
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* The toggles sit together in one soft tray, so they read as one control. */
.filter-group {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem;
    border-radius: 9999px;
    background: rgb(var(--zn-surface));
    border: 1px solid rgb(var(--zn-fg) / 0.07);
    box-shadow: inset 0 1px 0 rgb(var(--zn-fg) / 0.03);
}

.filter-pill {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.4375rem;
    padding: 0.4375rem 0.875rem 0.4375rem 0.75rem;
    border-radius: 9999px;
    border: 1px solid transparent;
    background: transparent;
    color: rgb(var(--zn-muted));
    font-size: 0.8125rem;
    font-weight: 500;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    -webkit-user-select: none;
       -moz-user-select: none;
            user-select: none;
    transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, transform 0.1s ease;
}

.filter-pill-icon {
    flex-shrink: 0;
    color: rgb(var(--zn-subtle));
    transition: color 0.18s ease;
}

/* Check mark slides in for active toggles. */
.filter-pill-check {
    flex-shrink: 0;
    width: 0;
    margin-left: -0.4375rem;
    opacity: 0;
    transform: scale(0.6);
    transition: width 0.18s ease, margin 0.18s ease, opacity 0.18s ease, transform 0.18s ease;
}

.filter-pill:hover:not(.active) {
    background: rgb(var(--zn-fg) / 0.05);
    color: rgb(var(--zn-text-soft));
}

.filter-pill:hover:not(.active) .filter-pill-icon {
    color: rgb(var(--zn-muted));
}

.filter-pill:active {
    transform: scale(0.97);
}

.filter-pill.active {
    background: rgb(var(--zn-accent-strong) / 0.16);
    border-color: rgb(var(--zn-accent) / 0.35);
    color: rgb(var(--zn-text));
    box-shadow: 0 1px 8px rgb(var(--zn-accent-strong) / 0.15);
}

.filter-pill.active .filter-pill-icon {
    color: rgb(var(--zn-accent));
}

.filter-pill.active .filter-pill-check {
    width: 14px;
    margin-left: 0;
    opacity: 1;
    transform: scale(1);
    color: rgb(var(--zn-accent));
}

.filter-pill.focus-visible {
    outline: 2px solid rgb(var(--zn-focus) / 0.8);
    outline-offset: 2px;
}

.filter-pill:focus-visible {
    outline: 2px solid rgb(var(--zn-focus) / 0.8);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    .filter-pill,
    .filter-pill-check {
        transition: none;
    }
}

/* ============================================================
   Empty state
   ============================================================ */

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: rgb(var(--zn-fg) / 0.35);
    font-size: 0.875rem;
}

.empty-state-link {
    color: rgb(var(--zn-accent-soft));
    text-decoration: none;
}

.empty-state-link:hover {
    text-decoration: underline;
}

/* ============================================================
   Settings page
   ============================================================ */

.settings-page {
    padding: 2rem;
    max-width: 560px;
}

.settings-header {
    margin-bottom: 2rem;
}

.settings-title {
    font-size: 1.375rem;
    font-weight: 700;
    color: rgb(var(--zn-fg));
    margin: 0 0 0.375rem;
}

.settings-subtitle {
    font-size: 0.8125rem;
    color: rgb(var(--zn-fg) / 0.45);
    margin: 0;
}

.settings-saved-notice {
    background: rgb(var(--zn-success) / 0.12);
    border: 1px solid rgb(var(--zn-success) / 0.3);
    color: rgb(var(--zn-success));
    border-radius: calc(8px * var(--zn-roundness));
    padding: 0.625rem 1rem;
    font-size: 0.8125rem;
    margin-bottom: 1.5rem;
}

.settings-form {
    display: flex;
    flex-direction: column;
    gap: 1.375rem;
}

.settings-group {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.settings-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: rgb(var(--zn-fg) / 0.75);
}

.settings-select {
    background: rgb(var(--zn-surface-2));
    border: 1px solid rgb(var(--zn-fg) / 0.1);
    border-radius: calc(8px * var(--zn-roundness));
    color: rgb(var(--zn-fg));
    font-size: 0.875rem;
    padding: 0.5rem 0.75rem;
    outline: none;
    transition: border-color 0.15s;
    -webkit-appearance: none;
       -moz-appearance: none;
            appearance: none;
    cursor: pointer;
}

.settings-select:focus {
    border-color: rgb(var(--zn-accent-strong));
}

.settings-input {
    background: rgb(var(--zn-surface-2));
    border: 1px solid rgb(var(--zn-fg) / 0.1);
    border-radius: calc(8px * var(--zn-roundness));
    color: rgb(var(--zn-fg));
    font-size: 0.875rem;
    padding: 0.5rem 0.75rem;
    outline: none;
    transition: border-color 0.15s;
}

.settings-input:focus {
    border-color: rgb(var(--zn-accent-strong));
}

.settings-input:disabled,
.settings-save-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.settings-hint {
    font-size: 0.75rem;
    color: rgb(var(--zn-fg) / 0.35);
    margin: 0;
    line-height: 1.5;
}

.settings-hint strong {
    color: rgb(var(--zn-fg) / 0.55);
}

.settings-save-btn {
    align-self: flex-start;
    background: rgb(var(--zn-accent-strong));
    color: rgb(var(--zn-on-accent));
    border: none;
    border-radius: calc(8px * var(--zn-roundness));
    padding: 0.5625rem 1.375rem;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    margin-top: 0.5rem;
}

.settings-save-btn:hover {
    background: rgb(var(--zn-accent-hover));
}

.sidebar-settings-link {
    margin-top: auto;
}

.sidebar-account-panel--always-open {
    display: block;
}

.family-card {
    background: rgb(var(--zn-overlay) / 0.9);
    border: 1px solid rgb(var(--zn-fg) / 0.08);
    border-radius: calc(10px * var(--zn-roundness));
    padding: 1rem;
    margin-top: 1.25rem;
}

.family-section-title {
    margin: 0;
    font-size: 1rem;
    color: rgb(var(--zn-text));
}

.family-error-notice {
    background: rgb(var(--zn-danger) / 0.12);
    border: 1px solid rgb(var(--zn-danger) / 0.4);
    color: rgb(var(--zn-danger-text));
    border-radius: calc(8px * var(--zn-roundness));
    padding: 0.625rem 1rem;
    font-size: 0.8125rem;
    margin-bottom: 1rem;
}

.family-error-text {
    margin: 0;
    color: rgb(var(--zn-danger-text));
    font-size: 0.8125rem;
}

.family-members-grid {
    margin-top: 1rem;
    display: grid;
    grid-gap: 0.75rem;
    gap: 0.75rem;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}

.family-member-tile {
    background: rgb(var(--zn-fg) / 0.03);
    border: 1px solid rgb(var(--zn-fg) / 0.08);
    border-radius: calc(10px * var(--zn-roundness));
    padding: 0.75rem;
    text-align: center;
}

.family-member-avatar {
    width: 52px;
    height: 52px;
    border-radius: 999px;
    margin: 0 auto 0.5rem;
    background: rgb(var(--zn-accent-strong) / 0.28);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.family-member-avatar img {
    width: 100%;
    height: 100%;
    -o-object-fit: cover;
       object-fit: cover;
    border-radius: 999px;
}

.family-member-name {
    font-size: 0.875rem;
    color: rgb(var(--zn-text));
}

.family-member-role {
    font-size: 0.75rem;
    color: rgb(var(--zn-fg) / 0.55);
}

.family-list {
    margin-top: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.family-list-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    border: 1px solid rgb(var(--zn-fg) / 0.08);
    border-radius: calc(8px * var(--zn-roundness));
    padding: 0.625rem 0.75rem;
    font-size: 0.8125rem;
}

.family-link-btn {
    text-decoration: none;
}

.family-switch-page {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--zn-backdrop-gradient);
    overflow: hidden;
}

.family-switch-backdrop {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    -o-object-fit: cover;
       object-fit: cover;
    opacity: 0.28;
    filter: blur(2px);
}

.family-switch-overlay {
    position: relative;
    z-index: 1;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.family-switch-card {
    width: min(900px, 100%);
    background: rgb(var(--zn-overlay) / 0.88);
    border: 1px solid rgb(var(--zn-fg) / 0.1);
    border-radius: calc(14px * var(--zn-roundness));
    padding: 1.5rem;
}

.family-switch-title {
    margin-bottom: 0.5rem;
    color: rgb(var(--zn-fg));
    font-size: 1.5rem;
}

.family-switch-subtitle {
    display: none;
    margin: 0.4rem 0 1rem;
    color: rgb(var(--zn-fg) / 0.65);
}

.family-switch-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    grid-gap: 0.75rem;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.family-switch-member {
    background: rgb(var(--zn-fg) / 0.03);
    border: 1px solid rgb(var(--zn-fg) / 0.08);
    border-radius: calc(10px * var(--zn-roundness));
    padding: 0.85rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.family-switch-member:hover {
    border-color: rgb(var(--zn-accent) / 0.45);
    box-shadow: 0 0 0 1px rgb(var(--zn-accent) / 0.3) inset;
}

.family-switch-member input {
    display: none;
}

.family-switch-member.is-active,
.family-switch-member[\:has\(input\:checked\)] {
    border-color: rgb(var(--zn-accent-strong));
    box-shadow: 0 0 0 1px rgb(var(--zn-accent-strong) / 0.5) inset;
}

.family-switch-member.is-active,
.family-switch-member:has(input:checked) {
    border-color: rgb(var(--zn-accent-strong));
    box-shadow: 0 0 0 1px rgb(var(--zn-accent-strong) / 0.5) inset;
}

.family-switch-avatar {
    width: 56px;
    height: 56px;
    border-radius: 999px;
    background: rgb(var(--zn-accent-strong) / 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.family-switch-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 999px;
    -o-object-fit: cover;
       object-fit: cover;
}

.family-switch-name {
    color: rgb(var(--zn-text));
    font-size: 0.9rem;
}

.family-switch-role {
    color: rgb(var(--zn-fg) / 0.6);
    font-size: 0.75rem;
}

.family-switch-submit {
    margin-top: 1rem;
}

.family-review-form {
    margin-top: 0.75rem;
}

.family-review-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.family-decline-btn {
    align-self: flex-start;
    background: rgb(var(--zn-danger-strong) / 0.12);
    border: 1px solid rgb(var(--zn-danger-strong) / 0.35);
    color: rgb(var(--zn-danger-text));
    border-radius: calc(8px * var(--zn-roundness));
    padding: 0.5625rem 1.1rem;
    font-size: 0.875rem;
    cursor: pointer;
    margin-top: 0.5rem;
}

/* -------------------------------------------------------------------------
   Anime card as anchor (home + shows pages)
------------------------------------------------------------------------- */
a.anime-card {
    text-decoration: none;
    color: inherit;
}

/* -------------------------------------------------------------------------
   Item detail page
------------------------------------------------------------------------- */
.item-page {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.item-top {
    position: relative;
    overflow: hidden;
    background: rgb(var(--zn-surface));
    border-radius: calc(12px * var(--zn-roundness));
    padding: 2rem;
    display: grid;
    grid-template-columns: 200px 1fr;
    grid-gap: 2rem;
    gap: 2rem;
    align-items: start;
}

.item-backdrop-bg {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    -o-object-fit: cover;
       object-fit: cover;
    -o-object-position: center top;
       object-position: center top;
    opacity: 0.18;
    filter: blur(6px);
    pointer-events: none;
}

.item-backdrop-overlay {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: linear-gradient(to right, rgb(var(--zn-surface)) 30%, transparent 100%);
    pointer-events: none;
}

.item-poster-col {
    position: relative;
    z-index: 1;
}

.item-poster-img {
    width: 100%;
    border-radius: calc(8px * var(--zn-roundness));
    display: block;
    aspect-ratio: 2 / 3;
    -o-object-fit: cover;
       object-fit: cover;
}

.item-meta-col {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.item-title {
    font-size: 1.875rem;
    font-weight: 700;
    color: rgb(var(--zn-text));
    line-height: 1.2;
    margin: 0;
}

.item-original-title {
    font-size: 0.9375rem;
    color: rgb(var(--zn-muted));
    margin: 0;
}

.item-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.item-badge {
    display: inline-block;
    padding: 0.25rem 0.625rem;
    background: rgb(var(--zn-fg) / 0.08);
    border: 1px solid rgb(var(--zn-fg) / 0.12);
    border-radius: calc(4px * var(--zn-roundness));
    font-size: 0.8125rem;
    color: rgb(var(--zn-text-soft));
}

.item-badge-rating {
    background: rgb(var(--zn-warning) / 0.15);
    border-color: rgb(var(--zn-warning) / 0.3);
    color: rgb(var(--zn-warning));
}

.item-badge-status {
    background: rgb(var(--zn-accent) / 0.15);
    border-color: rgb(var(--zn-accent) / 0.3);
    color: rgb(var(--zn-accent-soft));
}

.item-genres {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.item-genre-pill {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: rgb(var(--zn-accent) / 0.12);
    border: 1px solid rgb(var(--zn-accent) / 0.25);
    border-radius: 999px;
    font-size: 0.8125rem;
    color: rgb(var(--zn-accent-softer));
}

.item-overview {
    font-size: 0.9375rem;
    color: rgb(var(--zn-text-soft));
    line-height: 1.65;
    margin: 0;
    max-width: 65ch;
}

.item-series-stats {
    font-size: 0.875rem;
    color: rgb(var(--zn-muted));
    margin: 0;
}

.item-watch-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6875rem 1.5rem;
    background: rgb(var(--zn-accent-strong));
    color: rgb(var(--zn-on-accent));
    text-decoration: none;
    border-radius: calc(6px * var(--zn-roundness));
    font-size: 0.9375rem;
    font-weight: 600;
    align-self: flex-start;
    transition: background 0.15s;
}

.item-watch-btn:hover {
    background: rgb(var(--zn-accent-hover));
}

.item-actions {
    margin-top: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    max-width: 520px;
}

.item-action-btn {
    border: 1px solid rgb(var(--zn-fg) / 0.14);
    background: rgb(var(--zn-fg) / 0.04);
    color: rgb(var(--zn-text));
    border-radius: calc(8px * var(--zn-roundness));
    padding: 0.5rem 0.85rem;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.item-action-btn:hover {
    border-color: rgb(var(--zn-accent) / 0.5);
    background: rgb(var(--zn-accent) / 0.18);
}

.item-action-btn.is-active {
    border-color: rgb(var(--zn-danger) / 0.45);
    background: rgb(var(--zn-danger) / 0.2);
    color: rgb(var(--zn-danger-text));
}

.item-playlist-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-gap: 0.55rem;
    gap: 0.55rem;
}

.item-playlist-select,
.item-playlist-input {
    width: 100%;
    border: 1px solid rgb(var(--zn-fg) / 0.12);
    background: rgb(var(--zn-surface-2));
    color: rgb(var(--zn-fg));
    border-radius: calc(8px * var(--zn-roundness));
    padding: 0.5rem 0.65rem;
    font-size: 0.82rem;
}

.item-playlist-select:focus,
.item-playlist-input:focus {
    outline: none;
    border-color: rgb(var(--zn-accent-strong));
}

.item-action-feedback {
    min-height: 1.2rem;
    margin: 0;
    font-size: 0.78rem;
    color: rgb(var(--zn-fg) / 0.68);
}

.genre-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-bottom: 1rem;
}

.genre-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgb(var(--zn-fg) / 0.12);
    border-radius: 999px;
    background: rgb(var(--zn-fg) / 0.04);
    color: rgb(var(--zn-fg) / 0.86);
    padding: 0.3rem 0.65rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-decoration: none;
}

.genre-chip:hover {
    border-color: rgb(var(--zn-accent) / 0.45);
    background: rgb(var(--zn-accent) / 0.2);
    color: rgb(var(--zn-fg));
}

/* Seasons section: collapsible seasons + "go to season" chips */
.item-seasons {
    display: flex;
    flex-direction: column;
    gap: 0;
    background: rgb(var(--zn-surface));
    border-radius: calc(10px * var(--zn-roundness));
    /* no overflow:hidden here: it would stop the chip bar from sticking */
}

.item-seasons-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: rgb(var(--zn-text));
    margin: 0;
}

.season-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
}

.season-collapse-all {
    background: none;
    border: none;
    padding: 0;
    color: rgb(var(--zn-muted));
    font-size: 0.8125rem;
    cursor: pointer;
}

.season-collapse-all:hover {
    color: rgb(var(--zn-text));
    text-decoration: underline;
}

.season-jump {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.625rem 1.25rem;
    overflow-x: auto;
    scrollbar-width: none;
    background: rgb(var(--zn-surface) / 0.96);
    -webkit-backdrop-filter: blur(8px);
            backdrop-filter: blur(8px);
    border-top: 1px solid rgb(var(--zn-fg) / 0.06);
    border-bottom: 1px solid rgb(var(--zn-fg) / 0.06);
}

.season-jump::-webkit-scrollbar {
    display: none;
}

.season-jump-label {
    flex-shrink: 0;
    margin-right: 0.25rem;
    font-size: 0.75rem;
    color: rgb(var(--zn-muted));
}

.season-chip {
    flex-shrink: 0;
    min-width: 2.5rem;
    padding: 0.3125rem 0.75rem;
    border: 1px solid rgb(var(--zn-fg) / 0.12);
    border-radius: 999px;
    background: transparent;
    color: rgb(var(--zn-text-soft));
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.season-chip:hover {
    border-color: rgb(var(--zn-fg) / 0.3);
    color: rgb(var(--zn-text));
}

.season-chip.is-done {
    color: rgb(var(--zn-muted));
}

.season-chip.is-active {
    background: rgb(var(--zn-accent));
    border-color: rgb(var(--zn-accent));
    color: rgb(var(--zn-on-accent));
}

.season-block {
    scroll-margin-top: 3.5rem; /* land below the sticky chip bar */
    border-top: 1px solid rgb(var(--zn-fg) / 0.06);
}

.season-header {
    display: grid;
    grid-template-columns: 1fr auto auto;
    grid-template-areas:
        "name meta chevron"
        "progress progress progress";
    align-items: center;
    grid-column-gap: 0.75rem;
    -moz-column-gap: 0.75rem;
         column-gap: 0.75rem;
    grid-row-gap: 0.5rem;
    row-gap: 0.5rem;
    width: 100%;
    padding: 0.875rem 1.25rem;
    border: none;
    background: none;
    color: rgb(var(--zn-text));
    text-align: left;
    cursor: pointer;
}

.season-header:hover {
    background: rgb(var(--zn-fg) / 0.03);
}

.season-header-name {
    grid-area: name;
    font-size: 1rem;
    font-weight: 600;
}

.season-header-meta {
    grid-area: meta;
    font-size: 0.8125rem;
    color: rgb(var(--zn-muted));
    white-space: nowrap;
}

.season-header-chevron {
    grid-area: chevron;
    color: rgb(var(--zn-muted));
    transition: transform 0.2s ease;
}

.season-block.is-open .season-header-chevron {
    transform: rotate(180deg);
}

.season-header-progress {
    grid-area: progress;
    display: block;
    height: 3px;
    border-radius: 2px;
    background: rgb(var(--zn-fg) / 0.08);
    overflow: hidden;
}

.season-header-progress > span {
    display: block;
    height: 100%;
    background: rgb(var(--zn-accent));
}

.season-body[hidden] {
    display: none;
}

/* Episode list */
.episode-list {
    display: flex;
    flex-direction: column;
    border-top: 1px solid rgb(var(--zn-fg) / 0.06);
}

.episode-item {
    display: grid;
    grid-template-columns: 160px 1fr;
    grid-gap: 1rem;
    gap: 1rem;
    padding: 0.875rem 1.25rem;
    text-decoration: none;
    color: inherit;
    border-bottom: 1px solid rgb(var(--zn-fg) / 0.04);
    transition: background 0.15s;
    align-items: start;
}

.episode-item-watched {
    background: linear-gradient(90deg, rgb(var(--zn-success) / 0.08), transparent 35%);
}

.episode-item-watching {
    background: linear-gradient(90deg, rgb(var(--zn-info) / 0.08), transparent 35%);
}

.episode-item:last-child {
    border-bottom: none;
}

.episode-item:hover {
    background: rgb(var(--zn-fg) / 0.04);
}

.episode-item:hover .episode-thumb-play {
    opacity: 1;
}

.episode-thumb {
    position: relative;
    border-radius: calc(6px * var(--zn-roundness));
    overflow: hidden;
    aspect-ratio: 16 / 9;
    background: rgb(var(--zn-bg));
}

.episode-progress {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 3px;
    background: rgb(var(--zn-fg) / 0.12);
    z-index: 1;
}

.episode-progress-fill {
    display: block;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, rgb(var(--zn-info)), rgb(var(--zn-accent)));
}

.episode-thumb img {
    width: 100%;
    height: 100%;
    -o-object-fit: cover;
       object-fit: cover;
    display: block;
}

.episode-thumb-play {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 1.25rem;
    opacity: 0;
    transition: opacity 0.15s;
}

.episode-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.episode-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: rgb(var(--zn-text));
    margin: 0;
    line-height: 1.3;
}

.episode-num {
    color: rgb(var(--zn-muted));
    font-weight: 400;
    margin-right: 0.2em;
}

.episode-duration {
    font-size: 0.8125rem;
    color: rgb(var(--zn-muted));
}

.episode-state-pill {
    display: inline-flex;
    align-self: flex-start;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.71875rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.episode-state-pill-watched {
    background: rgb(var(--zn-success) / 0.15);
    border: 1px solid rgb(var(--zn-success) / 0.25);
    color: rgb(var(--zn-success-text));
}

.episode-state-pill-watching {
    background: rgb(var(--zn-info) / 0.15);
    border: 1px solid rgb(var(--zn-info) / 0.25);
    color: rgb(var(--zn-info-text));
}

.episode-overview {
    font-size: 0.8125rem;
    color: rgb(var(--zn-muted));
    line-height: 1.5;
    margin: 0.25rem 0 0;
    display: -webkit-box;
    line-clamp: 3;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Mobile adjustments for item page */
@media (max-width: 900px) {
    .item-top {
        grid-template-columns: 1fr;
        padding: 1.25rem;
    }

    .item-poster-col {
        max-width: 180px;
    }

    .item-title {
        font-size: 1.375rem;
    }

    .episode-item {
        grid-template-columns: 120px 1fr;
        gap: 0.75rem;
        padding: 0.75rem 1rem;
    }
}

/* -------------------------------------------------------------------------
   Continue Watching section (home page)
------------------------------------------------------------------------- */

.cw-row {
    display: flex;
    flex-wrap: nowrap;
    align-items: flex-start;
    gap: 0.875rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    scrollbar-width: thin;
    scrollbar-color: rgb(var(--zn-fg) / 0.15) transparent;
}

.cw-row::-webkit-scrollbar {
    height: 4px;
}

.cw-row::-webkit-scrollbar-thumb {
    background: rgb(var(--zn-fg) / 0.15);
    border-radius: calc(4px * var(--zn-roundness));
}

.cw-card {
    flex: 0 0 140px;
    width: 140px;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    transition: transform 0.15s;
}

.cw-card.hidden {
    display: none;
}

.cw-card:hover {
    transform: scale(1.04);
}

.cw-card-poster {
    position: relative;
    width: 140px;
    height: 210px;
    border-radius: calc(8px * var(--zn-roundness));
    overflow: hidden;
    background: rgb(var(--zn-surface));
    flex-shrink: 0;
}

.cw-card-poster img {
    width: 100%;
    height: 100%;
    -o-object-fit: cover;
       object-fit: cover;
    display: block;
}

.cw-play-icon {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    font-size: 1.5rem;
    opacity: 0;
    transition: opacity 0.15s;
}

.cw-card:hover .cw-play-icon {
    opacity: 1;
}

.cw-progress-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: rgb(var(--zn-fg) / 0.15);
}

.cw-progress-fill {
    height: 100%;
    background: rgb(var(--zn-accent-strong));
    transition: width 0.3s;
}

.cw-card-info {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.cw-card-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: rgb(var(--zn-text));
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cw-card-sub {
    font-size: 0.75rem;
    color: rgb(var(--zn-muted));
    margin: 0;
}

.cw-card-skeleton {
    transform: none !important;
}

.cw-card-skeleton {
    pointer-events: none;
}

.cw-skeleton-box,
.cw-skeleton-line {
    background: rgb(var(--zn-fg) / 0.14);
    animation: cw-skeleton-pulse 1.25s ease-in-out infinite;
}

.cw-skeleton-line {
    height: 0.72rem;
    border-radius: calc(5px * var(--zn-roundness));
    width: 100%;
    margin-top: 0.14rem;
}

.cw-skeleton-line-short {
    width: 58%;
}

.cw-card-skeleton .cw-card-info {
    gap: 0.34rem;
}

.cw-loading-hint {
    margin: 0.6rem 0 0;
    font-size: 0.8125rem;
    color: rgb(var(--zn-muted));
}

@keyframes cw-skeleton-pulse {
    0% {
        opacity: 0.48;
    }

    50% {
        opacity: 0.9;
    }

    100% {
        opacity: 0.48;
    }
}

@media (max-width: 900px) {
    .zanime-body,
    .zanime-layout {
        height: auto;
        min-height: 100vh;
        overflow: visible;
    }

    .zanime-layout {
        flex-direction: column;
    }

    .zanime-sidebar {
        width: 100%;
        border-right: 0;
        border-bottom: 1px solid rgb(var(--zn-fg) / 0.06);
    }

    .sidebar-header {
        padding: 1rem 1rem 0.75rem;
    }

    .sidebar-search-wrapper {
        margin: 0 1rem 0.75rem;
    }

    .sidebar-nav {
        flex-direction: row;
        overflow-x: auto;
        overflow-y: hidden;
        gap: 0.5rem;
        padding: 0 1rem 0.75rem;
    }

    .sidebar-nav-item {
        white-space: nowrap;
        flex: 0 0 auto;
    }

    .sidebar-nav-divider {
        width: 1px;
        height: auto;
        margin: 0;
    }

    .sidebar-footer {
        padding: 0.75rem 1rem 1rem;
    }

    .zanime-main {
        overflow: visible;
    }

    .zanime-content-wrapper {
        padding: 1rem;
    }

    .content-section {
        margin-bottom: 2rem;
    }

    .filter-bar {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 1rem;
    }

    .filter-bar-label,
    .filter-group,
    .filter-pill {
        white-space: nowrap;
        flex: 0 0 auto;
    }

    .anime-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 0.75rem;
    }

    .recently-added-row .anime-card,
    .recently-added-row .anime-card-poster,
    .cw-card,
    .cw-card-poster {
        width: 130px;
        flex-basis: 130px;
    }

    .recently-added-row .anime-card-poster,
    .cw-card-poster {
        height: 195px;
    }

    .season-controls {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.625rem;
    }

    .season-select {
        width: 100%;
    }
}

@media (max-width: 640px) {
    .anime-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .episode-item {
        grid-template-columns: 1fr;
        gap: 0.65rem;
    }

    .item-top {
        gap: 1rem;
    }

    .item-poster-col {
        max-width: 150px;
    }

    .item-title {
        font-size: 1.1875rem;
    }
}


/* ============================================================
   Card lift: every title card grows a little on hover (home rows,
   library, genres, favorites), like the Continue Watching cards.
   Scrolling rows get room around the cards so the lift isn't clipped
   (overflow-x: auto also clips vertically).
   ============================================================ */

.anime-card {
    display: block;
    transition: transform 0.15s ease;
}

.anime-card:hover,
.anime-card.focus-visible {
    transform: scale(1.04);
}

.anime-card:hover,
.anime-card:focus-visible {
    transform: scale(1.04);
}

.recently-added-row,
.cw-row {
    padding-top: 0.625rem;
    margin-top: -0.625rem;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
    margin-left: -0.5rem;
    margin-right: -0.5rem;
    scroll-padding-inline: 0.5rem;
}


/* Watched toggle on the show/movie page: green when watched (favorite uses the red accent). */
.item-action-btn.is-watched {
    border-color: rgb(var(--zn-success) / 0.45);
    background: rgb(var(--zn-success) / 0.18);
    color: rgb(var(--zn-success-text));
}

.item-action-btn:disabled {
    opacity: 0.6;
    cursor: progress;
}

/* ============================================================
   Layout: collapsible sidebar, libraries group, topbar (new layout)
   and profile menu. Base sidebar styles live in zanime.css.
   ============================================================ */

/* ---------------------------------------------------------- sidebar header */

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

.sidebar-collapse-btn,
.zn-topbar-menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    flex-shrink: 0;
    border: 0;
    border-radius: calc(8px * var(--zn-roundness));
    background: transparent;
    color: rgb(var(--zn-muted));
    cursor: pointer;
    transition: color 0.15s, background 0.15s;
}

.sidebar-collapse-btn:hover,
.zn-topbar-menu-btn:hover {
    color: rgb(var(--zn-text));
    background: rgb(var(--zn-fg) / 0.06);
}

.sidebar-collapse-btn.focus-visible,
.zn-topbar-menu-btn.focus-visible,
.sidebar-group-toggle.focus-visible,
.sidebar-admin-toggle.focus-visible,
.zn-profile-btn.focus-visible {
    outline: 2px solid rgb(var(--zn-accent));
    outline: 2px solid rgb(var(--zn-focus, var(--zn-accent)));
    outline-offset: 2px;
}

.sidebar-collapse-btn.focus-visible,
.zn-topbar-menu-btn.focus-visible,
.sidebar-group-toggle.focus-visible,
.sidebar-admin-toggle.focus-visible,
.zn-profile-btn.focus-visible {
    outline: 2px solid rgb(var(--zn-accent));
    outline: 2px solid rgb(var(--zn-focus, var(--zn-accent)));
    outline-offset: 2px;
}

.sidebar-collapse-btn:focus-visible,
.zn-topbar-menu-btn:focus-visible,
.sidebar-group-toggle:focus-visible,
.sidebar-admin-toggle:focus-visible,
.zn-profile-btn:focus-visible {
    outline: 2px solid rgb(var(--zn-accent));
    outline: 2px solid rgb(var(--zn-focus, var(--zn-accent)));
    outline-offset: 2px;
}

/* The topbar has its own toggle; keep only one visible. */
.layout-new .sidebar-collapse-btn {
    display: none;
}

/* --------------------------------------------------------- libraries group */

.sidebar-nav {
    scrollbar-width: thin;
    scrollbar-color: rgb(var(--zn-fg) / 0.12) transparent;
}

.sidebar-libraries {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.sidebar-group-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.375rem 0.75rem;
    border: 0;
    border-radius: calc(6px * var(--zn-roundness));
    background: transparent;
    color: rgb(var(--zn-muted));
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
}

.sidebar-group-toggle:hover {
    color: rgb(var(--zn-text));
}

.sidebar-group-chevron {
    display: inline-flex;
    transition: transform 0.2s ease;
}

.sidebar-library-list {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.sidebar-libs-closed .sidebar-group-chevron {
    transform: rotate(-90deg);
}

.sidebar-libs-closed .sidebar-library-list {
    display: none;
}

.sidebar-library-list .sidebar-nav-item span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ------------------------------------------------------------ admin group */

/* The arrow sits over the right edge of the Admin link, as a sibling, so clicking it
   never navigates; the rest of the row still goes to /admin. */
.sidebar-admin-row {
    position: relative;
}

.sidebar-admin-row .sidebar-nav-item {
    padding-right: 2.5rem;
}

.sidebar-admin-toggle {
    position: absolute;
    top: 50%;
    right: 0.375rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    border: 0;
    border-radius: calc(6px * var(--zn-roundness));
    background: transparent;
    color: rgb(var(--zn-muted));
    cursor: pointer;
    transform: translateY(-50%);
    transition: color 0.15s, background 0.15s;
}

.sidebar-admin-toggle:hover {
    color: rgb(var(--zn-text));
    background: rgb(var(--zn-fg) / 0.06);
}

.sidebar-admin:not(.is-open) .sidebar-group-chevron {
    transform: rotate(-90deg);
}

.sidebar-admin-list {
    display: none;
    flex-direction: column;
    gap: 0.125rem;
    margin-top: 0.125rem;
}

.sidebar-admin.is-open .sidebar-admin-list {
    display: flex;
}

/* Text lines up with the Admin label (item padding + icon + gap). */
.sidebar-subnav-item {
    padding: 0.4375rem 0.75rem 0.4375rem 2.625rem;
    font-size: 0.8125rem;
}

.sidebar-subnav-item span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ------------------------------------------------- collapsed: an icon rail */

@media (min-width: 901px) {
    .zanime-sidebar {
        transition: width 0.2s ease;
    }

    .sidebar-collapsed .zanime-sidebar {
        width: 4.5rem;
    }

    .sidebar-collapsed .sidebar-header {
        flex-direction: column;
        padding: 1.25rem 0.5rem 0.75rem;
    }

    .sidebar-collapsed .sidebar-logo-name,
    .sidebar-collapsed .sidebar-search-wrapper,
    .sidebar-collapsed .sidebar-nav-item span,
    .sidebar-collapsed .sidebar-logout span,
    .sidebar-collapsed .sidebar-user-name,
    .sidebar-collapsed .sidebar-group-toggle {
        display: none;
    }

    /* Only the accent half of the logo fits the rail: show its first letter. */
    .sidebar-collapsed .sidebar-logo-z {
        display: inline-block;
        width: 0.8em;
        overflow: hidden;
        white-space: nowrap;
    }

    .sidebar-collapsed .sidebar-nav-item,
    .sidebar-collapsed .sidebar-logout {
        justify-content: center;
        padding-left: 0;
        padding-right: 0;
    }

    .sidebar-collapsed .sidebar-nav {
        scrollbar-width: none;
    }

    .sidebar-collapsed .sidebar-nav::-webkit-scrollbar {
        display: none;
    }

    .sidebar-collapsed .sidebar-nav,
    .sidebar-collapsed .sidebar-footer {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }

    /* The rail shows only the Admin icon; its pages need the full sidebar. */
    .sidebar-collapsed .sidebar-admin-toggle,
    .sidebar-collapsed .sidebar-admin.is-open .sidebar-admin-list {
        display: none;
    }

    /* Libraries stay reachable as icons even when the group is folded. */
    .sidebar-collapsed .sidebar-library-list {
        display: flex;
    }

    .sidebar-collapsed .sidebar-user {
        justify-content: center;
    }
}

/* ------------------------------------------------------------------ topbar */

.zn-topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 2rem;
    background: rgb(var(--zn-bg) / 0.82);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgb(var(--zn-fg) / 0.06);
}

.zn-topbar-search {
    position: relative;
    flex: 0 1 18rem;
    min-width: 10rem;
}

.zn-topbar-search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    width: 0.9375rem;
    height: 0.9375rem;
    transform: translateY(-50%);
    color: rgb(var(--zn-muted));
    pointer-events: none;
}

.zn-topbar-search-input {
    width: 100%;
    height: 2.375rem;
    padding: 0 0.875rem 0 2.25rem;
    border: 1px solid rgb(var(--zn-fg) / 0.08);
    border-radius: 9999px;
    background: rgb(var(--zn-fg) / 0.05);
    color: rgb(var(--zn-text));
    font-size: 0.875rem;
    outline: none;
    transition: border-color 0.2s, background 0.2s;
}

.zn-topbar-search-input::-moz-placeholder {
    color: rgb(var(--zn-muted));
}

.zn-topbar-search-input::placeholder {
    color: rgb(var(--zn-muted));
}

.zn-topbar-search-input:focus {
    border-color: rgb(var(--zn-accent) / 0.55);
    background: rgb(var(--zn-fg) / 0.08);
}

.zn-topbar-pills {
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
}

.zn-topbar-pills::-webkit-scrollbar {
    display: none;
}

.zn-topbar-pills .filter-pill {
    white-space: nowrap;
}

.zn-topbar-pills .filter-pill-icon {
    display: inline-flex;
}


/* ------------------------------------------------------------ profile menu */

.zn-profile {
    position: relative;
    margin-left: auto;
    flex-shrink: 0;
}

.zn-profile-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.5rem 0.25rem 0.25rem;
    border: 1px solid transparent;
    border-radius: 9999px;
    background: transparent;
    color: rgb(var(--zn-text));
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.zn-profile-btn:hover,
.zn-profile-btn[aria-expanded="true"] {
    background: rgb(var(--zn-fg) / 0.06);
    border-color: rgb(var(--zn-fg) / 0.08);
}

.zn-profile-name {
    max-width: 10rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.zn-profile-chevron {
    display: inline-flex;
    color: rgb(var(--zn-muted));
    transition: transform 0.2s ease;
}

.zn-profile-btn[aria-expanded="true"] .zn-profile-chevron {
    transform: rotate(180deg);
}

.zn-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    flex-shrink: 0;
    overflow: hidden;
    border-radius: 9999px;
    background: rgb(var(--zn-accent) / 0.2);
    color: rgb(var(--zn-accent));
    font-size: 0.8125rem;
    font-weight: 700;
}

.zn-avatar img {
    width: 100%;
    height: 100%;
    -o-object-fit: cover;
       object-fit: cover;
}

.zn-profile-menu {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    width: 16rem;
    padding: 0.375rem;
    border: 1px solid rgb(var(--zn-fg) / 0.08);
    border-radius: calc(12px * var(--zn-roundness));
    background: rgb(var(--zn-surface));
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
    animation: zn-menu-in 0.14s ease-out;
}

.zn-profile-menu[hidden] {
    display: none;
}

@keyframes zn-menu-in {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: none; }
}

.zn-profile-heading {
    padding: 0.375rem 0.625rem 0.25rem;
    color: rgb(var(--zn-muted));
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.zn-profile-members {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.zn-member,
.zn-profile-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.4375rem 0.625rem;
    border-radius: calc(8px * var(--zn-roundness));
    color: rgb(var(--zn-text-soft));
    font-size: 0.875rem;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}

.zn-member .zn-avatar {
    width: 1.75rem;
    height: 1.75rem;
    font-size: 0.75rem;
}

a.zn-member:hover,
.zn-profile-item:hover,
a.zn-member.focus-visible,
.zn-profile-item.focus-visible {
    background: rgb(var(--zn-fg) / 0.06);
    color: rgb(var(--zn-text));
    outline: none;
}

a.zn-member:hover,
.zn-profile-item:hover,
a.zn-member:focus-visible,
.zn-profile-item:focus-visible {
    background: rgb(var(--zn-fg) / 0.06);
    color: rgb(var(--zn-text));
    outline: none;
}

.zn-member-active {
    color: rgb(var(--zn-text));
    font-weight: 600;
}

.zn-member-badge {
    margin-left: auto;
    color: rgb(var(--zn-accent));
    font-size: 0.6875rem;
    font-weight: 600;
}

.zn-member-skeleton .zn-avatar,
.zn-member-line {
    background: rgb(var(--zn-fg) / 0.08);
    animation: zn-pulse 1.2s ease-in-out infinite;
}

.zn-member-line {
    width: 6rem;
    height: 0.625rem;
    border-radius: 9999px;
}

@keyframes zn-pulse {
    50% { opacity: 0.5; }
}

.zn-profile-item svg {
    width: 1.0625rem;
    height: 1.0625rem;
    flex-shrink: 0;
    color: rgb(var(--zn-muted));
}

.zn-profile-item-danger:hover,
.zn-profile-item-danger:hover svg {
    color: rgb(var(--zn-danger));
    color: rgb(var(--zn-danger-text, var(--zn-danger)));
}

.zn-profile-sep {
    height: 1px;
    margin: 0.375rem 0.25rem;
    background: rgb(var(--zn-fg) / 0.07);
}

/* ------------------------------------------------------------------ mobile */

/* Phones get their own shell (top bar, tab bar, sheets): see mobile-shell.css. */
@media (max-width: 900px) {
    .sidebar-collapse-btn,
    .zn-topbar-menu-btn {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .zanime-sidebar,
    .sidebar-group-chevron,
    .zn-profile-chevron,
    .zn-profile-menu {
        transition: none;
        animation: none;
    }
}

/* --------------------------------------------- sticky content vs. topbar */

/* Height of the sticky topbar; pages use it to keep their own sticky parts
   (settings nav, season chips) and anchor jumps clear of it. */
:root {
    --zn-topbar-h: 0px;
}

.layout-new {
    --zn-topbar-h: 3.875rem;
}

.layout-new .sx-nav {
    top: calc(0px + 1.5rem);
    top: calc(var(--zn-topbar-h) + 1.5rem);
}

.layout-new .season-jump {
    top: 0px;
    top: var(--zn-topbar-h);
}

.layout-new .sx-card,
.layout-new .admin-section {
    scroll-margin-top: calc(0px + 1.5rem);
    scroll-margin-top: calc(var(--zn-topbar-h) + 1.5rem);
}

.layout-new .season-block {
    scroll-margin-top: calc(0px + 3.5rem);
    scroll-margin-top: calc(var(--zn-topbar-h) + 3.5rem);
}

@media (max-width: 900px) {
    /* Phones: both layouts have a sticky top bar and the page scrolls as a whole.
       layout.js measures the bar (it grows when search opens or pills wrap) and sets
       --zn-topbar-h on <html>; this is the value until then. */
    .layout-classic,
    .layout-new {
        --zn-topbar-h: calc(3.5rem + env(safe-area-inset-top));
    }

    .layout-classic .sx-nav,
    .layout-new .sx-nav,
    .layout-classic .season-jump,
    .layout-new .season-jump {
        top: 0px;
        top: var(--zn-topbar-h);
    }

    /* The window scrolls with scroll-padding-top = the bar (mobile-shell.css); these only
       add the page's own sticky chip rows (settings sections, season chips). */
    .layout-classic .sx-card,
    .layout-new .sx-card,
    .layout-classic .admin-section,
    .layout-new .admin-section {
        scroll-margin-top: 4rem;
    }

    .layout-classic .season-block,
    .layout-new .season-block {
        scroll-margin-top: 3.5rem;
    }
}

/* ============================================================
   Phone shell (max-width 900px): compact top bar, bottom tab bar
   and bottom sheets. Markup in layouts/app.php, behaviour in
   layout.js. Desktop (901px and up) must look exactly as before:
   everything here is inside a mobile media query, except for
   hiding the phone-only elements.

   Shell-level hooks for pages (phones only, 0 on desktop):
     --zn-topbar-h       height of the sticky top bar (measured)
     --zn-shell-bottom   height of the fixed tab bar incl. safe area;
                         fixed page UI at the bottom (toasts, action
                         bars) should sit above it.
   ============================================================ */

:root {
    --zn-shell-bottom: 0px;
}

/* Phone-only elements. */
.zn-tabbar,
.zn-sheet,
.zn-mactions,
.zn-topbar .zn-topbar-logo {
    display: none;
}

@media (max-width: 900px) {
    :root {
        --zn-mbar-h: 3.5rem;
        --zn-tabbar-h: 3.5rem;
        --zn-shell-bottom: calc(var(--zn-tabbar-h) + env(safe-area-inset-bottom));
        /* Anchor jumps (the page scrolls as a whole here) clear the bars. */
        scroll-padding-top: var(--zn-topbar-h);
        scroll-padding-bottom: 0px;
        scroll-padding-bottom: var(--zn-shell-bottom);
        -webkit-tap-highlight-color: transparent;
    }

    .zanime-body {
        padding-bottom: 0px;
        padding-bottom: var(--zn-shell-bottom);
    }

    /* Landscape phones: keep content out of the notch. */
    .zanime-main {
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }

    /* ------------------------------------------------ top bar (both layouts) */

    .zn-mactions {
        display: flex;
        align-items: center;
        gap: 0.125rem;
        margin-left: auto;
        flex-shrink: 0;
    }

    .zn-mbtn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 2.75rem;
        height: 2.75rem;
        padding: 0;
        border: 0;
        border-radius: 9999px;
        background: transparent;
        color: rgb(var(--zn-text));
        cursor: pointer;
        touch-action: manipulation;
        transition: background 0.15s;
    }

    .zn-mbtn:active {
        background: rgb(var(--zn-fg) / 0.08);
    }

    .zn-mbtn.focus-visible {
        outline: 2px solid rgb(var(--zn-accent));
        outline: 2px solid rgb(var(--zn-focus, var(--zn-accent)));
        outline-offset: -2px;
    }

    .zn-mbtn.focus-visible {
        outline: 2px solid rgb(var(--zn-accent));
        outline: 2px solid rgb(var(--zn-focus, var(--zn-accent)));
        outline-offset: -2px;
    }

    .zn-mbtn:focus-visible {
        outline: 2px solid rgb(var(--zn-accent));
        outline: 2px solid rgb(var(--zn-focus, var(--zn-accent)));
        outline-offset: -2px;
    }

    .zn-mbtn svg {
        width: 1.375rem;
        height: 1.375rem;
    }

    .zn-mbtn-open,
    .zn-mbtn-close {
        display: inline-flex;
    }

    .zn-mbtn-close,
    .zn-search-open .zn-mbtn-open {
        display: none;
    }

    .zn-search-open .zn-mbtn-close {
        display: inline-flex;
    }

    .zn-mavatar .zn-avatar {
        width: 2rem;
        height: 2rem;
    }

    /* Classic layout: the sidebar becomes the top bar (logo + buttons); its navigation
       moves to the tab bar and sheets, its search opens below the bar. */
    .layout-classic .zanime-sidebar {
        position: sticky;
        top: 0;
        z-index: 40;
        padding-top: env(safe-area-inset-top);
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
        background: rgb(var(--zn-bg) / 0.86);
        backdrop-filter: blur(14px);
        -webkit-backdrop-filter: blur(14px);
        border-bottom: 1px solid rgb(var(--zn-fg) / 0.07);
    }

    .layout-classic .sidebar-header {
        height: var(--zn-mbar-h);
        padding: 0 0.375rem 0 1rem;
    }

    .layout-classic .sidebar-nav,
    .layout-classic .sidebar-footer,
    .layout-classic .sidebar-search-wrapper {
        display: none;
    }

    .zn-search-open.layout-classic .sidebar-search-wrapper {
        display: block;
        margin: 0 1rem 0.75rem;
    }

    /* New layout: the sidebar goes; the topbar gets the logo and the buttons, search opens
       as a second row, the home page's library pills stay as a scrolling row. */
    .layout-new .zanime-sidebar,
    .layout-new .zn-profile {
        display: none;
    }

    .layout-new .zn-topbar {
        flex-wrap: wrap;
        -moz-column-gap: 0.5rem;
             column-gap: 0.5rem;
        row-gap: 0;
        padding: env(safe-area-inset-top) max(0.375rem, env(safe-area-inset-right)) 0 max(1rem, env(safe-area-inset-left));
        background: rgb(var(--zn-bg) / 0.86);
        backdrop-filter: blur(14px);
        -webkit-backdrop-filter: blur(14px);
        border-bottom-color: rgb(var(--zn-fg) / 0.07);
    }

    .zn-topbar .zn-topbar-logo {
        display: flex;
        align-items: center;
        height: var(--zn-mbar-h);
    }

    .layout-new .zn-topbar-search {
        display: none;
        order: 3;
        flex: 1 1 100%;
        min-width: 0;
        margin: 0 0.625rem 0.75rem 0;
    }

    .zn-search-open.layout-new .zn-topbar-search {
        display: block;
    }

    /* A plain edge-to-edge scrolling row (no segmented-control frame). */
    .layout-new .zn-topbar-pills {
        order: 4;
        flex: 1 1 100%;
        margin: 0 -0.375rem 0 -1rem;
        padding: 0 1rem 0.625rem;
        border: 0;
        border-radius: 0;
        background: none;
        box-shadow: none;
    }

    /* Both search fields: big enough to tap, 16px text so iOS doesn't zoom in. */
    .sidebar-search-input,
    .zn-topbar-search-input {
        height: 2.75rem;
        font-size: 1rem;
    }

    /* ---------------------------------------------------------- tab bar */

    .zn-tabbar {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 45;
        display: flex;
        align-items: stretch;
        height: 0px;
        height: var(--zn-shell-bottom);
        padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
        background: rgb(var(--zn-surface) / 0.92);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        border-top: 1px solid rgb(var(--zn-fg) / 0.08);
        -webkit-user-select: none;
        -moz-user-select: none;
             user-select: none;
    }

    .zn-tab {
        flex: 1 1 0;
        min-width: 0;
        min-height: 2.75rem;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 0.1875rem;
        padding: 0 0.125rem;
        border: 0;
        background: transparent;
        color: rgb(var(--zn-muted));
        font-size: 0.6875rem;
        font-weight: 600;
        line-height: 1;
        text-decoration: none;
        cursor: pointer;
        touch-action: manipulation;
        transition: color 0.15s;
    }

    .zn-tab svg {
        width: 1.5rem;
        height: 1.5rem;
        transition: transform 0.15s ease;
    }

    .zn-tab span {
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .zn-tab:active svg {
        transform: scale(0.9);
    }

    .zn-tab[aria-current="page"],
    .zn-tab.is-active,
    .zn-tab[aria-expanded="true"] {
        color: rgb(var(--zn-accent));
    }

    .zn-tab.focus-visible {
        outline: 2px solid rgb(var(--zn-accent));
        outline: 2px solid rgb(var(--zn-focus, var(--zn-accent)));
        outline-offset: -4px;
        border-radius: calc(10px * var(--zn-roundness));
    }

    .zn-tab.focus-visible {
        outline: 2px solid rgb(var(--zn-accent));
        outline: 2px solid rgb(var(--zn-focus, var(--zn-accent)));
        outline-offset: -4px;
        border-radius: calc(10px * var(--zn-roundness));
    }

    .zn-tab:focus-visible {
        outline: 2px solid rgb(var(--zn-accent));
        outline: 2px solid rgb(var(--zn-focus, var(--zn-accent)));
        outline-offset: -4px;
        border-radius: calc(10px * var(--zn-roundness));
    }

    /* ----------------------------------------------------------- sheets */

    .zn-sheet:not([hidden]) {
        display: block;
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        z-index: 90;
    }

    .zn-sheet-open,
    .zn-sheet-open body {
        overflow: hidden;
    }

    .zn-sheet-backdrop {
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        background: rgba(0, 0, 0, 0.55);
        animation: zn-sheet-fade 0.2s ease-out;
    }

    .zn-sheet-panel {
        position: absolute;
        left: 0;
        right: 0;
        bottom: 0;
        display: flex;
        flex-direction: column;
        max-height: calc(100% - env(safe-area-inset-top) - 2.5rem);
        padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
        border-radius: calc(20px * var(--zn-roundness)) calc(20px * var(--zn-roundness)) 0 0;
        background: rgb(var(--zn-surface));
        box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.35);
        outline: none;
        animation: zn-sheet-up 0.24s cubic-bezier(0.2, 0.8, 0.2, 1);
        touch-action: pan-y;
    }

    /* Grab handle. */
    .zn-sheet-panel::before {
        content: "";
        align-self: center;
        flex-shrink: 0;
        width: 2.5rem;
        height: 0.3125rem;
        margin-top: 0.5rem;
        border-radius: 9999px;
        background: rgb(var(--zn-fg) / 0.18);
    }

    .zn-sheet-panel.is-dragging {
        animation: none;
        transition: none;
    }

    .zn-sheet-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.75rem;
        padding: 0.25rem 0.5rem 0.25rem 1.25rem;
    }

    .zn-sheet-title {
        overflow: hidden;
        color: rgb(var(--zn-text));
        font-size: 1.0625rem;
        font-weight: 700;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .zn-sheet-user {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        min-width: 0;
    }

    .zn-sheet-user .zn-avatar {
        width: 2.5rem;
        height: 2.5rem;
        font-size: 1rem;
    }

    .zn-sheet-close {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 2.75rem;
        height: 2.75rem;
        flex-shrink: 0;
        border: 0;
        border-radius: 9999px;
        background: transparent;
        color: rgb(var(--zn-muted));
        cursor: pointer;
    }

    .zn-sheet-close svg {
        width: 1.25rem;
        height: 1.25rem;
    }

    .zn-sheet-close:active {
        background: rgb(var(--zn-fg) / 0.08);
    }

    .zn-sheet-body {
        display: flex;
        flex-direction: column;
        gap: 0.125rem;
        overflow-y: auto;
        overscroll-behavior: contain;
        padding: 0.25rem 0.75rem 1rem;
    }

    .zn-sheet-quick {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-gap: 0.5rem;
        gap: 0.5rem;
        margin-bottom: 0.5rem;
    }

    .zn-sheet-item,
    .zn-sheet-chip {
        display: flex;
        align-items: center;
        min-height: 3rem;
        border-radius: calc(10px * var(--zn-roundness));
        color: rgb(var(--zn-text-soft));
        text-decoration: none;
        touch-action: manipulation;
        transition: background 0.15s, color 0.15s;
    }

    .zn-sheet-item {
        gap: 0.875rem;
        padding: 0 0.75rem;
        font-size: 0.9375rem;
        font-weight: 500;
    }

    .zn-sheet-chip {
        gap: 0.5rem;
        padding: 0 0.875rem;
        background: rgb(var(--zn-fg) / 0.05);
        font-size: 0.875rem;
        font-weight: 600;
    }

    .zn-sheet-item span,
    .zn-sheet-chip span {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .zn-sheet-item svg,
    .zn-sheet-chip svg {
        width: 1.25rem;
        height: 1.25rem;
        flex-shrink: 0;
        color: rgb(var(--zn-muted));
    }

    .zn-sheet-item:active,
    .zn-sheet-chip:active {
        background: rgb(var(--zn-fg) / 0.08);
    }

    .zn-sheet-item.focus-visible,
    .zn-sheet-chip.focus-visible {
        outline: 2px solid rgb(var(--zn-accent));
        outline: 2px solid rgb(var(--zn-focus, var(--zn-accent)));
        outline-offset: -2px;
    }

    .zn-sheet-item.focus-visible,
    .zn-sheet-chip.focus-visible {
        outline: 2px solid rgb(var(--zn-accent));
        outline: 2px solid rgb(var(--zn-focus, var(--zn-accent)));
        outline-offset: -2px;
    }

    .zn-sheet-item:focus-visible,
    .zn-sheet-chip:focus-visible {
        outline: 2px solid rgb(var(--zn-accent));
        outline: 2px solid rgb(var(--zn-focus, var(--zn-accent)));
        outline-offset: -2px;
    }

    .zn-sheet-item[aria-current="page"],
    .zn-sheet-chip[aria-current="page"] {
        background: rgb(var(--zn-accent) / 0.12);
        color: rgb(var(--zn-accent));
    }

    .zn-sheet-item[aria-current="page"] svg,
    .zn-sheet-chip[aria-current="page"] svg {
        color: currentColor;
    }

    .zn-sheet-item-danger,
    .zn-sheet-item-danger svg {
        color: rgb(var(--zn-danger));
        color: rgb(var(--zn-danger-text, var(--zn-danger)));
    }

    .zn-sheet-sep {
        height: 1px;
        margin: 0.375rem 0.75rem;
        background: rgb(var(--zn-fg) / 0.08);
    }

    .zn-sheet-empty {
        padding: 0.75rem;
        color: rgb(var(--zn-muted));
        font-size: 0.875rem;
    }

    @keyframes zn-sheet-up {
        from { transform: translateY(100%); }
        to   { transform: none; }
    }

    @keyframes zn-sheet-fade {
        from { opacity: 0; }
        to   { opacity: 1; }
    }
}

/* Installed app (standalone): no rubber-band bounce or overscroll glow behind the bars. */
@media (max-width: 900px) and (display-mode: standalone) {
    html,
    body {
        overscroll-behavior-y: none;
    }
}

/* Landscape phones wider than 900px get the desktop layout: keep it out of the notch. */
@media (min-width: 901px) and (pointer: coarse) {
    .zanime-sidebar {
        padding-left: env(safe-area-inset-left);
    }

    .zanime-main {
        padding-right: env(safe-area-inset-right);
    }
}

@media (prefers-reduced-motion: reduce) {
    .zn-sheet-backdrop,
    .zn-sheet-panel {
        animation: none;
    }
}

/* ============================================================
   OmniFin — Admin page styles
   ============================================================ */

.admin-header {
    margin-bottom: 2rem;
}

.admin-subtitle {
    font-size: 0.875rem;
    color: rgb(var(--zn-fg) / 0.4);
    margin-top: 0.25rem;
}

.admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    grid-gap: 1.25rem;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

/* Card */

.admin-card {
    background: rgb(var(--zn-surface));
    border: 1px solid rgb(var(--zn-fg) / 0.06);
    border-radius: calc(12px * var(--zn-roundness));
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.admin-card-label {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: rgb(var(--zn-fg) / 0.35);
    margin-bottom: 0.25rem;
}

.admin-card-desc {
    font-size: 0.8125rem;
    color: rgb(var(--zn-fg) / 0.45);
    line-height: 1.55;
    margin: 0;
}

/* Stat display */

.admin-stat {
    font-size: 2.5rem;
    font-weight: 800;
    color: rgb(var(--zn-fg));
    line-height: 1;
}

.admin-stat--empty {
    color: rgb(var(--zn-fg) / 0.2);
}

.admin-stat-label {
    font-size: 0.8125rem;
    color: rgb(var(--zn-fg) / 0.4);
}

.admin-meta {
    font-size: 0.75rem;
    color: rgb(var(--zn-fg) / 0.3);
    margin-top: 0.5rem;
}

/* Sync button */

.admin-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding: 0.625rem 1.25rem;
    border-radius: calc(8px * var(--zn-roundness));
    background: rgb(var(--zn-accent-strong));
    color: rgb(var(--zn-on-accent));
    font-size: 0.875rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: background 0.15s, opacity 0.15s;
}

.admin-btn:hover {
    background: rgb(var(--zn-accent-hover));
}

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

.admin-btn svg {
    flex-shrink: 0;
}

.admin-btn--small {
    margin-top: 0;
    padding: 0.35rem 0.7rem;
    font-size: 0.75rem;
    border-radius: calc(6px * var(--zn-roundness));
}

.admin-btn--spinning svg {
    animation: spin 1s linear infinite;
}

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

/* Progress section */

.admin-progress-section {
    margin-top: 0.25rem;
}

.admin-progress-bar-track {
    width: 100%;
    height: 6px;
    background: rgb(var(--zn-fg) / 0.08);
    border-radius: 3px;
    overflow: hidden;
    margin: 0.75rem 0 0.5rem;
}

.admin-progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, rgb(var(--zn-accent-strong)), rgb(var(--zn-accent-2)));
    border-radius: 3px;
    transition: width 0.3s ease;
}

.admin-progress-meta {
    font-size: 0.8125rem;
    color: rgb(var(--zn-fg) / 0.4);
}

.admin-queue-card {
    margin-top: 1rem;
}

.admin-queue-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.admin-queue-empty {
    font-size: 0.85rem;
    color: rgb(var(--zn-fg) / 0.45);
}

.admin-queue-list {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.admin-queue-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-gap: 0.8rem;
    gap: 0.8rem;
    align-items: center;
    padding: 0.7rem 0.8rem;
    border-radius: calc(8px * var(--zn-roundness));
    border: 1px solid rgb(var(--zn-fg) / 0.08);
    background: rgb(var(--zn-fg) / 0.02);
}

.admin-queue-title {
    font-size: 0.84rem;
    color: rgb(var(--zn-text));
    font-weight: 600;
}

.admin-queue-meta {
    margin-top: 0.2rem;
    font-size: 0.74rem;
    color: rgb(var(--zn-fg) / 0.45);
}

.admin-queue-error {
    margin-top: 0.35rem;
    font-size: 0.74rem;
    color: rgb(var(--zn-danger-text));
}

/* Empty state link (used on home screen) */

.empty-state-link {
    display: inline-block;
    margin-top: 0.75rem;
    color: rgb(var(--zn-accent));
    font-size: 0.875rem;
    text-decoration: none;
    transition: color 0.15s;
}

.empty-state-link:hover {
    color: rgb(var(--zn-accent-soft));
    text-decoration: underline;
}

/* ------------------------------------------------------------ sections */

.admin-section-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin-top: 1rem;
}

.admin-section-link {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.875rem;
    border: 1px solid rgb(var(--zn-fg) / 0.08);
    border-radius: 9999px;
    background: rgb(var(--zn-surface));
    color: rgb(var(--zn-text-soft));
    font-size: 0.8125rem;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.admin-section-link:hover {
    color: rgb(var(--zn-text));
    border-color: rgb(var(--zn-accent) / 0.4);
}

.admin-badge {
    min-width: 1.25rem;
    padding: 0 0.375rem;
    border-radius: 9999px;
    background: rgb(var(--zn-accent-strong));
    color: rgb(var(--zn-on-accent));
    font-size: 0.6875rem;
    font-weight: 700;
    line-height: 1.25rem;
    text-align: center;
}

.admin-section {
    margin-bottom: 2.75rem;
    scroll-margin-top: 5rem;
}

.admin-section-head {
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgb(var(--zn-fg) / 0.06);
}

.admin-section-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: rgb(var(--zn-text));
}

.admin-section-desc {
    margin-top: 0.25rem;
    font-size: 0.8125rem;
    color: rgb(var(--zn-muted));
}

.admin-section .admin-progress-section,
.admin-section .admin-queue-card {
    margin-top: 0;
}

.admin-meta--error {
    color: rgb(var(--zn-danger));
    color: rgb(var(--zn-danger-text, var(--zn-danger)));
}

/* Two-option switch (e.g. Layout: Classic / New). */
.admin-segmented {
    display: inline-flex;
    align-self: flex-start;
    gap: 0.25rem;
    margin-top: 0.5rem;
    padding: 0.25rem;
    border: 1px solid rgb(var(--zn-fg) / 0.08);
    border-radius: 9999px;
    background: rgb(var(--zn-fg) / 0.04);
}

.admin-segment {
    padding: 0.375rem 1rem;
    border: 0;
    border-radius: 9999px;
    background: transparent;
    color: rgb(var(--zn-muted));
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.admin-segment:hover:not(.is-active) {
    color: rgb(var(--zn-text));
}

.admin-segment.is-active {
    background: rgb(var(--zn-accent-strong));
    color: rgb(var(--zn-on-accent));
}

.admin-segment.focus-visible {
    outline: 2px solid rgb(var(--zn-accent));
    outline: 2px solid rgb(var(--zn-focus, var(--zn-accent)));
    outline-offset: 2px;
}

.admin-segment.focus-visible {
    outline: 2px solid rgb(var(--zn-accent));
    outline: 2px solid rgb(var(--zn-focus, var(--zn-accent)));
    outline-offset: 2px;
}

.admin-segment:focus-visible {
    outline: 2px solid rgb(var(--zn-accent));
    outline: 2px solid rgb(var(--zn-focus, var(--zn-accent)));
    outline-offset: 2px;
}

/* Settings form inside a card (e.g. Requests: Seerr URL and API key). */
.admin-card--wide {
    grid-column: 1 / -1;
    max-width: 40rem;
}

.admin-form {
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
    margin-top: 0.5rem;
}

.admin-field {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.admin-field--inline {
    flex-direction: row;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
}

.admin-field-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: rgb(var(--zn-text-soft));
}

.admin-input {
    height: 2.375rem;
    padding: 0 0.875rem;
    border: 1px solid rgb(var(--zn-fg) / 0.12);
    border-radius: var(--zn-radius);
    background-color: rgb(var(--zn-surface-2));
    color: rgb(var(--zn-text));
    font-size: 0.875rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.admin-input:hover {
    border-color: rgb(var(--zn-fg) / 0.22);
}

.admin-input.focus-visible {
    outline: none;
    border-color: rgb(var(--zn-accent));
    box-shadow: 0 0 0 3px rgb(var(--zn-accent) / 0.2);
}

.admin-input:focus-visible {
    outline: none;
    border-color: rgb(var(--zn-accent));
    box-shadow: 0 0 0 3px rgb(var(--zn-accent) / 0.2);
}

.admin-form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.admin-form-actions .admin-btn {
    margin-top: 0;
}

.admin-btn--ghost {
    background: rgb(var(--zn-fg) / 0.06);
    color: rgb(var(--zn-text));
}

.admin-btn--ghost:hover {
    background: rgb(var(--zn-fg) / 0.12);
}

/*
 * Plain text subtitles in the user's style: the player's overlay (player/subtitle-overlay.js)
 * and the preview on the settings page share these rules. The style options arrive as custom
 * properties from PlayerPrefsService::subtitleStyle(); the colours are the user's own choice.
 *
 *   --sub-base    px the size is relative to (set by the script from the picture size)
 *   --sub-raise   px the text moves up to clear the player controls (player only)
 */

.zn-subs .zn-subs-cues {
    position: absolute;
    left: 0;
    right: 0;
    bottom: max(calc(0.05 * 100%), 0px);
    bottom: max(calc(var(--sub-offset, 0.05) * 100%), var(--sub-raise, 0px));
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15em;
    padding: 0 4%;
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, sans-serif;
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, sans-serif, sans-serif;
    font-family: var(--sub-font, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, sans-serif, sans-serif);
    font-size: max(12px, calc(50vh * 0.045));
    font-size: max(var(--sub-min, 12px), calc(var(--sub-base, 50vh) * var(--sub-size, 0.045)));
    font-weight: 500;
    line-height: 1.3;
    text-align: center;
    color: #fff;
    color: var(--sub-color, #fff);
    text-shadow: none;
    text-shadow: var(--sub-edge, none);
    pointer-events: none;
}

.zn-subs .zn-subs-cue {
    max-width: 100%;
}

.zn-subs .zn-subs-text {
    white-space: pre-line;
    word-wrap: anywhere;
    padding: 0.06em 0.3em;
    border-radius: 0.12em;
    background: rgba(0, 0, 0, calc(0.5 * 0));
    background: rgb(var(--sub-bg-rgb, 0 0 0) / calc(var(--sub-bg-alpha, 0.5) * var(--sub-box, 0)));
    -webkit-box-decoration-break: clone;
    box-decoration-break: clone;
}

/*
 * Settings page (app/views/settings.php). Own "sx-" classes so the family pages, which
 * share the older settings-* classes, are unaffected. All colours come from theme tokens.
 */

.sx-page {
    max-width: 68rem;
    margin: 0 auto;
    padding: 2rem 1.5rem 4rem;
}

.sx-header {
    margin-bottom: 1.75rem;
}

.sx-title {
    margin: 0;
    font-family: inherit;
    font-family: var(--zn-font-display, inherit);
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: rgb(var(--zn-text));
}

.sx-subtitle {
    margin: 0.375rem 0 0;
    font-size: 0.9375rem;
    color: rgb(var(--zn-muted));
}

.sx-layout {
    display: grid;
    grid-template-columns: 12rem minmax(0, 1fr);
    grid-gap: 2rem;
    gap: 2rem;
    align-items: start;
}

/* ---------------------------------------------------------------- nav */

.sx-nav {
    position: sticky;
    top: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.sx-nav-link {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--zn-radius);
    color: rgb(var(--zn-muted));
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}

.sx-nav-link svg {
    color: rgb(var(--zn-subtle));
    transition: color 0.15s;
}

.sx-nav-link:hover {
    background: rgb(var(--zn-fg) / 0.05);
    color: rgb(var(--zn-text));
}

.sx-nav-link.is-active {
    background: rgb(var(--zn-accent-strong) / 0.14);
    color: rgb(var(--zn-text));
}

.sx-nav-link.is-active svg {
    color: rgb(var(--zn-accent));
}

/* ---------------------------------------------------------------- cards */

.sx-content {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    min-width: 0;
}

.sx-form {
    display: contents;
}

.sx-card {
    scroll-margin-top: 1.5rem;
    background: rgb(var(--zn-surface));
    border: 1px solid rgb(var(--zn-fg) / 0.07);
    border-radius: var(--zn-radius-lg);
    box-shadow: 0 1px 2px rgb(var(--zn-shadow) / 0.12);
}

.sx-card-head {
    display: flex;
    align-items: flex-start;
    gap: 0.875rem;
    padding: 1.25rem 1.5rem 1rem;
}

.sx-card-icon {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: var(--zn-radius);
    background: rgb(var(--zn-accent-strong) / 0.14);
    color: rgb(var(--zn-accent));
}

.sx-card-title {
    margin: 0;
    font-size: 1.0625rem;
    font-weight: 600;
    color: rgb(var(--zn-text));
}

.sx-card-desc {
    margin: 0.1875rem 0 0;
    font-size: 0.8125rem;
    line-height: 1.45;
    color: rgb(var(--zn-muted));
}

.sx-card-foot {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid rgb(var(--zn-fg) / 0.06);
    background: rgb(var(--zn-fg) / 0.015);
    border-radius: 0 0 var(--zn-radius-lg) var(--zn-radius-lg);
}

.sx-card-foot-plain {
    justify-content: flex-start;
    border-top: none;
    background: none;
    padding-top: 0;
}

.sx-foot-start {
    order: -1;
    margin-right: auto;
}

/* ---------------------------------------------------------------- rows */

.sx-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid rgb(var(--zn-fg) / 0.06);
}

.sx-row-text {
    min-width: 0;
    flex: 1 1 auto;
}

.sx-label {
    display: block;
    font-size: 0.9375rem;
    font-weight: 500;
    color: rgb(var(--zn-text));
    cursor: pointer;
}

.sx-hint {
    margin: 0.25rem 0 0;
    max-width: 34rem;
    font-size: 0.8125rem;
    line-height: 1.5;
    color: rgb(var(--zn-muted));
}

.sx-hint strong {
    font-weight: 600;
    color: rgb(var(--zn-text-soft));
}

.sx-control {
    flex: 0 0 auto;
    display: flex;
    justify-content: flex-end;
}

/* ---------------------------------------------------------------- controls */

.sx-select,
.sx-number {
    height: 2.375rem;
    border: 1px solid rgb(var(--zn-fg) / 0.12);
    border-radius: var(--zn-radius);
    background-color: rgb(var(--zn-surface-2));
    color: rgb(var(--zn-text));
    font-size: 0.875rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.sx-select {
    -webkit-appearance: none;
       -moz-appearance: none;
            appearance: none;
    min-width: 12rem;
    padding: 0 2.25rem 0 0.875rem;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 20 20%27 fill=%27%239ca3af%27%3E%3Cpath fill-rule=%27evenodd%27 d=%27M5.22 8.22a.75.75 0 0 1 1.06 0L10 11.94l3.72-3.72a.75.75 0 1 1 1.06 1.06l-4.25 4.25a.75.75 0 0 1-1.06 0L5.22 9.28a.75.75 0 0 1 0-1.06Z%27 clip-rule=%27evenodd%27/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.625rem center;
    background-size: 1.125rem;
}

.sx-select option {
    background-color: rgb(var(--zn-surface-2));
    color: rgb(var(--zn-text));
}

.sx-select:hover,
.sx-number:hover {
    border-color: rgb(var(--zn-fg) / 0.22);
}

.sx-select.focus-visible,
.sx-number[focus-within] {
    outline: none;
    border-color: rgb(var(--zn-accent));
    box-shadow: 0 0 0 3px rgb(var(--zn-accent) / 0.2);
}

.sx-select.focus-visible,
.sx-number:focus-within {
    outline: none;
    border-color: rgb(var(--zn-accent));
    box-shadow: 0 0 0 3px rgb(var(--zn-accent) / 0.2);
}

.sx-select.focus-visible,
.sx-number[focus-within] {
    outline: none;
    border-color: rgb(var(--zn-accent));
    box-shadow: 0 0 0 3px rgb(var(--zn-accent) / 0.2);
}

.sx-select:focus-visible,
.sx-number[focus-within] {
    outline: none;
    border-color: rgb(var(--zn-accent));
    box-shadow: 0 0 0 3px rgb(var(--zn-accent) / 0.2);
}

.sx-select:focus-visible,
.sx-number:focus-within {
    outline: none;
    border-color: rgb(var(--zn-accent));
    box-shadow: 0 0 0 3px rgb(var(--zn-accent) / 0.2);
}

.sx-number {
    display: inline-flex;
    align-items: center;
    overflow: hidden;
}

.sx-number input {
    width: 4.5rem;
    height: 100%;
    padding: 0 0.25rem 0 0.875rem;
    border: none;
    background: transparent;
    color: inherit;
    font: inherit;
    font-feature-settings: "tnum";
    font-variant-numeric: tabular-nums;
    text-align: right;
    -moz-appearance: textfield;
    -webkit-appearance: textfield;
            appearance: textfield;
}

.sx-number input::-webkit-outer-spin-button,
.sx-number input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.sx-number input:focus {
    outline: none;
}

.sx-number-unit {
    padding: 0 0.875rem 0 0.375rem;
    color: rgb(var(--zn-muted));
    font-size: 0.8125rem;
}

/* Toggle switch (a real checkbox, so forms and screen readers work unchanged). */
.sx-switch {
    -moz-appearance: none;
         appearance: none;
    -webkit-appearance: none;
    position: relative;
    flex-shrink: 0;
    width: 2.75rem;
    height: 1.5rem;
    margin: 0;
    border-radius: 999px;
    background: rgb(var(--zn-fg) / 0.16);
    cursor: pointer;
    transition: background 0.2s ease;
}

.sx-switch::after {
    content: '';
    position: absolute;
    top: 0.1875rem;
    left: 0.1875rem;
    width: 1.125rem;
    height: 1.125rem;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s ease;
}

.sx-switch:checked {
    background: rgb(var(--zn-accent-strong));
}

.sx-switch:checked::after {
    transform: translateX(1.25rem);
}

.sx-switch.focus-visible {
    outline: 2px solid rgb(var(--zn-focus) / 0.8);
    outline-offset: 2px;
}

.sx-switch:focus-visible {
    outline: 2px solid rgb(var(--zn-focus) / 0.8);
    outline-offset: 2px;
}

/* ---------------------------------------------------------------- buttons */

.sx-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    height: 2.375rem;
    padding: 0 1.125rem;
    border: 1px solid transparent;
    border-radius: var(--zn-radius);
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.1s;
}

.sx-btn:active {
    transform: translateY(1px);
}

.sx-btn-primary {
    background: rgb(var(--zn-accent-strong));
    color: rgb(var(--zn-on-accent));
}

.sx-btn-primary:hover {
    background: rgb(var(--zn-accent-hover));
}

.sx-btn-secondary {
    background: rgb(var(--zn-surface-2));
    border-color: rgb(var(--zn-fg) / 0.12);
    color: rgb(var(--zn-text));
}

.sx-btn-secondary:hover {
    border-color: rgb(var(--zn-fg) / 0.25);
}

.sx-btn-ghost {
    background: transparent;
    color: rgb(var(--zn-muted));
    padding: 0 0.5rem;
}

.sx-btn-ghost:hover {
    color: rgb(var(--zn-text));
}

.sx-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.875rem;
    height: 1.875rem;
    border: none;
    border-radius: var(--zn-radius-sm);
    background: transparent;
    color: rgb(var(--zn-muted));
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.sx-icon-btn:hover:not(:disabled) {
    background: rgb(var(--zn-fg) / 0.08);
    color: rgb(var(--zn-text));
}

.sx-icon-btn:disabled {
    opacity: 0.3;
    cursor: default;
}

/* ---------------------------------------------------------------- notices */

.sx-notice {
    margin: 0 1.5rem 1rem;
    padding: 0.625rem 0.875rem;
    border-radius: var(--zn-radius);
    font-size: 0.8125rem;
}

.sx-notice-success {
    background: rgb(var(--zn-success) / 0.12);
    color: rgb(var(--zn-success-text));
    border: 1px solid rgb(var(--zn-success) / 0.25);
}

.sx-notice-error {
    background: rgb(var(--zn-danger) / 0.1);
    color: rgb(var(--zn-danger-text));
    border: 1px solid rgb(var(--zn-danger) / 0.25);
}

/* ---------------------------------------------------------------- themes */

.sx-themes {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
    grid-gap: 0.875rem;
    gap: 0.875rem;
    padding: 0.25rem 1.5rem 1.25rem;
}

.sx-theme {
    cursor: pointer;
}

.sx-theme-input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.sx-theme-card {
    display: block;
    overflow: hidden;
    border: 2px solid rgb(var(--zn-fg) / 0.08);
    border-radius: var(--zn-radius-lg);
    background: rgb(var(--zn-bg));
    transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}

.sx-theme:hover .sx-theme-card {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgb(var(--zn-shadow) / 0.25);
}

.sx-theme-input:checked + .sx-theme-card {
    border-color: rgb(var(--zn-accent));
}

.sx-theme-input.focus-visible + .sx-theme-card {
    outline: 2px solid rgb(var(--zn-focus) / 0.8);
    outline-offset: 2px;
}

.sx-theme-input:focus-visible + .sx-theme-card {
    outline: 2px solid rgb(var(--zn-focus) / 0.8);
    outline-offset: 2px;
}

.sx-theme-preview {
    display: flex;
    gap: 0.375rem;
    height: 4.5rem;
    padding: 0.5rem;
}

.sx-theme-side {
    width: 25%;
    border-radius: var(--zn-radius-sm);
    background: rgb(var(--zn-surface));
}

.sx-theme-main {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 0.375rem;
}

.sx-theme-line {
    height: 0.5rem;
    width: 75%;
    border-radius: 999px;
    background: rgb(var(--zn-fg) / 0.7);
}

.sx-theme-line-short {
    width: 50%;
    background: rgb(var(--zn-muted) / 0.6);
}

.sx-theme-accent {
    margin-top: auto;
    height: 0.75rem;
    width: 35%;
    border-radius: var(--zn-radius-sm);
    background: rgb(var(--zn-accent-strong));
}

.sx-theme-name {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.5rem 0.625rem;
    background: rgb(var(--zn-surface));
    color: rgb(var(--zn-text));
    font-size: 0.8125rem;
    font-weight: 600;
}

.sx-theme-check {
    color: rgb(var(--zn-accent));
    opacity: 0;
    transform: scale(0.6);
    transition: opacity 0.15s, transform 0.15s;
}

.sx-theme-input:checked + .sx-theme-card .sx-theme-check {
    opacity: 1;
    transform: scale(1);
}

/* ---------------------------------------------------------------- home modules */

.sx-modules {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin: 0;
    padding: 0.25rem 1.5rem 1.25rem;
    list-style: none;
}

.sx-module {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.5rem 0.625rem 0.75rem;
    border: 1px solid rgb(var(--zn-fg) / 0.08);
    border-radius: var(--zn-radius);
    background: rgb(var(--zn-surface-2) / 0.6);
    transition: border-color 0.15s, background 0.15s;
}

.sx-module:hover {
    border-color: rgb(var(--zn-fg) / 0.16);
}

.sx-module-grip {
    display: inline-flex;
    color: rgb(var(--zn-subtle));
    cursor: grab;
}

.sx-module-main {
    display: flex;
    flex: 1;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-width: 0;
    cursor: pointer;
}

.sx-module-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.sx-module-title {
    font-size: 0.9375rem;
    font-weight: 500;
    color: rgb(var(--zn-text));
}

.sx-module-desc {
    font-size: 0.75rem;
    color: rgb(var(--zn-muted));
}

/* Disabled modules fade back a little. */
.sx-module[\:has\(.sx-switch\:not\(\:checked\)\)] .sx-module-text {
    opacity: 0.55;
}
.sx-module:has(.sx-switch:not(:checked)) .sx-module-text {
    opacity: 0.55;
}

.sx-module-move {
    display: flex;
    gap: 0.125rem;
    padding-left: 0.5rem;
    border-left: 1px solid rgb(var(--zn-fg) / 0.08);
}

/* ---------------------------------------------------------------- subtitle preview */

/* A stand-in video frame (dark, with a brighter patch to judge the edge style on) under a
   sample line in the chosen style (subtitle-settings.js, subtitles.css). */
.sx-subs-preview {
    position: relative;
    max-width: 36rem;
    aspect-ratio: 16 / 9;
    margin: 0 1.5rem 1.25rem;
    overflow: hidden;
    border-radius: var(--zn-radius);
    background:
        radial-gradient(ellipse 45% 55% at 72% 78%, rgb(var(--zn-on-accent) / 0.55), transparent 70%),
        radial-gradient(ellipse 60% 70% at 22% 30%, rgb(var(--zn-accent) / 0.45), transparent 75%),
        linear-gradient(160deg, rgb(var(--zn-accent-strong) / 0.35), rgb(var(--zn-shadow)) 70%),
        rgb(var(--zn-shadow));
}

.sx-subs-preview .zn-subs {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    --sub-min: 8px; /* the preview is a scaled-down player */
}

/* ---------------------------------------------------------------- responsive */

@media (max-width: 900px) {
    .sx-page {
        padding: 1.25rem 1rem 3rem;
    }

    .sx-layout {
        grid-template-columns: minmax(0, 1fr);
        gap: 1rem;
    }

    /* Section nav becomes a scrollable chip row at the top. */
    .sx-nav {
        top: 0;
        z-index: 5;
        flex-direction: row;
        gap: 0.375rem;
        margin: 0 -1rem;
        padding: 0.5rem 1rem;
        overflow-x: auto;
        scrollbar-width: none;
        background: rgb(var(--zn-bg) / 0.92);
        -webkit-backdrop-filter: blur(8px);
                backdrop-filter: blur(8px);
    }

    .sx-nav::-webkit-scrollbar {
        display: none;
    }

    .sx-nav-link {
        flex: 0 0 auto;
        padding: 0.4375rem 0.75rem;
        border: 1px solid rgb(var(--zn-fg) / 0.08);
        border-radius: 999px;
    }

    .sx-card {
        scroll-margin-top: 4rem;
    }
}

@media (max-width: 640px) {
    .sx-row {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .sx-control {
        justify-content: flex-start;
    }

    /* A switch is small enough to stay on the label's line. */
    .sx-row[\:has\(.sx-switch\)] {
        flex-direction: row;
        align-items: center;
    }
    .sx-row:has(.sx-switch) {
        flex-direction: row;
        align-items: center;
    }

    .sx-select {
        width: 100%;
    }

    .sx-card-head,
    .sx-row,
    .sx-card-foot {
        padding-left: 1.125rem;
        padding-right: 1.125rem;
    }

    .sx-themes,
    .sx-modules {
        padding-left: 1.125rem;
        padding-right: 1.125rem;
    }

    .sx-notice,
    .sx-subs-preview {
        margin-left: 1.125rem;
        margin-right: 1.125rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .sx-switch,
    .sx-switch::after,
    .sx-theme-card,
    .sx-btn {
        transition: none;
    }
}

/* Admin -> Libraries (rows reuse the settings page's sx-module styles). */

.lib-admin-row {
    align-items: center;
    gap: 0.875rem;
}

.lib-admin-fields {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.5rem 0.875rem;
}

.lib-admin-field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.lib-admin-caption {
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: rgb(var(--zn-muted));
}

.lib-admin-name {
    width: 14rem;
    max-width: 100%;
    padding: 0 0.75rem;
}

.lib-admin-source {
    flex-basis: 100%;
    font-size: 0.75rem;
    color: rgb(var(--zn-muted));
}

.lib-admin-row[\:has\(.sx-switch\:not\(\:checked\)\)] .lib-admin-fields {
    opacity: 0.55;
}

.lib-admin-row:has(.sx-switch:not(:checked)) .lib-admin-fields {
    opacity: 0.55;
}

/* Title count next to a library page heading. */
.section-count {
    margin-left: 0.375rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: rgb(var(--zn-muted));
}

/* Blurred poster previews (blur-placeholders.js): a 32×32 canvas stretched under the poster
   while it loads; the <img> fades in over it. */

.anime-card-poster,
.cw-card-poster {
    position: relative;
}

.zn-blur {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
    pointer-events: none;
}

/* Positioned (no z-index) so it paints over the canvas but stays under the card's overlay. */
.anime-card-poster > img,
.cw-card-poster > img {
    position: relative;
}

/* Home cards: mark as watched, "+N" grouped shows, undo toast, module skeletons.
   Cards themselves are styled in zanime.css (.cw-*). Theme tokens only (THEMES.md). */

.cw-card {
    position: relative;
}

.cw-card-link {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    color: inherit;
    text-decoration: none;
    border-radius: calc(8px * var(--zn-roundness));
}

.cw-card-link.focus-visible {
    outline: 2px solid rgb(var(--zn-focus));
    outline-offset: 2px;
}

.cw-card-link:focus-visible {
    outline: 2px solid rgb(var(--zn-focus));
    outline-offset: 2px;
}

/* ---- Buttons on the poster ------------------------------------------------ */

.cw-mark-btn,
.cw-group-badge {
    position: absolute;
    top: 0.4rem;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgb(var(--zn-fg) / 0.18);
    background: rgb(var(--zn-overlay) / 0.82);
    color: rgb(var(--zn-text));
    cursor: pointer;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    transition: opacity 0.15s, background-color 0.15s, color 0.15s, transform 0.15s;
}

.cw-mark-btn {
    right: 0.4rem;
    width: 1.875rem;
    height: 1.875rem;
    border-radius: 9999px;
    opacity: 0;
}

.cw-mark-btn svg,
.cw-group-mark svg {
    width: 1rem;
    height: 1rem;
}

.cw-card:hover .cw-mark-btn,
.cw-card[focus-within] .cw-mark-btn {
    opacity: 1;
}

.cw-card:hover .cw-mark-btn,
.cw-card:focus-within .cw-mark-btn {
    opacity: 1;
}

.cw-mark-btn:hover,
.cw-mark-btn.focus-visible {
    background: rgb(var(--zn-accent-strong));
    border-color: transparent;
    color: rgb(var(--zn-on-accent));
    transform: scale(1.08);
}

.cw-mark-btn:hover,
.cw-mark-btn:focus-visible {
    background: rgb(var(--zn-accent-strong));
    border-color: transparent;
    color: rgb(var(--zn-on-accent));
    transform: scale(1.08);
}

.cw-group-badge {
    left: 0.4rem;
    min-width: 1.875rem;
    height: 1.5rem;
    padding: 0 0.45rem;
    border-radius: calc(9999px * var(--zn-roundness));
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.cw-group-badge[hidden] {
    display: none;
}

.cw-group-badge:hover,
.cw-group-badge.focus-visible,
.cw-group-badge[aria-expanded="true"] {
    background: rgb(var(--zn-accent-strong));
    border-color: transparent;
    color: rgb(var(--zn-on-accent));
}

.cw-group-badge:hover,
.cw-group-badge:focus-visible,
.cw-group-badge[aria-expanded="true"] {
    background: rgb(var(--zn-accent-strong));
    border-color: transparent;
    color: rgb(var(--zn-on-accent));
}

.cw-mark-btn.focus-visible,
.cw-group-badge.focus-visible,
.cw-group-mark.focus-visible,
.cw-toast-undo.focus-visible {
    outline: 2px solid rgb(var(--zn-focus));
    outline-offset: 2px;
}

.cw-mark-btn:focus-visible,
.cw-group-badge:focus-visible,
.cw-group-mark:focus-visible,
.cw-toast-undo:focus-visible {
    outline: 2px solid rgb(var(--zn-focus));
    outline-offset: 2px;
}

/* Touch screens have no hover: keep the button visible. */
@media (hover: none), (pointer: coarse) {
    .cw-mark-btn {
        opacity: 1;
    }
}

/* ---- "+N" panel (moved to <body> while open, see home-cards.js) ----------- */

.cw-group-list[hidden] {
    display: none;
}

.cw-group-panel {
    position: fixed;
    z-index: 60;
    width: min(18rem, calc(100vw - 1rem));
    max-height: min(22rem, calc(100vh - 1rem));
    overflow-y: auto;
    padding: 0.5rem;
    border-radius: calc(10px * var(--zn-roundness));
    border: 1px solid rgb(var(--zn-fg) / 0.1);
    background: rgb(var(--zn-overlay) / 0.97);
    box-shadow: 0 12px 32px rgb(var(--zn-shadow) / 0.45);
    color: rgb(var(--zn-text-soft));
}

.cw-group-head {
    margin: 0.15rem 0.4rem 0.4rem;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: rgb(var(--zn-muted));
}

.cw-group-panel ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.cw-group-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.cw-group-resume {
    flex: 1 1 auto;
    min-width: 0;
    display: grid;
    grid-template-columns: auto 1fr;
    grid-column-gap: 0.5rem;
    -moz-column-gap: 0.5rem;
         column-gap: 0.5rem;
    grid-row-gap: 0.3rem;
    row-gap: 0.3rem;
    align-items: baseline;
    padding: 0.45rem 0.5rem;
    border-radius: calc(6px * var(--zn-roundness));
    color: inherit;
    text-decoration: none;
}

.cw-group-resume:hover,
.cw-group-resume.focus-visible {
    background: rgb(var(--zn-fg) / 0.07);
    outline: none;
}

.cw-group-resume:hover,
.cw-group-resume:focus-visible {
    background: rgb(var(--zn-fg) / 0.07);
    outline: none;
}

.cw-group-ep {
    font-size: 0.8125rem;
    font-weight: 600;
    color: rgb(var(--zn-text));
}

.cw-group-name {
    font-size: 0.8125rem;
    color: rgb(var(--zn-muted));
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cw-group-progress {
    grid-column: 1 / -1;
    height: 3px;
    border-radius: 9999px;
    background: rgb(var(--zn-fg) / 0.12);
    overflow: hidden;
}

.cw-group-progress > span {
    display: block;
    height: 100%;
    background: rgb(var(--zn-accent-strong));
}

.cw-group-mark {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border: 0;
    border-radius: 9999px;
    background: transparent;
    color: rgb(var(--zn-muted));
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s;
}

.cw-group-mark:hover,
.cw-group-mark.focus-visible {
    background: rgb(var(--zn-accent-strong));
    color: rgb(var(--zn-on-accent));
}

.cw-group-mark:hover,
.cw-group-mark:focus-visible {
    background: rgb(var(--zn-accent-strong));
    color: rgb(var(--zn-on-accent));
}

/* ---- Undo toast ----------------------------------------------------------- */

.cw-toast {
    position: fixed;
    left: 50%;
    bottom: max(1.25rem, env(safe-area-inset-bottom));
    z-index: 70;
    display: flex;
    align-items: center;
    gap: 0.875rem;
    max-width: calc(100vw - 2rem);
    padding: 0.6rem 0.6rem 0.6rem 1rem;
    border-radius: calc(10px * var(--zn-roundness));
    border: 1px solid rgb(var(--zn-fg) / 0.1);
    background: rgb(var(--zn-overlay) / 0.97);
    box-shadow: 0 12px 32px rgb(var(--zn-shadow) / 0.45);
    color: rgb(var(--zn-text));
    font-size: 0.875rem;
    transform: translate(-50%, 0);
    transition: opacity 0.2s, transform 0.2s;
}

.cw-toast[hidden] {
    display: none;
}

.cw-toast.is-leaving {
    opacity: 0;
    transform: translate(-50%, 0.5rem);
}

.cw-toast.is-error {
    color: rgb(var(--zn-danger-text));
}

.cw-toast-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cw-toast-undo {
    flex: 0 0 auto;
    padding: 0.35rem 0.75rem;
    border: 0;
    border-radius: calc(6px * var(--zn-roundness));
    background: rgb(var(--zn-fg) / 0.08);
    color: rgb(var(--zn-accent-soft));
    font-weight: 600;
    cursor: pointer;
}

.cw-toast-undo:hover {
    background: rgb(var(--zn-fg) / 0.14);
}

.cw-toast-undo[hidden] {
    display: none;
}

/* ---- Profiles skeleton (matches partials/modules/profiles.php) ------------- */

.cw-avatar-skeletons {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
}

.cw-avatar-skeleton {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    width: 5rem;
}

.cw-avatar-skeleton .cw-skeleton-box {
    display: block;
    width: 4rem;
    height: 4rem;
    border-radius: 9999px;
}

.cw-avatar-skeleton .cw-skeleton-line {
    display: block;
    width: 70%;
    margin-top: 0.35rem;
}

@media (prefers-reduced-motion: reduce) {
    .cw-mark-btn,
    .cw-group-badge,
    .cw-toast {
        transition: none;
    }
}

/* ---- Title and episode line are links of their own ------------------------- */

/* The poster plays; the title opens the show (or movie) page; the episode line plays. */
a.cw-card-title,
a.cw-card-sub {
    display: block;
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

a.cw-card-title:hover {
    color: rgb(var(--zn-accent));
}

a.cw-card-sub:hover {
    color: rgb(var(--zn-text-soft));
}

a.cw-card-title.focus-visible {
    outline: 2px solid rgb(var(--zn-focus));
    outline-offset: 2px;
    border-radius: 2px;
}

a.cw-card-title:focus-visible {
    outline: 2px solid rgb(var(--zn-focus));
    outline-offset: 2px;
    border-radius: 2px;
}

/* "Add to playlist" dialog (item.php, playlist-dialog.js), spoiler protection on the show page
   episode list (partials/episode-item.php) and the Spoilers settings card. Theme tokens only
   (THEMES.md). The player's spoiler styles live in player-overlay.css. */

/* ---- Item actions: Favorite + Add to playlist on one row ------------------- */

.item-actions[\:has\(\[data-playlist-open\]\)] {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
}

.item-actions:has([data-playlist-open]) {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
}

.item-actions[\:has\(\[data-playlist-open\]\)] .item-action-feedback {
    flex-basis: 100%;
}

.item-actions:has([data-playlist-open]) .item-action-feedback {
    flex-basis: 100%;
}

/* ---- Add to playlist dialog ------------------------------------------------ */

.pl-dialog {
    width: min(26rem, calc(100vw - 2rem));
    max-height: min(34rem, calc(100vh - 2rem));
    padding: 0;
    border: 1px solid rgb(var(--zn-fg) / 0.1);
    border-radius: var(--zn-radius-lg);
    background: rgb(var(--zn-overlay) / 0.98);
    color: rgb(var(--zn-text));
    box-shadow: 0 20px 50px rgb(var(--zn-shadow) / 0.55);
    overflow: hidden;
}

.pl-dialog[open] {
    display: flex;
    flex-direction: column;
    animation: pl-dialog-in 0.18s ease;
}

.pl-dialog::backdrop {
    background: rgba(0, 0, 0, 0.55);
}

@keyframes pl-dialog-in {
    from { opacity: 0; transform: translateY(8px) scale(0.98); }
    to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
    .pl-dialog[open] { animation: none; }
}

.pl-dialog-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1rem 0 1.25rem;
}

.pl-dialog-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
}

.pl-dialog-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border: 0;
    border-radius: var(--zn-radius);
    background: transparent;
    color: rgb(var(--zn-muted));
    cursor: pointer;
}

.pl-dialog-close:hover {
    background: rgb(var(--zn-fg) / 0.08);
    color: rgb(var(--zn-text));
}

.pl-dialog-sub {
    margin: 0.15rem 0 0;
    padding: 0 1.25rem;
    font-size: 0.8rem;
    color: rgb(var(--zn-muted));
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pl-list {
    list-style: none;
    margin: 0.75rem 0 0;
    padding: 0 0.5rem;
    flex: 1 1 auto;
    min-height: 3rem;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.pl-option {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 0;
    border-radius: var(--zn-radius);
    background: transparent;
    color: rgb(var(--zn-text-soft));
    font: inherit;
    font-size: 0.9rem;
    text-align: left;
    cursor: pointer;
}

.pl-option:hover:not(:disabled) {
    background: rgb(var(--zn-accent) / 0.14);
    color: rgb(var(--zn-text));
}

.pl-option-icon {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: var(--zn-radius-sm);
    background: rgb(var(--zn-fg) / 0.06);
    color: rgb(var(--zn-muted));
}

.pl-option:hover:not(:disabled) .pl-option-icon {
    color: rgb(var(--zn-accent-soft));
}

.pl-option-name {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pl-option-meta {
    flex: 0 0 auto;
    font-size: 0.75rem;
    color: rgb(var(--zn-subtle));
}

.pl-option.is-added {
    cursor: default;
    color: rgb(var(--zn-text));
}

.pl-option.is-added .pl-option-icon {
    background: rgb(var(--zn-success) / 0.18);
    color: rgb(var(--zn-success-text));
}

.pl-option.is-added .pl-option-meta {
    color: rgb(var(--zn-success-text));
}

.pl-option.is-busy {
    opacity: 0.6;
    cursor: progress;
}

.pl-empty {
    padding: 0.75rem;
    font-size: 0.85rem;
    color: rgb(var(--zn-muted));
}

.pl-retry {
    border: 0;
    padding: 0;
    background: none;
    color: rgb(var(--zn-accent-soft));
    font: inherit;
    text-decoration: underline;
    cursor: pointer;
}

.pl-skeleton {
    height: 2.95rem;
    margin: 0 0 2px;
    border-radius: var(--zn-radius);
    background: linear-gradient(90deg, rgb(var(--zn-fg) / 0.04), rgb(var(--zn-fg) / 0.09), rgb(var(--zn-fg) / 0.04));
    background-size: 200% 100%;
    animation: pl-shimmer 1.2s linear infinite;
}

@keyframes pl-shimmer {
    from { background-position: 100% 0; }
    to   { background-position: -100% 0; }
}

.pl-new {
    margin: 0.5rem 0 0;
    padding: 0.85rem 1.25rem 0;
    border-top: 1px solid rgb(var(--zn-fg) / 0.08);
}

.pl-new-label {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: rgb(var(--zn-muted));
}

.pl-new-row {
    display: flex;
    gap: 0.5rem;
}

.pl-new-input {
    flex: 1 1 auto;
    min-width: 0;
    padding: 0.5rem 0.7rem;
    border: 1px solid rgb(var(--zn-fg) / 0.12);
    border-radius: var(--zn-radius);
    background: rgb(var(--zn-surface-2));
    color: rgb(var(--zn-text));
    font: inherit;
    font-size: 0.875rem;
}

.pl-new-input:focus {
    outline: none;
    border-color: rgb(var(--zn-accent) / 0.6);
}

.pl-new-btn {
    flex: 0 0 auto;
    padding: 0.5rem 0.85rem;
    border: 0;
    border-radius: var(--zn-radius);
    background: rgb(var(--zn-accent-strong));
    color: rgb(var(--zn-on-accent));
    font: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

.pl-new-btn:hover:not(:disabled) {
    background: rgb(var(--zn-accent-hover));
}

.pl-new-btn:disabled {
    opacity: 0.6;
    cursor: progress;
}

.pl-status {
    min-height: 1.25rem;
    margin: 0;
    padding: 0.6rem 1.25rem 1rem;
    font-size: 0.8rem;
    color: rgb(var(--zn-success-text));
}

.pl-status.is-error {
    color: rgb(var(--zn-danger-text));
}

.pl-dialog button.focus-visible {
    outline: 2px solid rgb(var(--zn-focus));
    outline-offset: 2px;
}

.pl-dialog input.focus-visible {
    outline: 2px solid rgb(var(--zn-focus));
    outline-offset: 2px;
}

.pl-dialog button.focus-visible {
    outline: 2px solid rgb(var(--zn-focus));
    outline-offset: 2px;
}

.pl-dialog button:focus-visible {
    outline: 2px solid rgb(var(--zn-focus));
    outline-offset: 2px;
}

.pl-dialog input.focus-visible {
    outline: 2px solid rgb(var(--zn-focus));
    outline-offset: 2px;
}

.pl-dialog input:focus-visible {
    outline: 2px solid rgb(var(--zn-focus));
    outline-offset: 2px;
}

/* ---- Spoiler protection: show page episode list --------------------------- */

/* Blur the still; scaled up a little so the blurred edge doesn't show the background. */
.episode-item.is-spoiler-blur .episode-thumb img {
    filter: blur(14px) saturate(0.85);
    transform: scale(1.12);
    transition: filter 0.25s ease, transform 0.25s ease;
}

/* Peek: keep the pointer on a card for a moment to unblur it (not on touch, where a tap plays). */
@media (hover: hover) {
    .episode-item.is-spoiler-blur:hover .episode-thumb img {
        filter: none;
        transform: none;
        transition-delay: 0.8s;
    }
}

.episode-overview-hidden {
    font-style: italic;
    color: rgb(var(--zn-subtle));
}

/* ---- Settings > Spoilers --------------------------------------------------- */

.sx-row-sub {
    padding-left: 3rem;
}

.sx-row-sub.is-disabled .sx-row-text,
.sx-row-sub.is-disabled .sx-control {
    opacity: 0.45;
}

.sx-row-sub .sx-switch:disabled {
    cursor: not-allowed;
}

@media (max-width: 640px) {
    .sx-row.sx-row-sub {
        padding-left: 2rem;
    }
}

/* "Your stats" page (/stats, app/views/stats.php + app/src/js/my-stats.js). */

.ms-page {
    max-width: 68rem;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.ms-page [hidden] {
    display: none !important;
}

.ms-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.25rem;
}

.ms-title {
    font-family: inherit;
    font-family: var(--zn-font-display, inherit);
    font-size: 1.625rem;
    font-weight: 800;
    color: rgb(var(--zn-text));
    letter-spacing: -0.01em;
}

.ms-sub {
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: rgb(var(--zn-muted));
}

.ms-badge {
    flex-shrink: 0;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.25rem 0.625rem;
    border-radius: 999px;
    color: rgb(var(--zn-warning));
    background: rgb(var(--zn-warning) / 0.12);
    border: 1px solid rgb(var(--zn-warning) / 0.3);
}

/* ------------------------------------------------------------ cards */

.ms-card {
    background: rgb(var(--zn-surface));
    border: 1px solid rgb(var(--zn-fg) / 0.07);
    border-radius: calc(14px * var(--zn-roundness));
    padding: 1.125rem 1.25rem;
    min-width: 0;
}

.ms-grid {
    display: grid;
    grid-gap: 0.875rem;
    gap: 0.875rem;
}

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

.ms-grid-tiles {
    grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
}

.ms-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: rgb(var(--zn-muted));
}

.ms-hero {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    position: relative;
    overflow: hidden;
}

.ms-hero:first-child {
    background:
        radial-gradient(120% 140% at 100% 0%, rgb(var(--zn-accent) / 0.22), transparent 60%),
        rgb(var(--zn-surface));
    border-color: rgb(var(--zn-accent) / 0.25);
}

.ms-big {
    font-family: inherit;
    font-family: var(--zn-font-display, inherit);
    font-size: 2.125rem;
    line-height: 1.1;
    font-weight: 800;
    color: rgb(var(--zn-text));
    font-feature-settings: "tnum";
    font-variant-numeric: tabular-nums;
}

.ms-trend {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.8125rem;
    font-weight: 600;
}

.ms-trend svg {
    width: 0.95rem;
    height: 0.95rem;
}

.ms-trend-up { color: rgb(var(--zn-success)); color: rgb(var(--zn-success-text, var(--zn-success))); }
.ms-trend-down { color: rgb(var(--zn-danger)); color: rgb(var(--zn-danger-text, var(--zn-danger))); }
.ms-trend-flat,
.ms-trend-none { color: rgb(var(--zn-subtle)); font-weight: 500; }

.ms-tile {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s ease, transform 0.15s ease;
}

a.ms-tile:hover {
    border-color: rgb(var(--zn-accent) / 0.4);
    transform: translateY(-1px);
}

a.ms-tile.focus-visible {
    outline: 2px solid rgb(var(--zn-focus));
    outline-offset: 2px;
}

a.ms-tile:focus-visible {
    outline: 2px solid rgb(var(--zn-focus));
    outline-offset: 2px;
}

.ms-tile-value {
    font-family: inherit;
    font-family: var(--zn-font-display, inherit);
    font-size: 1.625rem;
    font-weight: 800;
    color: rgb(var(--zn-text));
    font-feature-settings: "tnum";
    font-variant-numeric: tabular-nums;
    line-height: 1.15;
}

.ms-tile-sub {
    font-size: 0.8125rem;
    color: rgb(var(--zn-text-soft) / 0.8);
}

/* ------------------------------------------------------------ daily chart */

.ms-card-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.ms-card-title,
.ms-section-title {
    font-size: 1.0625rem;
    font-weight: 700;
    color: rgb(var(--zn-text));
}

.ms-card-note {
    font-size: 0.8125rem;
    color: rgb(var(--zn-muted));
}

.ms-chart-wrap {
    display: flex;
    gap: 0.625rem;
}

.ms-scale {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 9rem;
    font-size: 0.6875rem;
    color: rgb(var(--zn-subtle));
    text-align: right;
    flex-shrink: 0;
    font-feature-settings: "tnum";
    font-variant-numeric: tabular-nums;
}

.ms-bars {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 9rem;
    padding-bottom: 1.25rem;
    box-sizing: content-box;
    border-bottom: 1px solid rgb(var(--zn-fg) / 0.08);
    background-image: linear-gradient(to bottom, rgb(var(--zn-fg) / 0.06) 1px, transparent 1px);
    background-size: 100% 50%;
    background-repeat: repeat-y;
    background-clip: content-box;
}

.ms-bar {
    position: relative;
    flex: 1;
    height: 100%;
    display: flex;
    align-items: flex-end;
    border-radius: 3px 3px 0 0;
    cursor: default;
}

.ms-bar:hover {
    background: rgb(var(--zn-fg) / 0.05);
}

.ms-bar-fill {
    display: block;
    width: 100%;
    border-radius: calc(4px * var(--zn-roundness)) calc(4px * var(--zn-roundness)) 1px 1px;
    background: linear-gradient(to top, rgb(var(--zn-accent-strong)), rgb(var(--zn-accent-soft)));
    opacity: 0.8;
    transition: opacity 0.15s ease;
}

.ms-bar.is-weekend .ms-bar-fill {
    opacity: 0.6;
}

.ms-bar:hover .ms-bar-fill,
.ms-bar.is-today .ms-bar-fill {
    opacity: 1;
}

.ms-bar-tick {
    position: absolute;
    top: calc(100% + 0.375rem);
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.6875rem;
    color: rgb(var(--zn-subtle));
    white-space: nowrap;
    pointer-events: none;
}

.ms-bar:first-child .ms-bar-tick { left: 0; transform: none; }
.ms-bar:last-child .ms-bar-tick { left: auto; right: 0; transform: none; }

.ms-chart-empty {
    padding: 2rem 0;
    text-align: center;
    font-size: 0.875rem;
    color: rgb(var(--zn-muted));
}

/* ------------------------------------------------------------ posters */

.ms-section {
    margin-top: 0.5rem;
    min-width: 0;
}

/* Top shows and top movies side by side when there's room; one alone takes the full width. */
.ms-top-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 24rem), 1fr));
    grid-gap: 1.25rem 2rem;
    gap: 1.25rem 2rem;
}

.ms-top-grid[\:not-has\(\%3E\%20.ms-section\:not\(\[hidden\]\)\)] {
    display: none;
}

.ms-top-grid:not(:has(> .ms-section:not([hidden]))) {
    display: none;
}

.ms-section-title {
    margin-bottom: 0.875rem;
}

.ms-posters {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 9.5rem));
    grid-gap: 0.875rem;
    gap: 0.875rem;
}

.ms-poster {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    text-decoration: none;
    color: inherit;
    min-width: 0;
}

.ms-poster-art {
    position: relative;
    aspect-ratio: 2 / 3;
    border-radius: calc(10px * var(--zn-roundness));
    overflow: hidden;
    background:
        linear-gradient(160deg, rgb(var(--zn-accent) / 0.35), rgb(var(--zn-accent) / 0.12)),
        rgb(var(--zn-surface-2));
    background:
        linear-gradient(160deg, rgb(var(--zn-accent) / 0.35), rgb(var(--zn-accent-2, var(--zn-accent)) / 0.12)),
        rgb(var(--zn-surface-2));
    border: 1px solid rgb(var(--zn-fg) / 0.06);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

a.ms-poster:hover .ms-poster-art {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgb(var(--zn-shadow) / 0.35);
}

a.ms-poster.focus-visible .ms-poster-art {
    outline: 2px solid rgb(var(--zn-focus));
    outline-offset: 2px;
}

a.ms-poster:focus-visible .ms-poster-art {
    outline: 2px solid rgb(var(--zn-focus));
    outline-offset: 2px;
}

.ms-poster-art img {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    -o-object-fit: cover;
       object-fit: cover;
    z-index: 1;
}

.ms-poster-initial {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    display: grid;
    align-items: center;
    justify-items: center;
    place-items: center;
    font-family: inherit;
    font-family: var(--zn-font-display, inherit);
    font-size: 2.5rem;
    font-weight: 800;
    color: rgb(var(--zn-text) / 0.55);
}

.ms-rank {
    position: absolute;
    left: 0.375rem;
    top: 0.375rem;
    z-index: 2;
    min-width: 1.5rem;
    height: 1.5rem;
    padding: 0 0.375rem;
    display: grid;
    align-items: center;
    justify-items: center;
    place-items: center;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 800;
    color: rgb(var(--zn-on-accent));
    background: rgb(var(--zn-accent-strong));
    box-shadow: 0 2px 6px rgb(var(--zn-shadow) / 0.4);
}

.ms-poster-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: rgb(var(--zn-text));
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ms-poster-meta {
    margin-top: -0.25rem;
    font-size: 0.75rem;
    color: rgb(var(--zn-muted));
}

/* ------------------------------------------------------------ most rewatched */

.ms-rewatch {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    max-width: 30rem;
}

.ms-rewatch-poster {
    width: 5.5rem;
    flex-shrink: 0;
}

.ms-rewatch-poster .ms-poster-title {
    display: none;
}

.ms-rewatch-poster .ms-poster-initial {
    font-size: 1.75rem;
}

.ms-rewatch-count {
    font-family: inherit;
    font-family: var(--zn-font-display, inherit);
    font-size: 2.25rem;
    font-weight: 800;
    line-height: 1;
    color: rgb(var(--zn-accent-soft));
}

.ms-rewatch-name {
    margin: 0.375rem 0 0.25rem;
    font-size: 1rem;
    font-weight: 700;
    color: rgb(var(--zn-text));
}

/* ------------------------------------------------------------ empty / error / loading */

.ms-empty {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 1.75rem;
    background:
        radial-gradient(90% 120% at 0% 0%, rgb(var(--zn-accent) / 0.16), transparent 60%),
        rgb(var(--zn-surface));
}

.ms-empty-icon {
    flex-shrink: 0;
    width: 3.5rem;
    height: 3.5rem;
    display: grid;
    align-items: center;
    justify-items: center;
    place-items: center;
    border-radius: calc(14px * var(--zn-roundness));
    color: rgb(var(--zn-accent-soft));
    background: rgb(var(--zn-accent) / 0.14);
}

.ms-empty-icon svg {
    width: 1.75rem;
    height: 1.75rem;
}

.ms-empty-title {
    font-family: inherit;
    font-family: var(--zn-font-display, inherit);
    font-size: 1.25rem;
    font-weight: 800;
    color: rgb(var(--zn-text));
}

.ms-empty-text {
    margin: 0.375rem 0 0.625rem;
    font-size: 0.875rem;
    color: rgb(var(--zn-text-soft) / 0.85);
    max-width: 36rem;
}

.ms-empty-link {
    font-size: 0.875rem;
    font-weight: 600;
    color: rgb(var(--zn-accent-soft));
    text-decoration: none;
}

.ms-empty-link:hover {
    text-decoration: underline;
}

.ms-error {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    font-size: 0.875rem;
    color: rgb(var(--zn-text-soft));
}

.ms-retry {
    padding: 0.5rem 0.875rem;
    border-radius: calc(8px * var(--zn-roundness));
    font-size: 0.8125rem;
    font-weight: 600;
    color: rgb(var(--zn-on-accent));
    background: rgb(var(--zn-accent-strong));
}

.ms-retry:hover {
    background: rgb(var(--zn-accent-hover));
}

.ms-skeleton {
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
}

.ms-sk {
    height: 7.5rem;
    background: linear-gradient(90deg, rgb(var(--zn-fg) / 0.04), rgb(var(--zn-fg) / 0.08), rgb(var(--zn-fg) / 0.04));
    background-size: 200% 100%;
    animation: ms-shimmer 1.4s ease-in-out infinite;
}

.ms-sk-sm { height: 5.5rem; }
.ms-sk-chart { height: 13rem; }

@keyframes ms-shimmer {
    from { background-position: 100% 0; }
    to { background-position: -100% 0; }
}

@media (prefers-reduced-motion: reduce) {
    .ms-sk { animation: none; }
    .ms-tile,
    .ms-poster-art { transition: none; }
}

/* ------------------------------------------------------------ small screens */

@media (max-width: 900px) {
    .ms-posters {
        grid-template-columns: repeat(5, minmax(7rem, 1fr));
        overflow-x: auto;
        padding-bottom: 0.25rem;
        scroll-snap-type: x mandatory;
    }

    .ms-poster { scroll-snap-align: start; }
}

@media (max-width: 640px) {
    .ms-grid-hero {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .ms-grid-hero .ms-hero:first-child {
        grid-column: 1 / -1;
    }

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

    .ms-big { font-size: 1.75rem; }
    .ms-title { font-size: 1.375rem; }

    .ms-bars { gap: 2px; }

    .ms-empty {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Item page: "More like this" / "More in <genre>" rows (app/views/item.php, similar-items.js).
   The cards themselves use .recently-added-row + .anime-card from zanime.css. */

.similar-items {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.similar-items .content-section {
    margin-bottom: 2rem;
    min-width: 0;
}

.similar-items .content-section:last-child {
    margin-bottom: 0;
}

/* Room for the hover lift: the row scrolls horizontally, which clips vertically too. */
.similar-items .recently-added-row {
    padding-top: 0.5rem;
    margin-top: -0.5rem;
    padding-left: 0.25rem;
    padding-right: 0.25rem;
    margin-left: -0.25rem;
    margin-right: -0.25rem;
}

/* ---- Skeleton row (shown until the rows arrive) ------------------------- */

.similar-skeleton-card {
    transform: none !important;
}

.similar-skeleton-card {
    pointer-events: none;
}

.similar-skeleton-box,
.similar-skeleton-line {
    background: rgb(var(--zn-fg) / 0.12);
    animation: similar-skeleton-pulse 1.25s ease-in-out infinite;
}

.similar-skeleton-card .anime-card-info {
    display: flex;
    flex-direction: column;
    gap: 0.34rem;
}

.similar-skeleton-line {
    display: block;
    height: 0.72rem;
    width: 100%;
    border-radius: calc(5px * var(--zn-roundness));
}

.similar-skeleton-line.is-short {
    width: 58%;
}

@keyframes similar-skeleton-pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 0.9; }
}

@media (prefers-reduced-motion: reduce) {
    .similar-skeleton-box,
    .similar-skeleton-line {
        animation: none;
    }
}

/* ============================================================
   Phones and touch screens: page-level fixes.

   Every rule in this file sits inside a small-screen or touch media
   query, so desktop (mouse, > 640px) renders exactly as before.
   - (max-width: 640px)  phones: layout, sizes, sheets;
   - (hover: none)       touch screens: no sticky hover effects,
                         hover-only UI made visible, larger hit areas.

   The mobile app shell (mobile-shell.css) draws the fixed bottom tab bar
   and already keeps room for it (padding on .zanime-body, up to 900px);
   it sets --zn-tabbar-h, which things fixed to the bottom here (toasts)
   use to stay above the bar.
   ============================================================ */

/* ---------------------------------------------------------------- general */

@media (max-width: 640px) {
    /* iOS zooms into any field with text under 16px: keep fields at 16px. */
    .zanime-main input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not(.zn-topbar-search-input),
    .zanime-main select,
    .zanime-main textarea,
    .pl-dialog input,
    .login-input {
        font-size: max(16px, 1em);
    }

    .section-title {
        font-size: 1.125rem;
    }

    /* Undo toast stays clear of the tab bar. */
    .cw-toast {
        bottom: calc(0px + max(1rem, env(safe-area-inset-bottom, 0px)));
        bottom: calc(var(--zn-tabbar-h, 0px) + max(1rem, env(safe-area-inset-bottom, 0px)));
    }
}

/* ------------------------------------------------- horizontal card rows */

@media (max-width: 640px) {
    /* Rows run edge to edge (the wrapper pads 1rem) and snap card by card. */
    .zanime-content-wrapper .recently-added-row,
    .zanime-content-wrapper .cw-row {
        gap: 0.75rem;
        margin-left: -1rem;
        margin-right: -1rem;
        padding-left: 1rem;
        padding-right: 1rem;
        scroll-padding-inline: 1rem;
        scroll-snap-type: x proximity;
        overscroll-behavior-x: contain;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .zanime-content-wrapper .recently-added-row::-webkit-scrollbar,
    .zanime-content-wrapper .cw-row::-webkit-scrollbar {
        display: none;
    }

    .recently-added-row > *,
    .cw-row > * {
        scroll-snap-align: start;
    }

    /* About 2.6 posters per screen: the next one peeks in, so the row reads as scrollable. */
    .recently-added-row .anime-card,
    .recently-added-row .anime-card-poster {
        width: max(112px, min(34vw, 150px));
        flex-basis: max(112px, min(34vw, 150px));
    }

    .recently-added-row .anime-card-poster {
        height: auto;
        aspect-ratio: 2 / 3;
    }

    /* Library pills (classic layout) scroll sideways without a scrollbar. */
    .filter-bar {
        margin-left: -1rem;
        margin-right: -1rem;
        padding-left: 1rem;
        padding-right: 1rem;
        scrollbar-width: none;
    }

    .filter-bar::-webkit-scrollbar {
        display: none;
    }

    .filter-bar .filter-pill {
        min-height: 2.5rem;
    }

    /* Profiles: one swipeable row instead of wrapping onto a second line. */
    #profiles > .flex-wrap {
        flex-wrap: nowrap;
        gap: 1rem;
        overflow-x: auto;
        margin-left: -1rem;
        margin-right: -1rem;
        padding: 0.25rem 1rem;
        scrollbar-width: none;
    }

    #profiles > .flex-wrap::-webkit-scrollbar {
        display: none;
    }

    #profiles > .flex-wrap > a {
        flex: 0 0 auto;
    }

    /* Your stats: top shows / movies rows run edge to edge like the home rows. */
    .ms-posters {
        margin-left: -1rem;
        margin-right: -1rem;
        padding-left: 1rem;
        padding-right: 1rem;
        scroll-padding-inline: 1rem;
        scrollbar-width: none;
    }

    .ms-posters::-webkit-scrollbar {
        display: none;
    }
}

/* ------------------------------------------------------------ card grids */

@media (max-width: 640px) {
    /* Three posters per row on phones (two on very narrow screens). */
    .anime-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 1rem 0.625rem;
    }

    .anime-card-title {
        font-size: 0.8125rem;
    }

    .anime-card-meta {
        font-size: 0.75rem;
    }
}

@media (max-width: 359px) {
    .anime-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* ----------------------------------------------------------- genres page */

@media (max-width: 640px) {
    /* The genre cloud took two screens: three rows that scroll sideways instead. */
    .genre-chip-row {
        display: grid;
        grid-auto-flow: column;
        grid-template-rows: repeat(3, auto);
        justify-content: start;
        grid-gap: 0.5rem;
        gap: 0.5rem;
        margin-left: -1rem;
        margin-right: -1rem;
        padding: 0 1rem 0.25rem;
        overflow-x: auto;
        overscroll-behavior-x: contain;
        scrollbar-width: none;
    }

    .genre-chip-row::-webkit-scrollbar {
        display: none;
    }

    .genre-chip {
        min-height: 2.5rem;
        padding: 0 0.875rem;
        font-size: 0.8125rem;
        white-space: nowrap;
    }
}

/* -------------------------------------------- touch: no hover-only parts */

@media (hover: none) {
    /* A tap would leave the card stuck in its hover "lift". */
    .anime-card:hover,
    .anime-card.focus-visible {
        transform: none;
    }
    .anime-card:hover,
    .anime-card:focus-visible {
        transform: none;
    }

    .anime-card:hover .anime-card-poster img {
        transform: none;
    }

    .anime-card:active {
        transform: scale(0.97);
    }

    .anime-card,
    .cw-card-link,
    .episode-item,
    .season-header {
        -webkit-tap-highlight-color: transparent;
    }

    /* The rating only showed on hover. */
    .anime-card-overlay {
        opacity: 1;
        background: linear-gradient(to top, rgba(0, 0, 0, 0.6) 0%, transparent 34%);
    }

    /* Mark-as-watched and "+N": bigger buttons with a 44px hit area. */
    .cw-mark-btn {
        width: 2.25rem;
        height: 2.25rem;
    }

    .cw-group-badge {
        min-width: 2.25rem;
        height: 1.875rem;
    }

    .cw-mark-btn::before,
    .cw-group-badge::before {
        content: "";
        position: absolute;
        top: -0.375rem;
        right: -0.375rem;
        bottom: -0.375rem;
        left: -0.375rem;
    }

    .cw-mark-btn:hover {
        transform: none;
    }
}

/* ------------------------------------------- Continue Watching "+N" sheet */

@media (max-width: 640px) {
    /* home-cards.js places the panel next to the badge; on phones it is a bottom sheet. */
    .cw-group-panel {
        left: 0 !important;
        right: 0 !important;
        top: auto !important;
        bottom: 0 !important;
        width: 100% !important;
    }
    .cw-group-panel {
        max-height: 70vh;
        padding: 0.75rem 0.75rem calc(0.75rem + env(safe-area-inset-bottom, 0px));
        border-radius: calc(18px * var(--zn-roundness)) calc(18px * var(--zn-roundness)) 0 0;
        border-bottom: 0;
        /* The second shadow dims the page behind the sheet (a tap there closes it). */
        box-shadow: 0 -12px 40px rgb(var(--zn-shadow) / 0.55), 0 0 0 100vmax rgba(0, 0, 0, 0.45);
        z-index: 80;
        animation: zn-sheet-in 0.2s ease;
    }

    .cw-group-head {
        font-size: 0.8125rem;
        margin: 0.25rem 0.5rem 0.625rem;
    }

    .cw-group-resume {
        min-height: 2.75rem;
        align-items: center;
    }

    .cw-group-mark {
        width: 2.75rem;
        height: 2.75rem;
    }
}

@keyframes zn-sheet-in {
    from { transform: translateY(24px); opacity: 0; }
    to   { transform: none; opacity: 1; }
}

/* ---------------------------------------------------- show / movie page */

@media (max-width: 640px) {
    /* Poster beside the title, everything else full width below. */
    .item-top {
        grid-template-columns: 7.25rem minmax(0, 1fr);
        -moz-column-gap: 1rem;
             column-gap: 1rem;
        row-gap: 0;
        padding: 1rem;
    }

    .item-meta-col {
        display: contents;
    }

    .item-meta-col > * {
        position: relative;
        z-index: 1;
        grid-column: 1 / -1;
        margin-top: 0.875rem;
    }

    .item-poster-col {
        grid-column: 1;
        grid-row: 1 / span 4;
        max-width: none;
        align-self: start;
    }

    .item-meta-col > .item-title,
    .item-meta-col > .item-original-title,
    .item-meta-col > .item-badges {
        grid-column: 2;
        margin-top: 0;
        margin-bottom: 0.5rem;
    }

    .item-title {
        font-size: 1.25rem;
        line-height: 1.25;
        word-wrap: anywhere;
        display: -webkit-box;
        -webkit-line-clamp: 4;
        line-clamp: 4;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .item-original-title {
        font-size: 0.8125rem;
    }

    .item-badges {
        gap: 0.375rem;
    }

    /* The backdrop shows at the top and fades into the card. */
    .item-backdrop-bg {
        opacity: 0.35;
    }

    .item-backdrop-overlay {
        background: linear-gradient(to bottom, rgb(var(--zn-surface) / 0.35) 0%, rgb(var(--zn-surface)) 70%);
    }

    /* Long summaries fold to six lines (mobile-pages.js adds the "More" toggle). */
    .item-overview.is-clamped {
        display: -webkit-box;
        -webkit-line-clamp: 6;
        line-clamp: 6;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .item-overview-toggle {
        position: relative;
        z-index: 1;
        grid-column: 1 / -1;
        justify-self: start;
        min-height: 2.75rem;
        margin: -0.25rem 0 -0.5rem;
        padding: 0 0.25rem;
        border: 0;
        background: none;
        color: rgb(var(--zn-accent-soft));
        font-size: 0.875rem;
        font-weight: 600;
        cursor: pointer;
    }

    .item-watch-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: 3rem;
        width: 100%;
    }

    .item-actions,
    .item-actions[\:has\(\[data-playlist-open\]\)] {
        max-width: none;
        flex-direction: row;
        flex-wrap: wrap;
    }

    .item-actions,
    .item-actions:has([data-playlist-open]) {
        max-width: none;
        flex-direction: row;
        flex-wrap: wrap;
    }

    .item-action-btn {
        flex: 1 1 0;
        min-height: 2.75rem;
        font-size: 0.875rem;
        white-space: nowrap;
    }

    .item-action-feedback {
        flex-basis: 100%;
    }

    /* Seasons */
    .season-controls {
        flex-direction: row;
        align-items: center;
        padding: 0.5rem 0.5rem 0.5rem 1rem;
    }

    .season-collapse-all {
        min-height: 2.75rem;
        padding: 0 0.75rem;
        font-size: 0.875rem;
    }

    .season-jump {
        padding: 0.5rem 1rem;
        gap: 0.5rem;
    }

    .season-chip {
        min-height: 2.5rem;
        min-width: 2.75rem;
        padding: 0 0.875rem;
        font-size: 0.875rem;
    }

    .season-header {
        min-height: 3.5rem;
        padding: 0.875rem 1rem;
        -moz-column-gap: 0.5rem;
             column-gap: 0.5rem;
    }

    /* Episodes: small thumbnail beside the text instead of a full-width image. */
    .episode-item {
        grid-template-columns: 8.5rem minmax(0, 1fr);
        gap: 0.75rem;
        padding: 0.75rem 1rem;
    }

    .episode-info {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        gap: 0.25rem 0.5rem;
        min-width: 0;
    }

    .episode-title,
    .episode-overview {
        flex-basis: 100%;
        min-width: 0;
    }

    .episode-title {
        font-size: 0.875rem;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        word-wrap: anywhere;
    }

    .episode-overview {
        margin-top: 0.125rem;
        -webkit-line-clamp: 2;
        line-clamp: 2;
    }

    .episode-state-pill {
        font-size: 0.6875rem;
        padding: 0.0625rem 0.4375rem;
    }

    .episode-thumb-play {
        font-size: 1rem;
    }
}

/* ------------------------------------------------ "Add to playlist" sheet */

@media (max-width: 640px) {
    .pl-dialog {
        top: auto;
        right: 0;
        bottom: 0;
        left: 0;
        width: 100%;
        max-width: none;
        max-height: 85vh;
        margin: 0;
        border-bottom: 0;
        border-radius: var(--zn-radius-lg) var(--zn-radius-lg) 0 0;
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }

    .pl-dialog[open] {
        animation-name: zn-sheet-in;
    }

    .pl-dialog-close {
        width: 2.75rem;
        height: 2.75rem;
    }

    .pl-option {
        min-height: 2.75rem;
    }

    .pl-new-input,
    .pl-new-btn {
        min-height: 2.75rem;
    }
}

/* -------------------------------------------- settings (new style: sx-*) */

@media (max-width: 640px) {
    .sx-nav-link {
        min-height: 2.5rem;
        display: inline-flex;
        align-items: center;
    }

    .sx-select,
    .sx-number,
    .sx-btn {
        min-height: 2.75rem;
    }

    .sx-icon-btn {
        width: 2.75rem;
        height: 2.75rem;
    }

    /* Up/down arrows stacked, so the row text keeps its width. */
    .sx-module .sx-module-move {
        flex-direction: column;
        gap: 0;
    }

    .sx-module .sx-icon-btn {
        height: 2.25rem;
    }

    .lib-admin-row .sx-module-move {
        flex-direction: row;
    }

    .lib-admin-row .sx-icon-btn {
        height: 2.75rem;
    }

    .sx-module {
        gap: 0.5rem;
        padding-right: 0.25rem;
    }

    .sx-card-foot {
        flex-wrap: wrap;
    }

    .sx-card-foot .sx-btn {
        flex: 1 1 auto;
        justify-content: center;
    }

    /* Admin -> Libraries: switch and arrows on top, fields full width below. */
    .lib-admin-row {
        display: grid;
        grid-template-columns: auto 1fr auto;
        grid-template-areas:
            "switch . move"
            "fields fields fields";
        grid-row-gap: 0.5rem;
        row-gap: 0.5rem;
        padding: 0.75rem;
    }

    .lib-admin-row > .sx-switch { grid-area: switch; }
    .lib-admin-row > .sx-module-move { grid-area: move; }

    .lib-admin-fields {
        grid-area: fields;
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        grid-gap: 0.625rem;
        gap: 0.625rem;
    }

    .lib-admin-name,
    .lib-admin-field .sx-select {
        width: 100%;
    }

    .lib-admin-caption {
        font-size: 0.75rem;
    }
}

/* ------------------------- settings-style pages (family, requests, switch) */

@media (max-width: 640px) {
    .settings-page {
        padding: 1.25rem 1rem;
        max-width: none;
    }

    .settings-input,
    .settings-select {
        min-height: 2.75rem;
    }

    .settings-save-btn {
        min-height: 2.75rem;
        width: 100%;
    }

    .family-switch-card {
        padding: 1.25rem 1rem;
    }

    /* Two members per row instead of one tall column. */
    .family-switch-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.625rem;
    }

    .family-switch-member {
        min-width: 0;
        padding: 0.875rem 0.5rem;
    }

    .family-switch-name {
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

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

    .family-list-item,
    .family-card strong,
    .family-card span {
        word-wrap: anywhere;
    }
}

/* ----------------------------------------------------------------- admin */

@media (max-width: 640px) {
    .admin-section-nav {
        flex-wrap: nowrap;
        overflow-x: auto;
        margin-left: -1rem;
        margin-right: -1rem;
        padding-left: 1rem;
        padding-right: 1rem;
        scrollbar-width: none;
    }

    .admin-section-nav::-webkit-scrollbar {
        display: none;
    }

    .admin-section-link {
        flex: 0 0 auto;
        min-height: 2.5rem;
        white-space: nowrap;
    }

    .admin-segment {
        min-height: 2.5rem;
    }

    .admin-btn--small {
        min-height: 2.25rem;
        padding: 0.375rem 0.875rem;
        font-size: 0.8125rem;
    }

    .admin-queue-row {
        grid-template-columns: minmax(0, 1fr);
    }

    .admin-queue-actions {
        justify-self: start;
    }

    .admin-queue-meta,
    .admin-queue-error {
        font-size: 0.8125rem;
        word-wrap: anywhere;
    }
}

@media (prefers-reduced-motion: reduce) {
    .cw-group-panel,
    .pl-dialog[open] {
        animation: none;
    }
}

/* Phones: the mark-watched buttons on home cards stay desktop-only (the item page has its own). */
@media (max-width: 900px) {
    .cw-mark-btn,
    .cw-group-mark {
        display: none;
    }
}

/* ============================================================
   Holiday decorations (FestiveService). Everything here only
   applies while the app layout sets <html data-festive="<id>">:
   - a small accent on the logo (markup: partials/festive-mark.php),
     drawn absolutely so the logo and the header don't move;
   - falling snow / leaves (festive.js builds .zn-festive-sky),
     click-through, paused in hidden tabs, off with reduced motion.
   ============================================================ */

[data-festive] .sidebar-logo {
    position: relative;
}

.zn-festive-mark {
    position: absolute;
    left: -0.6rem;
    /* Measured from the middle: the logo box is text-high in the sidebar, bar-high in the phone topbar. */
    top: calc(50% - 1.65rem);
    width: 1.5rem;
    height: 1.5rem;
    pointer-events: none;
    transform: rotate(-22deg);
    transform-origin: 50% 100%;
}

.zn-festive-mark svg {
    display: block;
    width: 100%;
    height: 100%;
    overflow: visible;
}

.zn-festive-mark--halloween {
    left: -0.4rem;
    top: calc(50% - 1.53rem);
    width: 1.3rem;
    height: 1.3rem;
    transform: rotate(-14deg);
}

.zn-festive-mark--kingsday {
    left: -0.15rem;
    top: calc(50% - 1.53rem);
    width: 1.3rem;
    height: 1.3rem;
    transform: rotate(-10deg);
}

/* Sparkles around the top of the logo instead of on the first letter. */
.zn-festive-mark--newyear {
    left: -0.7rem;
    top: calc(50% - 1.63rem);
    width: 1.6rem;
    height: 1.6rem;
    transform: none;
}

/* Colours come from the theme (a holiday theme for users on the default one). */
.zn-fx-hat     { fill: rgb(var(--zn-accent-strong)); }
.zn-fx-trim    { fill: rgb(var(--zn-on-accent)); stroke: rgb(var(--zn-fg) / 0.18); stroke-width: 0.8; }
.zn-fx-pumpkin { fill: rgb(var(--zn-accent)); }
.zn-fx-stem    { fill: rgb(var(--zn-success)); }
.zn-fx-rib     { fill: none; stroke: rgb(var(--zn-bg) / 0.35); stroke-width: 1.4; stroke-linecap: round; }
.zn-fx-face    { fill: rgb(var(--zn-bg) / 0.85); }
.zn-fx-crown   { fill: rgb(var(--zn-warning)); }
.zn-fx-jewel   { fill: rgb(var(--zn-accent)); }
.zn-fx-gold    { fill: rgb(var(--zn-warning)); }
.zn-fx-soft    { fill: rgb(var(--zn-accent-softer)); }
.zn-fx-light   { fill: rgb(var(--zn-on-accent)); }

.zn-fx-star {
    transform-box: fill-box;
    transform-origin: center;
    animation: zn-festive-twinkle 2.6s ease-in-out infinite;
}

.zn-fx-soft  { animation-delay: -0.9s; }
.zn-fx-light { animation-delay: -1.7s; }

@keyframes zn-festive-twinkle {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%      { opacity: 0.35; transform: scale(0.6); }
}

/* ------------------------------------------------ falling snow / leaves */

.zn-festive-sky {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    /* Above page content, below the top bars (30/40), tab bar (45), menus and sheets. */
    z-index: 25;
    overflow: hidden;
    pointer-events: none;
    contain: strict;
}

.zn-festive-sky i {
    position: absolute;
    top: -2rem;
    left: var(--x);
    width: var(--s);
    height: var(--s);
    opacity: var(--o);
    will-change: transform;
    animation: zn-festive-fall var(--d) linear var(--delay) infinite;
}

.zn-festive-sky--snow i {
    border-radius: 50%;
    background: rgb(var(--zn-on-accent));
}

.zn-festive-sky--leaf i {
    background: rgb(var(--zn-accent-soft));
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 24 24%27%3E%3Cpath d=%27M3 21C3 10 10 3 21 3c0 11-7 18-18 18Z%27/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 24 24%27%3E%3Cpath d=%27M3 21C3 10 10 3 21 3c0 11-7 18-18 18Z%27/%3E%3C/svg%3E") center / contain no-repeat;
    animation-name: zn-festive-drift;
}

.zn-festive-sky--leaf i:nth-child(even) {
    background: rgb(var(--zn-warning));
}

.zn-festive-sky.is-paused i {
    animation-play-state: paused;
}

@keyframes zn-festive-fall {
    from { transform: translate3d(0, 0, 0); }
    to   { transform: translate3d(var(--drift), calc(100vh + 4rem), 0); }
}

@keyframes zn-festive-drift {
    from { transform: translate3d(0, 0, 0) rotate(0deg); }
    50%  { transform: translate3d(calc(var(--drift) * -0.5), calc(50vh + 2rem), 0) rotate(calc(var(--r) * 0.5)); }
    to   { transform: translate3d(var(--drift), calc(100vh + 4rem), 0) rotate(var(--r)); }
}

@media (prefers-reduced-motion: reduce) {
    .zn-festive-sky {
        display: none;
    }

    .zn-fx-star {
        animation: none;
    }
}

/* ============================================================
   Title requests (Seerr): the "couldn't find it" panel and its result cards
   ============================================================ */

.zn-requests {
    margin: 1.5rem 0 2rem;
}

.zn-requests-prompt {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.875rem;
    padding: 2.5rem 1.5rem;
    text-align: center;
}

.zn-requests-prompt[hidden] {
    display: none;
}

.zn-requests-owned {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.zn-requests-owned-item {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: baseline;
    gap: 0.5rem;
}

.zn-requests-owned-link {
    font-size: 0.9375rem;
    font-weight: 600;
    color: rgb(var(--zn-accent-soft));
    text-decoration: none;
    word-wrap: anywhere;
}

.zn-requests-owned-link:hover {
    text-decoration: underline;
}

.zn-requests-owned-meta {
    font-size: 0.75rem;
    color: rgb(var(--zn-muted));
}

.zn-requests-lead {
    margin: 0;
    max-width: 36rem;
    font-size: 0.9375rem;
    line-height: 1.5;
    color: rgb(var(--zn-text-soft));
    word-wrap: anywhere;
}

.zn-requests-lead span {
    font-weight: 600;
    color: rgb(var(--zn-text));
}

.zn-requests-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.55rem 1.1rem;
    border: none;
    border-radius: calc(8px * var(--zn-roundness));
    background: rgb(var(--zn-accent-strong));
    color: rgb(var(--zn-on-accent));
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, opacity 0.15s;
}

.zn-requests-btn:hover {
    background: rgb(var(--zn-accent-hover));
}

.zn-requests-btn:disabled {
    opacity: 0.55;
    cursor: progress;
}

.zn-requests-btn.focus-visible {
    outline: 2px solid rgb(var(--zn-accent));
    outline: 2px solid rgb(var(--zn-focus, var(--zn-accent)));
    outline-offset: 2px;
}

.zn-requests-btn.focus-visible {
    outline: 2px solid rgb(var(--zn-accent));
    outline: 2px solid rgb(var(--zn-focus, var(--zn-accent)));
    outline-offset: 2px;
}

.zn-requests-btn:focus-visible {
    outline: 2px solid rgb(var(--zn-accent));
    outline: 2px solid rgb(var(--zn-focus, var(--zn-accent)));
    outline-offset: 2px;
}

.zn-requests-btn[hidden] {
    display: none;
}

.zn-requests-note {
    margin: 0 0 1rem;
    text-align: center;
    font-size: 0.875rem;
    color: rgb(var(--zn-muted));
}

.zn-requests-note.is-error {
    color: rgb(var(--zn-danger));
    color: rgb(var(--zn-danger-text, var(--zn-danger)));
}

.zn-requests-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr));
    grid-gap: 1rem;
    gap: 1rem;
}

.zn-requests-grid[hidden] {
    display: none;
}

.zn-request-card {
    display: flex;
    gap: 0.875rem;
    padding: 0.75rem;
    border: 1px solid rgb(var(--zn-fg) / 0.06);
    border-radius: calc(12px * var(--zn-roundness));
    background: rgb(var(--zn-surface));
    min-width: 0;
}

.zn-request-poster {
    flex: 0 0 5.5rem;
    aspect-ratio: 2 / 3;
    overflow: hidden;
    border-radius: calc(8px * var(--zn-roundness));
    background: rgb(var(--zn-fg) / 0.06);
    display: flex;
    align-items: center;
    justify-content: center;
}

.zn-request-poster img {
    width: 100%;
    height: 100%;
    -o-object-fit: cover;
       object-fit: cover;
}

.zn-request-poster-empty {
    font-size: 1.5rem;
    font-weight: 700;
    color: rgb(var(--zn-fg) / 0.3);
}

.zn-request-info {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    min-width: 0;
    flex: 1 1 auto;
}

.zn-request-title {
    margin: 0;
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1.3;
    color: rgb(var(--zn-text));
    word-wrap: anywhere;
}

.zn-request-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    font-size: 0.75rem;
    color: rgb(var(--zn-muted));
}

.zn-request-badge {
    padding: 0.1rem 0.45rem;
    border-radius: 9999px;
    background: rgb(var(--zn-fg) / 0.08);
    color: rgb(var(--zn-text-soft));
    font-weight: 600;
    letter-spacing: 0.02em;
}

.zn-request-overview {
    margin: 0;
    font-size: 0.8125rem;
    line-height: 1.45;
    color: rgb(var(--zn-fg) / 0.55);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.zn-request-action {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-top: auto;
    padding-top: 0.35rem;
}

.zn-request-btn {
    padding: 0.4rem 0.9rem;
    font-size: 0.8125rem;
}

.zn-request-status {
    font-size: 0.8125rem;
    font-weight: 600;
    color: rgb(var(--zn-text-soft));
}

.zn-request-status.is-available {
    color: rgb(var(--zn-success-text));
}

.zn-request-error {
    flex-basis: 100%;
    margin: 0;
    font-size: 0.75rem;
    color: rgb(var(--zn-danger));
    color: rgb(var(--zn-danger-text, var(--zn-danger)));
}

@media (max-width: 900px) {
    .zn-requests-prompt {
        padding: 1.75rem 1rem;
    }

    .zn-requests-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 0.75rem;
    }

    .zn-request-poster {
        flex-basis: 4.75rem;
    }

    .zn-request-overview {
        -webkit-line-clamp: 2;
    }
}

