/* ==========================================================================
   mem - memory keeper
   Theme colours are injected as custom properties by app.js from the values in
   user.keys; the defaults below keep the login and error pages self sufficient.
   ========================================================================== */

:root {
  --bg-rgb: 18 18 24;
  --fg-rgb: 232 232 240;
  --accent-rgb: 124 156 255;

  --bg: rgb(var(--bg-rgb));
  --bg-deep: rgb(var(--bg-rgb));
  --surface: rgb(var(--fg-rgb) / 0.045);
  --surface-2: rgb(var(--fg-rgb) / 0.075);
  --surface-3: rgb(var(--fg-rgb) / 0.11);
  --line: rgb(var(--fg-rgb) / 0.11);
  --line-2: rgb(var(--fg-rgb) / 0.2);
  --fg: rgb(var(--fg-rgb));
  --fg-2: rgb(var(--fg-rgb) / 0.72);
  --fg-3: rgb(var(--fg-rgb) / 0.48);
  --fg-4: rgb(var(--fg-rgb) / 0.28);
  --accent: rgb(var(--accent-rgb));
  --accent-soft: rgb(var(--accent-rgb) / 0.14);
  --accent-line: rgb(var(--accent-rgb) / 0.4);
  --accent-ink: #0b0b10;
  --danger: #ff5f6d;
  --danger-soft: rgb(255 95 109 / 0.14);
  --warn: #ffb43a;
  --good: #43d9a3;

  --font: "Inter var", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text",
    "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Code", Menlo, Consolas, monospace;
  --content-fs: 17px;
  --chrome-fs: 0.875rem;

  --r-xs: 8px;
  --r-sm: 12px;
  --r: 18px;
  --r-lg: 24px;
  --r-xl: 30px;

  --sh-1: 0 1px 2px rgb(0 0 0 / 0.18), 0 2px 8px rgb(0 0 0 / 0.14);
  --sh-2: 0 2px 6px rgb(0 0 0 / 0.2), 0 12px 30px -8px rgb(0 0 0 / 0.36);
  --sh-3: 0 8px 24px rgb(0 0 0 / 0.28), 0 32px 64px -16px rgb(0 0 0 / 0.5);
  --sh-glow: 0 6px 24px -6px rgb(var(--accent-rgb) / 0.5);

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --t-fast: 0.14s;
  --t: 0.24s;
  --t-slow: 0.42s;

  --bar-h: 96px;
  --pad: clamp(12px, 3.2vw, 22px);
  --col: 760px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
}

* { box-sizing: border-box; }
*::selection { background: rgb(var(--accent-rgb) / 0.32); color: var(--fg); }

html, body { height: 100%; }

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  font-size: var(--content-fs);
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overscroll-behavior-y: none;
  text-rendering: optimizeLegibility;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    radial-gradient(1100px 620px at 82% -8%, rgb(var(--accent-rgb) / 0.16), transparent 62%),
    radial-gradient(900px 520px at 4% 4%, rgb(var(--fg-rgb) / 0.07), transparent 60%),
    linear-gradient(178deg, rgb(var(--fg-rgb) / 0.035), transparent 42%);
}

/* Do not hide the whole page if JS is slow or fails — chrome stays usable */
body.booting .stage { opacity: 0.55; }
body.ready .stage { animation: stageIn 0.45s var(--ease-out) both; }
@keyframes stageIn { from { opacity: 0.55; transform: translateY(6px); } to { opacity: 1; transform: none; } }

h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -0.015em; line-height: 1.25; }
p { margin: 0; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: var(--accent); text-decoration: none; }
code, kbd, pre { font-family: var(--mono); font-size: 0.9em; }
svg.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.ico {
  width: 1.15em;
  height: 1.15em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ico-fill { fill: currentColor; stroke: currentColor; stroke-width: 1.1; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgb(var(--fg-rgb) / 0.16);
  border-radius: 99px;
  border: 3px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: rgb(var(--fg-rgb) / 0.3); background-clip: content-box; }

/* ==========================================================================
   sticky header
   ========================================================================== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  padding-top: var(--safe-t);
  background: rgb(var(--bg-rgb) / 0.72);
  backdrop-filter: blur(22px) saturate(1.7);
  -webkit-backdrop-filter: blur(22px) saturate(1.7);
  border-bottom: 1px solid transparent;
  transition: border-color var(--t) var(--ease), background var(--t) var(--ease), box-shadow var(--t) var(--ease);
}
.topbar.is-stuck {
  border-bottom-color: var(--line);
  box-shadow: 0 8px 28px -18px rgb(0 0 0 / 0.8);
}
@supports not (backdrop-filter: blur(2px)) {
  .topbar { background: rgb(var(--bg-rgb) / 0.97); }
}

.bar {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: calc(var(--col) + var(--pad) * 2);
  margin: 0 auto;
  padding: 0 max(var(--pad), var(--safe-l)) 0 max(var(--pad), var(--safe-r));
}
.bar-top { min-height: 50px; height: auto; padding: 5px 0; align-items: center; }
.bar-tools { min-height: 44px; height: auto; gap: 8px; align-items: center; }

/* Toolbar scales with text size but stays slightly compact vs note body */
.topbar { font-size: var(--chrome-fs); }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--fg);
  font-weight: 700;
  font-size: 0.92rem;
  letter-spacing: -0.02em;
  flex: none;
  opacity: 0.92;
  transition: opacity var(--t) var(--ease), transform var(--t) var(--spring);
}
.brand:hover { opacity: 1; transform: translateY(-1px); }
.brand-mark {
  display: block;
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--fg) 8%, transparent);
}
.brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.brand-word { font-size: 1rem; }

/* tabs */
.tabs {
  position: relative;
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1 1 auto;
  min-width: 0;
  padding: 3px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
  scroll-snap-type: x proximity;
}
.tabs::-webkit-scrollbar { display: none; }

.tab-glider {
  position: absolute;
  top: 3px;
  left: 0;
  height: calc(100% - 6px);
  border-radius: 999px;
  background: var(--accent);
  box-shadow: var(--sh-glow);
  transition: transform var(--t-slow) var(--spring), width var(--t-slow) var(--spring), opacity var(--t) var(--ease);
  will-change: transform, width;
  pointer-events: none;
  opacity: 0;
}
.tabs.is-ready .tab-glider { opacity: 1; }

