/* ============================================================
   Control Panel — HUD

   The circles are the instrument panel and they never move: the
   readout is a fixed pane laid over the grid, not a block pushed
   into it. Glass is 30% and genuinely see-through, but every
   piece of text sits on its own scrim so it still clears 4.5:1.
   ============================================================ */

:root {
  --head-tint: rgba(255, 255, 255, .20);
  --scrim-2: rgba(244, 249, 252, .82);
  --water-hi: 255 255 255;      /* crest */
  --water-lo: 62 112 148;       /* trough */
  --water-gain: 62;
  --veil: rgba(252, 253, 255, .58);
  --flat: rgba(255, 255, 255, .44);
  --rim: rgba(214, 228, 238, .42);
  --label-shadow: rgba(255, 255, 255, .9);
  /* daylight HUD — the same instrument, lit from outside */
  --void:    #e8f0f5;
  --deep-1:  #d3e3ee;
  --deep-2:  #e2ecf3;
  --panel:   rgba(255, 255, 255, .74);
  --glass:   rgba(255, 255, 255, .24);
  --scrim:   rgba(255, 255, 255, .78);

  --cyan:    #06707a;
  --cyan-2:  #0d95a3;
  --cyan-dim:rgba(6, 112, 122, .30);
  --wire:    rgba(6, 112, 122, .22);
  --wire-2:  rgba(6, 112, 122, .12);

  --ink:     #06202b;
  --ink-2:   #375563;
  --ink-3:   #5b7684;
  --on-cyan: #ffffff;

  --run:     #0b7a49;
  --idle:    #5b7684;
  --danger:  #b3261e;

  --sans: "Archivo", ui-sans-serif, -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --mono: "Azeret Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --t-press: 130ms;
  --t-hover: 180ms;
  --t-enter: 260ms;
  --t-exit:  150ms;

  --focus: 0 0 0 2px var(--void), 0 0 0 4px var(--cyan);
  --lift: 0 18px 44px -18px rgba(6, 40, 60, .40);
}

:root[data-theme="dark"] {
  --head-tint: rgba(6, 16, 30, .20);
  --scrim-2: rgba(4, 10, 20, .80);
  --water-hi: 122 240 232;
  --water-lo: 8 40 70;
  --water-gain: 26;
  --veil: rgba(3, 9, 18, .52);
  --flat: rgba(4, 10, 20, .40);
  --rim: rgba(2, 8, 18, .55);
  --label-shadow: rgba(2, 8, 18, .95);
  --void:    #04070f;
  --deep-1:  #071426;
  --deep-2:  #030710;
  --panel:   rgba(9, 20, 36, .78);
  --glass:   rgba(11, 26, 44, .24);
  --scrim:   rgba(4, 10, 20, .62);

  --cyan:    #24e6d4;
  --cyan-2:  #89e4ff;
  --cyan-dim:rgba(36, 230, 212, .30);
  --wire:    rgba(137, 228, 255, .26);
  --wire-2:  rgba(137, 228, 255, .12);

  --ink:     #e9fbff;
  --ink-2:   #a9c6d4;
  --ink-3:   #8fb0c0;
  --on-cyan: #032027;

  --run:     #3ff0b0;
  --idle:    #8fb0c0;
  --danger:  #ff7a6b;

  --lift: 0 30px 70px -22px rgba(0, 0, 0, .8);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh;
  background: var(--void); color: var(--ink);
  font: 400 16.5px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
}
/* the depth behind everything; fixed so scrolling never drags it */
.water { position: absolute; inset: 0; width: 100%; height: 100%; }
.deep {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(70% 55% at 18% 8%, var(--deep-1), transparent 70%),
    radial-gradient(60% 60% at 88% 92%, var(--deep-1), transparent 72%),
    var(--deep-2);
}
/* depth, not a mesh: one wide cyan bloom low and left, and a vignette that
   pushes the corners back so the circles read as lit objects in a space */
:root[data-theme="dark"] .deep::after {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(48% 38% at 12% 84%, color-mix(in srgb, var(--cyan) 12%, transparent), transparent 70%),
    radial-gradient(120% 90% at 50% 45%, transparent 42%, rgba(0, 0, 0, .55));
}
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 4px; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ico {
  width: 18px; height: 18px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.75;
  stroke-linecap: round; stroke-linejoin: round;
}
.ico--fill { fill: currentColor; stroke: currentColor; stroke-width: 1.2; }

