:root {
  --bg: #050508;
  --bg-deep: #0a0a12;
  --ink: rgba(255, 255, 255, 0.92);
  --muted: rgba(255, 255, 255, 0.4);
  --panel: rgba(255, 255, 255, 0.06);
  --accent: #8c5aff;
  --accent-dark: #5a3aaa;
  --accent-soft: #c4a0ff;
  --border: rgba(255, 255, 255, 0.1);
  --border-strong: rgba(255, 255, 255, 0.16);
  --shadow: rgba(0, 0, 0, 0.7);
  --glass-bg: rgba(255, 255, 255, 0.05);
  --glass-blur: blur(40px);
  --nav-offset: 140px;
  --overlay-item-size: 5px;
  --overlay-bubble-min-width: 5px;
  --overlay-bubble-height: 5px;
  --overlay-bubble-font-size: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
  color: var(--ink);
  background: #050508;
  min-height: 100vh;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at 10% 15%, rgba(108, 43, 217, 0.3), transparent 50%),
    radial-gradient(ellipse at 85% 10%, rgba(26, 58, 143, 0.25), transparent 50%),
    radial-gradient(ellipse at 60% 85%, rgba(45, 27, 78, 0.2), transparent 50%),
    radial-gradient(ellipse at 30% 70%, rgba(20, 10, 50, 0.3), transparent 45%);
  pointer-events: none;
  z-index: -1;
}

h1, h2 {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", sans-serif;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.3px;
}

p { margin: 0; line-height: 1.5; }

/* ── Navbar ───────────────────────────────────────────────── */

.navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  width: 100%;
  padding: 0 24px;
  background: rgba(5, 5, 8, 0.6);
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04);
}

.navbar-inner {
  max-width: 1500px;
  margin: 0 auto;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.navbar-home {
  width: 30px; height: 30px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.45);
  font-size: 12px;
  display: flex; align-items: center; justify-content: center;
  text-decoration: none;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.navbar-home:hover {
  background: rgba(140, 90, 255, 0.12);
  border-color: rgba(140, 90, 255, 0.3);
  color: rgba(200, 170, 255, 0.9);
}

.navbar-logo {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: rgba(140, 90, 255, 0.15);
  border: 1px solid rgba(140, 90, 255, 0.3);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.navbar-title {
  font-size: 15px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.92);
  letter-spacing: -0.2px;
  white-space: nowrap;
}

.navbar-sub {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.3);
  font-weight: 400;
  white-space: nowrap;
  padding-left: 10px;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  margin-left: 2px;
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.navbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  padding: 4px 12px 4px 6px;
}

.navbar-avatar {
  width: 26px; height: 26px;
  border-radius: 999px;
  background: rgba(140, 90, 255, 0.2);
  border: 1px solid rgba(140, 90, 255, 0.3);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px;
  color: var(--accent-soft);
}