.tab {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: 1 1 auto;
  justify-content: center;
  min-width: max-content;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.005em;
  color: var(--fg-3);
  scroll-snap-align: center;
  transition: color var(--t) var(--ease), transform var(--t-fast) var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.tab:hover { color: var(--fg-2); }
.tab:active { transform: scale(0.94); }
.tab.is-active { color: var(--accent-ink); }
.tab-count {
  font-style: normal;
  font-size: 0.66rem;
  font-weight: 700;
  padding: 0 4px;
  min-width: 15px;
  height: 15px;
  line-height: 15px;
  text-align: center;
  border-radius: 999px;
  background: rgb(var(--fg-rgb) / 0.1);
  color: var(--fg-3);
  transition: background var(--t) var(--ease), color var(--t) var(--ease), transform var(--t) var(--spring);
}
.tab-count:empty { display: none; }
.tab.is-active .tab-count { background: rgb(0 0 0 / 0.22); color: var(--accent-ink); }
.tab-count.bump { animation: bump 0.4s var(--spring); }
@keyframes bump { 50% { transform: scale(1.35); } }

.bar-right { display: flex; align-items: center; gap: 4px; flex: none; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 11px;
  color: var(--fg-2);
  font-size: 1.02rem;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.icon-btn:hover { background: var(--surface-2); color: var(--fg); }
.icon-btn:active { transform: scale(0.9); }
.cog-btn .ico { transition: transform 0.6s var(--ease-out); }
.cog-btn:hover .ico { transform: rotate(90deg); }

.secure-pill {
  width: auto;
  gap: 5px;
  padding: 0 9px;
  display: inline-flex;
  color: var(--warn);
  background: rgb(255 180 58 / 0.13);
  font-size: 0.95rem;
}
.secure-pill.is-open { color: var(--good); background: rgb(67 217 163 / 0.14); }
.secure-timer { font-size: 0.68rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.secure-pill.pulse { animation: securePulse 1.6s var(--ease) infinite; }
@keyframes securePulse { 50% { box-shadow: 0 0 0 6px rgb(255 180 58 / 0.1); } }

/* toolbar */
.search {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 auto;
  min-width: 0;
  height: 34px;
  padding: 0 10px;
  border-radius: 11px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--fg-3);
  transition: border-color var(--t) var(--ease), background var(--t) var(--ease), box-shadow var(--t) var(--ease);
}
.search:focus-within {
  border-color: var(--accent-line);
  background: var(--surface-2);
  box-shadow: 0 0 0 3px rgb(var(--accent-rgb) / 0.12);
  color: var(--accent);
}
.search input {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  background: none;
  outline: none;
  font-size: 0.85rem;
  color: var(--fg);
}
.search input::placeholder { color: var(--fg-4); }
.search input::-webkit-search-cancel-button { display: none; }
.chip-x {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  color: var(--fg-3);
  background: var(--surface-2);
  font-size: 0.7rem;
}
.chip-x:hover { color: var(--fg); background: var(--surface-3); }

.tool-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 11px;
  border-radius: 11px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--fg-2);
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  flex: none;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.tool-btn:hover { background: var(--surface-2); color: var(--fg); }
.tool-btn:active { transform: scale(0.96); }
.tool-btn.is-on { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft); }
.tool-dot {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 2px var(--bg);
}

.scroll-line { height: 2px; background: transparent; overflow: hidden; }
.scroll-line span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, transparent, var(--accent));
  border-radius: 999px;
  transition: width 0.1s linear, opacity var(--t) var(--ease);
  opacity: 0.65;
}

/* ==========================================================================
   stage + panels
   ========================================================================== */
.stage {
  width: 100%;
  max-width: calc(var(--col) + var(--pad) * 2);
  margin: 0 auto;
  padding: 14px max(var(--pad), var(--safe-l)) calc(120px + var(--safe-b)) max(var(--pad), var(--safe-r));
  min-height: 60vh;
}

html.type-large .p-body,
html.type-large .viewer-body .p-body {
  line-height: 1.68;
}
html.type-xl .p-body,
html.type-xl .viewer-body .p-body {
  line-height: 1.72;
  font-size: 1.02em;
}
html.type-xl .p-title,
html.type-xl .viewer-titles h2 {
  font-size: 1.14em;
}

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

.panel {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 15px 16px 13px;
  border-radius: var(--r);
  background:
    linear-gradient(180deg, rgb(var(--fg-rgb) / 0.055), rgb(var(--fg-rgb) / 0.028)),
    rgb(var(--bg-rgb) / 0.5);
  border: 1px solid var(--line);
  box-shadow: var(--sh-1);
  transition: transform var(--t) var(--ease-out), box-shadow var(--t) var(--ease),
    border-color var(--t) var(--ease), background var(--t) var(--ease), opacity var(--t) var(--ease);
  animation: panelIn 0.44s var(--ease-out) both;
  animation-delay: var(--d, 0ms);
  contain: layout paint style;
}
@keyframes panelIn {
  from { opacity: 0; transform: translate3d(0, 14px, 0) scale(0.985); }
  to { opacity: 1; transform: none; }
}
@media (hover: hover) {
  .panel:hover {
    transform: translateY(-2px);
    border-color: var(--line-2);
    box-shadow: var(--sh-2);
  }
}
.panel.is-permanent { border-color: rgb(var(--accent-rgb) / 0.34); }
.panel.is-pinned { box-shadow: inset 3px 0 0 var(--accent-line); }
.panel.is-permanent::before {
  content: "";
  position: absolute;
  left: 0;
  top: 14px;
  bottom: 14px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
  box-shadow: var(--sh-glow);
}
.panel.is-expiring { border-color: rgb(255 180 58 / 0.3); }
.panel.is-overdue { border-color: rgb(255 95 109 / 0.36); }
.panel.has-custom-border {
  border-color: var(--panel-custom-border) !important;
  border-width: 2px;
}
@media (hover: hover) {
  .panel.has-custom-border:hover {
    border-color: var(--panel-custom-border) !important;
    box-shadow: var(--sh-2), 0 0 0 1px var(--panel-custom-border);
  }
}
.panel.is-done { opacity: 0.55; }
.panel.is-leaving { animation: panelOut 0.3s var(--ease) forwards; }
@keyframes panelOut {
  to { opacity: 0; transform: translateX(-18px) scale(0.96); }
}
.panel.flash { animation: panelFlash 1.1s var(--ease); }
@keyframes panelFlash {
  0% { box-shadow: 0 0 0 0 rgb(var(--accent-rgb) / 0.55); }
  100% { box-shadow: 0 0 0 14px rgb(var(--accent-rgb) / 0); }
}

