/* ── Theme variables ─────────────────────────────────── */
:root {
  --bg:           #f5f5f7;
  --surface:      #ffffff;
  --surface-2:    #fafafa;
  --surface-3:    #f0f0f2;
  --border:       rgba(0,0,0,0.08);
  --border-strong:rgba(0,0,0,0.14);
  --primary:      #0071e3;
  --primary-hover:#006edb;
  --danger:       #ff3b30;
  --danger-hover: #e0352b;
  --text:         #1d1d1f;
  --text-2:       #3d3d3f;
  --text-muted:   #86868b;
  --text-dim:     #6e6e73;
  --shadow-xs:    0 1px 4px rgba(0,0,0,0.06);
  --shadow-sm:    0 2px 12px rgba(0,0,0,0.07);
  --shadow-md:    0 8px 28px rgba(0,0,0,0.1);
  --shadow-lg:    0 20px 60px rgba(0,0,0,0.14);
  --header-h:     52px;
  --sidebar-w:    232px;
  --radius:       12px;
  --radius-sm:    8px;
  --radius-lg:    18px;
  --transition:   0.18s cubic-bezier(0.4,0,0.2,1);
}

[data-theme="dark"] {
  --bg:           #000000;
  --surface:      #1c1c1e;
  --surface-2:    #2c2c2e;
  --surface-3:    #3a3a3c;
  --border:       rgba(255,255,255,0.09);
  --border-strong:rgba(255,255,255,0.16);
  --primary:      #0a84ff;
  --primary-hover:#3395ff;
  --danger:       #ff453a;
  --danger-hover: #ff6b63;
  --text:         #f5f5f7;
  --text-2:       #e5e5ea;
  --text-muted:   #8e8e93;
  --text-dim:     #aeaeb2;
  --shadow-xs:    0 1px 4px rgba(0,0,0,0.4);
  --shadow-sm:    0 2px 12px rgba(0,0,0,0.5);
  --shadow-md:    0 8px 28px rgba(0,0,0,0.6);
  --shadow-lg:    0 20px 60px rgba(0,0,0,0.8);
}

/* ── Reset & base ────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { color-scheme: light; }
[data-theme="dark"] { color-scheme: dark; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.47;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Header ──────────────────────────────── */
header {
  position: sticky;
  top: 0;
  height: var(--header-h);
  background: rgba(255,255,255,0.82);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border);
  z-index: 50;
  transition: background var(--transition), border-color var(--transition);
}

[data-theme="dark"] header {
  background: rgba(28,28,30,0.85);
}

.header-inner {
  max-width: 1120px;
  margin: 0 auto;
  height: 100%;
  padding: 0 22px;
  display: flex;
  align-items: center;
  gap: 14px;
}

/* ── Logo ────────────────────────────────── */
.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.3px;
  flex-shrink: 0;
  text-decoration: none;
}

.logo svg { color: var(--primary); }

.logo-img {
  max-height: 30px;
  max-width: 160px;
  width: auto;
  object-fit: contain;
  display: block;
}

/* ── Search ──────────────────────────────── */
/*
 * The wrapper is now the styled pill (chips live inside it alongside the
 * input). Focus state lights up via :focus-within so the visual ring still
 * triggers whether the user is typing in the input or interacting with chips.
 */
.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  background: var(--surface-3);
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 4px 8px 4px 32px;
  min-height: 32px;
  transition: border-color var(--transition), background var(--transition),
              box-shadow var(--transition);
}
.search-wrap:focus-within {
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(0,113,227,0.12);
}
[data-theme="dark"] .search-wrap:focus-within {
  box-shadow: 0 0 0 3px rgba(10,132,255,0.2);
}

.search-wrap svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.search-chips {
  display: contents;   /* the wrapper does the layout; chips flow with input */
}

.search-chip {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px 4px 2px 8px;
  background: rgba(0, 113, 227, 0.12);
  color: var(--primary);
  border-radius: 7px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: -0.005em;
  max-width: 100%;
  animation: chipIn 0.14s ease;
}
[data-theme="dark"] .search-chip { background: rgba(10,132,255,0.18); }
@keyframes chipIn { from { opacity: 0; transform: scale(0.92); } to { opacity: 1; transform: none; } }

