@layer reset, tokens, base, components;

@font-face {
  font-family: 'Barlow';
  font-style: normal;
  font-weight: 500;
  font-display: block;
  src: url('/fonts/barlow-500.woff2') format('woff2');
}

@font-face {
  font-family: 'Barlow';
  font-style: normal;
  font-weight: 600;
  font-display: block;
  src: url('/fonts/barlow-600.woff2') format('woff2');
}

@font-face {
  font-family: 'Barlow';
  font-style: normal;
  font-weight: 700;
  font-display: block;
  src: url('/fonts/barlow-700.woff2') format('woff2');
}

@font-face {
  font-family: 'Barlow Fallback';
  font-weight: 100 549;
  src: local('Arial'), local('Liberation Sans'), local('Arimo');
  size-adjust: 96.63%;
  ascent-override: 103.48%;
  descent-override: 20.7%;
  line-gap-override: 0%;
}

@font-face {
  font-family: 'Barlow Fallback';
  font-weight: 550 900;
  src: local('Arial Bold'), local('Liberation Sans Bold'), local('Arimo Bold');
  size-adjust: 90%;
  ascent-override: 111.11%;
  descent-override: 22.22%;
  line-gap-override: 0%;
}

@layer reset {
  *,
  *::before,
  *::after {
    box-sizing: border-box;
  }

  [hidden] {
    display: none !important;
  }

  body {
    margin: 0;
  }

  img,
  svg {
    display: block;
  }
}

