/* Cozy UI tokens. GENERATED from src/tokens/tokens.json by scripts/build-tokens.mjs. Do not edit. */

:root {
  --cz-radius-sm: 8px;
  --cz-radius-md: 12px; /* buttons, inputs */
  --cz-radius-lg: 16px; /* cards, toasts */
  --cz-radius-xl: 22px; /* dialogs */
  --cz-radius-full: 999px; /* switches, avatars, progress */
  --cz-border-thin: 2px; /* badges, small chips, in-game HUD */
  --cz-border-thick: 3px; /* buttons, inputs, cards */
  --cz-border-frame: 5px; /* dialog frame */
  --cz-depth-lift: 7px; /* height of a raised block: its solid side wall */
  --cz-depth-lift-hover: 9px;
  --cz-depth-lift-sm: 5px;
  --cz-depth-press: 1px; /* what is left of the wall while pressed */
  --cz-shadow-rim: inset 0 3px 0 rgb(255 255 255 / 0.55); /* rim light on the top edge */
  --cz-shadow-bevel: inset 0 -5px 0 rgb(0 0 0 / 0.16); /* darker lower lip */
  --cz-shadow-well: inset 0 4px 0 rgb(0 0 0 / 0.14), inset 0 8px 10px -4px rgb(0 0 0 / 0.12); /* sunken wells: inputs, tracks */
  --cz-shadow-plastic: linear-gradient(180deg, rgb(255 255 255 / 0.32) 0%, rgb(255 255 255 / 0.06) 48%, rgb(0 0 0 / 0.08) 100%); /* soft plastic face overlay, layered over the face colour */
  --cz-shadow-specular: rgb(255 255 255 / 0.55); /* small glint, top left */
  --cz-space-1: 4px;
  --cz-space-2: 8px;
  --cz-space-3: 12px;
  --cz-space-4: 16px;
  --cz-space-5: 20px;
  --cz-space-6: 24px;
  --cz-space-8: 32px;
  --cz-space-10: 40px;
  --cz-space-12: 48px;
  --cz-size-touch: 44px; /* minimum touch target */
  --cz-size-control-sm: 36px;
  --cz-size-control-md: 48px;
  --cz-size-control-lg: 56px;
  --cz-font-family: "Nunito", ui-rounded, system-ui, sans-serif; /* Nunito (SIL OFL 1.1): rounded, full Vietnamese and Latin coverage */
  --cz-font-weight-regular: 400;
  --cz-font-weight-thin: 200; /* display only, 24px and up */
  --cz-font-size-xs: 12px; /* absolute minimum */
  --cz-font-size-sm: 14px; /* minimum for body copy */
  --cz-font-size-md: 16px;
  --cz-font-size-lg: 20px;
  --cz-font-size-xl: 24px;
  --cz-font-size-2xl: 32px;
  --cz-font-size-3xl: 44px;
  --cz-font-line-height: 1.45; /* roomy: Vietnamese stacks two diacritics (Ổ, Ấ) */
  --cz-motion-instant: 80ms;
  --cz-motion-fast: 140ms; /* hover, press */
  --cz-motion-base: 220ms; /* toggles, tabs, tooltips */
  --cz-motion-slow: 360ms; /* dialogs, toasts, progress */
  --cz-motion-ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --cz-motion-ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1); /* toy-like overshoot; USS: ease-out-back */
  --cz-motion-ease-spring: cubic-bezier(0.5, 1.8, 0.4, 0.8); /* stronger overshoot for pops */
  --radius: var(--cz-radius-md);
}

/* default palette: village */
:root {
  color-scheme: light;
  --cz-page: #F3E7C9;
  --cz-page-sky: #BFE3EE;
  --cz-surface: #FBF4E2;
  --cz-surface-top: #FFFAF0;
  --cz-surface-bottom: #F5EAD0;
  --cz-surface-wall: #C9A979;
  --cz-surface-sunken: #E8D7AE;
  --cz-text: #3B2618;
  --cz-text-muted: #6B4E36;
  --cz-text-inverse: #FFF8E7;
  --cz-outline: #5A3A28;
  --cz-outline-soft: #8A5B3C;
  --cz-primary: #B04A2C;
  --cz-primary-wall: #8C3920;
  --cz-primary-text: #FFF8E7;
  --cz-secondary: #E9C77E;
  --cz-secondary-wall: #C9A35A;
  --cz-secondary-text: #3B2618;
  --cz-success: #4F7330;
  --cz-success-wall: #3A5622;
  --cz-success-text: #FFF8E7;
  --cz-success-bright: #8DB84A;
  --cz-reward: #E2A93A;
  --cz-reward-wall: #B9832A;
  --cz-reward-text: #3B2618;
  --cz-danger: #9E3A2C;
  --cz-danger-wall: #76281E;
  --cz-danger-text: #FFF8E7;
  --cz-info: #5D7486;
  --cz-info-text: #FFF8E7;
  --cz-accent: #BFE3EE;
  --cz-accent-text: #3B2618;
  --cz-tint-success: #EEF5DD;
  --cz-tint-info: #E3EBF0;
  --cz-tint-danger: #F7E1D8;
  --cz-ring: #B04A2C;
  --cz-overlay: rgb(59 38 24 / 0.55);
  --cz-contact: rgb(59 38 24 / 0.38);
  --cz-tooltip: #5A3A28;
  --cz-tooltip-text: #F3E7C9;
}

/* follow the system dark setting unless a palette or data-theme="light" is set */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-palette]) {
    color-scheme: dark;
    --cz-page: #1B1828;
    --cz-page-sky: #272247;
    --cz-surface: #2C2740;
    --cz-surface-top: #363050;
    --cz-surface-bottom: #262236;
    --cz-surface-wall: #151222;
    --cz-surface-sunken: #1F1B2E;
    --cz-text: #F3E7C9;
    --cz-text-muted: #C5B79A;
    --cz-text-inverse: #1B1828;
    --cz-outline: #0C0A14;
    --cz-outline-soft: #4A4266;
    --cz-primary: #E9A23B;
    --cz-primary-wall: #A86C1E;
    --cz-primary-text: #24160A;
    --cz-secondary: #4A4266;
    --cz-secondary-wall: #2F2946;
    --cz-secondary-text: #F3E7C9;
    --cz-success: #79B85A;
    --cz-success-wall: #4D7E36;
    --cz-success-text: #14200C;
    --cz-success-bright: #9BD27A;
    --cz-reward: #F2C25A;
    --cz-reward-wall: #B48A2E;
    --cz-reward-text: #24160A;
    --cz-danger: #E07A62;
    --cz-danger-wall: #A14A36;
    --cz-danger-text: #24100A;
    --cz-info: #8FA6C9;
    --cz-info-text: #141A26;
    --cz-accent: #3D5470;
    --cz-accent-text: #F3E7C9;
    --cz-tint-success: #2F3B2E;
    --cz-tint-info: #2B3142;
    --cz-tint-danger: #3E2A2E;
    --cz-ring: #F2C25A;
    --cz-overlay: rgb(8 6 14 / 0.7);
    --cz-contact: rgb(0 0 0 / 0.5);
    --cz-tooltip: #F3E7C9;
    --cz-tooltip-text: #1B1828;
  }
}
:root[data-theme="dark"]:not([data-palette]) {
  color-scheme: dark;
  --cz-page: #1B1828;
  --cz-page-sky: #272247;
  --cz-surface: #2C2740;
  --cz-surface-top: #363050;
  --cz-surface-bottom: #262236;
  --cz-surface-wall: #151222;
  --cz-surface-sunken: #1F1B2E;
  --cz-text: #F3E7C9;
  --cz-text-muted: #C5B79A;
  --cz-text-inverse: #1B1828;
  --cz-outline: #0C0A14;
  --cz-outline-soft: #4A4266;
  --cz-primary: #E9A23B;
  --cz-primary-wall: #A86C1E;
  --cz-primary-text: #24160A;
  --cz-secondary: #4A4266;
  --cz-secondary-wall: #2F2946;
  --cz-secondary-text: #F3E7C9;
  --cz-success: #79B85A;
  --cz-success-wall: #4D7E36;
  --cz-success-text: #14200C;
  --cz-success-bright: #9BD27A;
  --cz-reward: #F2C25A;
  --cz-reward-wall: #B48A2E;
  --cz-reward-text: #24160A;
  --cz-danger: #E07A62;
  --cz-danger-wall: #A14A36;
  --cz-danger-text: #24100A;
  --cz-info: #8FA6C9;
  --cz-info-text: #141A26;
  --cz-accent: #3D5470;
  --cz-accent-text: #F3E7C9;
  --cz-tint-success: #2F3B2E;
  --cz-tint-info: #2B3142;
  --cz-tint-danger: #3E2A2E;
  --cz-ring: #F2C25A;
  --cz-overlay: rgb(8 6 14 / 0.7);
  --cz-contact: rgb(0 0 0 / 0.5);
  --cz-tooltip: #F3E7C9;
  --cz-tooltip-text: #1B1828;
}

[data-palette="village"] {
  color-scheme: light;
  --cz-page: #F3E7C9;
  --cz-page-sky: #BFE3EE;
  --cz-surface: #FBF4E2;
  --cz-surface-top: #FFFAF0;
  --cz-surface-bottom: #F5EAD0;
  --cz-surface-wall: #C9A979;
  --cz-surface-sunken: #E8D7AE;
  --cz-text: #3B2618;
  --cz-text-muted: #6B4E36;
  --cz-text-inverse: #FFF8E7;
  --cz-outline: #5A3A28;
  --cz-outline-soft: #8A5B3C;
  --cz-primary: #B04A2C;
  --cz-primary-wall: #8C3920;
  --cz-primary-text: #FFF8E7;
  --cz-secondary: #E9C77E;
  --cz-secondary-wall: #C9A35A;
  --cz-secondary-text: #3B2618;
  --cz-success: #4F7330;
  --cz-success-wall: #3A5622;
  --cz-success-text: #FFF8E7;
  --cz-success-bright: #8DB84A;
  --cz-reward: #E2A93A;
  --cz-reward-wall: #B9832A;
  --cz-reward-text: #3B2618;
  --cz-danger: #9E3A2C;
  --cz-danger-wall: #76281E;
  --cz-danger-text: #FFF8E7;
  --cz-info: #5D7486;
  --cz-info-text: #FFF8E7;
  --cz-accent: #BFE3EE;
  --cz-accent-text: #3B2618;
  --cz-tint-success: #EEF5DD;
  --cz-tint-info: #E3EBF0;
  --cz-tint-danger: #F7E1D8;
  --cz-ring: #B04A2C;
  --cz-overlay: rgb(59 38 24 / 0.55);
  --cz-contact: rgb(59 38 24 / 0.38);
  --cz-tooltip: #5A3A28;
  --cz-tooltip-text: #F3E7C9;
}

[data-palette="meadow"] {
  color-scheme: light;
  --cz-page: #E9F0D2;
  --cz-page-sky: #CFE8D8;
  --cz-surface: #F8FBEC;
  --cz-surface-top: #FDFFF5;
  --cz-surface-bottom: #EDF3D8;
  --cz-surface-wall: #A9B97A;
  --cz-surface-sunken: #D9E4B8;
  --cz-text: #26301A;
  --cz-text-muted: #4D5A36;
  --cz-text-inverse: #FBFFF0;
  --cz-outline: #3B4724;
  --cz-outline-soft: #6B7A45;
  --cz-primary: #3F6E2A;
  --cz-primary-wall: #2D521D;
  --cz-primary-text: #FBFFF0;
  --cz-secondary: #D6E59A;
  --cz-secondary-wall: #AFC26A;
  --cz-secondary-text: #26301A;
  --cz-success: #2F6B4F;
  --cz-success-wall: #1F4D38;
  --cz-success-text: #F2FFF7;
  --cz-success-bright: #6FBF8E;
  --cz-reward: #E8C547;
  --cz-reward-wall: #BC9B2C;
  --cz-reward-text: #26301A;
  --cz-danger: #A0412E;
  --cz-danger-wall: #782D20;
  --cz-danger-text: #FFF6EE;
  --cz-info: #4F6E7E;
  --cz-info-text: #F4FBFF;
  --cz-accent: #CFE8D8;
  --cz-accent-text: #26301A;
  --cz-tint-success: #E2F2E6;
  --cz-tint-info: #E1EBEF;
  --cz-tint-danger: #F6E1D9;
  --cz-ring: #3F6E2A;
  --cz-overlay: rgb(38 48 26 / 0.55);
  --cz-contact: rgb(38 48 26 / 0.36);
  --cz-tooltip: #3B4724;
  --cz-tooltip-text: #E9F0D2;
}

[data-palette="lotus"] {
  color-scheme: light;
  --cz-page: #F8E4E4;
  --cz-page-sky: #F3D3DA;
  --cz-surface: #FFF6F3;
  --cz-surface-top: #FFFBF9;
  --cz-surface-bottom: #F9E8E3;
  --cz-surface-wall: #D9A6A9;
  --cz-surface-sunken: #F0D2CF;
  --cz-text: #3D1F28;
  --cz-text-muted: #6E4352;
  --cz-text-inverse: #FFF5F7;
  --cz-outline: #5B2E3C;
  --cz-outline-soft: #8E5A68;
  --cz-primary: #B2456A;
  --cz-primary-wall: #8A3150;
  --cz-primary-text: #FFF5F7;
  --cz-secondary: #F4C3CF;
  --cz-secondary-wall: #D69AAA;
  --cz-secondary-text: #3D1F28;
  --cz-success: #4E7A43;
  --cz-success-wall: #385A30;
  --cz-success-text: #F7FFF2;
  --cz-success-bright: #8CC27A;
  --cz-reward: #EFB94B;
  --cz-reward-wall: #C28E2E;
  --cz-reward-text: #3D1F28;
  --cz-danger: #9A2F2F;
  --cz-danger-wall: #722020;
  --cz-danger-text: #FFF5F2;
  --cz-info: #5E6C8A;
  --cz-info-text: #F6F8FF;
  --cz-accent: #CFE6D2;
  --cz-accent-text: #3D1F28;
  --cz-tint-success: #EAF4E4;
  --cz-tint-info: #E7EAF3;
  --cz-tint-danger: #F8DEDB;
  --cz-ring: #B2456A;
  --cz-overlay: rgb(61 31 40 / 0.55);
  --cz-contact: rgb(61 31 40 / 0.36);
  --cz-tooltip: #5B2E3C;
  --cz-tooltip-text: #F8E4E4;
}

[data-palette="river"] {
  color-scheme: light;
  --cz-page: #E2EEF2;
  --cz-page-sky: #BFE0EE;
  --cz-surface: #F7FBFC;
  --cz-surface-top: #FFFFFF;
  --cz-surface-bottom: #E9F2F5;
  --cz-surface-wall: #9CB8C4;
  --cz-surface-sunken: #D3E3EA;
  --cz-text: #1C2C36;
  --cz-text-muted: #435866;
  --cz-text-inverse: #F5FBFF;
  --cz-outline: #2B4150;
  --cz-outline-soft: #5A7586;
  --cz-primary: #2D6A92;
  --cz-primary-wall: #1F4E6D;
  --cz-primary-text: #F5FBFF;
  --cz-secondary: #EAD9AE;
  --cz-secondary-wall: #C6B07C;
  --cz-secondary-text: #1C2C36;
  --cz-success: #2F6B55;
  --cz-success-wall: #204D3D;
  --cz-success-text: #F2FFFA;
  --cz-success-bright: #6CC2A0;
  --cz-reward: #E9B54A;
  --cz-reward-wall: #BD8B2E;
  --cz-reward-text: #1C2C36;
  --cz-danger: #A33D33;
  --cz-danger-wall: #7A2A23;
  --cz-danger-text: #FFF6F4;
  --cz-info: #5A6F86;
  --cz-info-text: #F5F9FF;
  --cz-accent: #C6E6D9;
  --cz-accent-text: #1C2C36;
  --cz-tint-success: #E1F2EA;
  --cz-tint-info: #E2EAF2;
  --cz-tint-danger: #F6E0DC;
  --cz-ring: #2D6A92;
  --cz-overlay: rgb(28 44 54 / 0.55);
  --cz-contact: rgb(28 44 54 / 0.34);
  --cz-tooltip: #2B4150;
  --cz-tooltip-text: #E2EEF2;
}

[data-palette="lantern"] {
  color-scheme: dark;
  --cz-page: #1B1828;
  --cz-page-sky: #272247;
  --cz-surface: #2C2740;
  --cz-surface-top: #363050;
  --cz-surface-bottom: #262236;
  --cz-surface-wall: #151222;
  --cz-surface-sunken: #1F1B2E;
  --cz-text: #F3E7C9;
  --cz-text-muted: #C5B79A;
  --cz-text-inverse: #1B1828;
  --cz-outline: #0C0A14;
  --cz-outline-soft: #4A4266;
  --cz-primary: #E9A23B;
  --cz-primary-wall: #A86C1E;
  --cz-primary-text: #24160A;
  --cz-secondary: #4A4266;
  --cz-secondary-wall: #2F2946;
  --cz-secondary-text: #F3E7C9;
  --cz-success: #79B85A;
  --cz-success-wall: #4D7E36;
  --cz-success-text: #14200C;
  --cz-success-bright: #9BD27A;
  --cz-reward: #F2C25A;
  --cz-reward-wall: #B48A2E;
  --cz-reward-text: #24160A;
  --cz-danger: #E07A62;
  --cz-danger-wall: #A14A36;
  --cz-danger-text: #24100A;
  --cz-info: #8FA6C9;
  --cz-info-text: #141A26;
  --cz-accent: #3D5470;
  --cz-accent-text: #F3E7C9;
  --cz-tint-success: #2F3B2E;
  --cz-tint-info: #2B3142;
  --cz-tint-danger: #3E2A2E;
  --cz-ring: #F2C25A;
  --cz-overlay: rgb(8 6 14 / 0.7);
  --cz-contact: rgb(0 0 0 / 0.5);
  --cz-tooltip: #F3E7C9;
  --cz-tooltip-text: #1B1828;
}

[data-material="plastic"] {
  --cz-shadow-plastic: linear-gradient(180deg, rgb(255 255 255 / 0.32) 0%, rgb(255 255 255 / 0.06) 48%, rgb(0 0 0 / 0.08) 100%);
  --cz-shadow-rim: inset 0 3px 0 rgb(255 255 255 / 0.55);
  --cz-shadow-bevel: inset 0 -5px 0 rgb(0 0 0 / 0.16);
  --cz-shadow-specular: rgb(255 255 255 / 0.55);
}

:root, [data-palette] {
  --background: var(--cz-page);
  --foreground: var(--cz-text);
  --card: var(--cz-surface);
  --card-foreground: var(--cz-text);
  --popover: var(--cz-surface);
  --popover-foreground: var(--cz-text);
  --primary: var(--cz-primary);
  --primary-foreground: var(--cz-primary-text);
  --secondary: var(--cz-secondary);
  --secondary-foreground: var(--cz-secondary-text);
  --muted: var(--cz-surface-sunken);
  --muted-foreground: var(--cz-text-muted);
  --accent: var(--cz-accent);
  --accent-foreground: var(--cz-accent-text);
  --destructive: var(--cz-danger);
  --border: var(--cz-outline);
  --input: var(--cz-outline);
  --ring: var(--cz-ring);
}

/* ==========================================================================
   Cozy UI — component skins and motion.
   Plain class names (cz-button, cz-button--primary, …) on purpose: each block
   maps one-to-one to a Unity USS class, and the file works with or without
   Tailwind. Every colour is a palette role (--cz-primary, --cz-surface, …).

   The cozy 3D block = plastic face (gradient over the face colour) + rim light
   + darker lower lip + solid side wall (hard shadow, wall colour) wrapped by
   the outline + soft contact shadow. Pressing sinks the block into its wall.
   [data-force="hover|active|focus"] pins a state for documentation.
   ========================================================================== */

