:root {
  color-scheme: dark;
  --bg: #0c111c;
  --bg-2: #121a29;
  --card: #172033;
  --text: #e8edf7;
  --muted: #93a0b8;
  --line: #263249;
  --accent: #8b9cff;
  --accent-ink: #0c111c;
  --danger: #ff5d6c;
  --gear: #ff9f43;
  --shadow: 0 10px 30px rgba(3, 6, 14, 0.45);
  --shadow-sm: 0 4px 14px rgba(3, 6, 14, 0.35);
  --st-inactive: #ffffff;
  --st-active: #34d17c;
  --st-running: #34d17c;
  --st-starting: #ff9f43;
  --st-failed: #ff5d6c;
  --st-offline: #8a94a6;
  --radius: 16px;
  --font: ui-rounded, "SF Pro Rounded", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --bg: #f4f6fb;
    --bg-2: #ffffff;
    --card: #ffffff;
    --text: #141b2d;
    --muted: #55627d;
    --line: #d9e0ee;
    --accent: #4152e0;
    --accent-ink: #ffffff;
    --danger: #d63447;
    --gear: #d9770a;
    --shadow: 0 10px 30px rgba(30, 42, 80, 0.14);
    --shadow-sm: 0 4px 14px rgba(30, 42, 80, 0.12);
    --st-active: #15a45a;
    --st-running: #15a45a;
    --st-starting: #d9770a;
    --st-failed: #d63447;
    --st-offline: #6b7587;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

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

.skip {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 100;
  padding: 8px 14px;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  text-decoration: none;
}
.skip:focus { top: 10px; }

/* ---------- top bar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px clamp(16px, 4vw, 40px);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.wordmark {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  text-decoration: none;
}

.nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav > a {
  padding: 8px 14px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--muted);
  font-weight: 600;
  transition: color 0.15s, background-color 0.15s;
}
.nav > a:hover { color: var(--text); background: var(--card); }
.nav > a[aria-current="page"] { color: var(--text); background: var(--card); box-shadow: inset 0 -2px 0 var(--accent); }

.nav-sep {
  width: 1px;
  align-self: stretch;
  margin: 6px 8px;
  background: var(--line);
}

.nav-toggle {
  display: none;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
}
.nav-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: var(--text);
}

.account-wrap { position: relative; }

.acct-btn {
  display: inline-flex;
  align-items: center;
  max-width: 220px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: border-color 0.15s;
}
.acct-btn:hover { border-color: var(--accent); }

.account-popup {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  z-index: 40;
  width: 300px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-2);
  box-shadow: var(--shadow);
  animation: pop 0.16s ease-out;
}

.acct { margin: 0 0 16px; display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 0.92rem; }
.acct dt { color: var(--muted); }
.acct dd { margin: 0; overflow-wrap: anywhere; }

.account-backdrop { display: none; }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--card);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s, transform 0.15s;
}
.btn:hover { border-color: var(--accent); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { background: transparent; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-outline-danger { border-color: var(--danger); color: var(--danger); background: transparent; }
.btn-outline-danger:hover { background: color-mix(in srgb, var(--danger) 14%, transparent); }

/* ---------- home ---------- */

.page { padding: 0 clamp(16px, 4vw, 40px) 64px; max-width: 1280px; margin: 0 auto; }

.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
  margin-top: clamp(16px, 5vw, 48px);
  padding: clamp(48px, 12vw, 140px) clamp(24px, 6vw, 72px);
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--bg-2);
}

.hero h1 {
  margin: 0;
  font-size: clamp(3.6rem, 15vw, 9rem);
  line-height: 0.9;
  font-weight: 800;
  letter-spacing: -0.06em;
}

.tagline { margin: 0; max-width: 34ch; font-size: clamp(1.1rem, 2.4vw, 1.5rem); color: var(--muted); }
.greeting { margin: 0; font-size: 1.05rem; }

