/* ═══════════════════════════════════════════════════════════════
    HIG Liquid Glass New Tab — Master Stylesheet
   Crafted with precision according to Apple Human Interface Guidelines
   ═══════════════════════════════════════════════════════════════ */

:root {
  /* ── Typographic System (SF Pro Display / San Francisco Fallbacks) ── */
  --system-font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
    "SF Pro Icons", "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;

  /* ── Light Mode Palette ── */
  --text-primary: #1d1d1f;
  --text-secondary: rgba(0, 0, 0, 0.55);
  --text-tertiary: rgba(0, 0, 0, 0.38);
  --text-placeholder: rgba(0, 0, 0, 0.28);
  --surface-bg: rgba(255, 255, 255, 0.18);
  --surface-hover: rgba(255, 255, 255, 0.28);
  --surface-active: rgba(255, 255, 255, 0.38);
  --border-input: rgba(0, 0, 0, 0.10);
  --border-focus: rgba(0, 122, 255, 0.60);
  --shadow-btn: 0 4px 14px rgba(0, 0, 0, 0.08);
  --shadow-btn-hover: 0 6px 20px rgba(0, 0, 0, 0.12);

  /* ── Time-Tint Parametric Colors (Injected dynamically via JS) ── */
  --time-tint: rgba(255, 255, 255, 0.05);
  --time-highlight: rgba(255, 255, 255, 0.80);
  --time-glow: rgba(255, 255, 255, 0.12);

  /* Apple System Accent Colors */
  --accent: #007aff;
  --accent-hover: #0056cc;

  /* ── Apple Liquid Glass Material System ──
     True Liquid Glass has three optical layers:
       1. Frosted backdrop  -> backdrop-filter: blur + saturate + brightness
       2. Diffuse white body -> angled gradient (the milky glass volume)
       3. Specular rim       -> inset box-shadow (physically-based edge lighting)
  */
  --glass-blur-mult: 1;
  --glass-blur-base: 28px;
  --glass-blur: blur(calc(var(--glass-blur-base) * var(--glass-blur-mult)));

  /* Specular rim: top-left light source model (matches Apple HIG) */
  --glass-rim-top:    rgba(255, 255, 255, 0.90);
  --glass-rim-left:   rgba(255, 255, 255, 0.45);
  --glass-rim-bottom: rgba(0, 0, 0, 0.06);
  --glass-rim-right:  rgba(0, 0, 0, 0.04);

  /* Composite specular shadow applied to all glass surfaces */
  --glass-specular:
    inset 0 1.5px 0 0 var(--glass-rim-top),
    inset 1px 0 0 0 var(--glass-rim-left),
    inset 0 -1px 0 0 var(--glass-rim-bottom),
    inset -1px 0 0 0 var(--glass-rim-right),
    inset 0 0 20px 0 rgba(255, 255, 255, 0.09);

  /* Outer physical shadows */
  --glass-shadow:       0 2px 8px rgba(0,0,0,0.08), 0 8px 32px rgba(0,0,0,0.06);
  --glass-shadow-hover: 0 4px 16px rgba(0,0,0,0.12), 0 16px 48px rgba(0,0,0,0.10);

  /* Diffuse glass body gradient (angled to simulate curved glass surface) */
  --glass-sheen: linear-gradient(
    140deg,
    rgba(255, 255, 255, 0.28) 0%,
    rgba(255, 255, 255, 0.12) 40%,
    rgba(255, 255, 255, 0.08) 65%,
    rgba(255, 255, 255, 0.18) 100%
  );

  /* Legacy edge vars (preserved for compatibility) */
  --glass-edge-top:    rgba(255, 255, 255, 0.90);
  --glass-edge-left:   rgba(255, 255, 255, 0.45);
  --glass-edge-bottom: rgba(0, 0, 0, 0.06);
  --glass-edge-right:  rgba(0, 0, 0, 0.04);

  /* Mouse-driven specular highlight position (set by JS) */
  --mouse-x: 50%;
  --mouse-y: 50%;

  /* Apple Spring Physics Timing */
  --apple-spring: 0.35s cubic-bezier(0.22, 0.74, 0.26, 1);

  /* Parallax Offsets */
  --parallax-x: 0;
  --parallax-y: 0;
}

/* ═══════════════════════════════════
   Dark Mode System Overrides
   ═══════════════════════════════════ */
[data-theme="dark"] {
  --text-primary: #f5f5f7;
  --text-secondary: rgba(255, 255, 255, 0.60);
  --text-tertiary: rgba(255, 255, 255, 0.42);
  --text-placeholder: rgba(255, 255, 255, 0.28);
  --surface-bg: rgba(255, 255, 255, 0.10);
  --surface-hover: rgba(255, 255, 255, 0.18);
  --surface-active: rgba(255, 255, 255, 0.24);
  --border-input: rgba(255, 255, 255, 0.16);
  --border-focus: rgba(77, 171, 255, 0.70);
  --shadow-btn: 0 4px 16px rgba(0, 0, 0, 0.35);
  --shadow-btn-hover: 0 6px 24px rgba(0, 0, 0, 0.45);
  --glass-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  --glass-shadow-hover: 0 8px 30px rgba(0, 0, 0, 0.40);
  --accent: #0a84ff;
  --accent-hover: #409cff;
}

