/* ==========================================================================
   Isilumko AI Agent Library
   iOS-grammar glassmorphism over the Isilumko crimson identity.
   ========================================================================== */

:root {
  /* Brand — anchored to isilumko.co.za (#8e182b crimson, #32373c charcoal) */
  --brand:        oklch(0.44 0.155 17);
  --brand-strong: oklch(0.37 0.15 17);
  --brand-soft:   oklch(0.44 0.155 17 / 0.12);
  --brand-ghost:  oklch(0.44 0.155 17 / 0.06);

  --bg:        oklch(0.958 0.008 17);
  --ink:       oklch(0.25 0.018 255);
  --ink-2:     oklch(0.42 0.022 255);
  --ink-3:     oklch(0.52 0.02 255);

  /* Glass material */
  --glass:        oklch(1 0 0 / 0.58);
  --glass-strong: oklch(1 0 0 / 0.74);
  --glass-edge:   oklch(1 0 0 / 0.72);
  --glass-blur:   saturate(1.6) blur(22px);
  --hairline:     oklch(0.25 0.02 255 / 0.08);

  --shadow-card:  0 1px 1px oklch(0.25 0.05 17 / 0.04), 0 8px 24px -8px oklch(0.3 0.08 17 / 0.14);
  --shadow-float: 0 2px 4px oklch(0.25 0.05 17 / 0.06), 0 20px 48px -12px oklch(0.3 0.09 17 / 0.28);

  --r-card: 22px;
  --r-ctl: 12px;
  --r-pill: 999px;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);      /* ease-out-quint */
  --dur: 200ms;

  /* Semantic z scale */
  --z-nav: 10;
  --z-menu: 20;
  --z-drawer: 30;
  --z-sheet: 30;
  --z-toast: 40;

  font-size: 16px;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

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

body {
  margin: 0;
  min-height: 100dvh;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", Roboto, sans-serif;
  font-size: 1.0625rem; /* iOS body 17px */
  line-height: 1.45;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ---------------------------------------------------------------- backdrop */

.backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background:
    radial-gradient(120% 90% at 85% -10%, oklch(0.9 0.03 17 / 0.9), transparent 60%),
    var(--bg);
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  will-change: transform;
}

.blob-a {
  width: 46vmax; height: 46vmax;
  left: -12vmax; top: -16vmax;
  background: oklch(0.55 0.16 17 / 0.32);
  animation: drift-a 26s var(--ease-out) infinite alternate;
}

.blob-b {
  width: 38vmax; height: 38vmax;
  right: -14vmax; top: 8vmax;
  background: oklch(0.62 0.1 35 / 0.26);
  animation: drift-b 32s var(--ease-out) infinite alternate;
}

.blob-c {
  width: 42vmax; height: 42vmax;
  left: 24vmax; bottom: -26vmax;
  background: oklch(0.45 0.045 255 / 0.2);
  animation: drift-c 38s var(--ease-out) infinite alternate;
}

@keyframes drift-a { to { transform: translate(9vmax, 7vmax) scale(1.12); } }
@keyframes drift-b { to { transform: translate(-7vmax, 9vmax) scale(0.92); } }
@keyframes drift-c { to { transform: translate(-9vmax, -7vmax) scale(1.08); } }

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

.topbar {
  position: sticky;
  top: 0;
  z-index: var(--z-nav);
  background: oklch(1 0 0 / 0.5);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--hairline);
}

.topbar-inner {
  max-width: 1180px;
  margin-inline: auto;
  padding: 12px clamp(16px, 4vw, 32px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar-lead {
  display: flex;
  align-items: center;
  gap: 6px;
}

.menu-btn {
  display: grid;
  place-items: center;
  width: 40px; height: 40px;
  margin-left: -8px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  transition: background var(--dur) var(--ease-out);
}

.menu-btn:hover { background: oklch(0.25 0.02 255 / 0.07); }

.menu-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3.5px var(--brand-soft), 0 0 0 1.5px var(--brand);
}

.wordmark {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  min-height: 44px;
}

.wordmark-badge {
  display: block;
  width: 34px; height: 34px;
  border-radius: 8px; /* logo's own corner radius at this size */
  filter: drop-shadow(0 3px 8px oklch(0.44 0.155 17 / 0.4));
}

.wordmark-text {
  font-weight: 700;
  font-size: 1.0625rem;
  letter-spacing: -0.01em;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.wordmark-sub {
  font-weight: 500;
  font-size: 0.8125rem;
  color: var(--ink-2);
  letter-spacing: 0.01em;
}

.add-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 44px;
  padding: 0 16px 0 13px;
  border: 0;
  border-radius: var(--r-pill);
  background: var(--brand);
  color: white;
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 14px -3px oklch(0.44 0.155 17 / 0.5);
  transition: transform var(--dur) var(--ease-out), background var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out);
}

