/* DECOMPGAMES — retro-futurist dark workshop design system */

@layer reset, tokens, layout, components, utilities;

@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  * { margin: 0; }
  html { -webkit-text-size-adjust: 100%; }
  body { min-height: 100dvh; line-height: 1.5; -webkit-font-smoothing: antialiased; }
  img, video, canvas, svg { display: block; max-width: 100%; }
  input, button, textarea, select { font: inherit; color: inherit; }
  button { cursor: pointer; background: none; border: none; padding: 0; }
  a { color: inherit; }
  :focus-visible {
    outline: 2px solid var(--cyan);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--cyan) 25%, transparent);
    border-radius: 4px;
  }
}

@layer tokens {
  :root {
    --bg: #0b0d12;
    --surface: #111521;
    --surface-2: #171d2d;
    --border: #232c42;
    --text: #f5f5f4;
    --muted: #94a3b8;
    --amber: #f59e0b;
    --cyan: #22d3ee;
    --emerald: #34d399;
    --violet: #a855f7;
    --rose: #fb7185;
    --mono: "SFMono-Regular", "JetBrains Mono", "Cascadia Mono", ui-monospace, Menlo, Consolas, monospace;
    --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --radius: 10px;
    --radius-sm: 6px;
    --hud-h: auto;
  }
}

@layer layout {
  body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--sans);
    overflow-x: hidden;
  }

  .bg-grid {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background-image:
      linear-gradient(color-mix(in srgb, var(--border) 45%, transparent) 1px, transparent 1px),
      linear-gradient(90deg, color-mix(in srgb, var(--border) 45%, transparent) 1px, transparent 1px);
    background-size: 44px 44px;
    mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, black 30%, transparent 100%);
  }

  .hud {
    position: sticky;
    top: 0;
    z-index: 40;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    padding: 0.6rem clamp(0.75rem, 3vw, 2rem) 0;
  }
  .hud-top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
  }
  .hud-brand { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; min-width: 0; }
  .hud-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; }

  .tabs {
    display: flex;
    gap: 0.25rem;
    margin-top: 0.6rem;
    overflow-x: auto;
    scrollbar-width: thin;
  }

  main {
    padding: clamp(0.75rem, 3vw, 2rem);
    max-width: 1500px;
    margin-inline: auto;
  }
  .view { display: none; }
  .view.active { display: block; }

  .workbench { display: flex; flex-direction: column; gap: 0.65rem; container-type: inline-size; }
  .search-row { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
  .search-wrap { position: relative; flex: 1 1 260px; min-width: 200px; }
  .filter-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; }

  .catalog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: 0.75rem;
    margin-top: 0.35rem;
  }
  .catalog-grid.as-table { display: block; }

  .pagination { display: flex; align-items: center; justify-content: center; gap: 0.8rem; padding: 1rem 0 2rem; }

  dialog.dialog {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    padding: 0;
    max-width: min(720px, 94vw);
    width: 100%;
    max-height: 88dvh;
    box-shadow: 0 24px 80px rgb(0 0 0 / 0.6), 0 0 0 1px color-mix(in srgb, var(--cyan) 8%, transparent);
  }
  dialog.dialog::backdrop { background: rgb(4 6 10 / 0.72); backdrop-filter: blur(3px); }
  .dialog-drawer { margin-right: 0; margin-left: auto; height: 100dvh; max-height: 100dvh; border-radius: var(--radius) 0 0 var(--radius); }
  .dialog-cmd { margin-top: 12dvh; vertical-align: top; max-width: min(600px, 94vw); }
  .dialog-inner { padding: 1.1rem 1.25rem 1.4rem; overflow-y: auto; max-height: inherit; position: relative; }
  .dialog-cmd .dialog-inner { padding: 0.75rem; }

  #toast-root {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: min(360px, 90vw);
  }
}