.search-chip-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 160px;
}

.search-chip-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin-left: 2px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  cursor: pointer;
  opacity: 0.65;
  line-height: 1;
  font-size: 14px;
  transition: opacity var(--transition), background var(--transition);
}
.search-chip-remove:hover {
  background: rgba(0,113,227,0.18);
  opacity: 1;
}
.search-chip-remove:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
  opacity: 1;
}

.search-input {
  flex: 1;
  min-width: 80px;
  border: none;
  outline: none;
  background: transparent;
  padding: 2px 4px;
  color: var(--text);
  font-size: 0.875rem;
  font-family: inherit;
  width: auto;
}

.search-input::placeholder { color: var(--text-muted); }
.search-wrap:not(:has(.search-chip)) .search-input::placeholder { /* same */ }
.search-wrap:has(.search-chip) .search-input::placeholder { color: var(--text-muted); opacity: 0.7; }

/* ── Theme toggle ────────────────────────── */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
}

.theme-toggle:hover {
  background: var(--surface-3);
  color: var(--text);
  border-color: transparent;
}

/* ── Buttons ─────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 980px;
  border: none;
  font-size: 0.875rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  letter-spacing: -0.01em;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:active { transform: scale(0.98); }

.btn-ghost {
  background: var(--surface-3);
  color: var(--text-2);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--surface-2); border-color: var(--border-strong); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-hover); }

.btn:disabled { opacity: 0.45; cursor: default; pointer-events: none; }
.btn-icon { padding: 8px; border-radius: 50%; }

/* ── Cards ───────────────────────────────── */
.link-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 13px 15px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  transition: box-shadow var(--transition), transform var(--transition), border-color var(--transition);
  min-width: 0;
}

.link-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
  transform: translateY(-2px);
}

.link-icon {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--surface-3);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative; /* needed for the favicon shimmer overlay */
}

.link-icon img { width: 100%; height: 100%; object-fit: cover; display: block; }
.link-icon .fallback { color: var(--text-muted); opacity: 0.5; }
/* The Settings-favicon default sits as a small contained glyph, not cropped. */
.link-icon img.site-favicon-default { object-fit: contain; padding: 7px; }

/* File-type tile paints its own coloured background; let it own the whole
   icon slot so we don't see the surface-3 chip behind it. */
.link-icon:has(.file-type-tile) {
  background: transparent;
  border: none;
}
.file-type-tile { display: block; width: 100%; height: 100%; }

/* Icon fallback wrapper */
.icon-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  opacity: 0.45;
  width: 100%;
  height: 100%;
}

.link-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.link-name {
  font-size: 0.9375rem;
  font-weight: 590;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.01em;
}

.link-domain {
  font-size: 0.8rem;
  color: var(--primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0.8;
}

.link-url {
  font-size: 0.8rem;
  color: var(--primary);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
  opacity: 0.8;
}
.link-url:hover { opacity: 1; }

.link-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.45;
}

.link-footer,
.card-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 7px;
}

/* ── Card meta strip + chips ─────────────────────────────────────────────────
 *
 * All status indicators on a link card live in a single .card-meta strip,
 * sharing a common chip baseline so heights, paddings and corner radii line
 * up regardless of variant (group tag, "Hidden" pill, dead-link pill, click
 * count). Wraps naturally when there are many chips.
 */

.group-badge,
.hidden-badge,
.broken-badge,
.card-click-count {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 980px;
  border: 1px solid transparent;
  letter-spacing: 0.01em;
  line-height: 1.4;
  transition: filter var(--transition);
}
.group-badge > svg,
.hidden-badge > svg,
.broken-badge > svg,
.card-click-count > svg { flex-shrink: 0; opacity: 0.9; }

.group-badge:hover { filter: brightness(0.96); }
[data-theme="dark"] .group-badge:hover { filter: brightness(1.15); }