.skip {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  padding: 10px 16px; background: var(--cyan); color: var(--on-cyan);
  border-radius: 4px; text-decoration: none; font-weight: 600;
  transition: top var(--t-enter) var(--ease-out);
}
.skip:focus { top: 12px; }

/* ---------- bar ---------- */
.bar {
  position: sticky; top: 0; z-index: 40;
  display: grid; grid-template-columns: minmax(180px, 1fr) minmax(240px, 1.8fr) auto;
  gap: 20px; align-items: center; padding: 12px 22px;
  background: var(--panel);
  backdrop-filter: blur(16px) saturate(1.4);
  border-bottom: 1px solid var(--wire);
}
.bar-id { display: flex; align-items: center; gap: 12px; min-width: 0; }
.mark {
  width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--cyan);
  box-shadow: 0 0 0 4px var(--cyan-dim), 0 0 18px var(--cyan);
}
.bar h1 {
  margin: 0; font-size: 15px; font-weight: 700;
  letter-spacing: .15em; text-transform: uppercase;
}
.sub {
  margin: 3px 0 0; font: 500 12.5px/1.35 var(--mono);
  color: var(--ink-2); font-variant-numeric: tabular-nums; letter-spacing: -.01em;
}
.sub .live { color: var(--run); }

.bar-search { position: relative; display: flex; align-items: center; }
.bar-search .search-ico { position: absolute; left: 12px; color: var(--ink-3); transition: color var(--t-hover) var(--ease-out); }
.bar-search input {
  width: 100%; height: 48px; padding: 0 48px 0 42px; font-size: 16px;
  background: var(--glass); border: 1px solid var(--wire); border-radius: 4px;
  transition: border-color var(--t-hover) var(--ease-out), background var(--t-hover) var(--ease-out);
}
.bar-search input::placeholder { color: var(--ink-3); }
.bar-search input:focus { outline: none; border-color: var(--cyan); box-shadow: var(--focus); }
.bar-search:focus-within .search-ico { color: var(--cyan); }
.slash {
  position: absolute; right: 12px; pointer-events: none;
  font: 400 11px/1 var(--mono); color: var(--ink-3);
  border: 1px solid var(--wire); border-radius: 3px; padding: 4px 6px;
  transition: opacity var(--t-hover) var(--ease-out);
}
.bar-search:focus-within .slash { opacity: 0; }

.bar-act { display: flex; gap: 8px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 46px; padding: 0 17px;
  background: var(--glass); border: 1px solid var(--wire); border-radius: 4px;
  cursor: pointer; font-size: 15px; font-weight: 600; white-space: nowrap;
  transition: transform var(--t-press) var(--ease-out), border-color var(--t-hover) var(--ease-out),
              background var(--t-hover) var(--ease-out), color var(--t-hover) var(--ease-out);
}
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--cyan); color: var(--on-cyan); border-color: var(--cyan); font-weight: 600; }
.btn.icon { width: 46px; padding: 0; }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 34%, transparent); }
.btn[disabled] { opacity: .42; cursor: not-allowed; transform: none; }
@media (hover: hover) and (pointer: fine) {
  .btn:hover { border-color: var(--cyan); }
  .btn.primary:hover { background: var(--cyan-2); border-color: var(--cyan-2); }
  .btn.danger:hover { background: color-mix(in srgb, var(--danger) 12%, transparent); border-color: var(--danger); }
  .btn[disabled]:hover { border-color: var(--wire); }
}
:root[data-theme="dark"] .theme-sun, :root:not([data-theme="dark"]) .theme-moon { display: none; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 228px minmax(0, 1fr); align-items: start; }
.rail {
  position: sticky; top: 67px; max-height: calc(100dvh - 67px); overflow-y: auto;
  padding: 22px 18px 28px; border-right: 1px solid var(--wire); scrollbar-width: thin;
}
main { min-width: 0; padding: 26px 24px 22vh; }
#grid:focus { outline: none; }