.navbar-email {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.65);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.navbar-logout {
  width: 26px; height: 26px;
  border-radius: 999px;
  border: none;
  background: none;
  color: rgba(255, 255, 255, 0.35);
  font-size: 12px;
  cursor: pointer;
  display: grid; place-items: center;
  transition: color 0.15s;
}
.navbar-logout:hover { color: #ff9090; }

.navbar-signin {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 16px;
  border-radius: 999px;
  background: rgba(140, 90, 255, 0.15);
  border: 1px solid rgba(140, 90, 255, 0.35);
  color: var(--accent-soft);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.navbar-signin:hover {
  background: rgba(140, 90, 255, 0.28);
  border-color: rgba(140, 90, 255, 0.6);
}

.auth-error {
  color: #ff8080;
  font-size: 12px;
  min-height: 16px;
}

/* ── Layout ───────────────────────────────────────────────── */

.page {
  width: min(1500px, 96vw);
  margin: 0 auto;
  padding: 24px 0 80px;
  display: flex;
  align-items: flex-start;
  gap: 20px;
}

.main-area {
  flex: 1 1 auto;
  min-width: 0;
}

/* ── Sidebar ──────────────────────────────────────────────── */

.sidebar {
  width: 220px;
  flex-shrink: 0;
  position: sticky;
  top: 82px;
  max-height: calc(100vh - 90px);
  display: flex;
  flex-direction: column;
  background: rgba(10, 8, 20, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  box-shadow:
    0 0 0 0.5px rgba(255, 255, 255, 0.04) inset,
    0 24px 48px -16px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 14px 16px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  flex-shrink: 0;
}

.sidebar-header-icon {
  color: var(--accent);
  font-size: 14px;
}

.sidebar-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: rgba(255, 255, 255, 0.5);
}

.sidebar-list {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 8px 6px;
  scrollbar-width: thin;
  scrollbar-color: rgba(140, 90, 255, 0.4) transparent;
}

.sidebar-list::-webkit-scrollbar { width: 4px; }
.sidebar-list::-webkit-scrollbar-thumb {
  background: rgba(140, 90, 255, 0.4);
  border-radius: 999px;
}

.project-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s;
  position: relative;
  min-width: 0;
}

.project-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.project-item.active {
  background: rgba(140, 90, 255, 0.15);
  border: 1px solid rgba(140, 90, 255, 0.25);
}


.project-item-icon {
  font-size: 13px;
  flex-shrink: 0;
  color: var(--muted);
  transition: color 0.15s;
}

.project-item.active .project-item-icon {
  color: var(--accent-soft);
}

.project-item-name {
  font-size: 13px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.7);
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 0.15s;
}

.project-item.active .project-item-name {
  color: rgba(255, 255, 255, 0.95);
}

.project-item-badge {
  font-size: 10px;
  color: var(--muted);
  flex-shrink: 0;
}

.project-item-actions {
  display: none;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}

.project-item:hover .project-item-actions,
.project-item.active .project-item-actions {
  display: flex;
}

.project-item-btn {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.4);
  width: 22px;
  height: 22px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 11px;
  transition: background 0.12s, color 0.12s;
  flex-shrink: 0;
}

.project-item-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.85);
}

.project-item-btn.danger:hover {
  background: rgba(220, 50, 50, 0.2);
  color: #ff6b6b;
}


.share-panel-sidebar {
  padding: 10px 10px 8px;
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  flex-shrink: 0;
}
.share-panel-title {
  font-size: 11px;
  font-weight: 600;
  color: rgba(255,255,255,0.4);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.share-vis-row {
  display: flex;
  gap: 4px;
  margin-bottom: 10px;
}
.share-vis-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 4px;
  border-radius: 7px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.04);
  color: rgba(255,255,255,0.4);
  font-size: 10px;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.share-vis-btn i { font-size: 13px; }
.share-vis-btn:hover { background: rgba(255,255,255,0.09); color: rgba(255,255,255,0.7); }
.share-vis-btn.active {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.25);
  color: #e2e8f0;
}

.share-panel-body { display: flex; flex-direction: column; gap: 6px; }
.share-panel-row { display: flex; align-items: center; gap: 5px; }
.share-panel-input {
  flex: 1; min-width: 0;
  background: rgba(0,0,0,0.3);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 5px; padding: 4px 7px;
  font-size: 11px; color: #94a3b8; outline: none; font-family: monospace;
}
.share-panel-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 9px; border-radius: 5px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.75);
  font-size: 11px; font-family: inherit; cursor: pointer;
  white-space: nowrap; transition: background 0.15s;
}
.share-panel-btn:hover { background: rgba(255,255,255,0.12); }
.share-panel-btn.danger { border-color: rgba(220,50,50,0.3); color: #f87171; padding: 4px 7px; }
.share-panel-btn.danger:hover { background: rgba(220,50,50,0.15); }
.share-panel-btn.create {
  width: 100%; justify-content: center;
  border-style: dashed; border-color: rgba(96,165,250,0.3);
  color: #60a5fa; background: rgba(96,165,250,0.06);
}
.share-panel-btn.create:hover { background: rgba(96,165,250,0.12); }

.sidebar-footer {
  padding: 8px 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  flex-shrink: 0;
}

.sidebar-new-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  background: none;
  border: 1px dashed rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.45);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.sidebar-new-btn:hover {
  background: rgba(140, 90, 255, 0.1);
  border-color: rgba(140, 90, 255, 0.35);
  color: var(--accent-soft);
}