.aurora { position: absolute; inset: 0; z-index: -1; filter: blur(60px); opacity: 0.55; }
.aurora span {
  position: absolute;
  width: 46%;
  aspect-ratio: 1;
  border-radius: 50%;
  will-change: transform;
}
.aurora span:nth-child(1) { left: -6%; top: -30%; background: #5b6cff; animation: drift-a 22s ease-in-out infinite alternate; }
.aurora span:nth-child(2) { right: -8%; top: 10%; background: #2ec4b6; animation: drift-b 28s ease-in-out infinite alternate; }
.aurora span:nth-child(3) { left: 30%; bottom: -45%; background: #c06cff; animation: drift-c 25s ease-in-out infinite alternate; }

@keyframes drift-a { from { transform: translate(0, 0) scale(1); } to { transform: translate(28%, 22%) scale(1.15); } }
@keyframes drift-b { from { transform: translate(0, 0) scale(1.1); } to { transform: translate(-30%, 18%) scale(0.9); } }
@keyframes drift-c { from { transform: translate(0, 0) scale(0.95); } to { transform: translate(-22%, -20%) scale(1.2); } }

/* ---------- sites ---------- */

.notices { display: grid; gap: 10px; margin: 24px 0 8px; }
.notice {
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: 12px;
  background: var(--bg-2);
  font-size: 0.94rem;
}
.notice p { margin: 0; }
.notice ul { margin: 8px 0 0; padding-left: 20px; }
.notice.info { border-left-color: var(--accent); }
.notice.warn { border-left-color: var(--gear); }
.notice.error { border-left-color: var(--danger); }


.check { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
  margin-top: 16px;
}

.empty { margin: 48px 0; text-align: center; color: var(--muted); }

.block {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow-sm);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s;
  animation: rise 0.5s ease-out backwards;
}
.block:hover, .block:focus-within { transform: translateY(-4px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); }

.grid > .block:nth-child(1) { animation-delay: 0ms; }
.grid > .block:nth-child(2) { animation-delay: 45ms; }
.grid > .block:nth-child(3) { animation-delay: 90ms; }
.grid > .block:nth-child(4) { animation-delay: 135ms; }
.grid > .block:nth-child(5) { animation-delay: 180ms; }
.grid > .block:nth-child(6) { animation-delay: 225ms; }
.grid > .block:nth-child(7) { animation-delay: 270ms; }
.grid > .block:nth-child(8) { animation-delay: 315ms; }
.grid > .block:nth-child(9) { animation-delay: 360ms; }
.grid > .block:nth-child(10) { animation-delay: 405ms; }
.grid > .block:nth-child(11) { animation-delay: 450ms; }
.grid > .block:nth-child(12) { animation-delay: 495ms; }
.grid > .block:nth-child(13) { animation-delay: 540ms; }
.grid > .block:nth-child(14) { animation-delay: 585ms; }
.grid > .block:nth-child(15) { animation-delay: 630ms; }
.grid > .block:nth-child(16) { animation-delay: 675ms; }
.grid > .block:nth-child(17) { animation-delay: 720ms; }
.grid > .block:nth-child(18) { animation-delay: 765ms; }
.grid > .block:nth-child(n + 19) { animation-delay: 810ms; }

.block-link { position: absolute; inset: 0; display: block; color: inherit; text-decoration: none; }
a.block-link:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; border-radius: var(--radius); }
div.block-link { cursor: default; }

.block-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease, filter 0.3s, opacity 0.3s;
}
.block:hover .block-img { transform: scale(1.06); }

.has-image .block-link::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(4, 7, 14, 0.82) 0%, rgba(4, 7, 14, 0.35) 42%, rgba(4, 7, 14, 0) 70%);
}

.block-text {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 13px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.block-name { font-size: 1.1rem; font-weight: 700; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.block-host { font-size: 0.8rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.has-image .block-name { color: #fff; }
.has-image .block-host { color: rgba(255, 255, 255, 0.78); }

.is-inactive .block-img { filter: grayscale(1); opacity: 0.55; }
.is-inactive .block-text { opacity: 0.7; }

/* status dot */
.dot-wrap {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 4;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  cursor: default;
  --st: var(--st-inactive);
}
.dot-wrap[data-state="active"] { --st: var(--st-active); }
.dot-wrap[data-state="running"] { --st: var(--st-running); }
.dot-wrap[data-state="starting"] { --st: var(--st-starting); }
.dot-wrap[data-state="failed"] { --st: var(--st-failed); }
.dot-wrap[data-state="offline"] { --st: var(--st-offline); }

.dot { width: 12px; height: 12px; border-radius: 50%; background: var(--st); border: 1.5px solid #0b0f19; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.18); }

.status-box {
  position: absolute;
  top: 26px;
  left: 0;
  padding: 4px 10px;
  border: 1.5px solid var(--st);
  border-radius: 9px;
  background: var(--bg-2);
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
  opacity: 0;
  transform: translateY(-3px) scale(0.94);
  transform-origin: top left;
  pointer-events: none;
  transition: opacity 0.15s, transform 0.15s;
}
.dot-wrap:hover .status-box,
.dot-wrap:focus .status-box,
.dot-wrap.open .status-box { opacity: 1; transform: none; }

.block-actions { position: absolute; top: 8px; right: 8px; z-index: 4; display: flex; gap: 6px; }
.icon-btn {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 9px;
  background: rgba(10, 14, 24, 0.72);
  backdrop-filter: blur(6px);
  cursor: pointer;
  transition: background-color 0.15s, transform 0.15s;
}
.icon-btn:hover { background: rgba(10, 14, 24, 0.92); }
.icon-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn.gear { color: var(--gear); }
.icon-btn.trash { color: var(--danger); }

/* ---------- forms ---------- */

.page-narrow { max-width: 760px; }
.page-title { margin: clamp(20px, 4vw, 40px) 0 4px; font-size: clamp(1.7rem, 4vw, 2.3rem); letter-spacing: -0.03em; }

.form-card {
  display: grid;
  gap: 22px;
  margin-top: 16px;
  padding: clamp(18px, 4vw, 32px);
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--bg-2);
  box-shadow: var(--shadow-sm);
  animation: pop 0.25s ease-out;
}
.form-card p { margin: 0; }

.field { margin: 0; padding: 0; border: 0; display: grid; gap: 8px; min-width: 0; align-content: start; }
.field label, .field legend { font-weight: 600; font-size: 0.92rem; padding: 0; }

input[type="text"], select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}
input[type="text"]:focus, select:focus { border-color: var(--accent); outline: 2px solid color-mix(in srgb, var(--accent) 40%, transparent); outline-offset: 0; }
input[type="file"] { font: inherit; color: var(--muted); max-width: 100%; }

/* Controls that do not apply right now stay in place, greyed out, with their data. */
input:disabled, select:disabled { opacity: 0.55; cursor: not-allowed; background: color-mix(in srgb, var(--bg) 70%, var(--line)); }
.field:has(:disabled) > label { opacity: 0.6; }

.hint { margin: 0; color: var(--muted); font-size: 0.85rem; }
.field-error { margin: 0; color: var(--danger); font-size: 0.86rem; }
.field-error:empty { display: none; }
.field-error ul { margin: 0; padding-left: 18px; }
.status-line { min-height: 1.5em; margin: 0; font-size: 0.92rem; color: var(--muted); }
.access-summary { min-height: 3em; margin: 0; padding: 10px 12px; border: 1px dashed var(--line); border-radius: 10px; }
.access-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; margin: 12px 0 4px; }

.img-preview {
  position: relative;
  aspect-ratio: 16 / 9;
  max-width: 320px;
  overflow: hidden;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  color: var(--muted);
  font-size: 0.88rem;
}
.img-preview img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

.img-picker { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 8px; }
.thumb {
  position: relative;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 104px;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--muted);
  font-size: 0.78rem;
  cursor: pointer;
}
.thumb input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.thumb:has(input:checked) { border-color: var(--accent); }
.thumb:has(input:focus-visible) { outline: 3px solid var(--accent); outline-offset: 2px; }
.upload-row { display: grid; gap: 6px; }

.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }

.flash {
  margin: 24px 0 0;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--st-active);
  border-radius: 12px;
  background: var(--bg-2);
  animation: rise 0.3s ease-out;
}
.flash code { padding: 1px 6px; border-radius: 6px; background: var(--bg); font-size: 0.9em; }

.delete-name { display: grid; gap: 2px; }

.hide-inactive .is-inactive { display: none; }
.just-updated { animation: settle 0.6s ease-out; }

/* ---------- footer ---------- */

.footer { padding: 0 clamp(16px, 4vw, 40px) 28px; text-align: center; font-size: 0.75rem; color: var(--muted); opacity: 0.7; }

/* ---------- motion ---------- */

@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(0.97); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes settle { from { opacity: 0.55; transform: scale(0.96); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .aurora span { animation: none; }
  .block, .flash, .form-card, .just-updated, .account-popup { animation-name: fade; }
  .block:hover, .block:focus-within { transform: none; }
  .block:hover .block-img { transform: none; }
  .status-box { transform: none; transition: opacity 0.15s; }
  .btn:active { transform: none; }
}

/* ---------- narrow screens ---------- */

@media (max-width: 720px) {
  .nav-toggle { display: inline-flex; }
  .nav {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding: 12px clamp(16px, 4vw, 40px) 16px;
    border-bottom: 1px solid var(--line);
    background: var(--bg);
  }
  .nav.open { display: flex; }
  .nav-sep { width: auto; height: 1px; align-self: auto; margin: 6px 0; }
  .acct-btn { max-width: none; width: 100%; justify-content: center; }
  .account-wrap { position: static; }
  .account-backdrop { position: fixed; inset: 0; z-index: 39; display: block; background: rgba(4, 7, 14, 0.6); }
  .account-backdrop[hidden] { display: none !important; }
  .account-popup { position: fixed; top: 50%; left: 50%; right: auto; width: min(340px, calc(100vw - 32px)); transform: translate(-50%, -50%); animation: fade 0.16s ease-out; }
  .grid { grid-template-columns: 1fr; }
  .hero { border-radius: 22px; }
  .toolbar { flex-wrap: wrap; }
  .access-grid { grid-template-columns: 1fr; }
}

/* ---------- home: Project Nexus ---------- */

.nexus {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(24px, 4vw, 56px);
  padding: clamp(40px, 8vw, 96px) clamp(24px, 5vw, 64px);
  min-height: min(78vh, 720px);
}
.nexus .aurora { opacity: 0.32; z-index: -2; }
.web-canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; }

.nexus-copy { display: flex; flex-direction: column; align-items: flex-start; gap: 16px; min-width: 0; }
.nexus-copy > * { animation: rise 0.7s cubic-bezier(.2, .7, .2, 1) both; }
.nexus-copy > *:nth-child(2) { animation-delay: 80ms; }
.nexus-copy > *:nth-child(3) { animation-delay: 160ms; }
.nexus-copy > *:nth-child(4) { animation-delay: 240ms; }
.nexus-copy > *:nth-child(5) { animation-delay: 320ms; }

.nexus h1 { font-size: clamp(3rem, 9vw, 6.6rem); line-height: 0.95; }
.gradient-text {
  background: linear-gradient(100deg, var(--text) 10%, var(--accent) 45%, #2ec4b6 70%, #c06cff 95%);
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: sheen 9s ease-in-out infinite alternate;
}

.eyebrow {
  display: inline-flex; align-items: center; gap: 10px; margin: 0;
  padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px;
  background: color-mix(in srgb, var(--bg) 60%, transparent);
  font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
}
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--st-active); box-shadow: 0 0 0 0 color-mix(in srgb, var(--st-active) 60%, transparent); animation: pulse 2.4s ease-out infinite; }
.btn-lg { padding: 12px 22px; font-size: 1.02rem; }

.code-window {
  margin: 0; min-width: 0;
  border: 1px solid var(--line); border-radius: 14px;
  background: color-mix(in srgb, #070b14 88%, transparent);
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: rise 0.9s 0.25s cubic-bezier(.2, .7, .2, 1) both;
  backdrop-filter: blur(6px);
}
.code-bar { display: flex; align-items: center; gap: 7px; padding: 10px 14px; border-bottom: 1px solid #1d2638; background: #0d1320; }
.win-dot { width: 11px; height: 11px; border-radius: 50%; }
.win-r { background: #ff5f57; } .win-y { background: #febc2e; } .win-g { background: #28c840; }
.code-file { margin-left: 10px; font: 0.78rem ui-monospace, "Cascadia Code", "JetBrains Mono", Consolas, Menlo, monospace; color: #7d8aa5; }
.code-body {
  margin: 0; padding: 16px 18px; height: 300px; overflow: hidden;
  font: 0.84rem/1.6 ui-monospace, "Cascadia Code", "JetBrains Mono", Consolas, Menlo, monospace;
  color: #cdd6ea; white-space: pre; tab-size: 2;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 12%, #000 100%);
  mask-image: linear-gradient(to bottom, transparent 0, #000 12%, #000 100%);
  transition: opacity 0.4s ease;
}
.code-body.fading { opacity: 0; }
.tk-kw { color: #c792ea; } .tk-str { color: #c3e88d; } .tk-com { color: #5f6f8f; font-style: italic; }
.tk-num { color: #f78c6c; } .tk-fn { color: #82aaff; } .tk-ty { color: #ffcb6b; }
.caret { display: inline-block; width: 0.55em; height: 1.1em; margin-left: 1px; vertical-align: text-bottom; background: var(--accent); animation: blink 1s steps(1) infinite; }

@keyframes sheen { from { background-position: 0% 50%; } to { background-position: 100% 50%; } }
@keyframes blink { 50% { opacity: 0; } }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--st-active) 55%, transparent); } 80%, 100% { box-shadow: 0 0 0 10px transparent; } }

@media (max-width: 900px) {
  .nexus { grid-template-columns: minmax(0, 1fr); min-height: 0; }
  .code-body { height: 220px; font-size: 0.78rem; }
}

@media (prefers-reduced-motion: reduce) {
  .nexus-copy > *, .code-window { animation: none; }
  .gradient-text { animation: none; background-position: 30% 50%; }
  .pulse, .caret { animation: none; }
  .code-body { transition: none; }
}

/* ---------- page headers, sites toolbar, empty states (0.3.0) ---------- */

.page-head {
  display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 16px;
  margin: clamp(20px, 4vw, 40px) 0 18px;
}
.page-head .page-title { margin: 0; }
.page-head-text { display: grid; gap: 4px; min-width: 0; }
.page-sub { margin: 0; color: var(--muted); }
.page-head-actions {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 8px 8px 8px 16px;
  border: 1px solid var(--line); border-radius: 16px;
  background: var(--bg-2); box-shadow: var(--shadow-sm);
  animation: pop 0.25s ease-out;
}
.btn-plus { font-size: 1.15em; line-height: 1; font-weight: 700; }

.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; color: var(--muted); font-size: 0.92rem; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track { position: relative; width: 38px; height: 22px; border-radius: 999px; background: var(--line); transition: background-color 0.2s; flex: 0 0 auto; }
.switch-track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); transition: transform 0.2s ease;
}
.switch input:checked + .switch-track { background: var(--accent); }
.switch input:checked + .switch-track::after { transform: translateX(16px); background: var(--accent-ink); }
.switch input:focus-visible + .switch-track { outline: 3px solid var(--accent); outline-offset: 2px; }
.switch:hover { color: var(--text); }

.chip {
  display: inline-flex; align-items: center; gap: 8px; max-width: 100%;
  margin: 0 0 14px; padding: 6px 12px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--bg-2); color: var(--muted); font-size: 0.8rem;
}
.chip-dot { flex: 0 0 auto; width: 7px; height: 7px; border-radius: 50%; background: var(--st-active); }

