/* ==========================================================================
   whilelost.dev — Personal Web Sanctuary & Forum Profile
   Inspired by anxious.sh/mxx, paco.me, and retro-modern personal sites.
   Human, quiet, authentic web craft — strictly no AI tropes or clichés.
   ========================================================================== */

:root {
  /* Dark Theme (Default) */
  --bg: #000000;
  --bg-card: #0c0c0e;
  --bg-subtle: #18181c;
  --bg-hover: #1e1e24;
  --border: #212127;
  --border-subtle: #17171c;
  --border-focus: #3d3d48;

  --ink: #f0f0f3;
  --fg: #b0b3bc;
  --dim: #8b8f9c; /* ≥ 5.3:1 contrast on #161618 and ≥ 4.8:1 on #1c1c1f */
  --accent: #10b981;
  --accent-soft: rgba(16, 185, 129, 0.12);

  --status-online: #10b981;
  --status-idle: #f59e0b;
  --status-dnd: #ef4444;
  --status-offline: #8b8f9c;

  --font-mono: 'JetBrains Mono', 'SF Mono', Menlo, Consolas, Monaco, monospace;
  --site-width: min(1320px, 94vw);
}

[data-theme="light"] {
  --bg: #f5f5f7;
  --bg-card: #ffffff;
  --bg-subtle: #eeeff3;
  --bg-hover: #e5e5eb;
  --border: #d4d4dc;
  --border-subtle: #e4e4ec;
  --border-focus: #888894;

  --ink: #111114;
  --fg: #464850;
  --dim: #5c606d; /* ≥ 5.2:1 contrast on #ffffff */
  --accent: #059669;
  --accent-soft: rgba(5, 150, 105, 0.1);

  --status-online: #059669;
  --status-idle: #d97706;
  --status-dnd: #dc2626;
  --status-offline: #717786;
}

[data-theme="xmas"] {
  /* Festive Nordic Winter Theme */
  --bg: #07090b;
  --bg-card: #0d1116;
  --bg-subtle: #121820;
  --bg-hover: #19222c;
  --border: #1d2734;
  --border-subtle: #141c26;
  --border-focus: #334358;

  --ink: #f1f5f9;
  --fg: #94a3b8;
  --dim: #64748b;
  --accent: #059669; /* Evergreen Cedar Pine */
  --accent-soft: rgba(5, 150, 105, 0.16);
  --accent-xmas: #991b1b; /* Winter Cranberry Berry */
  --accent-warm: #d97706; /* Candlelight Amber */

  --status-online: #059669;
  --status-idle: #d97706;
  --status-dnd: #dc2626;
  --status-offline: #64748b;
}

[data-theme="xmas"] ::selection {
  background-color: rgba(5, 150, 105, 0.35);
  color: #f8fafc;
}

[data-theme="xmas"] .avatar-frame {
  box-shadow: 0 0 0 1px rgba(5, 150, 105, 0.4), 0 0 14px rgba(5, 150, 105, 0.14);
}

[data-theme="xmas"] #audio-toggle.audio-playing .wave-bar {
  background-color: var(--accent);
}

[data-theme="xmas"] #audio-toggle.audio-playing .wave-bar:nth-child(2) {
  background-color: var(--accent-xmas);
}

[data-theme="xmas"] #theme-toggle .icon-snowflake {
  color: var(--accent);
}

/* Base Resets */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  color: var(--fg);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "tnum" 1;
}

body {
  min-height: 100vh;
  position: relative;
  background-color: var(--bg);
  color: var(--fg);
}

::selection {
  background-color: var(--ink);
  color: var(--bg);
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}
::-webkit-scrollbar-track {
  background: var(--bg);
}
::-webkit-scrollbar-thumb {
  background: var(--border);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--border-focus);
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

:focus-visible {
  outline: 1px dashed var(--accent);
  outline-offset: 2px;
}

.dim {
  color: var(--dim);
}