@layer components {
  /* ---------- Baseline: lets the kit work without Tailwind's preflight.
     Zero-specificity :where() so any app style wins. ---------- */
  :where([class*="cz-"]), :where([class*="cz-"])::before, :where([class*="cz-"])::after { box-sizing: border-box; }
  :where(.cz-card__title, .cz-dialog__title, .cz-accordion__trigger, .cz-alert__title, .cz-table__head) { font-weight: var(--cz-font-weight-regular); }
  :where(.cz-card, .cz-dialog, .cz-sheet, .cz-popover, .cz-menu, .cz-toast, .cz-tooltip, .cz-dt) { font-family: var(--cz-font-family); line-height: var(--cz-font-line-height); }
  :where(.cz-badge) { align-self: center; }

  /* ---------- Button ---------- */
  .cz-button {
    --face: var(--cz-surface);
    --wall: var(--cz-surface-wall);
    --fg: var(--cz-text);
    --lift: var(--cz-depth-lift);
    position: relative;
    isolation: isolate;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--cz-space-2);
    min-height: var(--cz-size-control-md);
    min-width: var(--cz-size-touch);
    margin-bottom: calc(var(--cz-depth-lift) + 4px); /* keeps the wall and contact shadow inside the layout */
    padding: 0 var(--cz-space-5);
    border: var(--cz-border-thick) solid var(--cz-outline);
    border-radius: var(--cz-radius-md);
    background: var(--cz-shadow-plastic), var(--face);
    color: var(--fg);
    font: inherit;
    font-size: var(--cz-font-size-md);
    line-height: 1.2;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    box-shadow:
      var(--cz-shadow-rim), var(--cz-shadow-bevel),
      0 var(--lift) 0 var(--wall),
      0 calc(var(--lift) - 1px) 0 var(--cz-border-thick) var(--cz-outline),
      0 calc(var(--lift) + 8px) 14px -6px var(--cz-contact);
    translate: 0 0;
    scale: 1;
    transition:
      translate var(--cz-motion-fast) var(--cz-motion-ease-bounce),
      scale var(--cz-motion-fast) var(--cz-motion-ease-bounce),
      box-shadow var(--cz-motion-fast) var(--cz-motion-ease-out),
      filter var(--cz-motion-fast) ease-out;
  }
  .cz-button::before { /* specular glint: soft plastic, not a glossy pill */
    content: "";
    position: absolute;
    z-index: -1;
    top: 4px;
    left: 8px;
    width: min(32%, 30px);
    height: 4px;
    border-radius: 99px;
    background: var(--cz-shadow-specular);
    pointer-events: none;
  }
  .cz-button svg { width: 1.15em; height: 1.15em; flex-shrink: 0; }
  .cz-button:hover:not(:disabled),
  .cz-button[data-force="hover"] {
    --lift: var(--cz-depth-lift-hover);
    translate: 0 -2px;
    filter: brightness(1.06) saturate(1.05);
  }
  .cz-button:active:not(:disabled),
  .cz-button[data-force="active"] {
    --lift: var(--cz-depth-press);
    translate: 0 calc(var(--cz-depth-lift) - var(--cz-depth-press));
    scale: 1.02 0.97; /* a little squash, like pressing soft plastic */
    filter: brightness(0.95);
    transition-duration: var(--cz-motion-instant);
    box-shadow:
      var(--cz-shadow-well),
      0 1px 0 var(--wall),
      0 0 0 var(--cz-border-thick) var(--cz-outline),
      0 3px 4px -2px var(--cz-contact);
  }
  .cz-button[data-force="focus"] { outline: 3px solid var(--cz-ring); outline-offset: 3px; }
  .cz-button:disabled,
  .cz-button[aria-disabled="true"] {
    --face: var(--cz-surface-sunken);
    --fg: var(--cz-text-muted);
    --wall: color-mix(in srgb, var(--cz-outline) 30%, var(--cz-surface-sunken));
    border-style: dashed;
    border-color: color-mix(in srgb, var(--cz-outline) 50%, var(--cz-surface-sunken));
    background: var(--face);
    text-shadow: none;
    cursor: not-allowed;
    box-shadow: 0 var(--cz-depth-lift-sm) 0 var(--wall);
  }
  .cz-button:disabled::before { display: none; }
  .cz-button[data-loading="true"] { cursor: progress; }

  .cz-button--primary { --face: var(--cz-primary); --wall: var(--cz-primary-wall); --fg: var(--cz-primary-text); text-shadow: 0 1px 0 var(--cz-primary-wall); }
  .cz-button--secondary { --face: var(--cz-secondary); --wall: var(--cz-secondary-wall); --fg: var(--cz-secondary-text); }
  .cz-button--success { --face: var(--cz-success); --wall: var(--cz-success-wall); --fg: var(--cz-success-text); text-shadow: 0 1px 0 var(--cz-success-wall); }
  .cz-button--reward { --face: var(--cz-reward); --wall: var(--cz-reward-wall); --fg: var(--cz-reward-text); }
  .cz-button--destructive { --face: var(--cz-danger); --wall: var(--cz-danger-wall); --fg: var(--cz-danger-text); text-shadow: 0 1px 0 var(--cz-danger-wall); }
  .cz-button--outline { --face: var(--cz-surface); --wall: var(--cz-surface-wall); }
  .cz-button--ghost { /* a painted label until touched */
    --face: transparent;
    border-color: transparent;
    background: transparent;
    box-shadow: none;
    margin-bottom: 0;
  }
  .cz-button--ghost::before { display: none; }
  .cz-button--ghost:hover:not(:disabled),
  .cz-button--ghost[data-force="hover"] { background: color-mix(in srgb, var(--cz-secondary) 45%, transparent); translate: 0 0; box-shadow: none; }
  .cz-button--ghost:active:not(:disabled),
  .cz-button--ghost[data-force="active"] { background: color-mix(in srgb, var(--cz-secondary) 75%, transparent); translate: 0 1px; scale: 1; box-shadow: var(--cz-shadow-well); }
  .cz-button--ghost:disabled { background: transparent; border-color: transparent; box-shadow: none; }

  .cz-button--sm { --lift: var(--cz-depth-lift-sm); min-height: var(--cz-size-control-sm); margin-bottom: calc(var(--cz-depth-lift-sm) + 3px); padding: 0 var(--cz-space-3); font-size: var(--cz-font-size-sm); border-radius: var(--cz-radius-sm); }
  .cz-button--sm:hover:not(:disabled) { --lift: calc(var(--cz-depth-lift-sm) + 2px); }
  .cz-button--sm::before { top: 3px; left: 6px; height: 3px; }
  .cz-button--lg { min-height: var(--cz-size-control-lg); padding: 0 var(--cz-space-6); font-size: var(--cz-font-size-lg); border-radius: var(--cz-radius-lg); }
  .cz-button--icon { width: var(--cz-size-control-md); padding: 0; }
  .cz-button--icon::before { width: 30%; left: 7px; }
  .cz-button--icon.cz-button--sm { width: var(--cz-size-touch); min-height: var(--cz-size-touch); }

  /* ---------- Spinner ---------- */
  .cz-spinner { display: inline-block; flex-shrink: 0; width: 1.1em; height: 1.1em; border: 3px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: cz-spin 0.8s linear infinite; }

  /* ---------- Input / Textarea ---------- */
  .cz-input {
    display: block;
    width: 100%;
    min-height: var(--cz-size-control-md);
    padding: var(--cz-space-2) var(--cz-space-4);
    border: var(--cz-border-thick) solid var(--cz-outline);
    border-radius: var(--cz-radius-md);
    background: linear-gradient(180deg, var(--cz-surface-sunken) 0, var(--cz-surface) 14px);
    color: var(--cz-text);
    font: inherit;
    font-size: var(--cz-font-size-md);
    line-height: var(--cz-font-line-height);
    box-shadow: var(--cz-shadow-well), 0 2px 0 color-mix(in srgb, var(--cz-surface-top) 70%, transparent);
    transition: box-shadow var(--cz-motion-fast) var(--cz-motion-ease-out), background var(--cz-motion-fast) ease-out;
  }
  .cz-input::placeholder { color: color-mix(in srgb, var(--cz-text-muted) 82%, var(--cz-surface)); }
  .cz-input:hover:not(:disabled) { background: linear-gradient(180deg, var(--cz-surface-sunken) 0, var(--cz-surface-top) 14px); }
  /* focus: no outer ring; the well brightens and its rim takes the primary colour */
  .cz-input:focus,
  .cz-input:focus-visible,
  .cz-input[data-force="focus"] {
    outline: none;
    border-color: var(--cz-primary);
    background: var(--cz-surface-top);
    box-shadow: var(--cz-shadow-well), inset 0 0 0 1px var(--cz-primary);
    caret-color: var(--cz-primary);
  }
  .cz-input::selection { background: color-mix(in srgb, var(--cz-reward) 45%, transparent); }
  .cz-input[aria-invalid="true"] {
    border-color: var(--cz-danger);
    box-shadow: var(--cz-shadow-well), 0 0 0 3px color-mix(in srgb, var(--cz-danger) 25%, transparent);
    animation: cz-shake 360ms var(--cz-motion-ease-out) 1;
  }
  .cz-input:disabled {
    background: var(--cz-surface-sunken);
    color: var(--cz-text-muted);
    border-style: dashed;
    border-color: color-mix(in srgb, var(--cz-outline) 50%, var(--cz-surface-sunken));
    cursor: not-allowed;
  }
  textarea.cz-input { min-height: 96px; resize: vertical; }

  .cz-label { display: inline-flex; align-items: center; gap: var(--cz-space-2); color: var(--cz-text); font-size: var(--cz-font-size-sm); }
  .cz-hint { color: var(--cz-text-muted); font-size: var(--cz-font-size-sm); }
  .cz-hint--error { color: var(--cz-danger-ink); }

  /* ---------- Checkbox ---------- */
  .cz-checkbox {
    display: inline-grid;
    place-items: center;
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border: var(--cz-border-thick) solid var(--cz-outline);
    border-radius: var(--cz-radius-sm);
    background: var(--cz-surface);
    color: var(--cz-success-text);
    box-shadow: var(--cz-shadow-well);
    cursor: pointer;
    transition: background var(--cz-motion-fast) ease-out, scale var(--cz-motion-fast) var(--cz-motion-ease-bounce);
  }
  .cz-checkbox:active:not(:disabled) { scale: 0.9; }
  .cz-checkbox[data-state="checked"] {
    background: var(--cz-shadow-plastic), var(--cz-success);
    box-shadow: var(--cz-shadow-rim), inset 0 -3px 0 rgb(0 0 0 / 0.2), 0 3px 0 var(--cz-success-wall), 0 3px 0 2px var(--cz-outline);
    animation: cz-jelly var(--cz-motion-slow) var(--cz-motion-ease-out);
  }
  .cz-checkbox svg { width: 18px; height: 18px; animation: cz-stamp var(--cz-motion-base) var(--cz-motion-ease-bounce); }
  .cz-checkbox:disabled { opacity: 0.55; cursor: not-allowed; }

  /* ---------- Card ---------- */
  .cz-card {
    display: flex;
    flex-direction: column;
    gap: var(--cz-space-4);
    padding: var(--cz-space-5);
    border: var(--cz-border-thick) solid var(--cz-outline);
    border-radius: var(--cz-radius-lg);
    background: linear-gradient(180deg, var(--cz-surface-top) 0%, var(--cz-surface) 40%, var(--cz-surface-bottom) 100%);
    color: var(--cz-text);
    box-shadow:
      inset 0 4px 0 color-mix(in srgb, var(--cz-surface-top) 80%, transparent),
      inset 0 -6px 0 rgb(0 0 0 / 0.05),
      0 var(--cz-depth-lift) 0 var(--cz-surface-wall),
      0 var(--cz-depth-lift) 0 var(--cz-border-thick) var(--cz-outline),
      0 calc(var(--cz-depth-lift) + 10px) 16px -6px var(--cz-contact);
    transition: translate var(--cz-motion-base) var(--cz-motion-ease-bounce);
  }
  .cz-card--interactive { cursor: pointer; }
  .cz-card--interactive:hover { translate: 0 -4px; }
  .cz-card--interactive:active { translate: 0 3px; transition-duration: var(--cz-motion-instant); }
  .cz-card__title { margin: 0; font-size: var(--cz-font-size-lg); line-height: 1.3; }
  .cz-card__description { margin: 0; color: var(--cz-text-muted); font-size: var(--cz-font-size-sm); }

  /* ---------- Badge ---------- */
  .cz-badge {
    --face: var(--cz-reward);
    --fg: var(--cz-reward-text);
    display: inline-flex;
    align-items: center;
    gap: var(--cz-space-1);
    padding: 2px var(--cz-space-3);
    border: var(--cz-border-thin) solid var(--cz-outline);
    border-radius: var(--cz-radius-sm);
    background: var(--cz-shadow-plastic), var(--face);
    color: var(--fg);
    font-size: var(--cz-font-size-sm);
    line-height: 1.4;
    white-space: nowrap;
    box-shadow: inset 0 2px 0 rgb(255 255 255 / 0.4), inset 0 -2px 0 rgb(0 0 0 / 0.14), 0 3px 0 var(--cz-outline), 0 7px 8px -4px var(--cz-contact);
  }
  .cz-badge img, .cz-badge svg { width: 1.1em; height: 1.1em; }
  .cz-badge--primary { --face: var(--cz-primary); --fg: var(--cz-primary-text); }
  .cz-badge--secondary { --face: var(--cz-secondary); --fg: var(--cz-secondary-text); }
  .cz-badge--success { --face: var(--cz-success); --fg: var(--cz-success-text); }
  .cz-badge--info { --face: var(--cz-info); --fg: var(--cz-info-text); }
  .cz-badge--accent { --face: var(--cz-accent); --fg: var(--cz-accent-text); }
  .cz-badge--destructive { --face: var(--cz-danger); --fg: var(--cz-danger-text); }
  .cz-badge--outline { --face: var(--cz-surface); --fg: var(--cz-text); background: var(--face); box-shadow: none; }
  .cz-badge--bounce { animation: cz-bob 1.6s ease-in-out infinite; }

  /* ---------- Progress ---------- */
  .cz-progress {
    position: relative;
    width: 100%;
    height: 22px;
    overflow: hidden;
    border: var(--cz-border-thick) solid var(--cz-outline);
    border-radius: var(--cz-radius-full);
    background: var(--cz-surface-sunken);
    box-shadow: var(--cz-shadow-well);
  }
  .cz-progress__fill {
    --fill: var(--cz-reward);
    width: 100%;
    height: 100%;
    border-radius: inherit;
    background:
      linear-gradient(180deg, rgb(255 255 255 / 0.55) 0 22%, rgb(255 255 255 / 0.12) 40%, transparent 60%, rgb(0 0 0 / 0.16) 100%),
      repeating-linear-gradient(-45deg, transparent 0 8px, rgb(255 255 255 / 0.18) 8px 16px) 0 0 / 22.63px 22.63px,
      var(--fill);
    box-shadow: 2px 0 0 var(--cz-outline);
    transition: transform var(--cz-motion-slow) var(--cz-motion-ease-bounce);
    animation: cz-stripes 900ms linear infinite;
  }
  .cz-progress--success .cz-progress__fill { --fill: var(--cz-success-bright); }
  .cz-progress--primary .cz-progress__fill { --fill: var(--cz-primary); }
  .cz-progress--sm { height: 14px; border-width: var(--cz-border-thin); }
  .cz-progress[data-complete="true"] .cz-progress__fill { animation: cz-stripes 900ms linear infinite, cz-glint 1.4s ease-in-out infinite; }

  /* ---------- Switch ---------- */
  .cz-switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    width: 64px;
    height: 36px;
    padding: 0 3px;
    border: var(--cz-border-thick) solid var(--cz-outline);
    border-radius: var(--cz-radius-full);
    background: var(--cz-surface-sunken);
    box-shadow: var(--cz-shadow-well);
    cursor: pointer;
    transition: background var(--cz-motion-base) ease-out;
  }
  .cz-switch[data-state="checked"] { background: linear-gradient(180deg, color-mix(in srgb, var(--cz-success-bright) 70%, #000) 0, var(--cz-success-bright) 45%); }
  .cz-switch:disabled { opacity: 0.55; border-style: dashed; cursor: not-allowed; }
  .cz-switch__thumb {
    display: block;
    width: 24px;
    height: 24px;
    border: var(--cz-border-thin) solid var(--cz-outline);
    border-radius: var(--cz-radius-full);
    background: radial-gradient(circle at 35% 28%, #fff 0 18%, var(--cz-surface) 42%, var(--cz-surface-sunken) 100%);
    box-shadow: inset 0 -3px 0 rgb(0 0 0 / 0.12), 0 3px 0 var(--cz-outline), 0 6px 6px -2px var(--cz-contact);
    translate: 0 -2px;
    transition: translate var(--cz-motion-base) var(--cz-motion-ease-bounce);
  }
  .cz-switch[data-state="checked"] .cz-switch__thumb { translate: 28px -2px; animation: cz-squish var(--cz-motion-base) var(--cz-motion-ease-out); }
  .cz-switch[data-state="unchecked"] .cz-switch__thumb { animation: cz-squish-2 var(--cz-motion-base) var(--cz-motion-ease-out); }

  /* ---------- Slider ---------- */
  .cz-slider { position: relative; display: flex; align-items: center; width: 100%; height: 44px; touch-action: none; user-select: none; }
  .cz-slider[data-disabled] { opacity: 0.55; }
  .cz-slider__track {
    position: relative;
    flex-grow: 1;
    height: 16px;
    overflow: hidden;
    border: var(--cz-border-thick) solid var(--cz-outline);
    border-radius: var(--cz-radius-full);
    background: var(--cz-surface-sunken);
    box-shadow: var(--cz-shadow-well);
  }
  .cz-slider__range { position: absolute; height: 100%; background: linear-gradient(180deg, rgb(255 255 255 / 0.5) 0 25%, transparent 55%, rgb(0 0 0 / 0.15) 100%), var(--cz-reward); }
  .cz-slider__thumb {
    display: block;
    width: 32px;
    height: 32px;
    border: var(--cz-border-thick) solid var(--cz-outline);
    border-radius: var(--cz-radius-full);
    background: radial-gradient(circle at 35% 28%, #fff 0 18%, var(--cz-surface) 42%, var(--cz-surface-sunken) 100%);
    box-shadow: inset 0 -4px 0 rgb(0 0 0 / 0.12), 0 4px 0 var(--cz-outline), 0 8px 8px -3px var(--cz-contact);
    cursor: grab;
    transition: scale var(--cz-motion-fast) var(--cz-motion-ease-bounce), translate var(--cz-motion-fast) var(--cz-motion-ease-bounce);
  }
  .cz-slider__thumb:hover { scale: 1.1; }
  .cz-slider__thumb:active { cursor: grabbing; scale: 1.12 0.92; translate: 0 2px; }

  /* ---------- Tabs (raised indicator slides between triggers) ---------- */
  .cz-tabs__list {
    position: relative;
    isolation: isolate;
    display: inline-flex;
    gap: var(--cz-space-1);
    max-width: 100%;
    padding: 7px var(--cz-space-1) 9px;
    border: var(--cz-border-thick) solid var(--cz-outline);
    border-radius: var(--cz-radius-lg);
    background: var(--cz-surface-sunken);
    box-shadow: var(--cz-shadow-well);
    overflow-x: auto;
    scrollbar-width: none;
  }
  .cz-tabs__indicator {
    position: absolute;
    z-index: -1;
    top: 4px;
    left: 0;
    border: var(--cz-border-thin) solid var(--cz-outline);
    border-radius: var(--cz-radius-md);
    background: var(--cz-shadow-plastic), var(--cz-surface);
    box-shadow: var(--cz-shadow-rim), inset 0 -3px 0 rgb(0 0 0 / 0.08), 0 4px 0 var(--cz-outline), 0 8px 8px -4px var(--cz-contact);
    transition: translate var(--cz-motion-slow) var(--cz-motion-ease-bounce), width var(--cz-motion-slow) var(--cz-motion-ease-bounce), height var(--cz-motion-slow) var(--cz-motion-ease-bounce);
    pointer-events: none;
  }
  .cz-tabs__trigger {
    display: inline-flex;
    align-items: center;
    gap: var(--cz-space-2);
    min-height: var(--cz-size-touch);
    padding: 0 var(--cz-space-4);
    border: var(--cz-border-thin) solid transparent;
    border-radius: var(--cz-radius-md);
    background: transparent;
    color: var(--cz-text-muted);
    font: inherit;
    font-size: var(--cz-font-size-sm);
    white-space: nowrap;
    cursor: pointer;
    transition: color var(--cz-motion-fast), translate var(--cz-motion-base) var(--cz-motion-ease-bounce);
  }
  .cz-tabs__trigger img, .cz-tabs__trigger svg { width: 26px; height: 26px; object-fit: contain; }
  .cz-tabs__trigger:hover { color: var(--cz-text); }
  .cz-tabs__trigger[data-state="active"] { color: var(--cz-text); translate: 0 -3px; }
  .cz-tabs__list:not([data-measured]) .cz-tabs__trigger[data-state="active"] { /* fallback until the indicator is measured */
    border-color: var(--cz-outline);
    background: var(--cz-surface);
    box-shadow: 0 4px 0 var(--cz-outline);
  }
  .cz-tabs__trigger:disabled { opacity: 0.5; cursor: not-allowed; }
  .cz-tabs__content { padding-top: var(--cz-space-4); }
  .cz-tabs__content[data-state="active"] { animation: cz-rise var(--cz-motion-base) var(--cz-motion-ease-out); }

  /* ---------- Avatar ---------- */
  .cz-avatar {
    position: relative;
    display: inline-flex;
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    overflow: hidden;
    border: var(--cz-border-thick) solid var(--cz-outline);
    border-radius: var(--cz-radius-full);
    background: var(--cz-accent);
    box-shadow: 0 4px 0 var(--cz-outline), 0 10px 8px -5px var(--cz-contact);
    transition: rotate var(--cz-motion-base) var(--cz-motion-ease-bounce), translate var(--cz-motion-base) var(--cz-motion-ease-bounce);
  }
  .cz-avatar:hover { rotate: -6deg; translate: 0 -2px; }
  .cz-avatar--sm { width: 36px; height: 36px; border-width: var(--cz-border-thin); }
  .cz-avatar--lg { width: 72px; height: 72px; }
  .cz-avatar img { width: 100%; height: 100%; object-fit: cover; }
  .cz-avatar__fallback {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 35% 25%, color-mix(in srgb, var(--cz-secondary) 55%, #fff) 0 15%, var(--cz-secondary) 55%, var(--cz-secondary-wall) 100%);
    color: var(--cz-secondary-text);
    font-size: var(--cz-font-size-md);
  }
  .cz-avatar--sm .cz-avatar__fallback { font-size: var(--cz-font-size-sm); }
  .cz-avatar--lg .cz-avatar__fallback { font-size: var(--cz-font-size-xl); }

  /* ---------- Tooltip: a little wooden tag that swings in ---------- */
  .cz-tooltip {
    z-index: 50;
    max-width: 260px;
    padding: var(--cz-space-2) var(--cz-space-3);
    border: var(--cz-border-thin) solid var(--cz-outline);
    border-radius: var(--cz-radius-sm);
    background: linear-gradient(180deg, color-mix(in srgb, var(--cz-tooltip) 82%, #fff) 0, var(--cz-tooltip) 60%);
    color: var(--cz-tooltip-text);
    font-size: var(--cz-font-size-sm);
    line-height: 1.4;
    box-shadow: inset 0 2px 0 rgb(255 255 255 / 0.18), 0 4px 0 var(--cz-outline), 0 10px 10px -6px var(--cz-contact);
    transform-origin: var(--radix-tooltip-content-transform-origin, top center);
    animation: cz-swing var(--cz-motion-slow) var(--cz-motion-ease-out);
  }
  .cz-tooltip[data-state="closed"] { animation: cz-fade-out var(--cz-motion-fast) ease-in forwards; }
  .cz-tooltip__arrow { fill: var(--cz-tooltip); }

  /* ---------- Dialog: a framed board that bounces in ---------- */
  .cz-overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    background: var(--cz-overlay);
    animation: cz-fade-in var(--cz-motion-base) ease-out;
  }
  .cz-overlay[data-state="closed"] { animation: cz-fade-out var(--cz-motion-base) ease-in forwards; }
  .cz-dialog {
    position: fixed;
    z-index: 51;
    left: 50%;
    top: 50%;
    display: grid;
    gap: var(--cz-space-4);
    width: calc(100% - 32px);
    max-width: 440px;
    max-height: calc(100dvh - 48px);
    overflow-y: auto;
    padding: var(--cz-space-6) var(--cz-space-5) var(--cz-space-5);
    border: var(--cz-border-frame) solid var(--cz-outline);
    border-radius: var(--cz-radius-xl);
    background: linear-gradient(180deg, var(--cz-surface-top) 0, var(--cz-page) 55%, var(--cz-surface-bottom) 100%);
    color: var(--cz-text);
    box-shadow:
      inset 0 0 0 4px var(--cz-outline-soft),
      inset 0 8px 0 4px rgb(255 255 255 / 0.25),
      inset 0 -8px 0 4px rgb(0 0 0 / 0.12),
      0 10px 0 var(--cz-outline),
      0 26px 30px -8px var(--cz-contact);
    translate: -50% -50%;
    animation: cz-bounce-in var(--cz-motion-slow) var(--cz-motion-ease-out);
  }
  .cz-dialog[data-state="closed"] { animation: cz-drop-out var(--cz-motion-base) ease-in forwards; }
  .cz-dialog--static { position: relative; z-index: 0; left: auto; top: auto; width: 100%; translate: none; animation: none; }
  .cz-dialog__title { margin: 0; font-size: var(--cz-font-size-xl); line-height: 1.3; }
  .cz-dialog__description { margin: 0; color: var(--cz-text-muted); font-size: var(--cz-font-size-sm); }
  .cz-dialog__close { position: absolute; top: 10px; right: 10px; }

  /* ---------- Toast (sonner, unstyled) ---------- */
  .cz-toast {
    display: flex;
    align-items: center;
    gap: var(--cz-space-3);
    width: min(360px, calc(100vw - 32px));
    padding: var(--cz-space-3) var(--cz-space-4);
    border: var(--cz-border-thick) solid var(--cz-outline);
    border-radius: var(--cz-radius-lg);
    background: var(--cz-shadow-plastic), var(--tone, var(--cz-surface));
    color: var(--cz-text);
    font-family: var(--cz-font-family);
    font-size: var(--cz-font-size-sm);
    box-shadow: var(--cz-shadow-rim), inset 0 -4px 0 rgb(0 0 0 / 0.07), 0 6px 0 var(--cz-outline), 0 16px 16px -8px var(--cz-contact);
  }
  [data-sonner-toast][data-mounted="true"].cz-toast { animation: cz-pop var(--cz-motion-slow) var(--cz-motion-ease-out); }
  .cz-toast [data-title], .cz-toast__title { font-size: var(--cz-font-size-md); }
  .cz-toast [data-description], .cz-toast__description { color: var(--cz-text-muted); }
  .cz-toast [data-icon], .cz-toast__icon { width: 32px; height: 32px; margin: 0; flex-shrink: 0; }
  .cz-toast [data-icon] > *, .cz-toast__icon > * { width: 100%; height: 100%; }
  .cz-toast--success { --tone: var(--cz-tint-success); }
  .cz-toast--warning, .cz-toast--info { --tone: var(--cz-tint-info); }
  .cz-toast--error { --tone: var(--cz-tint-danger); }

  /* ---------- Separator: a carved groove ---------- */
  .cz-separator { flex-shrink: 0; border: 0; background: var(--cz-outline-soft); box-shadow: 0 1px 0 color-mix(in srgb, var(--cz-surface-top) 80%, transparent); }
  .cz-separator[data-orientation="horizontal"] { width: 100%; height: 2px; }
  .cz-separator[data-orientation="vertical"] { width: 2px; height: 100%; box-shadow: 1px 0 0 color-mix(in srgb, var(--cz-surface-top) 80%, transparent); }

  /* ---------- Table: a board with a sunken header strip ---------- */
  .cz-table-wrap {
    position: relative;
    width: 100%;
    overflow-x: auto;
    border: var(--cz-border-thick) solid var(--cz-outline);
    border-radius: var(--cz-radius-lg);
    background: var(--cz-surface);
    box-shadow: 0 var(--cz-depth-lift-sm) 0 var(--cz-surface-wall), 0 var(--cz-depth-lift-sm) 0 var(--cz-border-thick) var(--cz-outline), 0 calc(var(--cz-depth-lift-sm) + 8px) 14px -6px var(--cz-contact);
    margin-bottom: calc(var(--cz-depth-lift-sm) + 4px);
  }
  .cz-table { width: 100%; border-collapse: collapse; font-size: var(--cz-font-size-sm); caption-side: bottom; }
  .cz-table__caption { padding: var(--cz-space-3); color: var(--cz-text-muted); font-size: var(--cz-font-size-sm); }
  .cz-table__header { background: var(--cz-surface); }
  .cz-table__head { height: 44px; padding: 0 var(--cz-space-3); border-bottom: 2px solid var(--cz-outline); background: var(--cz-surface); color: var(--cz-text-muted); font-size: var(--cz-font-size-xs); font-weight: inherit; text-align: left; white-space: nowrap; }
  .cz-table__head.is-num .cz-table__sort { margin-left: 0; margin-right: -6px; }
  .cz-table__cell { padding: var(--cz-space-3); vertical-align: middle; }
  .cz-table__row { border-bottom: 2px solid color-mix(in srgb, var(--cz-surface-sunken) 80%, transparent); transition: background var(--cz-motion-fast) ease-out; }
  .cz-table__body .cz-table__row:last-child { border-bottom: 0; }
  .cz-table__body .cz-table__row:hover { background: color-mix(in srgb, var(--cz-secondary) 22%, transparent); }
  .cz-table__row[data-state="selected"] { background: color-mix(in srgb, var(--cz-reward) 26%, transparent); }
  .cz-table__footer { background: var(--cz-surface-sunken); box-shadow: inset 0 2px 0 var(--cz-outline); }
  .cz-table .is-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
  .cz-table__sort { display: inline-flex; align-items: center; gap: 4px; padding: 4px 6px; margin-left: -6px; border: 0; border-radius: var(--cz-radius-sm); background: transparent; color: inherit; font: inherit; cursor: pointer; }
  .cz-table__sort:hover { background: var(--cz-surface); color: var(--cz-text); }
  .cz-table__sort svg { width: 14px; height: 14px; transition: rotate var(--cz-motion-base) var(--cz-motion-ease-bounce); }
  .cz-table__sort[data-dir="desc"] svg { rotate: 180deg; }
  .cz-table__sort[data-dir="none"] svg { display: none; } /* arrow on the active column only */

  /* ---------- Data table (frozen edges, sticky header, toolbar, facets, pager) ---------- */
  .cz-dt { display: grid; gap: var(--cz-space-3); width: 100%; min-width: 0; }
  .cz-dt__toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--cz-space-2); }
  .cz-dt__search { position: relative; flex: 1 1 220px; max-width: 320px; }
  .cz-dt__search svg { position: absolute; left: 12px; top: 50%; width: 18px; height: 18px; translate: 0 -50%; color: var(--cz-text-muted); pointer-events: none; }
  .cz-dt__search .cz-input { min-height: 40px; padding-left: 38px; font-size: var(--cz-font-size-sm); }
  .cz-dt__facet {
    display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 12px;
    border: var(--cz-border-thin) dashed var(--cz-outline-soft); border-radius: var(--cz-radius-md);
    background: var(--cz-surface); color: var(--cz-text); font: inherit; font-size: var(--cz-font-size-sm); white-space: nowrap; cursor: pointer;
    transition: translate var(--cz-motion-fast) var(--cz-motion-ease-bounce);
  }
  .cz-dt__facet:hover { translate: 0 -1px; border-color: var(--cz-outline); }
  .cz-dt__facet[data-active] { border-style: solid; border-color: var(--cz-outline); box-shadow: 0 3px 0 var(--cz-outline); }
  .cz-dt__facet svg { width: 16px; height: 16px; color: var(--cz-text-muted); }
  .cz-dt__facet-values { display: inline-flex; gap: 4px; padding-left: 6px; border-left: 2px solid var(--cz-surface-sunken); }
  .cz-dt__chip { padding: 0 6px; border-radius: 6px; background: var(--cz-secondary); color: var(--cz-secondary-text); font-size: var(--cz-font-size-xs); line-height: 20px; }
  .cz-dt__total { margin-left: auto; color: var(--cz-text-muted); font-size: var(--cz-font-size-sm); font-variant-numeric: tabular-nums; white-space: nowrap; }
  .cz-dt__action.cz-button { margin-bottom: 4px; }
  .cz-dt__pop { width: 260px; padding: var(--cz-space-2); }
  .cz-dt__pop-search { min-height: 38px; margin-bottom: var(--cz-space-2); font-size: var(--cz-font-size-sm); }
  .cz-dt__pop-list { display: grid; max-height: 260px; overflow-y: auto; }
  .cz-dt__pop-item { display: flex; align-items: center; gap: var(--cz-space-2); min-height: 40px; padding: 0 var(--cz-space-2); border-radius: var(--cz-radius-sm); font-size: var(--cz-font-size-sm); cursor: pointer; }
  .cz-dt__pop-item:hover { background: color-mix(in srgb, var(--cz-secondary) 35%, transparent); }
  .cz-dt__pop-item .cz-checkbox { width: 24px; height: 24px; }
  .cz-dt__count { color: var(--cz-text-muted); font-variant-numeric: tabular-nums; }
  .cz-dt__pop-foot { margin-top: var(--cz-space-2); padding-top: var(--cz-space-2); border-top: 2px solid var(--cz-surface-sunken); }

  .cz-dt__board {
    min-width: 0; overflow: hidden;
    border: var(--cz-border-thick) solid var(--cz-outline); border-radius: var(--cz-radius-lg); background: var(--cz-surface);
    box-shadow: 0 var(--cz-depth-lift-sm) 0 var(--cz-surface-wall), 0 var(--cz-depth-lift-sm) 0 var(--cz-border-thick) var(--cz-outline), 0 calc(var(--cz-depth-lift-sm) + 8px) 14px -6px var(--cz-contact);
    margin-bottom: calc(var(--cz-depth-lift-sm) + 4px);
  }
  .cz-dt__scroll { overflow: auto; overscroll-behavior-x: contain; }
  .cz-dt__select-bar {
    display: flex; align-items: center; gap: var(--cz-space-3); min-height: 48px; padding: 2px var(--cz-space-2) 0 var(--cz-space-4);
    border-bottom: 2px solid var(--cz-outline); background: color-mix(in srgb, var(--cz-reward) 30%, var(--cz-surface)); font-size: var(--cz-font-size-sm);
    animation: cz-rise var(--cz-motion-base) var(--cz-motion-ease-out);
  }
  .cz-table--data .cz-table__head { position: sticky; top: 0; z-index: 2; }
  .cz-table--data .cz-table__cell { height: 52px; padding-block: 6px; white-space: nowrap; background: var(--cz-surface); }
  .cz-table--data .cz-table__row { border-bottom: 0; }
  .cz-table--data .cz-table__cell { border-bottom: 2px solid color-mix(in srgb, var(--cz-surface-sunken) 80%, transparent); }
  .cz-table--data .cz-table__body .cz-table__row:last-child .cz-table__cell { border-bottom: 0; }
  .cz-table--data .cz-table__body .cz-table__row:hover { background: none; }
  .cz-table--data .cz-table__body .cz-table__row:hover .cz-table__cell { background: color-mix(in srgb, var(--cz-secondary) 22%, var(--cz-surface)); }
  .cz-table--data .cz-table__row[data-state="selected"] .cz-table__cell { background: color-mix(in srgb, var(--cz-reward) 24%, var(--cz-surface)); }
  .cz-table--data .cz-table__row.is-clickable { cursor: pointer; }
  .cz-table--data .cz-table__row.is-clickable:focus-visible { outline: 3px solid var(--cz-ring); outline-offset: -3px; }
  .cz-table--data .is-pinned { z-index: 1; }
  .cz-table--data .cz-table__head.is-pinned { z-index: 3; }
  .cz-table--data .is-pinned-edge-start { box-shadow: inset -2px 0 0 var(--cz-surface-sunken), 6px 0 8px -6px var(--cz-contact); }
  .cz-table--data .is-pinned-edge-end { box-shadow: inset 2px 0 0 var(--cz-surface-sunken), -6px 0 8px -6px var(--cz-contact); }
  .cz-table--data .cz-checkbox { width: 24px; height: 24px; vertical-align: middle; }
  .cz-table--data .cz-checkbox svg { width: 15px; height: 15px; }
  .cz-dt__row-actions { display: flex; justify-content: flex-end; gap: 2px; }
  .cz-dt__row-actions .cz-button { margin-bottom: 0; }

  .cz-dt__state { display: flex; align-items: center; justify-content: center; gap: var(--cz-space-3); min-height: 160px; margin: var(--cz-space-2); padding: var(--cz-space-4); border: var(--cz-border-thin) dashed var(--cz-outline-soft); border-radius: var(--cz-radius-md); color: var(--cz-text-muted); white-space: normal; text-align: center; }
  .cz-dt__state--error { border-color: var(--cz-danger); color: var(--cz-text); text-align: left; }
  .cz-dt__state--error > svg { width: 24px; height: 24px; color: var(--cz-danger); flex-shrink: 0; }

  .cz-dt__pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--cz-space-3); color: var(--cz-text-muted); font-size: var(--cz-font-size-sm); }
  .cz-dt__pager-controls { display: flex; flex-wrap: wrap; align-items: center; gap: var(--cz-space-3); }
  .cz-dt__size { display: inline-flex; align-items: center; gap: var(--cz-space-2); white-space: nowrap; }
  .cz-dt__size-trigger.cz-select { width: 78px; min-height: 38px; margin-bottom: 4px; font-size: var(--cz-font-size-sm); }
  .cz-dt__range { font-variant-numeric: tabular-nums; }

  /* ---------- Breadcrumb ---------- */
  .cz-breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0; padding: 0; list-style: none; color: var(--cz-text-muted); font-size: var(--cz-font-size-sm); }
  .cz-breadcrumb__item { display: inline-flex; align-items: center; }
  .cz-breadcrumb__link { color: var(--cz-text-muted); text-decoration: none; border-radius: 6px; padding: 2px 4px; margin: -2px -4px; cursor: pointer; background: none; border: 0; font: inherit; }
  .cz-breadcrumb__link:hover { color: var(--cz-text); background: var(--cz-surface-sunken); }
  .cz-breadcrumb__page { color: var(--cz-text); }
  .cz-breadcrumb__sep svg { width: 14px; height: 14px; }

  /* ---------- Floating boards: popover, select and menu content ---------- */
  .cz-popover, .cz-menu {
    z-index: 50;
    border: var(--cz-border-thick) solid var(--cz-outline);
    border-radius: var(--cz-radius-lg);
    background: linear-gradient(180deg, var(--cz-surface-top), var(--cz-surface) 50%, var(--cz-surface-bottom));
    color: var(--cz-text);
    box-shadow: var(--cz-shadow-rim), 0 6px 0 var(--cz-outline), 0 18px 18px -8px var(--cz-contact);
    transform-origin: var(--radix-popover-content-transform-origin, var(--radix-dropdown-menu-content-transform-origin, var(--radix-select-content-transform-origin, top)));
    animation: cz-pop var(--cz-motion-base) var(--cz-motion-ease-out);
  }
  .cz-popover[data-state="closed"], .cz-menu[data-state="closed"] { animation: cz-fade-out var(--cz-motion-fast) ease-in forwards; }
  .cz-popover { width: 300px; max-width: calc(100vw - 24px); padding: var(--cz-space-4); }
  .cz-popover__arrow { fill: var(--cz-outline); }
  .cz-menu { min-width: 200px; max-height: var(--radix-select-content-available-height, var(--radix-dropdown-menu-content-available-height, 60vh)); overflow-y: auto; padding: var(--cz-space-1); }
  .cz-menu__item {
    position: relative;
    display: flex;
    align-items: center;
    gap: var(--cz-space-2);
    min-height: 40px;
    padding: 0 var(--cz-space-3) 0 34px;
    border: var(--cz-border-thin) solid transparent;
    border-radius: var(--cz-radius-md);
    color: var(--cz-text);
    font-size: var(--cz-font-size-sm);
    outline: none;
    cursor: pointer;
    user-select: none;
    transition: translate var(--cz-motion-fast) var(--cz-motion-ease-bounce);
  }
  .cz-menu__item[data-highlighted] {
    border-color: var(--cz-outline);
    background: var(--cz-shadow-plastic), var(--cz-secondary);
    color: var(--cz-secondary-text);
    box-shadow: 0 3px 0 var(--cz-outline);
    translate: 0 -2px;
  }
  .cz-menu__item[data-disabled] { opacity: 0.5; cursor: not-allowed; }
  .cz-menu__item--danger { color: var(--cz-danger-ink); }
  .cz-menu__item--danger[data-highlighted] { background: var(--cz-shadow-plastic), var(--cz-danger); color: var(--cz-danger-text); }
  .cz-menu__indicator { position: absolute; left: 9px; display: inline-grid; place-items: center; width: 18px; height: 18px; }
  .cz-menu__indicator svg { width: 16px; height: 16px; animation: cz-stamp var(--cz-motion-base) var(--cz-motion-ease-bounce); }
  .cz-menu__label { padding: var(--cz-space-2) var(--cz-space-3) var(--cz-space-1) 34px; color: var(--cz-text-muted); font-size: var(--cz-font-size-xs); }
  .cz-menu__separator { height: 2px; margin: var(--cz-space-1) var(--cz-space-2); background: var(--cz-surface-sunken); }
  .cz-menu__search-wrap { position: sticky; top: calc(-1 * var(--cz-space-1)); z-index: 1; margin: calc(-1 * var(--cz-space-1)) calc(-1 * var(--cz-space-1)) var(--cz-space-1); padding: var(--cz-space-2); background: inherit; border-bottom: 2px solid var(--cz-surface-sunken); }
  .cz-menu__search { display: flex; align-items: center; gap: var(--cz-space-2); height: 40px; padding: 0 var(--cz-space-3); border: var(--cz-border-thin) solid var(--cz-outline); border-radius: var(--cz-radius-md); background: var(--cz-surface-sunken); box-shadow: var(--cz-shadow-well); color: var(--cz-text-muted); }
  .cz-menu__search:focus-within { border-color: var(--cz-primary); color: var(--cz-text); }
  .cz-menu__search svg { width: 16px; height: 16px; flex-shrink: 0; }
  .cz-menu__search-input { flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; outline: none; background: transparent; color: var(--cz-text); font: inherit; font-size: var(--cz-font-size-sm); }
  .cz-menu__search-input::-webkit-search-cancel-button { display: none; }
  .cz-menu__search-input::placeholder { color: var(--cz-text-muted); }
  .cz-menu__empty { padding: var(--cz-space-3) var(--cz-space-2) var(--cz-space-1); color: var(--cz-text-muted); font-size: var(--cz-font-size-sm); text-align: center; }
  .cz-menu__shortcut { margin-left: auto; color: var(--cz-text-muted); font-size: var(--cz-font-size-xs); }
  .cz-menu__item[data-highlighted] .cz-menu__shortcut { color: inherit; }

  /* ---------- Select trigger: a raised block with a chevron ---------- */
  .cz-select {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--cz-space-2);
    width: 100%;
    min-height: var(--cz-size-control-md);
    margin-bottom: 5px;
    padding: 0 var(--cz-space-3) 0 var(--cz-space-4);
    border: var(--cz-border-thick) solid var(--cz-outline);
    border-radius: var(--cz-radius-md);
    background: var(--cz-shadow-plastic), var(--cz-surface);
    color: var(--cz-text);
    font: inherit;
    font-size: var(--cz-font-size-md);
    text-align: left;
    cursor: pointer;
    box-shadow: var(--cz-shadow-rim), 0 4px 0 var(--cz-surface-wall), 0 3px 0 var(--cz-border-thick) var(--cz-outline);
    transition: translate var(--cz-motion-fast) var(--cz-motion-ease-bounce);
  }
  .cz-select:hover { translate: 0 -1px; }
  .cz-select[data-state="open"] { translate: 0 3px; box-shadow: var(--cz-shadow-well), 0 1px 0 var(--cz-surface-wall), 0 0 0 var(--cz-border-thick) var(--cz-outline); }
  .cz-select[data-placeholder] { color: var(--cz-text-muted); }
  .cz-select > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .cz-select svg { width: 18px; height: 18px; flex-shrink: 0; rotate: 90deg; transition: rotate var(--cz-motion-base) var(--cz-motion-ease-bounce); }
  .cz-select[data-state="open"] svg { rotate: -90deg; }
  .cz-select:disabled { opacity: 0.55; border-style: dashed; cursor: not-allowed; }
  .cz-menu--select { width: var(--radix-select-trigger-width); min-width: max(var(--radix-select-trigger-width), 180px); }

  /* ---------- Radio group: marbles in sunken cups ---------- */
  .cz-radio {
    display: inline-grid;
    place-items: center;
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    padding: 0;
    border: var(--cz-border-thick) solid var(--cz-outline);
    border-radius: 50%;
    background: var(--cz-surface-sunken);
    box-shadow: var(--cz-shadow-well);
    cursor: pointer;
  }
  .cz-radio:disabled { opacity: 0.55; cursor: not-allowed; }
  .cz-radio__dot {
    display: block;
    width: 16px;
    height: 16px;
    border: var(--cz-border-thin) solid var(--cz-outline);
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--cz-success-bright) 40%, #fff) 0 20%, var(--cz-success-bright) 60%, var(--cz-success) 100%);
    box-shadow: 0 2px 0 var(--cz-outline);
    translate: 0 -1px;
    animation: cz-jelly var(--cz-motion-slow) var(--cz-motion-ease-out);
  }
  .cz-radio-card { display: flex; align-items: center; gap: var(--cz-space-3); padding: var(--cz-space-3) var(--cz-space-4); border: var(--cz-border-thick) solid var(--cz-outline); border-radius: var(--cz-radius-md); background: var(--cz-surface); cursor: pointer; box-shadow: 0 3px 0 var(--cz-outline); transition: translate var(--cz-motion-fast) var(--cz-motion-ease-bounce); }
  .cz-radio-card:hover { translate: 0 -2px; }
  .cz-radio-card:has([data-state="checked"]) { background: color-mix(in srgb, var(--cz-success-bright) 18%, var(--cz-surface)); }

  /* ---------- Toggle group: a tray of keys, pressed keys stay down ---------- */
  .cz-toggle-group { display: inline-flex; flex-wrap: wrap; gap: var(--cz-space-1); padding: var(--cz-space-1) var(--cz-space-1) calc(var(--cz-space-1) + 4px); border: var(--cz-border-thick) solid var(--cz-outline); border-radius: var(--cz-radius-lg); background: var(--cz-surface-sunken); box-shadow: var(--cz-shadow-well); }
  .cz-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--cz-space-2);
    min-width: var(--cz-size-touch);
    min-height: 40px;
    padding: 0 var(--cz-space-3);
    border: var(--cz-border-thin) solid var(--cz-outline);
    border-radius: var(--cz-radius-md);
    background: var(--cz-shadow-plastic), var(--cz-surface);
    color: var(--cz-text);
    font: inherit;
    font-size: var(--cz-font-size-sm);
    cursor: pointer;
    box-shadow: var(--cz-shadow-rim), 0 4px 0 var(--cz-outline);
    translate: 0 -2px;
    transition: translate var(--cz-motion-fast) var(--cz-motion-ease-bounce), box-shadow var(--cz-motion-fast) ease-out, background var(--cz-motion-fast) ease-out;
  }
  .cz-toggle:hover { translate: 0 -3px; box-shadow: var(--cz-shadow-rim), 0 5px 0 var(--cz-outline); }
  .cz-toggle[data-state="on"] { background: var(--cz-shadow-plastic), var(--cz-reward); color: var(--cz-reward-text); box-shadow: var(--cz-shadow-well), 0 1px 0 var(--cz-outline); translate: 0 1px; }
  .cz-toggle:disabled { opacity: 0.5; cursor: not-allowed; }
  .cz-toggle svg, .cz-toggle img { width: 20px; height: 20px; object-fit: contain; }

  /* ---------- Accordion: stacked boards, the open one unfolds ---------- */
  .cz-accordion { display: grid; gap: var(--cz-space-3); }
  .cz-accordion__item { border: var(--cz-border-thick) solid var(--cz-outline); border-radius: var(--cz-radius-lg); background: var(--cz-surface); box-shadow: 0 4px 0 var(--cz-surface-wall), 0 4px 0 var(--cz-border-thick) var(--cz-outline); overflow: hidden; margin-bottom: 4px; }
  .cz-accordion__trigger { display: flex; align-items: center; justify-content: space-between; gap: var(--cz-space-3); width: 100%; min-height: 52px; padding: var(--cz-space-3) var(--cz-space-4); border: 0; background: var(--cz-shadow-plastic), var(--cz-surface); color: var(--cz-text); font: inherit; font-size: var(--cz-font-size-md); text-align: left; cursor: pointer; }
  .cz-accordion__trigger:hover { background: var(--cz-shadow-plastic), color-mix(in srgb, var(--cz-secondary) 30%, var(--cz-surface)); }
  .cz-accordion__trigger svg { width: 18px; height: 18px; flex-shrink: 0; rotate: 90deg; transition: rotate var(--cz-motion-slow) var(--cz-motion-ease-bounce); }
  .cz-accordion__trigger[data-state="open"] { box-shadow: inset 0 -2px 0 var(--cz-surface-sunken); }
  .cz-accordion__trigger[data-state="open"] svg { rotate: -90deg; }
  .cz-accordion__content { overflow: hidden; color: var(--cz-text-muted); font-size: var(--cz-font-size-sm); }
  .cz-accordion__content[data-state="open"] { animation: cz-unfold var(--cz-motion-slow) var(--cz-motion-ease-out); }
  .cz-accordion__content[data-state="closed"] { animation: cz-fold var(--cz-motion-base) ease-in; }
  .cz-accordion__inner { padding: var(--cz-space-3) var(--cz-space-4) var(--cz-space-4); }

  /* ---------- Sheet: a board that slides in from an edge ---------- */
  .cz-sheet {
    position: fixed;
    z-index: 51;
    display: flex;
    flex-direction: column;
    gap: var(--cz-space-4);
    padding: var(--cz-space-6) var(--cz-space-5) var(--cz-space-5);
    border: var(--cz-border-frame) solid var(--cz-outline);
    background: linear-gradient(180deg, var(--cz-surface-top) 0, var(--cz-page) 40%, var(--cz-surface-bottom) 100%);
    color: var(--cz-text);
    box-shadow: inset 0 0 0 4px var(--cz-outline-soft), 0 0 30px -6px var(--cz-contact);
    overflow-y: auto;
  }
  .cz-sheet--right { top: 8px; right: 8px; bottom: 8px; width: min(400px, calc(100vw - 16px)); border-radius: var(--cz-radius-xl); animation: cz-slide-r var(--cz-motion-slow) var(--cz-motion-ease-bounce); padding-top: max(var(--cz-space-6), env(safe-area-inset-top)); }
  .cz-sheet--left { top: 8px; left: 8px; bottom: 8px; width: min(400px, calc(100vw - 16px)); border-radius: var(--cz-radius-xl); animation: cz-slide-l var(--cz-motion-slow) var(--cz-motion-ease-bounce); }
  .cz-sheet--top { top: 8px; left: 8px; right: 8px; max-height: 80dvh; border-radius: var(--cz-radius-xl); animation: cz-slide-t var(--cz-motion-slow) var(--cz-motion-ease-bounce); }
  .cz-sheet--bottom { left: 8px; right: 8px; bottom: 0; max-height: 85dvh; border-bottom: 0; border-radius: var(--cz-radius-xl) var(--cz-radius-xl) 0 0; padding-bottom: max(var(--cz-space-5), env(safe-area-inset-bottom)); animation: cz-slide-b var(--cz-motion-slow) var(--cz-motion-ease-bounce); }
  .cz-sheet--bottom::before { content: ""; align-self: center; width: 56px; height: 8px; margin-top: -10px; border: 2px solid var(--cz-outline); border-radius: 99px; background: var(--cz-surface-sunken); flex-shrink: 0; }
  .cz-sheet--right[data-state="closed"] { animation: cz-slide-r-out var(--cz-motion-base) ease-in forwards; }
  .cz-sheet--left[data-state="closed"] { animation: cz-slide-l-out var(--cz-motion-base) ease-in forwards; }
  .cz-sheet--top[data-state="closed"] { animation: cz-slide-t-out var(--cz-motion-base) ease-in forwards; }
  .cz-sheet--bottom[data-state="closed"] { animation: cz-slide-b-out var(--cz-motion-base) ease-in forwards; }
  .cz-sheet__close { position: absolute; top: 10px; right: 10px; }

  /* ---------- Alert: an inline notice board ---------- */
  .cz-alert { --tone: var(--cz-surface); --icon: var(--cz-outline); display: grid; grid-template-columns: auto 1fr; gap: 2px var(--cz-space-3); align-items: start; padding: var(--cz-space-3) var(--cz-space-4); border: var(--cz-border-thick) solid var(--cz-outline); border-radius: var(--cz-radius-lg); background: var(--cz-shadow-plastic), var(--tone); color: var(--cz-text); box-shadow: 0 4px 0 var(--cz-outline); margin-bottom: 4px; }
  .cz-alert > svg, .cz-alert > img { grid-row: span 2; width: 28px; height: 28px; color: var(--icon); }
  .cz-alert__title { font-size: var(--cz-font-size-md); line-height: 1.35; }
  .cz-alert__description { grid-column: 2; color: var(--cz-text-muted); font-size: var(--cz-font-size-sm); }
  .cz-alert--success { --tone: var(--cz-tint-success); --icon: var(--cz-success); }
  .cz-alert--info { --tone: var(--cz-tint-info); --icon: var(--cz-info); }
  .cz-alert--destructive { --tone: var(--cz-tint-danger); --icon: var(--cz-danger); }

  /* ---------- Skeleton: sunken clay with a moving sheen ---------- */
  /* ---------- Calendar: a board of date tiles ---------- */
  .cz-calendar {
    display: inline-grid;
    gap: var(--cz-space-3);
    width: max-content;
    max-width: 100%;
    padding: var(--cz-space-4);
    border: var(--cz-border-thick) solid var(--cz-outline);
    border-radius: var(--cz-radius-lg);
    background: linear-gradient(180deg, var(--cz-surface-top) 0%, var(--cz-surface) 40%, var(--cz-surface-bottom) 100%);
    color: var(--cz-text);
    font-family: var(--cz-font-family);
    box-shadow: inset 0 3px 0 color-mix(in srgb, var(--cz-surface-top) 80%, transparent), 0 var(--cz-depth-lift) 0 var(--cz-surface-wall), 0 var(--cz-depth-lift) 0 var(--cz-border-thick) var(--cz-outline);
    margin-bottom: calc(var(--cz-depth-lift) + 4px);
  }
  .cz-calendar__head { display: flex; align-items: center; justify-content: space-between; gap: var(--cz-space-2); }
  .cz-calendar__title { font-size: var(--cz-font-size-md); text-transform: capitalize; }
  .cz-calendar__nav {
    display: grid; place-items: center; width: 36px; height: 36px; padding: 0;
    border: var(--cz-border-thin) solid var(--cz-outline); border-radius: var(--cz-radius-sm);
    background: var(--cz-shadow-plastic), var(--cz-surface); color: var(--cz-text); cursor: pointer;
    box-shadow: var(--cz-shadow-rim), 0 3px 0 var(--cz-outline);
    margin-bottom: 3px;
    transition: translate var(--cz-motion-fast) var(--cz-motion-ease-bounce), box-shadow var(--cz-motion-fast) ease-out;
  }
  .cz-calendar__nav svg { width: 16px; height: 16px; }
  .cz-calendar__nav:hover { translate: 0 -1px; box-shadow: var(--cz-shadow-rim), 0 4px 0 var(--cz-outline); }
  .cz-calendar__nav:active { translate: 0 3px; box-shadow: var(--cz-shadow-well), 0 0 0 var(--cz-outline); }
  .cz-calendar__grid { display: grid; gap: 4px; }
  .cz-calendar__row { display: grid; grid-template-columns: repeat(7, 40px); }
  .cz-calendar__weekday { display: grid; place-items: center; height: 28px; color: var(--cz-text-muted); font-size: var(--cz-font-size-sm); text-transform: capitalize; }
  .cz-calendar__cell { position: relative; display: grid; place-items: center; height: 44px; }
  .cz-calendar__cell[data-in-range], .cz-calendar__cell[data-range-start], .cz-calendar__cell[data-range-end] { background: color-mix(in srgb, var(--cz-reward) 28%, transparent); }
  .cz-calendar__cell[data-range-start] { border-radius: 12px 0 0 12px; }
  .cz-calendar__cell[data-range-end] { border-radius: 0 12px 12px 0; }
  .cz-calendar__day {
    position: relative; display: grid; place-items: center; width: 36px; height: 36px; padding: 0;
    border: var(--cz-border-thin) solid transparent; border-radius: 10px;
    background: transparent; color: var(--cz-text); font: inherit; font-size: var(--cz-font-size-sm); font-variant-numeric: tabular-nums;
    cursor: pointer;
    transition: translate var(--cz-motion-fast) var(--cz-motion-ease-bounce), scale var(--cz-motion-fast) var(--cz-motion-ease-bounce), box-shadow var(--cz-motion-fast) ease-out;
  }
  .cz-calendar__day:hover:not(:disabled) { border-color: var(--cz-outline); background: var(--cz-shadow-plastic), var(--cz-surface-top); box-shadow: var(--cz-shadow-rim), 0 3px 0 var(--cz-outline); translate: 0 -2px; }
  .cz-calendar__day:active:not(:disabled) { translate: 0 1px; scale: 1.04 0.94; box-shadow: var(--cz-shadow-well); transition-duration: var(--cz-motion-instant); }
  .cz-calendar__day:focus-visible { outline: 3px solid var(--cz-ring); outline-offset: 2px; }
  .cz-calendar__day[data-today] { border-color: var(--cz-outline); box-shadow: inset 0 0 0 2px var(--cz-surface-top); }
  .cz-calendar__day[data-outside] { color: color-mix(in srgb, var(--cz-text-muted) 70%, transparent); }
  .cz-calendar__day[data-selected] {
    border: var(--cz-border-thin) solid var(--cz-outline);
    background: var(--cz-shadow-plastic), var(--cz-reward); color: var(--cz-reward-text);
    box-shadow: var(--cz-shadow-rim), var(--cz-shadow-bevel), 0 3px 0 var(--cz-reward-wall), 0 3px 0 var(--cz-border-thin) var(--cz-outline);
    translate: 0 -2px;
    animation: cz-jelly 420ms var(--cz-motion-ease-out);
  }
  .cz-calendar__day[data-marked]::after { content: ""; position: absolute; bottom: 3px; left: 50%; width: 6px; height: 6px; margin-left: -3px; border-radius: 50%; background: var(--cz-success); box-shadow: 0 0 0 1.5px var(--cz-surface); }
  .cz-calendar__day[data-selected][data-marked]::after { box-shadow: 0 0 0 1.5px var(--cz-reward); }
  .cz-calendar__day:disabled { color: color-mix(in srgb, var(--cz-text-muted) 55%, transparent); text-decoration: line-through; cursor: not-allowed; }
  @media (max-width: 380px) { .cz-calendar { padding: var(--cz-space-3); } .cz-calendar__row { grid-template-columns: repeat(7, 36px); } .cz-calendar__day { width: 34px; height: 34px; } }

  /* ---------- Game: rarity, item slots, stat bars ---------- */
  :where(:root, [data-palette]) {
    --cz-rarity-common: color-mix(in srgb, var(--cz-text-muted) 55%, var(--cz-surface));
    /* danger as text: pulled toward the text colour so it stays AA in light and dark palettes */
    --cz-danger-ink: color-mix(in srgb, var(--cz-danger) 78%, var(--cz-text));
    --cz-rarity-uncommon: var(--cz-success);
    --cz-rarity-rare: var(--cz-info);
    --cz-rarity-epic: #8e5bd0;
    --cz-rarity-legendary: var(--cz-reward);
  }
  .cz-sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
  .cz-rarity {
    display: inline-flex; align-items: center; height: 22px; padding: 0 8px;
    border: var(--cz-border-thin) solid color-mix(in srgb, var(--rarity, var(--cz-outline)) 75%, var(--cz-outline));
    border-radius: var(--cz-radius-full);
    background: color-mix(in srgb, var(--rarity, var(--cz-surface)) 24%, var(--cz-surface));
    color: var(--cz-text); font-size: var(--cz-font-size-xs); line-height: 1; white-space: nowrap;
  }
  .cz-slot {
    --slot: 64px;
    --edge: var(--rarity, var(--cz-outline-soft));
    position: relative; display: grid; place-items: center; flex-shrink: 0;
    width: var(--slot); height: var(--slot); padding: 0;
    border: var(--cz-border-thick) solid color-mix(in srgb, var(--edge) 80%, var(--cz-outline));
    border-radius: var(--cz-radius-md);
    background: radial-gradient(circle at 50% 38%, color-mix(in srgb, var(--rarity, transparent) 22%, transparent), transparent 70%), var(--cz-surface-sunken);
    box-shadow: var(--cz-shadow-well);
    color: var(--cz-text); font: inherit; cursor: pointer; user-select: none; -webkit-user-select: none;
    transition: translate var(--cz-motion-fast) var(--cz-motion-ease-bounce), scale var(--cz-motion-fast) var(--cz-motion-ease-bounce), box-shadow var(--cz-motion-fast) ease-out;
  }
  .cz-slot[data-rarity="epic"], .cz-slot[data-rarity="legendary"] { box-shadow: var(--cz-shadow-well), 0 0 0 3px color-mix(in srgb, var(--rarity) 30%, transparent), 0 0 14px color-mix(in srgb, var(--rarity) 45%, transparent); }
  .cz-slot:not([data-empty]):not([data-locked]):hover { translate: 0 -2px; scale: 1.04; }
  .cz-slot:focus-visible { outline: 3px solid var(--cz-ring); outline-offset: 2px; }
  .cz-slot[data-selected] { border-color: var(--cz-reward); box-shadow: var(--cz-shadow-well), 0 0 0 3px color-mix(in srgb, var(--cz-reward) 55%, transparent); translate: 0 -2px; }
  .cz-slot[data-grabbed] { opacity: 0.45; scale: 0.94; border-style: dashed; }
  .cz-slot[data-drop-target] { border-color: var(--cz-primary); border-style: dashed; box-shadow: var(--cz-shadow-well), 0 0 0 4px color-mix(in srgb, var(--cz-primary) 35%, transparent); scale: 1.06; }
  .cz-slot[data-empty] { cursor: default; }
  .cz-slot[data-locked] { cursor: not-allowed; border-style: dashed; background: repeating-linear-gradient(-45deg, transparent 0 6px, color-mix(in srgb, var(--cz-outline) 8%, transparent) 6px 12px), var(--cz-surface-sunken); color: color-mix(in srgb, var(--cz-text-muted) 70%, transparent); }
  .cz-slot__icon { display: grid; place-items: center; width: 72%; height: 72%; pointer-events: none; }
  .cz-slot__icon > * { width: 100%; height: 100%; object-fit: contain; }
  .cz-slot__lock { width: 38%; height: 38%; }
  .cz-slot__placeholder { display: grid; place-items: center; width: 54%; height: 54%; opacity: 0.3; pointer-events: none; }
  .cz-slot__placeholder > * { width: 100%; height: 100%; }
  .cz-slot__qty { position: absolute; right: 4px; bottom: 2px; color: #fff; font-size: 14px; font-variant-numeric: tabular-nums; line-height: 1; paint-order: stroke; -webkit-text-stroke: 3px #2a1c12; pointer-events: none; }
  .cz-slot__corner { position: absolute; left: 3px; top: 3px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 6px; background: var(--cz-outline); color: #fff; font-size: 11px; line-height: 16px; text-align: center; pointer-events: none; }
  .cz-slot__meter { position: absolute; left: 5px; right: 5px; bottom: 4px; height: 4px; border-radius: 99px; background: color-mix(in srgb, var(--cz-outline) 25%, transparent); pointer-events: none; }
  .cz-slot__meter::after { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--meter); border-radius: inherit; background: var(--cz-success); }
  .cz-slot:has(.cz-slot__meter) .cz-slot__qty { bottom: 9px; }

  .cz-statbar { display: grid; gap: 4px; min-width: 0; }
  .cz-statbar__head { display: flex; align-items: center; gap: 6px; font-size: var(--cz-font-size-sm); }
  .cz-statbar__icon { display: grid; width: 18px; height: 18px; }
  .cz-statbar__icon > * { width: 100%; height: 100%; }
  .cz-statbar__label { color: var(--cz-text); }
  .cz-statbar__value { margin-left: auto; color: var(--cz-text-muted); font-variant-numeric: tabular-nums; }
  .cz-statbar__track { position: relative; height: 14px; overflow: hidden; border: var(--cz-border-thin) solid var(--cz-outline); border-radius: var(--cz-radius-full); background: var(--cz-surface-sunken); box-shadow: var(--cz-shadow-well); }
  .cz-statbar__fill { height: 100%; border-radius: inherit; background: linear-gradient(180deg, rgb(255 255 255 / 0.5) 0 25%, transparent 55%), var(--fill, var(--cz-success)); transition: width var(--cz-motion-slow) var(--cz-motion-ease-bounce); }

  /* ---------- Shared game board (inventory, character sheet, gallery) ---------- */
  .cz-inventory, .cz-character, .cz-gallery {
    display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; gap: var(--cz-space-3); min-width: 0; padding: var(--cz-space-4);
    border: var(--cz-border-thick) solid var(--cz-outline); border-radius: var(--cz-radius-lg);
    background: linear-gradient(180deg, var(--cz-surface-top) 0%, var(--cz-surface) 40%, var(--cz-surface-bottom) 100%);
    color: var(--cz-text); font-family: var(--cz-font-family);
    box-shadow: inset 0 3px 0 color-mix(in srgb, var(--cz-surface-top) 80%, transparent), 0 var(--cz-depth-lift) 0 var(--cz-surface-wall), 0 var(--cz-depth-lift) 0 var(--cz-border-thick) var(--cz-outline), 0 calc(var(--cz-depth-lift) + 10px) 16px -6px var(--cz-contact);
    margin-bottom: calc(var(--cz-depth-lift) + 4px);
  }
  .cz-inventory__head, .cz-gallery__head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--cz-space-2) var(--cz-space-3); }
  .cz-inventory__title, .cz-gallery__title { font-size: var(--cz-font-size-lg); }
  .cz-inventory__cap { padding: 2px 10px; border-radius: var(--cz-radius-full); background: var(--cz-surface-sunken); color: var(--cz-text-muted); font-size: var(--cz-font-size-sm); font-variant-numeric: tabular-nums; }
  .cz-inventory__end { margin-left: auto; display: flex; gap: var(--cz-space-2); }
  .cz-inventory__tools { display: flex; flex-wrap: wrap; align-items: center; gap: var(--cz-space-2); }
  .cz-inventory__tabs { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: var(--cz-radius-md); background: var(--cz-surface-sunken); box-shadow: var(--cz-shadow-well); }
  .cz-inventory__tab, .cz-inventory__sort {
    display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 12px;
    border: var(--cz-border-thin) solid transparent; border-radius: var(--cz-radius-sm); background: transparent;
    color: var(--cz-text-muted); font: inherit; font-size: var(--cz-font-size-sm); cursor: pointer;
  }
  .cz-inventory__tab:hover { color: var(--cz-text); }
  .cz-inventory__tab[aria-selected="true"] { border-color: var(--cz-outline); background: var(--cz-shadow-plastic), var(--cz-surface); color: var(--cz-text); box-shadow: 0 2px 0 var(--cz-outline); }
  .cz-inventory__tab-icon { display: grid; width: 18px; height: 18px; }
  .cz-inventory__tab-icon > * { width: 100%; height: 100%; }
  .cz-inventory__sort { border-color: var(--cz-outline); background: var(--cz-shadow-plastic), var(--cz-surface); color: var(--cz-text); box-shadow: 0 3px 0 var(--cz-outline); }
  .cz-inventory__sort:active { translate: 0 2px; box-shadow: 0 1px 0 var(--cz-outline); }
  .cz-inventory__search { flex: 1 1 160px; max-width: 260px; min-height: 40px; }
  .cz-inventory__grid { display: grid; grid-template-columns: repeat(var(--cols, auto-fill), var(--slot)); gap: 8px; justify-content: start; }
  /* a fixed column count shrinks the slots on narrow screens instead of overflowing */
  .cz-inventory__grid[data-cols] { grid-template-columns: repeat(var(--cols), minmax(0, var(--slot))); }
  .cz-inventory__grid[data-cols] > .cz-slot, .cz-inventory__grid[data-cols] > * > .cz-slot { width: 100%; height: auto; aspect-ratio: 1; }
  .cz-inventory__grid[data-dragging] { cursor: grabbing; }
  .cz-inventory__empty { grid-column: 1 / -1; padding: var(--cz-space-4); color: var(--cz-text-muted); text-align: center; }
  .cz-inventory__ghost { position: fixed; z-index: 60; pointer-events: none; translate: -50% -50%; rotate: -6deg; scale: 1.12; box-shadow: var(--cz-shadow-well), 0 12px 18px -6px var(--cz-contact); }

  /* ---------- Item info ---------- */
  .cz-iteminfo {
    display: grid; align-content: start; gap: var(--cz-space-3); min-width: 0; padding: var(--cz-space-4);
    border: var(--cz-border-thick) solid var(--cz-outline); border-radius: var(--cz-radius-lg);
    background: linear-gradient(180deg, color-mix(in srgb, var(--rarity, var(--cz-surface-top)) 18%, var(--cz-surface-top)) 0, var(--cz-surface) 46px);
    color: var(--cz-text); font-family: var(--cz-font-family); font-size: var(--cz-font-size-sm);
    box-shadow: inset 0 4px 0 color-mix(in srgb, var(--rarity, var(--cz-outline-soft)) 70%, transparent), 0 4px 0 var(--cz-outline);
    margin-bottom: 4px;
  }
  .cz-iteminfo[data-variant="card"] { max-width: 340px; }
  .cz-iteminfo[data-variant="compact"] { gap: var(--cz-space-2); width: 260px; padding: var(--cz-space-3); }
  .cz-iteminfo__head { display: flex; align-items: center; gap: var(--cz-space-3); }
  .cz-iteminfo__icon { display: grid; place-items: center; flex-shrink: 0; width: 56px; height: 56px; border: var(--cz-border-thin) solid color-mix(in srgb, var(--rarity, var(--cz-outline-soft)) 80%, var(--cz-outline)); border-radius: var(--cz-radius-md); background: var(--cz-surface-sunken); box-shadow: var(--cz-shadow-well); }
  .cz-iteminfo[data-variant="compact"] .cz-iteminfo__icon { width: 44px; height: 44px; }
  .cz-iteminfo__icon > * { width: 76%; height: 76%; object-fit: contain; }
  .cz-iteminfo__titles { display: grid; gap: 4px; min-width: 0; }
  .cz-iteminfo__name { font-size: var(--cz-font-size-md); line-height: 1.25; }
  .cz-iteminfo__qty { color: var(--cz-text-muted); }
  .cz-iteminfo__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; color: var(--cz-text-muted); font-size: var(--cz-font-size-xs); }
  .cz-iteminfo__desc { color: var(--cz-text-muted); line-height: 1.45; }
  .cz-iteminfo__stats { display: grid; gap: 4px; margin: 0; padding: var(--cz-space-2) var(--cz-space-3); border-radius: var(--cz-radius-md); background: var(--cz-surface-sunken); }
  .cz-iteminfo__stat { display: flex; justify-content: space-between; gap: var(--cz-space-3); }
  .cz-iteminfo__stat dt { color: var(--cz-text-muted); }
  .cz-iteminfo__stat dd { margin: 0; font-variant-numeric: tabular-nums; }
  .cz-iteminfo__delta { margin-left: 6px; color: var(--cz-danger-ink); }
  .cz-iteminfo__delta[data-good] { color: var(--cz-success-text-on-surface, var(--cz-success)); }
  .cz-iteminfo__foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--cz-space-2); }
  .cz-iteminfo__value { color: var(--cz-text); font-variant-numeric: tabular-nums; }
  .cz-iteminfo__actions { display: flex; flex-wrap: wrap; gap: var(--cz-space-2); margin-left: auto; }
  .cz-iteminfo__kbd { margin-left: 6px; padding: 0 5px; border-radius: 5px; background: rgb(0 0 0 / 0.12); font-size: 11px; }
  .cz-tooltip.cz-iteminfo-tip { max-width: none; padding: 0; border: 0; background: none; box-shadow: none; color: inherit; }

  /* ---------- Character sheet ---------- */
  .cz-character { max-width: 460px; }
  .cz-character[data-variant="compact"] { max-width: 300px; padding: var(--cz-space-3); gap: var(--cz-space-2); }
  .cz-character__top { display: flex; align-items: center; gap: var(--cz-space-4); }
  .cz-character__portrait {
    position: relative; display: grid; place-items: center; flex-shrink: 0; width: 96px; height: 96px;
    border: var(--cz-border-thick) solid color-mix(in srgb, var(--rarity, var(--cz-outline)) 70%, var(--cz-outline)); border-radius: var(--cz-radius-lg);
    background: radial-gradient(circle at 50% 35%, var(--cz-surface-top), var(--cz-page-sky, var(--cz-surface-sunken)));
    box-shadow: 0 4px 0 var(--cz-outline);
  }
  .cz-character[data-variant="compact"] .cz-character__portrait { width: 64px; height: 64px; }
  .cz-character__portrait > :not(.cz-character__level) { width: 84%; height: 84%; object-fit: contain; border-radius: inherit; }
  .cz-character__level { position: absolute; right: -10px; bottom: -10px; display: grid; place-items: center; min-width: 32px; height: 32px; padding: 0 6px; border: var(--cz-border-thin) solid var(--cz-outline); border-radius: var(--cz-radius-full); background: var(--cz-shadow-plastic), var(--cz-reward); color: var(--cz-reward-text); font-size: var(--cz-font-size-sm); box-shadow: 0 2px 0 var(--cz-outline); }
  .cz-character__id { display: grid; gap: 6px; flex: 1; min-width: 0; }
  .cz-character__name { margin: 0; font-size: var(--cz-font-size-xl, 22px); font-weight: var(--cz-font-weight-regular); line-height: 1.15; }
  .cz-character__title { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; color: var(--cz-text-muted); font-size: var(--cz-font-size-sm); }
  .cz-character__bars { display: grid; gap: var(--cz-space-2); }
  .cz-character__status { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
  .cz-character__desc { color: var(--cz-text-muted); font-size: var(--cz-font-size-sm); line-height: 1.45; }
  .cz-character__attrs { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 6px; margin: 0; }
  .cz-character__attr { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 6px 10px; border-radius: var(--cz-radius-md); background: var(--cz-surface-sunken); box-shadow: var(--cz-shadow-well); font-size: var(--cz-font-size-sm); }
  .cz-character__attr dt { display: inline-flex; align-items: center; gap: 6px; color: var(--cz-text-muted); }
  .cz-character__attr dt > svg { width: 16px; height: 16px; }
  .cz-character__attr dd { margin: 0; font-variant-numeric: tabular-nums; }
  .cz-character__bonus { margin-left: 4px; color: var(--cz-danger-ink); font-size: var(--cz-font-size-xs); }
  .cz-character__bonus[data-good] { color: var(--cz-success); }
  .cz-character__equip { display: grid; grid-template-columns: repeat(auto-fill, minmax(calc(var(--slot) + 8px), 1fr)); gap: var(--cz-space-2); }
  .cz-character__equip-slot { display: grid; justify-items: center; gap: 4px; }
  .cz-character__equip-label { color: var(--cz-text-muted); font-size: var(--cz-font-size-xs); }
  .cz-character__actions { display: flex; flex-wrap: wrap; gap: var(--cz-space-2); }

  /* ---------- Gallery ---------- */
  .cz-gallery__progress { display: grid; gap: 4px; flex: 1 1 180px; max-width: 280px; margin-left: auto; color: var(--cz-text-muted); font-size: var(--cz-font-size-sm); }
  .cz-gallery__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--card), 1fr)); grid-auto-rows: 1fr; gap: var(--cz-space-3); }
  .cz-gallery__cell { display: grid; min-width: 0; }
  .cz-gallery__card {
    position: relative; display: grid; grid-template-rows: auto auto 1fr; justify-items: center; align-content: start; gap: 4px; width: 100%; height: var(--card-h, 100%); padding: var(--cz-space-3) var(--cz-space-2) var(--cz-space-2); overflow: hidden;
    border: var(--cz-border-thick) solid color-mix(in srgb, var(--rarity, var(--cz-outline)) 65%, var(--cz-outline)); border-radius: var(--cz-radius-lg);
    background: linear-gradient(180deg, color-mix(in srgb, var(--rarity, var(--cz-surface-top)) 16%, var(--cz-surface-top)), var(--cz-surface) 70%);
    color: var(--cz-text); font: inherit; text-align: center; cursor: pointer;
    box-shadow: inset 0 3px 0 rgb(255 255 255 / 0.4), 0 4px 0 var(--cz-outline);
    margin-bottom: 4px;
    transition: translate var(--cz-motion-fast) var(--cz-motion-ease-bounce);
  }
  .cz-gallery__card:hover:not([aria-disabled]) { translate: 0 -3px; }
  .cz-gallery__card:active:not([aria-disabled]) { translate: 0 2px; box-shadow: inset 0 3px 0 rgb(255 255 255 / 0.4), 0 2px 0 var(--cz-outline); }
  .cz-gallery__card:focus-visible { outline: 3px solid var(--cz-ring); outline-offset: 3px; }
  .cz-gallery__card[data-locked] { border-style: dashed; background: var(--cz-surface-sunken); cursor: default; box-shadow: var(--cz-shadow-well); }
  .cz-gallery__art { display: grid; place-items: center; width: var(--art, 74%); aspect-ratio: 1; }
  .cz-gallery__art > * { width: 100%; height: 100%; object-fit: contain; }
  .cz-gallery__card[data-locked] .cz-gallery__art > * { filter: brightness(0); opacity: 0.28; }
  .cz-gallery__name { font-size: var(--cz-font-size-sm); line-height: 1.25; }
  .cz-gallery__caption { color: var(--cz-text-muted); font-size: var(--cz-font-size-xs); }
  .cz-gallery__badge { position: absolute; right: 6px; top: 6px; padding: 1px 7px; border: var(--cz-border-thin) solid var(--cz-outline); border-radius: var(--cz-radius-full); background: var(--cz-reward); color: var(--cz-reward-text); font-size: 11px; }
  .cz-gallery__viewer { justify-items: center; text-align: center; max-width: 420px; }
  .cz-gallery__stage { display: grid; place-items: center; width: 220px; max-width: 70vw; aspect-ratio: 1; border-radius: var(--cz-radius-xl); background: radial-gradient(circle at 50% 45%, color-mix(in srgb, var(--rarity, var(--cz-reward)) 40%, transparent), transparent 68%); }
  .cz-gallery__stage > * { width: 78%; height: 78%; object-fit: contain; animation: cz-pop var(--cz-motion-slow) var(--cz-motion-ease-out); }
  .cz-gallery__stage[data-locked] > * { filter: brightness(0); opacity: 0.3; }
  .cz-gallery__vname { margin: 0; font-size: var(--cz-font-size-xl, 22px); font-weight: var(--cz-font-weight-regular); }
  .cz-gallery__vmeta { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px; color: var(--cz-text-muted); font-size: var(--cz-font-size-sm); }
  .cz-gallery__vdesc { margin: 0; color: var(--cz-text-muted); }
  .cz-gallery__vnav { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: var(--cz-space-2); width: 100%; }
  .cz-gallery__count { color: var(--cz-text-muted); font-size: var(--cz-font-size-sm); font-variant-numeric: tabular-nums; }

  /* ---------- Collectible card (ItemCard), hand and grid ---------- */
  .cz-tcard {
    --card-w: 240px;
    --element: var(--cz-reward);
    --frame: color-mix(in srgb, var(--element) 55%, var(--cz-surface-top));
    position: relative; flex-shrink: 0; width: min(var(--card-w), 100%); aspect-ratio: 5 / 7;
    container-type: inline-size; perspective: 900px; outline: none;
    color: var(--cz-text); font-family: var(--cz-font-family); text-align: left;
    -webkit-tap-highlight-color: transparent;
    transition: translate var(--cz-motion-base) var(--cz-motion-ease-bounce);
  }
  .cz-tcard[role="button"] { cursor: pointer; }
  .cz-tcard[role="button"]:hover:not([data-disabled]) { translate: 0 -4px; }
  .cz-tcard:focus-visible .cz-tcard__face { outline: 3px solid var(--cz-ring); outline-offset: 3px; }
  .cz-tcard[data-selected] { translate: 0 -8px; }
  .cz-tcard[data-selected] .cz-tcard__front { box-shadow: inset 0 0 0 1.2cqw var(--rarity, transparent), 0 0 0 1.6cqw var(--cz-reward), 0 3cqw 0 var(--cz-outline), 0 8cqw 10cqw -4cqw var(--cz-contact); }
  .cz-tcard[data-disabled] { opacity: 0.55; filter: grayscale(0.6); cursor: not-allowed; }
  .cz-tcard__inner {
    position: relative; width: 100%; height: 100%; transform-style: preserve-3d;
    transform: rotateX(var(--rx, 0deg)) rotateY(calc(var(--ry, 0deg) + var(--flip, 0deg)));
    transition: transform 520ms var(--cz-motion-ease-bounce);
  }
  .cz-tcard[data-active] .cz-tcard__inner { transition: transform 90ms linear; }
  .cz-tcard[data-flipped] { --flip: 180deg; }
  .cz-tcard__face { position: absolute; inset: 0; overflow: hidden; border-radius: 6cqw; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
  /* Hide the face we are not looking at halfway through the flip. backface-visibility alone is not reliable in every engine. */
  .cz-tcard__face { transition: visibility 0s linear 260ms; }
  .cz-tcard__back, .cz-tcard[data-flipped] .cz-tcard__front { visibility: hidden; }
  .cz-tcard[data-flipped] .cz-tcard__back { visibility: visible; }
  .cz-tcard__front {
    display: grid; grid-template-rows: auto auto auto 1fr auto; gap: 2cqw; padding: 3.4cqw;
    border: 1.6cqw solid var(--cz-outline);
    background:
      radial-gradient(120% 60% at 20% 0%, rgb(255 255 255 / 0.55), transparent 60%),
      linear-gradient(160deg, var(--frame), color-mix(in srgb, var(--element) 75%, var(--cz-outline)) 140%);
    box-shadow: inset 0 0 0 1.2cqw color-mix(in srgb, var(--rarity, transparent) 85%, transparent), 0 3cqw 0 var(--cz-outline), 0 8cqw 10cqw -4cqw var(--cz-contact);
  }
  .cz-tcard__head { display: flex; align-items: center; gap: 2cqw; min-width: 0; padding: 1.4cqw 2.8cqw; border: 0.9cqw solid var(--cz-outline); border-radius: 3.4cqw; background: linear-gradient(180deg, var(--cz-surface-top), var(--cz-surface)); box-shadow: 0 1cqw 0 color-mix(in srgb, var(--cz-outline) 70%, transparent); }
  .cz-tcard__name { flex: 1; min-width: 0; overflow: hidden; font-size: 6.8cqw; line-height: 1.15; text-overflow: ellipsis; white-space: nowrap; }
  .cz-tcard__stat { display: inline-flex; align-items: baseline; gap: 1cqw; font-size: 7cqw; font-variant-numeric: tabular-nums; line-height: 1; }
  .cz-tcard__stat small { color: var(--cz-text-muted); font-size: 3.8cqw; }
  .cz-tcard__art {
    position: relative; display: grid; place-items: center; aspect-ratio: 4 / 3;
    border: 1.2cqw solid var(--cz-outline); border-radius: 3.6cqw;
    background: radial-gradient(circle at 50% 42%, rgb(255 255 255 / 0.85), color-mix(in srgb, var(--element) 30%, var(--cz-surface-top)) 70%);
    box-shadow: inset 0 -1.6cqw 0 color-mix(in srgb, var(--element) 25%, transparent);
  }
  .cz-tcard__art > :not(.cz-tcard__badge) { width: 70%; height: 82%; object-fit: contain; }
  .cz-tcard__art > img { width: 100%; height: 100%; object-fit: cover; border-radius: 2.4cqw; }
  .cz-tcard__badge { position: absolute; right: 2cqw; top: 2cqw; padding: 0.6cqw 2.4cqw; border: 0.8cqw solid var(--cz-outline); border-radius: 99px; background: var(--cz-reward); color: var(--cz-reward-text); font-size: 3.8cqw; }
  .cz-tcard__type { display: flex; align-items: center; justify-content: space-between; gap: 2cqw; padding: 0.8cqw 2.6cqw; border-radius: 99px; background: color-mix(in srgb, var(--cz-surface-top) 82%, transparent); font-size: 4cqw; color: var(--cz-text); }
  .cz-tcard__element { display: inline-flex; align-items: center; gap: 1cqw; padding: 0.2cqw 2cqw; border: 0.6cqw solid var(--cz-outline); border-radius: 99px; background: color-mix(in srgb, var(--element) 30%, var(--cz-surface-top)); font-size: 3.6cqw; }
  .cz-tcard__element > svg { width: 4cqw; height: 4cqw; }
  .cz-tcard__body { display: grid; align-content: start; gap: 2cqw; min-height: 0; overflow: hidden; padding: 2.6cqw 3cqw; border: 0.9cqw solid var(--cz-outline); border-radius: 3.4cqw; background: var(--cz-surface); font-size: 4.2cqw; line-height: 1.32; }
  .cz-tcard__body--empty { background: color-mix(in srgb, var(--cz-surface) 70%, transparent); }
  .cz-tcard__ability { display: grid; gap: 0.6cqw; }
  .cz-tcard__ability + .cz-tcard__ability { padding-top: 1.6cqw; border-top: 0.6cqw dashed color-mix(in srgb, var(--cz-outline) 30%, transparent); }
  .cz-tcard__ability-head { display: flex; align-items: center; gap: 1.6cqw; }
  .cz-tcard__cost { display: inline-grid; place-items: center; min-width: 6cqw; height: 6cqw; padding: 0 1.4cqw; border: 0.7cqw solid var(--cz-outline); border-radius: 99px; background: color-mix(in srgb, var(--element) 35%, var(--cz-surface-top)); font-size: 3.8cqw; }
  .cz-tcard__cost > svg { width: 4.2cqw; height: 4.2cqw; }
  .cz-tcard__ability-name { flex: 1; min-width: 0; font-size: 5cqw; }
  .cz-tcard__ability-value { font-size: 6.2cqw; font-variant-numeric: tabular-nums; line-height: 1; }
  .cz-tcard__ability-text { color: var(--cz-text-muted); }
  .cz-tcard__flavor { padding-top: 1.4cqw; border-top: 0.6cqw dashed color-mix(in srgb, var(--cz-outline) 30%, transparent); color: var(--cz-text-muted); font-size: 3.7cqw; font-style: italic; }
  .cz-tcard__foot { display: flex; align-items: center; gap: 2cqw; padding: 0 1.4cqw; color: color-mix(in srgb, var(--cz-text) 85%, var(--element)); font-size: 3.3cqw; line-height: 1.2; }
  .cz-tcard__set { margin-left: auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .cz-tcard__gem { width: 3.4cqw; height: 3.4cqw; border: 0.6cqw solid var(--cz-outline); background: var(--rarity, var(--cz-surface)); rotate: 45deg; }
  /* foil and glare */
  .cz-tcard__foil, .cz-tcard__glare { position: absolute; inset: 0; border-radius: inherit; pointer-events: none; }
  .cz-tcard[data-foil="holo"] .cz-tcard__foil {
    background: linear-gradient(115deg, transparent 18%, rgb(255 90 200 / 0.55) 32%, rgb(90 220 255 / 0.55) 44%, rgb(255 236 90 / 0.55) 56%, rgb(140 255 160 / 0.5) 66%, transparent 80%) var(--mx, 30%) var(--my, 30%) / 260% 260%;
    mix-blend-mode: color-dodge; opacity: 0.35; animation: cz-foil 6s ease-in-out infinite alternate;
  }
  .cz-tcard[data-foil="shimmer"] .cz-tcard__foil { background: linear-gradient(105deg, transparent 38%, rgb(255 255 255 / 0.7) 50%, transparent 62%) var(--mx, 0%) 0 / 300% 100%; mix-blend-mode: soft-light; opacity: 0.6; animation: cz-foil 5s ease-in-out infinite alternate; }
  .cz-tcard[data-active] .cz-tcard__foil { animation: none; opacity: 0.8; }
  .cz-tcard__glare { background: radial-gradient(circle at var(--mx, 50%) var(--my, 50%), rgb(255 255 255 / 0.5), transparent 46%); opacity: 0; transition: opacity var(--cz-motion-base) ease-out; mix-blend-mode: overlay; }
  .cz-tcard[data-active] .cz-tcard__glare { opacity: 1; }
  @keyframes cz-foil { from { background-position: 0% 0%; } to { background-position: 100% 100%; } }
  /* back */
  .cz-tcard__back { transform: rotateY(180deg); border: 1.6cqw solid var(--cz-outline); background: var(--cz-primary); box-shadow: 0 3cqw 0 var(--cz-outline); }
  .cz-tcard__back-art { position: absolute; inset: 3cqw; display: grid; place-items: center; border: 1cqw solid color-mix(in srgb, var(--cz-primary-text) 55%, transparent); border-radius: 4cqw; background: radial-gradient(circle, color-mix(in srgb, var(--cz-primary-text) 22%, transparent) 1.2cqw, transparent 1.4cqw) 0 0 / 8cqw 8cqw, linear-gradient(160deg, color-mix(in srgb, var(--cz-primary) 80%, #fff), var(--cz-primary-wall)); }
  .cz-tcard__back-mark { width: 34cqw; aspect-ratio: 1; border: 1.6cqw solid var(--cz-outline); border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff 0 12%, var(--cz-reward) 40%, color-mix(in srgb, var(--cz-reward) 70%, var(--cz-outline)) 100%); box-shadow: 0 2cqw 0 var(--cz-outline); }
  /* not collected */
  .cz-tcard[data-unowned] .cz-tcard__front { background: var(--cz-surface-sunken); border-style: dashed; box-shadow: none; }
  .cz-tcard[data-unowned] .cz-tcard__art > * { filter: brightness(0); opacity: 0.3; }
  .cz-tcard[data-unowned] .cz-tcard__head, .cz-tcard[data-unowned] .cz-tcard__type { color: var(--cz-text-muted); }

  .cz-hand { container-type: inline-size; display: flex; justify-content: center; width: 100%; padding: 12% 0 3%; }
  .cz-hand__slot {
    --hand-card: min(var(--card-w), calc(86cqw / (1 + (var(--n, 5) - 1) * (1 - var(--overlap)))));
    flex-shrink: 0; width: var(--hand-card); margin-left: calc(var(--hand-card) * var(--overlap) * -1);
    rotate: var(--a); translate: 0 var(--lift); transform-origin: 50% 130%;
    transition: translate var(--cz-motion-base) var(--cz-motion-ease-bounce), rotate var(--cz-motion-base) var(--cz-motion-ease-bounce);
  }
  .cz-hand__slot:first-child { margin-left: 0; }
  .cz-hand__slot > .cz-tcard { --card-w: var(--hand-card); width: 100%; }
  .cz-hand__slot:hover, .cz-hand__slot:focus-within, .cz-hand__slot[data-selected] { z-index: 99 !important; translate: 0 calc(var(--lift) - 18%); rotate: calc(var(--a) * 0.4); }
  .cz-cardgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(var(--card-w), 100%), 1fr)); justify-items: center; gap: var(--cz-space-4) var(--cz-space-3); padding-bottom: 12px; }
  .cz-cardgrid__cell { display: grid; justify-items: center; width: 100%; min-width: 0; }

  /* ---------- GameMap and MiniMap ---------- */
  .cz-map, .cz-minimap {
    --cz-map-fog: color-mix(in srgb, var(--cz-surface-sunken) 70%, #9fb3c8);
    --cz-map-cloud: color-mix(in srgb, #fff 88%, var(--cz-surface));
    --cz-map-water: #8cc6dc;
    --cz-map-halo: color-mix(in srgb, var(--cz-surface-top) 92%, #fff);
  }
  .cz-map {
    position: relative; overflow: hidden; width: 100%; min-height: 260px;
    border: 3px solid var(--cz-outline); border-radius: var(--cz-radius-lg);
    background: var(--cz-map-water); box-shadow: 0 5px 0 var(--cz-outline), 0 12px 18px -8px var(--cz-contact);
    font-family: var(--cz-font-family); color: var(--cz-text); isolation: isolate;
  }
  .cz-map__viewport { position: absolute; inset: 0; overflow: hidden; cursor: grab; touch-action: none; outline: none; user-select: none; -webkit-user-select: none; }
  .cz-map__viewport[data-moving] { cursor: grabbing; }
  .cz-map__viewport[data-gestures="cooperative"] { touch-action: pan-x pan-y; }
  .cz-map__hint { position: absolute; z-index: 11; inset: 0; display: grid; place-items: center; padding: 16px; background: rgb(0 0 0 / 0.42); color: #fff; font-size: 18px; text-align: center; pointer-events: none; animation: cz-map-pop 160ms ease-out; }
  @keyframes cz-map-pop { from { opacity: 0; } }
  .cz-map__viewport:focus-visible { box-shadow: inset 0 0 0 3px var(--cz-ring); }
  .cz-map__world, .cz-minimap__world { position: absolute; left: 0; top: 0; transform-origin: 0 0; will-change: transform; }
  .cz-map__world { transition: transform 360ms var(--cz-motion-ease-out); }
  .cz-map__viewport[data-moving] .cz-map__world { transition: none; }
  .cz-map__bg, .cz-map__shapes { position: absolute; inset: 0; width: 100%; height: 100%; }
  .cz-map__bg > img, .cz-map__bg > svg { display: block; width: 100%; height: 100%; }
  .cz-map__bg > img { object-fit: cover; -webkit-user-drag: none; }
  .cz-map__shapes { overflow: visible; pointer-events: none; }
  .cz-map__region { fill: color-mix(in srgb, var(--rc) 10%, transparent); stroke: color-mix(in srgb, var(--rc) 55%, transparent); stroke-width: 2px; stroke-dasharray: 8 8; vector-effect: non-scaling-stroke; }
  .cz-map__path { fill: none; stroke: var(--pc); stroke-width: var(--pw); stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; filter: drop-shadow(0 1.5px 0 var(--cz-outline)); }
  .cz-map__path[data-dashed] { stroke-dasharray: 2 12; stroke-width: calc(var(--pw) + 2px); animation: cz-map-march 1.2s linear infinite; }
  @keyframes cz-map-march { to { stroke-dashoffset: -28; } }
  .cz-map__fog { stroke: var(--cz-map-cloud); stroke-width: 6px; vector-effect: non-scaling-stroke; filter: drop-shadow(0 3px 0 color-mix(in srgb, var(--cz-outline) 35%, transparent)); }
  /* region names: big text with a halo, no box (they give way to pins) */
  .cz-map__region-name {
    position: absolute; transform-origin: 0 0; transform: scale(calc(1 / var(--z))) rotate(var(--cr, 0deg)) translate(-50%, -50%);
    color: color-mix(in srgb, var(--cz-text) 78%, transparent); font-size: 17px; letter-spacing: 0.06em; white-space: nowrap; pointer-events: none;
    paint-order: stroke fill; -webkit-text-stroke: 4px var(--cz-map-halo); text-shadow: 0 1px 0 var(--cz-map-halo);
  }
  .cz-map__region-name[data-fog] { padding: 1px 12px; border: 2px dashed var(--cz-outline); border-radius: 99px; background: var(--cz-map-cloud); color: var(--cz-text-muted); -webkit-text-stroke: 0; letter-spacing: 0.02em; }
  /* pins: small teardrops; the label sits beside the pin */
  .cz-map__marker, .cz-map__cluster, .cz-map__waypoint {
    position: absolute; z-index: 1; margin: 0; padding: 0; border: 0; background: none; color: inherit; font: inherit;
    transform-origin: 0 0; -webkit-tap-highlight-color: transparent;
  }
  .cz-map__marker { display: block; width: 30px; height: 38px; transform: scale(calc(var(--ps, 1) / var(--z))) rotate(var(--cr, 0deg)) translate(-50%, -100%); cursor: pointer; }
  span.cz-map__marker { cursor: default; }
  .cz-map__marker:hover, .cz-map__marker:focus-visible { z-index: 4; }
  .cz-map__marker[data-selected] { z-index: 5; }
  .cz-map__pin {
    position: absolute; left: 1px; top: 1px; display: block; width: 28px; height: 28px;
    border: 2.5px solid var(--cz-outline); border-radius: 50% 50% 50% 4px; rotate: -45deg; transform-origin: 50% 50%;
    background: radial-gradient(circle at 35% 30%, #fff8 0 16%, transparent 44%), var(--kc);
    box-shadow: -1.5px 2.5px 0 var(--cz-outline);
    transition: scale var(--cz-motion-base) var(--cz-motion-ease-bounce), translate var(--cz-motion-base) var(--cz-motion-ease-bounce);
  }
  .cz-map__pin-icon { position: absolute; inset: 3px; display: grid; place-items: center; rotate: 45deg; }
  .cz-map__pin-icon > * { width: 100%; height: 100%; object-fit: contain; }
  .cz-map__alert { position: absolute; right: -5px; top: -5px; width: 12px; height: 12px; border: 2px solid var(--cz-outline); border-radius: 50%; background: var(--cz-danger); rotate: 45deg; }
  .cz-map__marker:hover .cz-map__pin, .cz-map__marker:focus-visible .cz-map__pin { translate: 0 -3px; }
  .cz-map__marker[data-selected] .cz-map__pin { scale: 1.35; translate: 0 -6px; box-shadow: -1.5px 2.5px 0 var(--cz-outline), 0 0 0 3px var(--cz-reward); }
  .cz-map__marker:focus-visible .cz-map__pin { outline: 3px solid var(--cz-ring); outline-offset: 2px; }
  .cz-map__label {
    position: absolute; top: 6px; padding: 0 3px; font-size: 13.5px; line-height: 20px; white-space: nowrap; pointer-events: none;
    color: color-mix(in srgb, var(--kc) 30%, var(--cz-text)); paint-order: stroke fill; -webkit-text-stroke: 3.5px var(--cz-map-halo);
  }
  .cz-map__label[data-side="right"] { left: calc(100% - 2px); }
  .cz-map__label[data-side="left"] { right: calc(100% - 2px); }
  .cz-map__label[data-hidden] { display: none; }
  .cz-map__marker:hover .cz-map__label[data-hidden], .cz-map__marker:focus-visible .cz-map__label[data-hidden] {
    display: block; padding: 0 8px; border: 2px solid var(--cz-outline); border-radius: 99px; background: var(--cz-surface-top); -webkit-text-stroke: 0; box-shadow: 0 2px 0 var(--cz-outline);
  }
  .cz-map__marker[data-selected] .cz-map__label { top: 0; font-size: 15px; }
  .cz-map__cluster {
    display: grid; place-items: center; min-width: 34px; height: 34px; padding: 0 8px;
    transform: scale(calc(var(--ps, 1) / var(--z))) rotate(var(--cr, 0deg)) translate(-50%, -50%);
    border: 2.5px solid var(--cz-outline); border-radius: 99px; background: var(--kc); color: var(--cz-text);
    box-shadow: 0 2.5px 0 var(--cz-outline), 0 0 0 4px color-mix(in srgb, var(--kc) 35%, transparent); font-size: 15px; font-variant-numeric: tabular-nums; cursor: pointer;
  }
  .cz-map__cluster .cz-map__alert { rotate: 0deg; right: -3px; top: -3px; }
  .cz-map__cluster:hover { z-index: 4; }
  .cz-map__cluster:focus-visible { outline: 3px solid var(--cz-ring); outline-offset: 2px; }
  .cz-map__waypoint { z-index: 3; width: 32px; height: 40px; transform: scale(calc(var(--ps, 1) / var(--z))) rotate(var(--cr, 0deg)) translate(-25%, -96%); pointer-events: none; }
  .cz-map__waypoint > svg { width: 100%; height: 100%; filter: drop-shadow(0 2px 0 rgb(0 0 0 / 0.2)); }
  .cz-map__player {
    position: absolute; z-index: 2; width: 34px; height: 34px; pointer-events: none;
    transform-origin: 0 0; transform: scale(calc(var(--ps, 1) / var(--z))) rotate(var(--heading)) translate(-50%, -50%);
  }
  .cz-map__player > svg, .cz-map__player-icon { position: absolute; inset: 0; width: 100%; height: 100%; filter: drop-shadow(0 2px 0 rgb(0 0 0 / 0.25)); }
  .cz-map__player-icon { display: grid; place-items: center; border: 3px solid var(--cz-outline); border-radius: 50%; background: var(--cz-reward); }
  .cz-map__player-icon > * { width: 76%; height: 76%; object-fit: contain; }
  .cz-map__player-ring { position: absolute; inset: -10px; border: 3px solid var(--cz-reward); border-radius: 50%; opacity: 0; animation: cz-map-ping 2s ease-out infinite; }
  @keyframes cz-map-ping { 0% { opacity: 0.9; scale: 0.4; } 100% { opacity: 0; scale: 1.4; } }

  /* top bar: search pill and filter chips */
  .cz-map__top { position: absolute; z-index: 10; left: 12px; right: 12px; top: 12px; display: flex; align-items: flex-start; gap: 8px; pointer-events: none; }
  .cz-map__top > * { pointer-events: auto; }
  .cz-map__search { position: relative; z-index: 2; flex: 0 0 min(320px, 100%); }
  .cz-map__search input {
    width: 100%; height: 46px; padding: 0 40px 0 42px; border: 2.5px solid var(--cz-outline); border-radius: 99px;
    background: var(--cz-surface-top); color: var(--cz-text); font: inherit; font-size: 15px; box-shadow: 0 3px 0 var(--cz-outline), 0 6px 12px -6px var(--cz-contact); outline: none;
  }
  .cz-map__search input::-webkit-search-cancel-button { display: none; }
  .cz-map__search input:focus-visible { box-shadow: 0 3px 0 var(--cz-outline), 0 0 0 3px var(--cz-ring); }
  .cz-map__search-icon { position: absolute; left: 14px; top: 50%; width: 20px; height: 20px; translate: 0 -50%; color: var(--cz-text-muted); pointer-events: none; }
  .cz-map__search-clear { position: absolute; right: 8px; top: 50%; width: 30px; height: 30px; translate: 0 -50%; border: 0; border-radius: 50%; background: none; color: var(--cz-text-muted); font: inherit; font-size: 22px; line-height: 1; cursor: pointer; }
  .cz-map__search-clear:hover { background: var(--cz-surface-sunken); }
  .cz-map__results { position: absolute; left: 0; right: 0; top: calc(100% + 6px); display: grid; margin: 0; padding: 6px; list-style: none; border: 2.5px solid var(--cz-outline); border-radius: 18px; background: var(--cz-surface-top); box-shadow: 0 3px 0 var(--cz-outline), 0 10px 18px -8px var(--cz-contact); }
  .cz-map__results [role="option"] { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 12px; cursor: pointer; }
  .cz-map__results [role="option"]:hover, .cz-map__results [data-active] { background: var(--cz-surface-sunken); }
  .cz-map__results-icon { display: grid; flex-shrink: 0; place-items: center; width: 30px; height: 30px; padding: 4px; border: 2px solid var(--cz-outline); border-radius: 50%; background: var(--kc); }
  .cz-map__results-icon > * { width: 100%; height: 100%; object-fit: contain; }
  .cz-map__results-text { display: grid; min-width: 0; line-height: 1.25; }
  .cz-map__results-text small { color: var(--cz-text-muted); font-size: 12.5px; }
  .cz-map__results-empty { padding: 8px; color: var(--cz-text-muted); }
  .cz-map__chips { display: flex; flex: 1 1 auto; gap: 6px; min-width: 0; padding: 4px 2px 6px; overflow-x: auto; scrollbar-width: none; mask-image: linear-gradient(90deg, #000 calc(100% - 24px), transparent); }
  .cz-map__chips::-webkit-scrollbar { display: none; }
  .cz-map__chip {
    display: inline-flex; flex-shrink: 0; align-items: center; gap: 6px; height: 36px; padding: 0 12px 0 5px; border: 2px solid var(--cz-outline); border-radius: 99px;
    background: var(--cz-surface-top); color: var(--cz-text); font: inherit; font-size: 14px; box-shadow: 0 2.5px 0 var(--cz-outline); cursor: pointer;
  }
  .cz-map__chip[aria-pressed="false"] { background: color-mix(in srgb, var(--cz-surface-top) 75%, transparent); color: var(--cz-text-muted); text-decoration: line-through; text-decoration-thickness: 2px; }
  .cz-map__chip[aria-pressed="false"] .cz-map__chip-icon { filter: grayscale(1); opacity: 0.5; }
  .cz-map__chip:focus-visible { outline: 3px solid var(--cz-ring); outline-offset: 2px; }
  .cz-map__chip-icon { display: grid; place-items: center; width: 26px; height: 26px; padding: 3px; border: 2px solid var(--cz-outline); border-radius: 50%; background: var(--kc); }
  .cz-map__chip-icon > * { width: 100%; height: 100%; object-fit: contain; }
  .cz-map[data-layout="narrow"] .cz-map__top { flex-direction: column; align-items: stretch; gap: 4px; }
  .cz-map[data-layout="narrow"] .cz-map__search { flex: none; }
  .cz-map[data-layout="narrow"] .cz-map__chip { height: 32px; font-size: 13px; }
  .cz-map[data-layout="narrow"] .cz-map__chip-icon { width: 22px; height: 22px; }

  /* place panel: side panel on wide maps, bottom sheet on narrow ones */
  .cz-map__panel {
    position: absolute; z-index: 9; display: flex; flex-direction: column; gap: 10px; overflow: auto; padding: 16px;
    border: 2.5px solid var(--cz-outline); background: var(--cz-surface-top); box-shadow: 0 4px 0 var(--cz-outline), 0 14px 24px -10px var(--cz-contact);
    overscroll-behavior: contain; cursor: auto; user-select: text; -webkit-user-select: text;
    transition: translate 260ms var(--cz-motion-ease-out);
  }
  .cz-map[data-layout="wide"] .cz-map__panel { left: 12px; top: 70px; bottom: 12px; width: min(340px, 45%); border-radius: 22px; animation: cz-map-panel-in 260ms var(--cz-motion-ease-out); }
  .cz-map[data-layout="wide"] .cz-map__top .cz-map__search { flex-basis: min(340px, 45%); }
  .cz-map[data-layout="narrow"] .cz-map__panel { left: -2.5px; right: -2.5px; bottom: -2.5px; max-height: min(50%, 230px); padding-top: 6px; border-radius: 22px 22px 0 0; animation: cz-map-sheet-in 280ms var(--cz-motion-ease-out); }
  @keyframes cz-map-panel-in { from { translate: -24px 0; opacity: 0; } }
  @keyframes cz-map-sheet-in { from { translate: 0 100%; } }
  .cz-map__handle { display: grid; place-items: center; flex-shrink: 0; height: 18px; margin: 0 -16px; cursor: grab; touch-action: none; }
  .cz-map__handle > span { width: 40px; height: 5px; border-radius: 99px; background: color-mix(in srgb, var(--cz-text-muted) 55%, transparent); }
  .cz-map__panel-close { position: absolute; right: 10px; top: 10px; z-index: 1; display: grid; place-items: center; width: 32px; height: 32px; border: 2px solid var(--cz-outline); border-radius: 50%; background: var(--cz-surface-top); color: var(--cz-text); font: inherit; font-size: 20px; line-height: 1; cursor: pointer; box-shadow: 0 2px 0 var(--cz-outline); }
  .cz-map[data-layout="narrow"] .cz-map__panel-close { top: 14px; }
  .cz-map__panel-close:focus-visible { outline: 3px solid var(--cz-ring); outline-offset: 2px; }
  .cz-map__panel-image { overflow: hidden; flex-shrink: 0; height: 140px; margin: -16px -16px 0; border-bottom: 2.5px solid var(--cz-outline); background: var(--cz-surface-sunken); }
  .cz-map__panel-image > img, .cz-map__panel-image > svg { display: block; width: 100%; height: 100%; object-fit: cover; }
  .cz-map__panel-head { display: flex; align-items: center; gap: 12px; padding-right: 36px; }
  .cz-map__panel-icon { display: grid; flex-shrink: 0; place-items: center; width: 46px; height: 46px; padding: 6px; border: 2.5px solid var(--cz-outline); border-radius: 14px; background: var(--kc); box-shadow: 0 2.5px 0 var(--cz-outline); }
  .cz-map__panel-icon > * { width: 100%; height: 100%; object-fit: contain; }
  .cz-map__panel-title { display: grid; min-width: 0; line-height: 1.2; }
  .cz-map__panel-title h3 { margin: 0; font-size: 20px; font-weight: inherit; }
  .cz-map__panel-title small { color: var(--cz-text-muted); font-size: 13.5px; }
  .cz-map__panel-sub { color: var(--cz-text-muted); font-size: 14px; }
  .cz-map__panel-actions { display: flex; flex-wrap: wrap; gap: 8px; }
  .cz-map__panel-desc { padding-top: 10px; border-top: 2px dashed color-mix(in srgb, var(--cz-outline) 25%, transparent); color: var(--cz-text); font-size: 14.5px; line-height: 1.45; }

  /* controls: "find me" and a zoom pill, bottom right */
  .cz-map__controls { position: absolute; z-index: 7; right: 12px; bottom: 12px; display: grid; justify-items: center; gap: 10px; transition: bottom 260ms var(--cz-motion-ease-out); }
  .cz-map__fab, .cz-map__zoom { border: 2.5px solid var(--cz-outline); background: var(--cz-surface-top); box-shadow: 0 3px 0 var(--cz-outline), 0 6px 12px -6px var(--cz-contact); }
  .cz-map__fab { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border-radius: 50%; color: var(--cz-info, var(--cz-text)); cursor: pointer; }
  .cz-map__fab > svg { width: 24px; height: 24px; }
  .cz-map__zoom { display: grid; overflow: hidden; border-radius: 14px; }
  .cz-map__zoom > button { display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 0; background: none; color: var(--cz-text); font: inherit; font-size: 22px; line-height: 1; cursor: pointer; }
  .cz-map__zoom > button + button { border-top: 2px solid color-mix(in srgb, var(--cz-outline) 25%, transparent); }
  .cz-map__fab:hover, .cz-map__zoom > button:hover:not(:disabled) { background: var(--cz-surface-sunken); }
  .cz-map__zoom > button:disabled { opacity: 0.4; cursor: not-allowed; }
  .cz-map__fab:active, .cz-map__zoom > button:active:not(:disabled) { translate: 0 1px; }
  .cz-map__fab:focus-visible, .cz-map__zoom > button:focus-visible { outline: 3px solid var(--cz-ring); outline-offset: -3px; }
  .cz-map__scale-wrap { position: absolute; z-index: 6; left: 14px; bottom: 12px; transition: bottom 260ms var(--cz-motion-ease-out), left 260ms var(--cz-motion-ease-out); pointer-events: none; }
  .cz-map__scale { display: grid; justify-items: start; gap: 2px; font-size: 12px; color: var(--cz-text); paint-order: stroke fill; -webkit-text-stroke: 3px var(--cz-map-halo); }
  .cz-map__scale-bar { height: 7px; border: 2px solid var(--cz-outline); border-top: 0; background: none; box-shadow: 0 1px 0 var(--cz-map-halo); }

  /* minimap */
  .cz-minimap { position: relative; flex-shrink: 0; width: var(--mm); height: var(--mm); font-family: var(--cz-font-family); color: var(--cz-text); }
  .cz-minimap__view {
    position: absolute; inset: 0; display: block; overflow: hidden; margin: 0; padding: 0; border: 4px solid var(--cz-outline); border-radius: 50%;
    background: var(--cz-map-water); box-shadow: 0 4px 0 var(--cz-outline), inset 0 0 0 3px color-mix(in srgb, #fff 55%, transparent), 0 10px 16px -6px var(--cz-contact);
    font: inherit; color: inherit; isolation: isolate;
  }
  .cz-minimap[data-shape="square"] .cz-minimap__view { border-radius: var(--cz-radius-lg); }
  button.cz-minimap__view { cursor: pointer; }
  button.cz-minimap__view:focus-visible { outline: 3px solid var(--cz-ring); outline-offset: 3px; }
  .cz-minimap__world { transition: transform 240ms linear; }
  .cz-minimap__north { position: absolute; inset: 0; rotate: var(--a); pointer-events: none; transition: rotate 240ms linear; }
  .cz-minimap__north > span { position: absolute; left: 50%; top: -8px; display: grid; place-items: center; width: 24px; height: 24px; translate: -50% 0; rotate: calc(var(--a) * -1); border: 2.5px solid var(--cz-outline); border-radius: 50%; background: var(--cz-danger); color: var(--cz-danger-text); font-size: 13px; line-height: 1; box-shadow: 0 2px 0 var(--cz-outline); }
  .cz-minimap__zoom { position: absolute; right: -6px; bottom: 2px; display: grid; gap: 4px; }
  .cz-minimap__zoom button {
    display: grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 2.5px solid var(--cz-outline); border-radius: 50%;
    background: var(--cz-surface-top); color: var(--cz-text); font: inherit; font-size: 18px; line-height: 1; box-shadow: 0 2.5px 0 var(--cz-outline); cursor: pointer;
  }
  .cz-minimap__zoom button:hover:not(:disabled) { background: var(--cz-surface-sunken); }
  .cz-minimap__zoom button:disabled { opacity: 0.5; cursor: not-allowed; }
  .cz-minimap__zoom button:focus-visible { outline: 3px solid var(--cz-ring); outline-offset: 2px; }
  .cz-minimap__region { position: absolute; z-index: 3; left: 50%; bottom: -10px; max-width: 110%; overflow: hidden; translate: -50% 0; padding: 1px 10px; border: 2.5px solid var(--cz-outline); border-radius: 99px; background: var(--cz-surface-top); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; box-shadow: 0 2px 0 var(--cz-outline); pointer-events: none; }
  .cz-minimap__arrow { position: absolute; z-index: 2; width: 24px; height: 24px; translate: -50% -50%; pointer-events: none; }
  .cz-minimap__arrow-tip { position: absolute; inset: 0; rotate: var(--a); }
  .cz-minimap__arrow-tip::before { content: ""; position: absolute; left: 50%; top: -8px; translate: -50% 0; border: 7px solid transparent; border-bottom: 9px solid var(--cz-outline); border-top: 0; }
  .cz-minimap__arrow-icon { position: absolute; inset: 0; display: grid; place-items: center; padding: 3px; border: 2.5px solid var(--cz-outline); border-radius: 50%; background: var(--kc); }
  .cz-minimap__arrow-icon > * { width: 100%; height: 100%; object-fit: contain; }

  /* ---------- Price tag (economy-core) ---------- */
  .cz-price { display: inline-flex; align-items: center; gap: 0.3em; font-size: 15px; font-variant-numeric: tabular-nums; line-height: 1; white-space: nowrap; }
  .cz-price[data-size="sm"] { font-size: 13px; }
  .cz-price[data-size="lg"] { font-size: 19px; }
  .cz-price__icon { display: inline-grid; place-items: center; width: 1.35em; height: 1.35em; flex-shrink: 0; }
  .cz-price__icon > * { width: 100%; height: 100%; object-fit: contain; }
  .cz-price__was { color: var(--cz-text-muted); font-size: 0.82em; text-decoration-thickness: 2px; }
  .cz-price[data-short] .cz-price__amount { color: var(--cz-danger-ink); }

  /* ---------- economy: CurrencyBar and PurchaseDialog ---------- */

  /* CurrencyBar */
  .cz-currency-bar { --cb-fs: 16px; display: flex; flex-wrap: wrap; gap: var(--cz-space-3); align-items: center; max-width: 100%; }
  .cz-currency-bar[data-size="sm"] { --cb-fs: 14px; gap: var(--cz-space-2); }
  .cz-currency-bar[data-size="lg"] { --cb-fs: 20px; gap: var(--cz-space-4); }
  .cz-currency-bar[data-orientation="vertical"] { flex-direction: column; flex-wrap: nowrap; align-items: stretch; width: max-content; }
  .cz-currency { position: relative; display: inline-flex; align-items: center; gap: 2px; min-width: 0; max-width: 100%; min-height: 2.75em; padding: 0 0.4em 0 0; font-size: var(--cb-fs); font-family: var(--cz-font-family); line-height: 1.2; color: var(--cz-text); border: var(--cz-border-thin) solid var(--cz-outline); border-radius: var(--cz-radius-full); background: var(--cz-surface-sunken); box-shadow: var(--cz-shadow-well), 0 3px 0 var(--cz-outline); margin-bottom: 3px; }
  .cz-currency-bar[data-size="sm"] .cz-currency { min-height: 2.5em; }
  .cz-currency__main { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: 0.45em; flex: 1; min-width: 0; min-height: inherit; padding: 0.25em 0.4em 0.25em 0.3em; border-radius: var(--cz-radius-full); color: inherit; font: inherit; }
  button.cz-currency__main { cursor: pointer; }
  button.cz-currency__main:hover { background: color-mix(in srgb, var(--cz-text) 7%, transparent); }
  button.cz-currency__main:active { background: color-mix(in srgb, var(--cz-text) 12%, transparent); }
  button.cz-currency__main:focus-visible, .cz-currency__add:focus-visible { outline: 3px solid var(--cz-ring); outline-offset: 2px; }
  .cz-currency__icon { display: inline-grid; place-items: center; flex-shrink: 0; width: 1.7em; height: 1.7em; }
  .cz-currency__icon > * { width: 100%; height: 100%; object-fit: contain; }
  .cz-currency__text { display: grid; gap: 0.2em; min-width: 3ch; }
  .cz-currency__line { display: inline-flex; align-items: baseline; gap: 0.3em; white-space: nowrap; font-variant-numeric: tabular-nums; }
  .cz-currency__value { font-weight: 800; }
  .cz-currency__max { font-size: 0.82em; color: var(--cz-text-muted); font-weight: 700; }
  .cz-currency__cap { display: block; height: 0.4em; min-width: 5em; border: 1.5px solid var(--cz-outline); border-radius: var(--cz-radius-full); background: var(--cz-surface); overflow: hidden; }
  .cz-currency__cap-fill { display: block; height: 100%; background: var(--cur, var(--cz-reward)); border-radius: inherit; }
  .cz-currency[data-full] .cz-currency__cap-fill { background: var(--cz-success-bright); }
  .cz-currency__add { all: unset; box-sizing: border-box; position: relative; display: inline-grid; place-items: center; flex-shrink: 0; width: 1.8em; height: 1.8em; margin-right: 0.15em; border: 2px solid var(--cz-outline); border-radius: 50%; background: var(--cz-success); color: var(--cz-success-text); box-shadow: 0 2px 0 var(--cz-outline); cursor: pointer; transition: translate var(--cz-motion-fast) var(--cz-motion-ease-bounce), box-shadow var(--cz-motion-fast) ease-out; }
  .cz-currency__add::after { content: ""; position: absolute; inset: calc((40px - 1.8em) / -2); min-width: 40px; min-height: 40px; }
  .cz-currency__add svg { width: 0.85em; height: 0.85em; }
  .cz-currency__add:hover { translate: 0 -1px; box-shadow: 0 3px 0 var(--cz-outline); }
  .cz-currency__add:active { translate: 0 2px; box-shadow: 0 0 0 var(--cz-outline); }
  .cz-currency__deltas { position: absolute; left: 50%; bottom: 100%; z-index: 2; display: grid; justify-items: center; pointer-events: none; }
  .cz-currency__delta { grid-area: 1 / 1; padding: 1px 0.55em; border: 2px solid var(--cz-outline); border-radius: var(--cz-radius-full); font-size: 0.85em; font-weight: 800; line-height: 1.3; font-variant-numeric: tabular-nums; white-space: nowrap; background: var(--cz-success); color: var(--cz-success-text); animation: cz-currency-rise 1.2s var(--cz-motion-ease-out) forwards; }
  .cz-currency__delta[data-sign="down"] { background: var(--cz-danger); color: var(--cz-danger-text); }
  .cz-currency[data-alert] { background: var(--cz-danger); color: var(--cz-danger-text); border-color: var(--cz-outline); box-shadow: var(--cz-shadow-bevel), 0 3px 0 var(--cz-outline); }
  .cz-currency[data-alert] .cz-currency__max { color: inherit; }
  .cz-currency[data-alert="0"] { animation: cz-currency-shake-a 0.55s ease-in-out; }
  .cz-currency[data-alert="1"] { animation: cz-currency-shake-b 0.55s ease-in-out; }
  @keyframes cz-currency-rise { 0% { opacity: 0; translate: 0 8px; scale: 0.8; } 15% { opacity: 1; translate: 0 -2px; scale: 1.05; } 25% { scale: 1; } 70% { opacity: 1; } 100% { opacity: 0; translate: 0 -26px; } }
  @keyframes cz-currency-shake-a { 0%, 100% { translate: 0; } 15% { translate: -6px; } 30% { translate: 6px; } 45% { translate: -5px; } 60% { translate: 4px; } 80% { translate: -2px; } }
  @keyframes cz-currency-shake-b { 0%, 100% { translate: 0; } 15% { translate: -6px; } 30% { translate: 6px; } 45% { translate: -5px; } 60% { translate: 4px; } 80% { translate: -2px; } }

  /* PurchaseDialog */
  .cz-purchase { gap: var(--cz-space-3); max-width: 420px; }
  .cz-purchase__head { display: grid; gap: var(--cz-space-1); padding-right: 48px; }
  .cz-purchase__item { display: flex; align-items: center; gap: var(--cz-space-3); padding: var(--cz-space-3); border: var(--cz-border-thick) solid color-mix(in srgb, var(--rarity, var(--cz-outline-soft)) 80%, var(--cz-outline)); border-radius: var(--cz-radius-lg); background: radial-gradient(circle at 18% 50%, color-mix(in srgb, var(--rarity, transparent) 22%, transparent), transparent 60%), var(--cz-surface); }
  .cz-purchase__icon, .cz-purchase__pop { display: grid; place-items: center; flex-shrink: 0; width: 64px; height: 64px; padding: 6px; border: var(--cz-border-thick) solid color-mix(in srgb, var(--rarity, var(--cz-outline-soft)) 80%, var(--cz-outline)); border-radius: var(--cz-radius-md); background: radial-gradient(circle at 50% 38%, color-mix(in srgb, var(--rarity, transparent) 22%, transparent), transparent 70%), var(--cz-surface-sunken); box-shadow: var(--cz-shadow-well); }
  .cz-purchase__icon > *, .cz-purchase__pop > * { width: 100%; height: 100%; object-fit: contain; }
  .cz-purchase__info { display: grid; gap: var(--cz-space-1); justify-items: start; min-width: 0; }
  .cz-purchase__name { font-size: var(--cz-font-size-lg); line-height: 1.25; overflow-wrap: anywhere; }
  .cz-purchase__units { margin-left: 0.5em; padding: 1px 0.5em; border: 2px solid var(--cz-outline); border-radius: var(--cz-radius-full); background: var(--cz-secondary); color: var(--cz-secondary-text); font-size: 0.7em; font-weight: 800; vertical-align: 0.15em; white-space: nowrap; }
  .cz-purchase__row { display: flex; align-items: center; justify-content: space-between; gap: var(--cz-space-3); flex-wrap: wrap; }
  .cz-purchase__row-label { font-weight: 700; }
  .cz-purchase__stepper { display: inline-flex; align-items: center; gap: var(--cz-space-3); }
  .cz-purchase__stepper .cz-button { margin-bottom: 0; }
  .cz-purchase__qty { min-width: 2.2ch; text-align: center; font-size: var(--cz-font-size-lg); font-weight: 800; font-variant-numeric: tabular-nums; }
  .cz-purchase__total { padding: var(--cz-space-2) var(--cz-space-3); border: var(--cz-border-thin) solid var(--cz-outline-soft); border-radius: var(--cz-radius-md); background: var(--cz-surface-sunken); box-shadow: var(--cz-shadow-well); }
  .cz-purchase__prices { display: inline-flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--cz-space-3); }
  .cz-purchase__free { font-size: 19px; font-weight: 800; color: var(--cz-text); }
  .cz-purchase__note { margin: 0; color: var(--cz-text-muted); font-size: var(--cz-font-size-sm); text-align: center; }
  .cz-purchase__balances { display: grid; gap: var(--cz-space-2); margin: 0; padding: 0; list-style: none; }
  .cz-purchase__balance { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--cz-space-1) var(--cz-space-3); font-size: var(--cz-font-size-sm); }
  .cz-purchase__cur { display: inline-flex; align-items: center; gap: var(--cz-space-2); font-weight: 700; }
  .cz-purchase__cur-icon { display: inline-grid; width: 22px; height: 22px; }
  .cz-purchase__cur-icon > * { width: 100%; height: 100%; object-fit: contain; }
  .cz-purchase__amounts { color: var(--cz-text-muted); font-variant-numeric: tabular-nums; }
  .cz-purchase__amounts b { color: var(--cz-text); }
  .cz-purchase__need { flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--cz-space-2) var(--cz-space-3); padding: var(--cz-space-2) var(--cz-space-3); border: var(--cz-border-thin) solid var(--cz-danger); border-radius: var(--cz-radius-md); background: color-mix(in srgb, var(--cz-danger) 14%, var(--cz-surface)); color: var(--cz-text); font-weight: 700; }
  .cz-purchase__need .cz-button { margin-bottom: 0; }
  .cz-purchase__error { margin: 0; padding: var(--cz-space-2) var(--cz-space-3); border: var(--cz-border-thin) solid var(--cz-danger); border-radius: var(--cz-radius-md); background: var(--cz-danger); color: var(--cz-danger-text); font-weight: 700; }
  .cz-purchase__live:empty { display: none; }
  .cz-purchase__success { display: grid; justify-items: center; gap: var(--cz-space-3); padding: var(--cz-space-3) 0; text-align: center; }
  .cz-purchase__pop { width: 96px; height: 96px; padding: 10px; animation: cz-purchase-pop 0.6s var(--cz-motion-ease-spring) both; }
  .cz-purchase__success-text { margin: 0; font-size: var(--cz-font-size-lg); font-weight: 800; overflow-wrap: anywhere; }
  .cz-purchase__actions { display: flex; flex-direction: column-reverse; gap: var(--cz-space-3); }
  .cz-purchase__actions .cz-button { flex: 1; }
  @media (min-width: 420px) { .cz-purchase__actions { flex-direction: row; } }
  @keyframes cz-purchase-pop { 0% { scale: 0.3; rotate: -10deg; opacity: 0; } 60% { scale: 1.15; rotate: 4deg; opacity: 1; } 100% { scale: 1; rotate: 0deg; } }

  @media (prefers-reduced-motion: reduce) {
    .cz-currency[data-alert] { animation: none; }
    .cz-currency__delta { animation: none; opacity: 1; }
    .cz-purchase__pop { animation: none; }
    .cz-currency__add { transition: none; }
  }

  /* ---------- shop ---------- */
  .cz-shop { container: cz-shop / inline-size; display: grid; gap: var(--cz-space-3); width: 100%; min-width: 0; }
  .cz-shop__head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--cz-space-2) var(--cz-space-4); }
  .cz-shop__title { color: var(--cz-text); font-size: var(--cz-font-size-lg); line-height: 1.2; }
  .cz-shop__refresh, .cz-shop__deal { display: inline-flex; align-items: center; gap: 5px; font-size: var(--cz-font-size-sm); font-variant-numeric: tabular-nums; }
  .cz-shop__refresh { padding: 4px 12px; border: var(--cz-border-thin) solid var(--cz-outline); border-radius: var(--cz-radius-full); background: var(--cz-surface-sunken); color: var(--cz-text); }
  .cz-shop__head-end { margin-left: auto; min-width: 0; }
  .cz-shop__tabs { display: flex; flex-wrap: wrap; gap: 4px; justify-self: start; max-width: 100%; padding: 4px; border-radius: var(--cz-radius-md); background: var(--cz-surface-sunken); box-shadow: var(--cz-shadow-well); }
  .cz-shop__tab {
    display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px;
    border: var(--cz-border-thin) solid transparent; border-radius: var(--cz-radius-sm); background: transparent;
    color: var(--cz-text-muted); font: inherit; font-size: var(--cz-font-size-sm); cursor: pointer;
    transition: color var(--cz-motion-fast), translate var(--cz-motion-fast) var(--cz-motion-ease-out);
  }
  .cz-shop__tab:hover { color: var(--cz-text); }
  .cz-shop__tab[aria-selected="true"] { border-color: var(--cz-outline); background: var(--cz-shadow-plastic), var(--cz-surface); color: var(--cz-text); box-shadow: 0 2px 0 var(--cz-outline); }
  .cz-shop__tab:focus-visible { outline: 3px solid var(--cz-ring); outline-offset: 2px; }
  .cz-shop__tab-icon { display: grid; width: 20px; height: 20px; }
  .cz-shop__tab-icon > * { width: 100%; height: 100%; object-fit: contain; }

  .cz-shop__panel { display: grid; gap: 18px; padding-top: 12px; }
  .cz-shop__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(var(--card, 168px), 100%), 1fr)); gap: 18px 12px; }
  .cz-shop__grid[data-fixed] { grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); }
  @container cz-shop (max-width: 479px) {
    .cz-shop__grid[data-fixed] { grid-template-columns: repeat(auto-fill, minmax(min(var(--card, 168px), 100%), 1fr)); }
  }
  .cz-shop__featured { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); gap: 18px 12px; }
  .cz-shop__cell { display: flex; min-width: 0; }
  .cz-shop__empty { padding: var(--cz-space-6) var(--cz-space-4); color: var(--cz-text-muted); text-align: center; }

  /* card */
  .cz-shop__item {
    position: relative; display: flex; flex-direction: column; width: 100%; margin-bottom: 4px;
    border: var(--cz-border-thick) solid color-mix(in srgb, var(--rarity, var(--cz-outline)) 65%, var(--cz-outline)); border-radius: var(--cz-radius-lg);
    background: linear-gradient(180deg, color-mix(in srgb, var(--rarity, var(--cz-surface-top)) 16%, var(--cz-surface-top)), var(--cz-surface) 70%);
    color: var(--cz-text);
    box-shadow: inset 0 3px 0 rgb(255 255 255 / 0.4), 0 4px 0 var(--cz-outline);
    transition: translate var(--cz-motion-fast) var(--cz-motion-ease-out), box-shadow var(--cz-motion-fast);
  }
  .cz-shop__item:hover { translate: 0 -2px; }
  .cz-shop__item:has(.cz-shop__body:focus-visible) { outline: 3px solid var(--cz-ring); outline-offset: 3px; }
  .cz-shop__body {
    position: relative; display: flex; flex: 1; flex-direction: column; align-items: center; gap: 6px; width: 100%; min-width: 0;
    padding: var(--cz-space-3) var(--cz-space-2) var(--cz-space-1); border: 0; border-radius: calc(var(--cz-radius-lg) - 3px) calc(var(--cz-radius-lg) - 3px) 0 0; background: transparent;
    color: inherit; font: inherit; text-align: center; cursor: pointer;
  }
  .cz-shop__body:focus-visible { outline: none; }
  .cz-shop__item[data-has-tag] .cz-shop__body { padding-top: var(--cz-space-4); }
  .cz-shop__art { display: grid; place-items: center; width: 62%; max-width: 120px; aspect-ratio: 1; transition: scale var(--cz-motion-base) var(--cz-motion-ease-bounce); }
  .cz-shop__art > * { width: 100%; height: 100%; object-fit: contain; }
  .cz-shop__item:hover .cz-shop__art { scale: 1.06; }
  .cz-shop__text { display: grid; justify-items: center; align-content: start; gap: 4px; width: 100%; min-width: 0; }
  .cz-shop__name { font-size: var(--cz-font-size-sm); line-height: 1.25; overflow-wrap: anywhere; }
  .cz-shop__desc {
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden;
    color: var(--cz-text-muted); font-size: var(--cz-font-size-xs); line-height: 1.35;
  }
  .cz-shop__rarity { font-size: 11px; }
  .cz-shop__meta { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 6px; font-size: var(--cz-font-size-xs); }
  .cz-shop__stock { color: var(--cz-danger-ink); }
  .cz-shop__limit { color: var(--cz-text-muted); }
  .cz-shop__deal { padding: 1px 8px; border: var(--cz-border-thin) solid var(--cz-outline); border-radius: var(--cz-radius-full); background: var(--cz-info); color: var(--cz-info-text); font-size: var(--cz-font-size-xs); }

  /* corners and ribbons */
  .cz-shop__badge, .cz-shop__discount, .cz-shop__bonus, .cz-shop__ribbon {
    border: var(--cz-border-thin) solid var(--cz-outline); font-size: 11px; line-height: 1.3; white-space: nowrap; pointer-events: none;
  }
  .cz-shop__badge { position: absolute; left: 6px; top: 6px; padding: 1px 8px; border-radius: var(--cz-radius-full); background: var(--cz-primary); color: var(--cz-primary-text); }
  .cz-shop__flags { position: absolute; right: 6px; top: 6px; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; pointer-events: none; }
  .cz-shop__discount { padding: 1px 8px; border-radius: var(--cz-radius-full); background: var(--cz-danger); color: var(--cz-danger-text); font-size: 12px; rotate: 4deg; }
  .cz-shop__bonus { padding: 1px 8px; border-radius: var(--cz-radius-full); background: var(--cz-success); color: var(--cz-success-text); rotate: 4deg; }
  .cz-shop__ribbon {
    position: absolute; left: 50%; top: -13px; translate: -50% 0; max-width: calc(100% - 16px); overflow: hidden; text-overflow: ellipsis;
    padding: 2px 14px; border-radius: var(--cz-radius-sm); background: var(--cz-reward); color: var(--cz-reward-text); font-size: 12px; box-shadow: 0 2px 0 var(--cz-outline);
  }

  .cz-shop__item[data-has-tag] .cz-shop__flags { top: 16px; }
  .cz-shop__was { font-size: 0.82em; opacity: 0.8; text-decoration-thickness: 2px; }

  /* footer: price and buy */
  .cz-shop__foot { display: grid; justify-items: center; gap: 6px; padding: var(--cz-space-1) var(--cz-space-2) var(--cz-space-2); }
  .cz-shop__price { display: inline-flex; flex-wrap: wrap; justify-content: center; gap: 4px 10px; }
  .cz-shop__buy { width: 100%; margin-bottom: 0; min-height: 40px; }
  .cz-shop__state {
    display: inline-flex; align-items: center; justify-content: center; gap: 5px; width: 100%; min-height: 40px; padding: 0 var(--cz-space-3);
    border: var(--cz-border-thin) dashed color-mix(in srgb, var(--cz-text-muted) 70%, var(--cz-surface)); border-radius: var(--cz-radius-sm); background: var(--cz-surface-sunken);
    color: var(--cz-text-muted); font-size: var(--cz-font-size-sm);
  }
  .cz-shop__state[data-state="owned"] { border-style: solid; border-color: var(--cz-success); color: var(--cz-text); }
  .cz-shop__state[data-state="owned"] svg { color: var(--cz-success); }

  /* states */
  .cz-shop__item[data-sold-out], .cz-shop__item[data-disabled] { background: var(--cz-surface-sunken); }
  .cz-shop__item[data-sold-out] .cz-shop__art, .cz-shop__item[data-disabled] .cz-shop__art { filter: grayscale(0.85); opacity: 0.55; }
  .cz-shop__item[data-owned] .cz-shop__art { filter: saturate(0.8); }
  .cz-shop__item[data-sold-out]:hover, .cz-shop__item[data-disabled]:hover { translate: 0 0; }
  .cz-shop__item[data-sold-out]:hover .cz-shop__art, .cz-shop__item[data-disabled]:hover .cz-shop__art { scale: 1; }

  /* packs: big amount, price on the button */
  .cz-shop__item[data-kind="pack"] .cz-shop__art { width: 70%; max-width: 132px; }
  .cz-shop__amount { color: var(--cz-text); font-size: var(--cz-font-size-xl); line-height: 1; font-variant-numeric: tabular-nums; }
  .cz-shop__item[data-kind="pack"] .cz-shop__name { color: var(--cz-text-muted); font-size: var(--cz-font-size-xs); }

  /* featured: wide card, art beside the text, price and button in one row */
  .cz-shop__item[data-featured] .cz-shop__body { flex-direction: row; justify-content: flex-start; gap: var(--cz-space-4); padding: var(--cz-space-4) var(--cz-space-4) var(--cz-space-2); text-align: left; }
  .cz-shop__item[data-featured][data-has-tag] .cz-shop__body { padding-top: var(--cz-space-5); }
  .cz-shop__item[data-featured] .cz-shop__art { flex: none; width: 34%; max-width: 128px; min-width: 76px; }
  .cz-shop__item[data-featured] .cz-shop__text { justify-items: start; flex: 1; }
  .cz-shop__item[data-featured] .cz-shop__name { font-size: var(--cz-font-size-md); }
  .cz-shop__item[data-featured] .cz-shop__desc { -webkit-line-clamp: 3; line-clamp: 3; font-size: var(--cz-font-size-sm); }
  .cz-shop__item[data-featured] .cz-shop__meta { justify-content: flex-start; }
  .cz-shop__item[data-featured] .cz-shop__foot { grid-auto-flow: column; grid-template-columns: auto minmax(0, 1fr); justify-items: stretch; align-items: center; gap: var(--cz-space-3); padding: var(--cz-space-1) var(--cz-space-4) var(--cz-space-3); }
  .cz-shop__item[data-featured] .cz-shop__price { justify-content: flex-start; }
  .cz-shop__item[data-featured] .cz-shop__foot > :only-child { grid-column: 1 / -1; }
  .cz-shop__item[data-featured] .cz-shop__flags { right: 8px; }
  .cz-shop__item[data-featured] .cz-shop__badge { left: 8px; }

  @media (prefers-reduced-motion: reduce) {
    .cz-shop__item, .cz-shop__art, .cz-shop__tab { transition-duration: 1ms !important; }
    .cz-shop__item:hover { translate: 0 0; }
    .cz-shop__item:hover .cz-shop__art { scale: 1; }
  }

  /* ---------- perks: perk picker and buff bar ---------- */
  .cz-perks { container: cz-perks / inline-size; display: grid; gap: 16px; width: 100%; color: var(--cz-text); }
  .cz-perks__head { display: grid; gap: 4px; text-align: center; }
  .cz-perks__title { margin: 0; font-size: 1.5rem; line-height: 1.15; }
  .cz-perks__subtitle, .cz-perks__empty { margin: 0; color: var(--cz-text-muted); }
  .cz-perks__empty { padding: 24px 0; text-align: center; }
  .cz-perks__cards { display: grid; gap: 12px; padding: 10px 10px 8px; }

  .cz-perks__card {
    --edge: var(--rarity, var(--cz-outline-soft));
    position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 12px;
    min-height: 56px; padding: 12px 14px;
    border: var(--cz-border-thick) solid color-mix(in srgb, var(--edge) 80%, var(--cz-outline));
    border-radius: var(--cz-radius-lg);
    background: linear-gradient(180deg, color-mix(in srgb, var(--rarity, var(--cz-surface)) 16%, var(--cz-surface)), var(--cz-surface) 60%);
    box-shadow: 0 4px 0 var(--cz-outline);
    color: var(--cz-text); cursor: pointer; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
    transition: translate var(--cz-motion-fast) var(--cz-motion-ease-bounce), box-shadow var(--cz-motion-fast) ease-out;
    animation: cz-perk-pop 440ms var(--cz-motion-ease-bounce) both;
    animation-delay: calc(var(--i, 0) * 90ms);
  }
  .cz-perks__card:hover:not([data-locked]) { translate: 0 -3px; box-shadow: 0 7px 0 var(--cz-outline); }
  .cz-perks__card:active:not([data-locked]) { translate: 0 2px; box-shadow: 0 2px 0 var(--cz-outline); }
  .cz-perks__card:focus-visible { outline: 3px solid var(--cz-ring); outline-offset: 3px; }
  .cz-perks__card[data-selected] { translate: 0 -6px; box-shadow: 0 0 0 4px var(--cz-reward), 0 10px 0 var(--cz-outline), 0 0 18px color-mix(in srgb, var(--cz-reward) 55%, transparent); }
  .cz-perks__card[data-locked] { cursor: not-allowed; background: var(--cz-surface-sunken); box-shadow: none; }
  .cz-perks__card[data-locked] :is(.cz-perks__icon, .cz-perks__meta, .cz-perks__stats, .cz-perks__tags) { opacity: 0.6; }
  .cz-perks__card[data-locked] .cz-perks__icon { filter: grayscale(0.7); }

  .cz-perks__check {
    position: absolute; top: -11px; right: -11px; z-index: 1; display: grid; place-items: center; width: 28px; height: 28px;
    border: 2.5px solid var(--cz-outline); border-radius: 50%; background: var(--cz-reward); color: var(--cz-reward-text); box-shadow: 0 2px 0 var(--cz-outline);
    scale: 0; transition: scale var(--cz-motion-base) var(--cz-motion-ease-bounce);
  }
  .cz-perks__check svg { width: 16px; height: 16px; }
  .cz-perks__card[data-selected] .cz-perks__check { scale: 1; }

  .cz-perks__icon {
    display: grid; place-items: center; width: 64px; height: 64px; padding: 8px;
    border: var(--cz-border-thin) solid var(--cz-outline); border-radius: var(--cz-radius-md);
    background: radial-gradient(circle at 50% 38%, color-mix(in srgb, var(--rarity, transparent) 28%, transparent), transparent 72%), var(--cz-surface-sunken);
    box-shadow: var(--cz-shadow-well);
  }
  .cz-perks__icon > svg, .cz-perks__icon > img { width: 100%; height: 100%; object-fit: contain; }
  .cz-perks__card:not(:has(.cz-perks__icon)) { grid-template-columns: minmax(0, 1fr); }

  .cz-perks__body { display: grid; gap: 4px; min-width: 0; align-content: center; }
  .cz-perks__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
  .cz-perks__level {
    padding: 1px 8px; border: var(--cz-border-thin) solid var(--cz-outline); border-radius: 99px;
    background: var(--cz-surface-sunken); color: var(--cz-text); font-size: 0.75rem; font-weight: 700; line-height: 1.4; font-variant-numeric: tabular-nums;
  }
  .cz-perks__level[data-new] { background: var(--cz-success); color: var(--cz-success-text); }
  .cz-perks__name { font-size: 1.1rem; font-weight: 800; line-height: 1.2; overflow-wrap: anywhere; }
  .cz-perks__desc { color: var(--cz-text-muted); font-size: 0.9rem; line-height: 1.35; }
  .cz-perks__stats { display: grid; gap: 2px; margin-top: 2px; font-size: 0.85rem; }
  .cz-perks__stat { display: flex; justify-content: space-between; gap: 8px; }
  .cz-perks__stat > span { color: var(--cz-text-muted); }
  .cz-perks__stat > b { font-variant-numeric: tabular-nums; }
  .cz-perks__tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
  .cz-perks__tag { padding: 0 8px; border: var(--cz-border-thin) solid var(--cz-outline-soft); border-radius: 99px; color: var(--cz-text-muted); font-size: 0.72rem; line-height: 1.6; }
  .cz-perks__lock { color: var(--cz-text); font-size: 0.85rem; font-weight: 700; }

  .cz-perks__foot { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 10px; }
  .cz-perks__foot .cz-perks__confirm { order: 3; }
  .cz-perks__foot .cz-perks__skip { order: 1; }

  @container cz-perks (max-width: 559px) {
    .cz-perks__foot .cz-perks__confirm { order: 0; flex: 1 1 100%; }
    .cz-perks__foot .cz-perks__reroll { order: 1; }
    .cz-perks__foot .cz-perks__skip { order: 2; }
    .cz-perks__foot .cz-perks__skip, .cz-perks__foot .cz-perks__reroll { flex: 1 1 0; }
  }

  /* Wide container: a row of tall cards (always when variant="cards"). */
  @container cz-perks (min-width: 560px) {
    .cz-perks:not([data-variant="list"]) .cz-perks__cards { grid-template-columns: repeat(var(--n, 3), minmax(0, 240px)); justify-content: center; gap: 16px; }
    .cz-perks:not([data-variant="list"]) .cz-perks__card { grid-template-columns: minmax(0, 1fr); justify-items: center; align-content: start; gap: 12px; padding: 18px 14px 16px; text-align: center; }
    .cz-perks:not([data-variant="list"]) .cz-perks__icon { width: 84px; height: 84px; padding: 10px; }
    .cz-perks:not([data-variant="list"]) .cz-perks__body { width: 100%; justify-items: center; }
    .cz-perks:not([data-variant="list"]) .cz-perks__meta, .cz-perks:not([data-variant="list"]) .cz-perks__tags { justify-content: center; }
    .cz-perks:not([data-variant="list"]) .cz-perks__stat { justify-content: center; gap: 6px; }
  }
  @container cz-perks (min-width: 560px) and (max-width: 719px) {
    .cz-perks:not([data-variant="list"]) .cz-perks__cards[data-count="4"] { grid-template-columns: repeat(2, minmax(0, 240px)); }
  }
  .cz-perks[data-variant="cards"] .cz-perks__cards { grid-template-columns: repeat(auto-fit, minmax(150px, 240px)); justify-content: center; gap: 16px; }
  .cz-perks[data-variant="cards"] .cz-perks__card { grid-template-columns: minmax(0, 1fr); justify-items: center; align-content: start; gap: 12px; padding: 18px 14px 16px; text-align: center; }
  .cz-perks[data-variant="cards"] .cz-perks__icon { width: 84px; height: 84px; padding: 10px; }
  .cz-perks[data-variant="cards"] .cz-perks__body { width: 100%; justify-items: center; }
  .cz-perks[data-variant="cards"] .cz-perks__meta, .cz-perks[data-variant="cards"] .cz-perks__tags { justify-content: center; }
  .cz-perks[data-variant="cards"] .cz-perks__stat { justify-content: center; gap: 6px; }

  @keyframes cz-perk-pop {
    0% { opacity: 0; transform: translateY(18px) scale(0.82); }
    100% { opacity: 1; transform: none; }
  }

  /* ---------- buff bar ---------- */
  .cz-buffs { --buff: 52px; display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px 8px; padding-bottom: 8px; }
  .cz-buffs[data-size="sm"] { --buff: 40px; }
  .cz-buffs[data-size="lg"] { --buff: 64px; }
  .cz-buffs[data-orientation="vertical"] { flex-direction: column; flex-wrap: nowrap; width: max-content; }
  .cz-buffs__empty { color: var(--cz-text-muted); font-size: 0.9rem; }
  .cz-buffs__slot { display: flex; }

  .cz-buffs__buff {
    --tone: var(--cz-success);
    position: relative; display: grid; place-items: center; flex-shrink: 0; width: var(--buff); height: var(--buff); padding: 0;
    border: var(--cz-border-thin) solid var(--cz-outline); border-radius: 50%;
    background: var(--cz-surface-top); color: var(--cz-text); font: inherit; box-shadow: 0 3px 0 var(--cz-outline);
    cursor: default; -webkit-tap-highlight-color: transparent;
    transition: translate var(--cz-motion-fast) var(--cz-motion-ease-bounce), box-shadow var(--cz-motion-fast) ease-out;
  }
  button.cz-buffs__buff { cursor: pointer; }
  button.cz-buffs__buff:hover { translate: 0 -2px; box-shadow: 0 5px 0 var(--cz-outline); }
  button.cz-buffs__buff:active { translate: 0 2px; box-shadow: 0 1px 0 var(--cz-outline); }
  .cz-buffs__buff:focus-visible { outline: 3px solid var(--cz-ring); outline-offset: 3px; }
  .cz-buffs__buff[data-kind="debuff"] { --tone: var(--cz-danger); background: color-mix(in srgb, var(--cz-danger) 18%, var(--cz-surface-top)); }

  .cz-buffs__ring { position: absolute; inset: 0; width: 100%; height: 100%; rotate: -90deg; pointer-events: none; overflow: visible; }
  .cz-buffs__ring circle { fill: none; stroke-width: 4.5; }
  .cz-buffs__track { stroke: color-mix(in srgb, var(--cz-text) 14%, transparent); }
  .cz-buffs__arc { stroke: var(--tone); stroke-linecap: round; transition: stroke-dashoffset 500ms linear; }
  .cz-buffs__buff[data-permanent] .cz-buffs__arc { stroke-dasharray: 3 4.5; }
  .cz-buffs__buff[data-urgent] { animation: cz-buff-blink 1s ease-in-out infinite; }

  .cz-buffs__icon { display: grid; place-items: center; width: 64%; height: 64%; }
  .cz-buffs__icon > svg, .cz-buffs__icon > img { width: 100%; height: 100%; object-fit: contain; }
  .cz-buffs__letter { font-weight: 800; font-size: calc(var(--buff) * 0.36); line-height: 1; }

  .cz-buffs__time {
    position: absolute; left: 50%; bottom: -9px; translate: -50% 0; min-width: 2.4em; padding: 0 5px;
    border: 2px solid var(--cz-outline); border-radius: 99px; background: var(--cz-surface); color: var(--cz-text);
    font-size: 0.68rem; font-weight: 800; line-height: 1.35; text-align: center; white-space: nowrap; font-variant-numeric: tabular-nums;
  }
  .cz-buffs__stacks {
    position: absolute; right: -6px; top: -6px; min-width: 1.6em; padding: 0 4px;
    border: 2px solid var(--cz-outline); border-radius: 99px; background: var(--cz-reward); color: var(--cz-reward-text);
    font-size: 0.68rem; font-weight: 800; line-height: 1.35; text-align: center; font-variant-numeric: tabular-nums;
  }
  .cz-buffs__mark {
    position: absolute; left: -5px; top: -5px; display: grid; place-items: center; width: 16px; height: 16px;
    border: 2px solid var(--cz-outline); border-radius: 50%; background: var(--cz-danger); color: var(--cz-danger-text); font-size: 0.8rem; font-weight: 900; line-height: 1;
  }
  .cz-buffs__chip { background: var(--cz-surface-sunken); font-weight: 800; font-size: 0.85rem; cursor: pointer; font-variant-numeric: tabular-nums; }

  .cz-buffs__tip { max-width: min(280px, calc(100vw - 24px)); }
  .cz-buffs__tipbody { display: grid; gap: 3px; font-size: 0.85rem; line-height: 1.35; }
  .cz-buffs__tiphead { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; }
  .cz-buffs__tiphead em { font-style: normal; font-size: 0.72rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; opacity: 0.85; }
  .cz-buffs__tipmeta { opacity: 0.85; font-size: 0.8rem; font-variant-numeric: tabular-nums; }
  .cz-buffs__more { display: grid; gap: 4px; min-width: 150px; font-size: 0.85rem; }
  .cz-buffs__row { display: flex; align-items: center; gap: 8px; }
  .cz-buffs__rowicon { display: grid; place-items: center; flex-shrink: 0; width: 22px; height: 22px; font-weight: 800; }
  .cz-buffs__rowicon > svg, .cz-buffs__rowicon > img { width: 100%; height: 100%; object-fit: contain; }
  .cz-buffs__rowname { flex: 1; min-width: 0; }
  .cz-buffs__rowtime { font-variant-numeric: tabular-nums; opacity: 0.85; }
  .cz-buffs__row[data-kind="debuff"] .cz-buffs__rowname::before { content: "− "; font-weight: 900; }

  @keyframes cz-buff-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }

  @media (prefers-reduced-motion: reduce) {
    .cz-perks__card { animation: none; transition: none; }
    .cz-perks__check { transition: none; }
    .cz-buffs__buff { transition: none; }
    .cz-buffs__buff[data-urgent] { animation: none; }
    .cz-buffs__arc { transition: none; }
  }

  /* ---------- skill-tree ---------- */
  .cz-skill { display: grid; gap: 12px; width: 100%; min-width: 0; color: var(--cz-text); }
  .cz-skill__sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }

  /* header: points, legend, reset */
  .cz-skill__bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
  .cz-skill__points {
    display: inline-flex; align-items: baseline; gap: 8px; padding: 5px 14px; border: 2.5px solid var(--cz-outline); border-radius: 99px;
    background: var(--cz-reward); color: var(--cz-reward-text); box-shadow: 0 3px 0 var(--cz-outline); font-size: 14px; font-weight: 700;
  }
  .cz-skill__points strong { font-size: 22px; line-height: 1; font-variant-numeric: tabular-nums; }
  .cz-skill__points[data-empty] { background: var(--cz-surface-sunken); color: var(--cz-text); }
  .cz-skill .cz-skill__legend { display: flex; flex: 1 1 auto; flex-wrap: wrap; gap: 6px 8px; margin: 0; padding: 0; list-style: none; }
  .cz-skill .cz-skill__legend li { margin: 0; display: inline-flex; align-items: center; gap: 7px; padding: 3px 11px 3px 6px; border: 2px solid var(--cz-outline); border-radius: 99px; background: var(--cz-surface-top); color: var(--cz-text); font-size: 13.5px; font-weight: 700; }
  .cz-skill__dot { display: grid; place-items: center; flex-shrink: 0; width: 18px; height: 18px; border: 2px solid var(--cz-outline); border-radius: 50%; background: var(--sk); }
  .cz-skill__dot > svg, .cz-skill__dot > img { width: 100%; height: 100%; }
  .cz-skill__reset { margin-left: auto; }

  /* layout: stage (the box) next to a side panel, or the stage alone with a bottom sheet */
  .cz-skill__body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .cz-skill[data-layout="wide"] .cz-skill__body { grid-template-columns: minmax(0, 1fr) minmax(240px, 300px); }
  .cz-skill__stage {
    position: relative; min-width: 0; height: var(--sk-h); overflow: hidden; border: 3px solid var(--cz-outline); border-radius: var(--cz-radius-lg);
    background: var(--cz-surface-sunken); box-shadow: 0 4px 0 var(--cz-outline), 0 12px 18px -10px var(--cz-contact);
  }
  .cz-skill__viewport {
    position: absolute; inset: 0; overflow: hidden; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
    background-image: radial-gradient(circle, color-mix(in srgb, var(--cz-outline) 20%, transparent) 1.5px, transparent 2px); background-size: 22px 22px;
  }
  .cz-skill__viewport[data-pannable] { cursor: grab; }
  .cz-skill__viewport[data-dragging] { cursor: grabbing; }
  .cz-skill__empty { margin: 0; padding: 24px; color: var(--cz-text-muted); text-align: center; }
  .cz-skill__world { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
  .cz-skill__viewport[data-dragging] .cz-skill__node { pointer-events: none; }

  /* lines */
  .cz-skill__edges { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }
  .cz-skill__edge-walls line { stroke: color-mix(in srgb, var(--cz-outline) 65%, transparent); stroke-width: 11; stroke-linecap: round; }
  .cz-skill__edge { stroke: color-mix(in srgb, var(--cz-text-muted) 35%, var(--cz-surface-sunken)); stroke-width: 6; stroke-linecap: round; }
  .cz-skill__edge[data-any] { stroke-dasharray: 1 12; stroke-width: 7; }
  .cz-skill__edge[data-on] { stroke: var(--sk); stroke-dasharray: none; stroke-width: 6; }

  /* nodes */
  .cz-skill__node {
    position: absolute; width: var(--sz); height: var(--sz); translate: -50% -50%; padding: 0; border: 0; background: none; color: var(--cz-text);
    font: inherit; cursor: pointer; outline: none; -webkit-tap-highlight-color: transparent;
  }
  .cz-skill__node::after { content: ""; position: absolute; inset: -4px; }
  .cz-skill__face {
    position: absolute; inset: 0; display: grid; place-items: center; border: 3px solid var(--cz-outline); border-radius: 50%;
    background: color-mix(in srgb, var(--cz-text-muted) 16%, var(--cz-surface)); color: var(--cz-text-muted);
    box-shadow: 0 3px 0 var(--cz-outline); transition: translate var(--cz-motion-fast) var(--cz-motion-ease-out), background var(--cz-motion-base) var(--cz-motion-ease-out), box-shadow var(--cz-motion-base) var(--cz-motion-ease-out);
  }
  .cz-skill__node[data-kind="notable"] .cz-skill__face { border-radius: 28%; }
  .cz-skill__node[data-kind="keystone"] .cz-skill__face { inset: 14.65%; border-radius: 22%; rotate: 45deg; }
  .cz-skill__icon { display: grid; place-items: center; width: 64%; height: 64%; pointer-events: none; }
  .cz-skill__icon > svg, .cz-skill__icon > img { width: 100%; height: 100%; object-fit: contain; -webkit-user-drag: none; }
  .cz-skill__node[data-kind="keystone"] .cz-skill__icon { rotate: -45deg; width: 78%; height: 78%; }
  .cz-skill__node:hover .cz-skill__face { translate: 0 -2px; }
  .cz-skill__node:active .cz-skill__face { translate: 0 1px; box-shadow: 0 1px 0 var(--cz-outline); }

  .cz-skill__node[data-state="locked"] .cz-skill__icon { opacity: 0.5; filter: grayscale(1); }
  .cz-skill__node[data-state="available"] .cz-skill__face { background: var(--cz-surface-top); color: var(--cz-text); box-shadow: 0 3px 0 var(--cz-outline), 0 0 0 4px color-mix(in srgb, var(--sk) 38%, transparent); }
  .cz-skill__node[data-state="available"][data-learnable] .cz-skill__face { box-shadow: 0 3px 0 var(--cz-outline), 0 0 0 4px color-mix(in srgb, var(--sk) 55%, transparent), 0 0 18px 4px color-mix(in srgb, var(--sk) 55%, transparent); }
  .cz-skill__node[data-state="learned"] .cz-skill__face, .cz-skill__node[data-state="maxed"] .cz-skill__face {
    background: color-mix(in srgb, var(--sk) 72%, var(--cz-surface-top)); color: var(--cz-text);
  }
  .cz-skill__node[data-state="maxed"] .cz-skill__face { box-shadow: 0 0 0 3px var(--cz-reward), 0 0 0 5.5px var(--cz-outline), 0 3px 0 5.5px var(--cz-outline); }
  .cz-skill__node[data-learnable] .cz-skill__face::after {
    content: ""; position: absolute; inset: -4px; border: 3px solid var(--sk); border-radius: inherit; pointer-events: none; opacity: 0;
    animation: cz-skill-pulse 1.9s var(--cz-motion-ease-out) infinite;
  }
  @keyframes cz-skill-pulse { 0% { opacity: 0.9; scale: 1; } 100% { opacity: 0; scale: 1.38; } }
  .cz-skill__node[data-selected] .cz-skill__face { outline: 3px dashed var(--cz-text); outline-offset: 6px; }
  .cz-skill__node:focus-visible .cz-skill__face { outline: 3px solid var(--cz-ring); outline-offset: 6px; }

  .cz-skill__badge, .cz-skill__lock { position: absolute; z-index: 1; display: grid; place-items: center; border: 2px solid var(--cz-outline); background: var(--cz-surface-top); color: var(--cz-text); pointer-events: none; }
  .cz-skill__badge { right: -7px; bottom: -6px; min-width: 26px; height: 20px; padding: 0 5px; border-radius: 99px; font-size: 12px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; box-shadow: 0 2px 0 var(--cz-outline); }
  .cz-skill__node[data-state="maxed"] .cz-skill__badge { background: var(--cz-reward); color: var(--cz-reward-text); }
  .cz-skill__lock { right: -5px; top: -5px; width: 20px; height: 20px; border-radius: 50%; color: var(--cz-text-muted); }
  .cz-skill__node[data-kind="keystone"] .cz-skill__badge { right: calc(25% - 15px); bottom: calc(25% - 12px); }
  .cz-skill__node[data-kind="keystone"] .cz-skill__lock { right: calc(25% - 10px); top: calc(25% - 10px); }
  .cz-skill__name {
    position: absolute; left: 50%; top: calc(100% + 6px); translate: -50% 0; width: max-content; max-width: var(--cell); padding: 0 calc(4px / var(--s, 1)); border-radius: calc(7px / var(--s, 1)); background: color-mix(in srgb, var(--cz-surface-sunken) 82%, transparent); overflow: hidden; pointer-events: none;
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2;
    color: var(--cz-text); font-size: calc(11.5px / var(--s, 1)); font-weight: 800; line-height: 1.12; text-align: center; overflow-wrap: anywhere;
  }
  .cz-skill__node[data-state="locked"] .cz-skill__name { color: var(--cz-text-muted); }

  /* zoom buttons */
  .cz-skill__zoom { position: absolute; z-index: 6; right: 10px; top: 10px; display: grid; overflow: hidden; border: 2.5px solid var(--cz-outline); border-radius: 14px; background: var(--cz-surface-top); box-shadow: 0 3px 0 var(--cz-outline), 0 6px 12px -6px var(--cz-contact); }
  .cz-skill__zoom > button { display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 0; background: none; color: var(--cz-text); font: inherit; cursor: pointer; }
  .cz-skill__zoom > button + button { border-top: 2px solid color-mix(in srgb, var(--cz-outline) 25%, transparent); }
  .cz-skill__zoom > button:hover:not(:disabled) { background: var(--cz-surface-sunken); }
  .cz-skill__zoom > button:active:not(:disabled) { translate: 0 1px; }
  .cz-skill__zoom > button:disabled { opacity: 0.4; cursor: not-allowed; }
  .cz-skill__zoom > button:focus-visible, .cz-skill__close:focus-visible { outline: 3px solid var(--cz-ring); outline-offset: -3px; }

  /* details: side panel on wide boxes, bottom sheet on narrow ones */
  .cz-skill__panel { position: relative; display: flex; flex-direction: column; gap: 10px; overflow: auto; padding: 16px; background: var(--cz-surface-top); color: var(--cz-text); overscroll-behavior: contain; }
  .cz-skill__stack { border: 3px solid var(--cz-outline); border-radius: var(--cz-radius-lg); box-shadow: 0 4px 0 var(--cz-outline); }
  .cz-skill__side { height: var(--sk-h); min-width: 0; border: 3px solid var(--cz-outline); border-radius: var(--cz-radius-lg); box-shadow: 0 4px 0 var(--cz-outline), 0 12px 18px -10px var(--cz-contact); }
  .cz-skill__side[data-empty] { justify-content: center; background: var(--cz-surface); border-style: dashed; box-shadow: none; }
  .cz-skill__placeholder { margin: 0; color: var(--cz-text-muted); font-size: 15px; text-align: center; }
  .cz-skill__sheet {
    position: absolute; z-index: 8; left: 0; right: 0; bottom: 0; max-height: min(52%, 270px); padding-top: 6px;
    border-top: 3px solid var(--cz-outline); border-radius: 20px 20px 0 0; box-shadow: 0 -8px 14px -10px var(--cz-contact);
    transition: translate var(--cz-motion-base) var(--cz-motion-ease-out); animation: cz-skill-sheet-in var(--cz-motion-slow) var(--cz-motion-ease-out);
  }
  @keyframes cz-skill-sheet-in { from { translate: 0 100%; } }
  .cz-skill__handle { display: grid; place-items: center; flex-shrink: 0; height: 22px; margin: 0 -16px; cursor: grab; touch-action: none; }
  .cz-skill__handle > span { width: 40px; height: 5px; border-radius: 99px; background: color-mix(in srgb, var(--cz-text-muted) 55%, transparent); }
  .cz-skill__close { position: absolute; z-index: 1; right: 10px; top: 10px; display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 2px solid var(--cz-outline); border-radius: 50%; background: var(--cz-surface-top); color: var(--cz-text); font: inherit; font-size: 22px; line-height: 1; cursor: pointer; box-shadow: 0 2px 0 var(--cz-outline); }
  .cz-skill__sheet .cz-skill__close { top: 16px; }
  .cz-skill__close:active { translate: 0 1px; box-shadow: none; }
  .cz-skill__head { display: flex; align-items: center; gap: 12px; padding-right: 48px; }
  .cz-skill__tile { display: grid; flex-shrink: 0; place-items: center; width: 52px; height: 52px; padding: 7px; border: 2.5px solid var(--cz-outline); border-radius: 14px; background: color-mix(in srgb, var(--sk) 72%, var(--cz-surface-top)); color: var(--cz-text); box-shadow: 0 2.5px 0 var(--cz-outline); }
  .cz-skill__tile > svg, .cz-skill__tile > img { width: 100%; height: 100%; object-fit: contain; }
  .cz-skill__title { display: grid; min-width: 0; line-height: 1.2; }
  .cz-skill__title h3 { margin: 0; font-size: 19px; font-weight: 800; overflow-wrap: anywhere; }
  .cz-skill__title small { color: var(--cz-text-muted); font-size: 13.5px; }
  .cz-skill__rank { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 800; font-variant-numeric: tabular-nums; }
  .cz-skill__pips { display: inline-flex; gap: 5px; }
  .cz-skill__pips i { width: 16px; height: 16px; border: 2px solid var(--cz-outline); border-radius: 50%; background: var(--cz-surface-sunken); }
  .cz-skill__pips i[data-on] { background: var(--sk); }
  .cz-skill__actions { display: flex; flex-wrap: wrap; gap: 8px; }
  .cz-skill__actions .cz-button { min-height: 44px; }
  .cz-skill__btn-cost { margin-left: 8px; padding: 1px 8px; border-radius: 99px; background: rgb(0 0 0 / 0.2); font-size: 13px; font-variant-numeric: tabular-nums; }
  .cz-skill__hint { margin: 0; padding: 6px 10px; border-left: 4px solid var(--cz-danger); border-radius: 4px 10px 10px 4px; background: var(--cz-surface-sunken); color: var(--cz-text); font-size: 13.5px; font-weight: 700; }
  .cz-skill__desc { padding-top: 10px; border-top: 2px dashed color-mix(in srgb, var(--cz-outline) 25%, transparent); font-size: 14.5px; line-height: 1.45; }
  .cz-skill__effects { display: grid; gap: 6px; margin: 0; }
  .cz-skill__effects > div { display: grid; gap: 1px; padding: 7px 10px; border-radius: 10px; background: var(--cz-surface-sunken); }
  .cz-skill__effects > div[data-next] { border: 2px dashed color-mix(in srgb, var(--cz-outline) 40%, transparent); background: transparent; }
  .cz-skill__effects dt { color: var(--cz-text-muted); font-size: 12px; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; }
  .cz-skill__effects dd { margin: 0; font-size: 15px; font-weight: 800; }
  .cz-skill__row { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; }
  .cz-skill__reqs { display: grid; gap: 4px; }
  .cz-skill__reqs-title { color: var(--cz-text-muted); font-size: 12px; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; }
  .cz-skill .cz-skill__reqs ul { display: grid; gap: 4px; margin: 0 0 4px; padding: 0; list-style: none; }
  .cz-skill .cz-skill__req { display: flex; margin: 0; padding: 0; align-items: center; gap: 8px; color: var(--cz-text-muted); font-size: 14px; }
  .cz-skill__req[data-met] { color: var(--cz-text); }
  .cz-skill__req-mark { display: grid; flex-shrink: 0; place-items: center; width: 18px; height: 18px; border-radius: 50%; font-size: 12px; font-weight: 800; }
  .cz-skill__req[data-met] .cz-skill__req-mark { background: var(--cz-success); color: var(--cz-success-text); }

  @media (prefers-reduced-motion: reduce) {
    .cz-skill__face, .cz-skill__sheet { transition-duration: 1ms !important; }
    .cz-skill__sheet { animation: none !important; }
    .cz-skill__node[data-learnable] .cz-skill__face::after { animation: none !important; opacity: 0.6; scale: 1.12; }
    .cz-skill__node:hover .cz-skill__face { translate: none; }
  }

  .cz-skeleton { border-radius: var(--cz-radius-md); background: linear-gradient(100deg, transparent 30%, color-mix(in srgb, var(--cz-surface-top) 70%, transparent) 50%, transparent 70%) 0 0 / 300% 100%, var(--cz-surface-sunken); box-shadow: var(--cz-shadow-well); animation: cz-sheen 1.6s ease-in-out infinite; }

  /* ---------- Pagination ---------- */
  .cz-pagination { display: flex; justify-content: center; }
  .cz-pagination__list { display: flex; flex-wrap: wrap; align-items: center; gap: var(--cz-space-2); margin: 0; padding: 0; list-style: none; }
  .cz-pagination__ellipsis { display: inline-grid; place-items: center; width: 36px; height: 36px; color: var(--cz-text-muted); }

  /* ---------- Motion utilities ---------- */
  .cz-motion-pop { animation: cz-pop var(--cz-motion-slow) var(--cz-motion-ease-out) both; }
  .cz-motion-bounce-in { animation: cz-bounce-in-up var(--cz-motion-slow) var(--cz-motion-ease-out) both; }
  .cz-motion-rise { animation: cz-rise var(--cz-motion-base) var(--cz-motion-ease-out) both; }
  .cz-motion-jelly { animation: cz-jelly 520ms var(--cz-motion-ease-out) both; }
  .cz-motion-wiggle { animation: cz-wiggle 520ms ease-in-out both; }
  .cz-motion-shake { animation: cz-shake 360ms var(--cz-motion-ease-out) both; }
  .cz-motion-swing { transform-origin: top center; animation: cz-swing 600ms var(--cz-motion-ease-out) both; }
  .cz-motion-float { animation: cz-bob 2.4s ease-in-out infinite; }
  .cz-motion-spin { animation: cz-spin 0.9s linear infinite; }
}