.p-head { display: flex; align-items: flex-start; gap: 10px; }
.p-badge {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--fg-2);
  font-size: 0.98rem;
  transition: background var(--t) var(--ease), color var(--t) var(--ease), transform var(--t) var(--spring);
}
.panel:hover .p-badge { transform: rotate(-6deg) scale(1.05); }
.p-badge.t-note { color: #8fb7ff; background: rgb(143 183 255 / 0.14); }
.p-badge.t-link { color: #6fe0c4; background: rgb(111 224 196 / 0.14); }
.p-badge.t-file { color: #ffc27a; background: rgb(255 194 122 / 0.14); }
.p-badge.t-time { color: #c79bff; background: rgb(199 155 255 / 0.15); }

.p-titles { flex: 1 1 auto; min-width: 0; }
.p-title {
  font-size: 1.1em;
  font-weight: 650;
  letter-spacing: -0.01em;
  word-break: break-word;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.p-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 7px;
  margin-top: 3px;
  font-size: 0.7rem;
  color: var(--fg-3);
  font-variant-numeric: tabular-nums;
}
.p-meta b { font-weight: 600; color: var(--fg-2); }
.p-meta .sep { opacity: 0.35; }
.p-meta .warn { color: var(--warn); }
.p-meta .danger { color: var(--danger); }
.p-meta .good { color: var(--good); }

/* stays above the security overlay so star / lock / menu remain usable */
.p-tools, .viewer-tools {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 2px;
  flex: none;
}
.p-tools { margin: -3px -4px 0 0; }

.panel.is-clickable { cursor: pointer; }
.panel.is-clickable:active { transform: scale(0.995); }

.p-indicators {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: none;
  margin: -2px 0 0 0;
}
.p-ind {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  color: var(--fg-4);
  font-size: 0.88rem;
  pointer-events: none;
}
.p-ind.star.is-on { color: var(--accent); }
.p-ind.pin.is-on { color: var(--fg); opacity: 0.88; }
.p-ind.lock.is-on { color: var(--warn); }
.p-ind .ico-fill { fill: currentColor; stroke-width: 1.1; }

/* full-screen entry viewer */
.viewer-root {
  position: fixed;
  inset: 0;
  z-index: 96;
  display: grid;
  place-items: stretch;
  padding: max(8px, var(--safe-t)) max(8px, var(--safe-r)) max(8px, var(--safe-b)) max(8px, var(--safe-l));
}
.viewer {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: min(960px, 100%);
  max-height: 100%;
  margin: 0 auto;
  border-radius: var(--r-lg);
  background: rgb(var(--bg-rgb) / 0.96);
  border: 1px solid var(--line-2);
  box-shadow: var(--sh-3);
  backdrop-filter: blur(26px) saturate(1.6);
  -webkit-backdrop-filter: blur(26px) saturate(1.6);
  overflow: hidden;
  animation: modalIn 0.32s var(--ease-out) both;
  font-size: 1rem;
}
.viewer-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 14px 10px;
  border-bottom: 1px solid var(--line);
  flex: none;
}
.viewer-badge {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 11px;
  background: var(--surface-2);
  font-size: 1.05rem;
}
.viewer-titles { flex: 1 1 auto; min-width: 0; }
.viewer-titles h2 {
  font-size: 1.08rem;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.viewer-title-inp {
  display: block;
  width: 100%;
  margin: 0 0 2px;
  font-size: 1.08rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  padding: 8px 10px;
}
.viewer-meta { margin-top: 4px; font-size: 0.72rem; color: var(--fg-3); }
.viewer-tools {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: none;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.viewer-tools .p-tool { width: 34px; height: 34px; }
.viewer-body {
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px 18px 20px;
  display: grid;
  gap: 12px;
  align-content: start;
}
.viewer-body .p-body { font-size: 1em; -webkit-line-clamp: unset; max-height: none; mask: none; -webkit-mask: none; }
.viewer-note-editor {
  display: grid;
  gap: 10px;
  align-content: start;
}
.viewer-note-editor .mdbar { position: sticky; top: 0; z-index: 2; background: var(--bg); padding-bottom: 4px; }
.viewer-note-body {
  min-height: min(52vh, 520px);
  font-size: 1em;
  line-height: 1.55;
  resize: vertical;
}
.viewer-save-hint {
  font-size: 0.72rem;
  color: var(--fg-3);
  flex: 1 1 auto;
  min-width: 0;
}
.viewer-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px 14px calc(12px + var(--safe-b));
  border-top: 1px solid var(--line);
  background: rgb(var(--bg-rgb) / 0.55);
  flex: none;
}
.viewer-foot:empty { display: none; }
.viewer-root.is-closing .viewer { animation: modalOut 0.2s var(--ease) both; }
.p-tool {
  display: grid;
  place-items: center;
  width: 29px;
  height: 29px;
  border-radius: 9px;
  color: var(--fg-4);
  font-size: 0.92rem;
  transition: color var(--t-fast) var(--ease), background var(--t-fast) var(--ease), transform var(--t-fast) var(--spring);
  -webkit-tap-highlight-color: transparent;
}
.p-tool:hover { color: var(--fg); background: var(--surface-2); }
.p-tool:active { transform: scale(0.85); }
.p-tool.is-on { color: var(--accent); }
.p-tool.is-on .ico { fill: currentColor; stroke-width: 1.2; }
.p-tool.star.is-on { color: var(--accent); animation: starPop 0.45s var(--spring); }
.p-tool.pin.is-on { color: var(--fg); }
@keyframes starPop { 40% { transform: scale(1.32) rotate(12deg); } }
.p-tool.danger:hover { color: var(--danger); background: var(--danger-soft); }

.p-body { font-size: 1em; color: var(--fg-2); line-height: 1.62; }
.p-body.clamped {
  display: -webkit-box;
  -webkit-line-clamp: 9;
  -webkit-box-orient: vertical;
  overflow: hidden;
  mask-image: linear-gradient(180deg, #000 68%, transparent);
  -webkit-mask-image: linear-gradient(180deg, #000 68%, transparent);
}
.p-body p { margin: 0 0 0.5em; }
.p-body p:last-child { margin-bottom: 0; }
.p-body h3 { font-size: 1rem; margin: 0.35em 0 0.2em; color: var(--fg); }
.p-body ul, .p-body ol { margin: 0.25em 0; padding-left: 1.2em; }
.p-body li { margin: 0.12em 0; }
.p-body li.task { list-style: none; margin-left: -1.1em; display: flex; gap: 7px; align-items: baseline; }
.p-body li.task i { font-style: normal; color: var(--accent); }
.p-body code {
  padding: 0.1em 0.36em;
  border-radius: 6px;
  background: rgb(var(--fg-rgb) / 0.1);
  color: var(--fg);
}
.p-body pre {
  margin: 0.4em 0;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  background: rgb(0 0 0 / 0.28);
  border: 1px solid var(--line);
  overflow-x: auto;
}
.p-body pre code { background: none; padding: 0; }
.p-body blockquote {
  margin: 0.4em 0;
  padding: 2px 0 2px 12px;
  border-left: 2px solid var(--accent-line);
  color: var(--fg-3);
}
.p-body a { text-decoration: underline; text-decoration-color: var(--accent-line); text-underline-offset: 2px; }
.p-body mark { background: rgb(var(--accent-rgb) / 0.24); color: var(--fg); border-radius: 4px; padding: 0 3px; }
.p-body s { color: var(--fg-4); }
.p-body strong { color: var(--fg); font-weight: 680; }
.p-body hr { border: 0; border-top: 1px solid var(--line); margin: 0.7em 0; }
.p-more {
  align-self: flex-start;
  font-size: 0.74rem;
  font-weight: 650;
  color: var(--accent);
  padding: 2px 0;
}
.p-more:hover { text-decoration: underline; }

.p-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.p-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--fg-3);
  font-size: 0.68rem;
  font-weight: 600;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.p-tag:hover { background: var(--accent-soft); color: var(--accent); }

/* link panel */
a.p-link {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}
.p-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border-radius: var(--r-sm);
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--fg-2);
  min-width: 0;
  transition: background var(--t) var(--ease), border-color var(--t) var(--ease), transform var(--t) var(--ease);
}
.p-link:hover { background: var(--surface-2); border-color: var(--accent-line); transform: translateX(2px); }
.p-favicon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--accent-ink);
  background: var(--accent);
  text-transform: uppercase;
}
.p-link-text { min-width: 0; flex: 1 1 auto; }
.p-host { font-size: 0.78rem; font-weight: 600; color: var(--fg); }
.p-url {
  font-size: 0.7rem;
  color: var(--fg-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  direction: ltr;
}

/* file panel */
.p-file {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 11px;
  border-radius: var(--r-sm);
  background: var(--surface);
  border: 1px solid var(--line);
  min-width: 0;
}
.p-fileicon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 9px;
  background: var(--surface-2);
  color: var(--fg-2);
  font-size: 1.05rem;
}
.p-filetext { min-width: 0; flex: 1 1 auto; }
.p-filename {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.p-filemeta { font-size: 0.68rem; color: var(--fg-3); }
.p-thumb {
  position: relative;
  display: block;
  width: 100%;
  border-radius: var(--r-sm);
  overflow: hidden;
  background: rgb(0 0 0 / 0.25);
  border: 1px solid var(--line);
  aspect-ratio: 16 / 9;
}
.p-thumb img, .p-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.6s var(--ease-out), filter var(--t) var(--ease);
}
.p-thumb:hover img { transform: scale(1.035); }
.p-thumb.is-loading::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 20%, rgb(var(--fg-rgb) / 0.08) 45%, transparent 70%);
  background-size: 220% 100%;
  animation: shimmer 1.3s linear infinite;
}
.p-audio { width: 100%; margin-top: 2px; }
audio { width: 100%; height: 34px; }

/* time panel */
.p-when {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border-radius: var(--r-sm);
  background: var(--surface);
  border: 1px solid var(--line);
}
.p-when-cal {
  display: grid;
  place-items: center;
  width: 42px;
  flex: none;
  padding: 3px 0;
  border-radius: 9px;
  background: rgb(var(--bg-rgb) / 0.5);
  border: 1px solid var(--line);
  line-height: 1.05;
}
.p-when-cal b { font-size: 1.02rem; font-weight: 700; }
.p-when-cal span { font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--fg-3); }
.p-when-text { flex: 1 1 auto; min-width: 0; }
.p-when-main { font-size: 0.82rem; font-weight: 600; }
.p-countdown {
  font-size: 0.7rem;
  color: var(--fg-3);
  font-variant-numeric: tabular-nums;
}
.p-countdown.soon { color: var(--warn); }
.p-countdown.now { color: var(--danger); font-weight: 700; }
.p-countdown.past { color: var(--fg-4); }
.ring {
  --v: 0;
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 999px;
  background:
    conic-gradient(var(--accent) calc(var(--v) * 1%), rgb(var(--fg-rgb) / 0.12) 0),
    var(--bg);
  display: grid;
  place-items: center;
  transition: --v 0.6s var(--ease);
}
.ring i {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: rgb(var(--bg-rgb) / 0.92);
  display: grid;
  place-items: center;
  font-size: 0.62rem;
  font-style: normal;
  font-weight: 700;
  color: var(--fg-2);
}