.add-btn:hover { background: var(--brand-strong); transform: translateY(-1px); }
.add-btn:active { transform: scale(0.97); }

/* ------------------------------------------------------------------- shell */

.shell {
  max-width: 1180px;
  margin-inline: auto;
  padding: clamp(28px, 5vw, 52px) clamp(16px, 4vw, 32px) 96px;
}

.hero { margin-bottom: clamp(24px, 4vw, 36px); }

.hero h1 {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI Variable Display", "Segoe UI", Roboto, sans-serif;
  font-size: clamp(2rem, 4.5vw, 2.75rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.hero-sub {
  margin: 6px 0 0;
  font-size: 1.0625rem;
  color: var(--ink-2);
  max-width: 60ch;
}

.hero-tools {
  margin-top: 22px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.search {
  position: relative;
  flex: 1 1 260px;
  max-width: 380px;
}

.search-glyph {
  position: absolute;
  left: 13px; top: 50%;
  translate: 0 -50%;
  color: var(--ink-3);
  pointer-events: none;
}

.search input {
  width: 100%;
  min-height: 44px;
  padding: 0 14px 0 38px;
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: var(--glass);
  border: 1px solid var(--glass-edge);
  border-radius: var(--r-ctl);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--shadow-card);
  outline: none;
  transition: border-color var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out);
}

.search input::placeholder { color: var(--ink-3); }
.search input::-webkit-search-cancel-button { -webkit-appearance: none; }

.search input:focus-visible {
  border-color: oklch(0.44 0.155 17 / 0.55);
  box-shadow: 0 0 0 3.5px var(--brand-soft), var(--shadow-card);
}

.count {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------- platforms */

.platforms {
  margin-bottom: clamp(22px, 3.5vw, 30px);
}

.platforms-title {
  margin: 0 0 10px;
  font-size: 0.9375rem;
  font-weight: 650;
  color: var(--ink-2);
}

.platform-row {
  list-style: none;
  margin: 0;
  padding: 2px 2px 10px;
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.platform-row::-webkit-scrollbar { display: none; }

.platform-row li {
  flex: 0 0 auto;
  scroll-snap-align: start;
  animation: card-in 420ms var(--ease-out) both;
}

.platform-row li:nth-child(1) { animation-delay: 0ms; }
.platform-row li:nth-child(2) { animation-delay: 30ms; }
.platform-row li:nth-child(3) { animation-delay: 60ms; }
.platform-row li:nth-child(4) { animation-delay: 90ms; }
.platform-row li:nth-child(5) { animation-delay: 120ms; }

.platform-card {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 44px;
  padding: 0 16px 0 6px;
  text-decoration: none;
  color: var(--ink);
  background: var(--glass);
  border: 1px solid var(--glass-edge);
  border-radius: 16px;
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--shadow-card);
  cursor: pointer;
  white-space: nowrap;
  transition: transform var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out), background var(--dur) var(--ease-out);
}

.platform-card:hover {
  transform: translateY(-2px);
  background: var(--glass-strong);
  box-shadow: var(--shadow-float);
}

.platform-card:active { transform: translateY(-1px) scale(0.98); }

.platform-card:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3.5px var(--brand-soft), 0 0 0 1.5px var(--brand), var(--shadow-card);
}

.platform-icon {
  flex: 0 0 auto;
  width: 28px; height: 28px;
  border-radius: 8px;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: white;
  border: 1px solid var(--hairline);
}

.platform-icon img {
  width: 100%; height: 100%;
  object-fit: cover;
}

