/* wisper — shared design system
   Dark graphite studio lit from above, holographic foil as the one accent.
   Surfaces are physical: raised slabs with a visible edge, recessed wells
   for anything you type into or read from, glass cards with foil ink.
   Page styles (home.css, download.css, …) build on these pieces. */

@property --rim {
  syntax: "<number>";
  inherits: true;
  initial-value: 0.16;
}

:root {
  --bg:       #0A090E;
  --spot:     #1E1B28;
  --face-hi:  #221F2D;
  --face:     #16141D;
  --face-lo:  #110F17;
  --well:     #0D0C12;
  --raise:    #1C1A25;
  --line:     rgba(255, 255, 255, 0.07);
  --line-hi:  rgba(255, 255, 255, 0.14);

  --text:     #F2F0F7;
  --muted:    #A3A0B4;
  --dim:      #646077;
  --danger:   #FF6B81;
  --ok:       #7CF7FF;
  --warn:     #FFE08A;
  --violet:   #A08CFF;

  /* Holographic foil — one material, used for edges, ink and card backs. */
  --holo: linear-gradient(115deg, #7CF7FF 0%, #A08CFF 28%, #FF8BD6 52%, #FFE08A 76%, #7CF7FF 100%);
  --edge: linear-gradient(180deg, #2A2736 0%, #15131C 55%, #0C0B11 100%);

  --display: "Unbounded", "Hanken Grotesk", system-ui, sans-serif;
  --ui:      "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --code:    ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;

  --gutter:  clamp(16px, 4vw, 48px);
  --thick:   22px;
  --radius:  30px;

  --ease:     cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --spring:   cubic-bezier(0.34, 1.36, 0.5, 1);

  /* Pointer-driven, written by site.js each frame (-1 … 1). */
  --nx: 0;
  --ny: 0;

  color-scheme: dark;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--ui);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

[hidden] { display: none !important; }
a { color: inherit; }
img, svg, video { display: block; }
button { font: inherit; color: inherit; }
::selection { background: var(--violet); color: var(--bg); }

:focus-visible {
  outline: 2px solid var(--violet);
  outline-offset: 3px;
}

* { scrollbar-width: thin; scrollbar-color: #2C2938 transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #2C2938; border: 3px solid transparent; border-radius: 99px; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

code, kbd, pre, .mono { font-family: var(--code); }

/* ── Shell: studio lighting from above ──────────────────────────────────── */

.shell {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background:
    radial-gradient(ellipse 62% 58% at 50% -6%, var(--spot) 0%, rgba(30, 27, 40, 0) 72%),
    var(--bg);
  overflow-x: clip;
}

/* Foil light that spills onto the backdrop while something is in play. */
.shell::before {
  content: "";
  position: absolute;
  left: 50%;
  top: var(--glow-y, 46%);
  width: min(1100px, 120vw);
  height: 520px;
  translate: -50% -50%;
  background:
    radial-gradient(closest-side at 30% 55%, rgba(124, 247, 255, 0.16), transparent),
    radial-gradient(closest-side at 70% 50%, rgba(255, 139, 214, 0.14), transparent),
    radial-gradient(closest-side at 50% 40%, rgba(160, 140, 255, 0.14), transparent);
  filter: blur(30px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 900ms var(--ease);
}
.shell.dragging::before,
.shell.is-busy::before { opacity: 0.7; }
.shell.is-done::before,
.shell.glow::before { opacity: 1; }

/* ── Header ─────────────────────────────────────────────────────────────── */

.bar {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 68px;
  padding: env(safe-area-inset-top) var(--gutter) 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex: none;
  text-decoration: none;
}
.brand-tile {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: var(--holo);
  background-size: 200% 200%;
  background-position: calc(50% + var(--nx) * 30%) calc(50% + var(--ny) * 30%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.6),
    inset 0 -2px 0 rgba(0, 0, 0, 0.18),
    0 6px 14px -4px rgba(160, 140, 255, 0.55);
  transform: perspective(160px) rotateX(16deg) rotateY(-20deg);
}
.brand-word {
  font-family: var(--display);
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -0.01em;
}

.nav {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  opacity: 0;
  transition: opacity 240ms var(--ease);
}
.nav.ready { opacity: 1; }
.nav-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  height: 38px;
  padding: 0 14px;
  border: 0;
  border-radius: 11px;
  background: none;
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: color 160ms var(--ease), background-color 160ms var(--ease);
}
.nav-link:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); }
.nav-link[aria-current="page"] { color: var(--text); }
.nav-link[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 3px;
  width: 14px;
  height: 2px;
  margin-left: -7px;
  border-radius: 2px;
  background: var(--holo);
  background-size: 300% 100%;
}
.nav-cta {
  margin-left: 6px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 0 0 1px var(--line-hi), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.nav-cta:hover { background: rgba(255, 255, 255, 0.1); }
.nav-cta[aria-current="page"]::after { display: none; }
.nav-links { display: contents; }
.nav-menu { display: none; }

/* Narrow screens: secondary links fold into a sheet under a menu button. */
@media (max-width: 640px) {
  .nav { position: relative; gap: 2px; }
  .nav-menu {
    display: inline-grid;
    place-items: center;
    width: 40px;
    height: 38px;
    border: 0;
    border-radius: 11px;
    background: none;
    color: var(--muted);
    cursor: pointer;
  }
  .nav-menu:hover,
  .nav.open .nav-menu { color: var(--text); background: rgba(255, 255, 255, 0.06); }
  .nav-links {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    z-index: 20;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 200px;
    padding: 8px;
    border-radius: 18px;
    background: linear-gradient(180deg, #24212F 0%, #18161F 100%);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.1),
      inset 0 0 0 1px var(--line-hi),
      0 6px 0 -1px #0E0D13,
      0 30px 60px -20px rgba(0, 0, 0, 0.9);
    transform-origin: 90% 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px) scale(0.96) rotateX(14deg);
    transition: opacity 180ms var(--ease), transform 380ms var(--spring), visibility 0s linear 380ms;
  }
  .nav.open .nav-links {
    opacity: 1;
    visibility: visible;
    transform: none;
    transition: opacity 180ms var(--ease), transform 380ms var(--spring), visibility 0s;
  }
  .nav-links .nav-link { height: 44px; padding: 0 14px; font-size: 16px; }
  .nav-links .nav-link[aria-current="page"]::after { left: auto; right: 14px; bottom: 50%; margin: 0 0 -1px; }
}

/* ── Page head (non-home pages) ─────────────────────────────────────────── */

.page-title {
  margin: 0;
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(26px, 1rem + 1.9vw, 42px);
  line-height: 1.1;
  letter-spacing: -0.035em;
  text-wrap: balance;
}
.page-lede {
  margin: 10px 0 0;
  max-width: 60ch;
  font-size: clamp(15px, 0.9rem + 0.2vw, 17px);
  color: var(--muted);
  text-wrap: pretty;
}

.holo-ink {
  background: var(--holo);
  background-size: 260% 260%;
  background-position: calc(50% + var(--nx) * 70%) calc(50% + var(--ny) * 70%);
  -webkit-background-clip: text;
          background-clip: text;
  color: transparent;
}

/* ── Buttons ────────────────────────────────────────────────────────────── */

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  height: 50px;
  padding: 0 24px;
  border: 0;
  border-radius: 14px;
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform 160ms var(--ease), background-color 160ms var(--ease), box-shadow 160ms var(--ease), color 160ms var(--ease), opacity 160ms var(--ease);
}
.btn:active { transform: translateY(1px) scale(0.98); }
.btn svg { flex: none; }
.btn:disabled,
.btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; transform: none; }