/* secured panels */
.panel.is-secured .p-body,
.panel.is-secured .p-title,
.panel.is-secured .p-link,
.panel.is-secured .p-file,
.panel.is-secured .p-tags,
.panel.is-secured .p-when-text {
  filter: blur(9px);
  opacity: 0.75;
  user-select: none;
  pointer-events: none;
  transition: filter var(--t-slow) var(--ease), opacity var(--t-slow) var(--ease);
}
.panel.is-secured { cursor: pointer; }
.panel.is-secured::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: repeating-linear-gradient(135deg, rgb(var(--fg-rgb) / 0.028) 0 8px, transparent 8px 16px);
  pointer-events: none;
}
.panel.is-revealed .p-body,
.panel.is-revealed .p-title,
.panel.is-revealed .p-link,
.panel.is-revealed .p-file,
.panel.is-revealed .p-tags,
.panel.is-revealed .p-when-text {
  filter: none;
  opacity: 1;
  user-select: auto;
  pointer-events: auto;
}
.panel.is-revealed::after { display: none; }
.panel.is-revealed { cursor: default; }
/* slow re-blur when the session goes idle */
.panel.is-relocking .p-body,
.panel.is-relocking .p-title,
.panel.is-relocking .p-link,
.panel.is-relocking .p-file,
.panel.is-relocking .p-tags,
.panel.is-relocking .p-when-text {
  animation: reblur 10s linear forwards;
}
@keyframes reblur {
  from { filter: blur(0); opacity: 1; }
  35% { filter: blur(1px); opacity: 0.98; }
  to { filter: blur(9px); opacity: 0.75; }
}
.p-guard {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  border-radius: inherit;
}
.p-guard span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px;
  border-radius: 999px;
  background: rgb(var(--bg-rgb) / 0.72);
  border: 1px solid var(--line-2);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  font-size: 0.74rem;
  font-weight: 650;
  color: var(--fg-2);
  box-shadow: var(--sh-1);
  transition: transform var(--t) var(--spring), background var(--t) var(--ease);
}
.panel.is-secured:hover .p-guard span { transform: scale(1.05); background: rgb(var(--bg-rgb) / 0.85); }
.panel.is-revealed .p-guard { display: none; }

/* selection mode */
.panel.is-picked { border-color: var(--accent); background: var(--accent-soft); }
.pick-box {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 7px;
  border: 1.6px solid var(--line-2);
  color: transparent;
  font-size: 0.7rem;
  flex: none;
  transition: all var(--t-fast) var(--ease);
}
.panel.is-picked .pick-box { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* empty + skeleton */
.empty {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 54px 20px 40px;
  text-align: center;
  animation: panelIn 0.5s var(--ease-out) both;
}
.empty-art {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  border-radius: 22px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 1.7rem;
  margin-bottom: 4px;
  animation: floaty 4.5s var(--ease) infinite;
}
@keyframes floaty { 50% { transform: translateY(-7px); } }
.empty h2 { font-size: 1.02rem; }
.empty p { font-size: 0.85rem; color: var(--fg-3); max-width: 42ch; line-height: 1.55; }

.empty-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
  max-width: 420px;
  margin-top: 6px;
}
@media (min-width: 520px) {
  .empty-actions { grid-template-columns: repeat(4, minmax(0, 1fr)); max-width: 640px; }
}
.empty-act {
  display: grid;
  gap: 4px;
  justify-items: center;
  text-align: center;
  padding: 14px 10px;
  border-radius: var(--r);
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--fg);
  transition: border-color var(--t) var(--ease), background var(--t) var(--ease), transform var(--t) var(--spring);
  -webkit-tap-highlight-color: transparent;
}
.empty-act .ico { font-size: 1.35rem; color: var(--accent); }
.empty-act span { font-size: 0.82rem; font-weight: 650; }
.empty-act small { font-size: 0.65rem; color: var(--fg-4); line-height: 1.3; }
.empty-act:hover { border-color: var(--accent-line); background: var(--accent-soft); transform: translateY(-2px); }
.empty-act:active { transform: scale(0.97); }

.tool-new { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft); }
.tool-new .ico { color: var(--accent); }
@media (max-width: 560px) {
  .tool-new-label { display: none; }
}

.skeletons { display: grid; gap: 12px; }
.skel {
  height: 104px;
  border-radius: var(--r);
  background:
    linear-gradient(100deg, transparent 18%, rgb(var(--fg-rgb) / 0.07) 42%, transparent 66%),
    var(--surface);
  background-size: 220% 100%, auto;
  animation: shimmer 1.25s linear infinite;
  border: 1px solid var(--line);
}
.skel:nth-child(2) { height: 138px; animation-delay: 0.1s; }
.skel:nth-child(3) { height: 92px; animation-delay: 0.2s; }
@keyframes shimmer { from { background-position: 120% 0; } to { background-position: -120% 0; } }

.stage-foot {
  padding: 22px 4px 4px;
  text-align: center;
  font-size: 0.72rem;
  color: var(--fg-4);
}

/* ==========================================================================
   fab
   ========================================================================== */
.fab-stack {
  position: fixed;
  right: max(var(--pad), var(--safe-r));
  bottom: calc(18px + var(--safe-b));
  z-index: 55;
  display: grid;
  justify-items: end;
  gap: 10px;
}
.fab {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 20px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 1.5rem;
  box-shadow: 0 6px 18px -4px rgb(var(--accent-rgb) / 0.55), var(--sh-2);
  transition: transform var(--t) var(--spring), box-shadow var(--t) var(--ease), border-radius var(--t) var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.fab:hover { transform: translateY(-2px) scale(1.04); }
.fab:active { transform: scale(0.93); }
.fab .ico { transition: transform var(--t-slow) var(--spring); stroke-width: 2.1; }
.fab-stack.is-open .fab { border-radius: 999px; }
.fab-stack.is-open .fab .ico { transform: rotate(135deg); }

.fab-menu { display: grid; gap: 8px; justify-items: end; }
.fab-item {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  height: 42px;
  padding: 0 8px 0 14px;
  border-radius: 999px;
  background: rgb(var(--bg-rgb) / 0.86);
  border: 1px solid var(--line-2);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: var(--fg);
  font-size: 0.83rem;
  font-weight: 600;
  box-shadow: var(--sh-2);
  animation: fabIn 0.34s var(--spring) both;
  animation-delay: var(--d, 0ms);
}
.fab-item .ico { font-size: 1.1rem; color: var(--accent); }
.fab-item:hover { border-color: var(--accent-line); transform: translateX(-3px); }
.fab-item:active { transform: scale(0.95); }
.fab-menu.is-closing .fab-item { animation: fabOut 0.16s var(--ease) both; }
@keyframes fabIn { from { opacity: 0; transform: translateY(14px) scale(0.9); } to { opacity: 1; transform: none; } }
@keyframes fabOut { to { opacity: 0; transform: translateY(10px) scale(0.94); } }

/* ==========================================================================
   sheet / modal / popover
   ========================================================================== */
.sheet-root, .modal-root, .pop-root, .lightbox {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
}
.sheet-root[hidden],
.modal-root[hidden],
.viewer-root[hidden],
.pop-root[hidden],
.lightbox[hidden],
.drop-veil[hidden],
#empty[hidden],
#skeletons[hidden],
#fabMenu[hidden] {
  display: none !important;
}
.sheet-body, .modal-body { font-size: 1rem; }
/* editors open on top of the settings modal (admin user editing) */
.sheet-root { z-index: 95; }
.pop-root { z-index: 108; }
.sheet-veil, .modal-veil, .pop-veil {
  position: absolute;
  inset: 0;
  background: rgb(0 0 0 / 0.5);
  backdrop-filter: blur(5px) saturate(0.9);
  -webkit-backdrop-filter: blur(5px) saturate(0.9);
  animation: veilIn var(--t) var(--ease) both;
}
.pop-veil { background: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; }
@keyframes veilIn { from { opacity: 0; } to { opacity: 1; } }
.is-closing .sheet-veil, .is-closing .modal-veil { animation: veilOut 0.18s var(--ease) both; }
@keyframes veilOut { to { opacity: 0; } }