[data-theme="dark"] #wallpaper {
  background: linear-gradient(145deg, #0f0c29 0%, #1e1b4b 50%, #111827 100%);
}

/* Dark mode: glass body is darker, less milky */
[data-theme="dark"] .glass-panel::after,
[data-theme="dark"] .search-bar::after,
[data-theme="dark"] .modal-content::after,
[data-theme="dark"] .donate-card::after {
  background: linear-gradient(
    140deg,
    rgba(255, 255, 255, 0.14) 0%,
    rgba(255, 255, 255, 0.06) 40%,
    rgba(255, 255, 255, 0.04) 65%,
    rgba(255, 255, 255, 0.09) 100%
  );
}

/* Dark mode: add-btn, glass-btn, and control-btn diffuse fill */
[data-theme="dark"] .add-btn,
[data-theme="dark"] .glass-btn,
[data-theme="dark"] .control-btn {
  background: linear-gradient(
    140deg,
    rgba(255, 255, 255, 0.12) 0%,
    rgba(255, 255, 255, 0.05) 50%,
    rgba(255, 255, 255, 0.08) 100%
  );
}

/* Dark mode: rim specular rims are subdued */
[data-theme="dark"] .glass-panel,
[data-theme="dark"] .search-bar,
[data-theme="dark"] .add-btn,
[data-theme="dark"] .glass-btn,
[data-theme="dark"] .modal-content,
[data-theme="dark"] .donate-card,
[data-theme="dark"] .control-btn {
  box-shadow:
    inset 0 1.5px 0 0 rgba(255, 255, 255, 0.50),
    inset 1px 0 0 0 rgba(255, 255, 255, 0.24),
    inset 0 -1px 0 0 rgba(0, 0, 0, 0.22),
    inset -1px 0 0 0 rgba(0, 0, 0, 0.16),
    inset 0 0 20px 0 rgba(255, 255, 255, 0.04),
    var(--glass-shadow);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --text-primary: #f5f5f7;
    --text-secondary: rgba(255, 255, 255, 0.60);
    --text-tertiary: rgba(255, 255, 255, 0.42);
    --text-placeholder: rgba(255, 255, 255, 0.28);
    --surface-bg: rgba(255, 255, 255, 0.08);
    --surface-hover: rgba(255, 255, 255, 0.14);
    --surface-active: rgba(255, 255, 255, 0.20);
    --border-input: rgba(255, 255, 255, 0.16);
    --border-focus: rgba(77, 171, 255, 0.70);
    --accent: #0a84ff;
    --accent-hover: #409cff;
  }
  :root:not([data-theme="light"]) #wallpaper {
    background: linear-gradient(145deg, #0f0c29 0%, #1e1b4b 50%, #111827 100%);
  }
}

/* ═══════════════════════════════════
   Accessibility: Reduced Motion
   ═══════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  #wallpaper, #wallpaper-overlay {
    transform: translate(0, 0) !important;
    will-change: auto;
    transition: none !important;
  }

  *, *::before, *::after {
    transition-duration: 0.001s !important;
    animation-duration: 0.001s !important;
    animation-iteration-count: 1 !important;
  }

  body { opacity: 1 !important; }
  body.ready #clock-wrapper,
  body.ready .search-bar,
  body.ready .bookmark-grid,
  body.ready #show-add-btn,
  body.ready .bookmark-wrapper {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}

*, *::before, *::after { box-sizing: border-box; }

body, html {
  margin: 0; padding: 0;
  width: 100vw; height: 100vh;
  font-family: var(--system-font);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ═══════════════════════════════════
   Smooth Entrance Animations
   ═══════════════════════════════════ */
body { opacity: 1; }

body.ready #clock-wrapper {
  animation: fadeInUp 0.6s var(--apple-spring) both;
}
body.ready .search-bar {
  animation: fadeInUp 0.6s 0.1s var(--apple-spring) both;
}
body.ready .bookmark-grid {
  animation: fadeInUp 0.6s 0.2s var(--apple-spring) both;
}
body.ready #show-add-btn {
  animation: fadeInUp 0.6s 0.3s var(--apple-spring) both;
}

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

body.ready .bookmark-wrapper {
  animation: fadeInScale 0.5s var(--apple-spring) both;
}

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.88);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* ═══════════════════════════════════
   Wallpaper Layer
   ═══════════════════════════════════ */
#wallpaper {
  position: fixed;
  inset: -30px;
  z-index: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 1;
  transition: opacity 0.8s ease-in-out, filter 0.4s ease;
  transform: translate(
    calc(var(--parallax-x) * -1px),
    calc(var(--parallax-y) * -1px)
  );
  will-change: transform;
}

#wallpaper-overlay {
  position: fixed;
  inset: -30px;
  z-index: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.8s ease-in-out;
  transform: translate(
    calc(var(--parallax-x) * -1px),
    calc(var(--parallax-y) * -1px)
  );
}
#wallpaper-overlay.fading { opacity: 0; }
#wallpaper-overlay.hidden-overlay { visibility: hidden; }

/* Main Container */
.main-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  padding: 72px 24px 16px;
  overflow: hidden;
}

/* ═══════════════════════════════════
   Apple Liquid Glass — Three-Layer Architecture
   Layer 1 (::before): Frosted backdrop + blur
   Layer 2 (::after):  Diffuse white glass body
   Layer 3 (box-shadow): Specular rim + shadow
   ═══════════════════════════════════ */
.glass-panel {
  position: relative;
  isolation: isolate;
  border: none;
  box-shadow:
    /* Specular rim: physically-based top-left lighting */
    inset 0 1.5px 0 0 var(--glass-rim-top),
    inset 1px 0 0 0 var(--glass-rim-left),
    inset 0 -1px 0 0 var(--glass-rim-bottom),
    inset -1px 0 0 0 var(--glass-rim-right),
    /* Internal volume glow */
    inset 0 0 24px 0 rgba(255, 255, 255, 0.08),
    /* External drop shadow */
    var(--glass-shadow);
  transition: box-shadow var(--apple-spring);
}

/* Layer 1: Frosted glass backdrop — blur + chromatic amplification */
.glass-panel::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -2;
  border-radius: inherit;
  backdrop-filter: var(--glass-blur) saturate(1.8) brightness(1.06);
  -webkit-backdrop-filter: var(--glass-blur) saturate(1.8) brightness(1.06);
  transition: backdrop-filter 0.6s ease;
}

/* Layer 2: Diffuse white glass body — the milky semi-opaque fill */
.glass-panel::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(
    140deg,
    rgba(255, 255, 255, 0.28) 0%,
    rgba(255, 255, 255, 0.13) 35%,
    rgba(255, 255, 255, 0.08) 65%,
    rgba(255, 255, 255, 0.17) 100%
  );
  transition: background var(--apple-spring);
}

/* Hover: glass brightens — specular rim becomes more vivid */
.glass-panel:hover {
  box-shadow:
    inset 0 1.5px 0 0 rgba(255, 255, 255, 0.98),
    inset 1px 0 0 0 rgba(255, 255, 255, 0.55),
    inset 0 -1px 0 0 rgba(0, 0, 0, 0.08),
    inset -1px 0 0 0 rgba(0, 0, 0, 0.06),
    inset 0 0 28px 0 rgba(255, 255, 255, 0.11),
    var(--glass-shadow-hover);
}
.glass-panel:hover::after {
  background: linear-gradient(
    140deg,
    rgba(255, 255, 255, 0.36) 0%,
    rgba(255, 255, 255, 0.18) 35%,
    rgba(255, 255, 255, 0.11) 65%,
    rgba(255, 255, 255, 0.22) 100%
  );
}

/* ═══════════════════════════════════
   Header: Clock & Greeting
   ═══════════════════════════════════ */
#clock-wrapper {
  text-align: center;
  margin-bottom: 40px;
  user-select: none;
}

.clock {
  font-size: clamp(64px, 9vw, 104px);
  font-weight: 200;
  letter-spacing: -2.5px;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 4px;
  font-family: "SF Pro Display", "Helvetica Neue", var(--system-font);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum", "zero" 1;
}

.date {
  font-size: 14px;
  font-weight: 400;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}

.ampm {
  font-size: 0.35em;
  font-weight: 300;
  letter-spacing: 0;
  margin-left: 6px;
  opacity: 0.6;
  vertical-align: super;
}

.greeting {
  font-size: clamp(28px, 4.5vw, 48px);
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.2;
  margin-bottom: 16px;
  letter-spacing: -0.5px;
}

/* ═══════════════════════════════════
   Search Bar
   ═══════════════════════════════════ */
.search-bar {
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 520px;
  margin-bottom: 40px;
  padding: 12px 18px;
  border-radius: 22px;
  position: relative;
  isolation: isolate;
  border: none;
  /* Liquid Glass specular rim + outer shadow */
  box-shadow:
    inset 0 1.5px 0 0 rgba(255, 255, 255, 0.92),
    inset 1px 0 0 0 rgba(255, 255, 255, 0.48),
    inset 0 -1px 0 0 rgba(0, 0, 0, 0.07),
    inset -1px 0 0 0 rgba(0, 0, 0, 0.04),
    inset 0 0 20px 0 rgba(255, 255, 255, 0.09),
    var(--glass-shadow);
  transition: all var(--apple-spring);
}

/* Search bar Layer 1: frosted backdrop */
.search-bar::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -2;
  border-radius: inherit;
  backdrop-filter: var(--glass-blur) saturate(1.8) brightness(1.06);
  -webkit-backdrop-filter: var(--glass-blur) saturate(1.8) brightness(1.06);
}

/* Search bar Layer 2: diffuse glass body */
.search-bar::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(
    140deg,
    rgba(255, 255, 255, 0.30) 0%,
    rgba(255, 255, 255, 0.14) 40%,
    rgba(255, 255, 255, 0.09) 70%,
    rgba(255, 255, 255, 0.20) 100%
  );
}

.search-input-wrapper {
  display: flex;
  align-items: center;
  width: 100%;
  position: relative;
  z-index: 1;
}

.search-bar:focus-within {
  box-shadow:
    inset 0 1.5px 0 0 rgba(255, 255, 255, 0.98),
    inset 1px 0 0 0 rgba(255, 255, 255, 0.55),
    inset 0 -1px 0 0 rgba(0, 0, 0, 0.08),
    inset -1px 0 0 0 rgba(0, 0, 0, 0.05),
    inset 0 0 24px 0 rgba(255, 255, 255, 0.11),
    var(--glass-shadow-hover),
    0 0 0 3px rgba(0, 122, 255, 0.20);
  transform: translateY(-1px);
}

.search-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 400;
  font-family: var(--system-font);
}
.search-input::placeholder { color: var(--text-placeholder); }

.engine-toggle {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 14px;
  transition: all var(--apple-spring);
}
.engine-toggle:hover {
  color: var(--text-primary);
  background: var(--surface-hover);
  transform: scale(1.05);
}
.engine-toggle:active {
  transform: scale(0.92);
  background: var(--surface-active);
}

/* ═══════════════════════════════════
   Bookmark Scroll Container & Grid
   ═══════════════════════════════════ */
.bookmarks-scroll {
  flex: 1;
  min-height: 0;
  width: 100%;
  overflow-y: auto;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 6px 0 64px;
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
}

.bookmark-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 32px 20px;
  max-width: 640px;
  width: 100%;
  justify-items: center;
  flex: none;
  overflow: visible;
  align-content: start;
}

.bookmark-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.bookmark-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  cursor: pointer;
  transition: transform var(--apple-spring);
}
.bookmark-wrapper:hover .bookmark-item {
  transform: translateY(-4px) scale(1.05);
}
.bookmark-wrapper:active .bookmark-item {
  transform: scale(0.93);
}

.bookmark-icon {
  width: 62px;
  height: 62px;
  border-radius: 18px;
  overflow: hidden;
  position: relative;
  border: none;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
  box-shadow:
    0 4px 14px rgba(0, 0, 0, 0.14),
    0 1px 3px rgba(0, 0, 0, 0.08);
  transition: transform var(--apple-spring), box-shadow var(--apple-spring);
}

.bookmark-wrapper:hover .bookmark-icon {
  box-shadow:
    0 8px 22px rgba(0, 0, 0, 0.20),
    0 2px 6px rgba(0, 0, 0, 0.10);
}

.bookmark-icon img {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  object-fit: contain;
}

.bookmark-icon img.letter-icon {
  width: 100%;
  height: 100%;
  border-radius: 0;
  object-fit: cover;
  display: block;
}

.bookmark-name {
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 500;
  text-align: center;
  width: 80px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.1px;
}

/* Bookmark Action Badges (Edit, Delete, Open New Tab) */
.bookmark-delete, .bookmark-edit, .bookmark-newtab {
  position: absolute;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: white;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transform: scale(0.7);
  transition: all var(--apple-spring);
  border: none;
  z-index: 5;
}
.bookmark-delete { top: -8px; right: -8px; }
.bookmark-edit { top: -8px; left: -8px; }
.bookmark-newtab { bottom: 20px; right: -8px; }

.bookmark-delete.visible, .bookmark-edit.visible, .bookmark-newtab.visible {
  opacity: 1;
  transform: scale(1);
}
.bookmark-delete:hover { background: #ff3b30; }
.bookmark-edit:hover { background: #007aff; }
.bookmark-newtab:hover { background: #34c759; }

/* Drag & Drop Reordering */
.bookmark-wrapper.dragging {
  opacity: 0.35;
  transform: scale(0.92);
}
.bookmark-wrapper.drag-over .bookmark-icon {
  box-shadow: 0 0 0 3px var(--accent), var(--glass-shadow-hover);
  transform: scale(1.06);
}

/* ═══════════════════════════════════
   Floating Glass Control Buttons
   ═══════════════════════════════════ */
.add-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 22px;
  border-radius: 100px;
  border: none;
  position: relative;
  isolation: isolate;
  /* Liquid Glass pill */
  background: linear-gradient(
    140deg,
    rgba(255, 255, 255, 0.26) 0%,
    rgba(255, 255, 255, 0.11) 50%,
    rgba(255, 255, 255, 0.18) 100%
  );
  backdrop-filter: var(--glass-blur) saturate(1.8) brightness(1.06);
  -webkit-backdrop-filter: var(--glass-blur) saturate(1.8) brightness(1.06);
  box-shadow:
    inset 0 1.5px 0 0 rgba(255, 255, 255, 0.90),
    inset 1px 0 0 0 rgba(255, 255, 255, 0.44),
    inset 0 -1px 0 0 rgba(0, 0, 0, 0.07),
    inset -1px 0 0 0 rgba(0, 0, 0, 0.04),
    inset 0 0 16px 0 rgba(255, 255, 255, 0.08),
    var(--glass-shadow);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--apple-spring);
  outline: none;
}
.add-btn:hover {
  background: linear-gradient(
    140deg,
    rgba(255, 255, 255, 0.34) 0%,
    rgba(255, 255, 255, 0.15) 50%,
    rgba(255, 255, 255, 0.24) 100%
  );
  transform: translateY(-2px);
  box-shadow:
    inset 0 1.5px 0 0 rgba(255, 255, 255, 0.98),
    inset 1px 0 0 0 rgba(255, 255, 255, 0.55),
    inset 0 -1px 0 0 rgba(0, 0, 0, 0.09),
    inset -1px 0 0 0 rgba(0, 0, 0, 0.06),
    inset 0 0 20px 0 rgba(255, 255, 255, 0.11),
    var(--glass-shadow-hover);
}
.add-btn:active {
  transform: scale(0.95);
  background: rgba(255, 255, 255, 0.32);
}

.control-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  outline: none;
  /* Liquid Glass circular pill */
  background: linear-gradient(
    145deg,
    rgba(255, 255, 255, 0.26) 0%,
    rgba(255, 255, 255, 0.11) 50%,
    rgba(255, 255, 255, 0.17) 100%
  );
  backdrop-filter: var(--glass-blur) saturate(1.8) brightness(1.06);
  -webkit-backdrop-filter: var(--glass-blur) saturate(1.8) brightness(1.06);
  box-shadow:
    inset 0 1.5px 0 0 rgba(255, 255, 255, 0.90),
    inset 1px 0 0 0 rgba(255, 255, 255, 0.44),
    inset 0 -1px 0 0 rgba(0, 0, 0, 0.08),
    inset -1px 0 0 0 rgba(0, 0, 0, 0.05),
    inset 0 0 12px 0 rgba(255, 255, 255, 0.08),
    var(--glass-shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: all var(--apple-spring);
  opacity: 0.85;
}

.top-nav-bar {
  position: fixed;
  top: 20px;
  left: 20px;
  z-index: 99;
  display: flex;
  align-items: center;
  gap: 10px;
}
.top-nav-right {
  left: auto;
  right: 20px;
}

.sync-trigger {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 99;
}
.donate-trigger {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 99;
}

.control-btn:hover {
  opacity: 1;
  color: var(--text-primary);
  transform: scale(1.08);
  background: linear-gradient(
    145deg,
    rgba(255, 255, 255, 0.34) 0%,
    rgba(255, 255, 255, 0.15) 50%,
    rgba(255, 255, 255, 0.24) 100%
  );
  box-shadow:
    inset 0 1.5px 0 0 rgba(255, 255, 255, 0.98),
    inset 1px 0 0 0 rgba(255, 255, 255, 0.55),
    inset 0 -1px 0 0 rgba(0, 0, 0, 0.10),
    inset -1px 0 0 0 rgba(0, 0, 0, 0.06),
    inset 0 0 16px 0 rgba(255, 255, 255, 0.12),
    var(--glass-shadow-hover);
}
.control-btn:active {
  transform: scale(0.92);
  opacity: 0.85;
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
  transition: opacity 0.3s ease;
}
.modal-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.modal-content, .donate-card {
  border-radius: 24px;
  padding: 32px 28px;
  width: 360px;
  max-width: 90vw;
  position: relative;
  isolation: isolate;
  border: none;
  /* Full Liquid Glass treatment for modal panels */
  box-shadow:
    inset 0 1.5px 0 0 rgba(255, 255, 255, 0.92),
    inset 1px 0 0 0 rgba(255, 255, 255, 0.48),
    inset 0 -1px 0 0 rgba(0, 0, 0, 0.07),
    inset -1px 0 0 0 rgba(0, 0, 0, 0.04),
    inset 0 0 32px 0 rgba(255, 255, 255, 0.09),
    0 24px 60px rgba(0, 0, 0, 0.22),
    0 8px 24px rgba(0, 0, 0, 0.10);
  transform: scale(1);
  transition: transform var(--apple-spring), box-shadow var(--apple-spring);
}

/* Modal Layer 1: frosted backdrop */
.modal-content::before, .donate-card::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -2;
  border-radius: inherit;
  backdrop-filter: blur(40px) saturate(1.8) brightness(1.06);
  -webkit-backdrop-filter: blur(40px) saturate(1.8) brightness(1.06);
}

/* Modal Layer 2: diffuse glass body */
.modal-content::after, .donate-card::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(
    145deg,
    rgba(255, 255, 255, 0.34) 0%,
    rgba(255, 255, 255, 0.16) 40%,
    rgba(255, 255, 255, 0.10) 70%,
    rgba(255, 255, 255, 0.22) 100%
  );
}

.hidden .modal-content, .hidden .donate-card {
  transform: scale(0.90);
}

/* Empty State */
#bookmark-grid .grid-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  min-height: 220px;
  color: var(--text-tertiary);
  font-size: 13px;
  user-select: none;
}
#bookmark-grid .grid-empty .preset-btn {
  padding: 8px 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
  background: transparent;
  border: 1.5px solid var(--accent);
  border-radius: 20px;
  cursor: pointer;
  transition: all var(--apple-spring);
}
#bookmark-grid .grid-empty .preset-btn:hover {
  background: var(--accent);
  color: #fff;
  transform: scale(1.04);
}
#bookmark-grid .grid-empty .preset-btn:active {
  transform: scale(0.95);
}

/* ═══════════════════════════════════
   Offline Badge
   ═══════════════════════════════════ */
#offline-badge {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%) translateY(-40px);
  z-index: 9999;
  padding: 6px 16px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  background: rgba(120, 120, 140, 0.55);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  pointer-events: none;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
  opacity: 0;
  transition: all 0.4s var(--apple-spring);
  user-select: none;
}
body.offline #offline-badge {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ═══════════════════════════════════
   Wallpaper Credit
   ═══════════════════════════════════ */
#wallpaper-credit {
  position: fixed;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1;
  font-size: 11px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.45);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 80vw;
  pointer-events: none;
  user-select: none;
  font-family: var(--system-font);
  letter-spacing: 0.01em;
}

/* ═══════════════════════════════════
   Modal Form Elements
   ═══════════════════════════════════ */
.modal-content h3,
.donate-card h3 {
  margin: 0 0 20px;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.modal-content input[type="text"],
.modal-content input[type="url"] {
  width: 100%;
  padding: 10px 14px;
  margin-bottom: 12px;
  border: 1px solid var(--border-input);
  border-radius: 12px;
  background: var(--surface-bg);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: var(--text-primary);
  font-size: 14px;
  font-family: var(--system-font);
  outline: none;
  transition: all var(--apple-spring);
  box-sizing: border-box;
}
.modal-content input[type="text"]:focus,
.modal-content input[type="url"]:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.15);
  background: var(--surface-hover);
}
.modal-content input[type="text"]:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.modal-content input::placeholder {
  color: var(--text-placeholder);
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 8px;
  justify-content: flex-end;
}

.btn-primary,
.btn-secondary {
  padding: 9px 22px;
  border-radius: 12px;
  border: none;
  font-size: 14px;
  font-weight: 500;
  font-family: var(--system-font);
  cursor: pointer;
  transition: all var(--apple-spring);
  outline: none;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 8px rgba(0, 122, 255, 0.25);
}
.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0, 122, 255, 0.35);
}
.btn-primary:active {
  transform: scale(0.95);
  box-shadow: 0 1px 4px rgba(0, 122, 255, 0.2);
}

.btn-secondary {
  background: var(--surface-bg);
  color: var(--text-secondary);
  border: 1px solid var(--border-input);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.btn-secondary:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
  transform: translateY(-1px);
}
.btn-secondary:active {
  transform: scale(0.95);
}

/* ═══════════════════════════════════
   Bookmark Group Headers
   ═══════════════════════════════════ */
.bookmark-group-header {
  grid-column: 1 / -1;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  margin: 4px 0;
  border-radius: 10px;
  cursor: pointer;
  user-select: none;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--system-font);
  transition: all var(--apple-spring);
  outline: none;
  border: 1px solid transparent;
}
.bookmark-group-header:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
  border-color: var(--glass-edge-left);
}
.bookmark-group-header:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}
.bookmark-group-header:active {
  transform: scale(0.98);
}

.group-toggle {
  font-size: 10px;
  transition: transform var(--apple-spring);
  opacity: 0.5;
  display: inline-block;
}
.bookmark-group-header[data-collapsed="true"] .group-toggle {
  transform: rotate(-90deg);
}

.group-name {
  font-weight: 600;
  letter-spacing: -0.1px;
  color: var(--text-primary);
}

.group-count {
  font-size: 11px;
  color: var(--text-tertiary);
  font-weight: 400;
  margin-left: auto;
}

/* ═══════════════════════════════════
   Sync Panel
   ═══════════════════════════════════ */
.sync-panel {
  width: 400px;
}

.sync-section {
  padding: 4px 0;
}

.sync-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0 0 16px;
  line-height: 1.6;
}

.sync-code-box {
  padding: 16px 18px;
  border-radius: 14px;
  background: var(--surface-bg);
  border: 1px solid var(--border-input);
  margin-bottom: 14px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.sync-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: block;
  margin-bottom: 8px;
}

.sync-code-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sync-code {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.5px;
  font-family: "SF Mono", "Fira Code", "Cascadia Code", "Menlo", monospace;
  word-break: break-all;
  flex: 1;
}

.sync-no-code {
  text-align: center;
  padding: 20px 0;
}
.sync-no-code p {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0 0 16px;
  line-height: 1.5;
}

.sync-code-input {
  flex: 1;
  padding: 9px 14px;
  border-radius: 12px;
  border: 1px solid var(--border-input);
  background: var(--surface-bg);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: var(--text-primary);
  font-size: 14px;
  font-family: var(--system-font);
  outline: none;
  transition: all var(--apple-spring);
  box-sizing: border-box;
}
.sync-code-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.15);
}
.sync-code-input::placeholder {
  color: var(--text-placeholder);
}

/* Glass Buttons (Sync Panel) */
.glass-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 11px 18px;
  margin-bottom: 8px;
  border-radius: 14px;
  border: none;
  /* Liquid Glass */
  background: linear-gradient(
    140deg,
    rgba(255, 255, 255, 0.24) 0%,
    rgba(255, 255, 255, 0.10) 50%,
    rgba(255, 255, 255, 0.16) 100%
  );
  backdrop-filter: blur(20px) saturate(1.8) brightness(1.06);
  -webkit-backdrop-filter: blur(20px) saturate(1.8) brightness(1.06);
  box-shadow:
    inset 0 1.5px 0 0 rgba(255, 255, 255, 0.88),
    inset 1px 0 0 0 rgba(255, 255, 255, 0.42),
    inset 0 -1px 0 0 rgba(0, 0, 0, 0.07),
    inset -1px 0 0 0 rgba(0, 0, 0, 0.04),
    inset 0 0 14px 0 rgba(255, 255, 255, 0.07),
    var(--glass-shadow);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  font-family: var(--system-font);
  cursor: pointer;
  transition: all var(--apple-spring);
  outline: none;
}
.glass-btn:hover {
  background: linear-gradient(
    140deg,
    rgba(255, 255, 255, 0.32) 0%,
    rgba(255, 255, 255, 0.14) 50%,
    rgba(255, 255, 255, 0.22) 100%
  );
  transform: translateY(-1px);
  box-shadow:
    inset 0 1.5px 0 0 rgba(255, 255, 255, 0.96),
    inset 1px 0 0 0 rgba(255, 255, 255, 0.52),
    inset 0 -1px 0 0 rgba(0, 0, 0, 0.09),
    inset -1px 0 0 0 rgba(0, 0, 0, 0.05),
    inset 0 0 18px 0 rgba(255, 255, 255, 0.10),
    var(--glass-shadow-hover);
}
.glass-btn:active {
  transform: scale(0.96);
  background: rgba(255, 255, 255, 0.28);
  box-shadow: inset 0 1px 0 0 rgba(255, 255, 255, 0.70), var(--glass-shadow);
}
.glass-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.glass-btn-sm {
  padding: 7px 14px;
  border-radius: 10px;
  border: 1px solid var(--glass-edge-top);
  background: var(--surface-bg);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--system-font);
  cursor: pointer;
  transition: all var(--apple-spring);
  outline: none;
  white-space: nowrap;
  box-shadow: var(--glass-shadow);
}
.glass-btn-sm:hover {
  background: var(--surface-hover);
  transform: translateY(-1px);
  box-shadow: var(--glass-shadow-hover);
}
.glass-btn-sm:active {
  transform: scale(0.94);
}

/* ═══════════════════════════════════
   Shortcuts Panel
   ═══════════════════════════════════ */
.shortcuts-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.shortcuts-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.shortcuts-close-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: var(--surface-bg);
  color: var(--text-secondary);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--apple-spring);
  outline: none;
}
.shortcuts-close-btn:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
  transform: scale(1.1);
}
.shortcuts-close-btn:active {
  transform: scale(0.88);
}

.shortcuts-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.shortcut-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 4px;
  border-bottom: 1px solid rgba(128, 128, 128, 0.08);
  font-size: 13px;
  color: var(--text-secondary);
}
.shortcut-item:last-child {
  border-bottom: none;
}

.shortcut-item kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  padding: 4px 9px;
  border-radius: 7px;
  background: var(--surface-bg);
  border: 1px solid var(--border-input);
  font-size: 12px;
  font-weight: 600;
  font-family: "SF Mono", "Fira Code", "Cascadia Code", monospace;
  color: var(--text-primary);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06), inset 0 -1px 0 rgba(0, 0, 0, 0.06);
  line-height: 1;
}

/* ═══════════════════════════════════
   Donate Modal
   ═══════════════════════════════════ */
.donate-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
  transition: opacity 0.3s ease;
}
.donate-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}
.hidden .donate-card {
  transform: scale(0.90);
}

.modal-body {
  padding: 4px 0;
}

.donate-intro {
  font-size: 14px;
  color: var(--text-secondary);
  text-align: center;
  margin: 0 0 20px;
  line-height: 1.6;
}

.donate-qr {
  display: block;
  width: 200px;
  max-width: 80%;
  margin: 0 auto 16px;
  border-radius: 16px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.donate-footer {
  font-size: 13px;
  color: var(--text-tertiary);
  text-align: center;
  margin: 0 0 8px;
}

/* ═══════════════════════════════════
   Settings Sections (Modal Sliders & Inputs)
   ═══════════════════════════════════ */
.modal-section {
  padding: 16px 0;
  border-top: 1px solid rgba(128, 128, 128, 0.12);
}

.modal-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.modal-section-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

.blur-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  min-width: 40px;
  text-align: right;
}

/* Range Slider — Apple-style */
.modal-section-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: var(--border-input);
  outline: none;
  transition: background var(--apple-spring);
  margin: 2px 0;
}
.modal-section-range::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
}
.modal-section-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  margin-top: -9px;
  border-radius: 50%;
  background: #fff;
  border: 0.5px solid rgba(0, 0, 0, 0.12);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15), 0 0 1px rgba(0, 0, 0, 0.08);
  cursor: pointer;
  transition: transform var(--apple-spring), box-shadow var(--apple-spring);
}
.modal-section-range::-webkit-slider-thumb:hover {
  transform: scale(1.12);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2), 0 0 1px rgba(0, 0, 0, 0.1);
}
.modal-section-range::-webkit-slider-thumb:active {
  transform: scale(0.95);
}
.modal-section-range::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  border: 0.5px solid rgba(0, 0, 0, 0.12);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
  cursor: pointer;
}
.modal-section-range::-moz-range-track {
  height: 4px;
  border-radius: 2px;
  background: var(--border-input);
}

[data-theme="dark"] .modal-section-range::-webkit-slider-thumb {
  background: #3a3a3c;
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}
[data-theme="dark"] .modal-section-range::-moz-range-thumb {
  background: #3a3a3c;
  border-color: rgba(255, 255, 255, 0.12);
}

.modal-section-hint {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-tertiary);
}

.modal-section-select {
  width: 100%;
  padding: 9px 14px;
  margin-top: 8px;
  border-radius: 12px;
  border: 1px solid var(--border-input);
  background: var(--surface-bg);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: var(--text-primary);
  font-size: 14px;
  font-family: var(--system-font);
  outline: none;
  transition: all var(--apple-spring);
  box-sizing: border-box;
}
.modal-section-select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.15);
}

/* ═══════════════════════════════════
   Paste URL Button
   ═══════════════════════════════════ */
.paste-url-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  margin-top: -4px;
  margin-bottom: 12px;
  border-radius: 10px;
  border: 1px solid var(--border-input);
  background: var(--surface-bg);
  color: var(--text-secondary);
  font-size: 12px;
  font-family: var(--system-font);
  cursor: pointer;
  transition: all var(--apple-spring);
  outline: none;
}
.paste-url-btn:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
  transform: translateY(-1px);
}
.paste-url-btn:active {
  transform: scale(0.94);
}
.paste-url-btn svg {
  opacity: 0.7;
}

/* ═══════════════════════════════════
   Scrollbar (Bookmark Grid)
   ═══════════════════════════════════ */
.bookmarks-scroll::-webkit-scrollbar {
  width: 4px;
}
.bookmarks-scroll::-webkit-scrollbar-track {
  background: transparent;
}
.bookmarks-scroll::-webkit-scrollbar-thumb {
  background: rgba(128, 128, 128, 0.2);
  border-radius: 2px;
}
.bookmarks-scroll:hover::-webkit-scrollbar-thumb {
  background: rgba(128, 128, 128, 0.35);
}

/* Sync Reset Button */
.sync-reset-btn {
  margin-top: 8px;
  color: var(--text-tertiary);
  font-size: 13px;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  opacity: 0.7;
}
.sync-reset-btn:hover {
  opacity: 1;
  color: #ff3b30;
  background: rgba(255, 59, 48, 0.08);
  border-color: rgba(255, 59, 48, 0.2);
  box-shadow: none;
}

/* ═══════════════════════════════════
   Donate & Contact Tabs / QR Fallbacks
   ═══════════════════════════════════ */
.donate-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  background: rgba(0, 0, 0, 0.05);
  padding: 4px;
  border-radius: 12px;
}
[data-theme="dark"] .donate-tabs {
  background: rgba(255, 255, 255, 0.06);
}

.donate-tab-btn {
  flex: 1;
  padding: 8px 12px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--system-font);
  cursor: pointer;
  transition: all var(--apple-spring);
  outline: none;
}
.donate-tab-btn:hover {
  color: var(--text-primary);
}
.donate-tab-btn.active {
  background: var(--surface-bg);
  color: var(--text-primary);
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.qr-box {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 180px;
  margin-bottom: 16px;
}

.qr-fallback {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 20px;
  border-radius: 16px;
  border: 1px dashed var(--border-input);
  background: var(--surface-bg);
  text-align: center;
}
.qr-fallback-icon {
  font-size: 32px;
  margin-bottom: 8px;
}
.qr-fallback p {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}
.qr-path-hint {
  font-size: 11px;
  font-family: monospace;
  color: var(--text-tertiary);
  background: rgba(0, 0, 0, 0.04);
  padding: 2px 8px;
  border-radius: 6px;
}
[data-theme="dark"] .qr-path-hint {
  background: rgba(255, 255, 255, 0.06);
}

/* ═══════════════════════════════════
   Settings Modal & File Upload Styles
   ═══════════════════════════════════ */
.settings-card {
  width: 400px;
}

.settings-body {
  display: flex;
  flex-direction: column;
}

.settings-btn-row {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.settings-btn-row .glass-btn-sm {
  flex: 1;
  text-align: center;
}

.file-upload-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* ═══════════════════════════════════
   HIG Liquid Toast Notification System
   ═══════════════════════════════════ */
.toast-container {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  min-width: 180px;
  max-width: 380px;
  padding: 10px 20px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
  /* Liquid glass capsule */
  background: linear-gradient(
    140deg,
    rgba(255, 255, 255, 0.40) 0%,
    rgba(255, 255, 255, 0.18) 50%,
    rgba(255, 255, 255, 0.28) 100%
  );
  backdrop-filter: var(--glass-blur) saturate(1.8) brightness(1.06);
  -webkit-backdrop-filter: var(--glass-blur) saturate(1.8) brightness(1.06);
  box-shadow:
    inset 0 1.5px 0 0 rgba(255, 255, 255, 0.95),
    inset 1px 0 0 0 rgba(255, 255, 255, 0.50),
    inset 0 -1px 0 0 rgba(0, 0, 0, 0.08),
    inset -1px 0 0 0 rgba(0, 0, 0, 0.04),
    0 10px 30px rgba(0, 0, 0, 0.15);
  transform: translateY(20px) scale(0.92);
  opacity: 0;
  transition: all 0.35s cubic-bezier(0.22, 0.74, 0.26, 1);
}

[data-theme="dark"] .toast {
  background: linear-gradient(
    140deg,
    rgba(255, 255, 255, 0.16) 0%,
    rgba(255, 255, 255, 0.08) 50%,
    rgba(255, 255, 255, 0.12) 100%
  );
  box-shadow:
    inset 0 1.5px 0 0 rgba(255, 255, 255, 0.40),
    inset 1px 0 0 0 rgba(255, 255, 255, 0.20),
    inset 0 -1px 0 0 rgba(0, 0, 0, 0.25),
    inset -1px 0 0 0 rgba(0, 0, 0, 0.15),
    0 10px 30px rgba(0, 0, 0, 0.4);
}

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

.toast.toast-error {
  color: #ff3b30;
}

.toast.toast-success {
  color: #34c759;
}

/* ═══════════════════════════════════
   HIG Confirm Dialog
   ═══════════════════════════════════ */
.confirm-dialog {
  width: 320px;
  text-align: center;
}

.confirm-dialog h3 {
  margin: 0 0 8px;
}

.confirm-message {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-secondary);
  margin: 0 0 20px;
  white-space: pre-line;
}

.confirm-dialog .modal-actions {
  justify-content: center;
  gap: 12px;
}