/* ── Icon buttons ────────────────────────── */
.icon-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: all var(--transition);
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); border-color: var(--border-strong); }
.icon-btn.danger:hover { background: rgba(255,59,48,0.1); color: var(--danger); border-color: rgba(255,59,48,0.25); }

/* ── Links grid ──────────────────────────── */
.links-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(295px, 1fr));
  gap: 10px;
  transition: opacity 0.1s ease;
}

/* Section heading spans the full width of the grid and adds a divider line
   so each section of links reads as its own block. */
.section-heading {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 4px 6px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  margin-top: 6px;
}
.section-heading:first-child {
  border-top: none;
  margin-top: 0;
  padding-top: 4px;
}
.section-heading-count {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: normal;
  background: var(--surface-3);
  color: var(--text-muted);
  border-radius: 980px;
  padding: 1px 7px;
  text-transform: none;
}

/* Subsection headings — indented, smaller type, no full-width divider. */
.section-heading.subsection-heading {
  border-top: none;
  margin-top: 2px;
  padding: 6px 4px 4px 22px;
  font-size: 0.66rem;
  position: relative;
}
.section-heading.subsection-heading::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 50%;
  width: 10px;
  height: 1px;
  background: var(--border-strong);
}
.section-heading.subsection-heading .section-heading-count {
  font-size: 0.66rem;
  padding: 0 6px;
}

/* ── Card entrance animation ──────────────── */
@keyframes cardIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}
.card-animate {
  animation: cardIn 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* ── Search highlight ─────────────────────── */
mark { background: none; color: inherit; font-style: normal; }
mark.hl {
  background: rgba(0,113,227,0.12);
  color: var(--primary);
  border-radius: 3px;
  padding: 0 2px;
  font-weight: 600;
}
[data-theme="dark"] mark.hl { background: rgba(10,132,255,0.18); }

/* ── Favicon shimmer ──────────────────────── */
@keyframes shimmer {
  from { background-position: -200% 0; }
  to   { background-position: 200% 0; }
}
.favicon-shimmer {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, var(--surface-3) 0%, var(--surface-2) 50%, var(--surface-3) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}

/* ── Responsive — phones (≤480) and small tablets (≤720) ─────────────────── */

@media (max-width: 720px) {
  .header-inner { padding: 0 14px; gap: 10px; }
  .search-wrap  { max-width: 260px; }
}

@media (max-width: 480px) {
  body { font-size: 14px; }

  .header-inner { padding: 0 10px; gap: 6px; }
  .logo { font-size: 15px; }
  .logo-img { max-height: 26px; max-width: 130px; }

  /* Let search fill whatever's left between brand and the right-edge buttons */
  .search-wrap { flex: 1 1 auto !important; max-width: none !important; min-width: 0; }

  .theme-toggle { width: 32px; height: 32px; }

  .btn       { padding: 7px 14px; font-size: 0.8125rem; }
  .btn-icon  { padding: 8px; }

  /* Card grid: single column, tighter padding around it */
  .links-grid { gap: 8px; }
  .link-card  { padding: 11px 12px; gap: 10px; }
  .link-icon  { width: 36px; height: 36px; }

  /* Modals fit the phone width, slide up from the top edge.
     overflow-y: auto lets a long form scroll the whole overlay vertically. */
  .modal-overlay {
    padding: 0;
    align-items: flex-start;
    padding-top: 24px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .modal {
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    max-width: 100%;
    margin: 0 8px;
  }
  .modal-sm { max-width: 100%; }
  .modal-header  { padding: 16px 16px 0; }
  .modal-header h2 { font-size: 1rem; }

  .form-row { flex-direction: column !important; gap: 10px !important; }
  .form-row > * { width: 100% !important; }
  .form-group label { font-size: 0.8125rem; }

  /* Stack form action buttons on phones so each is full-width / thumb-friendly */
  .form-actions { flex-direction: column-reverse; gap: 8px; padding: 14px 16px 20px; }
  .form-actions .btn { width: 100%; justify-content: center; }
}

/* ── Custom scrollbar ─────────────────────── */
::-webkit-scrollbar         { width: 4px; height: 4px; }
::-webkit-scrollbar-track   { background: transparent; }
::-webkit-scrollbar-thumb   { background: var(--border-strong); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }

/* ── Empty state ──────────────────────────── */
.empty-state { transition: opacity 0.1s ease; }
.empty-icon  { opacity: 0.22; margin-bottom: 4px; }
.empty-title { font-size: 1rem; font-weight: 600; color: var(--text); letter-spacing: -0.01em; }
.empty-sub   { font-size: 0.875rem; color: var(--text-muted); margin-top: 4px; }
.empty-cta   { margin-top: 16px; }

/* ── Empty state ─────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 88px 24px;
  color: var(--text-muted);
  text-align: center;
}
.empty-state svg { opacity: 0.2; }
.empty-state p { font-size: 0.9375rem; }

/* ── Modals ──────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.38);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.15s ease;
}

[data-theme="dark"] .modal-overlay { background: rgba(0,0,0,0.65); }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 488px;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.2s cubic-bezier(0.34,1.56,0.64,1);
  overflow: hidden;
}

.modal-sm { max-width: 380px; }

@keyframes slideUp {
  from { transform: translateY(16px) scale(0.97); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 22px 0;
}

.modal-header h2 {
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.modal-close {
  background: var(--surface-3);
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}
.modal-close:hover { background: var(--border-strong); color: var(--text); }

/* ── Forms ───────────────────────────────── */
form { padding: 18px 22px 22px; display: flex; flex-direction: column; gap: 14px; }

.form-row { display: flex; gap: 12px; }
.form-group { display: flex; flex-direction: column; gap: 5px; }

label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-dim);
  letter-spacing: -0.01em;
}