/* ── Topbar ───────────────────────────────────────────────── */

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  padding: 10px 14px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(10, 8, 20, 0.7);
  box-shadow:
    0 0 0 0.5px rgba(255, 255, 255, 0.04) inset,
    0 24px 48px -16px rgba(0, 0, 0, 0.55);
  position: sticky;
  top: 70px;
  z-index: 20;
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
}

.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-left {
  flex: 1 1 auto;
  min-width: 0;
}

.search-wrap {
  flex: 0 0 auto;
  position: relative;
}

.topbar-search {
  min-width: min(320px, 55vw);
  padding: 9px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.07);
  color: var(--ink);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
}

.topbar-search::placeholder { color: var(--muted); }
.topbar-search:focus {
  border-color: rgba(140, 90, 255, 0.5);
  background: rgba(255, 255, 255, 0.09);
}

/* ── Copy ID button ───────────────────────────────────────── */

.copy-id-btn {
  width: 32px; height: 32px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  display: grid; place-items: center;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.copy-id-btn:hover {
  background: rgba(140, 90, 255, 0.12);
  border-color: rgba(140, 90, 255, 0.3);
  color: var(--accent-soft);
}
.copy-id-btn.copied {
  border-color: rgba(46, 204, 113, 0.6);
  color: #5eea8f;
}

/* ── Search suggest ───────────────────────────────────────── */

.search-suggest {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: rgba(15, 12, 28, 0.9);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 8px;
  box-shadow: 0 24px 48px -16px rgba(0, 0, 0, 0.7);
  display: none;
  z-index: 30;
}

.search-suggest.show { display: block; }

.suggest-item {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 10px;
  align-items: center;
  padding: 8px;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.15s;
}

.suggest-item:hover { background: rgba(140, 90, 255, 0.12); }

.suggest-thumb {
  width: 44px; height: 44px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  display: grid; place-items: center;
  overflow: hidden;
}

.suggest-thumb img { width: 100%; height: 100%; object-fit: contain; }

.suggest-meta {
  display: grid;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}

.suggest-meta strong { color: var(--ink); font-size: 13px; }

/* ── Page nav ─────────────────────────────────────────────── */

.page-nav {
  display: flex;
  gap: 6px;
  flex-wrap: nowrap;
  overflow-x: auto;
  flex: 1 1 auto;
  min-width: 0;
  padding: 0 8px 4px;
  scrollbar-width: thin;
  scrollbar-color: rgba(140, 90, 255, 0.5) transparent;
}

.page-nav::-webkit-scrollbar { height: 4px; }
.page-nav::-webkit-scrollbar-track { background: transparent; }
.page-nav::-webkit-scrollbar-thumb {
  background: rgba(140, 90, 255, 0.5);
  border-radius: 999px;
}

.page-link {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  font-size: 12px;
  font-family: inherit;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.page-link.is-draggable { cursor: grab; }
.page-link.is-draggable:active { cursor: grabbing; }
.page-link.is-dragging { opacity: 0.5; }
.page-link.is-drop-target {
  border-color: rgba(255, 255, 255, 0.4);
  color: var(--ink);
}
.page-link:hover,
.page-link.active {
  color: var(--ink);
  border-color: rgba(140, 90, 255, 0.6);
  background: rgba(140, 90, 255, 0.1);
}

/* ── Upload card ──────────────────────────────────────────── */

.upload-card {
  padding: 36px 32px;
  background: rgba(255, 255, 255, 0.025);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1.5px dashed rgba(255, 255, 255, 0.1);
  border-radius: 22px;
  display: grid;
  gap: 14px;
  place-items: center;
  text-align: center;
  margin-top: 28px;
  transition: border-color 0.25s, background 0.25s;
  position: relative;
  overflow: hidden;
}

.upload-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(140, 90, 255, 0.04) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

.upload-card:hover {
  border-color: rgba(140, 90, 255, 0.35);
  background: rgba(140, 90, 255, 0.04);
}
.upload-card:hover::before { opacity: 1; }

.upload-label {
  font-weight: 600;
  font-size: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.7);
}

.upload-hint { font-size: 12px; color: var(--muted); }

.upload-plus {
  width: 64px; height: 64px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: rgba(140, 90, 255, 0.1);
  color: rgba(140, 90, 255, 0.8);
  display: grid; place-items: center;
  font-size: 26px;
  transition: background 0.2s, color 0.2s;
}

.upload-card:hover .upload-plus {
  background: rgba(140, 90, 255, 0.2);
  color: var(--accent-soft);
}

.upload-card input[type="file"] { width: min(320px, 80%); text-align: center; }

input[type="file"] {
  padding: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 13px;
  color: var(--ink);
  font-family: inherit;
}

/* ── Main / Empty ─────────────────────────────────────────── */

main { margin-top: 32px; }

.empty {
  padding: 72px 48px;
  text-align: center;
  border-radius: 24px;
  border: 1px dashed rgba(255, 255, 255, 0.1);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.025);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  animation: rise 0.4s ease both;
}