/* Monochrome Bokeh Background Canvas */
.constellation-canvas {
  position: fixed;
  inset: -30px;
  width: calc(100% + 60px);
  height: calc(100% + 60px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.9;
  filter: blur(10px);
  transform: translate3d(0, 0, 0);
  will-change: transform, opacity;
  transition: opacity 250ms ease;
}

.constellation-canvas.is-hidden {
  opacity: 0;
}

[data-theme="light"] .constellation-canvas {
  opacity: 1;
  filter: blur(8px);
}

/* Shell Wrapper */
.site-wrapper {
  position: relative;
  z-index: 1;
  max-width: var(--site-width);
  margin-left: auto;
  margin-right: auto;
  padding: 24px 20px 60px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Top Utility Header */
.site-header {
  border: 1px solid var(--border);
  background-color: var(--bg-card);
  padding: 8px 14px;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand {
  font-weight: 700;
  font-size: 14px;
  color: var(--ink);
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ctrl-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border: 1px solid var(--border);
  background-color: var(--bg-subtle);
  color: var(--dim);
  font-size: 12px;
  transition: border-color 100ms ease, color 100ms ease;
}

.ctrl-btn:hover {
  border-color: var(--ink);
  color: var(--ink);
}

.ctrl-btn svg {
  width: 13px;
  height: 13px;
}

/* Audio Waveform */
.audio-waves {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 10px;
}

.wave-bar {
  width: 2px;
  height: 3px;
  background-color: var(--dim);
  transition: height 0.2s ease, background-color 0.2s ease;
}

#audio-toggle.audio-playing .wave-bar {
  background-color: var(--accent);
  animation: wavePulse 1s ease-in-out infinite alternate;
}

#audio-toggle.audio-playing .wave-bar:nth-child(1) { animation-delay: 0.1s; height: 8px; }
#audio-toggle.audio-playing .wave-bar:nth-child(2) { animation-delay: 0.3s; height: 10px; }
#audio-toggle.audio-playing .wave-bar:nth-child(3) { animation-delay: 0.2s; height: 6px; }

@keyframes wavePulse {
  0% { height: 2px; }
  100% { height: 10px; }
}

.constellation-active {
  border-color: var(--border-focus);
  color: var(--fg);
}

.quote-text {
  font-style: italic;
  quotes: none;
  color: var(--fg);
}

/* Status Indicator Dot */
.status-indicator-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
}

.status-online { background-color: var(--status-online); }
.status-idle { background-color: var(--status-idle); }
.status-dnd { background-color: var(--status-dnd); }
.status-offline { background-color: var(--status-offline); }

.spotify-idle-icon {
  width: 12px;
  height: 12px;
  stroke: var(--dim);
}

.music-bars {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 9px;
}

.music-bars span {
  display: block;
  width: 2px;
  height: 2px;
  background-color: var(--accent);
  animation: musicWave 0.8s ease-in-out infinite alternate;
}

.music-bars span:nth-child(2) { animation-delay: 0.2s; }
.music-bars span:nth-child(3) { animation-delay: 0.4s; }

@keyframes musicWave {
  0% { height: 2px; }
  100% { height: 9px; }
}

/* Split Columns */
.layout-cols {
  display: grid;
  grid-template-columns: 310px 1fr;
  gap: 20px;
  align-items: start;
}

.sidebar-sticky {
  position: sticky;
  top: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Profile Card */
.profile-card {
  border: 1px solid var(--border);
  background-color: var(--bg-card);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.card-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
}

.userpic-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.avatar-frame {
  position: relative;
  width: 68px;
  height: 68px;
  border: 1px solid var(--border);
  background-color: var(--bg);
  flex-shrink: 0;
}

.avatar-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-titles {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.user-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.25;
}

.user-handle {
  font-size: 12px;
}

.user-role {
  font-size: 12px;
  color: var(--dim);
  line-height: 1.4;
  margin-top: 2px;
}

.bio-text {
  font-size: 12px;
  line-height: 1.6;
  color: var(--fg);
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
  padding: 10px 0;
}

/* Live Presence Metadata List (Minimalist Blueprint) */
.presence-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 12px;
  padding-top: 10px;
}

.presence-row {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 8px;
  align-items: baseline;
  min-width: 0;
}

.presence-label {
  color: var(--dim);
}

.presence-val {
  color: var(--ink);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: opacity 180ms ease;
}

/* Smooth Music Track Marquee */
.music-scroll-wrap {
  position: relative;
  overflow: hidden;
  white-space: nowrap;
  width: 100%;
  min-width: 0;
}

.music-scroll-wrap.is-scrolling {
  mask-image: linear-gradient(90deg, transparent, #000 6px, #000 calc(100% - 14px), transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 6px, #000 calc(100% - 14px), transparent);
}

.music-scroll-track {
  display: inline-flex;
  align-items: center;
  width: max-content;
  will-change: transform;
}

.music-track-content {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  text-transform: lowercase;
}

.music-track-content .ticker-sep {
  color: var(--dim);
  margin: 0 10px;
  opacity: 0.6;
}

@media (prefers-reduced-motion: reduce) {
  .music-scroll-wrap {
    overflow-x: auto;
    mask-image: none;
    -webkit-mask-image: none;
  }
}

.presence-link {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  color: var(--ink);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 0.1s ease;
  text-transform: lowercase;
}

.presence-link:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.presence-link:hover .presence-arrow {
  transform: translate(1px, -1px);
}

.presence-arrow {
  color: var(--dim);
  font-size: 12px;
  transition: transform 0.1s ease;
}

.presence-primary {
  color: var(--ink);
}

.presence-secondary {
  color: var(--dim);
}

/* Minimalist Monospace Inline Shimmer Capsule */
.presence-skeleton {
  display: inline-block;
  height: 10px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--bg-subtle) 25%, var(--border) 50%, var(--bg-subtle) 75%);
  background-size: 200% 100%;
  animation: presenceShimmer 1.8s infinite ease-in-out;
  vertical-align: middle;
  opacity: 0.85;
}