.req { color: var(--primary); }
.label-opt { font-weight: 400; color: var(--text-muted); }

input[type="text"],
input[type="url"],
input[type="password"],
select,
textarea {
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  color: var(--text);
  font-size: 0.9375rem;
  font-family: inherit;
  width: 100%;
  outline: none;
  transition: all var(--transition);
  resize: none;
  letter-spacing: -0.01em;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(0,113,227,0.12);
}
[data-theme="dark"] input:focus,
[data-theme="dark"] select:focus,
[data-theme="dark"] textarea:focus {
  box-shadow: 0 0 0 3px rgba(10,132,255,0.2);
}

input::placeholder, textarea::placeholder { color: var(--text-muted); }
select { appearance: none; cursor: pointer; }
select option { background: var(--surface); }

/* URL + favicon */
.url-input-wrap { display: flex; gap: 8px; align-items: center; }
.url-input-wrap input { flex: 1; }

.favicon-preview {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-3);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.favicon-preview img { width: 100%; height: 100%; object-fit: contain; display: none; }
.favicon-preview img.visible { display: block; }

/* Icon upload */
.icon-upload { display: flex; align-items: center; gap: 10px; }

.icon-upload-inner {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px;
  background: var(--surface-3);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.8125rem;
  transition: all var(--transition);
}
.icon-upload-inner:hover { border-color: var(--primary); color: var(--primary); background: var(--surface); }

.icon-preview-wrap { position: relative; width: 42px; height: 42px; }
.icon-preview-wrap img {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  border: 1px solid var(--border);
}

.icon-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  background: var(--danger);
  border: none;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #fff;
}

/* Color palette */
.color-palette { display: flex; gap: 8px; flex-wrap: wrap; padding: 2px 0; }
.color-swatch {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  cursor: pointer;
  border: 2.5px solid transparent;
  transition: transform var(--transition), border-color var(--transition);
}
.color-swatch:hover { transform: scale(1.15); }
.color-swatch.selected { border-color: var(--text); transform: scale(1.1); }

/* Form error */
.form-error {
  background: rgba(255,59,48,0.08);
  border: 1px solid rgba(255,59,48,0.2);
  color: var(--danger);
  border-radius: var(--radius-sm);
  padding: 9px 13px;
  font-size: 0.8125rem;
}

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

.confirm-msg {
  padding: 14px 22px 6px;
  color: var(--text-2);
  font-size: 0.9375rem;
  line-height: 1.5;
}