/* Keyframes animate the individual translate / scale / rotate properties so they
   never fight a component's own transform (Radix and sonner position with transform). */
@keyframes cz-spin { to { rotate: 360deg; } }
@keyframes cz-fade-in { from { opacity: 0; } }
@keyframes cz-fade-out { to { opacity: 0; } }
@keyframes cz-pop { 0% { opacity: 0; scale: 0.6; } 60% { opacity: 1; scale: 1.08; } 100% { scale: 1; } }
@keyframes cz-stamp { 0% { opacity: 0; scale: 1.8; rotate: -12deg; } 100% { opacity: 1; scale: 1; rotate: 0deg; } }
@keyframes cz-jelly { 0% { scale: 1; } 30% { scale: 1.18 0.86; } 50% { scale: 0.9 1.1; } 70% { scale: 1.05 0.96; } 100% { scale: 1; } }
@keyframes cz-wiggle { 0%, 100% { rotate: 0deg; } 20% { rotate: -9deg; } 40% { rotate: 7deg; } 60% { rotate: -4deg; } 80% { rotate: 2deg; } }
@keyframes cz-shake { 0%, 100% { translate: 0 0; } 20% { translate: -6px 0; } 40% { translate: 5px 0; } 60% { translate: -3px 0; } 80% { translate: 2px 0; } }
@keyframes cz-swing { 0% { opacity: 0; rotate: 14deg; } 35% { opacity: 1; rotate: -8deg; } 60% { rotate: 4deg; } 80% { rotate: -2deg; } 100% { rotate: 0deg; } }
@keyframes cz-bob { 0%, 100% { translate: 0 0; } 50% { translate: 0 -5px; } }
@keyframes cz-rise { from { opacity: 0; translate: 0 8px; } }
@keyframes cz-bounce-in { 0% { opacity: 0; scale: 0.7; } 55% { opacity: 1; scale: 1.05; } 75% { scale: 0.98; } 100% { scale: 1; } }
@keyframes cz-bounce-in-up { 0% { opacity: 0; scale: 0.7; translate: 0 12px; } 55% { opacity: 1; scale: 1.05; translate: 0 0; } 75% { scale: 0.98; } 100% { scale: 1; } }
@keyframes cz-drop-out { to { opacity: 0; scale: 0.9; } }
@keyframes cz-squish { 0% { scale: 1; } 40% { scale: 1.35 0.8; } 100% { scale: 1; } }
@keyframes cz-squish-2 { 0% { scale: 1; } 40% { scale: 1.35 0.8; } 100% { scale: 1; } }
@keyframes cz-stripes { to { background-position: 0 0, 22.63px 0, 0 0; } }
@keyframes cz-glint { 0%, 100% { filter: brightness(1); } 50% { filter: brightness(1.18); } }