.fgroup { margin-bottom: 22px; }
.fgroup h2 {
  margin: 0 0 8px; font: 600 11px/1 var(--mono); letter-spacing: .14em;
  text-transform: uppercase; color: var(--ink-3);
}
.fbtn {
  position: relative; display: flex; justify-content: space-between; gap: 10px;
  width: 100%; min-height: 38px; padding: 6px 8px 6px 12px;
  background: none; border: 0; border-radius: 4px; cursor: pointer;
  font-size: 15px; color: var(--ink-2); text-align: left;
  transition: color var(--t-hover) var(--ease-out), background var(--t-hover) var(--ease-out);
}
.fbtn::before {
  content: ""; position: absolute; left: 0; top: 50%; width: 2px; height: 15px;
  background: var(--cyan); border-radius: 1px;
  transform: translateY(-50%) scaleY(0); transform-origin: center;
  transition: transform var(--t-enter) var(--ease-out);
}
.fbtn[aria-pressed="true"] { color: var(--ink); font-weight: 600; }
.fbtn[aria-pressed="true"]::before { transform: translateY(-50%) scaleY(1); }
@media (hover: hover) { .fbtn:hover { color: var(--ink); background: var(--glass); } }
.fbtn .n { font: 500 12.5px/1.7 var(--mono); color: var(--ink-3); font-variant-numeric: tabular-nums; }
.fbtn .swatch { width: 7px; height: 7px; border-radius: 50%; }

.rail-foot { padding-top: 16px; border-top: 1px solid var(--wire-2); }
.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 15px; font-weight: 500; margin-top: 16px; }
.switch:first-child { margin-top: 0; }
.switch input { width: 17px; height: 17px; margin: 0; accent-color: var(--cyan); cursor: pointer; }
.rail-note { margin: 7px 0 0; font-size: 13px; line-height: 1.5; color: var(--ink-3); }

/* ---------- the circles ---------- */
.grid {
  display: grid; gap: clamp(26px, 3.4vw, 52px) clamp(20px, 2.6vw, 40px);
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  justify-items: center; align-items: start;
}
.orb {
  position: relative; width: 100%; max-width: 310px; aspect-ratio: 1;
  padding: 0; border-radius: 50%; overflow: hidden; cursor: pointer;
  color: var(--ink);
  border: 1px solid var(--wire);
  background: radial-gradient(circle at 50% 34%, color-mix(in srgb, var(--cyan) 16%, transparent), var(--glass) 52%, var(--scrim));
  box-shadow: inset 0 0 40px color-mix(in srgb, var(--cyan) 12%, transparent), var(--lift);
  /* transform only: a circle may grow, but it must never shove a neighbour */
  transition: transform var(--t-hover) var(--ease-out), box-shadow var(--t-hover) var(--ease-out),
              border-color var(--t-hover) var(--ease-out);
}
.orb:active { transform: scale(.975); }
@media (hover: hover) and (pointer: fine) {
  .orb:hover { transform: scale(1.03); border-color: var(--cyan); }
  .orb:hover .orb-ring { opacity: 1; }
}
/* Clicking lights the disc: the ring brightens, the bloom pushes outward once,
   then settles into a steady halo. */
