/* ============================================================
   Components — glass surfaces, buttons, forms, overlays, widgets
   ============================================================ */

/* --- Liquid background decoration --------------------------- */
.liquid-field {
  position: fixed;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  pointer-events: none;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(64px);
  opacity: 0.55;
  will-change: transform;
}

.blob-1 { width: 44vw; height: 44vw; min-width: 320px; min-height: 320px;
  top: -12vw; left: -10vw;
  background: radial-gradient(circle at 35% 35%, rgba(66,99,235,0.42), rgba(66,99,235,0) 70%);
  animation: drift-a 26s ease-in-out infinite alternate; }

.blob-2 { width: 40vw; height: 40vw; min-width: 300px; min-height: 300px;
  top: 8vh; right: -12vw;
  background: radial-gradient(circle at 60% 40%, rgba(184,164,255,0.46), rgba(184,164,255,0) 70%);
  animation: drift-b 32s ease-in-out infinite alternate; }

.blob-3 { width: 36vw; height: 36vw; min-width: 260px; min-height: 260px;
  bottom: -8vw; left: 30vw;
  background: radial-gradient(circle at 50% 50%, rgba(255,135,108,0.34), rgba(255,135,108,0) 70%);
  animation: drift-c 30s ease-in-out infinite alternate; }

@keyframes drift-a { to { transform: translate3d(6vw, 5vh, 0) scale(1.08); } }
@keyframes drift-b { to { transform: translate3d(-5vw, 8vh, 0) scale(1.12); } }
@keyframes drift-c { to { transform: translate3d(4vw, -6vh, 0) scale(0.94); } }

.liquid-grain {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.5;
  background-image: radial-gradient(rgba(36,38,58,0.05) 1px, transparent 1px);
  background-size: 3px 3px;
}
:root[data-theme="dark"] .liquid-grain { opacity: 0.35; background-image: radial-gradient(rgba(255,255,255,0.05) 1px, transparent 1px); }

/* --- Glass card --------------------------------------------- */
.glass {
  position: relative;
  background: var(--surface-glass);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  isolation: isolate;
}

@supports (backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px)) {
  .glass {
    backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  }
}
/* Fallback for browsers without backdrop-filter: solid, readable surface */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass { background: var(--surface-glass-strong); }
}

/* subtle top-edge reflection */
.glass::after {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 46%;
  background: linear-gradient(180deg, rgba(255,255,255,0.16), rgba(255,255,255,0));
  pointer-events: none;
  z-index: -1;
}
:root[data-theme="dark"] .glass::after { background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0)); }

.glass-card {
  padding: clamp(1.25rem, 2.6vw, 1.9rem);
  transition: transform var(--dur-med) var(--ease-out),
              box-shadow var(--dur-med) var(--ease-out),
              border-color var(--dur-med) var(--ease-out);
}

.glass-card.is-interactive:hover,
.glass-card.is-interactive:focus-within {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-strong);
}

/* gradient hairline illumination on hover */
.glass-card.is-interactive::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: var(--grad-brand);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity var(--dur-med) var(--ease-out);
  pointer-events: none;
  z-index: 2;
}
.glass-card.is-interactive:hover::before,
.glass-card.is-interactive:focus-within::before { opacity: 0.85; }

.card-accent-cobalt { --card-accent: var(--cobalt); }
.card-accent-lavender { --card-accent: var(--lavender); }
.card-accent-coral { --card-accent: var(--coral); }
.card-accent-lime { --card-accent: var(--lime); }

.solid {
  background: var(--surface-solid);
  border: 1px solid var(--border-ink);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}

/* --- Buttons ------------------------------------------------- */
.btn {
  --btn-bg: var(--surface-solid);
  --btn-fg: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.78rem 1.4rem;
  border-radius: var(--r-pill);
  border: 1px solid var(--border-ink);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
  cursor: pointer;
  white-space: nowrap;
  transition: transform var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-med) var(--ease-out),
              background-color var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out);
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn svg { width: 18px; height: 18px; flex: none; }