.sheet, .modal {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  background: rgb(var(--bg-rgb) / 0.94);
  border: 1px solid var(--line-2);
  box-shadow: var(--sh-3);
  backdrop-filter: blur(26px) saturate(1.6);
  -webkit-backdrop-filter: blur(26px) saturate(1.6);
  overflow: hidden;
}
.sheet {
  place-self: end center;
  width: min(680px, 100%);
  max-height: min(92svh, 940px);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  border-bottom: 0;
  padding-bottom: var(--safe-b);
  animation: sheetIn 0.4s var(--ease-out) both;
  touch-action: pan-y;
}
@keyframes sheetIn { from { transform: translateY(102%); } to { transform: none; } }
.is-closing .sheet { animation: sheetOut 0.24s var(--ease) both; }
@keyframes sheetOut { to { transform: translateY(104%); } }

.modal {
  place-self: center;
  width: min(720px, calc(100% - 24px));
  max-height: min(88svh, 900px);
  border-radius: var(--r-lg);
  animation: modalIn 0.32s var(--ease-out) both;
  margin: max(12px, var(--safe-t)) 0 max(12px, var(--safe-b));
}
@keyframes modalIn { from { opacity: 0; transform: translateY(14px) scale(0.97); } to { opacity: 1; transform: none; } }
.is-closing .modal { animation: modalOut 0.2s var(--ease) both; }
@keyframes modalOut { to { opacity: 0; transform: translateY(10px) scale(0.98); } }

@media (min-width: 700px) {
  .sheet {
    place-self: center;
    border-radius: var(--r-lg);
    border-bottom: 1px solid var(--line-2);
    max-height: min(88svh, 900px);
    animation: modalIn 0.32s var(--ease-out) both;
    margin: 0;
  }
  .is-closing .sheet { animation: modalOut 0.2s var(--ease) both; }
  .sheet-grip { display: none; }
}

.sheet-grip { display: grid; place-items: center; padding: 9px 0 2px; cursor: grab; touch-action: none; }
.sheet-grip span { width: 42px; height: 4px; border-radius: 99px; background: var(--line-2); }

.sheet-head, .modal-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px 10px;
  flex: none;
}
.sheet-head h2, .modal-head h2 { flex: 1 1 auto; font-size: 1rem; }
.sheet-body, .modal-body {
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 2px 16px 14px;
  display: grid;
  gap: 13px;
  align-content: start;
}
.sheet-foot, .modal-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 16px calc(13px + var(--safe-b));
  border-top: 1px solid var(--line);
  background: rgb(var(--bg-rgb) / 0.6);
  flex: none;
  flex-wrap: wrap;
}
.sheet-foot:empty, .modal-foot:empty { display: none; }
.foot-spacer { flex: 1 1 auto; }

.pop {
  position: absolute;
  z-index: 1;
  min-width: 218px;
  max-width: min(320px, calc(100vw - 20px));
  padding: 6px;
  border-radius: var(--r);
  background: rgb(var(--bg-rgb) / 0.94);
  border: 1px solid var(--line-2);
  box-shadow: var(--sh-3);
  backdrop-filter: blur(22px) saturate(1.6);
  -webkit-backdrop-filter: blur(22px) saturate(1.6);
  transform-origin: top right;
  animation: popIn 0.2s var(--ease-out) both;
  max-height: min(70svh, 560px);
  overflow-y: auto;
}
@keyframes popIn { from { opacity: 0; transform: translateY(-6px) scale(0.96); } to { opacity: 1; transform: none; } }
.pop-title {
  padding: 7px 10px 4px;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--fg-4);
}
.pop-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  font-size: 0.84rem;
  font-weight: 550;
  color: var(--fg-2);
  text-align: left;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.pop-item:hover { background: var(--surface-2); color: var(--fg); }
.pop-item .ico { font-size: 1rem; color: var(--fg-3); }
.pop-item.is-on { color: var(--accent); background: var(--accent-soft); }
.pop-item.is-on .ico { color: var(--accent); }
.pop-item .tail { margin-left: auto; font-size: 0.72rem; color: var(--fg-4); }
.pop-item.danger { color: var(--danger); }
.pop-item.danger:hover { background: var(--danger-soft); }
.pop-item.danger .ico { color: var(--danger); }
.pop-sep { height: 1px; margin: 5px 6px; background: var(--line); }

/* ==========================================================================
   forms
   ========================================================================== */
.field { display: grid; gap: 6px; }
.field > label, .flabel {
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.02em;
  color: var(--fg-3);
  display: flex;
  align-items: center;
  gap: 6px;
}
.flabel .tail { margin-left: auto; font-weight: 500; color: var(--fg-4); font-variant-numeric: tabular-nums; }
.hint { font-size: 0.72rem; color: var(--fg-4); line-height: 1.45; }
.hint.warn { color: var(--warn); }
.hint.bad { color: var(--danger); }
.hint.good { color: var(--good); }

.inp, textarea.inp, select.inp {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--fg);
  font-size: 0.88rem;
  outline: none;
  transition: border-color var(--t) var(--ease), background var(--t) var(--ease), box-shadow var(--t) var(--ease);
  -webkit-appearance: none;
  appearance: none;
}
.inp::placeholder { color: var(--fg-4); }
.inp:hover { background: var(--surface-2); }
.inp:focus {
  border-color: var(--accent-line);
  background: var(--surface-2);
  box-shadow: 0 0 0 3px rgb(var(--accent-rgb) / 0.13);
}
.inp:disabled { opacity: 0.55; cursor: not-allowed; }
.inp.is-bad { border-color: var(--danger); box-shadow: 0 0 0 3px rgb(255 95 109 / 0.12); }
textarea.inp {
  resize: vertical;
  min-height: 96px;
  line-height: 1.62;
  font-family: inherit;
}
textarea.inp.grow { resize: none; overflow: hidden; }
textarea.inp.mono { font-family: var(--mono); font-size: 0.83rem; }
select.inp {
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 32px;
}
select.inp option { background: #16161c; color: #eee; }
.inp-row { display: flex; gap: 8px; align-items: center; }
.inp-row .inp { flex: 1 1 auto; min-width: 0; }
.inp-wrap { position: relative; display: flex; align-items: center; }
.inp-wrap .inp { padding-right: 40px; }
.inp-act {
  position: absolute;
  right: 5px;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  color: var(--fg-3);
  transition: all var(--t-fast) var(--ease);
}
.inp-act:hover { color: var(--fg); background: var(--surface-2); }
.inp-act.is-on { color: var(--accent); }
.inp.is-masked {
  -webkit-text-security: disc;
  text-security: disc;
}
.inp.is-masked.is-visible {
  -webkit-text-security: none;
  text-security: none;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 40px;
  padding: 0 16px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--fg);
  font-size: 0.85rem;
  font-weight: 650;
  white-space: nowrap;
  transition: transform var(--t-fast) var(--ease), background var(--t-fast) var(--ease),
    box-shadow var(--t) var(--ease), border-color var(--t-fast) var(--ease), opacity var(--t) var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: scale(0.97); }