.orb.selected {
  border-color: var(--cyan);
  box-shadow: inset 0 0 60px color-mix(in srgb, var(--cyan) 26%, transparent),
              0 0 0 2px var(--cyan), 0 0 34px 2px color-mix(in srgb, var(--cyan) 55%, transparent),
              0 0 90px 10px color-mix(in srgb, var(--cyan) 22%, transparent), var(--lift);
  animation: ignite 620ms var(--ease-out);
}
.orb.selected .orb-ring { opacity: 1; border-color: var(--cyan); }
.orb.selected .orb-ring.inner { opacity: .7; }
.orb.selected .orb-label .nm { color: #fff; }
:root:not([data-theme="dark"]) .orb.selected .orb-label .nm { color: var(--ink); }
@keyframes ignite {
  0%   { box-shadow: inset 0 0 60px color-mix(in srgb, var(--cyan) 26%, transparent),
                     0 0 0 2px var(--cyan), 0 0 0 0 color-mix(in srgb, var(--cyan) 70%, transparent),
                     0 0 0 0 color-mix(in srgb, var(--cyan) 40%, transparent), var(--lift); }
  55%  { box-shadow: inset 0 0 70px color-mix(in srgb, var(--cyan) 34%, transparent),
                     0 0 0 3px var(--cyan), 0 0 44px 8px color-mix(in srgb, var(--cyan) 66%, transparent),
                     0 0 120px 26px color-mix(in srgb, var(--cyan) 26%, transparent), var(--lift); }
}
/* Scaled to cover the disc and centred, so the circle is a window onto the
   page rather than a band across its top. The sides crop; that is the point. */
.orb-frame {
  position: absolute; z-index: 0; left: 50%; top: 50%;
  width: var(--shot-w); height: var(--shot-h); border: 0;
  transform-origin: center; transform: translate(-50%, -50%) scale(var(--shot-scale));
  pointer-events: none; opacity: 0;
  transition: opacity 460ms var(--ease-out);
}
.orb-frame[data-ready] { opacity: .66; }
:root:not([data-theme="dark"]) .orb-frame[data-ready] { opacity: .9; }
.orb-skel {
  position: absolute; z-index: 1; inset: 0;
  background-image: linear-gradient(100deg, transparent 22%, color-mix(in srgb, var(--cyan) 12%, transparent) 46%, transparent 70%);
  background-size: 220% 100%; animation: sweep 1.5s linear infinite;
}
@keyframes sweep { from { background-position: 120% 0; } to { background-position: -120% 0; } }
/* glass over the preview: this is what keeps the label readable */
/* The glass is what makes a label readable over somebody else's homepage:
   the lower third resolves to the theme's own surface, so the text contrast
   is known rather than at the mercy of whatever the site happens to show. */
.orb-glass {
  position: absolute; z-index: 2; inset: 0; pointer-events: none;
  background:
    linear-gradient(152deg, color-mix(in srgb, #fff 18%, transparent), transparent 44%),
    radial-gradient(62% 38% at 50% 52%, var(--veil), transparent 78%),
    radial-gradient(circle at 50% 50%, transparent 58%, var(--rim) 99%),
    /* one flat pass over the whole disc: a site is recognisable at 60% of its
       brightness, and the label needs a floor it can count on */
    linear-gradient(var(--flat), var(--flat));
}
.orb-ring {
  position: absolute; z-index: 3; inset: 7%; border-radius: 50%; pointer-events: none;
  border: 1px solid var(--wire); opacity: .6;
  transition: opacity var(--t-hover) var(--ease-out), inset var(--t-hover) var(--ease-out);
}
.orb-ring.inner { inset: 19%; opacity: .34; }
.orb-label {
  position: absolute; z-index: 4; inset: 0; display: grid; align-content: center; gap: 8px;
  padding: 0 11%; justify-items: center; text-align: center; pointer-events: none;
}
.orb-label .nm {
  font-size: clamp(19px, 2.1vw, 29px); font-weight: 700; letter-spacing: -.02em;
  line-height: 1.12; max-width: 100%;
  text-shadow: 0 2px 14px var(--label-shadow), 0 1px 3px var(--label-shadow);
  overflow-wrap: anywhere; hyphens: auto;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
}
.orb-state {
  display: inline-flex; align-items: center; gap: 6px;
  font: 600 11.5px/1 var(--mono); letter-spacing: .16em; text-transform: uppercase;
  color: var(--ink-2); text-shadow: 0 1px 8px var(--label-shadow);
}
.orb-state .led { width: 6px; height: 6px; border-radius: 50%; background: var(--idle); }
.orb-state.running { color: var(--run); }
.orb-state.running .led { background: var(--run); box-shadow: 0 0 0 3px color-mix(in srgb, var(--run) 22%, transparent); animation: breathe 2.6s var(--ease-out) infinite; }
.orb-state.unmapped .led { background: transparent; border: 1.5px solid var(--ink-3); }
@keyframes breathe { 50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--run) 6%, transparent); } }
.orb-flags {
  position: absolute; z-index: 4; top: 13%; left: 50%; transform: translateX(-50%);
  display: flex; gap: 6px; color: var(--cyan); pointer-events: none;
}

/* ---------- the readout ----------
   It belongs to the disc you clicked, so it is positioned onto that disc and
   opens upward out of it like a bonnet. Absolute, not fixed: it scrolls with
   its circle, and being out of flow it cannot push a single one of them. */