.empty-icon-wrap {
  width: 72px; height: 72px;
  border-radius: 20px;
  background: rgba(140, 90, 255, 0.1);
  border: 1px solid rgba(140, 90, 255, 0.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
  color: rgba(140, 90, 255, 0.6);
  margin-bottom: 4px;
}

.empty h2 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: rgba(255, 255, 255, 0.75);
}

.empty p {
  font-size: 14px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.35);
  max-width: 320px;
}

.empty-steps {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 8px;
}

.empty-step {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(140, 90, 255, 0.08);
  border: 1px solid rgba(140, 90, 255, 0.18);
  color: rgba(180, 140, 255, 0.7);
}

.empty-step i { font-size: 11px; }
.empty-step-sep { font-size: 12px; color: rgba(255, 255, 255, 0.2); }

.gallery { display: grid; gap: 28px; }

/* ── Image section ────────────────────────────────────────── */

.image-section {
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-radius: 22px;
  border: 1px solid var(--border);
  box-shadow:
    0 0 0 0.5px rgba(255, 255, 255, 0.04) inset,
    0 20px 40px -20px rgba(0, 0, 0, 0.6);
  padding: 16px;
  scroll-margin-top: var(--nav-offset);
}

.image-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding: 0 4px;
}

.image-title {
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.2px;
  color: rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 4px 12px;
  border-radius: 999px;
}

.image-delete {
  position: absolute;
  top: 12px; right: 12px;
  width: 28px; height: 28px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(10px);
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  display: grid; place-items: center;
  z-index: 2;
  transition: background 0.15s, color 0.15s;
}

.image-delete i { pointer-events: none; }

.image-delete:hover {
  background: rgba(255, 80, 80, 0.2);
  border-color: rgba(255, 80, 80, 0.4);
  color: #ff8080;
}

/* ── Edit toggle ──────────────────────────────────────────── */

.edit-toggle {
  position: relative;
  width: 128px; height: 38px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-weight: 600;
  font-family: inherit;
  letter-spacing: 0.01em;
  cursor: pointer;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  padding: 0;
  text-transform: uppercase;
  backdrop-filter: blur(10px);
  overflow: hidden;
}