.btn-solid {
  color: #120F1A;
  background: linear-gradient(180deg, #FFFFFF 0%, #E4E1EE 100%);
  box-shadow:
    inset 0 1px 0 #FFFFFF,
    inset 0 -2px 0 rgba(18, 15, 26, 0.14),
    0 1px 0 rgba(0, 0, 0, 0.4),
    0 12px 28px -12px rgba(200, 190, 255, 0.55);
}
.btn-solid:hover:not(:disabled) { background: linear-gradient(180deg, #FFFFFF 0%, #EEEBF6 100%); }

.btn-glass {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 0 0 1px var(--line-hi), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.btn-glass:hover:not(:disabled) { background: rgba(255, 255, 255, 0.1); }

.btn-text {
  padding: 0 14px;
  color: var(--muted);
  background: none;
}
.btn-text:hover:not(:disabled) { color: var(--text); }

.btn-danger {
  color: #22070D;
  background: linear-gradient(180deg, #FF95A5 0%, #F4566F 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    inset 0 -2px 0 rgba(60, 0, 14, 0.2),
    0 1px 0 rgba(0, 0, 0, 0.4),
    0 12px 28px -12px rgba(255, 107, 129, 0.6);
}
.btn-danger:hover:not(:disabled) { background: linear-gradient(180deg, #FFA6B3 0%, #F86680 100%); }

.btn-sm { height: 38px; padding: 0 16px; border-radius: 11px; font-size: 14px; gap: 7px; }
.btn-block { width: 100%; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color 160ms var(--ease), background-color 160ms var(--ease), transform 160ms var(--ease);
}
.icon-btn:hover { color: var(--text); background: rgba(255, 255, 255, 0.07); }
.icon-btn:active { transform: scale(0.92); }
.icon-btn.done { color: var(--ok); }
.icon-btn.danger:hover { color: var(--danger); background: rgba(255, 107, 129, 0.1); }

/* Holographic busy ring */
.spinner {
  display: inline-block;
  flex: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, rgba(124, 247, 255, 0), #7CF7FF 30%, #A08CFF 55%, #FF8BD6 80%, #FFE08A);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 2.5px), #000 calc(100% - 2px));
          mask: radial-gradient(farthest-side, transparent calc(100% - 2.5px), #000 calc(100% - 2px));
  animation: spin 800ms linear infinite;
}
.btn-solid .spinner { background: conic-gradient(from 0deg, rgba(18, 15, 26, 0), #120F1A); }
@keyframes spin { to { transform: rotate(360deg); } }

kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 6px;
  background: #1E1C27;
  box-shadow: inset 0 -1.5px 0 rgba(0, 0, 0, 0.5), inset 0 0 0 1px var(--line-hi);
  font-family: var(--ui);
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  vertical-align: 1px;
}

/* ── Raised slab: a lit face on a visible edge ──────────────────────────── */

.slab {
  --rim: 0.16;
  --r: 26px;
  --t: 14px;
  position: relative;
  isolation: isolate;
  border-radius: var(--r);
  transition: --rim 400ms var(--ease);
}
.slab::before {
  /* face + foil rim (gradient-border trick; --rim dims the foil) */
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border: 1.5px solid transparent;
  border-radius: inherit;
  background:
    radial-gradient(130% 90% at 50% 0%, var(--face-hi) 0%, var(--face) 55%, var(--face-lo) 100%) padding-box,
    linear-gradient(rgba(18, 16, 25, calc(1 - var(--rim))), rgba(18, 16, 25, calc(1 - var(--rim)))) border-box,
    var(--holo) border-box;
  background-size: auto, auto, 200% 200%;
  background-position: 0 0, 0 0, calc(50% + var(--nx) * 50%) calc(50% + var(--ny) * 50%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07);
}
.slab::after {
  /* edge: darker copy pushed down; fills with foil as --p rises */
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  border-radius: inherit;
  background:
    linear-gradient(180deg, rgba(10, 9, 14, 0.62) 0%, rgba(10, 9, 14, 0) 92%),
    linear-gradient(90deg, transparent 0 calc(var(--p, 0) * 100%), #17151E calc(var(--p, 0) * 100%)),
    var(--holo);
  background-size: auto, auto, 160% 100%;
  background-position: 0 0, 0 0, calc(50% + var(--nx) * 40%) 50%;
  box-shadow:
    inset 0 -1px 0 rgba(255, 255, 255, 0.08),
    0 34px 60px -26px rgba(0, 0, 0, 0.9);
  transform: translate(calc(var(--nx) * -4px), var(--t));
}
.slab:focus-within { --rim: 0.42; }
.slab.lit { --rim: 0.9; }
.slab.warn { --rim: 0.55; }
.slab.warn::before {
  background:
    radial-gradient(130% 90% at 50% 0%, var(--face-hi) 0%, var(--face) 55%, var(--face-lo) 100%) padding-box,
    linear-gradient(rgba(255, 107, 129, 0.6), rgba(255, 107, 129, 0.6)) border-box;
}

/* Recessed well — anything you type into or read from */
.well {
  border-radius: 16px;
  background: var(--well);
  box-shadow:
    inset 0 2px 8px rgba(0, 0, 0, 0.6),
    inset 0 0 0 1px var(--line),
    0 1px 0 rgba(255, 255, 255, 0.04);
}

/* ── Forms ──────────────────────────────────────────────────────────────── */

.field { display: grid; gap: 8px; min-width: 0; }
.field + .field { margin-top: 16px; }
.field-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
}
.field-note { font-weight: 500; color: var(--dim); }
.field-hint { font-size: 13px; color: var(--dim); }

.input {
  display: block;
  width: 100%;
  min-width: 0;
  height: 50px;
  padding: 0 16px;
  border: 0;
  border-radius: 14px;
  background: var(--well);
  box-shadow:
    inset 0 2px 8px rgba(0, 0, 0, 0.6),
    inset 0 0 0 1px var(--line),
    0 1px 0 rgba(255, 255, 255, 0.04);
  font: inherit;
  font-size: 16px;
  font-weight: 500;
  color: var(--text);
  transition: box-shadow 180ms var(--ease);
}
textarea.input { height: auto; min-height: 96px; padding: 13px 16px; line-height: 1.45; resize: vertical; }
.input::placeholder { color: var(--dim); opacity: 1; }
.input:hover { box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.6), inset 0 0 0 1px var(--line-hi), 0 1px 0 rgba(255, 255, 255, 0.04); }
.input:focus {
  outline: none;
  box-shadow:
    inset 0 2px 8px rgba(0, 0, 0, 0.6),
    inset 0 0 0 1.5px var(--violet),
    0 0 0 4px rgba(160, 140, 255, 0.16);
}
.input[aria-invalid="true"] { box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.6), inset 0 0 0 1.5px var(--danger); }
.input.mono { font-family: var(--code); font-size: 15px; }

/* Toggle switch: a recessed track with a raised knob */
.switch {
  position: relative;
  flex: none;
  width: 44px;
  height: 26px;
  border-radius: 99px;
  background: var(--well);
  box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.7), inset 0 0 0 1px var(--line);
  transition: background 220ms var(--ease);
}
.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(180deg, #4A4659 0%, #34313F 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 2px 5px rgba(0, 0, 0, 0.6);
  transition: transform 300ms var(--spring), background 220ms var(--ease);
}
[aria-checked="true"] > .switch,
[aria-pressed="true"] > .switch,
input:checked + .switch {
  background: var(--holo);
  background-size: 200% 100%;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.35);
}
[aria-checked="true"] > .switch::after,
[aria-pressed="true"] > .switch::after,
input:checked + .switch::after {
  transform: translateX(18px);
  background: linear-gradient(180deg, #FFFFFF 0%, #E4E1EE 100%);
}

/* Segmented control with a sliding raised thumb */
.seg {
  position: relative;
  display: inline-flex;
  padding: 3px;
  border-radius: 11px;
  background: var(--well);
  box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.6), inset 0 0 0 1px var(--line);
  isolation: isolate;
}
.seg-thumb {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 0;
  width: 0;
  border-radius: 8px;
  background: linear-gradient(180deg, #2E2B3B 0%, #22202C 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 3px 8px -2px rgba(0, 0, 0, 0.7);
  z-index: -1;
  transition: transform 380ms var(--ease-out), width 380ms var(--ease-out);
}
.seg.no-anim .seg-thumb { transition: none; }
.seg-opt {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  padding: 0 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
  cursor: pointer;
  transition: color 160ms var(--ease), opacity 160ms var(--ease);
}
.seg-opt:hover { color: var(--text); }
.seg-opt input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.seg-opt:has(input:checked) { color: var(--text); }
.seg-opt:has(input:focus-visible) { outline: 2px solid var(--violet); outline-offset: 1px; }
.seg-opt:has(input:disabled) { opacity: 0.4; cursor: not-allowed; }

/* ── Notices ────────────────────────────────────────────────────────────── */

.notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 15px;
  line-height: 1.45;
  background: rgba(255, 255, 255, 0.04);
  box-shadow: inset 0 0 0 1px var(--line);
  color: var(--text);
}
.notice svg { flex: none; margin-top: 2px; }
.notice-error { background: rgba(255, 107, 129, 0.08); box-shadow: inset 0 0 0 1px rgba(255, 107, 129, 0.28); }
.notice-error svg { color: var(--danger); }
.notice-ok { background: rgba(124, 247, 255, 0.07); box-shadow: inset 0 0 0 1px rgba(124, 247, 255, 0.24); }
.notice-ok svg { color: var(--ok); }
.notice-warn { background: rgba(255, 224, 138, 0.07); box-shadow: inset 0 0 0 1px rgba(255, 224, 138, 0.24); }
.notice-warn svg { color: var(--warn); }
.notice strong { font-weight: 600; }
.notice code { font-size: 0.9em; padding: 1px 6px; border-radius: 6px; background: rgba(255, 255, 255, 0.07); }

/* ── Glass card + foil (file cards everywhere) ──────────────────────────── */

.glass {
  position: relative;
  border-radius: 16px;
  background: linear-gradient(160deg, #2D293B 0%, #1C1926 46%, #141219 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    inset 0 0 0 1px rgba(255, 255, 255, 0.07);
  overflow: hidden;
}
.glass::before {
  /* foil rim */
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  padding: 1px;
  border-radius: inherit;
  background: var(--holo);
  background-size: 220% 220%;
  background-position: calc(50% + var(--nx) * 60%) calc(50% + var(--ny) * 60%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  opacity: 0.5;
  pointer-events: none;
}
.glare {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: radial-gradient(circle at calc(50% + var(--nx) * 60%) calc(30% + var(--ny) * 50%), rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0) 55%);
  pointer-events: none;
}
.foil {
  color: #120F1A;
  background: var(--holo);
  background-size: 240% 240%;
  background-position: calc(50% + var(--nx) * 60%) calc(50% + var(--ny) * 60%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}

/* ── Tray scene (home drop tray, download plinth, bundle tray) ──────────── */

.scene {
  position: relative;
  width: var(--tray-w, min(860px, 100%));
  perspective: 1500px;
  perspective-origin: 50% -30%;
}
.rig {
  transform-style: preserve-3d;
  transform:
    rotateX(calc(var(--tilt, 20deg) + var(--ny) * -4deg))
    rotateY(calc(var(--nx) * 6deg));
}
.tray {
  position: relative;
  height: var(--tray-h, 300px);
  transform-style: preserve-3d;
  transition: transform 650ms var(--spring);
}
.shell.dragging .tray { transform: translateZ(34px); }

.tray-base {
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  background: var(--edge);
  box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.08);
  transform: translate3d(calc(var(--nx) * -5px), var(--thick), -2px);
  overflow: hidden;
}
.tray-base-fill {
  position: absolute;
  inset: 0;
  background: var(--holo);
  background-size: 160% 100%;
  background-position: calc(50% + var(--nx) * 40%) 50%;
  clip-path: inset(0 calc((1 - var(--p, 0)) * 100%) 0 0);
  opacity: 0.95;
}
.tray-base-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(10, 9, 14, 0.6) 0%, rgba(10, 9, 14, 0) 92%);
}

.tray-face {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: radial-gradient(120% 95% at 50% 0%, var(--face-hi) 0%, var(--face) 52%, var(--face-lo) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.09),
    inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  outline-offset: 6px;
  -webkit-tap-highlight-color: transparent;
}
.tray-face::before {
  /* recessed well */
  content: "";
  position: absolute;
  inset: 16px;
  border-radius: calc(var(--radius) - 12px);
  background: var(--well);
  box-shadow:
    inset 0 3px 14px rgba(0, 0, 0, 0.7),
    inset 0 -1px 0 rgba(255, 255, 255, 0.05),
    0 1px 0 rgba(255, 255, 255, 0.04);
  transition: background-color 400ms var(--ease);
}
.tray-face::after {
  /* foil rim */
  content: "";
  position: absolute;
  inset: 0;
  padding: 1.5px;
  border-radius: inherit;
  background: var(--holo);
  background-size: 200% 200%;
  background-position: calc(50% + var(--nx) * 50%) calc(50% + var(--ny) * 50%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  opacity: 0.16;
  pointer-events: none;
  transition: opacity 400ms var(--ease);
}
.shell.dragging .tray-face::after,
.shell.is-busy .tray-face::after,
.shell.is-done .tray-face::after { opacity: 0.9; }

.well-glow {
  position: absolute;
  inset: 16px;
  border-radius: calc(var(--radius) - 12px);
  background:
    radial-gradient(closest-side at 32% 60%, rgba(124, 247, 255, 0.22), transparent),
    radial-gradient(closest-side at 68% 45%, rgba(255, 139, 214, 0.2), transparent),
    radial-gradient(closest-side at 50% 50%, rgba(160, 140, 255, 0.18), transparent);
  opacity: 0;
  transition: opacity 500ms var(--ease);
  pointer-events: none;
}
.shell.dragging .well-glow { opacity: 1; }
.shell.is-busy .well-glow { opacity: calc(0.25 + var(--p, 0) * 0.75); transition-duration: 120ms; }
.shell.is-done .well-glow { opacity: 1; }

.floor-shadow {
  position: absolute;
  left: 7%;
  right: 7%;
  bottom: calc(var(--thick) * -1 - 34px);
  height: 64px;
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.75) 0%, rgba(0, 0, 0, 0) 70%);
  filter: blur(8px);
  pointer-events: none;
  transition: transform 650ms var(--spring), opacity 650ms var(--ease);
}
.shell.dragging .floor-shadow { transform: scale(0.9, 1.15); opacity: 0.6; }

/* Error: the tray shudders and the rim warms. */
.shell.is-error .tray { animation: shake 420ms var(--ease); }
.shell.is-error .tray-face::after { background: var(--danger); opacity: 0.55; }
@keyframes shake {
  0%, 100% { translate: 0 0; }
  20% { translate: -9px 0; }
  40% { translate: 7px 0; }
  60% { translate: -4px 0; }
  80% { translate: 2px 0; }
}

/* ── Link box + terminal command ────────────────────────────────────────── */

.linkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(620px, 100%);
  padding: 6px 6px 6px 18px;
  border-radius: 16px;
  background: var(--well);
  box-shadow:
    inset 0 2px 8px rgba(0, 0, 0, 0.6),
    inset 0 0 0 1px var(--line),
    0 1px 0 rgba(255, 255, 255, 0.05);
}
.linkbox input {
  flex: 1;
  min-width: 0;
  height: 44px;
  border: 0;
  background: none;
  font: inherit;
  font-size: 16px;
  font-weight: 500;
  color: var(--text);
  text-overflow: ellipsis;
}
.linkbox input:focus { outline: none; }
.linkbox .btn { height: 44px; border-radius: 11px; padding: 0 18px; }

.cmd {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding: 3px 3px 3px 14px;
  border-radius: 11px;
  background: var(--well);
  box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.6), inset 0 0 0 1px var(--line);
}
.cmd code {
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  white-space: nowrap;
  font-size: 13px;
  color: var(--text);
  scrollbar-width: none;
}
.cmd code::-webkit-scrollbar { display: none; }

/* ── Footer ─────────────────────────────────────────────────────────────── */

.foot {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px 32px;
  padding: 14px var(--gutter) calc(18px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
}
.foot-left,
.foot-right {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}
.foot-label { flex: none; font-size: 14px; color: var(--dim); }
.foot-text { font-size: 14px; color: var(--muted); }
.foot-text a { color: var(--text); text-decoration-color: var(--line-hi); text-underline-offset: 3px; }
.foot-link { margin-left: 14px; }

/* ── Toasts ─────────────────────────────────────────────────────────────── */

.w-toast-stack {
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom));
  z-index: 300;
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 10px;
  width: min(440px, calc(100vw - 32px));
  translate: -50% 0;
  pointer-events: none;
}
.w-toast {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  width: 100%;
  padding: 13px 10px 13px 15px;
  border-radius: 16px;
  background: linear-gradient(180deg, #24212F 0%, #18161F 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    inset 0 0 0 1px var(--line-hi),
    0 6px 0 -1px #0E0D13,
    0 24px 50px -18px rgba(0, 0, 0, 0.9);
  pointer-events: auto;
  opacity: 0;
  transform: translateY(18px) scale(0.96) rotateX(24deg);
  transform-origin: 50% 100%;
  transition: opacity 260ms var(--ease), transform 520ms var(--spring);
}
.w-toast.in { opacity: 1; transform: none; }
.w-toast.out { opacity: 0; transform: translateY(10px) scale(0.97); transition-duration: 200ms; }
.w-toast-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
}
.w-toast-success .w-toast-icon { color: #120F1A; background: var(--holo); background-size: 200% 200%; }
.w-toast-danger .w-toast-icon { color: var(--danger); background: rgba(255, 107, 129, 0.12); }
.w-toast-warn .w-toast-icon { color: var(--warn); background: rgba(255, 224, 138, 0.1); }
.w-toast-body { flex: 1; min-width: 0; padding-top: 2px; }
.w-toast-title { font-size: 15px; font-weight: 600; line-height: 1.3; }
.w-toast-message { font-size: 15px; line-height: 1.4; color: var(--muted); overflow-wrap: anywhere; }
.w-toast-title + .w-toast-message { margin-top: 2px; }
.w-toast-body > .w-toast-message:only-child { color: var(--text); }
.w-toast-close {
  display: grid;
  place-items: center;
  flex: none;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--dim);
  cursor: pointer;
}
.w-toast-close:hover { color: var(--text); background: rgba(255, 255, 255, 0.07); }