.readout {
  position: absolute; z-index: 60;
  width: 400px; max-width: calc(100vw - 24px);
  max-height: min(70dvh, 560px); overflow: hidden auto; overscroll-behavior: contain;
  border: 1px solid var(--cyan-dim); border-radius: 6px;
  background: var(--glass);
  backdrop-filter: blur(34px) saturate(1.6) brightness(.86);
  box-shadow: var(--lift), inset 0 1px 0 color-mix(in srgb, #fff 16%, transparent);
  user-select: text;
  transform-origin: bottom center;
  /* the panel is wiped open from its lower edge upward */
  clip-path: inset(100% 0 0 0);
  transform: translateY(14px);
  opacity: 0;
  transition: clip-path 340ms var(--ease-out), transform 340ms var(--ease-out),
              opacity 200ms var(--ease-out);
}
.readout.open {
  clip-path: inset(0 0 0 0); transform: translateY(0); opacity: 1;
}
/* shutting it is quicker than opening it — the system answering, not deciding */
.readout.closing {
  transition-duration: 200ms, 200ms, 140ms;
}
.readout::before, .readout::after {
  content: ""; position: absolute; width: 14px; height: 14px; pointer-events: none;
  border: 1px solid var(--cyan);
}
.readout::before { top: 6px; left: 6px; border-right: 0; border-bottom: 0; }
.readout::after  { bottom: 6px; right: 6px; border-left: 0; border-top: 0; }

.ro-head { position: relative; padding: 15px 16px 11px; border-bottom: 1px solid var(--wire); background: var(--head-tint); }
.ro-head::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--cyan), transparent);
  animation: scan 3.4s linear infinite;
}
@keyframes scan { 0%, 100% { opacity: .25; } 50% { opacity: .9; } }
.ro-head h2 { margin: 0; font-size: 23px; font-weight: 700; letter-spacing: -.02em; padding-right: 42px; }
.ro-head .kind { margin: 4px 0 0; font: 500 12px/1.4 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2); }
.ro-close { position: absolute; top: 12px; right: 12px; }

/* The pane stays 30% glass; the text column carries a light tint of its own so
   a circle behind it can never turn into a second layer of words. Raise or drop
   --glass to taste — it is the one number that controls how see-through it is. */
.ro-body { padding: 0 16px 15px; background: var(--head-tint); }

/* Without backdrop-filter there is no blur to protect the text, so the pane
   falls back to being properly opaque rather than illegible. */
@supports not (backdrop-filter: blur(2px)) {
  .readout, .menu, dialog, .toast { background: var(--panel); }
}
/* Two facts to a row: the panel has to rise out of a disc, so every
   unnecessary line of height costs it that gesture. */