.edit-toggle::before {
  content: "";
  position: absolute;
  top: 4px; bottom: 3px; left: 4px;
  width: calc(50% - 7px);
  border-radius: 9px;
  background: linear-gradient(135deg, rgba(140, 90, 255, 0.85), rgba(80, 50, 180, 0.85));
  box-shadow: 0 4px 12px -4px rgba(140, 90, 255, 0.5);
  transition: left 0.2s ease;
  z-index: 0;
}

.edit-toggle span {
  position: relative;
  z-index: 1;
  font-size: 11px;
  text-align: center;
  justify-self: center;
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.edit-toggle.is-editing { color: rgba(255, 255, 255, 0.9); }
.edit-toggle.is-editing::before { left: calc(50% + 4px); }
.edit-toggle.is-editing .toggle-edit { color: rgba(255, 255, 255, 0.95); }
.edit-toggle.is-editing .toggle-view { color: var(--muted); }
.edit-toggle .toggle-view { color: rgba(255, 255, 255, 0.9); }

/* ── Image frame ──────────────────────────────────────────── */

.image-frame {
  position: relative;
  width: auto; max-width: 100%;
  margin: 0 auto;
  aspect-ratio: 16/9;
  height: auto;
  overflow: hidden;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.4);
  user-select: none;
}

.image-frame img { user-select: none; -webkit-user-drag: none; }

.image-frame.is-editing {
  outline: 2px dashed rgba(140, 90, 255, 0.7);
  outline-offset: 4px;
  cursor: crosshair;
}

.image-frame.is-link-drop {
  outline: 2px dashed rgba(255, 255, 255, 0.5);
  outline-offset: 6px;
}

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

/* ── Overlay nodes ────────────────────────────────────────── */

.overlay-node { position: absolute; width: 0; height: 0; }

.overlay-node.highlight .overlay-btn {
  box-shadow:
    0 0 0 3px rgba(140, 90, 255, 0.8),
    0 0 24px rgba(140, 90, 255, 0.6);
  animation: highlight-pulse 0.55s ease-out;
}

@keyframes highlight-pulse {
  0%   { box-shadow: 0 0 0 12px rgba(140, 90, 255, 0.35), 0 0 44px rgba(140, 90, 255, 0.75); }
  60%  { box-shadow: 0 0 0 5px rgba(140, 90, 255, 0.6),   0 0 30px rgba(140, 90, 255, 0.7);  }
  100% { box-shadow: 0 0 0 3px rgba(140, 90, 255, 0.8),   0 0 24px rgba(140, 90, 255, 0.6);  }
}

.overlay-layer { position: absolute; inset: 0; }

.overlay-btn {
  position: absolute;
  width: var(--overlay-item-size);
  height: var(--overlay-item-size);
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.6);
  background: rgba(20, 16, 40, 0.6);
  backdrop-filter: blur(8px);
  color: rgba(255, 255, 255, 0.9);
  font-weight: 800;
  cursor: pointer;
  top: 0; left: 0;
  transform: translate(-50%, -50%);
  display: grid; place-items: center;
  box-shadow: 0 4px 16px -6px rgba(0, 0, 0, 0.6);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  background-size: cover;
  background-position: center;
  overflow: hidden;
  --marker-size: calc(var(--overlay-item-size) + 28px);
}

.overlay-btn:hover {
  transform: translate(-50%, -50%) scale(1.18);
  box-shadow: 0 6px 20px -8px rgba(0, 0, 0, 0.7);
}

.overlay-btn::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 12px);
  transform: translateX(-50%);
  background: rgba(10, 8, 20, 0.9);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  color: var(--ink);
  padding: 7px 11px;
  border-radius: 10px;
  font-size: 12px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.overlay-btn:hover::after { opacity: 1; }