/* ── Modal ──────────────────────────────────────────────────────────────── */

.w-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 250;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background: rgba(6, 5, 9, 0.66);
  -webkit-backdrop-filter: blur(10px) saturate(120%);
          backdrop-filter: blur(10px) saturate(120%);
  perspective: 1200px;
  opacity: 0;
  transition: opacity 220ms var(--ease);
  overflow-y: auto;
}
.w-modal-overlay.in { opacity: 1; }
.w-modal-overlay.out { opacity: 0; }
.w-modal-card {
  width: min(460px, 100%);
  padding: 26px 26px 22px;
  transform: translateY(26px) rotateX(18deg) scale(0.96);
  transform-origin: 50% 0;
  transition: transform 560ms var(--spring);
}
.w-modal-overlay.in .w-modal-card { transform: none; }
.w-modal-overlay.out .w-modal-card { transform: translateY(12px) scale(0.98); transition-duration: 200ms; }
.w-modal-title {
  margin: 0;
  font-family: var(--display);
  font-weight: 600;
  font-size: 21px;
  line-height: 1.2;
  letter-spacing: -0.03em;
}
.w-modal-message { margin-top: 8px; font-size: 15px; color: var(--muted); overflow-wrap: anywhere; }
.w-modal-message strong, .w-modal-message b { color: var(--text); font-weight: 600; }
.w-modal-message code { font-size: 0.9em; padding: 1px 6px; border-radius: 6px; background: rgba(255, 255, 255, 0.07); color: var(--text); }
.w-modal-field { margin-top: 18px; }
.w-modal-input-err { min-height: 20px; margin-top: 6px; font-size: 14px; color: var(--danger); }
.w-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 22px;
}
.w-modal-actions .btn { height: 44px; padding: 0 18px; border-radius: 12px; font-size: 15px; }