.btn-primary {
  background: var(--cobalt);
  border-color: transparent;
  color: #fff;
  box-shadow: var(--shadow-glow-cobalt);
}
.btn-primary:hover { background: color-mix(in srgb, var(--cobalt) 88%, #000); }

.btn-gradient {
  background: var(--grad-brand);
  background-size: 180% 180%;
  border-color: transparent;
  color: #fff;
  box-shadow: var(--shadow-glow-lavender);
  animation: grad-pan 9s ease-in-out infinite alternate;
}
@keyframes grad-pan { to { background-position: 100% 50%; } }

.btn-ghost {
  background: var(--surface-glass);
  border-color: var(--border-ink);
  backdrop-filter: blur(8px);
}
.btn-ghost:hover { border-color: var(--cobalt); color: var(--cobalt); }

.btn-soft {
  background: var(--cobalt-soft);
  border-color: transparent;
  color: var(--cobalt);
}
.btn-soft:hover { background: color-mix(in srgb, var(--cobalt) 20%, transparent); }

.btn-danger { background: var(--danger); border-color: transparent; color: #fff; }
.btn-success { background: var(--success); border-color: transparent; color: #fff; }

.btn-sm { padding: 0.5rem 0.95rem; font-size: 0.85rem; }
.btn-lg { padding: 0.95rem 1.8rem; font-size: 1.02rem; }
.btn-block { width: 100%; }
.btn-icon {
  padding: 0.6rem;
  width: 40px; height: 40px;
  border-radius: 50%;
}
.btn-icon.btn-sm { width: 34px; height: 34px; padding: 0.45rem; }

/* --- Badges / chips ----------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.42rem 0.9rem;
  border-radius: var(--r-pill);
  font-family: var(--font-mono);
  font-size: var(--fs-tiny);
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  background: var(--surface-glass-strong);
  border: 1px solid var(--border-ink);
  color: var(--ink);
}
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 25%, transparent); }
.badge-cobalt { background: var(--cobalt-soft); border-color: transparent; color: var(--cobalt); }
.badge-lavender { background: var(--lavender-soft); border-color: transparent; color: color-mix(in srgb, var(--lavender) 62%, var(--ink)); }
.badge-coral { background: var(--coral-soft); border-color: transparent; color: color-mix(in srgb, var(--coral) 70%, var(--ink)); }
.badge-lime { background: var(--lime-soft); border-color: transparent; color: color-mix(in srgb, var(--lime) 55%, var(--ink)); }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.28rem 0.7rem;
  border-radius: var(--r-pill);
  font-size: var(--fs-tiny);
  font-weight: 600;
  background: color-mix(in srgb, var(--ink) 6%, transparent);
  border: 1px solid var(--border-ink);
  color: var(--muted);
}
.tag-solid { background: var(--surface-solid); color: var(--ink); }
.tag-row { display: flex; flex-wrap: wrap; gap: 0.45rem; }

.status-pill {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.25rem 0.6rem;
  border-radius: var(--r-pill);
  font-weight: 600;
}
.status-live { background: color-mix(in srgb, var(--success) 18%, transparent); color: var(--success); }
.status-wip { background: color-mix(in srgb, var(--warning) 20%, transparent); color: var(--warning); }
.status-draft { background: color-mix(in srgb, var(--muted) 18%, transparent); color: var(--muted); }

/* --- Forms --------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 1.05rem; }
.field > label { font-size: var(--fs-small); font-weight: 600; color: var(--ink); }
.field .hint { font-size: var(--fs-tiny); color: var(--muted); }
.field .error { font-size: var(--fs-tiny); color: var(--danger); font-weight: 600; min-height: 1em; }

.input, .textarea, .select {
  width: 100%;
  padding: 0.72rem 0.95rem;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-ink);
  background: var(--surface-glass-strong);
  color: var(--ink);
  transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
@supports (backdrop-filter: blur(1px)) { .input, .textarea, .select { backdrop-filter: blur(10px); } }
.input::placeholder, .textarea::placeholder { color: color-mix(in srgb, var(--muted) 80%, transparent); }
.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--cobalt);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--cobalt) 18%, transparent);
}
.input[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--danger); }
.textarea { min-height: 130px; resize: vertical; line-height: 1.6; }
.select { appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2362677C' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 0.9rem center; padding-right: 2.4rem; cursor: pointer; }

.check { display: flex; align-items: center; gap: 0.6rem; cursor: pointer; font-size: var(--fs-small); }
.check input { width: 18px; height: 18px; accent-color: var(--cobalt); cursor: pointer; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1.2rem; }
.form-grid .span-2 { grid-column: 1 / -1; }

.search-box { position: relative; }
.search-box .input { padding-left: 2.5rem; }
.search-box svg { position: absolute; left: 0.85rem; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--muted); pointer-events: none; }

/* --- Segmented filter pills ---------------------------------- */
.filters { display: flex; flex-wrap: wrap; gap: 0.55rem; }
.filter-pill {
  padding: 0.5rem 1.05rem;
  border-radius: var(--r-pill);
  border: 1px solid var(--border-ink);
  background: var(--surface-glass);
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
}
.filter-pill:hover { border-color: var(--cobalt); color: var(--cobalt); }
.filter-pill.is-active { background: var(--ink); border-color: var(--ink); color: var(--bg); }

/* --- Navigation --------------------------------------------- */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 90;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  transition: box-shadow var(--dur-med) var(--ease-out), background-color var(--dur-med) var(--ease-out);
}
.nav .container { display: flex; align-items: center; gap: 1rem; width: min(var(--container), 100% - 2rem); }

.nav-shell {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.5rem 0.6rem 0.5rem 1rem;
  border-radius: var(--r-pill);
  background: color-mix(in srgb, var(--bg) 55%, transparent);
  border: 1px solid transparent;
  transition: all var(--dur-med) var(--ease-out);
}
@supports (backdrop-filter: blur(1px)) {
  .nav-shell { backdrop-filter: blur(14px) saturate(140%); -webkit-backdrop-filter: blur(14px) saturate(140%); }
}
.nav.is-scrolled .nav-shell {
  background: var(--surface-glass-strong);
  border-color: var(--border);
  box-shadow: var(--shadow-md);
}

.brand { display: inline-flex; align-items: center; gap: 0.6rem; font-family: var(--font-head); font-weight: 800; letter-spacing: -0.02em; }
.brand-mark {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 12px;
  background: var(--grad-brand);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  box-shadow: var(--shadow-glow-lavender);
  flex: none;
}
.brand-name { font-size: 1.02rem; }
.brand-name small { display: block; font-family: var(--font-mono); font-size: 0.62rem; letter-spacing: 0.22em; color: var(--muted); font-weight: 500; text-transform: uppercase; }

.nav-links { display: flex; align-items: center; gap: 0.15rem; margin-inline: auto; }
.nav-link {
  position: relative;
  padding: 0.5rem 0.78rem;
  border-radius: var(--r-pill);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--muted);
  transition: color var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out);
}
.nav-link:hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 6%, transparent); }
.nav-link.is-active { color: var(--cobalt); background: var(--cobalt-soft); }