.btn[disabled] { opacity: 0.45; pointer-events: none; }
.btn.primary {
  background: var(--accent);
  border-color: transparent;
  color: var(--accent-ink);
  box-shadow: 0 4px 14px -6px rgb(var(--accent-rgb) / 0.7);
}
.btn.primary:hover { box-shadow: 0 7px 22px -6px rgb(var(--accent-rgb) / 0.85); }
.btn.ghost { background: none; border-color: var(--line); color: var(--fg-2); }
.btn.ghost:hover { background: var(--surface); color: var(--fg); }
.btn.danger { background: var(--danger-soft); border-color: rgb(255 95 109 / 0.34); color: var(--danger); }
.btn.danger:hover { background: rgb(255 95 109 / 0.22); }
.btn.small { height: 32px; padding: 0 11px; font-size: 0.78rem; border-radius: 10px; }
.btn.wide { width: 100%; }
.btn.is-busy { pointer-events: none; color: transparent; position: relative; }
.btn.is-busy::after {
  content: "";
  position: absolute;
  width: 15px;
  height: 15px;
  border-radius: 999px;
  border: 2px solid rgb(255 255 255 / 0.35);
  border-top-color: #fff;
  animation: spin 0.7s linear infinite;
}
.btn.primary.is-busy::after { border-color: rgb(0 0 0 / 0.25); border-top-color: var(--accent-ink); }
@keyframes spin { to { transform: rotate(360deg); } }

.seg {
  display: flex;
  gap: 3px;
  padding: 3px;
  border-radius: var(--r-sm);
  background: var(--surface);
  border: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
}
.seg::-webkit-scrollbar { display: none; }
.seg button {
  flex: 1 1 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: max-content;
  padding: 7px 12px;
  border-radius: 9px;
  font-size: 0.8rem;
  font-weight: 620;
  color: var(--fg-3);
  transition: all var(--t-fast) var(--ease);
}
.seg button:hover { color: var(--fg-2); background: var(--surface-2); }
.seg button.is-on { background: var(--accent); color: var(--accent-ink); box-shadow: var(--sh-1); }

.switch-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 13px;
  border-radius: var(--r-sm);
  background: var(--surface);
  border: 1px solid var(--line);
  transition: border-color var(--t) var(--ease), background var(--t) var(--ease);
}
.switch-row:hover { background: var(--surface-2); }
.switch-row.is-on { border-color: var(--accent-line); }
.switch-row .ico { font-size: 1.05rem; color: var(--fg-3); flex: none; }
.switch-row.is-on .ico { color: var(--accent); }
.switch-text { flex: 1 1 auto; min-width: 0; }
.switch-text b { display: block; font-size: 0.83rem; font-weight: 650; }
.switch-text span { font-size: 0.72rem; color: var(--fg-4); }
.switch {
  position: relative;
  width: 42px;
  height: 25px;
  flex: none;
  border-radius: 999px;
  background: rgb(var(--fg-rgb) / 0.16);
  transition: background var(--t) var(--ease);
}
.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 19px;
  height: 19px;
  border-radius: 999px;
  background: var(--fg);
  box-shadow: var(--sh-1);
  transition: transform var(--t) var(--spring), background var(--t) var(--ease);
}
.switch-row.is-on .switch { background: var(--accent); }
.switch-row.is-on .switch::after { transform: translateX(17px); background: var(--accent-ink); }

.border-color-editor { display: grid; gap: 8px; margin-bottom: 4px; }
.border-controls { display: grid; gap: 10px; padding: 0 2px 4px; }
.border-controls-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px 12px;
  align-items: center;
}
.border-controls-row input[type="color"] {
  width: 44px;
  height: 36px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
}
.border-alpha { font-size: 0.78rem; color: var(--fg-3); white-space: nowrap; }
.border-alpha-label { font-variant-numeric: tabular-nums; color: var(--fg-2); margin-left: 4px; }
.border-controls-row input[type="range"] { width: 100%; min-width: 0; }
.border-preview {
  height: 36px;
  border-radius: var(--r-sm);
  border: 2px solid transparent;
  background: var(--surface);
}

.tagbox {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px;
  border-radius: var(--r-sm);
  background: var(--surface);
  border: 1px solid var(--line);
  transition: border-color var(--t) var(--ease);
}
.tagbox:focus-within { border-color: var(--accent-line); box-shadow: 0 0 0 3px rgb(var(--accent-rgb) / 0.13); }
.tagbox input {
  flex: 1 1 90px;
  min-width: 90px;
  border: 0;
  background: none;
  outline: none;
  font-size: 0.83rem;
  padding: 3px;
}
.tagchip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 5px 3px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 620;
  animation: popTag 0.24s var(--spring) both;
}
@keyframes popTag { from { transform: scale(0.7); opacity: 0; } }
.tagchip button { display: grid; place-items: center; width: 15px; height: 15px; border-radius: 999px; color: inherit; opacity: 0.7; }
.tagchip button:hover { opacity: 1; background: rgb(var(--accent-rgb) / 0.2); }

.mdbar { display: flex; gap: 3px; flex-wrap: wrap; align-items: center; }
.mdbar button {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  color: var(--fg-3);
  font-size: 0.9rem;
  transition: all var(--t-fast) var(--ease);
}
.mdbar button:hover { background: var(--surface-2); color: var(--fg); }
.mdbar button.is-rec { color: var(--danger); background: var(--danger-soft); animation: recPulse 1.4s ease-in-out infinite; }
@keyframes recPulse { 50% { box-shadow: 0 0 0 6px rgb(255 95 109 / 0.12); } }
.mdbar .spacer { flex: 1 1 auto; }
.mdbar .count { font-size: 0.68rem; color: var(--fg-4); font-variant-numeric: tabular-nums; padding-right: 4px; }

.dictating { position: relative; }
.wave { display: inline-flex; align-items: flex-end; gap: 2px; height: 12px; }
.wave i {
  width: 2px;
  background: currentColor;
  border-radius: 2px;
  animation: wave 0.9s var(--ease) infinite;
}
.wave i:nth-child(1) { height: 4px; animation-delay: 0s; }
.wave i:nth-child(2) { height: 10px; animation-delay: 0.12s; }
.wave i:nth-child(3) { height: 6px; animation-delay: 0.24s; }
.wave i:nth-child(4) { height: 12px; animation-delay: 0.36s; }
@keyframes wave { 50% { transform: scaleY(0.35); } }

.dropzone {
  display: grid;
  place-items: center;
  gap: 6px;
  padding: 26px 18px;
  border-radius: var(--r);
  border: 1.6px dashed var(--line-2);
  background: var(--surface);
  color: var(--fg-3);
  text-align: center;
  cursor: pointer;
  transition: all var(--t) var(--ease);
}
.dropzone:hover, .dropzone.is-over { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.dropzone .ico { font-size: 1.5rem; }
.dropzone b { font-size: 0.87rem; color: var(--fg); }
.dropzone span { font-size: 0.73rem; }

.picked-list { display: grid; gap: 7px; }
.picked {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  background: var(--surface);
  border: 1px solid var(--line);
  animation: panelIn 0.3s var(--ease-out) both;
}
.picked .ico { color: var(--fg-3); flex: none; }
.picked-text { flex: 1 1 auto; min-width: 0; }
.picked-text b { display: block; font-size: 0.8rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.picked-text span { font-size: 0.7rem; color: var(--fg-4); }
.picked-thumb { width: 38px; height: 38px; border-radius: 8px; object-fit: cover; flex: none; background: rgb(0 0 0 / 0.25); }

.bar-progress {
  height: 4px;
  border-radius: 99px;
  background: rgb(var(--fg-rgb) / 0.12);
  overflow: hidden;
}
.bar-progress i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 99px;
  background: var(--accent);
  transition: width 0.2s var(--ease);
}
.bar-progress.good i { background: var(--good); }
.bar-progress.warn i { background: var(--warn); }
.bar-progress.bad i { background: var(--danger); }

.swatches { display: flex; flex-wrap: wrap; gap: 7px; }
.swatch {
  width: 26px;
  height: 26px;
  border-radius: 9px;
  border: 2px solid transparent;
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.14);
  transition: transform var(--t-fast) var(--spring), border-color var(--t-fast) var(--ease);
}
.swatch:hover { transform: scale(1.14); }
.swatch.is-on { border-color: var(--fg); transform: scale(1.08); }