.ro-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; padding: 4px 0 2px; }
.ro-line {
  display: grid; gap: 1px; min-width: 0;
  padding: 7px 0; border-bottom: 1px solid var(--wire-2);
  font: 500 13.5px/1.4 var(--mono); color: var(--ink);
}
.ro-line.wide { grid-column: 1 / -1; }
.ro-line.inline { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ro-line .v { min-width: 0; overflow-wrap: anywhere; }
.ro-line .k { color: var(--ink-3); letter-spacing: .12em; text-transform: uppercase; font-size: 11px; font-weight: 600; }
.ro-acts { display: flex; gap: 8px; flex-wrap: wrap; padding: 13px 0 2px; }
.ro-acts .btn { min-height: 42px; }
.ro-sec { padding-top: 10px; }
.ro-sec h3 {
  margin: 0 0 4px; font: 600 11px/1 var(--mono); letter-spacing: .14em;
  text-transform: uppercase; color: var(--ink-3);
}
.ro-note { margin: 8px 0 0; font-size: 14.5px; color: var(--ink-2); max-width: 60ch; }

.linkrow {
  display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 10px;
  align-items: center; min-height: 46px; border-top: 1px solid var(--wire-2);
}
.ro-sec .linkrow:first-of-type { border-top: 0; }
.linkrow .toolico { color: var(--ink-3); justify-self: center; transition: color var(--t-hover) var(--ease-out); }
.linkrow a { display: block; padding: 7px 0; min-width: 0; color: var(--ink); text-decoration: none; border-radius: 4px; }
.linkrow .lbl { display: flex; align-items: center; gap: 7px; font-weight: 600; font-size: 15.5px; }
.linkrow .lbl .star { color: var(--cyan); }
.linkrow .sub2 { display: block; font: 400 12.5px/1.5 var(--mono); color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; }
@media (hover: hover) {
  .linkrow:hover .toolico, .linkrow a:hover .lbl { color: var(--cyan); }
  .linkacts .act { opacity: 0; }
  .linkrow:hover .linkacts .act, .linkacts:focus-within .act { opacity: 1; }
}
.linkacts { display: flex; gap: 2px; }
.act {
  display: grid; place-items: center; width: 34px; height: 34px;
  background: none; border: 0; border-radius: 4px; cursor: pointer; padding: 0; color: var(--ink-3);
  transition: color var(--t-hover) var(--ease-out), background var(--t-hover) var(--ease-out),
              transform var(--t-press) var(--ease-out), opacity var(--t-hover) var(--ease-out);
}
.act:active { transform: scale(.92); }
@media (hover: hover) {
  .act:hover { background: var(--glass); color: var(--ink); }
  .act.danger:hover { color: var(--danger); }
}
.ro-foot { display: flex; gap: 8px; padding-top: 12px; }
.ro-foot .btn.danger { margin-left: auto; }

/* ---------- empty ---------- */
.empty {
  display: grid; justify-items: start; gap: 8px; max-width: 46ch; padding: 60px 4px;
  animation: rise var(--t-enter) var(--ease-out) both;
}
.empty .ico { width: 26px; height: 26px; color: var(--cyan); margin-bottom: 6px; }
.empty h2 { margin: 0; font-size: 17px; font-weight: 600; }
.empty p { margin: 0; color: var(--ink-2); font-size: 14px; }
.empty .btn { margin-top: 10px; }
mark { background: color-mix(in srgb, var(--cyan) 30%, transparent); color: inherit; border-radius: 2px; }

/* ---------- menu ---------- */
.menu {
  position: fixed; top: 64px; right: 22px; z-index: 70; width: 300px; padding: 6px;
  background: var(--panel); backdrop-filter: blur(20px) saturate(1.4);
  border: 1px solid var(--wire); border-radius: 6px; box-shadow: var(--lift);
  transform-origin: top right; animation: pop var(--t-enter) var(--ease-out) both;
}
.menu button {
  display: flex; align-items: flex-start; gap: 11px; width: 100%;
  padding: 9px 10px; background: none; border: 0; border-radius: 4px; cursor: pointer; text-align: left;
  transition: background var(--t-hover) var(--ease-out);
}
.menu .ico { margin-top: 2px; color: var(--ink-3); }
.menu strong { display: block; font-size: 13.5px; font-weight: 500; }
.menu em { display: block; font-style: normal; font-size: 12px; color: var(--ink-3); margin-top: 1px; }
.menu-sep { height: 1px; margin: 5px 8px; background: var(--wire-2); }
.menu .destructive strong { color: var(--danger); }
@media (hover: hover) {
  .menu button:hover { background: var(--glass); }
  .menu button:hover .ico { color: var(--cyan); }
  .menu .destructive:hover .ico { color: var(--danger); }
}

/* ---------- dialog ---------- */
dialog {
  width: min(640px, calc(100vw - 24px)); padding: 0; color: var(--ink);
  background: var(--panel); backdrop-filter: blur(24px) saturate(1.4);
  border: 1px solid var(--cyan-dim); border-radius: 6px; box-shadow: var(--lift);
}
dialog[open] { animation: pop var(--t-enter) var(--ease-out) both; }
dialog::backdrop { background: rgba(2, 6, 14, .6); animation: fade var(--t-enter) var(--ease-out) both; }
.dlg-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 20px 14px; }
.dlg-head h3 { margin: 0; font-size: 16px; font-weight: 600; }
.dlg-head .who { display: block; font: 400 11px/1.4 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); margin-top: 3px; }
.dlg-body { padding: 4px 20px 20px; max-height: 62dvh; overflow-y: auto; user-select: text; }
.dlg-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--wire); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.full { grid-column: 1 / -1; }
label { display: block; font-size: 12.5px; font-weight: 500; color: var(--ink-2); }
label .req { color: var(--danger); }
label input, label select, label textarea {
  width: 100%; min-height: 42px; margin-top: 6px; padding: 9px 11px;
  background: var(--scrim); border: 1px solid var(--wire); border-radius: 4px; font-size: 14.5px;
  transition: border-color var(--t-hover) var(--ease-out);
}
label textarea { min-height: 74px; resize: vertical; line-height: 1.5; }
label input:focus, label textarea:focus { outline: none; border-color: var(--cyan); box-shadow: var(--focus); }
label .hint { display: block; margin-top: 5px; font-size: 12px; color: var(--ink-3); font-weight: 400; }
.check {
  display: flex; align-items: flex-start; gap: 10px; padding: 11px 12px;
  border: 1px solid var(--wire); border-radius: 4px; background: var(--scrim);
  font-size: 13.5px; color: var(--ink); font-weight: 400; cursor: pointer;
}
.check input { width: 18px; height: 18px; min-height: 0; margin: 1px 0 0; accent-color: var(--cyan); }
.check em { display: block; font-style: normal; color: var(--ink-3); font-size: 12px; margin-top: 2px; }
.err {
  display: flex; align-items: flex-start; gap: 8px; margin: 14px 0 0; padding: 10px 12px;
  color: var(--danger); font-size: 13px;
  background: color-mix(in srgb, var(--danger) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--danger) 32%, transparent); border-radius: 4px;
  animation: rise var(--t-enter) var(--ease-out) both;
}
.vocab-sec { margin-top: 20px; }
.vocab-sec h4 { margin: 0 0 4px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.vocab-line {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  min-height: 40px; padding: 4px 0; border-top: 1px solid var(--wire-2); font-size: 14px;
}
.vocab-add { display: flex; gap: 8px; margin-top: 10px; }
.vocab-add input { flex: 1; min-height: 40px; padding: 8px 11px; background: var(--scrim); border: 1px solid var(--wire); border-radius: 4px; }
.vocab-add input:focus { outline: none; border-color: var(--cyan); box-shadow: var(--focus); }
.linkish { background: none; border: 0; padding: 8px 2px; cursor: pointer; color: var(--ink-3); font-size: 12.5px; font-weight: 500; }
@media (hover: hover) { .linkish:hover { color: var(--ink); } }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 26px; z-index: 90;
  display: flex; align-items: center; gap: 9px; padding: 11px 16px; border-radius: 4px;
  background: var(--panel); backdrop-filter: blur(20px); color: var(--ink);
  border: 1px solid var(--cyan-dim); font-size: 13.5px; font-weight: 500;
  box-shadow: var(--lift); transform: translate(-50%, 0); opacity: 1;
  transition: opacity var(--t-exit) var(--ease-out), transform var(--t-exit) var(--ease-out);
}
.toast .ico { color: var(--cyan); }
@starting-style { .toast { opacity: 0; transform: translate(-50%, 10px); } }
.toast[data-leaving] { opacity: 0; transform: translate(-50%, 6px); }

