/* Layout: one full-bleed interactive dot field as the hero, a quiet strip of public shortcuts, a plain footer.
   Admin is a separate utilitarian view (sign-in, then a link manager). */
:root {
  color-scheme: light;
  --bg: #EDEFF3;
  --surface: #FFFFFF;
  --ink: #12151B;
  --muted: #5A6170;
  --line: #D4D8E0;
  --accent: #2B3DF5;
  --accent-ink: #FFFFFF;
  --accent-soft: #E3E6FE;
  --dot: #A3A9B5;
  --good: #1D8448;
  --danger: #C0362C;
  --danger-soft: #FBE7E5;
  --display: "Bricolage Grotesque", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --body: "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0B0D11; --surface: #14171E; --ink: #E8EBF0; --muted: #8B92A0; --line: #252A34;
    --accent: #8E9BFF; --accent-ink: #0B0D11; --accent-soft: #1D2240; --dot: #394050;
    --good: #4FC781; --danger: #FF7B6F; --danger-soft: #3A1B19; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0B0D11; --surface: #14171E; --ink: #E8EBF0; --muted: #8B92A0; --line: #252A34;
  --accent: #8E9BFF; --accent-ink: #0B0D11; --accent-soft: #1D2240; --dot: #394050;
  --good: #4FC781; --danger: #FF7B6F; --danger-soft: #3A1B19; color-scheme: dark;
}

* { box-sizing: border-box; }
body { background: var(--bg); color: var(--ink); font-family: var(--body); font-size: 15px; line-height: 1.55; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--bg); }
a { color: inherit; }
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.wrap { max-width: 1120px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.mono { font-family: var(--mono); font-size: 12px; letter-spacing: .04em; }
.eyebrow { font-family: var(--mono); font-size: 11.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }

/* ---------- top bar ---------- */
.topbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-block: 12px; }
.mark { display: flex; align-items: center; gap: 10px; text-decoration: none; font-family: var(--display); font-weight: 800; font-size: 19px; letter-spacing: -.02em; }
.mark i { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); display: block; }
.btn { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--surface); padding: 8px 14px; border-radius: 999px; cursor: pointer; text-decoration: none; font-weight: 500; font-size: 14px; transition: border-color .15s, transform .15s; }
.btn:hover { border-color: var(--ink); }
.btn.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn.accent { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); }
.btn.sm { padding: 5px 11px; font-size: 13px; }
.btn svg { width: 15px; height: 15px; }

/* ---------- hero field ---------- */
.hero { position: relative; height: clamp(460px, 66vh, 660px); overflow: hidden; border-bottom: 1px solid var(--line); cursor: crosshair; touch-action: pan-y; }
.hero canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.hero .wrap { position: relative; height: 100%; display: flex; flex-direction: column; justify-content: space-between; padding-block: 40px 22px; pointer-events: none; }
.hero h1 { font-family: var(--display); font-weight: 800; font-size: clamp(44px, 9vw, 116px); line-height: .9; letter-spacing: -.045em; margin: 0; max-width: 11ch; text-wrap: balance; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero p.lede { max-width: 38ch; color: var(--muted); font-size: 16px; margin: 18px 0 0; }
.hero-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.modes { display: inline-flex; gap: 4px; padding: 4px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); pointer-events: auto; }
.modes button { border: 0; background: transparent; padding: 6px 13px; border-radius: 999px; cursor: pointer; font-family: var(--mono); font-size: 12px; letter-spacing: .04em; color: var(--muted); }
.modes button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.hint { color: var(--muted); }
.hint b { color: var(--ink); font-weight: 500; }

/* ---------- shortcuts ---------- */
.doors { padding-block: 48px 64px; }
.doors-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 24px; margin-bottom: 20px; }
.doors-head h2 { font-family: var(--display); font-weight: 600; font-size: 28px; letter-spacing: -.02em; margin: 0; }
.door-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.door { display: grid; grid-template-columns: 1fr auto; align-items: start; gap: 6px 12px; padding: 18px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); text-decoration: none; transition: border-color .15s, transform .2s; min-width: 0; }
.door:hover { border-color: var(--accent); transform: translateY(-2px); }
.door strong { font-family: var(--display); font-weight: 600; font-size: 19px; letter-spacing: -.01em; }
.door .arrow { color: var(--accent); font-family: var(--mono); }
.door .host { grid-column: 1 / -1; color: var(--muted); overflow-wrap: anywhere; }
.door .desc { grid-column: 1 / -1; color: var(--muted); font-size: 14px; }
.empty { padding: 28px; border: 1px dashed var(--line); border-radius: var(--radius); color: var(--muted); text-align: center; }

footer.site { border-top: 1px solid var(--line); }
footer.site .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 24px; padding-block: 22px; color: var(--muted); font-size: 13.5px; }
footer.site nav { display: flex; gap: 20px; }
footer.site a { text-decoration: none; }
footer.site a:hover { color: var(--ink); text-decoration: underline; }

/* ---------- legal pages ---------- */
.legal { padding-block: 48px 72px; }
.legal article { max-width: 66ch; }
.legal h1 { font-family: var(--display); font-weight: 800; font-size: clamp(34px, 5vw, 52px); letter-spacing: -.035em; line-height: 1; margin: 10px 0 8px; }
.legal h2 { font-family: var(--display); font-weight: 600; font-size: 20px; margin: 32px 0 6px; }
.legal p, .legal li { color: var(--ink); }
.legal .back { margin-bottom: 28px; }
.draft { display: inline-block; margin-top: 12px; padding: 3px 9px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); }