.presence-skeleton.skeleton-status {
  width: 44px;
}

.presence-skeleton.skeleton-music {
  width: 130px;
}

@keyframes presenceShimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (prefers-reduced-motion: reduce) {
  .presence-skeleton {
    animation: none;
    background: var(--bg-subtle);
  }
}

/* Connections list */
.connect-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.connect-link,
.connect-link-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  border: 1px solid var(--border);
  background-color: var(--bg-subtle);
  color: var(--ink);
  font-size: 12px;
  text-align: left;
  width: 100%;
  transition: border-color 100ms ease, background-color 100ms ease;
}

.connect-link:hover,
.connect-link-btn:hover {
  background-color: var(--bg-hover);
  border-color: var(--ink);
}

/* Main Content Column */
.content-col {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Content Tabs */
.content-nav {
  border: 1px solid var(--border);
  background-color: var(--bg-card);
  padding: 4px;
}

.nav-track {
  display: flex;
  gap: 4px;
}

.nav-pill {
  padding: 6px 14px;
  font-size: 12px;
  color: var(--dim);
  transition: color 100ms ease, background-color 100ms ease;
}

.nav-pill:hover {
  color: var(--ink);
}

.nav-pill.active {
  background-color: var(--bg-subtle);
  color: var(--ink);
  font-weight: 700;
  border: 1px solid var(--border);
}

/* Garden Sectors */
.garden-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.garden-sector {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sector-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
}

.sector-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}

/* Works List */
.works-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.work-card {
  border: 1px solid var(--border);
  background-color: var(--bg-card);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 100ms ease, background-color 100ms ease;
}

.work-card:hover {
  border-color: var(--border-focus);
  background-color: var(--bg-hover);
}