.overlay-btn.is-editing { background: rgba(140, 90, 255, 0.35); border-color: rgba(140, 90, 255, 0.8); }
.overlay-btn.has-item { color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7); background: rgba(0, 0, 0, 0.5); }
.overlay-btn.is-link { background: rgba(20, 16, 40, 0.7); color: rgba(255, 255, 255, 0.9); }
.overlay-btn.is-link.is-editing { background: rgba(20, 16, 40, 0.7); }

.link-index {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  text-align: center; line-height: 1;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: calc(var(--marker-size) * 0.46);
  color: rgba(255, 255, 255, 0.3);
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
  letter-spacing: 1px;
  pointer-events: none; z-index: 2;
}

.link-trail {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  pointer-events: none; z-index: 1;
}

.link-trail i {
  color: rgba(255, 255, 255, 0.7);
  font-size: calc(var(--marker-size) * 0.32);
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.4));
  transform: rotate(90deg);
  opacity: 0.6;
}

/* ── Thumb grid ───────────────────────────────────────────── */

.thumb-grid {
  position: absolute; inset: 5px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 4px; z-index: 1; pointer-events: none;
}

.thumb-grid.count-2 { grid-template-columns: repeat(2,1fr); grid-template-rows: 1fr; inset: 6px 4px; gap: 3px; }
.thumb-grid.count-3 { display: block; inset: 4px; }
.thumb-grid.count-3 .thumb-cell { position: absolute; width: 58%; height: 58%; }
.thumb-grid.count-3 .thumb-cell:nth-child(1) { left: 2%; top: 4%; }
.thumb-grid.count-3 .thumb-cell:nth-child(2) { right: 2%; top: 4%; }
.thumb-grid.count-3 .thumb-cell:nth-child(3) { left: 21%; top: 42%; }

.thumb-cell {
  background: transparent;
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  border-radius: 4px;
}

.thumb-single { position: absolute; inset: 10px; display: grid; place-items: center; z-index: 1; pointer-events: none; }
.thumb-single img { width: 100%; height: 100%; object-fit: contain; }

.thumb-extra {
  position: absolute; right: 6px; bottom: 6px;
  min-width: var(--overlay-bubble-min-width);
  height: var(--overlay-bubble-height);
  padding: 0 5px; border-radius: 999px;
  background: rgba(10, 8, 20, 0.85);
  color: rgba(255, 255, 255, 0.9);
  font-size: var(--overlay-bubble-font-size);
  font-weight: 700;
  display: grid; place-items: center;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
  pointer-events: none;
}

/* ── Overlay card ─────────────────────────────────────────── */

.overlay-card {
  position: absolute;
  top: 12px; left: 12px;
  width: 400px;
  background: rgba(12, 10, 24, 0.88);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 14px;
  box-shadow:
    0 0 0 0.5px rgba(255, 255, 255, 0.05) inset,
    0 24px 48px -16px rgba(0, 0, 0, 0.7);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px) scale(0.98);
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 5;
}

.overlay-card .overlay-close {
  position: absolute; top: 10px; right: 10px;
  width: 26px; height: 26px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  cursor: pointer; font-size: 12px; line-height: 1;
  display: grid; place-items: center;
  transition: background 0.15s, color 0.15s;
}

.overlay-card .overlay-close i { pointer-events: none; }

.overlay-card .overlay-close:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--ink);
}

.overlay-node.expanded { z-index: 6; }
.overlay-node.expanded .overlay-card { opacity: 1; pointer-events: auto; transform: translateY(0) scale(1); }

.overlay-card h4 { margin: 0 0 8px; font-size: 14px; font-weight: 600; }

.overlay-card-list { display: grid; gap: 6px; max-height: 220px; overflow: auto; }

.overlay-card-item {
  display: grid;
  grid-template-columns: 34px 1fr auto auto;
  gap: 10px; align-items: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 7px 10px;
}

.overlay-card-item img { width: 34px; height: 34px; border-radius: 8px; object-fit: cover; }
.overlay-card-item span { font-size: 12px; color: var(--ink); }

.overlay-card-actions { display: flex; gap: 8px; margin-top: 10px; }