@layer tokens {
  :root {
    color-scheme: light dark;

    --rv-font: 'Barlow', 'Barlow Fallback', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --rv-mono: ui-monospace, 'SFMono-Regular', 'JetBrains Mono', Menlo, Consolas, monospace;

    /* OKLCH dual-theme surfaces & neutral ink ladder (matched to reiver.net & Mizan DESIGN.md) */
    --rv-bg-primary: light-dark(oklch(0.96 0.004 240), oklch(0.159 0.005 248));
    --rv-bg-secondary: light-dark(oklch(0.992 0.002 240), oklch(0.205 0.006 248));
    --rv-dialog: light-dark(oklch(0.996 0.002 240), oklch(0.205 0.006 248));
    --rv-header-bg: light-dark(oklch(0.988 0.003 240 / 0.86), oklch(0.185 0.006 248 / 0.86));

    --rv-fill-faint: light-dark(oklch(0 0 0 / 0.02), oklch(1 0 0 / 0.025));
    --rv-fill-subtle: light-dark(oklch(0 0 0 / 0.045), oklch(1 0 0 / 0.045));
    --rv-fill: light-dark(oklch(0 0 0 / 0.06), oklch(1 0 0 / 0.06));
    --rv-fill-hover: light-dark(oklch(0 0 0 / 0.085), oklch(1 0 0 / 0.095));
    --rv-fill-selected: light-dark(oklch(1 0 0), oklch(1 0 0 / 0.12));

    --rv-text-primary: light-dark(oklch(0.173 0.005 248), oklch(0.946 0.004 240));
    --rv-text-secondary: light-dark(oklch(0.36 0.005 248), oklch(0.79 0.004 240));
    --rv-text-muted: light-dark(oklch(0.45 0.005 248), oklch(0.72 0.004 240));
    --rv-text-dim: light-dark(oklch(0.52 0.005 248), oklch(0.64 0.004 240));
    --rv-ink-invert: light-dark(oklch(0.97 0.003 240), oklch(0.159 0.005 248));

    --rv-stroke-soft: light-dark(oklch(0 0 0 / 0.06), oklch(1 0 0 / 0.055));
    --rv-stroke: light-dark(oklch(0 0 0 / 0.1), oklch(1 0 0 / 0.085));
    --rv-stroke-strong: light-dark(oklch(0 0 0 / 0.16), oklch(1 0 0 / 0.14));
    --rv-highlight: light-dark(transparent, oklch(1 0 0 / 0.04));

    --rv-control-raised: light-dark(oklch(1 0 0), oklch(1 0 0 / 0.055));
    --rv-control-raised-hover: light-dark(oklch(0.975 0.003 240), oklch(1 0 0 / 0.095));
    --rv-control-edge: light-dark(oklch(0 0 0 / 0.11), transparent);
    --rv-control-edge-hover: light-dark(oklch(0 0 0 / 0.16), transparent);
    --rv-segment-on: light-dark(oklch(1 0 0), oklch(1 0 0 / 0.11));

    --rv-danger: light-dark(oklch(0.54 0.2 22), oklch(0.72 0.17 22));
    --rv-danger-wash: light-dark(oklch(0.54 0.2 22 / 0.08), oklch(0.72 0.17 22 / 0.12));
    --rv-success: light-dark(oklch(0.46 0.13 152), oklch(0.78 0.14 152));

    --rv-shadow-ink: 0.2 0.01 260;
    --rv-control-lift:
      0 1px 2px oklch(var(--rv-shadow-ink) / 0.07),
      0 2px 6px -2px oklch(var(--rv-shadow-ink) / 0.06);
    --rv-control-lift-primary:
      0 1px 2px oklch(var(--rv-shadow-ink) / 0.14),
      0 4px 12px -4px oklch(var(--rv-shadow-ink) / 0.16);
    --rv-segment-lift:
      0 0 0 1px oklch(0 0 0 / 0.05),
      0 1px 2px oklch(var(--rv-shadow-ink) / 0.08);
    --rv-shadow-md:
      0 1px 2px oklch(var(--rv-shadow-ink) / 0.06),
      0 4px 12px -4px oklch(var(--rv-shadow-ink) / 0.1),
      0 12px 28px -12px oklch(var(--rv-shadow-ink) / 0.12);
    --rv-shadow-lg:
      0 2px 4px oklch(var(--rv-shadow-ink) / 0.08),
      0 10px 24px -6px oklch(var(--rv-shadow-ink) / 0.16),
      0 28px 60px -16px oklch(var(--rv-shadow-ink) / 0.24);
    --rv-backdrop: oklch(0.1 0.005 248 / 0.56);

    --rv-focus-ring: 0 0 0 2px var(--rv-text-primary);

    /* Type scale (DESIGN.md) */
    --text-xs: 0.75rem;
    --text-control: 0.8125rem;
    --text-sm: 0.875rem;
    --text-title: 0.9375rem;
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.375rem;
    --text-page: clamp(1.5rem, 1.25rem + 1vw, 2rem);

    /* Spacing & concentric radii */
    --rv-measure: 72rem;
    --rv-gutter: clamp(1.125rem, 3.5vw, 2.5rem);
    --rv-radius-sm: 0.4375rem;
    --rv-radius-control: 0.5625rem;
    --rv-radius-card: 0.875rem;
    --rv-radius-pill: 999px;

    /* Motion (Emil Kowalski curves) */
    --rv-ease-out: cubic-bezier(0.23, 1, 0.32, 1);
    --rv-ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
    --rv-field-floor: 0px;

    @media (prefers-color-scheme: dark) {
      --rv-shadow-ink: 0.05 0.01 260;
      --rv-control-lift: inset 0 1px 0 var(--rv-highlight);
      --rv-segment-lift: inset 0 1px 0 var(--rv-highlight);
      --rv-backdrop: oklch(0.06 0.005 248 / 0.72);
    }

    &:has(> head > meta[name='color-scheme'][content='dark']) {
      color-scheme: dark;
      --rv-shadow-ink: 0.05 0.01 260;
      --rv-control-lift: inset 0 1px 0 var(--rv-highlight);
      --rv-segment-lift: inset 0 1px 0 var(--rv-highlight);
      --rv-backdrop: oklch(0.06 0.005 248 / 0.72);
    }

    &:has(> head > meta[name='color-scheme'][content='light']) {
      color-scheme: light;
      --rv-shadow-ink: 0.2 0.01 260;
      --rv-control-lift:
        0 1px 2px oklch(var(--rv-shadow-ink) / 0.07),
        0 2px 6px -2px oklch(var(--rv-shadow-ink) / 0.06);
      --rv-segment-lift:
        0 0 0 1px oklch(0 0 0 / 0.05),
        0 1px 2px oklch(var(--rv-shadow-ink) / 0.08);
      --rv-backdrop: oklch(0.1 0.005 248 / 0.44);
    }
  }

  @media (pointer: coarse) {
    :root {
      --rv-field-floor: 1rem;
    }
  }
}