.nav-actions { display: flex; align-items: center; gap: 0.4rem; }

.nav-toggle { display: none; }

/* Mobile drawer */
.mobile-menu {
  position: fixed;
  inset: 0;
  z-index: 95;
  padding: calc(var(--nav-h) + 1rem) 1.25rem 2rem;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  transform: translateY(-100%);
  opacity: 0;
  visibility: hidden;
  transition: transform var(--dur-med) var(--ease-out), opacity var(--dur-med) var(--ease-out), visibility var(--dur-med);
  overflow-y: auto;
}
.mobile-menu.is-open { transform: none; opacity: 1; visibility: visible; }
.mobile-menu a {
  padding: 0.95rem 1.1rem;
  border-radius: var(--r-md);
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.1rem;
  border: 1px solid transparent;
}
.mobile-menu a:hover, .mobile-menu a.is-active { background: var(--surface-glass-strong); border-color: var(--border); color: var(--cobalt); }
.mobile-menu .menu-foot { margin-top: auto; display: flex; gap: 0.6rem; padding-top: 1rem; }
.menu-close { position: absolute; top: 0.85rem; right: 1rem; }

/* --- Splash screen ------------------------------------------- */
.splash {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  background:
    radial-gradient(80% 60% at 20% 10%, rgba(66,99,235,0.30), transparent 60%),
    radial-gradient(70% 60% at 85% 25%, rgba(184,164,255,0.36), transparent 62%),
    radial-gradient(90% 70% at 60% 100%, rgba(255,135,108,0.26), transparent 60%),
    var(--bg);
  transition: opacity 700ms var(--ease-out), visibility 700ms;
}
.splash.is-hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.splash-inner { text-align: center; padding: 2rem; position: relative; }