/* ---------- admin: sign-in ---------- */
.auth { min-height: calc(100vh - 140px); display: grid; place-items: center; padding-block: 48px; }
.auth-card { width: min(400px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 28px; display: grid; gap: 18px; }
.auth-card h1 { font-family: var(--display); font-weight: 800; font-size: 30px; letter-spacing: -.03em; margin: 0; }
.field { display: grid; gap: 6px; }
.field label { font-size: 13px; font-weight: 500; }
.field input[type="text"], .field input[type="url"], .field input[type="password"] { width: 100%; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); }
.field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.err { color: var(--danger); font-size: 13.5px; margin: 0; }
.note { font-size: 13px; color: var(--muted); padding: 10px 12px; border-radius: 8px; background: var(--bg); }

/* ---------- admin: dashboard ---------- */
.admin { padding-block: 32px 72px; display: grid; gap: 24px; }
.admin-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 16px; }
.admin-head h1 { font-family: var(--display); font-weight: 800; font-size: clamp(30px, 4vw, 40px); letter-spacing: -.03em; margin: 4px 0 0; line-height: 1; }
.counts { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-family: var(--mono); font-size: 12px; }
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.chip.on .dot { background: var(--good); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.editor { padding: 20px; display: grid; gap: 16px; }
.editor h2 { font-family: var(--display); font-weight: 600; font-size: 20px; margin: 0; }
.editor-grid { display: grid; grid-template-columns: 1fr 1.4fr; gap: 14px; }
.editor-grid .wide { grid-column: 1 / -1; }
.editor-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.check { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.toolbar input { padding: 8px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); width: min(280px, 100%); }
.toolbar h2 { font-family: var(--display); font-weight: 600; font-size: 18px; margin: 0; }
.rows { list-style: none; margin: 0; padding: 0; }
.row { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.6fr) 150px 150px; gap: 16px; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row.head { padding-block: 10px; border-bottom: 1px solid var(--line); }
.row .label strong { display: block; font-weight: 600; }
.row .label span { color: var(--muted); font-size: 13px; }
.row .url { font-family: var(--mono); font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }
.row .url a { text-decoration: none; }
.row .url a:hover { color: var(--accent); text-decoration: underline; }
.row .acts { display: flex; gap: 6px; justify-content: flex-end; }
.row.confirming { background: var(--danger-soft); }
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13px; color: var(--muted); }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { width: 36px; height: 20px; border-radius: 999px; background: var(--line); position: relative; transition: background .15s; flex: none; }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--surface); transition: transform .15s; box-shadow: 0 1px 2px rgb(0 0 0 / .25); }
.switch input:checked + .track { background: var(--good); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch input:checked ~ .txt { color: var(--ink); }
.warn { font-size: 12px; color: var(--danger); font-family: var(--mono); }
.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%) translateY(20px); opacity: 0; background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-size: 14px; transition: opacity .2s, transform .2s; pointer-events: none; z-index: 20; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.mock-flag { font-family: var(--mono); font-size: 11.5px; color: var(--muted); }

@media (max-width: 760px) {
  .row { grid-template-columns: 1fr auto; gap: 8px 12px; }
  .row.head { display: none; }
  .row .url { grid-column: 1 / -1; grid-row: 2; }
  .row .label { grid-column: 1; grid-row: 1; }
  .row .vis { grid-column: 1; grid-row: 3; }
  .row .acts { grid-column: 2; grid-row: 1 / 4; align-self: start; flex-direction: column; }
  .editor-grid { grid-template-columns: 1fr; }
  .hide-sm { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- base + helpers (inline styles are blocked by the CSP) ---------- */
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; }
body > main { flex: 1 0 auto; }
[hidden] { display: none !important; }
img { max-width: 100%; }
.bar-right { display: flex; gap: 8px; align-items: center; }
.hero h1 { margin-top: 14px; }
.auth-card h1 { margin-top: 6px; }
.btn.block { justify-content: center; padding-block: 11px; }
.split { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.btn-row { display: flex; gap: 8px; }
.opt { color: var(--muted); font-weight: 400; }
.row .full { grid-column: 1 / -1; color: var(--muted); }
.head-right { text-align: right; }
.loading { color: var(--muted); padding: 20px 16px; }

/* ---------- admin: tabs, users ---------- */
.tabs { justify-self: start; }
.tab-body { display: grid; gap: 24px; }
.inline-input { display: flex; gap: 8px; align-items: center; }
.inline-input input { flex: 1; min-width: 0; }
.urow { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) auto; }
.urow .acts { flex-wrap: wrap; }
.chip.warnchip { color: var(--danger); border-color: var(--danger); }
.chip.you { color: var(--accent); border-color: var(--accent); }
.urow .label strong { display: inline; margin-right: 8px; }
.urow .label .chip { margin-top: 4px; }
.reset-form { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.reset-form input { flex: 1 1 200px; min-width: 0; padding: 8px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); font-family: var(--mono); font-size: 13px; }
.reset-form .err { flex-basis: 100%; }
@media (max-width: 760px) {
  .urow { grid-template-columns: 1fr; }
  .urow .acts { grid-column: 1; grid-row: auto; flex-direction: row; justify-content: flex-start; }
  .urow .when { grid-row: auto; }
}
