/* House style tokens (violet accent) + clipboard components */
:root {
  --bg: #f5f6f8; --surface: #ffffff; --surface-2: #eef0f4; --ink: #0d1117; --muted: #5d6675; --line: #e2e5eb;
  --accent: #7c5cff; --accent-ink: #ffffff; --accent-soft: rgba(124, 92, 255, 0.10);
  --ok: #0b8f7f; --ok-soft: rgba(11, 143, 127, 0.10);
  --pain: #e0383e; --pain-soft: rgba(224, 56, 62, 0.09);
  --warn: #d98a00;
  --glow-a: rgba(124, 92, 255, 0.16); --glow-b: rgba(11, 143, 127, 0.08);
  --shadow: 0 1px 2px rgba(13, 17, 23, 0.04), 0 8px 24px rgba(13, 17, 23, 0.06);
  --shadow-lg: 0 2px 4px rgba(13, 17, 23, 0.04), 0 24px 60px rgba(13, 17, 23, 0.14);
  --sans: "Geist", "Segoe UI", system-ui, sans-serif; --serif: "Instrument Serif", Georgia, serif; --mono: "Geist Mono", ui-monospace, Consolas, monospace;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #090b0f; --surface: #11141a; --surface-2: #171b23; --ink: #eef1f5; --muted: #8a93a3; --line: #222834;
  --accent: #a48bff; --accent-ink: #140d33; --accent-soft: rgba(164, 139, 255, 0.13);
  --ok: #34d8c3; --ok-soft: rgba(52, 216, 195, 0.12);
  --pain: #ff6b6f; --pain-soft: rgba(255, 107, 111, 0.12);
  --warn: #f5b13d;
  --glow-a: rgba(164, 139, 255, 0.14); --glow-b: rgba(52, 216, 195, 0.06);
  --shadow: 0 1px 0 rgba(255,255,255,0.03) inset, 0 12px 32px rgba(0,0,0,0.35);
  --shadow-lg: 0 1px 0 rgba(255,255,255,0.04) inset, 0 30px 70px rgba(0,0,0,0.55);
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 16px; line-height: 1.6; -webkit-font-smoothing: antialiased;
  background-image: radial-gradient(1000px 560px at 85% -10%, var(--glow-a), transparent 60%), radial-gradient(760px 460px at -10% 10%, var(--glow-b), transparent 60%);
  background-repeat: no-repeat; transition: background-color .25s ease, color .25s ease; }
h1, h2, h3, h4 { margin: 0; text-wrap: balance; line-height: 1.12; letter-spacing: -0.02em; }
p { margin: 0; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
.wrap { max-width: 1240px; margin: 0 auto; padding-inline: 28px; }
.mono { font-family: var(--mono); font-size: 0.78rem; letter-spacing: 0.02em; color: var(--muted); font-variant-numeric: tabular-nums; }
.kicker { font-family: var(--mono); font-size: 0.74rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); }
h1 em, h2 em, h3 em { font-family: var(--serif); font-style: italic; font-weight: 400; letter-spacing: -0.01em; color: var(--accent); }

/* bar */
.bar { position: sticky; top: 0; z-index: 20; backdrop-filter: saturate(160%) blur(14px); -webkit-backdrop-filter: saturate(160%) blur(14px);
  background: color-mix(in srgb, var(--bg) 72%, transparent); border-bottom: 1px solid var(--line); }
.bar .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-block: 12px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 0.92rem; min-width: 0; }
.brand .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); flex: none; }
.bar-right { display: flex; align-items: center; gap: 14px; min-width: 0; }
.who { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.live { display: inline-flex; align-items: center; gap: 6px; font: 500 0.68rem var(--mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--ok);
  padding: 3px 9px; border-radius: 999px; background: var(--ok-soft); }
.live i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: pulse 2s ease-in-out infinite; }
.live.off { color: var(--warn); background: color-mix(in srgb, var(--warn) 12%, transparent); }
.live.off i { animation: none; }
.toggle { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; flex: none; }
.toggle button { appearance: none; border: 0; background: transparent; color: var(--muted); font: 500 0.8rem var(--sans); padding: 6px 12px; border-radius: 999px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; transition: all .2s ease; }
.toggle button:hover { color: var(--ink); }
.toggle button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.toggle svg { width: 14px; height: 14px; }