.color-field { display: flex; align-items: center; gap: 9px; }
.color-field input[type="color"] {
  width: 40px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: none;
  cursor: pointer;
}
.color-field input[type="color"]::-webkit-color-swatch-wrapper { padding: 3px; }
.color-field input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 7px; }
.color-field .inp { flex: 1 1 auto; font-family: var(--mono); text-transform: lowercase; }

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 26px;
  background: none;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 5px;
  border-radius: 99px;
  background: rgb(var(--fg-rgb) / 0.14);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 19px;
  height: 19px;
  margin-top: -7px;
  border-radius: 999px;
  background: var(--accent);
  border: 3px solid var(--bg);
  box-shadow: var(--sh-1);
  transition: transform var(--t-fast) var(--spring);
}
input[type="range"]::-webkit-slider-thumb:active { transform: scale(1.2); }
input[type="range"]::-moz-range-track { height: 5px; border-radius: 99px; background: rgb(var(--fg-rgb) / 0.14); }
input[type="range"]::-moz-range-thumb {
  width: 15px;
  height: 15px;
  border-radius: 999px;
  background: var(--accent);
  border: 3px solid var(--bg);
}

/* settings specifics */
.mtabs { display: flex; gap: 3px; padding: 0 16px 10px; overflow-x: auto; scrollbar-width: none; flex: none; }
.mtabs::-webkit-scrollbar { display: none; }
.mtab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 0.79rem;
  font-weight: 620;
  color: var(--fg-3);
  white-space: nowrap;
  transition: all var(--t-fast) var(--ease);
}
.mtab .ico { font-size: 0.98rem; }
.mtab:hover { background: var(--surface); color: var(--fg-2); }
.mtab.is-on { background: var(--accent-soft); color: var(--accent); }

.card {
  display: grid;
  gap: 11px;
  padding: 14px;
  border-radius: var(--r);
  background: var(--surface);
  border: 1px solid var(--line);
}
.card > h3 { font-size: 0.86rem; display: flex; align-items: center; gap: 7px; }
.card > h3 .ico { color: var(--accent); }
.card.tight { gap: 8px; padding: 12px; }
.card.accent { border-color: var(--accent-line); background: var(--accent-soft); }
.card.danger { border-color: rgb(255 95 109 / 0.3); background: var(--danger-soft); }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 9px; }
.stat {
  display: grid;
  gap: 2px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  background: rgb(var(--bg-rgb) / 0.4);
  border: 1px solid var(--line);
}
.stat b { font-size: 1.02rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat span { font-size: 0.68rem; color: var(--fg-4); text-transform: uppercase; letter-spacing: 0.06em; }

.rows { display: grid; gap: 7px; }
.row-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  background: var(--surface);
  border: 1px solid var(--line);
  transition: border-color var(--t) var(--ease), background var(--t) var(--ease), transform var(--t) var(--ease);
}
.row-item:hover { border-color: var(--line-2); transform: translateX(2px); }
.row-item.is-off { opacity: 0.6; }
.avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 11px;
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--accent-ink);
  background: var(--accent);
  text-transform: uppercase;
}
.row-text { flex: 1 1 auto; min-width: 0; }
.row-text b { display: flex; align-items: center; gap: 6px; font-size: 0.86rem; font-weight: 650; }
.row-text span { font-size: 0.71rem; color: var(--fg-4); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 0.63rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  background: var(--surface-3);
  color: var(--fg-3);
}
.pill.accent { background: var(--accent-soft); color: var(--accent); }
.pill.good { background: rgb(67 217 163 / 0.16); color: var(--good); }
.pill.bad { background: var(--danger-soft); color: var(--danger); }
.pill.warn { background: rgb(255 180 58 / 0.16); color: var(--warn); }