.modal-sm .form-actions { padding: 6px 22px 22px; }

/* ── Utility ─────────────────────────────── */
.hidden { display: none !important; }

/* ── Gate (public password + admin token) ── */
.gate {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg);
  z-index: 200;
}

.gate-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 44px 40px;
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  box-shadow: var(--shadow-lg);
}

.gate-icon {
  width: 62px;
  height: 62px;
  border-radius: 16px;
  background: rgba(0,113,227,0.1);
  border: 1px solid rgba(0,113,227,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  margin-bottom: 6px;
}

[data-theme="dark"] .gate-icon {
  background: rgba(10,132,255,0.12);
  border-color: rgba(10,132,255,0.2);
}

.gate-card h1      { font-size: 1.375rem; font-weight: 700; letter-spacing: -0.03em; }
.gate-card > p     { color: var(--text-muted); font-size: 0.9375rem; margin-bottom: 8px; }
.gate-card form    { width: 100%; display: flex; flex-direction: column; gap: 10px; padding: 0; }
.gate-input-wrap   { position: relative; display: flex; }
.gate-submit       { width: 100%; justify-content: center; padding: 10px; font-size: 0.9375rem; }
.gate-back         { margin-top: 6px; font-size: 0.8125rem; color: var(--text-muted); text-decoration: none; transition: color var(--transition); }
.gate-back:hover   { color: var(--primary); }

/* ── Form warning (non-blocking, yellow) ───── */
.form-warning {
  background: rgba(255,149,0,0.08);
  border: 1px solid rgba(255,149,0,0.25);
  color: #ff9500;
  border-radius: var(--radius-sm);
  padding: 9px 13px;
  font-size: 0.8125rem;
}
[data-theme="dark"] .form-warning { color: #ffb340; }

/* ── Broken link chip — colour variant of .card-meta chip baseline ─────── */
.broken-badge {
  color: var(--danger);
  background: rgba(255,59,48,0.08);
  border-color: rgba(255,59,48,0.22);
}

/* ── Easter egg ───────────────────────────── */
.easteregg-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  animation: fadeIn 0.2s ease;
}

.easteregg-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 52px 56px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  max-width: 360px;
  width: calc(100% - 48px);
  animation: slideUp 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  cursor: default;
}

.easteregg-flag     { font-size: 3.25rem; line-height: 1; margin-bottom: 20px; display: block; }
.easteregg-by       { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.12em; color: var(--text-muted); margin-bottom: 8px; }
.easteregg-name     { font-size: 1.875rem; font-weight: 700; letter-spacing: -0.04em; color: var(--text); margin-bottom: 4px; }
.easteregg-location { font-size: 0.9375rem; color: var(--text-muted); }
.easteregg-divider  { width: 36px; height: 2px; background: var(--primary); border-radius: 2px; margin: 22px auto; }
.easteregg-quote    { font-size: 1.0625rem; font-style: italic; font-weight: 500; color: var(--primary); letter-spacing: -0.01em; }
.easteregg-github {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 20px;
  padding: 8px 16px;
  border-radius: 980px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: 0.8125rem;
  font-weight: 500;
  text-decoration: none;
  transition: all var(--transition);
}
.easteregg-github:hover { background: var(--surface-2); border-color: var(--border-strong); color: var(--text); }
.easteregg-dismiss  { margin-top: 20px; font-size: 0.75rem; color: var(--text-muted); }

/* ── Drag and drop ───────────────────────── */
.link-card[draggable="true"] { cursor: grab; }
.link-card.dragging          { opacity: 0.4; }
.link-card.drag-over {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(0,113,227,0.25);
}
[data-theme="dark"] .link-card.drag-over { box-shadow: 0 0 0 2px rgba(10,132,255,0.3); }

.drag-handle {
  color: var(--text-muted);
  opacity: 0;
  cursor: grab;
  padding: 2px;
  flex-shrink: 0;
  transition: opacity var(--transition);
}
.link-card:hover .drag-handle { opacity: 0.5; }