.platform-icon.monogram {
  color: white;
  font-weight: 700;
  font-size: 0.8125rem;
  border: 0;
}

.platform-name {
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -0.005em;
}

/* -------------------------------------------------------------------- grid */

.grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.card-wrap {
  position: relative;
  animation: card-in 500ms var(--ease-out) both;
  animation-delay: calc(var(--i, 0) * 40ms);
}

@keyframes card-in {
  from { opacity: 0; transform: translateY(14px) scale(0.98); }
}

.card {
  display: flex;
  flex-direction: column;
  gap: 13px;
  height: 100%;
  padding: 18px 18px 16px;
  text-decoration: none;
  color: inherit;
  background: var(--glass);
  border: 1px solid var(--glass-edge);
  border-radius: var(--r-card);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--shadow-card);
  cursor: pointer;
  transition: transform var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out), background var(--dur) var(--ease-out);
}

.card:hover {
  transform: translateY(-3px);
  background: var(--glass-strong);
  box-shadow: var(--shadow-float);
}

.card:active { transform: translateY(-1px) scale(0.99); }

.card:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3.5px var(--brand-soft), 0 0 0 1.5px var(--brand), var(--shadow-card);
}

.card-top {
  display: flex;
  align-items: center;
  gap: 12px;
}

.card-icon {
  flex: 0 0 auto;
  width: 52px; height: 52px;
  border-radius: 14px;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: white;
  border: 1px solid var(--hairline);
  box-shadow: 0 2px 6px oklch(0.25 0.05 17 / 0.07);
}

.card-icon img {
  width: 100%; height: 100%;
  object-fit: cover;
}

.card-icon.monogram {
  color: white;
  font-weight: 700;
  font-size: 1.35rem;
  border: 0;
}

.card-launch {
  margin-left: auto;
  color: var(--ink-3);
  opacity: 0;
  translate: -4px 0;
  transition: opacity var(--dur) var(--ease-out), translate var(--dur) var(--ease-out), color var(--dur) var(--ease-out);
}

.card:hover .card-launch,
.card:focus-visible .card-launch {
  opacity: 1;
  translate: 0 0;
  color: var(--brand);
}

.card h3 {
  margin: 0;
  font-size: 1.0625rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.card-desc {
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.45;
  color: var(--ink-2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.7em;
}

.card-host {
  margin-top: auto;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--ink-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-menu-btn {
  position: absolute;
  top: 6px; right: 6px;
  width: 44px; height: 44px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: oklch(1 0 0 / 0.5);
  color: var(--ink-3);
  font: inherit;
  cursor: pointer;
  opacity: 0.85;
  transition: opacity var(--dur) var(--ease-out), background var(--dur) var(--ease-out), color var(--dur) var(--ease-out);
}

/* Hover-capable devices (mouse/trackpad): keep the tile clean at rest and
   reveal the action only on proximity, since :hover is always available
   as a discovery cue. Touch devices have no such cue, so the button stays
   visible there (see below) — otherwise it's an invisible tap target. */
@media (hover: hover) {
  .card-menu-btn { background: transparent; opacity: 0; }

  .card-wrap:hover .card-menu-btn,
  .card-menu-btn:focus-visible,
  .card-menu-btn[aria-expanded="true"] {
    opacity: 1;
  }
}

.card-menu-btn:focus-visible,
.card-menu-btn[aria-expanded="true"] {
  opacity: 1;
}

.card-menu-btn:hover,
.card-menu-btn[aria-expanded="true"] {
  background: oklch(0.25 0.02 255 / 0.1);
  color: var(--ink);
}

.card-menu-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--brand-soft), 0 0 0 1.5px var(--brand);
}

/* -------------------------------------------------------------- empty state */

.empty { display: grid; justify-items: center; padding-top: 8px; }

.empty-card {
  display: grid;
  justify-items: center;
  text-align: center;
  gap: 6px;
  max-width: 420px;
  padding: 44px 36px 40px;
  background: var(--glass);
  border: 1px solid var(--glass-edge);
  border-radius: 28px;
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--shadow-card);
}