.work-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.work-title-link {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.work-title-link:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.arrow-glyph {
  font-size: 12px;
  color: var(--dim);
}

.work-desc {
  font-size: 12px;
  line-height: 1.6;
  color: var(--fg);
}

.work-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
}

.tag-badge {
  font-size: 12px;
  padding: 1px 6px;
  border: 1px solid var(--border);
  color: var(--dim);
}

/* Setup Grid */
.setup-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.machine-spec-card {
  border: 1px solid var(--border);
  background-color: var(--bg-card);
  display: flex;
  flex-direction: column;
}

.machine-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background-color: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}

.machine-name {
  font-weight: 700;
  color: var(--ink);
}

.spec-table {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
}

.spec-row {
  display: grid;
  grid-template-columns: 65px 1fr;
  gap: 8px;
}

.spec-row dd {
  color: var(--ink);
}

/* Footer */
.site-footer {
  border: 1px solid var(--border);
  background-color: var(--bg-card);
  padding: 10px 14px;
  font-size: 12px;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.views-counter-number {
  color: var(--ink);
  font-weight: 700;
  transition: opacity 180ms ease;
}

/* Toast */
.toast-notice {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  background-color: var(--ink);
  color: var(--bg);
  border: 1px solid var(--ink);
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 150ms ease, transform 150ms ease;
  pointer-events: none;
}

.toast-notice.show {
  opacity: 1;
  transform: translateY(0);
}

template {
  display: none !important;
}

/* ==========================================================================
   Admin & In-Browser Live Edit Mode System
   Square geometry (0px), hairline borders, JetBrains Mono, WCAG AAA.
   ========================================================================== */

/* Footer Admin Trigger */
.footer-admin-btn {
  color: var(--dim);
  font-size: 12px;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0 4px;
  transition: color 150ms ease;
}

.footer-admin-btn:hover {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Top Admin Floating Command Bar */
.admin-bar {
  position: sticky;
  top: 0;
  z-index: 1200;
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 8px 16px;
  font-size: 12px;
}

.admin-bar-inner {
  max-width: var(--site-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.admin-bar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.admin-indicator-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  background-color: var(--accent);
}

.admin-badge {
  color: var(--ink);
  font-weight: 700;
}

.admin-status-text {
  color: var(--dim);
}

.admin-bar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Shared Admin Buttons */
.admin-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 4px 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.4;
  border: 1px solid var(--border);
  background-color: var(--bg-subtle);
  color: var(--ink);
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}

.admin-btn:hover {
  background-color: var(--bg-hover);
  border-color: var(--border-focus);
}

.admin-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.admin-btn-primary {
  background-color: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
  font-weight: 600;
}

.admin-btn-primary:hover {
  background-color: var(--ink);
  color: var(--bg);
  filter: brightness(1.1);
}

.admin-btn-accent {
  background-color: var(--accent);
  color: #000000;
  border-color: var(--accent);
  font-weight: 600;
}

.admin-btn-accent:hover {
  background-color: var(--accent);
  color: #000000;
  border-color: var(--accent);
  filter: brightness(1.1);
}

.admin-btn-dim {
  color: var(--dim);
  background-color: transparent;
  border-color: transparent;
}

.admin-btn-dim:hover {
  color: var(--ink);
  background-color: var(--bg-hover);
  border-color: var(--border);
}

.admin-btn-danger {
  border-color: rgba(239, 68, 68, 0.4);
  color: var(--status-dnd);
}

.admin-btn-danger:hover {
  background-color: rgba(239, 68, 68, 0.15);
  border-color: var(--status-dnd);
}

.admin-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: 1px solid var(--border);
  background-color: var(--bg-subtle);
  color: var(--fg);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}

.admin-icon-btn:hover {
  color: var(--ink);
  border-color: var(--border-focus);
  background-color: var(--bg-hover);
}

/* Inline Edit States */
body.is-edit-mode [data-editable] {
  outline: 1px dashed var(--border-focus);
  outline-offset: 2px;
  cursor: text;
  transition: outline-color 120ms ease, background-color 120ms ease;
}

body.is-edit-mode [data-editable]:hover {
  outline-color: var(--accent);
  background-color: var(--accent-soft);
}

body.is-edit-mode [data-editable]:focus {
  outline: 1px solid var(--accent);
  background-color: var(--accent-soft);
}

/* Empty Editable Fields (Prevents 0px collapse & provides clear clickable target) */
body.is-edit-mode [data-editable]:empty,
body.is-edit-mode [data-editable][data-is-empty="true"] {
  display: inline-block;
  min-width: 64px;
  min-height: 1.3em;
  padding: 1px 4px;
  outline: 1px dashed var(--status-idle);
  background-color: rgba(245, 158, 11, 0.08);
}

body.is-edit-mode [data-editable]:empty::before,
body.is-edit-mode [data-editable][data-is-empty="true"]::before {
  content: attr(data-placeholder);
  color: var(--status-idle);
  opacity: 0.8;
  font-size: 12px;
  pointer-events: none;
}

/* In-Card Quick Controls (Edit Mode) */
.card-admin-actions {
  display: none;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
}

body.is-edit-mode .card-admin-actions {
  display: flex;
}

/* Admin Modals */
.admin-modal-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.8);
  z-index: 2500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.admin-modal-box {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  max-width: 500px;
  width: 100%;
  padding: 20px;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.6);
}