@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
@keyframes pop  { from { opacity: 0; transform: scale(.97); } }
@keyframes fade { from { opacity: 0; } }
.grid[data-intro] .orb { animation: rise 320ms var(--ease-out) both; animation-delay: calc(var(--i) * 34ms); }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .bar { grid-template-columns: 1fr auto; row-gap: 10px; padding: 10px 14px; }
  .bar-search { grid-column: 1 / -1; order: 3; }
  .slash { display: none; }
  .bar .btn.primary span { display: none; }
  .bar .btn.primary { width: 46px; padding: 0; }
  .shell { grid-template-columns: 1fr; }
  .rail {
    display: none;
    position: fixed;
    top: 132px;
    left: 12px;
    right: 12px;
    z-index: 66;
    max-height: calc(100dvh - 150px);
    overflow: auto;
    padding: 16px 14px;
    border: 1px solid var(--wire);
    border-radius: 6px;
    background: var(--panel);
    backdrop-filter: blur(22px) saturate(1.4);
    box-shadow: var(--lift);
  }
  body.menu-open .rail { display: block; animation: pop var(--t-enter) var(--ease-out) both; }
  .filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(148px, 1fr)); gap: 16px; }
  main { padding: 20px 14px 30vh; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .readout { width: min(400px, calc(100vw - 20px)); max-height: 68dvh; }
  .ro-facts { grid-template-columns: 1fr; }
  .act { width: 44px; height: 44px; }
  .linkacts .act { opacity: 1 !important; }
  .grid2 { grid-template-columns: 1fr; }
  .menu { right: 12px; left: 12px; width: auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important; animation-delay: 0ms !important; transition-duration: 1ms !important;
  }
  .orb-skel, .orb-state.running .led, .ro-head::after { animation: none; }
}