.empty-glyph {
  display: grid;
  place-items: center;
  width: 84px; height: 84px;
  margin-bottom: 12px;
  border-radius: 24px;
  color: var(--brand);
  background: linear-gradient(165deg, oklch(0.44 0.155 17 / 0.14), oklch(0.44 0.155 17 / 0.05));
  border: 1px solid oklch(0.44 0.155 17 / 0.18);
}

.empty-card h2 {
  margin: 0;
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.empty-card p {
  margin: 0 0 18px;
  color: var(--ink-2);
  font-size: 0.9995rem;
}

.empty-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 20px;
  border: 0;
  border-radius: var(--r-pill);
  background: var(--brand);
  color: white;
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 6px 18px -4px oklch(0.44 0.155 17 / 0.55);
  transition: transform var(--dur) var(--ease-out), background var(--dur) var(--ease-out);
}

.empty-cta:hover { background: var(--brand-strong); transform: translateY(-1px); }
.empty-cta:active { transform: scale(0.97); }

/* ------------------------------------------------------------------- sheet */

.sheet {
  margin: auto auto 0;
  width: min(560px, 100%);
  max-height: min(86dvh, 720px);
  padding: 0;
  border: 1px solid var(--glass-edge);
  border-bottom: 0;
  border-radius: 26px 26px 0 0;
  background: oklch(0.99 0.002 17 / 0.86);
  -webkit-backdrop-filter: saturate(1.7) blur(30px);
  backdrop-filter: saturate(1.7) blur(30px);
  box-shadow: 0 -8px 60px -12px oklch(0.25 0.08 17 / 0.35);
  color: var(--ink);
  overflow: hidden;
}

@media (min-width: 640px) {
  .sheet {
    margin: auto;
    border-radius: 26px;
    border-bottom: 1px solid var(--glass-edge);
  }
}

.sheet::backdrop {
  background: oklch(0.2 0.03 17 / 0.32);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.sheet[open] { animation: sheet-in 420ms var(--ease-out); }
.sheet[open]::backdrop { animation: fade-in 320ms ease-out; }

@keyframes sheet-in {
  from { transform: translateY(48px); opacity: 0; }
}
@keyframes fade-in { from { opacity: 0; } }

.sheet form {
  display: flex;
  flex-direction: column;
  max-height: inherit;
}

.sheet-grabber {
  width: 40px; height: 5px;
  margin: 8px auto 0;
  border-radius: 3px;
  background: oklch(0.25 0.02 255 / 0.16);
}

@media (min-width: 640px) { .sheet-grabber { display: none; } }

.sheet-head {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 10px 16px 12px;
  border-bottom: 1px solid var(--hairline);
}

.sheet-head h2 {
  margin: 0;
  font-size: 1.0625rem;
  font-weight: 650;
  text-align: center;
}

.sheet-cancel,
.sheet-save {
  border: 0;
  background: none;
  font: inherit;
  font-size: 1.0625rem;
  padding: 8px 10px;
  margin: -8px -10px;
  border-radius: 10px;
  cursor: pointer;
  min-height: 44px;
}

.sheet-cancel { color: var(--brand); justify-self: start; }
.sheet-save { color: var(--brand); font-weight: 700; justify-self: end; }

.sheet-save:disabled {
  color: var(--ink-3);
  font-weight: 600;
  cursor: default;
}

.sheet-cancel:focus-visible,
.sheet-save:focus-visible,
.chip-btn:focus-visible,
.detect-btn:focus-visible,
.empty-cta:focus-visible,
.add-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3.5px var(--brand-soft), 0 0 0 1.5px var(--brand);
}

.sheet-body {
  padding: 20px 20px calc(24px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow-y: auto;
}

.field-group { display: flex; flex-direction: column; gap: 7px; }

.field-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ink-2);
}

.sheet-body input[type="text"],
.sheet-body input[type="url"],
.sheet-body textarea {
  width: 100%;
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  padding: 12px 14px;
  background: white;
  border: 1px solid oklch(0.25 0.02 255 / 0.14);
  border-radius: var(--r-ctl);
  outline: none;
  transition: border-color var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out);
}

.sheet-body input::placeholder,
.sheet-body textarea::placeholder { color: var(--ink-3); }