@keyframes cz-unfold { from { height: 0; opacity: 0; } to { height: var(--radix-accordion-content-height); opacity: 1; } }
@keyframes cz-fold { from { height: var(--radix-accordion-content-height); } to { height: 0; opacity: 0; } }
@keyframes cz-slide-r { from { translate: 110% 0; } }
@keyframes cz-slide-l { from { translate: -110% 0; } }
@keyframes cz-slide-t { from { translate: 0 -110%; } }
@keyframes cz-slide-b { from { translate: 0 110%; } }
@keyframes cz-slide-r-out { to { translate: 110% 0; } }
@keyframes cz-slide-l-out { to { translate: -110% 0; } }
@keyframes cz-slide-t-out { to { translate: 0 -110%; } }
@keyframes cz-slide-b-out { to { translate: 0 110%; } }
@keyframes cz-sheen { from { background-position: 100% 0, 0 0; } to { background-position: -50% 0, 0 0; } }

@media (prefers-reduced-motion: reduce) {
  .cz-button, .cz-card, .cz-switch__thumb, .cz-slider__thumb, .cz-tabs__indicator, .cz-avatar, .cz-progress__fill, .cz-toggle, .cz-select, .cz-menu__item, .cz-slot, .cz-gallery__card, .cz-statbar__fill, .cz-tcard, .cz-tcard__inner, .cz-tcard__glare, .cz-tcard__face, .cz-hand__slot, .cz-map__world, .cz-minimap__world, .cz-minimap__north, .cz-map__pin, .cz-map__panel, .cz-map__controls, .cz-map__scale-wrap { transition-duration: 1ms !important; }
  .cz-map__panel { animation: none !important; }
  .cz-map__player-ring, .cz-map__path { animation: none !important; }
  .cz-tcard__foil { animation: none !important; }
  [class*="cz-"], [class*="cz-"]::before { animation-duration: 1ms !important; animation-iteration-count: 1 !important; }
}