.admin-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}

.admin-modal-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}

.admin-modal-desc {
  font-size: 12px;
  line-height: 1.6;
  color: var(--fg);
  margin-bottom: 14px;
}

.color-ink {
  color: var(--ink);
}

.admin-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.admin-field-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.admin-helper-card {
  border: 1px solid var(--border);
  background-color: var(--bg-subtle);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  line-height: 1.5;
}

.admin-helper-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent);
  font-weight: 600;
  font-size: 12px;
}

.admin-helper-link:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.token-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.token-input-wrap .admin-input {
  padding-right: 50px;
}

.token-visibility-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  color: var(--dim);
  background: none;
  border: none;
  padding: 4px 6px;
  cursor: pointer;
  font-family: var(--font-mono);
}

.token-visibility-btn:hover {
  color: var(--ink);
}

.admin-label {
  font-size: 12px;
  color: var(--dim);
  display: flex;
  justify-content: space-between;
}

.admin-input,
.admin-textarea,
.admin-select {
  background-color: var(--bg-subtle);
  border: 1px solid var(--border);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 8px 10px;
  width: 100%;
}

.admin-input:focus,
.admin-textarea:focus,
.admin-select:focus {
  outline: 1px solid var(--accent);
  border-color: var(--accent);
}

.admin-textarea {
  resize: vertical;
  min-height: 80px;
}

.admin-form-error {
  font-size: 12px;
  color: var(--status-dnd);
  background-color: rgba(239, 68, 68, 0.1);
  border: 1px solid var(--status-dnd);
  padding: 8px 10px;
  line-height: 1.4;
}

.admin-modal-foot {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

/* Customizer Slide-Over Drawer */
.admin-drawer-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.65);
  z-index: 1500;
}

.admin-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(520px, 94vw);
  height: 100vh;
  background-color: var(--bg-card);
  border-left: 1px solid var(--border);
  z-index: 1600;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 200ms cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.5);
}

.admin-drawer.open {
  transform: translateX(0);
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background-color: var(--bg-subtle);
}

.drawer-header-left {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.drawer-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}

.drawer-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  background-color: var(--bg);
  overflow-x: auto;
}

.drawer-tab {
  padding: 8px 12px;
  font-size: 12px;
  color: var(--dim);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: all 120ms ease;
}

.drawer-tab:hover {
  color: var(--ink);
}