@layer base {
  html {
    background-color: var(--rv-bg-primary);
    color: var(--rv-text-primary);
    font-family: var(--rv-font);
    font-weight: 500;
    font-optical-sizing: auto;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-tap-highlight-color: transparent;
    scroll-padding-block-start: 5rem;
  }

  html.theme-switching *,
  html.theme-switching *::before,
  html.theme-switching *::after {
    transition: none !important;
  }

  body {
    min-block-size: 100svh;
    display: flex;
    flex-direction: column;
    background-color: var(--rv-bg-primary);
    color: var(--rv-text-primary);
    padding-inline: env(safe-area-inset-left) env(safe-area-inset-right);
  }

  a {
    color: inherit;
    touch-action: manipulation;
  }

  button {
    font: inherit;
    color: inherit;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
  }

  code {
    font-family: var(--rv-mono);
    font-size: 0.88em;
    padding: 0.1em 0.35em;
    border-radius: 5px;
    background-color: var(--rv-fill);
  }

  .skip-link {
    position: fixed;
    inset-block-start: -4rem;
    inset-inline-start: 1rem;
    z-index: 100;
    padding: 0.5rem 0.9rem;
    border-radius: var(--rv-radius-control);
    background-color: var(--rv-text-primary);
    color: var(--rv-ink-invert);
    font-size: var(--text-sm);
    font-weight: 600;
    text-decoration: none;
  }

  .skip-link:focus-visible {
    inset-block-start: 1rem;
    outline: none;
    box-shadow: var(--rv-focus-ring);
  }
}