/* Tabs on a phone: icon above label, triggers share the width instead of scrolling. */
@media (max-width: 520px) {
  .cz-tabs__list { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; width: 100%; }
  .cz-tabs__trigger { flex-direction: column; gap: 2px; padding: var(--cz-space-1); font-size: var(--cz-font-size-xs); }
}
.cz-dialog:focus, .cz-sheet:focus { outline: none; }

/* ==========================================================================
   Cozy UI: Liquid Glass material, after Apple's guidance:
   - Glass is a functional layer that floats over content: buttons, toggles,
     tabs, thumbs, menus, popovers, dialogs, sheets and toasts. The content
     layer (cards, inputs, tables, calendar) keeps the cozy plastic look.
   - Controls use "clear" glass: almost no tint, light blur, a bright thin rim,
     a soft floating shadow and capsule shapes. Prominent actions (primary,
     success, destructive, reward) are tinted glass.
   - Boards use "regular" glass: stronger blur and luminosity so text reads.
   - prefers-reduced-transparency and prefers-contrast: more fill, less blur.
   Turn on with data-material="glass" on <html> or a section;
   data-material="plastic" switches a nested area back.
   ========================================================================== */

@layer components {
  [data-material="glass"] {
    --cz-glass-fill: light-dark(rgb(255 255 255 / 0.2), rgb(12 10 20 / 0.28)); /* dark palettes dim instead (Apple: dimming layer) */
    --cz-glass-fill-hover: light-dark(rgb(255 255 255 / 0.3), rgb(255 255 255 / 0.1));
    --cz-glass-tint: 82%;  /* colour kept on prominent (tinted) glass */
    --cz-glass-board: 72%; /* surface colour kept on regular glass boards */
    --cz-glass-control-filter: blur(3px) saturate(1.8) brightness(1.06);
    --cz-glass-board-filter: blur(22px) saturate(1.8) brightness(1.04);
    --cz-glass-sheen: linear-gradient(180deg, rgb(255 255 255 / 0.32), rgb(255 255 255 / 0) 55%);
    --cz-glass-rim:
      inset 0 1px 0 rgb(255 255 255 / 0.85),
      inset 0 -1px 0 rgb(255 255 255 / 0.3),
      inset 1px 0 0 rgb(255 255 255 / 0.35),
      inset -1px 0 0 rgb(255 255 255 / 0.35),
      0 0 0 1px color-mix(in srgb, var(--cz-outline) 18%, transparent);
    --cz-glass-float: 0 8px 22px -8px rgb(0 0 0 / 0.28), 0 2px 5px rgb(0 0 0 / 0.08);
  }

  @scope ([data-material="glass"]) to ([data-material="plastic"]) {
    /* ---------- Controls: clear glass capsules ---------- */
    .cz-button:where(:not(.cz-button--ghost, :disabled, [aria-disabled="true"])) {
      --face-glass: var(--cz-glass-fill);
      border-width: 0;
      border-radius: var(--cz-radius-full);
      background: var(--cz-glass-sheen), var(--face-glass);
      color: var(--cz-text);
      text-shadow: none;
      -webkit-backdrop-filter: var(--cz-glass-control-filter);
      backdrop-filter: var(--cz-glass-control-filter);
      box-shadow: var(--cz-glass-rim), var(--cz-glass-float);
      transition:
        scale var(--cz-motion-base) var(--cz-motion-ease-bounce),
        translate var(--cz-motion-base) var(--cz-motion-ease-bounce),
        box-shadow var(--cz-motion-fast) ease-out,
        filter var(--cz-motion-fast) ease-out;
    }
    .cz-button::before { display: none; }
    /* prominent actions are tinted glass; light text gets a deeper tint so it stays AA */
    .cz-button--primary, .cz-button--success, .cz-button--destructive {
      --face-glass: color-mix(in srgb, color-mix(in srgb, var(--face) 70%, var(--cz-text)) var(--cz-glass-tint), transparent);
      color: var(--fg);
    }
    .cz-button--reward, .cz-button--secondary {
      --face-glass: color-mix(in srgb, var(--face) 62%, transparent);
      color: var(--fg);
    }
    /* liquid feel: hover brightens, press swells like a drop instead of sinking */
    .cz-button:hover:not(:disabled), .cz-button[data-force="hover"] { translate: 0 0; filter: brightness(1.06) saturate(1.1); }
    .cz-button:hover:not(:disabled, .cz-button--primary, .cz-button--success, .cz-button--destructive, .cz-button--reward, .cz-button--secondary, .cz-button--ghost) { --face-glass: var(--cz-glass-fill-hover); }
    .cz-button:active:not(:disabled), .cz-button[data-force="active"] {
      translate: 0 0;
      scale: 1.06;
      filter: brightness(1.12) saturate(1.2);
      box-shadow: var(--cz-glass-rim), 0 12px 28px -8px rgb(0 0 0 / 0.3), 0 2px 5px rgb(0 0 0 / 0.08);
    }
    .cz-button--ghost:hover:not(:disabled) { background: var(--cz-glass-fill); box-shadow: var(--cz-glass-rim); border-radius: var(--cz-radius-full); }

    /* tabs and toggles: the active pill is glass floating in the track */
    .cz-tabs__indicator, .cz-toggle[data-state="on"] {
      border-width: 0;
      border-radius: var(--cz-radius-full);
      background: var(--cz-glass-sheen), var(--cz-glass-fill-hover);
      color: var(--cz-text);
      -webkit-backdrop-filter: var(--cz-glass-control-filter);
      backdrop-filter: var(--cz-glass-control-filter);
      box-shadow: var(--cz-glass-rim), 0 4px 12px -4px rgb(0 0 0 / 0.25);
      translate: 0 0;
    }
    /* the track is a glass capsule too (a segmented control) */
    .cz-tabs__list, .cz-toggle-group {
      border-width: 0;
      border-radius: var(--cz-radius-full);
      background: color-mix(in srgb, var(--cz-surface-sunken) 45%, transparent);
      -webkit-backdrop-filter: var(--cz-glass-board-filter);
      backdrop-filter: var(--cz-glass-board-filter);
      box-shadow: var(--cz-glass-rim), inset 0 2px 6px rgb(0 0 0 / 0.1);
    }
    .cz-toggle { border-radius: var(--cz-radius-full); }

    /* thumbs: clear glass marbles that bend the track behind them */
    .cz-switch__thumb, .cz-slider__thumb {
      border-width: 0;
      background: radial-gradient(circle at 35% 28%, rgb(255 255 255 / 0.9) 0 14%, rgb(255 255 255 / 0) 42%), var(--cz-glass-fill-hover);
      -webkit-backdrop-filter: var(--cz-glass-control-filter);
      backdrop-filter: var(--cz-glass-control-filter);
      box-shadow: var(--cz-glass-rim), 0 4px 10px -2px rgb(0 0 0 / 0.3);
    }

    /* ---------- Boards: regular glass ---------- */
    .cz-dialog, .cz-sheet, .cz-popover, .cz-menu, .cz-toast {
      border-width: 0;
      background: var(--cz-glass-sheen), color-mix(in srgb, var(--tone, var(--cz-surface)) var(--cz-glass-board), transparent);
      -webkit-backdrop-filter: var(--cz-glass-board-filter);
      backdrop-filter: var(--cz-glass-board-filter);
      box-shadow: var(--cz-glass-rim), 0 24px 48px -16px rgb(0 0 0 / 0.35), 0 4px 10px rgb(0 0 0 / 0.08);
    }
    .cz-menu__item[data-highlighted] { border-width: 0; border-radius: var(--cz-radius-full); background: var(--cz-glass-fill-hover); color: var(--cz-text); box-shadow: var(--cz-glass-rim); }
    .cz-menu__item--danger[data-highlighted] { color: var(--cz-danger); }
    .cz-overlay { background: color-mix(in srgb, var(--cz-overlay) 70%, transparent); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
    .cz-tooltip { border-width: 0; border-radius: var(--cz-radius-full); box-shadow: var(--cz-glass-rim), var(--cz-glass-float); }
    .cz-popover__arrow, .cz-tooltip__arrow { opacity: 0; }

    /* ---------- Panels: cards, alerts, accordions, tables, calendar (regular glass) ---------- */
    .cz-card, .cz-alert, .cz-accordion__item, .cz-table-wrap, .cz-dt__board, .cz-calendar {
      border-width: 0;
      background: var(--cz-glass-sheen), color-mix(in srgb, var(--tone, var(--cz-surface)) var(--cz-glass-board), transparent);
      -webkit-backdrop-filter: var(--cz-glass-board-filter);
      backdrop-filter: var(--cz-glass-board-filter);
      box-shadow: var(--cz-glass-rim), 0 18px 36px -16px rgb(0 0 0 / 0.3), 0 2px 6px rgb(0 0 0 / 0.06);
    }
    .cz-card { border-radius: calc(var(--cz-radius-lg) + 6px); }
    .cz-card--interactive:hover { translate: 0 -2px; filter: brightness(1.03); }
    .cz-card--interactive:active { translate: 0 0; scale: 1.015; }
    .cz-accordion__trigger, .cz-accordion__trigger:hover { background: transparent; }
    .cz-accordion__trigger:hover { background: var(--cz-glass-fill); }
    .cz-table__header, .cz-table__head { background: transparent; }
    .cz-table__head { border-bottom-color: color-mix(in srgb, var(--cz-outline) 25%, transparent); }
    .cz-table__footer { background: var(--cz-glass-fill); box-shadow: inset 0 1px 0 color-mix(in srgb, var(--cz-outline) 20%, transparent); }
    .cz-separator { background: color-mix(in srgb, var(--cz-outline) 18%, transparent); box-shadow: 0 1px 0 rgb(255 255 255 / 0.45); }

    /* ---------- Fields: inputs, selects, search, facets ---------- */
    .cz-input:where(:not(:disabled)), .cz-menu__search, .cz-dt__facet {
      border-color: transparent;
      background: color-mix(in srgb, var(--cz-surface) var(--cz-glass-board), transparent);
      -webkit-backdrop-filter: var(--cz-glass-control-filter);
      backdrop-filter: var(--cz-glass-control-filter);
      box-shadow: var(--cz-glass-rim), inset 0 2px 6px rgb(0 0 0 / 0.08);
    }
    .cz-input:where(:focus-visible, [data-force="focus"]), .cz-menu__search:focus-within { border-color: var(--cz-primary); background: color-mix(in srgb, var(--cz-surface-top) 88%, transparent); }
    .cz-select {
      border-width: 0;
      border-radius: var(--cz-radius-full);
      background: var(--cz-glass-sheen), color-mix(in srgb, var(--cz-surface) var(--cz-glass-board), transparent);
      -webkit-backdrop-filter: var(--cz-glass-control-filter);
      backdrop-filter: var(--cz-glass-control-filter);
      box-shadow: var(--cz-glass-rim), var(--cz-glass-float);
      translate: 0 0;
    }
    .cz-menu__search-wrap { background: transparent; }

    /* ---------- Choice controls: checkbox, radio, radio cards, switch, slider ---------- */
    .cz-checkbox, .cz-radio {
      border-color: color-mix(in srgb, var(--cz-outline) 35%, transparent);
      background: var(--cz-glass-sheen), var(--cz-glass-fill);
      -webkit-backdrop-filter: var(--cz-glass-control-filter);
      backdrop-filter: var(--cz-glass-control-filter);
      box-shadow: var(--cz-glass-rim), 0 3px 8px -3px rgb(0 0 0 / 0.25);
    }
    .cz-checkbox[data-state="checked"] { border-color: transparent; background: var(--cz-glass-sheen), color-mix(in srgb, color-mix(in srgb, var(--cz-success) 70%, var(--cz-text)) var(--cz-glass-tint), transparent); }
    .cz-radio__dot { box-shadow: var(--cz-glass-rim), 0 2px 4px rgb(0 0 0 / 0.25); }
    .cz-radio-card {
      border-color: transparent;
      background: var(--cz-glass-sheen), color-mix(in srgb, var(--cz-surface) var(--cz-glass-board), transparent);
      -webkit-backdrop-filter: var(--cz-glass-board-filter);
      backdrop-filter: var(--cz-glass-board-filter);
      box-shadow: var(--cz-glass-rim), var(--cz-glass-float);
    }
    .cz-radio-card:has([data-state="checked"]) { box-shadow: var(--cz-glass-rim), 0 0 0 3px color-mix(in srgb, var(--cz-reward) 70%, transparent), var(--cz-glass-float); }
    .cz-switch, .cz-slider__track, .cz-progress { border-color: color-mix(in srgb, var(--cz-outline) 30%, transparent); box-shadow: var(--cz-glass-rim), inset 0 2px 6px rgb(0 0 0 / 0.12); }
    .cz-switch[data-state="checked"] { background: var(--cz-glass-sheen), color-mix(in srgb, var(--cz-success) 80%, transparent); }
    .cz-slider__range, .cz-progress__fill { box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.6); }

    /* ---------- Small pieces: badges, avatars, toggles, skeletons, calendar days ---------- */
    .cz-badge:where(:not(.cz-badge--outline)) {
      border-width: 0;
      border-radius: var(--cz-radius-full);
      background: var(--cz-glass-sheen), color-mix(in srgb, var(--face) 62%, transparent);
      color: var(--fg);
      -webkit-backdrop-filter: var(--cz-glass-control-filter);
      backdrop-filter: var(--cz-glass-control-filter);
      box-shadow: var(--cz-glass-rim), 0 3px 8px -3px rgb(0 0 0 / 0.25);
    }
    .cz-badge--primary, .cz-badge--success, .cz-badge--info, .cz-badge--destructive {
      background: var(--cz-glass-sheen), color-mix(in srgb, color-mix(in srgb, var(--face) 70%, var(--cz-text)) var(--cz-glass-tint), transparent);
    }
    .cz-badge--info { --cz-glass-tint: 92%; } /* the info hue needs more colour to keep AA */
    .cz-badge--outline { border-width: 0; border-radius: var(--cz-radius-full); background: var(--cz-glass-fill); box-shadow: var(--cz-glass-rim); }
    .cz-avatar { border-color: rgb(255 255 255 / 0.7); box-shadow: var(--cz-glass-rim), var(--cz-glass-float); }
    .cz-toggle { border-width: 0; background: transparent; box-shadow: none; }
    .cz-toggle:hover:not([data-state="on"]) { background: var(--cz-glass-fill); }
    .cz-skeleton { background: linear-gradient(100deg, transparent 30%, rgb(255 255 255 / 0.45) 50%, transparent 70%) 0 0 / 300% 100%, var(--cz-glass-fill); box-shadow: var(--cz-glass-rim); }
    .cz-calendar__nav { border-width: 0; border-radius: var(--cz-radius-full); background: var(--cz-glass-sheen), var(--cz-glass-fill-hover); box-shadow: var(--cz-glass-rim), 0 3px 8px -3px rgb(0 0 0 / 0.25); margin-bottom: 0; }
    .cz-calendar__day:hover:not(:disabled) { border-color: transparent; border-radius: var(--cz-radius-full); background: var(--cz-glass-fill-hover); box-shadow: var(--cz-glass-rim); translate: 0 0; }
    .cz-calendar__day[data-selected] { border-width: 0; border-radius: var(--cz-radius-full); background: var(--cz-glass-sheen), color-mix(in srgb, var(--cz-reward) 62%, transparent); box-shadow: var(--cz-glass-rim), 0 4px 10px -3px color-mix(in srgb, var(--cz-reward) 60%, transparent); translate: 0 0; }
    .cz-calendar__day[data-today] { border-color: color-mix(in srgb, var(--cz-outline) 45%, transparent); box-shadow: none; }
    .cz-calendar__cell[data-in-range], .cz-calendar__cell[data-range-start], .cz-calendar__cell[data-range-end] { background: color-mix(in srgb, var(--cz-reward) 22%, transparent); }
    .cz-breadcrumb__link:hover { background: var(--cz-glass-fill); border-radius: var(--cz-radius-full); }
    .cz-dt__select-bar { background: color-mix(in srgb, var(--cz-reward) 24%, transparent); }

    /* ---------- Game components ---------- */
    .cz-inventory, .cz-character, .cz-gallery, .cz-iteminfo:not([data-variant="compact"]) {
      border-width: 0;
      background: var(--cz-glass-sheen), color-mix(in srgb, var(--cz-surface) var(--cz-glass-board), transparent);
      -webkit-backdrop-filter: var(--cz-glass-board-filter);
      backdrop-filter: var(--cz-glass-board-filter);
      box-shadow: var(--cz-glass-rim), 0 18px 36px -16px rgb(0 0 0 / 0.3), 0 2px 6px rgb(0 0 0 / 0.06);
    }
    .cz-iteminfo { box-shadow: var(--cz-glass-rim), inset 0 4px 0 color-mix(in srgb, var(--rarity, transparent) 60%, transparent), 0 18px 36px -16px rgb(0 0 0 / 0.3); }
    .cz-iteminfo[data-variant="compact"] { border-width: 0; background: var(--cz-glass-sheen), color-mix(in srgb, var(--cz-surface) var(--cz-glass-board), transparent); -webkit-backdrop-filter: var(--cz-glass-board-filter); backdrop-filter: var(--cz-glass-board-filter); }
    .cz-slot {
      border-color: color-mix(in srgb, var(--rarity, rgb(255 255 255)) 55%, transparent);
      border-radius: calc(var(--cz-radius-md) + 4px);
      background: radial-gradient(circle at 50% 38%, color-mix(in srgb, var(--rarity, transparent) 26%, transparent), transparent 70%), var(--cz-glass-fill);
      -webkit-backdrop-filter: var(--cz-glass-control-filter);
      backdrop-filter: var(--cz-glass-control-filter);
      box-shadow: var(--cz-glass-rim), inset 0 2px 6px rgb(0 0 0 / 0.08);
    }
    .cz-slot[data-selected] { border-color: var(--cz-reward); box-shadow: var(--cz-glass-rim), 0 0 0 3px color-mix(in srgb, var(--cz-reward) 55%, transparent), var(--cz-glass-float); }
    .cz-gallery__card:where(:not([data-locked])) {
      border-color: color-mix(in srgb, var(--rarity, rgb(255 255 255)) 50%, transparent);
      background: var(--cz-glass-sheen), color-mix(in srgb, var(--rarity, var(--cz-surface)) 12%, color-mix(in srgb, var(--cz-surface) var(--cz-glass-board), transparent));
      -webkit-backdrop-filter: var(--cz-glass-control-filter);
      backdrop-filter: var(--cz-glass-control-filter);
      box-shadow: var(--cz-glass-rim), var(--cz-glass-float);
    }
    .cz-inventory__tabs { border-radius: var(--cz-radius-full); background: color-mix(in srgb, var(--cz-surface-sunken) 45%, transparent); box-shadow: var(--cz-glass-rim), inset 0 2px 6px rgb(0 0 0 / 0.1); }
    .cz-inventory__tab[aria-selected="true"], .cz-inventory__sort { border-color: transparent; border-radius: var(--cz-radius-full); background: var(--cz-glass-sheen), var(--cz-glass-fill-hover); box-shadow: var(--cz-glass-rim), 0 3px 8px -3px rgb(0 0 0 / 0.25); }
    .cz-statbar__track { border-color: color-mix(in srgb, var(--cz-outline) 30%, transparent); background: color-mix(in srgb, var(--cz-surface-sunken) 46%, transparent); box-shadow: var(--cz-glass-rim), inset 0 2px 6px rgb(0 0 0 / 0.12); }
    .cz-character__portrait { border-color: color-mix(in srgb, var(--rarity, rgb(255 255 255)) 60%, transparent); box-shadow: var(--cz-glass-rim), var(--cz-glass-float); }
    .cz-character__attr, .cz-iteminfo__stats, .cz-inventory__cap { background: color-mix(in srgb, var(--cz-surface-sunken) 50%, transparent); box-shadow: var(--cz-glass-rim); }

    /* ---------- Item cards: a glass frame with a rarity rim, frosted panels ---------- */
    .cz-tcard__front {
      border-color: color-mix(in srgb, var(--rarity, var(--cz-outline)) 55%, transparent);
      background:
        var(--cz-glass-sheen),
        linear-gradient(160deg, color-mix(in srgb, var(--element) 42%, transparent), color-mix(in srgb, var(--element) 22%, transparent)),
        color-mix(in srgb, var(--cz-surface) 62%, transparent);
      /* no backdrop-filter on the faces: it flattens the 3D flip in every engine and the back would show */
      box-shadow: var(--cz-glass-rim), inset 0 0 0 1.2cqw color-mix(in srgb, var(--rarity, transparent) 45%, transparent), 0 6cqw 12cqw -5cqw rgb(0 0 0 / 0.35);
    }
    .cz-tcard__head, .cz-tcard__body, .cz-tcard__type {
      border-color: color-mix(in srgb, var(--cz-outline) 22%, transparent);
      background: var(--cz-glass-sheen), color-mix(in srgb, var(--cz-surface-top) var(--cz-glass-board), transparent);
      box-shadow: var(--cz-glass-rim);
    }
    .cz-tcard__art { border-color: color-mix(in srgb, var(--cz-outline) 30%, transparent); box-shadow: var(--cz-glass-rim), inset 0 -1.6cqw 0 color-mix(in srgb, var(--element) 20%, transparent); }
    .cz-tcard__element, .cz-tcard__cost, .cz-tcard__badge { border-color: color-mix(in srgb, var(--cz-outline) 35%, transparent); box-shadow: var(--cz-glass-rim); }
    .cz-tcard__back { border-color: color-mix(in srgb, var(--cz-outline) 35%, transparent); background: var(--cz-glass-sheen), color-mix(in srgb, var(--cz-primary) var(--cz-glass-tint), transparent); box-shadow: var(--cz-glass-rim), 0 6cqw 12cqw -5cqw rgb(0 0 0 / 0.35); }
    .cz-tcard[data-unowned] .cz-tcard__front { border-color: color-mix(in srgb, var(--cz-outline) 40%, transparent); background: var(--cz-glass-fill); box-shadow: var(--cz-glass-rim); }
    .cz-tcard[data-selected] .cz-tcard__front { box-shadow: var(--cz-glass-rim), 0 0 0 1.6cqw color-mix(in srgb, var(--cz-reward) 70%, transparent), 0 6cqw 12cqw -5cqw rgb(0 0 0 / 0.35); }

    /* ---------- Game map: the map is content; search, chips, buttons and the panel float as glass ---------- */
    .cz-map { border-color: color-mix(in srgb, var(--cz-outline) 30%, transparent); box-shadow: var(--cz-glass-rim), 0 18px 36px -16px rgb(0 0 0 / 0.3); }
    .cz-map__search input, .cz-map__chip, .cz-map__fab, .cz-map__zoom, .cz-map__panel-close {
      border-color: transparent;
      background: var(--cz-glass-sheen), color-mix(in srgb, var(--cz-surface-top) var(--cz-glass-board), transparent);
      -webkit-backdrop-filter: var(--cz-glass-board-filter);
      backdrop-filter: var(--cz-glass-board-filter);
      box-shadow: var(--cz-glass-rim), var(--cz-glass-float);
    }
    .cz-map__chip[aria-pressed="false"] { background: var(--cz-glass-fill); }
    .cz-map__search input:focus-visible { box-shadow: var(--cz-glass-rim), 0 0 0 3px var(--cz-ring); }
    .cz-map__results, .cz-map__panel {
      border-color: transparent;
      background: var(--cz-glass-sheen), color-mix(in srgb, var(--cz-surface-top) var(--cz-glass-board), transparent);
      -webkit-backdrop-filter: var(--cz-glass-board-filter);
      backdrop-filter: var(--cz-glass-board-filter);
      box-shadow: var(--cz-glass-rim), 0 18px 36px -16px rgb(0 0 0 / 0.35);
    }
    .cz-map__panel-icon, .cz-map__results-icon, .cz-map__chip-icon { border-color: color-mix(in srgb, var(--cz-outline) 40%, transparent); box-shadow: var(--cz-glass-rim); }
    .cz-map__cluster { border-color: color-mix(in srgb, var(--cz-outline) 45%, transparent); background: var(--cz-glass-sheen), color-mix(in srgb, var(--kc) 70%, transparent); -webkit-backdrop-filter: var(--cz-glass-control-filter); backdrop-filter: var(--cz-glass-control-filter); box-shadow: var(--cz-glass-rim), var(--cz-glass-float); }
    .cz-map__region-name[data-fog] { border-color: color-mix(in srgb, var(--cz-outline) 40%, transparent); background: var(--cz-glass-sheen), color-mix(in srgb, var(--cz-map-cloud) 80%, transparent); }

    /* ---------- MiniMap: a glass lens ---------- */
    .cz-minimap__view { border-color: color-mix(in srgb, #fff 55%, transparent); box-shadow: var(--cz-glass-rim), inset 0 0 0 3px color-mix(in srgb, #fff 35%, transparent), 0 14px 26px -10px rgb(0 0 0 / 0.4); }
    .cz-minimap__zoom button, .cz-minimap__region {
      border-color: transparent;
      background: var(--cz-glass-sheen), color-mix(in srgb, var(--cz-surface-top) var(--cz-glass-board), transparent);
      -webkit-backdrop-filter: var(--cz-glass-board-filter);
      backdrop-filter: var(--cz-glass-board-filter);
      box-shadow: var(--cz-glass-rim), var(--cz-glass-float);
    }
    .cz-minimap__arrow-icon { border-color: color-mix(in srgb, var(--cz-outline) 45%, transparent); box-shadow: var(--cz-glass-rim), var(--cz-glass-float); }

    /* ---------- Economy: wallet chips float as glass; shop cards and the purchase panels are frosted ---------- */
    .cz-currency:where(:not([data-alert])) {
      border-color: transparent;
      background: var(--cz-glass-sheen), color-mix(in srgb, var(--cz-surface-top) var(--cz-glass-board), transparent);
      -webkit-backdrop-filter: var(--cz-glass-board-filter);
      backdrop-filter: var(--cz-glass-board-filter);
      box-shadow: var(--cz-glass-rim), var(--cz-glass-float);
    }
    .cz-shop__item:where(:not([data-sold-out], [data-disabled])) {
      border-color: color-mix(in srgb, var(--rarity, rgb(255 255 255)) 50%, transparent);
      background: var(--cz-glass-sheen), color-mix(in srgb, var(--rarity, var(--cz-surface)) 10%, color-mix(in srgb, var(--cz-surface) var(--cz-glass-board), transparent));
      -webkit-backdrop-filter: var(--cz-glass-board-filter);
      backdrop-filter: var(--cz-glass-board-filter);
      box-shadow: var(--cz-glass-rim), var(--cz-glass-float);
    }
    .cz-shop__item:is([data-sold-out], [data-disabled]) { border-color: color-mix(in srgb, var(--cz-outline) 35%, transparent); background: color-mix(in srgb, var(--cz-surface-sunken) 70%, transparent); box-shadow: var(--cz-glass-rim); }
    .cz-shop__tabs { border-radius: var(--cz-radius-full); background: color-mix(in srgb, var(--cz-surface-sunken) 45%, transparent); box-shadow: var(--cz-glass-rim), inset 0 2px 6px rgb(0 0 0 / 0.1); }
    .cz-shop__tab[aria-selected="true"] { border-color: transparent; border-radius: var(--cz-radius-full); background: var(--cz-glass-sheen), var(--cz-glass-fill-hover); box-shadow: var(--cz-glass-rim), 0 3px 8px -3px rgb(0 0 0 / 0.25); }
    .cz-shop__state, .cz-shop__ribbon, .cz-shop__badge { box-shadow: var(--cz-glass-rim); }
    .cz-purchase__item, .cz-purchase__total {
      border-color: color-mix(in srgb, var(--rarity, var(--cz-outline)) 40%, transparent);
      background: var(--cz-glass-sheen), color-mix(in srgb, var(--cz-surface-top) var(--cz-glass-board), transparent);
      box-shadow: var(--cz-glass-rim);
    }
    .cz-purchase__need { border-color: color-mix(in srgb, var(--cz-danger) 55%, transparent); background: color-mix(in srgb, var(--cz-danger) 14%, color-mix(in srgb, var(--cz-surface-top) var(--cz-glass-board), transparent)); box-shadow: var(--cz-glass-rim); }

    /* ---------- Progression: perk cards are glass tiles with a rarity rim; buffs are little glass lenses ---------- */
    .cz-perks__card:where(:not([data-locked])) {
      border-color: color-mix(in srgb, var(--rarity, rgb(255 255 255)) 55%, transparent);
      background: var(--cz-glass-sheen), color-mix(in srgb, var(--rarity, var(--cz-surface)) 12%, color-mix(in srgb, var(--cz-surface) var(--cz-glass-board), transparent));
      -webkit-backdrop-filter: var(--cz-glass-board-filter);
      backdrop-filter: var(--cz-glass-board-filter);
      box-shadow: var(--cz-glass-rim), var(--cz-glass-float);
    }
    .cz-perks__card[data-selected] { box-shadow: var(--cz-glass-rim), 0 0 0 4px color-mix(in srgb, var(--cz-reward) 75%, transparent), 0 16px 30px -12px rgb(0 0 0 / 0.35); }
    .cz-perks__card[data-locked] { border-color: color-mix(in srgb, var(--cz-outline) 35%, transparent); background: color-mix(in srgb, var(--cz-surface-sunken) 70%, transparent); box-shadow: var(--cz-glass-rim); }
    .cz-buffs__buff {
      border-color: color-mix(in srgb, var(--tone, var(--cz-outline)) 45%, transparent);
      background: var(--cz-glass-sheen), color-mix(in srgb, var(--cz-surface-top) var(--cz-glass-board), transparent);
      -webkit-backdrop-filter: var(--cz-glass-control-filter);
      backdrop-filter: var(--cz-glass-control-filter);
      box-shadow: var(--cz-glass-rim), var(--cz-glass-float);
    }
    .cz-buffs__buff[data-kind="debuff"] { background: var(--cz-glass-sheen), color-mix(in srgb, var(--cz-danger) 22%, color-mix(in srgb, var(--cz-surface-top) var(--cz-glass-board), transparent)); }
    /* skill tree: glass nodes and panel over the tree */
    .cz-skill__stage { border-color: color-mix(in srgb, var(--cz-outline) 30%, transparent); box-shadow: var(--cz-glass-rim), 0 18px 36px -16px rgb(0 0 0 / 0.3); }
    .cz-skill__node[data-state="locked"] .cz-skill__face, .cz-skill__node[data-state="available"] .cz-skill__face {
      background: var(--cz-glass-sheen), color-mix(in srgb, var(--cz-surface-top) var(--cz-glass-board), transparent);
      -webkit-backdrop-filter: var(--cz-glass-control-filter);
      backdrop-filter: var(--cz-glass-control-filter);
    }
    .cz-skill__panel, .cz-skill__sheet {
      background: var(--cz-glass-sheen), color-mix(in srgb, var(--cz-surface-top) var(--cz-glass-board), transparent);
      -webkit-backdrop-filter: var(--cz-glass-board-filter);
      backdrop-filter: var(--cz-glass-board-filter);
    }
  }

  /* ---------- A soft colour backdrop, so the glass has something to show ---------- */
  :root, [data-palette], [data-material] {
    --cz-glass-backdrop:
      radial-gradient(30% 40% at 12% 16%, color-mix(in srgb, var(--cz-reward) 40%, transparent), transparent 70%),
      radial-gradient(28% 38% at 88% 22%, color-mix(in srgb, var(--cz-primary) 40%, transparent), transparent 70%),
      radial-gradient(34% 44% at 72% 90%, color-mix(in srgb, var(--cz-success) 40%, transparent), transparent 70%),
      radial-gradient(26% 36% at 24% 86%, color-mix(in srgb, var(--cz-info) 36%, transparent), transparent 70%);
  }
  .cz-glass-backdrop { background: var(--cz-glass-backdrop), var(--cz-page); }

  /* ---------- Accessibility ---------- */
  @media (prefers-reduced-transparency: reduce), (prefers-contrast: more) {
    [data-material="glass"] {
      --cz-glass-fill: var(--cz-surface);
      --cz-glass-fill-hover: var(--cz-surface-top);
      --cz-glass-tint: 100%;
      --cz-glass-board: 100%;
      --cz-glass-control-filter: none;
      --cz-glass-board-filter: none;
    }
  }
}