.splash-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(28px);
  opacity: 0.7;
  animation: float-soft 7s ease-in-out infinite alternate;
}
.splash-orb.o1 { width: 120px; height: 120px; background: var(--lavender); top: -10%; left: -20%; }
.splash-orb.o2 { width: 90px; height: 90px; background: var(--coral); bottom: 0; right: -18%; animation-delay: -2.5s; }
.splash-orb.o3 { width: 70px; height: 70px; background: var(--cobalt); bottom: -30%; left: 10%; animation-delay: -4s; }

@keyframes float-soft { to { transform: translateY(-22px) translateX(10px); } }

.splash-monogram {
  width: clamp(96px, 22vw, 132px);
  height: clamp(96px, 22vw, 132px);
  margin: 0 auto 1.6rem;
  display: grid;
  place-items: center;
  border-radius: 30%;
  background: var(--grad-brand);
  color: #fff;
  font-family: var(--font-head);
  font-weight: 800;
  font-size: clamp(2.4rem, 7vw, 3.4rem);
  letter-spacing: -0.05em;
  box-shadow: 0 24px 70px rgba(66,99,235,0.42), inset 0 2px 12px rgba(255,255,255,0.45);
  animation: splash-in 900ms var(--ease-out) both;
}
.splash-monogram.has-logo {
  padding: 0;
  overflow: hidden;
  box-sizing: border-box;
  border: 2px solid rgba(255, 255, 255, 0.68);
  outline: 1px solid rgba(255, 255, 255, 0.22);
  outline-offset: 3px;
  background: var(--grad-brand);
}
.splash-monogram .splash-logo-image {
  display: block;
  width: 76%;
  height: 76%;
  max-width: 76%;
  max-height: 76%;
  margin: auto;
  object-fit: contain;
  object-position: center;
  border-radius: 10%;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.2);
}
.splash-name {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: clamp(1.6rem, 5vw, 2.4rem);
  letter-spacing: 0.34em;
  text-indent: 0.34em;
  animation: splash-in 900ms 220ms var(--ease-out) both;
}
.splash-tagline {
  margin-top: 0.7rem;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: clamp(0.72rem, 2.4vw, 0.85rem);
  letter-spacing: 0.26em;
  text-transform: uppercase;
  animation: splash-in 900ms 420ms var(--ease-out) both;
}
.splash-bar {
  width: min(280px, 70vw);
  height: 3px;
  margin: 2.2rem auto 0;
  border-radius: 3px;
  background: color-mix(in srgb, var(--ink) 12%, transparent);
  overflow: hidden;
  animation: splash-in 600ms 520ms var(--ease-out) both;
}
.splash-bar span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 3px;
  background: var(--grad-brand);
  animation: splash-fill 1150ms 620ms var(--ease-out) forwards;
}
@keyframes splash-fill { to { width: 100%; } }
@keyframes splash-in {
  from { opacity: 0; transform: translateY(16px) scale(0.96); filter: blur(8px); }
  to { opacity: 1; transform: none; filter: blur(0); }
}
.splash-skip {
  position: absolute;
  bottom: max(1.6rem, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--muted);
  border-radius: var(--r-pill);
  padding: 0.5rem 1.2rem;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
}
.splash-skip:hover { color: var(--ink); border-color: var(--ink); }