.sheet-body input:focus-visible,
.sheet-body textarea:focus-visible {
  border-color: oklch(0.44 0.155 17 / 0.55);
  box-shadow: 0 0 0 3.5px var(--brand-soft);
}

.sheet-body textarea { resize: vertical; min-height: 76px; }

.url-row { display: flex; gap: 8px; }
.url-row input { flex: 1; }

.detect-btn {
  flex: 0 0 auto;
  padding: 0 16px;
  min-height: 44px;
  border: 0;
  border-radius: var(--r-ctl);
  background: var(--brand);
  color: white;
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--dur) var(--ease-out), transform var(--dur) var(--ease-out), opacity var(--dur) var(--ease-out);
}

.detect-btn:hover:not(:disabled) { background: var(--brand-strong); }
.detect-btn:active:not(:disabled) { transform: scale(0.97); }
.detect-btn:disabled { opacity: 0.55; cursor: default; }

.field-hint {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--ink-2);
  min-height: 1.2em;
}

.field-hint.is-error { color: oklch(0.5 0.19 25); font-weight: 500; }
.field-hint.is-success { color: oklch(0.5 0.14 150); font-weight: 500; }

.field-hint.is-busy::after {
  content: "";
  display: inline-block;
  width: 0.85em; height: 0.85em;
  margin-left: 6px;
  vertical-align: -0.12em;
  border-radius: 50%;
  border: 2px solid oklch(0.44 0.155 17 / 0.25);
  border-top-color: var(--brand);
  animation: spin 700ms linear infinite;
}

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

.detail-fields {
  display: flex;
  flex-direction: column;
  gap: 18px;
  animation: fields-in 360ms var(--ease-out);
}

@keyframes fields-in {
  from { opacity: 0; transform: translateY(8px); }
}

.icon-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.icon-preview {
  flex: 0 0 auto;
  width: 64px; height: 64px;
  border-radius: 16px;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: white;
  border: 1px solid oklch(0.25 0.02 255 / 0.12);
  box-shadow: 0 2px 8px oklch(0.25 0.05 17 / 0.08);
  color: white;
  font-weight: 700;
  font-size: 1.6rem;
}

.icon-preview img { width: 100%; height: 100%; object-fit: cover; }

.icon-row-actions { display: flex; flex-direction: column; gap: 7px; }

.icon-btns { display: flex; gap: 8px; flex-wrap: wrap; }

.chip-btn {
  border: 1px solid oklch(0.25 0.02 255 / 0.16);
  background: white;
  color: var(--ink);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 550;
  padding: 8px 14px;
  border-radius: var(--r-pill);
  cursor: pointer;
  transition: background var(--dur) var(--ease-out), border-color var(--dur) var(--ease-out);
}

.chip-btn:hover { background: oklch(0.97 0.004 17); border-color: oklch(0.25 0.02 255 / 0.28); }

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

.nav-drawer {
  z-index: var(--z-drawer);
  margin: 0 auto 0 0;
  padding: 0;
  width: min(300px, 84vw);
  height: 100dvh;
  max-height: 100dvh;
  max-width: 84vw;
  border: 0;
  border-right: 1px solid var(--glass-edge);
  border-radius: 0 22px 22px 0;
  background: oklch(0.99 0.002 17 / 0.9);
  -webkit-backdrop-filter: saturate(1.7) blur(30px);
  backdrop-filter: saturate(1.7) blur(30px);
  box-shadow: var(--shadow-float);
  color: var(--ink);
  overflow: hidden;
}

.nav-drawer::backdrop {
  background: oklch(0.2 0.03 17 / 0.32);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.nav-drawer[open] { animation: drawer-in 380ms var(--ease-out); }
.nav-drawer[open]::backdrop { animation: fade-in 320ms ease-out; }

@keyframes drawer-in {
  from { transform: translateX(-100%); }
}

.nav-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 12px 16px 18px;
  border-bottom: 1px solid var(--hairline);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 700;
  font-size: 1.0625rem;
  letter-spacing: -0.01em;
}

.nav-brand-badge {
  width: 28px; height: 28px;
  border-radius: 7px;
}

.nav-close {
  display: grid;
  place-items: center;
  width: 36px; height: 36px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  transition: background var(--dur) var(--ease-out);
}