/* buttons */
.btn { appearance: none; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 500 0.88rem var(--sans); padding: 9px 16px; border-radius: 12px;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: transform .12s ease, background .2s ease, border-color .2s ease, opacity .2s; white-space: nowrap; }
.btn:hover { border-color: color-mix(in srgb, var(--ink) 25%, var(--line)); }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); box-shadow: 0 6px 18px -6px color-mix(in srgb, var(--accent) 70%, transparent); }
.btn.primary:hover { background: color-mix(in srgb, var(--accent) 88%, var(--ink)); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
:root[data-theme="dark"] .btn.ok { color: #062521; }
.btn.no { color: var(--pain); border-color: color-mix(in srgb, var(--pain) 35%, var(--line)); background: var(--pain-soft); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); padding: 7px 10px; }
.btn.ghost:hover { color: var(--ink); background: var(--surface-2); }
.btn.sm { font-size: 0.8rem; padding: 6px 11px; border-radius: 10px; }
.btn svg { width: 16px; height: 16px; flex: none; }
.kbd { font: 500 0.7rem var(--mono); padding: 2px 6px; border-radius: 6px; background: color-mix(in srgb, currentColor 16%, transparent); }
.icon-btn { appearance: none; border: 0; background: transparent; color: var(--muted); width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; cursor: pointer; transition: all .15s ease; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn.danger:hover { color: var(--pain); background: var(--pain-soft); }
.icon-btn svg { width: 17px; height: 17px; transition: transform .25s ease; }
.icon-btn[aria-expanded="true"] svg { transform: rotate(180deg); }

/* layout */
.head { padding-block: 44px 26px; display: flex; align-items: end; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.head h1 { font-size: clamp(2.2rem, 4.6vw, 3.6rem); font-weight: 600; }
.head .lede { color: var(--muted); margin-top: 10px; max-width: 60ch; }
.stats { display: grid; grid-template-columns: repeat(3, auto); border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.stat { padding: 12px 20px; display: grid; gap: 0; border-right: 1px solid var(--line); min-width: 0; }
.stat:last-child { border-right: 0; }
.stat b { font-size: 1.4rem; font-weight: 600; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; line-height: 1.2; }
.stat span { font: 0.7rem var(--mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 22px; align-items: start; padding-bottom: 80px; }
.layout.solo { grid-template-columns: minmax(0, 1fr); }
.col { display: grid; gap: 16px; min-width: 0; }
.aside { position: sticky; top: 78px; display: grid; gap: 16px; max-height: calc(100vh - 96px); overflow: auto; padding-bottom: 8px; scrollbar-width: thin; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 20px; display: grid; gap: 12px; align-content: start; box-shadow: var(--shadow); min-width: 0; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-h h3 { font-size: 0.98rem; font-weight: 600; letter-spacing: -0.01em; display: flex; align-items: center; gap: 8px; }
.count { font: 500 0.7rem var(--mono); min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; display: inline-grid; place-items: center; background: var(--surface-2); color: var(--muted); }
.count.hot { background: var(--accent); color: var(--accent-ink); }
.empty { color: var(--muted); font-size: 0.88rem; padding: 6px 0; }

/* composer */
.composer { padding: 0; overflow: hidden; gap: 0; transition: border-color .2s ease, box-shadow .2s ease; }
.composer:focus-within { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); box-shadow: 0 0 0 4px var(--accent-soft), var(--shadow); }
.composer textarea { width: 100%; border: 0; outline: 0; resize: none; background: transparent; color: var(--ink); font: 1rem/1.55 var(--mono); padding: 20px 22px 8px; min-height: 92px; max-height: 360px; }
.composer textarea::placeholder { color: var(--muted); opacity: 0.8; font-family: var(--sans); }
.composer-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px 12px 22px; }
.composer-foot .mono { font-size: 0.72rem; }

/* clips */
.clips { display: grid; gap: 10px; }
.clip { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); display: grid; grid-template-columns: minmax(0, 1fr) auto; min-width: 0;
  transition: border-color .2s ease, transform .2s ease; animation: rise .35s cubic-bezier(.2,.8,.2,1); }
.clip:hover { border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
.clip-copy { appearance: none; border: 0; background: transparent; text-align: left; cursor: pointer; padding: 14px 6px 14px 18px; display: grid; gap: 5px; min-width: 0; border-radius: 16px 0 0 16px; }
.clip-preview { font: 0.95rem/1.45 var(--mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); }
.clip-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font: 0.72rem var(--mono); color: var(--muted); font-variant-numeric: tabular-nums; }
.clip-meta .by { color: var(--ink); font-weight: 500; }
.clip-meta .by.owner { color: var(--accent); }
.clip-meta .sep { width: 3px; height: 3px; border-radius: 50%; background: currentColor; opacity: 0.5; }
.clip-tools { display: flex; align-items: center; gap: 2px; padding: 0 10px 0 4px; }
.clip-full { grid-column: 1 / -1; margin: 0 12px 12px; padding: 16px 18px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line);
  font: 0.86rem/1.6 var(--mono); white-space: pre-wrap; word-break: break-word; max-height: 460px; overflow: auto; color: var(--ink); }
.clip-full[hidden] { display: none; }
.clip .badge { position: absolute; top: 50%; right: 98px; transform: translateY(-50%) scale(0.9); opacity: 0; pointer-events: none;
  font: 600 0.72rem var(--mono); text-transform: uppercase; letter-spacing: 0.08em; padding: 5px 10px; border-radius: 999px; background: var(--ok); color: #fff; transition: all .2s ease; }
:root[data-theme="dark"] .clip .badge { color: #062521; }
.clip.copied { border-color: var(--ok); }
.clip.copied .badge { opacity: 1; transform: translateY(-50%) scale(1); }
.clip.new { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft), var(--shadow); }

/* knock cards */
.knock { border: 1px solid var(--line); border-radius: 16px; padding: 14px; display: grid; gap: 10px; background: var(--surface); min-width: 0; }
.knock.pending { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); background: linear-gradient(160deg, var(--accent-soft), var(--surface) 70%); }
.knock-top { display: flex; align-items: start; justify-content: space-between; gap: 10px; }
.knock-name { font-size: 1.15rem; font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; word-break: break-word; }
.knock-name small { display: block; font: 0.72rem var(--mono); color: var(--muted); letter-spacing: 0.02em; margin-top: 3px; font-weight: 400; }
.facts { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 12px; margin: 0; font-size: 0.8rem; }
.facts dt { font: 0.68rem var(--mono); text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); padding-top: 2px; }
.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.knock-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
details.raw summary { cursor: pointer; font: 0.72rem var(--mono); color: var(--muted); list-style: none; }
details.raw summary::-webkit-details-marker { display: none; }
details.raw summary::before { content: '+ '; }
details.raw[open] summary::before { content: '− '; }
details.raw pre { margin: 8px 0 0; font: 0.7rem/1.5 var(--mono); white-space: pre-wrap; word-break: break-all; background: var(--surface-2); border-radius: 10px; padding: 10px; max-height: 220px; overflow: auto; }
.pill { display: inline-block; font: 500 0.66rem var(--mono); text-transform: uppercase; letter-spacing: 0.05em; padding: 2px 8px; border-radius: 999px;
  background: color-mix(in srgb, var(--c, var(--accent)) 14%, transparent); color: var(--c, var(--accent)); border: 1px solid color-mix(in srgb, var(--c, var(--accent)) 30%, transparent); white-space: nowrap; }
.pill.ok { --c: var(--ok); } .pill.no { --c: var(--pain); } .pill.warn { --c: var(--warn); } .pill.mute { --c: var(--muted); }

.rows { display: grid; }
.row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; padding-top: 2px; }
.row b { font-weight: 500; font-size: 0.9rem; display: flex; align-items: center; gap: 8px; min-width: 0; }
.row b span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .mono { font-size: 0.7rem; display: block; }
.on-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--line); flex: none; }
.on-dot.on { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }

/* guest */
.gate { min-height: calc(100vh - 62px); display: grid; align-content: start; padding-block: max(48px, 12vh) 48px; }
.gate-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); gap: 22px; align-items: stretch; }
.gate-main { padding: 40px; gap: 22px; background: linear-gradient(150deg, var(--accent-soft), var(--surface) 55%); border-color: color-mix(in srgb, var(--accent) 25%, var(--line)); }
.gate-main h1 { font-size: clamp(2.6rem, 6vw, 4.4rem); font-weight: 600; }
.gate-main .lede { color: var(--muted); font-size: 1.05rem; max-width: 46ch; }
.name-field { display: grid; gap: 8px; }
.name-row { display: flex; gap: 10px; }
.name-input { flex: 1; min-width: 0; font: 500 1.1rem var(--sans); padding: 14px 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); outline: 0; transition: border-color .2s, box-shadow .2s; }
.name-input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.name-row .btn { padding-inline: 22px; border-radius: 14px; font-size: 0.98rem; }
.name-meta { display: flex; justify-content: space-between; font: 0.72rem var(--mono); color: var(--muted); }
.name-meta .over { color: var(--pain); }
.state { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface); }
.state b { display: block; font-weight: 600; }
.state span { font-size: 0.88rem; color: var(--muted); }
.state .orb { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); flex: none; box-shadow: 0 0 0 0 var(--accent-soft); animation: ring 1.6s ease-out infinite; }
.state.denied .orb { background: var(--pain); animation: none; box-shadow: 0 0 0 5px var(--pain-soft); }
.state.blocked .orb { background: var(--muted); animation: none; }
.gate-side h3 { font-size: 1rem; font-weight: 600; }
.gate-side p { font-size: 0.86rem; color: var(--muted); }
.gate-side .facts { font-size: 0.84rem; gap: 7px 14px; }