/* --- Modal / dialog ------------------------------------------ */
.modal-root { position: fixed; inset: 0; z-index: 120; display: none; }
.modal-root.is-open { display: block; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: color-mix(in srgb, var(--bg) 62%, rgba(10, 10, 24, 0.55));
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: fade-in var(--dur-med) var(--ease-out) both;
}
.modal-panel {
  position: relative;
  z-index: 1;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  width: min(1040px, calc(100vw - 2rem));
  max-height: calc(100vh - 3rem);
  margin: 1.5rem auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  animation: modal-up var(--dur-med) var(--ease-out) both;
}
.modal-root.modal-center { display: none; place-items: center; }
.modal-root.modal-center.is-open { display: grid; }
.modal-root.modal-center .modal-panel { margin: auto; width: min(640px, calc(100vw - 2rem)); }
.modal-head {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem clamp(1.2rem, 3vw, 2.2rem);
  background: color-mix(in srgb, var(--bg-elevated) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-ink);
}
.modal-body { padding: clamp(1.3rem, 3.4vw, 2.4rem); }
.modal-foot {
  position: sticky;
  bottom: 0;
  display: flex;
  gap: 0.7rem;
  justify-content: flex-end;
  padding: 1rem clamp(1.2rem, 3vw, 2.2rem);
  background: color-mix(in srgb, var(--bg-elevated) 90%, transparent);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--border-ink);
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-up { from { opacity: 0; transform: translateY(28px) scale(0.985); } to { opacity: 1; transform: none; } }

.icon-btn {
  display: grid;
  place-items: center;
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border-ink);
  background: var(--surface-glass);
  color: var(--ink);
  cursor: pointer;
  flex: none;
  transition: all var(--dur-fast) var(--ease-out);
}
.icon-btn:hover { background: var(--ink); color: var(--bg); transform: rotate(90deg); }
.icon-btn svg { width: 18px; height: 18px; }

/* --- Command palette ----------------------------------------- */
.palette { position: fixed; inset: 0; z-index: 140; display: none; }
.palette.is-open { display: block; }
.palette-backdrop { position: absolute; inset: 0; background: rgba(12, 12, 26, 0.5); backdrop-filter: blur(4px); animation: fade-in var(--dur-fast) both; }
.palette-panel {
  position: relative;
  width: min(620px, calc(100vw - 2rem));
  margin: 12vh auto 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modal-up var(--dur-med) var(--ease-out) both;
}
.palette-input {
  width: 100%;
  padding: 1.15rem 1.3rem;
  border: 0;
  border-bottom: 1px solid var(--border-ink);
  background: transparent;
  font-size: 1.05rem;
  color: var(--ink);
}
.palette-input:focus { outline: none; }
.palette-list { max-height: 46vh; overflow-y: auto; padding: 0.5rem; }
.palette-item {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  width: 100%;
  padding: 0.72rem 0.9rem;
  border-radius: var(--r-sm);
  background: transparent;
  border: 0;
  text-align: left;
  cursor: pointer;
  color: var(--ink);
}
.palette-item .pi-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: var(--cobalt-soft); color: var(--cobalt); flex: none; }
.palette-item .pi-icon svg { width: 17px; height: 17px; }
.palette-item .pi-title { font-weight: 600; font-size: 0.94rem; }
.palette-item .pi-sub { font-size: 0.78rem; color: var(--muted); }
.palette-item.is-selected, .palette-item:hover { background: var(--cobalt-soft); }
.palette-empty { padding: 1.4rem; text-align: center; color: var(--muted); font-size: 0.9rem; }
.palette-foot { display: flex; gap: 1rem; padding: 0.6rem 1.1rem; border-top: 1px solid var(--border-ink); font-size: 0.74rem; color: var(--muted); font-family: var(--font-mono); }
kbd {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 0.1rem 0.42rem;
  border-radius: 6px;
  border: 1px solid var(--border-ink);
  background: var(--surface-2);
  color: var(--muted);
}