.overlay-card-actions button,
.overlay-card-remove {
  border-radius: 999px;
  padding: 6px 12px;
  background: rgba(140, 90, 255, 0.15);
  border: 1px solid rgba(140, 90, 255, 0.3);
  color: var(--ink);
  font-size: 11px; font-weight: 500;
  cursor: pointer; font-family: inherit;
  transition: background 0.15s;
}

.overlay-card-actions button:hover { background: rgba(140, 90, 255, 0.25); }

.overlay-card-remove {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--border);
  color: var(--muted);
}

.overlay-card-remove:hover { background: rgba(255, 80, 80, 0.15); border-color: rgba(255, 80, 80, 0.3); color: #ff9090; }

/* ── Conveyor ─────────────────────────────────────────────── */

.conveyor-tools { display: flex; align-items: center; gap: 8px; margin: 10px 0 0; }

.conveyor-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
}

.conveyor-icon img { max-width: 100%; max-height: 100%; object-fit: contain; }

.conveyor-select {
  flex: 1; min-width: 120px;
  padding: 5px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
  font-size: 12px; font-family: inherit;
}

.conveyor-copy {
  width: 34px; height: 34px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
  cursor: pointer;
  display: grid; place-items: center;
  transition: background 0.15s;
}

.conveyor-copy i { font-size: 14px; }
.conveyor-copy:hover { background: rgba(255, 255, 255, 0.1); }
.conveyor-copy.copied { border-color: rgba(46, 204, 113, 0.6); color: #5eea8f; }

.instructions { font-size: 12px; color: var(--muted); margin-top: 10px; }

/* ── Toast ────────────────────────────────────────────────── */

.toast {
  position: fixed;
  left: 50%; bottom: 28px;
  transform: translateX(-50%);
  background: rgba(20, 16, 36, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  color: var(--ink);
  padding: 10px 20px;
  border-radius: 999px;
  font-size: 13px; font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  box-shadow: 0 8px 32px -8px rgba(0, 0, 0, 0.6);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(-6px);
}

/* ── Modals ───────────────────────────────────────────────── */

.modal {
  position: fixed; inset: 0;
  display: none;
  align-items: center; justify-content: center;
  z-index: 100;
}

.modal.show { display: flex; }

.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.modal-card {
  position: relative;
  width: min(560px, 92vw);
  background: rgba(12, 10, 24, 0.92);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-radius: 22px;
  border: 1px solid var(--border);
  box-shadow:
    0 0 0 0.5px rgba(255, 255, 255, 0.06) inset,
    0 32px 64px -16px rgba(0, 0, 0, 0.8),
    0 0 60px rgba(108, 43, 217, 0.06);
  padding: 20px;
  display: grid;
  gap: 14px;
}

.confirm-card { width: min(400px, 92vw); }
.auth-card { width: min(380px, 92vw); }

.confirm-message { color: var(--muted); margin: 0; font-size: 14px; }
.auth-message { color: var(--muted); font-size: 13px; margin: 0; line-height: 1.5; }

.confirm-actions { display: flex; justify-content: flex-end; gap: 10px; }

.confirm-btn {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 13px; font-weight: 500;
  font-family: inherit;
  transition: background 0.15s;
}

.confirm-btn:hover { background: rgba(255, 255, 255, 0.1); }

.confirm-btn.primary {
  border-color: rgba(140, 90, 255, 0.5);
  color: rgba(255, 255, 255, 0.95);
  background: linear-gradient(135deg, rgba(140, 90, 255, 0.25), rgba(80, 50, 180, 0.25));
}

.confirm-btn.primary:hover { background: linear-gradient(135deg, rgba(140, 90, 255, 0.4), rgba(80, 50, 180, 0.35)); }

.confirm-btn.danger {
  border-color: rgba(255, 80, 80, 0.45);
  color: #ffb0b0;
  background: rgba(255, 60, 60, 0.12);
}

.confirm-btn.danger:hover { background: rgba(255, 60, 60, 0.22); }

/* ── Modal header / search ────────────────────────────────── */

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
}

.modal-actions { display: inline-flex; align-items: center; gap: 8px; }

.modal-confirm {
  border: 1px solid rgba(94, 234, 143, 0.5);
  background: rgba(94, 234, 143, 0.1);
  color: #c0f5d4;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 12px; font-weight: 600; font-family: inherit;
  display: inline-flex; align-items: center; gap: 6px;
  transition: background 0.15s;
}

.modal-confirm::before {
  content: "";
  width: 8px; height: 4px;
  border-left: 2px solid #5eea8f;
  border-bottom: 2px solid #5eea8f;
  transform: rotate(-45deg);
  margin-top: -1px;
}

.modal-confirm:hover { background: rgba(94, 234, 143, 0.18); }

.modal-close {
  border: none; background: transparent;
  color: var(--muted); font-weight: 500;
  cursor: pointer; font-family: inherit;
  font-size: 13px;
  transition: color 0.15s;
}

.modal-close:hover { color: var(--ink); }

.modal-search {
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  font-size: 14px; font-family: inherit;
  background: rgba(255, 255, 255, 0.07);
  color: var(--ink);
  outline: none;
  transition: border-color 0.2s;
  width: 100%;
}

.modal-search::placeholder { color: var(--muted); }
.modal-search:focus { border-color: rgba(140, 90, 255, 0.5); }

.modal-results { max-height: 320px; overflow: auto; display: grid; gap: 6px; }

.item-result {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 12px; align-items: center;
  border: 1px solid transparent;
  padding: 8px; border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.item-result:hover {
  border-color: rgba(140, 90, 255, 0.3);
  background: rgba(140, 90, 255, 0.1);
}

.item-result.is-selected {
  border-color: rgba(140, 90, 255, 0.6);
  background: rgba(140, 90, 255, 0.18);
}

.item-thumb {
  width: 48px; height: 48px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  display: grid; place-items: center; overflow: hidden;
}

.item-thumb img { width: 100%; height: 100%; object-fit: cover; }

.item-meta { display: grid; gap: 4px; }
.item-meta span { color: var(--muted); font-size: 12px; }

/* ── Sign preview ─────────────────────────────────────────── */

.sign-preview {
  display: none; margin-top: 10px; padding-top: 10px;
  border-top: 1px solid var(--border);
  position: relative;
}

.sign-preview.show { display: block; }

.sign-canvas {
  width: 100%; height: auto;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.3);
}

.sign-copy {
  position: absolute; top: 18px; right: 4px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(10px);
  color: var(--ink);
  font-size: 11px; font-weight: 500;
  cursor: pointer;
  opacity: 0; transform: translateY(-4px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}

.sign-copy i { font-size: 13px; }
.sign-preview:hover .sign-copy { opacity: 1; transform: translateY(0); pointer-events: auto; }
.sign-copy.copied { border-color: rgba(46, 204, 113, 0.6); color: #5eea8f; }
.sign-status:empty { display: none; }

/* ── Animations ───────────────────────────────────────────── */

@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Responsive ───────────────────────────────────────────── */

@media (max-width: 900px) {
  .page { flex-direction: column; }
  .sidebar { width: 100%; position: static; max-height: none; border-radius: 14px; }
  .sidebar-list { max-height: 160px; }
  .topbar { flex-direction: column; align-items: stretch; }
  .topbar-search { min-width: 100%; }
}

.legal-footer {
  text-align: center;
  padding: 16px 24px;
  border-top: 1px solid rgba(255,255,255,0.06);
  margin-top: 40px;
  display: flex;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
}
.legal-footer a {
  font-size: 11px;
  color: rgba(255,255,255,0.2);
  text-decoration: none;
}
.legal-footer a:hover { color: rgba(255,255,255,0.4); }