.drawer-tab.active {
  color: var(--ink);
  border-bottom-color: var(--accent);
  background-color: var(--bg-card);
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.drawer-tab-pane {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.drawer-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.drawer-item-card {
  border: 1px solid var(--border);
  background-color: var(--bg);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.drawer-item-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.drawer-item-title {
  font-weight: 700;
  font-size: 13px;
  color: var(--ink);
}

.drawer-item-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.drawer-action-btn {
  font-size: 12px;
  padding: 2px 6px;
  border: 1px solid var(--border);
  background-color: var(--bg-subtle);
  color: var(--dim);
  cursor: pointer;
}

.drawer-action-btn:hover {
  color: var(--ink);
  border-color: var(--border-focus);
}

.drawer-form-box {
  border: 1px solid var(--border);
  background-color: var(--bg-subtle);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.drawer-row-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.commit-diff-preview {
  border: 1px solid var(--border);
  background-color: var(--bg);
  padding: 10px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--fg);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 200px;
  overflow-y: auto;
}


/* Responsive */
@media (max-width: 768px) {
  .layout-cols {
    grid-template-columns: 1fr;
  }

  .sidebar-sticky {
    position: static;
  }

  .setup-grid {
    grid-template-columns: 1fr;
  }
}


/* ==========================================================================
   404 While Lost Code Loop Page
   ========================================================================== */
html:has(body.error-page-body),
body.error-page-body {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.error-page-viewport {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  z-index: 1;
}

.error-centered-card {
  width: 100%;
  max-width: 500px;
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  padding: 32px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 16px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
}

.error-code-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--dim);
  padding: 3px 8px;
  border: 1px solid var(--border);
  background-color: var(--bg-subtle);
}

.error-badge-dot {
  width: 6px;
  height: 6px;
  background-color: #ef4444;
}

.error-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  margin: 0;
}

.error-desc {
  font-size: 13px;
  color: var(--fg);
  line-height: 1.6;
  margin: 0;
  max-width: 440px;
}

/* Simulated Code Loop Window */
.error-code-window {
  width: 100%;
  max-width: 440px;
  background-color: var(--bg);
  border: 1px solid var(--border);
  text-align: left;
}

.code-window-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  background-color: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
}

.code-window-dots {
  display: flex;
  gap: 5px;
  align-items: center;
}

.code-window-dots .dot {
  width: 8px;
  height: 8px;
}

.dot-red { background: #ef4444; }
.dot-yellow { background: #f59e0b; }
.dot-green { background: #10b981; }

.code-window-filename {
  font-size: 12px;
  color: var(--dim);
}

.code-window-body {
  padding: 12px 14px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--ink);
}

.code-line {
  white-space: pre-wrap;
  word-break: break-all;
}

.code-indent {
  padding-left: 16px;
}

/* Syntax Token Highlighting (Mapped to DESIGN.md tokens) */
.token-keyword {
  color: var(--status-dnd);
  font-weight: 600;
}

.token-var {
  color: var(--accent);
  font-weight: 600;
}

.token-fn {
  color: var(--ink);
  font-weight: 600;
}

.token-str {
  color: var(--accent);
}

.token-comment {
  color: var(--dim);
  font-style: italic;
}

/* Interactive Break Action */
.error-action-row {
  display: flex;
  justify-content: center;
  width: 100%;
  margin-top: 4px;
}

.error-break-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 22px;
  border: 1px solid var(--border);
  background-color: var(--bg-subtle);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
  text-decoration: none;
}

.error-break-btn:hover {
  border-color: var(--accent);
  background-color: var(--bg-hover);
  color: var(--ink);
}

.error-keyboard-hint {
  font-size: 12px;
  color: var(--dim);
}

.error-keyboard-hint .kbd-badge {
  display: inline-block;
  padding: 1px 5px;
  font-size: 12px;
  border: 1px solid var(--border);
  background-color: var(--bg-subtle);
  color: var(--fg);
  line-height: 1.2;
}