@layer components {
  .back-link {
    font-family: var(--mono);
    font-size: 0.72rem;
    color: var(--muted);
    text-decoration: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.2rem 0.5rem;
    transition: color 0.15s, border-color 0.15s;
  }
  .back-link:hover { color: var(--cyan); border-color: var(--cyan); }

  .brand {
    font-family: var(--mono);
    font-size: 1.15rem;
    letter-spacing: 0.18em;
    font-weight: 700;
  }
  .brand-accent { color: var(--amber); text-shadow: 0 0 14px color-mix(in srgb, var(--amber) 60%, transparent); }

  .hud-stats { display: flex; flex-wrap: wrap; gap: 0.4rem; }
  .stat-pill {
    font-family: var(--mono);
    font-size: 0.7rem;
    color: var(--muted);
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: 999px;
    padding: 0.22rem 0.6rem;
    white-space: nowrap;
  }
  .stat-num { color: var(--text); font-weight: 700; }
  .stat-ai .stat-num { color: var(--violet); }
  .stat-browser .stat-num { color: var(--emerald); }

  .hud-btn {
    font-family: var(--mono);
    font-size: 0.72rem;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.32rem 0.6rem;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    transition: border-color 0.15s, background 0.15s;
  }
  .hud-btn:hover { border-color: var(--cyan); background: var(--surface-2); }
  .hud-btn[aria-pressed="true"] { border-color: var(--amber); color: var(--amber); }

  .kbd {
    font-family: var(--mono);
    font-size: 0.62rem;
    border: 1px solid var(--border);
    border-bottom-width: 2px;
    border-radius: 4px;
    padding: 0.05rem 0.3rem;
    color: var(--muted);
    background: var(--bg);
  }

  .tab {
    font-family: var(--mono);
    font-size: 0.78rem;
    color: var(--muted);
    padding: 0.5rem 0.85rem;
    border: 1px solid transparent;
    border-bottom: none;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    white-space: nowrap;
    transition: color 0.15s;
  }
  .tab:hover { color: var(--text); }
  .tab.active {
    color: var(--amber);
    background: var(--surface);
    border-color: var(--border);
    box-shadow: inset 0 2px 0 var(--amber);
  }

  .sync-banner {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-family: var(--mono);
    font-size: 0.78rem;
    color: var(--amber);
    background: color-mix(in srgb, var(--amber) 10%, var(--surface));
    border: 1px solid color-mix(in srgb, var(--amber) 40%, var(--border));
    border-radius: var(--radius-sm);
    padding: 0.55rem 0.8rem;
    margin-bottom: 0.65rem;
  }
  .sync-spinner {
    width: 14px; height: 14px;
    border: 2px solid color-mix(in srgb, var(--amber) 30%, transparent);
    border-top-color: var(--amber);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
    flex: none;
  }

  #search-input {
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.5rem 2.2rem 0.5rem 0.75rem;
    font-size: 0.85rem;
  }
  #search-input::placeholder { color: var(--muted); }
  #search-clear {
    position: absolute;
    right: 0.4rem;
    top: 50%;
    translate: 0 -50%;
    color: var(--muted);
    font-size: 1.1rem;
    line-height: 1;
    padding: 0.2rem 0.4rem;
  }
  #search-clear:hover { color: var(--rose); }

  select {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.45rem 0.6rem;
    font-size: 0.8rem;
    font-family: var(--mono);
  }

  .pill, .chip {
    font-family: var(--mono);
    font-size: 0.72rem;
    color: var(--muted);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.28rem 0.7rem;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
    white-space: nowrap;
  }
  .pill:hover, .chip:hover { color: var(--text); border-color: var(--muted); }
  .pill.active, .chip.active {
    color: var(--amber);
    border-color: var(--amber);
    background: color-mix(in srgb, var(--amber) 12%, var(--surface));
  }
  .pill-violet.active { color: var(--violet); border-color: var(--violet); background: color-mix(in srgb, var(--violet) 12%, var(--surface)); }
  .pill-emerald.active { color: var(--emerald); border-color: var(--emerald); background: color-mix(in srgb, var(--emerald) 12%, var(--surface)); }
  .pill-cyan.active { color: var(--cyan); border-color: var(--cyan); background: color-mix(in srgb, var(--cyan) 12%, var(--surface)); }
  .chip-amber.active { color: var(--amber); border-color: var(--amber); }
  .chip-cyan.active { color: var(--cyan); border-color: var(--cyan); }
  .chip-emerald.active { color: var(--emerald); border-color: var(--emerald); }
  .toggle-pill[aria-pressed="true"] { color: var(--amber); border-color: var(--amber); background: color-mix(in srgb, var(--amber) 14%, var(--surface)); }
  .pill-cyan { color: var(--cyan); }
  .pill-emerald { color: var(--emerald); }

  .filter-label {
    font-family: var(--mono);
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--muted);
    margin-right: 0.2rem;
    min-width: 3.2rem;
  }

  .badge {
    font-family: var(--mono);
    font-size: 0.65rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.05rem 0.4rem;
    color: var(--amber);
  }

  /* Cards */
  .card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.85rem 0.95rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    position: relative;
    transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
  }
  .card:hover { border-color: color-mix(in srgb, var(--cyan) 55%, var(--border)); transform: translateY(-2px); }
  .card.highlight {
    border-color: var(--amber);
    box-shadow: 0 0 0 1px var(--amber), 0 0 22px color-mix(in srgb, var(--amber) 25%, transparent);
  }
  .card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.5rem; }
  .card-title {
    font-weight: 650;
    font-size: 0.95rem;
    line-height: 1.3;
    overflow-wrap: anywhere;
  }
  .card-title button { text-align: left; font-weight: inherit; }
  .card-title button:hover { color: var(--cyan); }
  .card-meta { display: flex; flex-wrap: wrap; gap: 0.3rem; align-items: center; }
  .tag {
    font-family: var(--mono);
    font-size: 0.63rem;
    border-radius: 4px;
    padding: 0.1rem 0.4rem;
    border: 1px solid var(--border);
    color: var(--muted);
    background: var(--surface-2);
  }
  .tag-platform { color: var(--cyan); border-color: color-mix(in srgb, var(--cyan) 35%, var(--border)); }
  .tag-ai-generated { color: var(--violet); border-color: color-mix(in srgb, var(--violet) 45%, var(--border)); }
  .tag-ai-assisted { color: var(--violet); border-color: color-mix(in srgb, var(--violet) 45%, var(--border)); }
  .tag-human { color: var(--muted); }
  .tag-status-playable, .tag-status-released { color: var(--emerald); border-color: color-mix(in srgb, var(--emerald) 45%, var(--border)); }
  .tag-status-wip, .tag-status-beta { color: var(--amber); border-color: color-mix(in srgb, var(--amber) 45%, var(--border)); }
  .tag-archived { color: var(--rose); border-color: color-mix(in srgb, var(--rose) 45%, var(--border)); }
  .tag-play {
    color: var(--emerald);
    border-color: var(--emerald);
    background: color-mix(in srgb, var(--emerald) 14%, var(--surface));
    text-decoration: none;
  }
  .tag-play:hover { background: color-mix(in srgb, var(--emerald) 28%, var(--surface)); }

  .progress { display: flex; align-items: center; gap: 0.5rem; }
  .progress-track {
    flex: 1;
    height: 7px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 999px;
    overflow: hidden;
  }
  .progress-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, color-mix(in srgb, var(--amber) 60%, var(--surface)), var(--amber));
    box-shadow: 0 0 8px color-mix(in srgb, var(--amber) 50%, transparent);
    transition: width 0.4s ease;
  }
  .progress-num { font-family: var(--mono); font-size: 0.68rem; color: var(--amber); min-width: 3.4rem; text-align: right; }

  .card-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.4rem;
    font-family: var(--mono);
    font-size: 0.68rem;
    color: var(--muted);
  }
  .card-foot .foot-left { display: flex; gap: 0.7rem; flex-wrap: wrap; }
  .bookmark-btn { font-size: 0.95rem; color: var(--muted); line-height: 1; padding: 0.1rem 0.25rem; }
  .bookmark-btn:hover { color: var(--amber); }
  .bookmark-btn.saved { color: var(--amber); text-shadow: 0 0 10px color-mix(in srgb, var(--amber) 70%, transparent); }

  /* Table layout */
  .catalog-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
  .catalog-table th {
    font-family: var(--mono);
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--muted);
    text-align: left;
    padding: 0.45rem 0.6rem;
    border-bottom: 1px solid var(--border);
  }
  .catalog-table td { padding: 0.5rem 0.6rem; border-bottom: 1px solid color-mix(in srgb, var(--border) 55%, transparent); vertical-align: middle; }
  .catalog-table tbody tr { cursor: pointer; transition: background 0.12s; }
  .catalog-table tbody tr:hover { background: var(--surface-2); }
  .catalog-table tbody tr.highlight { background: color-mix(in srgb, var(--amber) 10%, var(--surface)); box-shadow: inset 2px 0 0 var(--amber); }
  .table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }

  /* Skeleton shimmer */
  .skeleton {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    min-height: 150px;
    position: relative;
    overflow: hidden;
  }
  .skeleton::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(100deg, transparent 20%, color-mix(in srgb, var(--surface-2) 80%, transparent) 50%, transparent 80%);
    animation: shimmer 1.4s infinite;
  }

  .empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.8rem;
  }
  .empty-glyph { font-size: 2.4rem; color: var(--border); }

  .page-info { font-family: var(--mono); font-size: 0.75rem; color: var(--muted); }

  /* Dialogs */
  .dialog-close {
    position: absolute;
    top: 0.6rem;
    right: 0.7rem;
    font-size: 1.4rem;
    color: var(--muted);
    line-height: 1;
    padding: 0.2rem 0.45rem;
    z-index: 2;
  }
  .dialog-close:hover { color: var(--rose); }
  .dialog-title { font-family: var(--mono); font-size: 1rem; letter-spacing: 0.08em; margin-bottom: 0.8rem; }

  /* Command palette */
  #cmd-input {
    width: 100%;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.65rem 0.8rem;
    font-family: var(--mono);
    font-size: 0.88rem;
  }
  #cmd-results { margin-top: 0.5rem; max-height: 50dvh; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
  .cmd-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    padding: 0.5rem 0.65rem;
    border-radius: var(--radius-sm);
    font-size: 0.83rem;
    text-align: left;
    color: var(--text);
  }
  .cmd-item .cmd-hint { font-family: var(--mono); font-size: 0.65rem; color: var(--muted); flex: none; }
  .cmd-item.active { background: color-mix(in srgb, var(--cyan) 14%, var(--surface-2)); box-shadow: inset 2px 0 0 var(--cyan); }
  .cmd-section {
    font-family: var(--mono);
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--muted);
    padding: 0.5rem 0.65rem 0.15rem;
  }

  /* Detail drawer */
  .detail-head { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 0.9rem; padding-right: 1.8rem; }
  .detail-title { font-size: 1.25rem; font-weight: 700; line-height: 1.25; }
  .detail-section { margin-top: 1rem; }
  .detail-section h3 {
    font-family: var(--mono);
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--muted);
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.3rem;
    margin-bottom: 0.55rem;
  }
  .detail-desc { color: color-mix(in srgb, var(--text) 88%, var(--muted)); font-size: 0.88rem; white-space: pre-wrap; }
  .detail-shot { border: 1px solid var(--border); border-radius: var(--radius-sm); margin-top: 0.4rem; max-height: 260px; object-fit: cover; width: 100%; }
  .chip-row { display: flex; flex-wrap: wrap; gap: 0.35rem; }
  .source-chip {
    font-family: var(--mono);
    font-size: 0.68rem;
    color: var(--cyan);
    border: 1px solid color-mix(in srgb, var(--cyan) 40%, var(--border));
    background: color-mix(in srgb, var(--cyan) 8%, var(--surface));
    border-radius: 999px;
    padding: 0.2rem 0.6rem;
    text-decoration: none;
  }
  .source-chip:hover { background: color-mix(in srgb, var(--cyan) 18%, var(--surface)); }
  .link-chip, .lineage-item {
    font-family: var(--mono);
    font-size: 0.72rem;
    color: var(--text);
    border: 1px solid var(--border);
    background: var(--surface-2);
    border-radius: var(--radius-sm);
    padding: 0.3rem 0.65rem;
    text-decoration: none;
    display: inline-flex;
    gap: 0.4rem;
    align-items: center;
  }
  .link-chip:hover { border-color: var(--cyan); color: var(--cyan); }
  .lineage-list { display: flex; flex-direction: column; gap: 0.35rem; }
  .lineage-item { text-align: left; width: 100%; justify-content: space-between; }
  .lineage-item:hover { border-color: var(--amber); }
  .lineage-rel { color: var(--muted); font-size: 0.65rem; }
  .ext-links { display: flex; flex-wrap: wrap; gap: 0.4rem; }
  .launch-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-family: var(--mono);
    font-size: 0.82rem;
    color: var(--bg);
    background: var(--emerald);
    border-radius: var(--radius-sm);
    padding: 0.55rem 1rem;
    font-weight: 700;
    border: none;
    box-shadow: 0 0 18px color-mix(in srgb, var(--emerald) 45%, transparent);
  }
  .launch-btn:hover { filter: brightness(1.1); }
  .wl-panel { display: flex; flex-direction: column; gap: 0.6rem; }
  .wl-status-row { display: flex; flex-wrap: wrap; gap: 0.35rem; }
  .wl-status-row .pill.active { color: var(--emerald); border-color: var(--emerald); background: color-mix(in srgb, var(--emerald) 12%, var(--surface)); }
  #detail-body textarea, .watchlist-import textarea {
    width: 100%;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.65rem;
    font-size: 0.82rem;
    resize: vertical;
  }

  /* Watchlist dialog */
  .watchlist-toolbar { display: flex; gap: 0.5rem; margin-bottom: 0.7rem; flex-wrap: wrap; }
  .watchlist-list { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 0.8rem; }
  .watchlist-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    border: 1px solid var(--border);
    background: var(--surface-2);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.65rem;
  }
  .watchlist-item .wl-title { font-size: 0.85rem; text-align: left; flex: 1; min-width: 0; overflow-wrap: anywhere; }
  .watchlist-item .wl-title:hover { color: var(--cyan); }
  .wl-remove { color: var(--muted); font-size: 1rem; line-height: 1; padding: 0.15rem 0.35rem; }
  .wl-remove:hover { color: var(--rose); }
  .watchlist-import summary { font-family: var(--mono); font-size: 0.75rem; color: var(--muted); cursor: pointer; margin-bottom: 0.5rem; }
  .watchlist-import-actions { display: flex; gap: 0.5rem; margin-top: 0.5rem; flex-wrap: wrap; }
  .file-pill { display: inline-flex; align-items: center; cursor: pointer; }

  /* Admin dialog */
  .muted { color: var(--muted); font-size: 0.82rem; }
  .admin-gate-row { display: flex; gap: 0.5rem; margin-top: 0.6rem; }
  .admin-gate-row input {
    flex: 1;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.65rem;
  }
  .admin-msg { font-family: var(--mono); font-size: 0.72rem; color: var(--rose); margin-top: 0.45rem; display: inline-block; }
  .admin-msg.ok { color: var(--emerald); }
  .admin-subhead { font-family: var(--mono); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); margin: 1rem 0 0.55rem; }
  .admin-form { display: grid; grid-template-columns: 1fr 1fr; gap: 0.55rem 0.7rem; }
  .admin-form label { display: flex; flex-direction: column; gap: 0.25rem; font-family: var(--mono); font-size: 0.68rem; color: var(--muted); }
  .admin-form input, .admin-form select, .admin-form textarea {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.42rem 0.55rem;
    font-size: 0.82rem;
    font-family: var(--sans);
    color: var(--text);
    width: 100%;
  }
  .admin-wide { grid-column: 1 / -1; }

  /* Toasts */
  .toast {
    font-family: var(--mono);
    font-size: 0.78rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-left: 3px solid var(--cyan);
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.85rem;
    color: var(--text);
    box-shadow: 0 8px 30px rgb(0 0 0 / 0.5);
    animation: toast-in 0.18s ease-out;
  }
  .toast.success { border-left-color: var(--emerald); }
  .toast.error { border-left-color: var(--rose); }

  /* CRT scanlines (Browser Arcade) */
  .crt-scanlines { position: relative; }
  .crt-scanlines::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 5;
    background: repeating-linear-gradient(
      to bottom,
      transparent 0px,
      transparent 2px,
      rgb(0 0 0 / 0.22) 3px,
      rgb(0 0 0 / 0.22) 4px
    );
    mix-blend-mode: multiply;
  }
  .crt-scanlines::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 6;
    background: radial-gradient(ellipse at center, transparent 55%, rgb(0 0 0 / 0.35) 100%);
  }
}

@layer utilities {
  @keyframes spin { to { rotate: 1turn; } }
  @keyframes shimmer { from { translate: -100% 0; } to { translate: 100% 0; } }
  @keyframes toast-in { from { opacity: 0; translate: 0 8px; } to { opacity: 1; translate: 0 0; } }

  .hidden { display: none !important; }
  .mono { font-family: var(--mono); }

  @container (max-width: 560px) {
    .catalog-grid { grid-template-columns: 1fr; }
  }

  @media (max-width: 700px) {
    .hud-top { flex-direction: column; align-items: stretch; }
    .hud-actions { justify-content: flex-start; }
    .brand { font-size: 1rem; }
    .search-row select { flex: 1 1 45%; }
    .dialog-drawer { max-width: 100vw; border-radius: 0; }
    .admin-form { grid-template-columns: 1fr; }
    main { padding: 0.75rem; }
  }
  @media (max-width: 400px) {
    .stat-pill { font-size: 0.62rem; padding: 0.18rem 0.45rem; }
    .hud-btn { font-size: 0.66rem; padding: 0.28rem 0.45rem; }
    .tab { font-size: 0.7rem; padding: 0.45rem 0.6rem; }
  }

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