.nav-close:hover { background: oklch(0.25 0.02 255 / 0.07); }

.nav-close:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3.5px var(--brand-soft), 0 0 0 1.5px var(--brand);
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 46px;
  padding: 0 12px;
  border-radius: 12px;
  text-decoration: none;
  color: var(--ink);
  font-size: 0.9375rem;
  font-weight: 550;
  transition: background var(--dur) var(--ease-out);
}

.nav-item:hover { background: oklch(0.25 0.02 255 / 0.06); }

.nav-item:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3.5px var(--brand-soft), 0 0 0 1.5px var(--brand);
}

.nav-item.is-active {
  background: var(--brand-soft);
  color: var(--brand-strong);
  font-weight: 650;
}

.nav-item.is-active .nav-icon { color: var(--brand); }

.nav-icon {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 20px; height: 20px;
  color: var(--ink-2);
}

.nav-label { flex: 1 1 auto; }

.nav-external { flex: 0 0 auto; color: var(--ink-3); }

.nav-group-summary {
  cursor: pointer;
  list-style: none;
}

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

.nav-caret {
  flex: 0 0 auto;
  color: var(--ink-3);
  transition: transform var(--dur) var(--ease-out);
}

.nav-group[open] > .nav-group-summary .nav-caret { transform: rotate(180deg); }

.nav-group-items {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-left: 14px;
  margin-top: 2px;
}

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

.menu {
  position: fixed;
  z-index: var(--z-menu);
  min-width: 208px;
  padding: 5px;
  border-radius: 15px;
  background: oklch(0.99 0.002 17 / 0.85);
  -webkit-backdrop-filter: saturate(1.7) blur(24px);
  backdrop-filter: saturate(1.7) blur(24px);
  border: 1px solid var(--glass-edge);
  box-shadow: var(--shadow-float);
  animation: menu-in 180ms var(--ease-out);
}

@keyframes menu-in {
  from { opacity: 0; transform: scale(0.94) translateY(-4px); }
}

.menu button {
  display: block;
  width: 100%;
  padding: 10px 13px;
  border: 0;
  border-radius: 10px;
  background: none;
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.menu button:hover,
.menu button:focus-visible {
  background: oklch(0.25 0.02 255 / 0.07);
  outline: none;
}

.menu button + button { margin-top: 1px; }

.menu .destructive { color: oklch(0.5 0.19 25); }
.menu .destructive:hover,
.menu .destructive:focus-visible { background: oklch(0.5 0.19 25 / 0.09); }

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

.toast-region {
  position: fixed;
  z-index: var(--z-toast);
  bottom: calc(20px + env(safe-area-inset-bottom));
  left: 50%;
  translate: -50% 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: max-content;
  max-width: calc(100vw - 32px);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 18px;
  border-radius: var(--r-pill);
  background: oklch(0.26 0.02 255 / 0.88);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  color: white;
  font-size: 0.9375rem;
  font-weight: 500;
  box-shadow: var(--shadow-float);
  pointer-events: auto;
  animation: toast-in 320ms var(--ease-out);
}

.toast.leaving { animation: toast-out 260ms var(--ease-out) forwards; }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(14px) scale(0.96); }
}
@keyframes toast-out {
  to { opacity: 0; transform: translateY(10px) scale(0.97); }
}

.toast button {
  border: 0;
  background: none;
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 700;
  color: oklch(0.82 0.09 17);
  cursor: pointer;
  padding: 4px 2px;
  margin: -4px -2px;
  border-radius: 8px;
}

.toast button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px oklch(0.82 0.09 17 / 0.6);
}

/* --------------------------------------------------------- reduced motion */

@media (prefers-reduced-motion: reduce) {
  .blob { animation: none; }
  .card-wrap,
  .platform-row li { animation-duration: 1ms; animation-delay: 0ms; }
  .sheet[open],
  .sheet[open]::backdrop,
  .nav-drawer[open],
  .nav-drawer[open]::backdrop,
  .detail-fields,
  .menu,
  .toast { animation-duration: 1ms; }
  .toast.leaving { animation-duration: 1ms; }
  * { transition-duration: 1ms !important; }
}