/* --- Terminal widget ----------------------------------------- */
.term-launcher {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 1.05rem 0.55rem 0.6rem;
  border-radius: var(--r-pill);
  border: 1px solid var(--border-ink);
  background: var(--surface-glass);
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
}
.term-launcher:hover { color: var(--ink); border-color: var(--cobalt); transform: translateY(-2px); }
.term-launcher .term-dot { width: 26px; height: 26px; border-radius: 8px; background: var(--grad-brand); display: grid; place-items: center; color: #fff; }
.term-launcher svg { width: 14px; height: 14px; }

.terminal {
  position: fixed;
  right: clamp(0.8rem, 3vw, 1.8rem);
  bottom: clamp(0.8rem, 3vw, 1.8rem);
  z-index: 110;
  width: min(560px, calc(100vw - 1.6rem));
  height: min(380px, 62vh);
  display: none;
  grid-template-rows: auto 1fr auto;
  border-radius: var(--r-md);
  overflow: hidden;
  background: rgba(16, 17, 30, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: var(--shadow-lg);
  color: #E9E9F5;
  font-family: var(--font-mono);
  font-size: 0.84rem;
}
@supports (backdrop-filter: blur(1px)) { .terminal { backdrop-filter: blur(14px); } }
.terminal.is-open { display: grid; animation: modal-up var(--dur-med) var(--ease-out) both; }

.term-bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.85rem;
  background: rgba(255, 255, 255, 0.06);
  border-bottom: 1px solid rgba(255, 255, 255, 0.10);
}
.term-lights { display: flex; gap: 6px; }
.term-lights i { width: 11px; height: 11px; border-radius: 50%; display: block; }
.term-lights i:nth-child(1) { background: #FF876C; }
.term-lights i:nth-child(2) { background: #FFD166; }
.term-lights i:nth-child(3) { background: #7CE0A6; }
.term-title { font-size: 0.74rem; color: #A9ABCB; letter-spacing: 0.08em; }
.term-bar .icon-btn { margin-left: auto; width: 30px; height: 30px; background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.14); color: #E9E9F5; }
.term-bar .icon-btn:hover { background: #FF876C; color: #16171F; }

.term-out { padding: 0.9rem 1rem; overflow-y: auto; line-height: 1.7; white-space: pre-wrap; word-break: break-word; }
.term-out .t-dim { color: #8E91B3; }
.term-out .t-ok { color: #7CE0A6; }
.term-out .t-err { color: #FF876C; }
.term-out .t-accent { color: #9FB6FF; }
.term-out .t-lav { color: #C5B4FF; }
.term-out a { color: #9FB6FF; text-decoration: underline; text-underline-offset: 3px; }
.term-out .t-cmd { color: #FFFFFF; font-weight: 600; }
.term-out table { border-collapse: collapse; margin: 0.3rem 0; }
.term-out td, .term-out th { padding: 0.1rem 0.9rem 0.1rem 0; text-align: left; }

.term-input-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(0, 0, 0, 0.25);
}
.term-prompt { color: #7CE0A6; font-weight: 600; flex: none; }
.term-input {
  flex: 1;
  background: transparent;
  border: 0;
  color: #fff;
  font-family: var(--font-mono);
  font-size: 0.84rem;
  caret-color: #D8F36A;
}
.term-input:focus { outline: none; }

/* --- Toasts --------------------------------------------------- */
.toast-stack {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  width: min(360px, calc(100vw - 2rem));
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  padding: 0.85rem 1rem;
  border-radius: var(--r-md);
  background: var(--surface-glass-strong);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  font-size: 0.9rem;
  animation: toast-in var(--dur-med) var(--ease-out) both;
}
.toast.is-leaving { animation: toast-out var(--dur-med) var(--ease-out) both; }
.toast .toast-icon { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; flex: none; font-size: 0.75rem; font-weight: 800; color: #fff; }
.toast-success .toast-icon { background: var(--success); }
.toast-error .toast-icon { background: var(--danger); }
.toast-info .toast-icon { background: var(--cobalt); }
@keyframes toast-in { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateX(24px); } }

/* --- Custom cursor (precise dot + trailing ring) ---------------- */
.cursor-follower {
  position: fixed;
  top: 0; left: 0;
  width: 0; height: 0;
  z-index: 400;
  pointer-events: none;
  display: none;
}
.cursor-dot, .cursor-ring, .cursor-label { position: absolute; top: 0; left: 0; pointer-events: none; }
.cursor-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--cobalt);
  transition: width var(--dur-fast) var(--ease-out), height var(--dur-fast) var(--ease-out);
}
.cursor-ring {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 1.5px solid color-mix(in srgb, var(--cobalt) 55%, transparent);
  transition: width var(--dur-med) var(--ease-out), height var(--dur-med) var(--ease-out),
              border-color var(--dur-med) var(--ease-out), background-color var(--dur-med) var(--ease-out);
}
.cursor-follower.has-hover .cursor-ring {
  width: 52px; height: 52px;
  border-color: var(--cobalt);
  background: color-mix(in srgb, var(--cobalt) 8%, transparent);
}
.cursor-follower.has-hover .cursor-dot { width: 6px; height: 6px; }
.cursor-follower.has-label .cursor-ring {
  width: 58px; height: 58px;
  border-color: color-mix(in srgb, var(--cobalt) 80%, transparent);
  background: color-mix(in srgb, var(--cobalt) 12%, transparent);
}
.cursor-follower.has-label .cursor-dot { width: 5px; height: 5px; }
.cursor-label {
  padding: 0.3rem 0.7rem;
  border-radius: var(--r-pill);
  background: var(--ink);
  color: var(--bg);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0;
  transition: opacity var(--dur-fast) var(--ease-out);
  white-space: nowrap;
}
.cursor-follower.has-label .cursor-label { opacity: 1; }
@media (hover: hover) and (pointer: fine) {
  html.has-custom-cursor .cursor-follower { display: block; }
  html.has-custom-cursor body,
  html.has-custom-cursor a,
  html.has-custom-cursor button,
  html.has-custom-cursor .is-interactive { cursor: none; }
  html.has-custom-cursor input,
  html.has-custom-cursor textarea,
  html.has-custom-cursor select,
  html.has-custom-cursor iframe { cursor: auto; }
}

/* --- Empty / loading states ----------------------------------- */
.empty-state {
  padding: clamp(2rem, 6vw, 3.4rem) 1.5rem;
  text-align: center;
  color: var(--muted);
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--r-lg);
  background: color-mix(in srgb, var(--surface-glass) 60%, transparent);
}
.empty-state svg { width: 40px; height: 40px; margin: 0 auto 0.8rem; opacity: 0.6; }
.empty-state strong { display: block; color: var(--ink); font-family: var(--font-head); font-size: 1.02rem; margin-bottom: 0.25rem; }

.skeleton {
  background: linear-gradient(90deg, color-mix(in srgb, var(--ink) 7%, transparent) 25%, color-mix(in srgb, var(--ink) 12%, transparent) 37%, color-mix(in srgb, var(--ink) 7%, transparent) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border-radius: var(--r-sm);
}
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

.spinner {
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 2.5px solid color-mix(in srgb, currentColor 25%, transparent);
  border-top-color: currentColor;
  animation: spin 700ms linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Image placeholder ---------------------------------------- */
.img-ph {
  position: relative;
  display: grid;
  place-items: center;
  background:
    radial-gradient(120% 120% at 15% 10%, var(--cobalt-soft), transparent 55%),
    radial-gradient(110% 110% at 85% 25%, var(--lavender-soft), transparent 60%),
    radial-gradient(120% 120% at 60% 95%, var(--coral-soft), transparent 55%),
    var(--surface-2);
  color: var(--muted);
  overflow: hidden;
}
.img-ph .ph-initials {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: clamp(2rem, 6vw, 3.4rem);
  letter-spacing: -0.04em;
  color: color-mix(in srgb, var(--ink) 62%, transparent);
}
.img-ph .ph-note {
  position: absolute;
  bottom: 0.7rem;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.75;
}


/* Keep uploaded splash logo visibly inset inside the splash mark. */
#splash-mono.has-logo {
  display: grid;
  place-items: center;
  padding: 10px;
  box-sizing: border-box;
  overflow: hidden;
  border: 3px solid rgba(255,255,255,.82);
  outline: 2px solid rgba(255,255,255,.28);
  outline-offset: 4px;
  background: var(--grad-brand);
  border-radius: 30%;
}
#splash-mono.has-logo > img.splash-logo-image {
  display: block;
  width: 68%;
  height: 68%;
  min-width: 0;
  min-height: 0;
  max-width: 68%;
  max-height: 68%;
  object-fit: contain;
  object-position: center;
  border: 0;
  border-radius: 8%;
  box-shadow: none;
}