/* toasts */
.toasts { position: fixed; bottom: 20px; right: 20px; z-index: 50; display: grid; gap: 12px; width: min(380px, calc(100vw - 32px)); }
.toast { background: var(--surface); border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--line)); border-radius: 18px; padding: 16px; box-shadow: var(--shadow-lg); display: grid; gap: 12px; animation: slide .35s cubic-bezier(.2,.8,.2,1); }
.toast.simple { padding: 12px 16px; border-color: var(--line); font-size: 0.9rem; }
.toast .kicker { display: flex; align-items: center; gap: 8px; }
.toast .kicker i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: pulse 1.2s ease-in-out infinite; }

.loading { min-height: 60vh; display: grid; place-items: center; }
.loading i { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; }

@keyframes pulse { 50% { opacity: 0.35; } }
@keyframes ring { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 45%, transparent); } 100% { box-shadow: 0 0 0 14px transparent; } }
@keyframes rise { from { opacity: 0; transform: translateY(-6px); } }
@keyframes slide { from { opacity: 0; transform: translateX(24px); } }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 980px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .aside { position: static; max-height: none; overflow: visible; order: -1; }
  .gate-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .wrap { padding-inline: 16px; }
  .head { padding-block: 28px 18px; }
  .stats { width: 100%; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stat { padding: 10px 14px; }
  .toggle button .lbl { display: none; }
  .who { display: none; }
  .gate-main { padding: 24px; }
  .name-row { flex-direction: column; }
  .clip-copy { padding-left: 14px; }
  .clip .badge { right: 84px; }
  .toasts { right: 16px; bottom: 16px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }
