:root {
  --bg: #ffffff;
  --sidebar-bg: #f5f5f7;
  --text: #000000;
  --text-dim: #86868b;
  --border: rgba(0,0,0,0.08);
  --accent: #000000;
  --card-bg: #ffffff;
  --card-shadow: 0 1px 3px rgba(0,0,0,0.08);
  --search-bg: #e9e9eb;
  --search-text: #000000;
  --hover: rgba(0,0,0,0.04);
  --selected: rgba(0,0,0,0.07);
  --modal-bg: #ffffff;
  --logo-filter: invert(1);
  --no-icon-color: #9a9aa0;
  --icon-shadow:
    0 1px 1px rgba(0,0,0,0.05),
    0 2px 6px rgba(0,0,0,0.07),
    inset 0 1px 0 rgba(255,255,255,0.35),
    inset 0 -1px 1px rgba(0,0,0,0.04);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000;
    --sidebar-bg: #1c1c1e;
    --text: #ffffff;
    --text-dim: #98989d;
    --border: rgba(255,255,255,0.1);
    --accent: #ffffff;
    --card-bg: #1c1c1e;
    --card-shadow: 0 1px 3px rgba(0,0,0,0.4);
    --search-bg: #2c2c2e;
    --search-text: #ffffff;
    --hover: rgba(255,255,255,0.08);
    --selected: rgba(255,255,255,0.12);
    --modal-bg: #1c1c1e;
    --logo-filter: none;
    --no-icon-color: #ffffff;
    --icon-shadow:
      0 1px 1px rgba(0,0,0,0.12),
      0 4px 10px rgba(0,0,0,0.18),
      inset 0 1px 0 rgba(255,255,255,0.35),
      inset 0 -1px 1px rgba(0,0,0,0.08);
  }
}

:root[data-theme="dark"] {
  --bg: #000000;
  --sidebar-bg: #1c1c1e;
  --text: #ffffff;
  --text-dim: #98989d;
  --border: rgba(255,255,255,0.1);
  --accent: #ffffff;
  --card-bg: #1c1c1e;
  --card-shadow: 0 1px 3px rgba(0,0,0,0.4);
  --search-bg: #2c2c2e;
  --search-text: #ffffff;
  --hover: rgba(255,255,255,0.08);
  --selected: rgba(255,255,255,0.12);
  --modal-bg: #1c1c1e;
  --logo-filter: none;
  --no-icon-color: #ffffff;
  --icon-shadow:
    0 1px 1px rgba(0,0,0,0.12),
    0 4px 10px rgba(0,0,0,0.18),
    inset 0 1px 0 rgba(255,255,255,0.35),
    inset 0 -1px 1px rgba(0,0,0,0.08);
}

* { box-sizing: border-box; }

/* Splash */
.splash {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.4s ease;
}

.splash.splash-hidden {
  opacity: 0;
  pointer-events: none;
}

.pulse-dot {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--text);
  animation: loading-ui-pulse-dot 1.2s ease-in-out infinite;
}

@keyframes loading-ui-pulse-dot {
  0%, 100% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.5); opacity: 1; }
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
}

.app {
  display: flex;
  height: 100vh;
  height: 100dvh;
}

/* Sidebar */
.sidebar {
  width: 240px;
  min-width: 240px;
  background: transparent;
  display: flex;
  flex-direction: column;
  padding: 28px 24px;
}

.sidebar-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0 24px;
}

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

.sidebar-header-logo {
  height: 20px;
  width: auto;
  display: block;
  filter: var(--logo-filter);
}

.beta-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--bg);
  background: var(--accent);
  padding: 2px 6px;
  border-radius: 4px;
}

.sidebar-header-btn {
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-size: 15px;
  line-height: 1;
  width: 20px;
  height: 20px;
  border-radius: 5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-header-btn:hover {
  background: var(--hover);
  color: var(--text);
}

.category-new-input {
  width: 100%;
  font-size: 13px;
  padding: 6px 10px;
  margin-bottom: 2px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--search-bg);
  color: var(--text);
  outline: none;
}

.category-rename-input {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  padding: 1px 4px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--search-bg);
  color: var(--text);
  outline: none;
}

.category-area {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* The list hides its own scrollbar; sidebar-scroll.js draws a half-height
   one in the sidebar's right margin, clear of the counts. */
.category-list { scrollbar-width: none; }
.category-list::-webkit-scrollbar { display: none; }

.side-scroll {
  position: absolute;
  right: -15px;
  width: 6px;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.side-scroll[hidden] { display: none; }
.side-scroll.is-active,
.side-scroll:hover { opacity: 1; }

.side-scroll-thumb {
  width: 4px;
  margin: 0 auto;
  border-radius: 4px;
  background: var(--scroll-thumb, rgba(0, 0, 0, 0.18));
  cursor: grab;
  touch-action: none;
}

.side-scroll:hover .side-scroll-thumb,
.side-scroll.is-dragging .side-scroll-thumb { background: var(--scroll-thumb-hover, rgba(0, 0, 0, 0.36)); }
.side-scroll.is-dragging .side-scroll-thumb { cursor: grabbing; }

@media (max-width: 820px) {
  .side-scroll { right: -10px; }
}

.category-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.category-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 0;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-dim);
  -webkit-user-select: none;
  user-select: none;
  transition: color 0.15s ease;
}

.category-item:hover {
  color: var(--text);
}

.category-item.active {
  color: var(--accent);
  font-weight: 600;
}

.category-item.drag-over {
  color: var(--accent);
  font-weight: 600;
  outline: 1px dashed var(--accent);
  outline-offset: 4px;
  border-radius: 4px;
}

.category-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-icon {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  color: var(--text-dim);
}

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





.category-item .count {
  font-size: 11px;
  color: var(--text-dim);
  flex-shrink: 0;
}

.category-item.active .count {
  color: var(--accent);
}

.category-divider {
  height: 1px;
  background: var(--border);
  margin: 8px 6px;
}

.sidebar-footer {
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.theme-switch {
  width: 40px;
  height: 24px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--search-bg);
  cursor: pointer;
  position: relative;
  padding: 0;
  flex-shrink: 0;
}

.theme-switch-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--text);
  transition: transform 0.2s ease;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-switch-knob {
    transform: translateX(16px);
  }
}

:root[data-theme="dark"] .theme-switch-knob {
  transform: translateX(16px);
}

.sidebar-btn {
  width: 100%;
  padding: 8px 10px;
  font-size: 13px;
  background: transparent;
  color: var(--accent);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-btn:hover {
  background: var(--hover);
}

.sidebar-btn[hidden] {
  display: none;
}

.sidebar-btn-icon {
  display: inline-flex;
  flex-shrink: 0;
}

.sidebar-divider {
  height: 1px;
  background: var(--border);
  margin: 10px 0;
}

.sidebar-btn-outline {
  width: 100%;
  padding: 7px 10px;
  font-size: 13px;
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  text-align: center;
}

.sidebar-btn-outline:hover {
  background: var(--hover);
  border-color: var(--accent);
}

/* Main */
.main {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  -webkit-app-region: drag;
}

.search-wrap {
  position: relative;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  background: var(--search-bg);
  border-radius: 16px;
  overflow: hidden;
  transition: width 0.2s ease;
  flex-shrink: 0;
}

.search-wrap.expanded {
  width: 320px;
}

.search-icon-btn {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border: none;
  background: transparent;
  color: var(--text-dim);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.search-icon {
  color: var(--text-dim);
  flex-shrink: 0;
}

#searchInput {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  outline: none;
  color: var(--search-text);
  font-size: 14px;
  padding: 0 8px 0 0;
}

#searchInput::placeholder {
  color: var(--text-dim);
}

.clear-btn {
  border: none;
  background: var(--text-dim);
  color: var(--bg);
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  border-radius: 50%;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin-right: 8px;
}

.add-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: var(--search-bg);
  color: var(--text);
  font-size: 18px;
  cursor: pointer;
  flex-shrink: 0;
}

.add-btn:hover {
  background: var(--hover);
}

.icon-btn {
  height: 32px;
  padding: 0 12px;
  border-radius: 8px;
  border: none;
  background: var(--search-bg);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  flex-shrink: 0;
  margin-left: auto;
}

.icon-btn:hover {
  background: var(--hover);
}

.icon-btn.active {
  background: var(--accent);
  color: var(--bg);
}

.select-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 24px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--text);
}

.select-bar[hidden] {
  display: none;
}

#selectCount {
  color: var(--text-dim);
}

#moveToSelect {
  font-size: 13px;
  padding: 5px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--search-bg);
  color: var(--text);
}

.select-bar .btn-text {
  margin-left: auto;
}

.select-bar .danger {
  margin-left: 0;
}

.select-bar .select-all-btn {
  margin-left: 0;
}

.select-bar .select-all-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.card-checkbox {
  position: absolute;
  top: -6px;
  left: -6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1.5px solid var(--text-dim);
  background: var(--card-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

.card-checkbox.checked {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
}

.drop-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.5);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 600;
  z-index: 40;
  pointer-events: none;
  border: 3px dashed rgba(255,255,255,0.6);
  margin: 10px;
  border-radius: 16px;
}

.drop-overlay[hidden] {
  display: none;
}

.content {
  flex: 1;
  overflow-y: auto;
  padding: 24px 32px 48px;
  position: relative;
}

.section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin: 28px 0 14px;
}

.section-title:first-child {
  margin-top: 0;
}

.grid {
  /* --pin is the icon size from the SIZE slider (default 64px). */
  --pin-size: var(--pin, 64px);
  --card-w: calc(var(--pin-size) * 1.5);
  display: grid;
  grid-template-columns: repeat(auto-fill, var(--card-w));
  gap: calc(var(--pin-size) * 0.375);
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  width: var(--card-w, 96px);
}

.card.dragging {
  opacity: 0.35;
}

.card.drop-before::before,
.card.drop-after::after {
  content: "";
  position: absolute;
  top: 2px;
  width: 3px;
  height: var(--pin-size, 64px);
  border-radius: 2px;
  background: var(--accent);
  animation: drop-indicator-in 0.12s ease-out;
}

.card.drop-before::before {
  left: calc(var(--pin-size, 64px) * -0.2);
}

.card.drop-after::after {
  right: calc(var(--pin-size, 64px) * -0.2);
}

@keyframes drop-indicator-in {
  from { opacity: 0; transform: scaleY(0.4); }
  to { opacity: 1; transform: scaleY(1); }
}

.card.selectable .card-icon {
  opacity: 0.6;
}

.card.selectable.selected .card-icon {
  opacity: 1;
  box-shadow: 0 0 0 2px var(--accent);
}

/* Icon style B (approved Nov 23): the tile is tinted with the website's own
   colour, which app.js reads from the logo and sets as --tint-light/--tint-dark.
   Black/white logos and the "no icon" X keep the neutral tile. */
.card-icon {
  position: relative;
  width: var(--pin-size, 64px);
  height: var(--pin-size, 64px);
  border-radius: calc(var(--pin-size, 64px) * 0.234);
  background: var(--tint-light, #f0f0f2);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
  transition: transform 0.15s ease-out, background-color 0.2s ease;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .card-icon {
    background: var(--tint-dark, #2c2c2e);
  }
}

:root[data-theme="dark"] .card-icon {
  background: var(--tint-dark, #2c2c2e);
}

.card:hover .card-icon {
  transform: scale(1.06);
}

.card.selectable:hover .card-icon {
  transform: none;
}

.card-icon img,
.card-icon .no-icon {
  pointer-events: none;
}

.card-icon img {
  width: 56%;
  height: 56%;
  border-radius: 5px;
  object-fit: contain;
}

/* Same footprint as a real logo so cards stay aligned. */
.card-icon .no-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56%;
  height: 56%;
  color: var(--no-icon-color);
}

.card-icon .no-icon svg {
  width: 62%;
  height: 62%;
}

.card-title {
  font-size: clamp(11px, calc(var(--pin-size, 64px) * 0.19), 14px);
  text-align: center;
  color: var(--text);
  max-width: var(--card-w, 96px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-action {
  position: absolute;
  top: -9px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--card-bg);
  box-shadow: var(--card-shadow);
  border: none;
  font-size: 11px;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text);
  z-index: 1;
  outline: 1px solid var(--border);
}

.card-action:hover {
  background: var(--search-bg);
}

.card-action-right {
  right: 2px;
}

.card-action-left {
  left: 2px;
}

.card-action-bottom {
  top: auto;
  bottom: -9px;
  right: -9px;
}

.card-action-bottom-left {
  top: auto;
  bottom: -9px;
  left: -9px;
}

.card-action.favorited {
  display: flex;
  color: var(--text);
}

.card-action.danger {
  color: #ff3b30;
  font-size: 14px;
  font-weight: 600;
}

.card:hover .card-action {
  display: flex;
}

/* Hover buttons: bigger and easier to see (Nov 25). */
.card-action svg {
  width: 15px;
  height: 15px;
}

.card-action.danger svg {
  width: 14px;
  height: 14px;
}

.duplicates-hint {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 20px;
  max-width: 520px;
}

.trash-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

.trash-header .duplicates-hint {
  margin-bottom: 16px;
}

.trash-header .btn-text,
.trash-row .btn-text {
  white-space: nowrap;
}

.share-list.trash-list {
  max-width: none;
  max-height: none;
  overflow: visible;
}

.trash-row {
  gap: 12px;
}

.trash-row .share-row-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.card-icon.trash-icon {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  flex-shrink: 0;
}

.duplicate-cluster {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 20px;
  margin-bottom: 16px;
  max-width: 400px;
}

.duplicate-cluster-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
}

.duplicate-cluster-favicon {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  object-fit: contain;
}

.duplicate-cluster-domain {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.duplicate-cluster-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  background: var(--border);
  padding: 3px 9px;
  border-radius: 20px;
  margin-left: auto;
}

.duplicate-row {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}

.duplicate-divider {
  width: 1px;
  height: 56px;
  background: var(--border);
  flex-shrink: 0;
}

.duplicate-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 112px;
}

.duplicate-item .card-icon {
  width: 56px;
  height: 56px;
  cursor: default;
}

.duplicate-item .card-title {
  max-width: 112px;
}

.duplicate-category {
  font-size: 11px;
  color: var(--text-dim);
  max-width: 112px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.duplicate-keep-btn {
  margin-top: 4px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  background: none;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 5px 13px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.duplicate-keep-btn:hover {
  background: var(--accent);
  color: var(--card-bg);
  border-color: var(--accent);
}

.duplicate-cluster-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.duplicate-footer-hint {
  font-size: 12px;
  color: var(--text-dim);
}

.duplicate-keep-all {
  font-size: 13px;
  padding: 4px 4px;
}

.view-gate {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 60;
}

.view-gate[hidden] {
  display: none;
}

.view-gate-card {
  width: 320px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
}

.view-gate-logo {
  height: 22px;
  width: auto;
  filter: var(--logo-filter);
  margin-bottom: 10px;
}

.view-gate-card h2 {
  font-size: 17px;
  margin: 0;
  color: var(--text);
}

.view-gate-text {
  font-size: 13px;
  color: var(--text-dim);
  margin: 0 0 8px;
}

.view-gate-label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12px;
  color: var(--text-dim);
  text-align: left;
  width: 100%;
}

.view-gate-label input {
  width: 100%;
  font-size: 14px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--search-bg);
  color: var(--text);
  outline: none;
}

.view-gate-btn {
  width: 100%;
  margin-top: 6px;
}

.view-gate-hint {
  font-size: 12px;
  color: #ff3b30;
  min-height: 14px;
}

.view-owner-note {
  font-size: 11px;
  color: var(--text-dim);
  padding: 4px 2px;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 60%;
  color: var(--text-dim);
  text-align: center;
  gap: 12px;
}

.empty-state .btn-primary {
  margin-top: 4px;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--modal-bg);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
  font-size: 13px;
  z-index: 60;
  animation: toast-fade-in 0.15s ease-out;
}

.toast[hidden] {
  display: none;
}

@keyframes toast-fade-in {
  from { opacity: 0; transform: translateX(-50%) translateY(6px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* Full-name tooltip on hover */
.name-tooltip {
  position: fixed;
  max-width: 280px;
  padding: 8px 11px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 9px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.22);
  z-index: 50;
  pointer-events: none;
  animation: name-tooltip-in 0.12s ease-out;
}

.name-tooltip[hidden] {
  display: none;
}

@keyframes name-tooltip-in {
  from { opacity: 0; transform: translateY(3px); }
  to { opacity: 1; transform: translateY(0); }
}

.name-tooltip-title {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
  word-break: break-word;
  overflow-wrap: anywhere;
}

.name-tooltip-url {
  margin-top: 2px;
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.modal-overlay[hidden] {
  display: none;
}

.modal {
  background: var(--modal-bg);
  border-radius: 14px;
  padding: 24px;
  width: 340px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.3);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal h2 {
  margin: 0;
  font-size: 16px;
}

.modal label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--text-dim);
}

.modal input {
  width: 100%;
  font-size: 14px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--search-bg);
  color: var(--text);
  outline: none;
}

.category-combobox {
  position: relative;
}

.category-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--modal-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  max-height: 160px;
  overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
  z-index: 5;
}

.category-dropdown[hidden] {
  display: none;
}

.category-dropdown-item {
  padding: 8px 10px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}

.category-dropdown-item:hover,
.category-dropdown-item.highlighted {
  background: var(--hover);
}

.category-dropdown-empty {
  padding: 8px 10px;
  font-size: 12px;
  color: var(--text-dim);
}

.modal-hint {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: -8px;
}

.icon-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--text-dim);
}

.icon-field-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.card-icon.icon-field-preview {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  flex-shrink: 0;
}

.icon-field-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

.icon-field-actions .btn-text {
  font-size: 13px;
  padding: 3px 6px;
  margin-left: -6px;
}

.icon-field-actions .btn-text[hidden] {
  display: none;
}

.organize-modal {
  width: 380px;
}

.share-modal {
  width: 440px;
}

.share-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}

.share-tab {
  position: relative;
  background: none;
  border: none;
  padding: 8px 10px;
  font-size: 13px;
  color: var(--text-dim);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.share-tab:hover {
  color: var(--text);
}

.share-tab.active {
  color: var(--text);
  font-weight: 600;
  border-bottom-color: var(--accent);
}

.share-tab-badge {
  display: inline-block;
  min-width: 15px;
  height: 15px;
  padding: 0 4px;
  margin-left: 5px;
  border-radius: 8px;
  background: #ff3b30;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 15px;
  text-align: center;
}

.share-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.share-panel[hidden] {
  display: none;
}

.share-mode-options {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.share-mode-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 6px;
  border-radius: 8px;
  cursor: pointer;
}

.share-mode-option:hover {
  background: var(--hover);
}

.share-mode-option input {
  margin-top: 3px;
  accent-color: var(--accent);
}

.share-mode-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.share-mode-desc {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 1px;
}

.share-link-row {
  display: flex;
  gap: 6px;
}

.share-link-row input {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  padding: 7px 9px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--search-bg);
  color: var(--text-dim);
}

.share-publish-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 4px;
  border-top: 1px solid var(--border);
}

.share-publish-status {
  font-size: 12px;
  color: var(--text-dim);
}

.share-publish-hint {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: -8px;
}

.share-invite-row {
  display: flex;
  gap: 6px;
}

.share-invite-row input {
  min-width: 0;
  font-size: 13px;
  padding: 7px 9px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--search-bg);
  color: var(--text);
  outline: none;
}

.share-invite-row input[placeholder="Name"] {
  flex: 1;
}

.share-invite-row input[placeholder="Email"] {
  flex: 1.4;
}

.share-invite-row select,
.share-row select {
  font-size: 12px;
  padding: 6px 7px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--search-bg);
  color: var(--text);
}

.share-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 260px;
  overflow-y: auto;
}

.share-empty {
  font-size: 13px;
  color: var(--text-dim);
  padding: 10px 2px;
}

.share-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 2px;
  border-bottom: 1px solid var(--border);
}

.share-row:last-child {
  border-bottom: none;
}

.share-row-info {
  flex: 1;
  min-width: 0;
}

.share-row-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.share-row-sub {
  font-size: 11px;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.share-row-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.share-row-icon-btn {
  border: none;
  background: transparent;
  color: var(--text-dim);
  width: 24px;
  height: 24px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.share-row-icon-btn:hover {
  background: var(--border);
  color: #ff3b30;
}

.organize-intro {
  font-size: 13px;
  color: var(--text-dim);
}

.organize-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 260px;
  overflow-y: auto;
}

.organize-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 2px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.organize-row:last-child {
  border-bottom: none;
}

.organize-row-name {
  font-weight: 600;
  color: var(--text);
}

.organize-row-count {
  color: var(--text-dim);
  font-size: 12px;
}

.modal-hint[hidden] {
  display: none;
}

.modal-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
}

.modal-actions-right {
  display: flex;
  gap: 10px;
}

.btn-text {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 14px;
  cursor: pointer;
  padding: 6px 4px;
}

.btn-text.danger {
  color: #ff3b30;
}

.btn-primary {
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: 8px;
  padding: 7px 16px;
  font-size: 14px;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.btn-primary:hover {
  opacity: 0.82;
}

.btn-primary:active {
  opacity: 0.68;
}

.btn-text:hover {
  background: var(--hover);
  border-radius: 6px;
}

/* Smaller screens */
@media (max-width: 820px) {
  .sidebar {
    width: 190px;
    min-width: 190px;
    padding: 20px 14px;
  }

  .topbar {
    padding: 12px 16px;
  }

  .content {
    padding: 20px 18px 40px;
  }
}

@media (max-width: 600px) {
  .app {
    flex-direction: column;
    height: auto;
    min-height: 100vh;
  }

  .sidebar {
    width: auto;
    min-width: 0;
    padding: 16px;
    border-bottom: 1px solid var(--border);
  }

  .sidebar-header-row {
    padding-bottom: 12px;
  }

  .category-list {
    max-height: 32vh;
    overflow-y: auto;
  }

  .sidebar-footer {
    padding-top: 10px;
  }

  .main {
    min-height: 70vh;
  }

  .grid {
    --card-w: calc(var(--pin-size) * 1.3);
    gap: calc(var(--pin-size) * 0.25);
  }

  .size-control .size-control-label {
    display: none;
  }

  .size-control .size-slider {
    width: 80px;
  }

  .select-bar {
    flex-wrap: wrap;
    padding: 10px 16px;
  }
}

/* Categories and subcategories (Phase 3) */
.category-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin-left: -2px;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  transition: transform 0.15s ease;
}

.category-chevron svg {
  width: 11px;
  height: 11px;
}

.category-chevron.open {
  transform: rotate(90deg);
}

.category-chevron:hover {
  color: var(--text);
  background: var(--hover);
}

.category-more {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 24px;
  height: 22px;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease;
}

.category-more svg {
  width: 15px;
  height: 15px;
}

.category-item:hover .category-more,
.category-item.menu-open .category-more {
  opacity: 1;
  pointer-events: auto;
}

.category-more:hover,
.category-item.menu-open .category-more {
  background: var(--hover);
  color: var(--text);
}

.subcategory-item {
  padding-left: 16px;
  font-size: 13px;
}

.subcategory-new-input {
  width: calc(100% - 16px);
  margin-left: 16px;
}

.category-item.drop-above {
  box-shadow: inset 0 2px 0 var(--accent);
}

.category-item.drop-below {
  box-shadow: inset 0 -2px 0 var(--accent);
}

.category-item[draggable="true"]:active {
  cursor: grabbing;
}

.context-menu {
  position: fixed;
  z-index: 200;
  min-width: 170px;
  padding: 5px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--modal-bg);
  box-shadow: 0 10px 30px rgba(0,0,0,0.22);
  display: flex;
  flex-direction: column;
}

.context-menu-item {
  text-align: left;
  font-size: 13px;
  padding: 7px 10px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.context-menu-item:hover {
  background: var(--hover);
}

.context-menu-item.danger {
  color: #ff3b30;
}

.section-subtitle {
  font-size: 13px;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text);
  margin: 56px 0 20px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.view-heading {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text);
  margin: 4px 0 32px;
}

/* Breadcrumb: Category  ›  Subcategory – wide gap, the subcategory lighter. */
.view-heading-sep {
  margin: 0 0.75em;
  font-weight: 400;
  color: var(--text-dim);
}

.view-heading-sub {
  font-weight: 400;
}

.view-heading-parent {
  font: inherit;
  color: var(--text-dim);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

.view-heading-parent:hover {
  color: var(--text);
}

/* 2.1 look (icon style B switched off): 2.0's white tile with a soft shadow.
   ":root body" outranks the style B background rules for both themes. */
:root body.icons-classic .card-icon {
  border-radius: calc(var(--pin-size, 64px) * 0.22);
  background: var(--card-bg);
  box-shadow: var(--icon-shadow);
}

:root body.icons-classic .card.selectable.selected .card-icon {
  box-shadow: 0 0 0 2px var(--accent);
}

body.icons-classic .card-icon::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(165deg, rgba(255,255,255,0.35) 0%, rgba(255,255,255,0.08) 22%, rgba(255,255,255,0) 45%);
  pointer-events: none;
}

body.icons-classic .card-icon img,
body.icons-classic .card-icon .no-icon {
  width: 60%;
  height: 60%;
}

body.icons-classic .card-icon img {
  border-radius: 8px;
}

.modal label[hidden],
.icon-field[hidden] {
  display: none;
}

/* SIZE slider in the top bar: sets --pin (icon size) for the website grid.
   A soft pill like the other top-bar controls: small tile · track · big tile. */
.size-control {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  -webkit-app-region: no-drag;
}

/* Top bar order: search on the left; view settings (size, light/dark);
   a divider; then the actions, with + (add a website) last. */
.topbar #selectBtn {
  margin-left: 0;
}

.topbar-divider {
  width: 1px;
  height: 20px;
  margin: 0 2px;
  background: var(--border);
  flex-shrink: 0;
}

.size-control-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--text-dim);
  user-select: none;
  -webkit-user-select: none;
}

.size-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 4px;
  color: var(--text-dim);
}

.size-pill-icon {
  flex-shrink: 0;
  border-radius: 2px;
  border: 1.5px solid currentColor;
  opacity: 0.8;
}

.size-pill-icon.small { width: 7px; height: 7px; border-radius: 2px; }
.size-pill-icon.big { width: 12px; height: 12px; border-radius: 3px; }

.size-slider {
  --fill: 25%;
  -webkit-appearance: none;
  appearance: none;
  width: 110px;
  height: 16px;
  margin: 0;
  background: transparent;
  cursor: pointer;
  outline: none;
}

.size-slider::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(to right, var(--text) var(--fill), var(--size-track) var(--fill));
}

.size-slider::-moz-range-track {
  height: 4px;
  border-radius: 2px;
  background: var(--size-track);
}

.size-slider::-moz-range-progress {
  height: 4px;
  border-radius: 2px;
  background: var(--text);
}

.size-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  margin-top: -6px;
  border-radius: 50%;
  background: #ffffff;
  border: 0.5px solid rgba(0,0,0,0.12);
  box-shadow: 0 1px 3px rgba(0,0,0,0.3), 0 0 0 0 transparent;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.size-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffffff;
  border: 0.5px solid rgba(0,0,0,0.12);
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.size-slider:hover::-webkit-slider-thumb {
  transform: scale(1.12);
}

.size-slider:active::-webkit-slider-thumb {
  transform: scale(1.2);
  box-shadow: 0 1px 4px rgba(0,0,0,0.35), 0 0 0 4px var(--size-halo);
}

.size-slider:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 1px 3px rgba(0,0,0,0.3), 0 0 0 3px var(--size-halo);
}

:root {
  --size-track: rgba(0,0,0,0.12);
  --size-halo: rgba(0,0,0,0.10);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --size-track: rgba(255,255,255,0.18);
    --size-halo: rgba(255,255,255,0.14);
  }
}

:root[data-theme="dark"] {
  --size-track: rgba(255,255,255,0.18);
  --size-halo: rgba(255,255,255,0.14);
}

/* Narrow windows: keep the whole top bar visible. */
@media (max-width: 820px) {
  .topbar {
    gap: 12px;
  }

  .size-control .size-control-label {
    display: none;
  }

  .size-control .size-slider {
    width: 80px;
  }
}

/* ---- Narrow windows (≤ 700px): burger menu ----
   Top bar: ☰ · SIZE · light/dark on the left; Search · Select · + on the right.
   The sidebar (categories, Organize by Topic, Import/Export) becomes a
   full-width menu that slides in over the page. */
.menu-btn,
.menu-close-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: var(--search-bg);
  color: var(--text);
  cursor: pointer;
  flex-shrink: 0;
  -webkit-app-region: no-drag;
}

.menu-btn:hover,
.menu-close-btn:hover {
  background: var(--hover);
}

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

@media (max-width: 700px) {
  .app {
    flex-direction: row;
    height: 100vh;
    height: 100dvh;
    min-height: 0;
  }

  .menu-btn,
  .menu-close-btn {
    display: inline-flex;
  }

  .sidebar {
    position: fixed;
    inset: 0;
    z-index: 60;
    width: auto;
    min-width: 0;
    padding: 20px 20px calc(20px + env(safe-area-inset-bottom));
    border-bottom: none;
    background: var(--bg);
    overflow-y: auto;
    transform: translateX(-100%);
    visibility: hidden;
    transition: transform 0.25s ease, visibility 0s linear 0.25s;
  }

  body.menu-open .sidebar {
    transform: none;
    visibility: visible;
    transition: transform 0.25s ease;
  }

  body.menu-open {
    overflow: hidden;
  }

  .sidebar-header-row {
    padding-bottom: 20px;
  }

  .category-area {
    flex: 1 0 auto;
    min-height: auto;
  }

  .category-list {
    max-height: none;
    overflow: visible;
    flex: 1;
  }

  .category-item,
  .subcategory-item {
    padding-top: 8px;
    padding-bottom: 8px;
    font-size: 16px;
  }

  .sidebar-footer {
    padding-top: 16px;
    margin-top: 16px;
    gap: 6px;
  }

  .sidebar-footer .sidebar-btn,
  .sidebar-footer .sidebar-btn-outline {
    padding-top: 12px;
    padding-bottom: 12px;
    font-size: 15px;
  }

  .main {
    min-height: 0;
  }

  .topbar {
    position: relative;
    gap: 10px;
    padding: 12px 16px;
  }

  /* Left group: ☰, SIZE, light/dark. Right group: Search, Select, +. */
  .menu-btn { order: 1; }
  .size-control { order: 2; margin-left: 0; }
  .theme-switch { order: 3; }
  .search-wrap { order: 4; margin-left: auto; }
  .topbar #selectBtn { order: 5; }
  .add-btn { order: 6; }
  .topbar-divider { display: none; }

  .size-control .size-control-label { display: none; }
  .size-control .size-slider { width: 72px; }
  .size-pill { gap: 6px; padding: 0; }

  /* An open search box covers the top bar instead of pushing things off. */
  .search-wrap.expanded {
    position: absolute;
    left: 16px;
    right: 16px;
    width: auto;
    z-index: 5;
  }

  .content {
    padding: 16px 16px 40px;
  }
}

@media (max-width: 420px) {
  .size-control .size-slider { width: 56px; }
  .size-pill-icon { display: none; } /* room for the Tiles/List switch */
  .topbar { gap: 8px; padding: 10px 12px; }
}


/* A subcategory right under the page heading doesn't need the extra air. */
.view-heading + .section-subtitle {
  margin-top: 8px;
  padding-top: 0;
  border-top: none;
}

/* Dropping a category onto the middle of another one makes it a subcategory. */
.category-item.drop-into {
  background: var(--selected);
  outline: 1px dashed var(--accent);
  outline-offset: -1px;
  border-radius: 8px;
}

/* "All" sits apart from the categories: a solid black pill (white in dark
   mode), like the + button, with its count softly dimmed. */
.category-item.category-item-all {
  margin: 0 0 14px;
  padding: 9px 12px;
  border-radius: 10px;
  background: var(--accent);
  color: var(--bg);
  font-weight: 600;
  transition: opacity 0.15s ease;
}

.category-item.category-item-all:hover {
  color: var(--bg);
  opacity: 0.88;
}

.category-item.category-item-all .count,
.category-item.category-item-all.active .count {
  color: var(--bg);
  opacity: 0.6;
  font-weight: 500;
}

.category-item.category-item-all .category-more {
  color: var(--bg);
}

/* Owner credit in the bottom-right corner of the page, above the content. */
.page-credit {
  position: absolute;
  right: 20px;
  /* Same baseline as the last sidebar button (sidebar 28px + button 8px padding). */
  bottom: 34px;
  z-index: 3;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--bg);
  font-size: 11px;
  letter-spacing: 0.01em;
  color: var(--text-dim);
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
}

/* "All" (top) and Hidden · Trash · Duplicates (bottom) sit outside the
   scrolling list, so they never move and the scrollbar runs only between them. */
.category-pinned-bottom {
  padding-bottom: 2px;
}

/* Hidden · Trash · Duplicates as one row of icons with counts. Each is a
   wide, easy drop target; the open one gets a black underline. */
.category-icon-row {
  display: flex;
  gap: 4px;
}

.category-item.category-item-compact {
  flex: 1;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 6px;
  position: relative;
  border-radius: 8px;
}

.category-item.category-item-compact:hover {
  background: var(--hover);
}

.category-item.category-item-compact .category-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.category-item.category-item-compact .category-icon svg {
  width: 17px;
  height: 17px;
}

.category-item.category-item-compact .count {
  font-size: 12px;
}

.category-item.category-item-compact .count[hidden] {
  display: none;
}

.category-item.category-item-compact.active {
  font-weight: 600;
}

.category-item.category-item-compact.active::after {
  content: "";
  position: absolute;
  left: 22%;
  right: 22%;
  bottom: 2px;
  height: 2px;
  border-radius: 1px;
  background: var(--accent);
}

/* In the ☰ menu (narrow windows/phones) there is room: show the names again. */
@media (max-width: 700px) {
  .category-icon-row {
    flex-direction: column;
    gap: 0;
  }

  .category-item.category-item-compact {
    justify-content: flex-start;
    padding: 8px 0;
    font-size: 16px;
  }

  .category-item.category-item-compact .category-label {
    position: static;
    width: auto;
    height: auto;
    clip: auto;
    flex: 1;
  }

  .category-item.category-item-compact.active::after {
    left: 0;
    right: auto;
    width: 24px;
    bottom: 0;
  }
}


/* ---- Tiles / List switch and list view (task 3.5) ---- */
.view-switch {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: 0;
  padding: 3px;
  border-radius: 10px;
  background: var(--search-bg);
  -webkit-app-region: no-drag;
}

/* Sits right next to the light/dark switch; when SIZE hides (List),
   the switch takes over pushing the group to the right. */
body.view-list .view-switch { margin-left: auto; }

.view-switch-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 26px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
}

.view-switch-btn:hover { color: var(--text); }