@layer components {
  .measure {
    inline-size: min(100%, var(--rv-measure));
    margin-inline: auto;
    padding-inline: var(--rv-gutter);
  }

  .ic {
    flex: none;
    translate: 0 0.04em;
  }

  .mono-inline {
    font-family: var(--rv-mono);
    font-size: 0.92em;
  }

  /* Theme icon swap */
  .ic-sun {
    display: none;
  }

  :root:has(> head > meta[name='color-scheme'][content='dark']) .ic-sun {
    display: block;
  }

  :root:has(> head > meta[name='color-scheme'][content='dark']) .ic-moon {
    display: none;
  }

  @media (prefers-color-scheme: dark) {
    :root:not(:has(> head > meta[name='color-scheme'][content='light'])) .ic-sun {
      display: block;
    }

    :root:not(:has(> head > meta[name='color-scheme'][content='light'])) .ic-moon {
      display: none;
    }
  }

  /* Sticky floating architectural bar (matching reiver.net SiteHeader) */
  .site-header {
    position: sticky;
    inset-block-start: 0;
    z-index: 40;
    padding-block: 0.75rem;
  }

  .header-dock {
    position: relative;
    isolation: isolate;
    min-block-size: 3rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
  }

  .header-dock::before {
    content: '';
    position: absolute;
    inset-block: -0.25rem;
    inset-inline: -0.875rem;
    z-index: -1;
    border-radius: var(--rv-radius-pill);
    background-color: var(--rv-header-bg);
    box-shadow: 0 0 0 1px var(--rv-stroke), var(--rv-shadow-md);
    backdrop-filter: blur(22px) saturate(1.3);
    -webkit-backdrop-filter: blur(22px) saturate(1.3);
    opacity: 0;
    transform: scale(0.99);
    pointer-events: none;
    transition: opacity 200ms var(--rv-ease-out), transform 220ms var(--rv-ease-out);
  }

  .site-header[data-scrolled] .header-dock::before {
    opacity: 1;
    transform: scale(1);
  }

  @media (prefers-reduced-transparency: reduce) {
    .header-dock::before {
      backdrop-filter: none;
      -webkit-backdrop-filter: none;
      background-color: var(--rv-bg-secondary);
    }
  }

  .header-start {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
  }

  .brand {
    font-size: 1.0625rem;
    font-weight: 600;
    letter-spacing: -0.026em;
    text-decoration: none;
    color: var(--rv-text-primary);
  }

  .brand-sep {
    color: var(--rv-text-dim);
    font-weight: 500;
  }

  .brand-section {
    font-size: var(--text-title);
    font-weight: 500;
    color: var(--rv-text-secondary);
  }

  .header-end {
    display: flex;
    align-items: center;
    gap: 0.5rem;
  }

  /* Unified Controls (Mizan DESIGN.md: 32px sm / 40px md / 44px lg, medium 500 weight, 0.96 press) */
  .ctrl {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4375rem;
    border: 1px solid transparent;
    font-weight: 500;
    font-size: var(--text-control);
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    transition:
      background-color 140ms var(--rv-ease-out),
      border-color 140ms var(--rv-ease-out),
      color 140ms var(--rv-ease-out),
      transform 110ms var(--rv-ease-out);
  }

  .ctrl:focus-visible {
    outline: none;
    box-shadow: var(--rv-focus-ring);
  }

  .ctrl:active:not(:disabled) {
    transform: scale(0.96);
  }

  .ctrl:disabled {
    opacity: 0.42;
    cursor: not-allowed;
    box-shadow: none;
  }

  .ctrl-sm {
    block-size: 2rem;
    padding-inline: 0.75rem;
    border-radius: var(--rv-radius-sm);
  }

  .ctrl-md {
    block-size: 2.5rem;
    padding-inline: 1rem;
    border-radius: var(--rv-radius-control);
    font-size: var(--text-sm);
  }

  .ctrl-lg {
    block-size: 2.75rem;
    padding-inline: 1.25rem;
    border-radius: var(--rv-radius-control);
    font-size: var(--text-sm);
  }

  .ctrl-icon {
    padding-inline: 0;
    inline-size: 2rem;
  }

  .ctrl-full {
    inline-size: 100%;
  }

  .ctrl-raised {
    background-color: var(--rv-control-raised);
    border-color: var(--rv-control-edge);
    color: var(--rv-text-primary);
    box-shadow: var(--rv-control-lift);
  }

  .ctrl-ghost {
    background-color: transparent;
    color: var(--rv-text-secondary);
  }

  .ctrl-primary {
    background-color: var(--rv-text-primary);
    color: var(--rv-ink-invert);
    box-shadow: var(--rv-control-lift-primary);
  }

  @media (hover: hover) and (pointer: fine) {
    .ctrl-raised:hover:not(:disabled) {
      background-color: var(--rv-control-raised-hover);
      border-color: var(--rv-control-edge-hover);
    }

    .ctrl-ghost:hover:not(:disabled) {
      background-color: var(--rv-fill-hover);
      color: var(--rv-text-primary);
    }

    .ctrl-primary:hover:not(:disabled) {
      opacity: 0.9;
    }

    .ctrl-icon:hover:not(:disabled) {
      background-color: var(--rv-fill-hover);
      color: var(--rv-text-primary);
    }
  }

  .avatar {
    inline-size: 1.125rem;
    block-size: 1.125rem;
    border-radius: 4px;
    image-rendering: pixelated;
    outline: 1px solid var(--rv-stroke);
    outline-offset: -1px;
  }

  .count-pill {
    display: inline-grid;
    place-items: center;
    min-inline-size: 1.25rem;
    block-size: 1.25rem;
    padding-inline: 0.3rem;
    border-radius: var(--rv-radius-pill);
    background-color: color-mix(in oklab, var(--rv-ink-invert) 18%, transparent);
    color: var(--rv-ink-invert);
    font-size: var(--text-xs);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
  }

  /* Main Workspace Header — opens straight into live store content (no 100vh pitch banner) */
  .site-main {
    flex: 1 0 auto;
    padding-block: 1.5rem 4rem;
  }

  .store-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-block-end: 1.5rem;
  }

  .page-title {
    margin: 0;
    font-size: var(--text-page);
    font-weight: 600;
    letter-spacing: -0.028em;
    line-height: 1.12;
    text-wrap: balance;
  }

  .page-lead {
    margin: 0.375rem 0 0;
    font-size: var(--text-base);
    color: var(--rv-text-secondary);
    text-wrap: pretty;
    max-inline-size: 38em;
  }

  .price-meta {
    margin: 0;
    font-size: var(--text-control);
    color: var(--rv-text-muted);
    font-variant-numeric: tabular-nums;
  }

  /* Gliding Segmented Control (reiver.net SystemsLedger + Mizan DESIGN.md) */
  .toolbar {
    margin-block-end: 1.5rem;
  }

  .seg-track {
    position: relative;
    display: inline-flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 2px;
    padding: 3px;
    border-radius: 0.6875rem;
    background-color: var(--rv-fill-subtle);
    max-inline-size: 100%;
    overflow-x: auto;
    scroll-snap-type: inline proximity;
    scrollbar-width: none;
  }

  .seg-track::-webkit-scrollbar {
    display: none;
  }

  .seg-track--full {
    display: grid;
    grid-template-columns: 1fr 1fr;
    inline-size: 100%;
  }

  .seg-thumb {
    position: absolute;
    inset-block: 3px;
    inset-inline-start: 0;
    z-index: 0;
    border-radius: 0.5rem;
    background-color: var(--rv-segment-on);
    box-shadow: var(--rv-segment-lift);
    pointer-events: none;
    opacity: 0;
    transition:
      transform 220ms var(--rv-ease-out),
      inline-size 220ms var(--rv-ease-out),
      opacity 140ms ease;
  }

  .seg-btn {
    position: relative;
    z-index: 1;
    flex: none;
    scroll-snap-align: start;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    block-size: 2.125rem;
    padding-inline: 0.875rem;
    border: 0;
    border-radius: 0.5rem;
    background: transparent;
    color: var(--rv-text-secondary);
    font-size: var(--text-sm);
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    transition: color 140ms var(--rv-ease-out), transform 100ms var(--rv-ease-out);
  }

  .seg-btn:focus-visible {
    outline: none;
    box-shadow: var(--rv-focus-ring);
  }

  .seg-btn:active {
    transform: scale(0.97);
  }

  .seg-btn[aria-selected='true'],
  .seg-btn[aria-checked='true'] {
    color: var(--rv-text-primary);
  }

  @media (hover: hover) and (pointer: fine) {
    .seg-btn:hover:not([aria-selected='true']):not([aria-checked='true']) {
      color: var(--rv-text-primary);
    }
  }

  .seg-count {
    font-size: var(--text-xs);
    color: var(--rv-text-muted);
    font-variant-numeric: tabular-nums;
  }

  .inline-notice {
    margin: 0 0 1.25rem;
    padding: 0.75rem 1rem;
    border-radius: var(--rv-radius-control);
    background-color: var(--rv-bg-secondary);
    box-shadow: inset 0 0 0 1px var(--rv-stroke);
    font-size: var(--text-sm);
    color: var(--rv-text-secondary);
  }

  /* Product Grid & Single-Frame Cards (DESIGN.md: 14px card, 1px inset hairline, zero nested boxes) */
  .pkg-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 20.5rem), 1fr));
    gap: 1rem;
    align-items: stretch;
  }

  .pkg-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border-radius: var(--rv-radius-card);
    background-color: var(--rv-bg-secondary);
    box-shadow: inset 0 0 0 1px var(--rv-stroke), inset 0 1px 0 var(--rv-highlight);
    transition: box-shadow 180ms var(--rv-ease-out), transform 180ms var(--rv-ease-out);
  }

  @supports (corner-shape: superellipse(1.25)) {
    .pkg-card,
    .sheet-modal {
      corner-shape: superellipse(1.25);
    }
  }

  @media (hover: hover) and (pointer: fine) {
    .pkg-card:hover {
      box-shadow: inset 0 0 0 1px var(--rv-stroke-strong), inset 0 1px 0 var(--rv-highlight), var(--rv-shadow-md);
      transform: translateY(-1px);
    }
  }

  .pkg-head {
    padding: 1.25rem 1.25rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
  }

  .pkg-title-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
  }

  .pkg-name {
    margin: 0;
    font-size: var(--text-lg);
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.25;
    color: var(--rv-text-primary);
  }

  .pkg-tag {
    flex: none;
    display: inline-flex;
    align-items: center;
    block-size: 1.375rem;
    padding-inline: 0.5rem;
    border-radius: var(--rv-radius-pill);
    background-color: var(--rv-fill);
    color: var(--rv-text-secondary);
    font-size: var(--text-xs);
    font-weight: 500;
    white-space: nowrap;
  }

  .pkg-desc {
    margin: 0;
    font-size: var(--text-sm);
    color: var(--rv-text-secondary);
    line-height: 1.5;
    text-wrap: pretty;
  }

  .pkg-rows {
    margin: 0;
    padding: 0 1.25rem;
    list-style: none;
    border-block-start: 1px solid var(--rv-stroke-soft);
  }

  .pkg-rows li {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    padding-block: 0.625rem;
    font-size: var(--text-control);
  }

  .pkg-rows li:not(:last-child) {
    border-block-end: 1px solid var(--rv-stroke-soft);
  }

  .row-k {
    color: var(--rv-text-muted);
  }

  .row-v {
    color: var(--rv-text-primary);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    text-align: end;
  }

  .pkg-foot {
    padding: 1rem 1.25rem 1.25rem;
    border-block-start: 1px solid var(--rv-stroke-soft);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
  }

  .price-figure {
    font-family: var(--rv-font);
    font-size: var(--text-xl);
    font-weight: 600;
    letter-spacing: -0.024em;
    font-variant-numeric: tabular-nums;
    color: var(--rv-text-primary);
    line-height: 1.1;
  }

  .price-cadence {
    font-size: var(--text-control);
    font-weight: 500;
    color: var(--rv-text-muted);
  }

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

  /* Measured Loading Skeleton */
  .skeleton-card {
    block-size: 19rem;
    border-radius: var(--rv-radius-card);
    background-color: var(--rv-bg-secondary);
    box-shadow: inset 0 0 0 1px var(--rv-stroke-soft);
    animation: pulse 1.6s ease-in-out infinite;
  }

  @keyframes pulse {
    0%, 100% { opacity: 0.55; }
    50% { opacity: 0.9; }
  }

  /* Quiet Progressive-Disclosure Footer Notes (DESIGN.md: explanations behind a disclosure) */
  .store-notes {
    margin-block-start: 3rem;
    padding-block-start: 1.5rem;
    border-block-start: 1px solid var(--rv-stroke-soft);
  }

  .note-disclosure {
    max-inline-size: 52rem;
  }

  .note-summary {
    list-style: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--rv-text-secondary);
    cursor: pointer;
    padding-block: 0.25rem;
  }

  .note-summary::-webkit-details-marker {
    display: none;
  }

  .note-chev {
    transition: transform 180ms var(--rv-ease-out);
  }

  .note-disclosure[open] .note-chev {
    transform: rotate(180deg);
  }

  .note-list {
    margin: 1rem 0 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem 2.5rem;
  }

  .note-item dt {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--rv-text-primary);
    margin-block-end: 0.25rem;
  }

  .note-item dd {
    margin: 0;
    font-size: var(--text-sm);
    color: var(--rv-text-secondary);
    line-height: 1.55;
  }

  /* Footer */
  .site-footer {
    padding-block: 1.75rem 2.25rem;
    border-block-start: 1px solid var(--rv-stroke-soft);
  }

  .footer-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
  }

  .footer-copy {
    margin: 0;
    font-size: var(--text-xs);
    color: var(--rv-text-muted);
  }

  .footer-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
    font-size: var(--text-control);
    color: var(--rv-text-secondary);
  }

  .footer-nav a {
    text-decoration: none;
  }

  @media (hover: hover) and (pointer: fine) {
    .footer-nav a:hover {
      color: var(--rv-text-primary);
    }
  }

  /* Top-Layer <dialog> Modals & Drawer (Modern Web Guidance + Emil Kowalski) */
  dialog.sheet {
    padding: 0;
    border: 0;
    color: var(--rv-text-primary);
    background-color: var(--rv-dialog);
    box-shadow: 0 0 0 1px var(--rv-stroke), inset 0 1px 0 var(--rv-highlight), var(--rv-shadow-lg);
    opacity: 0;
    transition-property: opacity, transform, display, overlay;
    transition-duration: 180ms;
    transition-timing-function: var(--rv-ease-out);
    transition-behavior: allow-discrete;
  }

  dialog.sheet:modal {
    overscroll-behavior: contain;
  }

  dialog.sheet::backdrop {
    overflow: hidden;
    overscroll-behavior: contain;
    background-color: transparent;
    transition-property: background-color, display, overlay;
    transition-duration: 180ms;
    transition-timing-function: var(--rv-ease-out);
    transition-behavior: allow-discrete;
  }

  dialog.sheet-modal {
    inline-size: min(calc(100vw - 2rem), 26rem);
    max-block-size: min(90svh, 44rem);
    border-radius: var(--rv-radius-card);
    overflow: hidden;

    @media (prefers-reduced-motion: no-preference) {
      transform: scale(0.96) translateY(6px);
    }
  }

  dialog.sheet-modal--wide {
    inline-size: min(calc(100vw - 2rem), 34rem);
  }

  dialog.sheet-drawer {
    margin: 0 0 0 auto;
    inline-size: min(100vw, 26rem);
    block-size: 100dvh;
    max-block-size: 100dvh;
    border-radius: var(--rv-radius-card) 0 0 var(--rv-radius-card);
    transition-duration: 280ms;
    transition-timing-function: var(--rv-ease-drawer);

    @media (prefers-reduced-motion: no-preference) {
      transform: translateX(100%);
    }
  }

  dialog.sheet[open] {
    display: flex;
    flex-direction: column;
  }

  dialog.sheet[open]:where(:not([data-closing])) {
    opacity: 1;

    @starting-style {
      opacity: 0;
    }

    @media (prefers-reduced-motion: no-preference) {
      transform: none;

      @starting-style {
        transform: scale(0.96) translateY(6px);
      }
    }

    &::backdrop {
      background-color: var(--rv-backdrop);

      @starting-style {
        background-color: transparent;
      }
    }
  }

  dialog.sheet-drawer[open]:where(:not([data-closing])) {
    @media (prefers-reduced-motion: no-preference) {
      transform: translateX(0);

      @starting-style {
        transform: translateX(100%);
      }
    }
  }

  @media (prefers-reduced-motion: reduce) {
    dialog.sheet,
    dialog.sheet::backdrop {
      transition-duration: 90ms;
    }
  }

  .sheet-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-block-end: 1px solid var(--rv-stroke-soft);
  }

  .sheet-title-wrap {
    min-inline-size: 0;
  }

  .sheet-title {
    margin: 0;
    font-size: var(--text-lg);
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.25;
  }

  .sheet-sub {
    display: block;
    margin-block-start: 0.125rem;
    font-size: var(--text-xs);
    color: var(--rv-text-muted);
  }

  .sheet-body {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1.125rem;
  }

  .sheet-body--scroll {
    flex: 1 1 auto;
    overflow-y: auto;
  }

  .sheet-foot {
    padding: 1rem 1.25rem;
    border-block-start: 1px solid var(--rv-stroke-soft);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
  }

  .sheet-foot--col {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .sheet-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-block-start: 0.25rem;
  }

  /* Forms & Recessed Compound Input (DESIGN.md: 4.5% fill, zero border at rest, 1 focus ring) */
  .field-group {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
  }

  .field-label {
    font-size: var(--text-xs);
    font-weight: 500;
    color: var(--rv-text-secondary);
  }

  .compound-input {
    display: flex;
    align-items: center;
    block-size: 2.5rem;
    padding-inline: 0.875rem;
    gap: 0.25rem;
    border-radius: var(--rv-radius-control);
    background-color: var(--rv-fill-subtle);
    transition: background-color 140ms var(--rv-ease-out), box-shadow 140ms var(--rv-ease-out);
  }

  .compound-input:focus-within {
    box-shadow: var(--rv-focus-ring);
    background-color: var(--rv-fill-faint);
  }

  .input-prefix {
    font-family: var(--rv-mono);
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--rv-text-muted);
    user-select: none;
  }

  .compound-input input {
    inline-size: 100%;
    min-inline-size: 0;
    border: 0;
    padding: 0;
    background: transparent;
    color: var(--rv-text-primary);
    font-family: var(--rv-font);
    font-size: max(var(--text-sm), var(--rv-field-floor));
    font-weight: 500;
  }

  .compound-input input:focus {
    outline: none;
  }

  .compound-input input::placeholder {
    color: var(--rv-text-dim);
  }

  .field-error {
    margin: 0;
    padding: 0.625rem 0.75rem;
    border-radius: var(--rv-radius-sm);
    background-color: var(--rv-danger-wash);
    color: var(--rv-danger);
    font-size: var(--text-control);
  }

  /* Details Modal Body (native Light/Dark token rendering) */
  .detail-lead {
    margin: 0;
    font-size: var(--text-sm);
    color: var(--rv-text-secondary);
    line-height: 1.55;
    text-wrap: pretty;
  }

  .detail-sections {
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }

  .detail-section-title {
    margin: 0 0 0.375rem;
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--rv-text-muted);
  }

  .detail-list {
    margin: 0;
    padding: 0;
    list-style: none;
    border-block-start: 1px solid var(--rv-stroke-soft);
  }

  .detail-list li {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    padding-block: 0.5625rem;
    border-block-end: 1px solid var(--rv-stroke-soft);
    font-size: var(--text-control);
  }

  .detail-footnote {
    margin: 0;
    font-size: var(--text-xs);
    color: var(--rv-text-muted);
    line-height: 1.5;
  }

  .price-stack {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
  }

  .price-sub {
    font-size: var(--text-xs);
    color: var(--rv-text-muted);
  }

  /* Inline Disclosures (Gift / Creator Code) */
  .inline-disclosure {
    border-block-start: 1px solid var(--rv-stroke-soft);
    padding-block-start: 0.875rem;
  }

  .inline-disclosure summary {
    list-style: none;
    font-size: var(--text-control);
    font-weight: 500;
    color: var(--rv-text-secondary);
    cursor: pointer;
  }

  .inline-disclosure summary::-webkit-details-marker {
    display: none;
  }

  @media (hover: hover) and (pointer: fine) {
    .inline-disclosure summary:hover {
      color: var(--rv-text-primary);
    }
  }

  .disclosure-inner {
    margin-block-start: 0.75rem;
  }

  .compound-form {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.25rem 0.25rem 0.875rem;
    border-radius: var(--rv-radius-control);
    background-color: var(--rv-fill-subtle);
  }

  .compound-form:focus-within {
    box-shadow: var(--rv-focus-ring);
  }

  .compound-form input {
    inline-size: 100%;
    min-inline-size: 0;
    border: 0;
    padding: 0;
    background: transparent;
    color: var(--rv-text-primary);
    font-family: var(--rv-font);
    font-size: max(var(--text-sm), var(--rv-field-floor));
  }

  .compound-form input:focus {
    outline: none;
  }

  .code-feedback {
    margin: 0.5rem 0 0;
    font-size: var(--text-xs);
    color: var(--rv-success);
  }

  .code-feedback[data-tone='error'] {
    color: var(--rv-danger);
  }

  /* Basket Drawer */
  .player-strip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.625rem 0.875rem;
    border-radius: var(--rv-radius-control);
    background-color: var(--rv-fill-faint);
    box-shadow: inset 0 0 0 1px var(--rv-stroke-soft);
    font-size: var(--text-control);
  }

  .player-strip-label {
    color: var(--rv-text-muted);
  }

  .text-link {
    border: 0;
    padding: 0;
    background: transparent;
    color: var(--rv-text-primary);
    font-size: var(--text-control);
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
  }

  .basket-list {
    list-style: none;
    margin: 0;
    padding: 0;
  }

  .basket-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding-block: 0.75rem;
    border-block-end: 1px solid var(--rv-stroke-soft);
  }

  .basket-row-name {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--rv-text-primary);
  }

  .basket-row-meta {
    font-size: var(--text-xs);
    color: var(--rv-text-muted);
    font-variant-numeric: tabular-nums;
  }

  .empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 2.5rem 1rem;
    gap: 0.375rem;
  }

  .empty-icon {
    color: var(--rv-text-dim);
    margin-block-end: 0.25rem;
  }

  .empty-title {
    margin: 0;
    font-size: var(--text-title);
    font-weight: 600;
    color: var(--rv-text-primary);
  }

  .empty-desc {
    margin: 0;
    font-size: var(--text-control);
    color: var(--rv-text-muted);
    max-inline-size: 30ch;
  }

  .total-line {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
  }

  .total-label {
    font-size: var(--text-sm);
    color: var(--rv-text-secondary);
  }

  @media (forced-colors: active) {
    .pkg-card,
    dialog.sheet,
    .ctrl {
      border: 1px solid CanvasText;
    }
  }

  @media (max-width: 48rem) {
    .note-list {
      grid-template-columns: 1fr;
    }

    #copyIpBtn {
      display: none;
    }

    dialog.sheet-drawer {
      inline-size: 100vw;
      border-radius: 0;
    }
  }
}