.keyline {
  font-family: var(--mono);
  font-size: 0.76rem;
  word-break: break-all;
  padding: 9px 11px;
  border-radius: var(--r-sm);
  background: rgb(var(--bg-rgb) / 0.5);
  border: 1px dashed var(--line-2);
  color: var(--fg-2);
}
.meter { display: flex; gap: 4px; }
.meter i {
  flex: 1 1 auto;
  height: 4px;
  border-radius: 99px;
  background: rgb(var(--fg-rgb) / 0.14);
  transition: background var(--t) var(--ease);
}
.meter.s1 i:nth-child(-n+1) { background: var(--danger); }
.meter.s2 i:nth-child(-n+2) { background: var(--warn); }
.meter.s3 i:nth-child(-n+3) { background: #7fd67f; }
.meter.s4 i { background: var(--good); }

/* ==========================================================================
   lightbox
   ========================================================================== */
.lightbox {
  z-index: 100;
  background: rgb(0 0 0 / 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  place-items: center;
  animation: veilIn var(--t) var(--ease) both;
  padding: max(16px, var(--safe-t)) 16px max(16px, var(--safe-b));
  grid-template-rows: 1fr auto;
  gap: 12px;
}
.lightbox.is-closing { animation: veilOut 0.2s var(--ease) both; }
.lightbox-stage {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 0;
  overflow: auto;
}
.lightbox-stage img, .lightbox-stage video {
  max-width: 100%;
  max-height: 76svh;
  border-radius: var(--r-sm);
  box-shadow: var(--sh-3);
  animation: modalIn 0.34s var(--ease-out) both;
}
.lightbox-stage pre {
  max-width: min(900px, 100%);
  max-height: 76svh;
  overflow: auto;
  margin: 0;
  padding: 16px;
  border-radius: var(--r);
  background: rgb(var(--bg-rgb) / 0.9);
  border: 1px solid var(--line);
  font-size: 0.8rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--fg-2);
}
.lightbox-stage iframe {
  width: min(1000px, 100%);
  height: 76svh;
  border: 0;
  border-radius: var(--r);
  background: #fff;
  box-shadow: var(--sh-3);
}
.lightbox-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  color: #fff;
  font-size: 0.8rem;
}
.lightbox-close { position: absolute; top: max(12px, var(--safe-t)); right: 14px; color: #fff; z-index: 2; background: rgb(255 255 255 / 0.1); }

/* ==========================================================================
   toasts, drop veil, misc
   ========================================================================== */
.toasts {
  position: fixed;
  left: 50%;
  bottom: calc(20px + var(--safe-b));
  transform: translateX(-50%);
  z-index: 120;
  display: grid;
  gap: 8px;
  justify-items: center;
  width: min(460px, calc(100% - 24px));
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: 100%;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgb(var(--bg-rgb) / 0.9);
  border: 1px solid var(--line-2);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: var(--sh-2);
  font-size: 0.83rem;
  font-weight: 550;
  color: var(--fg);
  pointer-events: auto;
  animation: toastIn 0.34s var(--spring) both;
}
.toast.is-out { animation: toastOut 0.26s var(--ease) both; }
@keyframes toastIn { from { opacity: 0; transform: translateY(18px) scale(0.94); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(10px) scale(0.96); } }
.toast .ico { flex: none; font-size: 1rem; }
.toast.good { border-color: rgb(67 217 163 / 0.4); }
.toast.good .ico { color: var(--good); }
.toast.bad { border-color: rgb(255 95 109 / 0.4); }
.toast.bad .ico { color: var(--danger); }
.toast.warn .ico { color: var(--warn); }
.toast button.undo {
  margin-left: 3px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 700;
}
.toast button.undo:hover { background: rgb(var(--accent-rgb) / 0.25); }

.drop-veil {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: grid;
  place-items: center;
  background: rgb(var(--bg-rgb) / 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: veilIn 0.16s var(--ease) both;
  pointer-events: none; /* hint only — page stays clickable; real drop still works on window */
}
.drop-veil[hidden] { display: none !important; }
.drop-card {
  display: grid;
  justify-items: center;
  gap: 5px;
  padding: 34px 46px;
  border-radius: var(--r-lg);
  border: 2px dashed var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  text-align: center;
  animation: dropPulse 1.6s var(--ease) infinite;
}
.drop-card .ico { font-size: 2rem; }
.drop-card strong { font-size: 1rem; color: var(--fg); }
.drop-card span { font-size: 0.78rem; color: var(--fg-3); }
@keyframes dropPulse { 50% { transform: scale(1.02); } }

.veil-blur {
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  backdrop-filter: blur(0px);
}

.spinner {
  width: 17px;
  height: 17px;
  border-radius: 999px;
  border: 2px solid rgb(var(--fg-rgb) / 0.2);
  border-top-color: var(--accent);
  animation: spin 0.7s linear infinite;
}
.center-note { display: grid; place-items: center; gap: 9px; padding: 26px; color: var(--fg-3); font-size: 0.83rem; text-align: center; }

/* ==========================================================================
   login / error gate
   ========================================================================== */
.gate-page { display: grid; place-items: center; min-height: 100svh; padding: 24px 16px; overflow: hidden; }
.gate-glow { position: fixed; inset: 0; z-index: -1; overflow: hidden; }
.gate-glow i {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.42;
  animation: drift 17s var(--ease) infinite alternate;
}
.gate-glow i:nth-child(1) { width: 46vmax; height: 46vmax; top: -14vmax; right: -10vmax; background: #7c9cff; }
.gate-glow i:nth-child(2) { width: 38vmax; height: 38vmax; bottom: -14vmax; left: -10vmax; background: #a06bff; animation-delay: -6s; }
.gate-glow i:nth-child(3) { width: 26vmax; height: 26vmax; top: 42%; left: 46%; background: #43d9a3; opacity: 0.22; animation-delay: -11s; }
@keyframes drift { to { transform: translate3d(6vmax, 4vmax, 0) scale(1.14); } }

.gate { width: 100%; display: grid; place-items: center; }
.gate-card {
  width: min(400px, 100%);
  display: grid;
  gap: 13px;
  padding: 30px 26px 24px;
  border-radius: var(--r-xl);
  background: rgb(16 16 22 / 0.66);
  border: 1px solid rgb(255 255 255 / 0.11);
  backdrop-filter: blur(28px) saturate(1.6);
  -webkit-backdrop-filter: blur(28px) saturate(1.6);
  box-shadow: var(--sh-3);
  text-align: center;
  animation: modalIn 0.6s var(--ease-out) both;
  color: #ececf4;
}
.gate-mark { display: grid; place-items: center; }
.gate-mark img {
  display: block;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  box-shadow: 0 8px 28px color-mix(in srgb, var(--accent) 35%, transparent);
}
.gate-card h1 { font-size: 1.5rem; letter-spacing: -0.03em; }
.gate-code { font-size: 2.6rem; font-weight: 800; color: #7c9cff; letter-spacing: -0.04em; }
.gate-sub { font-size: 0.85rem; color: rgb(236 236 244 / 0.6); }
.gate-error {
  padding: 9px 13px;
  border-radius: var(--r-sm);
  background: rgb(255 95 109 / 0.14);
  border: 1px solid rgb(255 95 109 / 0.34);
  color: #ff8f99;
  font-size: 0.8rem;
  animation: shake 0.4s var(--ease);
}
.gate-field { display: grid; gap: 6px; text-align: left; }
.gate-field > span:first-child {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: rgb(236 236 244 / 0.45);
}
.gate-input {
  display: flex;
  align-items: center;
  border-radius: var(--r-sm);
  background: rgb(255 255 255 / 0.06);
  border: 1px solid rgb(255 255 255 / 0.13);
  transition: border-color var(--t) var(--ease), box-shadow var(--t) var(--ease);
}
.gate-input:focus-within { border-color: #7c9cff; box-shadow: 0 0 0 3px rgb(124 156 255 / 0.16); }
.gate-input input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 12px 4px 12px 13px;
  border: 0;
  background: none;
  outline: none;
  font-size: 0.92rem;
  color: #fff;
  font-family: var(--mono);
}
.gate-input input::placeholder { font-family: var(--font); color: rgb(255 255 255 / 0.3); }
.gate-peek { display: grid; place-items: center; width: 40px; height: 44px; color: rgb(255 255 255 / 0.45); }
.gate-peek:hover { color: #fff; }
.gate-peek.is-on { color: #7c9cff; }
.gate-input.shake { animation: shake 0.4s var(--ease); }
@keyframes shake {
  10%, 90% { transform: translateX(-2px); }
  30%, 70% { transform: translateX(4px); }
  50% { transform: translateX(-6px); }
}
.gate-go {
  display: grid;
  place-items: center;
  height: 46px;
  border-radius: var(--r-sm);
  background: linear-gradient(135deg, #7c9cff, #a06bff);
  color: #0b0b12;
  font-size: 0.92rem;
  font-weight: 700;
  box-shadow: 0 8px 24px -8px rgb(124 156 255 / 0.8);
  transition: transform var(--t) var(--spring), box-shadow var(--t) var(--ease), filter var(--t) var(--ease);
}
.gate-go:hover { transform: translateY(-1px); filter: brightness(1.06); }
.gate-go:active { transform: scale(0.98); }
.gate-foot { font-size: 0.72rem; color: rgb(236 236 244 / 0.34); }
.gate-foot code { color: rgb(236 236 244 / 0.6); }

/* ==========================================================================
   responsive + preferences
   ========================================================================== */
@media (max-width: 560px) {
  :root { --col: 100%; }
  .brand-word { display: none; }
  .bar-top { height: 48px; gap: 7px; }
  .tab { padding: 5px 9px; font-size: 0.75rem; }
  .tool-btn#sortBtn span { display: none; }
  .tool-btn { padding: 0 10px; }
  .panel { padding: 13px 14px 11px; border-radius: 16px; }
  .fab { width: 52px; height: 52px; }
  .sheet-body, .modal-body { padding-left: 13px; padding-right: 13px; }
  .sheet-head, .modal-head { padding-left: 13px; padding-right: 13px; }
  .sheet-foot, .modal-foot { padding-left: 13px; padding-right: 13px; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 900px) {
  .stage { padding-top: 18px; }
  .grid { gap: 13px; }
}
@media (hover: none) {
  .p-tool { width: 33px; height: 33px; }
  .panel:hover { transform: none; box-shadow: var(--sh-1); }
}
@media print {
  .topbar, .fab-stack, .toasts { display: none !important; }
  .panel { break-inside: avoid; border-color: #ccc; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .panel.is-relocking .p-body,
  .panel.is-relocking .p-title,
  .panel.is-relocking .p-link,
  .panel.is-relocking .p-file,
  .panel.is-relocking .p-tags,
  .panel.is-relocking .p-when-text { filter: blur(9px); opacity: 0.75; }
}
body.light-ui .toast,
body.light-ui .pop,
body.light-ui .sheet,
body.light-ui .modal { box-shadow: 0 2px 8px rgb(0 0 0 / 0.1), 0 20px 50px -18px rgb(0 0 0 / 0.28); }
body.light-ui select.inp option { background: #fff; color: #222; }
body.light-ui ::-webkit-scrollbar-thumb { background: rgb(var(--fg-rgb) / 0.22); background-clip: content-box; }