.view-switch-btn[aria-pressed="true"] {
  background: var(--card-bg);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

/* SIZE only changes tiles, so it steps aside in list view. */
body.view-list .size-control { display: none; }

body.view-list .grid {
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Rows are compact, so sections need less air than the tile grid. */
body.view-list .section-subtitle { margin: 36px 0 8px; padding-top: 18px; }
body.view-list .view-heading + .section-subtitle { margin-top: 8px; }

.card.card-row {
  width: auto;
  flex-direction: row;
  align-items: center;
  gap: 14px;
  min-height: 52px;
  padding: 8px 12px;
  border-radius: 10px;
}

.card.card-row + .card.card-row { box-shadow: 0 -1px 0 var(--border); }
.card.card-row:hover,
.card.card-row:hover + .card.card-row { box-shadow: none; }
.card.card-row:hover { background: var(--search-bg); }
.card.card-row.selected { background: var(--search-bg); }

.card-row .card-icon {
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 9px;
}

.card.card-row:hover .card-icon { transform: none; }

.card-row .card-title {
  flex: 0 0 28%;
  min-width: 0;
  max-width: none;
  text-align: left;
  font-size: 14px;
  font-weight: 500;
}

.card-url {
  flex: 1 1 0;
  padding-left: 24px;
  min-width: 0;
  font-size: 13px;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-cat {
  flex: 0 0 24%;
  padding-left: 40px;
  text-align: right;
  font-size: 12px;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* The buttons float over the end of the row, so the category can sit at
   the right edge; only a favourite's star keeps its own column. */
.card.card-row { padding-right: 52px; }

.card-actions {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  gap: 8px;
  padding-left: 16px;
  border-radius: 10px;
}

.card.card-row:hover .card-actions { background: var(--search-bg); }

.card-row .card-action {
  position: static;
  display: flex;
  visibility: hidden;
}

.card.card-row:hover .card-action,
.card-row .card-action.favorited { visibility: visible; }

.card-row .card-checkbox {
  position: static;
  flex: none;
}

.card.card-row.drop-before::before,
.card.card-row.drop-after::after {
  left: 12px;
  right: 12px;
  width: auto;
  height: 3px;
}

.card.card-row.drop-before::before { top: -2px; }
.card.card-row.drop-after::after { top: auto; bottom: -2px; }

@media (max-width: 700px) {
  /* Narrow: the switch joins the left group (after ☰); rows show icon,
     name and buttons only. */
  .view-switch,
  body.view-list .view-switch { order: 2; margin-left: 0; }
  .view-switch-btn { width: 28px; }
  .card-cat,
  .card-url { display: none; }
  .card-row .card-title { flex: 1 1 auto; }
  .card-actions { gap: 4px; }
}

/* ---- Scrollbars: thin, rounded, quiet (Bea, Nov 26) ----
   A slim pill that sits away from the edge, darker only on hover. */
/* Safari (and new Chrome/Firefox) use these standard settings and draw
   their own system scrollbar – thin and in our grey. Older browsers that
   don't know them fall back to the rounded pill below. */
* { scrollbar-width: thin; scrollbar-color: var(--scroll-thumb) transparent; }

:root { --scroll-thumb: rgba(0, 0, 0, 0.18); --scroll-thumb-hover: rgba(0, 0, 0, 0.36); }
:root[data-theme="dark"] { --scroll-thumb: rgba(255, 255, 255, 0.18); --scroll-thumb-hover: rgba(255, 255, 255, 0.36); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --scroll-thumb: rgba(255, 255, 255, 0.18); --scroll-thumb-hover: rgba(255, 255, 255, 0.36); }
}

::-webkit-scrollbar { width: 10px; height: 10px; }
/* Shorter than the area it scrolls: a gap at the top and bottom. */
::-webkit-scrollbar-track { background: transparent; margin: 12px 0; }
::-webkit-scrollbar-corner { background: transparent; }
::-webkit-scrollbar-thumb {
  min-height: 40px;
  border-radius: 10px;
  border: 3px solid transparent;
  background: var(--scroll-thumb);
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background-color: var(--scroll-thumb-hover); }
::-webkit-scrollbar-button { display: none; height: 0; }

/* ---- Online data (tasks 4.2 / 4.3) ---- */
body.cloud-loading .content > * { visibility: hidden; }
body.cloud-loading .content::before {
  content: "Loading your websites…";
  display: block;
  margin-top: 18vh;
  text-align: center;
  font-size: 14px;
  color: var(--text-dim);
}

.cloud-move {
  position: fixed;
  left: 50%;
  top: 18vh;
  transform: translateX(-50%);
  z-index: 70;
  width: min(440px, calc(100vw - 32px));
  padding: 22px;
  border-radius: 16px;
  background: var(--modal-bg);
  border: 1px solid var(--border);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cloud-move-title { margin: 0; font-size: 17px; font-weight: 700; color: var(--text); }
.cloud-move-text { margin: 0; font-size: 14px; line-height: 1.45; color: var(--text-dim); }
.cloud-move-text strong { color: var(--text); }
.cloud-move-status { margin: 0; font-size: 14px; font-weight: 600; color: var(--text); }
.cloud-move-status[hidden] { display: none; }
.cloud-move-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }

.cloud-move-later,
.cloud-move-go {
  padding: 9px 14px;
  border: none;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.cloud-move-later { background: var(--search-bg); color: var(--text); }
.cloud-move-go { background: var(--accent); color: var(--bg); }
.cloud-move-later:disabled, .cloud-move-go:disabled { opacity: 0.5; cursor: default; }

/* ---- Admin panel (task 4.5) ---- */
.admin-btn { display: flex; align-items: center; gap: 8px; }

.admin-badge {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--accent);
  color: var(--bg);
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}

.admin-badge[hidden] { display: none; }

.admin-sheet {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 6vh 16px 16px;
  background: rgba(0, 0, 0, 0.35);
}

.admin-sheet[hidden] { display: none; }

.admin-card {
  width: min(780px, 100%);
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  background: var(--modal-bg);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

.admin-head {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}

.admin-title { margin: 0; font-size: 17px; font-weight: 700; color: var(--text); }

.admin-tabs {
  display: flex;
  gap: 2px;
  padding: 3px;
  border-radius: 10px;
  background: var(--search-bg);
}

.admin-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.admin-tab[aria-selected="true"] {
  background: var(--card-bg);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

.admin-count:empty { display: none; }
.admin-count {
  min-width: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--bg);
  font-size: 10px;
  line-height: 16px;
  text-align: center;
}

.admin-close {
  margin-left: auto;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 50%;
  background: var(--search-bg);
  color: var(--text);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.admin-body { overflow-y: auto; padding: 8px 20px 20px; }

.admin-empty { margin: 28px 0; text-align: center; font-size: 14px; color: var(--text-dim); }

.admin-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.admin-row:last-child { border-bottom: none; }
.admin-row.is-done { opacity: 0.55; }

.admin-who { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.admin-name { font-size: 14px; font-weight: 600; color: var(--text); }
.admin-message { font-size: 14px; line-height: 1.4; color: var(--text); white-space: pre-wrap; overflow-wrap: anywhere; }
.admin-sub { font-size: 12px; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; }
.admin-note { font-size: 13px; color: var(--text); font-style: italic; }
.admin-meta { flex: none; font-size: 12px; color: var(--text-dim); }
.admin-seat-fixed { flex: none; width: 130px; font-size: 13px; font-weight: 600; color: var(--text); }

.admin-select {
  flex: none;
  width: 130px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--search-bg);
  color: var(--text);
  font-size: 13px;
}

.admin-actions { flex: none; display: flex; gap: 6px; }

.admin-primary,
.admin-secondary,
.admin-danger {
  padding: 7px 12px;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.admin-primary { background: var(--accent); color: var(--bg); }
.admin-secondary { background: var(--search-bg); color: var(--text); }
.admin-danger { background: transparent; color: #ff3b30; }
.admin-primary:disabled, .admin-secondary:disabled, .admin-danger:disabled { opacity: 0.5; }

@media (max-width: 700px) {
  .admin-sheet { padding: 0; }
  .admin-card { max-height: 100vh; height: 100%; border-radius: 0; }
  .admin-head { flex-wrap: wrap; gap: 12px; }
  .admin-tabs { order: 3; width: 100%; }
  .admin-tab { flex: 1; justify-content: center; }
  .admin-row { flex-wrap: wrap; }
  .admin-who { flex-basis: 100%; }
}

/* ---- Report a problem bubble (task 4.8) ---- */
/* The credit steps left so it doesn't sit under the bubble. */
body:has(.feedback) .page-credit { right: 76px; }

.feedback-bubble {
  position: fixed;
  right: 20px;
  bottom: 22px;
  z-index: 45;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: var(--bg);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
  cursor: pointer;
  transition: transform 0.15s ease;
}

.feedback-bubble:hover { transform: scale(1.06); }
.feedback-bubble[aria-expanded="true"] { transform: none; }

.online-locked .feedback { display: none; }

.feedback-panel {
  position: fixed;
  right: 20px;
  bottom: 78px;
  z-index: 46;
  width: min(320px, calc(100vw - 32px));
  padding: 18px;
  border-radius: 14px;
  background: var(--modal-bg);
  border: 1px solid var(--border);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.22);
}

.feedback-panel[hidden],
.feedback-step[hidden],
.feedback-error[hidden] { display: none; }

.feedback-step {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.feedback-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.feedback-text,
.feedback-note {
  margin: 0;
  font-size: 13px;
  line-height: 1.4;
  color: var(--text-dim);
}

.feedback-note { font-size: 11px; }

.feedback-panel textarea {
  width: 100%;
  resize: vertical;
  min-height: 96px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--search-bg);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  line-height: 1.4;
  outline: none;
}

.feedback-panel textarea:focus { border-color: var(--text-dim); }

.feedback-error {
  margin: 0;
  font-size: 12px;
  color: #ff3b30;
}

.feedback-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.feedback-cancel,
.feedback-send {
  padding: 8px 14px;
  border-radius: 9px;
  border: none;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.feedback-cancel { background: var(--search-bg); color: var(--text); }
.feedback-send { background: var(--accent); color: var(--bg); }
.feedback-send:disabled { opacity: 0.5; cursor: default; }

@media (max-width: 700px) {
  .feedback-bubble { right: 16px; bottom: 16px; }
  .feedback-panel { right: 16px; bottom: 70px; }
}

/* ---- Online login gate (task 4.4) ---- */
.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 95; /* above the app, below the intro (100) */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: var(--bg);
  overflow-y: auto;
}

.auth-gate[hidden] { display: none; }

.auth-card {
  width: 100%;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.auth-logo {
  height: 34px;
  width: auto;
  align-self: center;
  margin-bottom: 6px;
  filter: var(--logo-filter);
}

.auth-view {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-view[hidden] { display: none; }

.auth-title {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}

.auth-text {
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
  color: var(--text-dim);
}

.auth-text strong { color: var(--text); font-weight: 600; }

.auth-view label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--text-dim);
}

.auth-optional { opacity: 0.7; }

.auth-view input {
  width: 100%;
  font-size: 15px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--search-bg);
  color: var(--text);
  outline: none;
}

.auth-view input:focus { border-color: var(--text-dim); }

.auth-primary {
  margin-top: 4px;
  padding: 11px 14px;
  border: none;
  border-radius: 10px;
  background: var(--accent);
  color: var(--bg);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.auth-primary:disabled { opacity: 0.5; cursor: default; }

.auth-links {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.auth-link {
  padding: 0;
  border: none;
  background: none;
  font-size: 13px;
  color: var(--text-dim);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.auth-link:hover { color: var(--text); }

.auth-error,
.auth-ok {
  margin: 0;
  font-size: 13px;
  line-height: 1.4;
}

.auth-error { color: #ff3b30; }
.auth-ok { color: var(--text); }
.auth-error[hidden], .auth-ok[hidden] { display: none; }

/* ---- Intro (splash) ----
   Two screens like a poster: 1) yellow, "Close the tabs. Keep the sites." in
   huge words in the four corners around the pulsing dot; 2) black, the
   headline and the 5 steps in yellow. Slow enough to read. */
.splash {
  --intro-yellow: #ffd21f;
  --intro-black: #0b0b0b;
  cursor: pointer;
}

.intro-screen,
.intro-quick {
  position: absolute;
  inset: 0;
  display: none;
}

.splash.intro-short .intro-quick {
  display: flex;
  align-items: center;
  justify-content: center;
}

.splash.show-1 .intro-1,
.splash.show-2 .intro-2 {
  display: block;
}

.intro-1 {
  background: var(--intro-yellow);
  color: var(--intro-black);
}

.intro-2 {
  background: var(--intro-black);
  color: #fff;
}

.intro-screen .pulse-dot,
.intro-quick .pulse-dot {
  background: currentColor;
}

.intro-dot {
  position: absolute;
  top: 50%;
  left: 50%;
  margin: -7px 0 0 -7px;
}

@keyframes intro-word-in {
  from { opacity: 0; transform: translateY(0.12em); }
  to { opacity: 1; transform: none; }
}

/* Screen 1 – 6 s. Three columns shared by both rows, so the two "THE"s line up. */
.intro-grid {
  position: absolute;
  inset: 4vh 3vw;
  display: grid;
  grid-template-columns: max-content max-content 1fr;
  grid-template-rows: auto 1fr auto;
  column-gap: 3vw;
}

/* Screen 1 is the dynamic one: each word slides up out of its own mask,
   in reading order, then the whole set slides away before screen 2. */
.intro-word {
  font-family: "SF Pro Display", -apple-system, "Helvetica Neue", Arial, sans-serif;
  font-weight: 900;
  text-transform: uppercase;
  font-size: min(11vw, 22.5vh);
  line-height: 0.84;
  letter-spacing: -0.045em;
  white-space: nowrap;
  overflow: hidden;
  padding: 0.04em 0.02em 0.06em;
  align-self: start;
}

.intro-word > span {
  display: block;
  transform: translateY(var(--from, 110%)) skewY(var(--skew, 8deg));
  transform-origin: left bottom;
  animation:
    intro-mask-in 0.65s cubic-bezier(0.16, 1, 0.3, 1) forwards var(--in),
    intro-mask-out 0.38s cubic-bezier(0.7, 0, 0.84, 0) forwards var(--out, 2.1s);
}

/* Top row comes up from below, bottom row drops in from above, and they
   leave the same way they came – fast, with a little skew that settles. */
.intro-word.w-bottom > span { --from: -110%; --skew: -8deg; --to: 110%; }

@keyframes intro-mask-in {
  to { transform: translateY(0) skewY(0); }
}

@keyframes intro-mask-out {
  from { transform: translateY(0); }
  to { transform: translateY(var(--to, -110%)); }
}

.intro-word.w-drop { margin-top: 0.62em; }
.intro-word.w-bottom { grid-row: 3; align-self: end; }
.intro-word.w-end { justify-self: end; }
.w1 { --in: 0.07s; }
.w2 { --in: 0.22s; }
.w3 { --in: 0.37s; }
.w4 { --in: 0.68s; }
.w5 { --in: 0.83s; }
.w6 { --in: 0.98s; }
.w1 > span, .w4 > span { --out: 2.1s; }
.w2 > span, .w5 > span { --out: 2.15s; }
.w3 > span, .w6 > span { --out: 2.2s; }

.intro-1 .intro-dot {
  animation:
    loading-ui-pulse-dot 0.8s ease-in-out infinite,
    intro-dot-grow 0.38s cubic-bezier(0.7, 0, 0.84, 0) forwards 2.2s;
}

@keyframes intro-dot-grow {
  to { transform: scale(2.2); }
}

/* Screen 2 is about the copy: calm fades in reading order. The newest line
   is bright white, the ones already read step back to grey, so the eye
   always knows where to look next. */
.splash.show-2 .intro-2 { display: block; animation: intro-fade 0.6s ease both; }

@keyframes intro-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.intro-step,
.intro-hdl,
.intro-logo {
  position: absolute;
  font-family: "SF Pro Display", -apple-system, "Helvetica Neue", Arial, sans-serif;
}

.intro-step,
.intro-hdl {
  opacity: 0;
  animation:
    intro-copy-in 0.7s cubic-bezier(0.22, 1, 0.36, 1) forwards var(--in),
    intro-copy-dim 1s ease forwards var(--out, 99s);
}

@keyframes intro-copy-in {
  from { opacity: 0; transform: translateY(10px); filter: blur(6px); }
  to { opacity: 1; transform: none; filter: blur(0); }
}

@keyframes intro-copy-dim {
  from { opacity: 1; }
  to { opacity: 0.38; }
}

/* Three columns (3vw · 36vw · 69vw, each 28vw wide). Steps 1–3 sit on top,
   step 4 under step 2, and the arrow + logo fill the third column on the
   same bottom line as step 4. */
.intro-step {
  font-size: clamp(17px, 2.3vw, 34px);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.015em;
  white-space: nowrap;
}

/* Each step appears and disappears before the next one comes. */
.intro-step {
  /* Timing follows reading research: adults read ~240 words/min silently
     (Brysbaert 2019), but text that appears on screen is paced like
     subtitles – ~170 words/min, about 0.35 s per word – plus ~0.5 s for the
     eye to find it. Option A screen 2 runs a bit quicker (Bea, Nov 25):
     about 0.4 s + 0.25 s × words + fade in/out per step. */
  animation: intro-step-flash var(--d) ease forwards var(--in);
}

@keyframes intro-step-flash {
  0% { opacity: 0; transform: translateY(8px); filter: blur(4px); }
  15% { opacity: 1; transform: none; filter: blur(0); }
  86% { opacity: 1; transform: none; filter: blur(0); }
  100% { opacity: 0; transform: translateY(-6px); filter: blur(3px); }
}

.s1 { top: 4vh; left: 3vw; --in: 1.5s; --d: 2s; }
.s2 { top: 4vh; left: 36vw; --in: 3.5s; --d: 1.3s; }
.s3 { top: 4vh; left: 69vw; --in: 4.8s; --d: 1.55s; }
.s4 { bottom: 4vh; left: 36vw; --in: 6.35s; --d: 2s; }

.intro-hdl {
  left: 0;
  right: 0;
  bottom: calc(50% + 11vh);
  margin: 0 auto;
  width: max-content;
  max-width: 90vw;
  text-align: center;
  font-size: clamp(22px, 2.6vw, 38px);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
  text-transform: uppercase;
  color: var(--intro-yellow);
  --in: 0.15s;
  --out: 99s;
}

.intro-logo {
  left: 69vw;
  right: 3vw;
  bottom: 4vh;
  display: flex;
  align-items: center;
  gap: 1.6vw;
}

/* Minimal arrow: a thin line that draws itself from the left, with a small
   open head. It stretches to whatever space the logo leaves. */
.intro-arrow {
  position: relative;
  flex: 1;
  min-width: 32px;
  height: 2px;
  background: currentColor;
  transform-origin: left center;
  transform: scaleX(0);
  animation: intro-arrow-draw 0.6s cubic-bezier(0.65, 0, 0.35, 1) forwards 8.25s;
}

.intro-arrow::after {
  content: "";
  position: absolute;
  right: 0;
  top: 50%;
  width: 12px;
  height: 12px;
  border-top: 2px solid currentColor;
  border-right: 2px solid currentColor;
  transform: translate(1px, -50%) rotate(45deg);
  transform-origin: center;
}

/* The logo only fades and rises – no blur, so it stays sharp. */
@keyframes intro-logo-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

@keyframes intro-arrow-draw {
  to { transform: scaleX(1); }
}

.intro-logo-word {
  display: block;
  flex: none;
  height: min(6.5vw, 13vh);
  width: auto;
  opacity: 0;
  animation: intro-logo-in 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards 8.5s;
}

@media (max-width: 700px) {
  .intro-step { max-width: none; font-size: 20px; }
  .s1 { left: 6vw; }
  .s2 { left: 6vw; top: calc(4vh + 1.7em); }
  .s3 { left: 6vw; top: calc(4vh + 3.4em); }
  .s4 { left: 6vw; bottom: calc(4vh + 13vw + 28px); }
  .intro-logo { left: 6vw; right: 6vw; gap: 16px; }
  .intro-logo-word { height: 13vw; }
}

/* Option A keeps the steps on the three-column grid; the row wrapper
   does nothing there. */
.intro-steps-row { display: contents; }

/* ---- Intro option C (?intro=c): screen 1 and timing as A; on screen 2
   the steps run along the top and stay (3 and 4 on the right), the
   headline is split over two lines at the bottom and builds up part by
   part, arrow + PINS logo in the corner, no dot. */
/* Steps appear one by one and stay; smaller type so 1 and 2 fit side by
   side. Everything on the right (3, 4, logo) shares one right edge (3vw). */
.splash.intro-c .intro-step {
  font-size: clamp(14px, 1.7vw, 26px);
  animation: intro-copy-in 0.7s cubic-bezier(0.22, 1, 0.36, 1) forwards var(--in);
}
.splash.intro-c .s2 { left: 34vw; }
.splash.intro-c .s3 { left: auto; right: 3vw; text-align: right; }
.splash.intro-c .s4 { top: calc(4vh + 1.6em); bottom: auto; left: auto; right: 3vw; text-align: right; }
.splash.intro-c .intro-2 .intro-dot { display: none; }

.splash.intro-c .intro-hdl {
  left: 21vw;
  right: 37vw;
  bottom: 4vh;
  animation: none;
  opacity: 1;
  width: auto;
  max-width: none;
  margin: 0;
  display: grid;
  grid-template-columns: auto auto;
  justify-content: space-between;
  row-gap: 0.12em;
  text-align: left;
  font-size: clamp(22px, 3.1vw, 46px);
  line-height: 1;
}

/* The headline builds up part by part. */
.splash.intro-c .intro-hdl > span {
  opacity: 0;
  animation: intro-copy-in 0.7s cubic-bezier(0.22, 1, 0.36, 1) forwards var(--in);
}
.splash.intro-c .hdl-1 { --in: 0.15s; }
.splash.intro-c .hdl-2 { text-align: right; --in: 0.5s; }
.splash.intro-c .hdl-3 { grid-column: 2; text-align: right; --in: 0.85s; }

.splash.intro-c .intro-logo {
  left: auto;
  right: 3vw;
  bottom: 4vh;
  gap: 1.2vw;
}

.splash.intro-c .intro-arrow {
  flex: none;
  width: min(3.75vw, 6.75vh);
}

.splash.intro-c .intro-logo-word { height: min(7.5vw, 13.5vh); }

@media (max-width: 700px) {
  .splash.intro-c .s1,
  .splash.intro-c .s2,
  .splash.intro-c .s3,
  .splash.intro-c .s4 { top: 4vh; bottom: auto; left: 6vw; right: auto; text-align: left; font-size: 17px; }
  .splash.intro-c .s2 { top: calc(4vh + 1.6em); }
  .splash.intro-c .s3 { top: calc(4vh + 3.2em); }
  .splash.intro-c .s4 { top: calc(4vh + 4.8em); }
  .splash.intro-c .intro-hdl { left: 6vw; right: 6vw; bottom: calc(4vh + 13vw); font-size: 22px; }
  .splash.intro-c .intro-logo { right: 6vw; gap: 14px; }
  .splash.intro-c .intro-arrow { width: 24px; }
  .splash.intro-c .intro-logo-word { height: 8.25vw; }
}

/* ---- Intro option B (?intro=b): everything on one yellow screen ----
   Big words (same mask reveal as screen 1), then the headline, then the
   four steps appear one by one under the words and stay, then the arrow + PINS logo. */
.splash.show-b .intro-b { display: block; }

.intro-b {
  --big: min(11vw, 20vh);
  background: var(--intro-yellow);
  color: var(--intro-black);
}

.ib-words {
  position: absolute;
  top: 3vh;
  left: 3vw;
  right: 1.5vw;
  height: calc(var(--big) * 2.6);
  font-size: var(--big);
}

.ib-words .intro-word {
  font-size: 1em;
  display: inline-block;
}

.ib-close { position: absolute; left: 0; top: 0; }
.ib-row { position: absolute; white-space: nowrap; }
.ib-row2 { left: 34vw; top: 0.7em; }
.ib-row3 { left: 12vw; top: 1.6em; }
.ib-sites { position: absolute; right: 0; top: 1.6em; }

.intro-b .intro-word > span {
  animation: intro-mask-in 0.65s cubic-bezier(0.16, 1, 0.3, 1) forwards var(--in);
}
/* Reading pace (see .intro-step): one word every ~0.35 s. */
.ib-close { --in: 0.1s; }
.ib2 { --in: 0.45s; }
.ib3 { --in: 0.8s; }
.ib4 { --in: 1.45s; }
.ib5 { --in: 1.8s; }
.ib6 { --in: 2.15s; }

.ib-dot {
  position: absolute;
  top: 4.5vh;
  right: 3vw;
  transform: scale(1.6);
}

.ib-step {
  position: absolute;
  top: calc(3vh + var(--big) * 2.75);
  font-family: "SF Pro Display", -apple-system, "Helvetica Neue", Arial, sans-serif;
  font-size: clamp(14px, 1.6vw, 24px);
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  animation: intro-copy-in 0.7s cubic-bezier(0.22, 1, 0.36, 1) forwards var(--in);
}

.ib-s1 { left: 19vw; --in: 5.3s; }
.ib-s2 { left: 41.5vw; --in: 7.55s; }
.ib-s3 { left: 50.5vw; --in: 8.75s; }
.ib-s4 { left: 32.5vw; top: calc(3vh + var(--big) * 2.75 + 2em); --in: 10.3s; }

.ib-hdl {
  position: absolute;
  left: 22vw;
  right: 37vw;
  bottom: 3vh;
  display: grid;
  grid-template-columns: auto auto;
  justify-content: space-between;
  row-gap: 0.12em;
  font-family: "SF Pro Display", -apple-system, "Helvetica Neue", Arial, sans-serif;
  font-size: clamp(20px, 3.1vw, 46px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.02em;
  text-transform: uppercase;
}

.ib-hdl > span {
  opacity: 0;
  animation: intro-copy-in 0.7s cubic-bezier(0.22, 1, 0.36, 1) forwards var(--in);
}
.ib-h1 { --in: 3.1s; }
.ib-h2 { text-align: right; --in: 3.6s; }
.ib-h3 { grid-column: 2; text-align: right; --in: 4.1s; }

.ib-logo {
  position: absolute;
  right: 1.5vw;
  bottom: 2.5vh;
  display: flex;
  align-items: center;
  gap: 1.4vw;
}

.ib-logo .intro-arrow {
  flex: none;
  width: min(4vw, 7.2vh);
  animation-delay: 12.5s;
}

.ib-logo .intro-logo-word {
  height: min(8vw, 14.4vh);
  animation-delay: 12.75s;
}

@media (max-width: 700px) {
  .intro-b { --big: 15vw; }
  .ib-row2 { left: 16vw; top: 0.88em; }
  .ib-row3 { left: 0; top: 1.76em; }
  .ib-sites { top: 2.64em; }
  .ib-step, .ib-s4 { left: 6vw; top: calc(3vh + var(--big) * 4.1); font-size: 17px; }
  .ib-s2 { top: calc(3vh + var(--big) * 4.1 + 1.5em); }
  .ib-s3 { top: calc(3vh + var(--big) * 4.1 + 3em); }
  .ib-s4 { top: calc(3vh + var(--big) * 4.1 + 4.5em); }
  .ib-hdl { left: 6vw; right: 6vw; bottom: calc(4vh + 13vw); font-size: 22px; }
  .ib-logo { right: 6vw; bottom: 2.5vh; gap: 14px; }
  .ib-logo .intro-arrow { width: 26px; }
  .ib-logo .intro-logo-word { height: 8.8vw; }
}

.splash.splash-hidden {
  transition: opacity 0.5s ease;
}

@media (prefers-reduced-motion: reduce) {
  .intro-word > span,
  .intro-b .intro-word > span,
  .ib-step,
  .ib-hdl > span,
  .intro-step,
  .intro-hdl,
  .intro-arrow,
  .intro-logo-word,
  .intro-1 .intro-dot {
    animation: none;
    opacity: 1;
    transform: none;
  }
}