/* ── Motion ─────────────────────────────────────────────────────────────── */

@keyframes lift-in {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}
@keyframes slab-in {
  from { opacity: 0; transform: perspective(1400px) translateY(40px) rotateX(24deg) scale(0.96); }
  to   { opacity: 1; transform: perspective(1400px) translateY(0) rotateX(0deg) scale(1); }
}
.shell.intro .bar { animation: lift-in 800ms var(--ease-out) 300ms both; }
.shell.intro .rise { animation: lift-in 800ms var(--ease-out) both; }
.shell.intro .settle { animation: slab-in 1000ms var(--ease-out) both; }

/* ── Responsive ─────────────────────────────────────────────────────────── */

@media (max-width: 760px) {
  :root { --radius: 24px; --thick: 16px; }
  .nav-link { padding: 0 10px; font-size: 14px; }
  .nav-cta { margin-left: 2px; }
  .foot { flex-direction: column; align-items: stretch; }
  .foot-left, .foot-right { flex-direction: column; align-items: stretch; gap: 8px; }
  .linkbox { flex-wrap: wrap; padding: 6px; }
  .linkbox input { flex: 1 1 100%; padding: 0 10px; }
  .linkbox .btn { flex: 1 1 100%; }
  .w-modal-card { padding: 22px 20px 18px; }
  .w-modal-actions .btn { flex: 1; }
}

@media (pointer: coarse) {
  .paste-hint { display: none; }
}

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