.notices { margin: 0 0 14px; }
.notice { border-radius: 14px; box-shadow: var(--shadow-sm); padding: 14px 18px; }
.flash { margin: 0 0 14px; border-radius: 14px; box-shadow: var(--shadow-sm); }

.empty-card {
  display: grid; justify-items: center; gap: 12px; text-align: center;
  max-width: 560px; margin: clamp(16px, 5vw, 48px) auto;
  padding: clamp(28px, 6vw, 48px) clamp(20px, 5vw, 40px);
  border: 1px solid var(--line); border-radius: 20px;
  background: var(--bg-2); box-shadow: var(--shadow-sm);
  animation: pop 0.25s ease-out;
}
.empty-card .btn { margin-top: 6px; }
.empty-card .hint { max-width: 42ch; }
.empty-title { margin: 0; font-size: 1.25rem; font-weight: 700; letter-spacing: -0.02em; }
.empty-icon {
  display: grid; place-items: center; width: 76px; height: 76px; border-radius: 22px;
  background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent);
}
.empty-icon svg { width: 44px; height: 44px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.empty-icon circle { fill: color-mix(in srgb, var(--accent) 35%, transparent); }

.block-add {
  display: grid; place-content: center; justify-items: center; gap: 6px;
  border: 2px dashed var(--line); background: transparent; box-shadow: none;
  color: var(--muted); text-decoration: none; font-weight: 600;
}
.block-add:hover, .block-add:focus-visible { color: var(--accent); border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, transparent); }
.block-add-plus {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px;
  background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); font-size: 1.6rem; line-height: 1;
}


.form-card-danger { border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); }
.delete-target { display: flex; align-items: center; gap: 14px; min-width: 0; }
.delete-thumb { flex: 0 0 auto; width: 112px; aspect-ratio: 16 / 9; border-radius: 10px; object-fit: cover; border: 1px solid var(--line); }
.delete-thumb-empty { display: grid; place-items: center; background: var(--bg); color: var(--muted); font-size: 1.4rem; font-weight: 800; }

.error-card { justify-items: start; margin-top: clamp(24px, 8vw, 80px); }
.error-card .page-title { margin: 0; }
.error-code {
  margin: 0; font-size: clamp(3rem, 10vw, 5rem); font-weight: 800; line-height: 1; letter-spacing: -0.05em;
  background: linear-gradient(100deg, var(--accent), #2ec4b6 60%, #c06cff);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.form-actions-start { justify-content: flex-start; }

@media (max-width: 720px) {
  .page-head-actions { width: 100%; justify-content: space-between; }
}
@media (prefers-reduced-motion: reduce) {
  .page-head-actions, .empty-card { animation-name: fade; }
  .switch-track, .switch-track::after { transition: none; }
}

/* Blocks without a picture get a soft gradient instead of a flat card. */
.block:not(.has-image):not(.block-add) {
  background:
    radial-gradient(120% 90% at 100% 0%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 60%),
    radial-gradient(90% 80% at 0% 100%, color-mix(in srgb, #2ec4b6 16%, transparent), transparent 65%),
    var(--card);
}
@media (max-width: 720px) {
  .chip { border-radius: 14px; align-items: flex-start; }
  .chip-dot { margin-top: 5px; }
}
