/* ============================================================
   BD Address Generator — Liquid-Glass design
   (visual system imported from SK071BDWeb; features preserved)
   ============================================================ */

:root {
  --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace;

  --radius-sm: 12px;
  --radius:    16px;
  --radius-lg: 24px;

  --blur:        blur(40px) saturate(200%);
  --blur-strong: blur(60px) saturate(220%);

  --accent:      #8b5cf6;
  --accent-2:    #22d3ee;
  --accent-3:    #10b981;
  --accent-rose: #f472b6;
  --accent-gold: #fbbf24;
  --accent-warm: #f59e0b;
  --danger:      #ef4444;

  --grad-aurora: linear-gradient(135deg, #8b5cf6 0%, #ec4899 45%, #22d3ee 100%);
  --grad-sunset: linear-gradient(135deg, #f59e0b 0%, #ec4899 50%, #8b5cf6 100%);
}

/* ---------- DARK (default) ---------- */
:root,
html[data-theme="dark"] {
  color-scheme: dark;

  --bg:   #07060f;
  --bg-2: #120a1f;

  --surface:       rgba(28, 22, 48, 0.58);
  --surface-2:     rgba(40, 30, 64, 0.78);
  --surface-hover: rgba(58, 42, 88, 0.88);

  --border:        rgba(255, 255, 255, 0.10);
  --border-strong: rgba(255, 255, 255, 0.18);
  --bevel:         rgba(255, 255, 255, 0.07);

  --text:      #f3eefb;
  --text-dim:  #b6abd0;
  --text-mute: #8076a3;

  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.35), 0 12px 38px rgba(15, 8, 35, 0.55);
  --shadow-2: 0 28px 70px rgba(15, 8, 35, 0.65), 0 2px 12px rgba(0, 0, 0, 0.4);

  --grid-line: rgba(255, 255, 255, 0.03);
  --chip-bg:   rgba(139, 92, 246, 0.14);
  --chip-bd:   rgba(139, 92, 246, 0.32);
  --chip-fg:   #c9b8ff;
}

/* ---------- LIGHT ---------- */
html[data-theme="light"] {
  color-scheme: light;

  --bg:   #fbe9e7;
  --bg-2: #e0e7ff;

  --surface:       rgba(255, 255, 255, 0.42);
  --surface-2:     rgba(255, 255, 255, 0.68);
  --surface-hover: rgba(255, 255, 255, 0.86);

  --border:        rgba(15, 23, 42, 0.08);
  --border-strong: rgba(15, 23, 42, 0.14);
  --bevel:         rgba(255, 255, 255, 0.75);

  --text:      #0f172a;
  --text-dim:  #475569;
  --text-mute: #64748b;

  --shadow-1: 0 1px 2px rgba(15, 23, 42, 0.06), 0 14px 36px rgba(15, 23, 42, 0.10);
  --shadow-2: 0 24px 70px rgba(15, 23, 42, 0.14), 0 2px 10px rgba(15, 23, 42, 0.08);

  --grid-line: rgba(15, 23, 42, 0.04);
  --chip-bg:   rgba(15, 23, 42, 0.05);
  --chip-bd:   rgba(15, 23, 42, 0.12);
  --chip-fg:   #334155;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; }

body {
  background: linear-gradient(160deg, var(--bg) 0%, var(--bg-2) 100%);
  color: var(--text);
  font-family: var(--font-sans);
  font-feature-settings: "cv11","ss01","cv01";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: 0.01em;
  overflow-x: hidden;
  transition: background-color .25s ease, color .25s ease;
}

/* Liquid Glass photographic backdrop — multi-layer blurred radial gradients */
body::before, body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}
html[data-theme="dark"] body::before {
  background:
    radial-gradient(55% 50% at 8% 12%,   rgba(139, 92, 246, 0.70) 0%, transparent 65%),
    radial-gradient(50% 45% at 92% 14%,  rgba(34, 211, 238, 0.55) 0%, transparent 65%),
    radial-gradient(55% 50% at 88% 86%,  rgba(236, 72, 153, 0.55) 0%, transparent 70%),
    radial-gradient(45% 45% at 14% 92%,  rgba(99, 102, 241, 0.55) 0%, transparent 68%),
    radial-gradient(38% 38% at 50% 45%,  rgba(251, 191, 36, 0.18) 0%, transparent 75%);
  filter: blur(90px) saturate(180%);
  opacity: 0.95;
}
html[data-theme="dark"] body::after {
  background:
    radial-gradient(28% 28% at 50% 50%, rgba(244, 114, 182, 0.30) 0%, transparent 70%),
    radial-gradient(22% 22% at 30% 30%, rgba(34, 211, 238, 0.25) 0%, transparent 70%);
  filter: blur(90px);
  opacity: 0.95;
}
html[data-theme="light"] body::before {
  background:
    radial-gradient(60% 55% at 12% 15%,  rgba(255, 183, 197, 0.90) 0%, transparent 65%),
    radial-gradient(55% 50% at 88% 20%,  rgba(167, 139, 250, 0.80) 0%, transparent 62%),
    radial-gradient(50% 45% at 80% 85%,  rgba(125, 211, 252, 0.75) 0%, transparent 68%),
    radial-gradient(55% 50% at 20% 90%,  rgba(252, 211, 77,  0.65) 0%, transparent 66%),
    radial-gradient(45% 45% at 50% 50%,  rgba(110, 231, 183, 0.60) 0%, transparent 72%);
  filter: blur(60px) saturate(135%);
}
html[data-theme="light"] body::after {
  background:
    radial-gradient(35% 30% at 70% 40%, rgba(139, 92, 246, 0.28) 0%, transparent 70%),
    radial-gradient(30% 28% at 25% 55%, rgba(236, 72, 153, 0.26) 0%, transparent 70%),
    radial-gradient(28% 26% at 60% 80%, rgba(34, 211, 238, 0.22) 0%, transparent 70%);
  filter: blur(80px);
  opacity: 0.95;
}

.bg-grid {
  position: fixed; inset: 0;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%);
  pointer-events: none;
  z-index: 0;
}

/* ---------- Layout ---------- */
.app {
  position: relative; z-index: 1;
  max-width: 720px; margin: 0 auto;
  padding: 36px 20px 56px;
  display: flex; flex-direction: column; gap: 16px;
}

/* ---------- Header ---------- */
.app-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1), inset 0 1px 0 var(--bevel);
  backdrop-filter: var(--blur-strong); -webkit-backdrop-filter: var(--blur-strong);
}

.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark {
  width: 50px; height: 50px;
  border-radius: 14px;
  display: grid; place-items: center;
  background: linear-gradient(135deg,
    rgba(139, 92, 246, 0.55),
    rgba(236, 72, 153, 0.35) 50%,
    rgba(34, 211, 238, 0.50));
  border: 1px solid var(--border-strong);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.25),
    0 8px 24px rgba(139, 92, 246, 0.35),
    0 0 28px rgba(236, 72, 153, 0.25);
  font-size: 24px;
  backdrop-filter: var(--blur);
}
.brand-text h1 {
  margin: 0;
  font-size: 19px; font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--text);
}
.brand-text p {
  margin: 3px 0 0;
  font-size: 12.5px;
  color: var(--text-dim);
}

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

.theme-toggle {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-dim);
  cursor: pointer;
  backdrop-filter: var(--blur);
  box-shadow: inset 0 1px 0 var(--bevel);
  transition: transform .25s, color .2s, background .2s, border-color .2s;
}
.theme-toggle:hover { color: var(--text); border-color: var(--border-strong); }
.theme-toggle:active { transform: scale(0.95); }
.theme-toggle .icon-sun, .theme-toggle .icon-moon { transition: transform .35s, opacity .25s; }
html[data-theme="dark"]  .theme-toggle .icon-sun  { display: none; }
html[data-theme="dark"]  .theme-toggle .icon-moon { display: block; }
html[data-theme="light"] .theme-toggle .icon-sun  { display: block; }
html[data-theme="light"] .theme-toggle .icon-moon { display: none; }

.status {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12.5px;
  color: var(--text-dim);
  backdrop-filter: var(--blur);
  box-shadow: inset 0 1px 0 var(--bevel);
}
.status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent-3);
  box-shadow: 0 0 12px var(--accent-3);
  animation: status-pulse 2s ease-in-out infinite;
}
@keyframes status-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.45; }
}

/* ---------- Filters / controls ---------- */
.controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.select-group label {
  display: block;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--text-mute); font-weight: 600;
  margin-bottom: 6px;
}
.select-wrap { position: relative; }
.select {
  -webkit-appearance: none; -moz-appearance: none; appearance: none;
  width: 100%;
  padding: 13px 42px 13px 16px;
  font-family: inherit; font-size: 14px; font-weight: 500;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  cursor: pointer; outline: none;
  backdrop-filter: var(--blur);
  box-shadow: inset 0 1px 0 var(--bevel), 0 1px 2px rgba(0,0,0,0.04);
  transition: background .18s, border-color .18s, box-shadow .18s;
}
.select:hover { background: var(--surface-2); }
.select:focus {
  border-color: var(--accent);
  box-shadow: inset 0 1px 0 var(--bevel), 0 0 0 4px rgba(139, 92, 246, 0.22);
}
.select:disabled { opacity: 0.55; cursor: not-allowed; }
.select option { background: var(--bg-2); color: var(--text); }
.select-arrow {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px;
  color: var(--text-dim); pointer-events: none;
}

/* ---------- Tracker card ---------- */
.tracker-card {
  padding: 18px 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1), inset 0 1px 0 var(--bevel);
  backdrop-filter: var(--blur-strong);
}
.tracker-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px;
}
.track-seg { min-width: 0; }
.track-label {
  font-size: 10px; font-weight: 700; letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-mute);
  margin-bottom: 6px;
}
.track-row {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 8px; margin-bottom: 8px;
}
.track-name {
  font-size: 13.5px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  flex: 1; min-width: 0;
}
.track-frac {
  font-family: var(--font-mono);
  font-size: 11px; font-weight: 500; color: var(--chip-fg);
  padding: 2px 9px; border-radius: 999px;
  background: var(--chip-bg); border: 1px solid var(--chip-bd);
  white-space: nowrap;
}
.track-bar {
  height: 5px;
  background: rgba(127, 127, 127, 0.12);
  border-radius: 999px;
  overflow: hidden;
}
.track-bar.overall { height: 8px; }
.track-fill {
  display: block; height: 100%;
  background: linear-gradient(90deg, #8b5cf6 0%, #ec4899 50%, #22d3ee 100%);
  background-size: 200% 100%;
  border-radius: 999px;
  transition: width .4s cubic-bezier(.2,.7,.3,1);
  box-shadow: 0 0 14px rgba(236, 72, 153, 0.45), 0 0 22px rgba(139, 92, 246, 0.4);
  animation: pool-shimmer 6s linear infinite;
}
@keyframes pool-shimmer {
  0%   { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}
.tracker-overall {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 12px;
  align-items: center;
}
.tracker-overall .track-label { grid-row: 1; grid-column: 1; margin: 0; }
.tracker-overall .track-name {
  grid-row: 1; grid-column: 2; text-align: right;
  font-family: var(--font-mono);
  font-size: 12px; font-weight: 500;
  color: var(--text-dim);
}
.tracker-overall .track-bar { grid-row: 2; grid-column: 1 / -1; margin-top: 8px; }

@media (max-width: 540px) {
  .tracker-grid { grid-template-columns: 1fr 1fr; }
}

/* ---------- Address card ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  /* Tighter bottom padding so the Reset row doesn't leave a big empty band
     between the button and the card's bottom edge. */
  padding: 28px 28px 18px;
  box-shadow: var(--shadow-2), inset 0 1px 0 var(--bevel);
  backdrop-filter: var(--blur-strong);
  position: relative;
  overflow: hidden;
}
.card-top {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
}
.card-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; color: var(--text-dim);
}
.card-title b { color: var(--text); font-weight: 600; }
.pin { font-size: 16px; }

/* OLD ADDRESS slot — sits where badges would */
.prev-slot {
  display: flex; flex-direction: column; align-items: flex-end;
  gap: 3px;
  max-width: 60%;
  padding: 7px 13px;
  border-radius: var(--radius-sm);
  background: var(--chip-bg);
  border: 1px solid var(--chip-bd);
}
.prev-label {
  font-family: var(--font-mono);
  font-size: 9px; font-weight: 700; letter-spacing: 0.12em;
  color: var(--text-mute);
}
.prev-text {
  font-size: 12px; font-weight: 500;
  color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 100%;
}

.divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-strong), transparent);
  margin: 22px 0;
}

/* Fields */
.fields {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 16px 24px;
}
.field { min-width: 0; }
.field-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--text-mute); font-weight: 600;
  margin-bottom: 4px;
}
.field-value {
  font-size: 15px; font-weight: 500;
  color: var(--text);
  word-break: break-word; line-height: 1.4;
}
.field-value.mono { font-family: var(--font-mono); font-size: 14px; }

@media (max-width: 540px) {
  .fields  { grid-template-columns: 1fr; }
  .controls { grid-template-columns: 1fr; }
}

/* ---------- Buttons ---------- */
.btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  font: inherit; font-size: 14px; font-weight: 600;
  letter-spacing: 0.005em;
  cursor: pointer; user-select: none;
  -webkit-tap-highlight-color: transparent;
  box-shadow:
    inset 0 1px 0 var(--bevel),
    inset 0 -1px 0 rgba(0, 0, 0, 0.06),
    0 1px 2px rgba(0, 0, 0, 0.04);
  transition:
    transform .18s cubic-bezier(.2,.7,.3,1),
    background .2s ease,
    border-color .2s ease,
    box-shadow .25s ease,
    color .2s ease,
    filter .2s ease;
}
.btn:hover {
  background: var(--surface-hover);
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 0 var(--bevel),
    inset 0 -1px 0 rgba(0, 0, 0, 0.05),
    0 6px 18px rgba(0, 0, 0, 0.10);
}
.btn:active {
  transform: translateY(0) scale(0.985);
  filter: brightness(0.97);
  box-shadow:
    inset 0 1px 2px rgba(0, 0, 0, 0.20),
    inset 0 -1px 0 var(--bevel);
}
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; filter: none !important; }
.btn svg { transition: transform .25s cubic-bezier(.2,.7,.3,1); }
.btn:hover svg { transform: scale(1.06); }

/* Copy buttons — color-coded by purpose */
.copy-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  margin-bottom: 18px;
}
.btn-copy { padding: 12px 16px; }
.btn-copy svg { opacity: 0.92; }
.btn-wide { grid-column: 1 / -1; }

/* Common refined inner highlight + sweep for all colour-coded copy buttons */
.btn-copy {
  overflow: hidden;
  isolation: isolate;
}
.btn-copy::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.10) 0%, rgba(255,255,255,0) 50%);
  pointer-events: none;
  border-radius: inherit;
}

/* Emerald — Copy Name */
.btn-copy-name {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.20), rgba(16, 185, 129, 0.08));
  border-color: rgba(16, 185, 129, 0.34);
  color: #10b981;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.18),
    inset 0 -1px 0 rgba(16, 185, 129, 0.18),
    0 1px 2px rgba(16, 185, 129, 0.08);
}
html[data-theme="dark"] .btn-copy-name { color: #6ee7b7; }
.btn-copy-name:hover {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.32), rgba(16, 185, 129, 0.16));
  border-color: rgba(16, 185, 129, 0.55);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.22),
    0 10px 28px rgba(16, 185, 129, 0.32),
    0 0 0 1px rgba(16, 185, 129, 0.18);
}
.btn-copy-name:focus-visible { outline-color: rgba(16, 185, 129, 0.7); }

/* Cyan — Copy Phone */
.btn-copy-phone {
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.20), rgba(34, 211, 238, 0.08));
  border-color: rgba(34, 211, 238, 0.34);
  color: #0891b2;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.18),
    inset 0 -1px 0 rgba(34, 211, 238, 0.18),
    0 1px 2px rgba(34, 211, 238, 0.08);
}
html[data-theme="dark"] .btn-copy-phone { color: #67e8f9; }
.btn-copy-phone:hover {
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.32), rgba(34, 211, 238, 0.16));
  border-color: rgba(34, 211, 238, 0.55);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.22),
    0 10px 28px rgba(34, 211, 238, 0.32),
    0 0 0 1px rgba(34, 211, 238, 0.18);
}
.btn-copy-phone:focus-visible { outline-color: rgba(34, 211, 238, 0.7); }

/* Aurora — Copy Full Address */
.btn-copy-address {
  background: linear-gradient(135deg,
    rgba(139, 92, 246, 0.22) 0%,
    rgba(236, 72, 153, 0.20) 50%,
    rgba(34, 211, 238, 0.22) 100%);
  border-color: rgba(236, 72, 153, 0.36);
  color: #6d28d9;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.18),
    inset 0 -1px 0 rgba(236, 72, 153, 0.18),
    0 1px 2px rgba(236, 72, 153, 0.08);
}
html[data-theme="dark"] .btn-copy-address { color: #d8caff; }
.btn-copy-address:hover {
  background: linear-gradient(135deg,
    rgba(139, 92, 246, 0.36) 0%,
    rgba(236, 72, 153, 0.34) 50%,
    rgba(34, 211, 238, 0.36) 100%);
  border-color: rgba(236, 72, 153, 0.6);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.25),
    0 12px 30px rgba(139, 92, 246, 0.32),
    0 0 22px rgba(236, 72, 153, 0.28);
}
.btn-copy-address:focus-visible { outline-color: rgba(236, 72, 153, 0.7); }

/* Briefly flashed when navigator.clipboard succeeds — emerald success tone. */
.btn-copy.copied {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.42), rgba(16, 185, 129, 0.18)) !important;
  border-color: rgba(16, 185, 129, 0.7) !important;
  color: #ffffff !important;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.30),
    0 12px 30px rgba(16, 185, 129, 0.42),
    0 0 0 1px rgba(16, 185, 129, 0.30) !important;
  transform: translateY(-1px) scale(1.012);
}

/* ---------- Footer actions: concentric rings + iridescent disc + Generate pill ---------- */
.footer-actions {
  position: relative;
  display: flex; flex-direction: column;
  justify-content: center; align-items: center;
  margin: 18px -28px 0;
  min-height: 105px;
  padding: 0 16px 16px;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(circle at center 30%, transparent 79px,  var(--ring-color) 79px,  var(--ring-color) 80px,  transparent 80px),
    radial-gradient(circle at center 30%, transparent 109px, var(--ring-color) 109px, var(--ring-color) 110px, transparent 110px),
    radial-gradient(circle at center 30%, transparent 139px, var(--ring-color) 139px, var(--ring-color) 140px, transparent 140px),
    radial-gradient(circle at center 30%, transparent 169px, var(--ring-color-dim) 169px, var(--ring-color-dim) 170px, transparent 170px),
    radial-gradient(circle at center 30%, transparent 199px, var(--ring-color-dim) 199px, var(--ring-color-dim) 200px, transparent 200px),
    radial-gradient(circle at center 30%, transparent 229px, var(--ring-color-dim) 229px, var(--ring-color-dim) 230px, transparent 230px);
  background-repeat: no-repeat;
}
html[data-theme="light"] .footer-actions {
  --ring-color:     rgba(139, 92, 246, 0.26);
  --ring-color-dim: rgba(236, 72, 153, 0.14);
  --btn-glow:       rgba(236, 72, 153, 0.45);
  --btn-glow-2:     rgba(139, 92, 246, 0.45);
}
html[data-theme="dark"] .footer-actions {
  --ring-color:     rgba(244, 114, 182, 0.28);
  --ring-color-dim: rgba(34, 211, 238, 0.14);
  --btn-glow:       rgba(236, 72, 153, 0.55);
  --btn-glow-2:     rgba(34, 211, 238, 0.45);
}

/* Iridescent jewel disc behind the button */
.footer-actions::before {
  content: '';
  position: absolute;
  left: 50%; top: 30%;
  transform: translate(-50%, -50%);
  width: 150px; height: 150px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, rgba(255,255,255,0.45) 0%, rgba(255,255,255,0) 38%),
    conic-gradient(from 200deg at 50% 50%,
      #8b5cf6 0%, #ec4899 25%, #f472b6 40%,
      #fbbf24 55%, #22d3ee 75%, #8b5cf6 100%);
  box-shadow:
    0 0 60px 18px var(--btn-glow),
    0 0 90px 30px var(--btn-glow-2),
    inset 0 -8px 18px rgba(0, 0, 0, 0.30),
    inset 0 4px 12px rgba(255, 255, 255, 0.30);
  z-index: -1;
  animation: jewel-spin 18s linear infinite;
}
@keyframes jewel-spin { to { transform: translate(-50%, -50%) rotate(360deg); } }

.footer-actions::after {
  content: '';
  position: absolute;
  left: 50%; top: 30%;
  transform: translate(-50%, -50%);
  width: 360px; height: 140px;
  border-radius: 80px;
  background:
    radial-gradient(45% 70% at 30% 50%, var(--btn-glow-2) 0%, transparent 70%),
    radial-gradient(45% 70% at 70% 50%, var(--btn-glow)   0%, transparent 70%);
  filter: blur(32px);
  opacity: 0.7;
  z-index: -2;
  pointer-events: none;
}

.btn-primary {
  position: relative; z-index: 2;
  display: inline-flex; align-items: center; justify-content: center; gap: 12px;
  padding: 14px 44px;
  min-width: 260px;
  margin-top: 16px;
  border-radius: 50px;
  background: linear-gradient(135deg, #8b5cf6 0%, #ec4899 50%, #22d3ee 100%);
  background-size: 220% 220%;
  background-position: 0% 50%;
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.24);
  font: inherit; font-size: 15px; font-weight: 600;
  letter-spacing: 0.4px;
  cursor: pointer;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.28);
  box-shadow:
    0 10px 28px rgba(139, 92, 246, 0.45),
    0 4px 14px rgba(236, 72, 153, 0.32),
    0 0 0 1px rgba(255, 255, 255, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.38),
    inset 0 -2px 8px rgba(0, 0, 0, 0.22);
  transition:
    background-position .6s cubic-bezier(.2,.7,.3,1),
    transform .22s cubic-bezier(.2,.7,.3,1),
    box-shadow .28s ease,
    filter .25s ease;
}
.btn-primary:hover {
  background-position: 100% 50%;
  transform: translateY(-2px);
  filter: brightness(1.06) saturate(1.05);
  box-shadow:
    0 16px 38px rgba(139, 92, 246, 0.58),
    0 8px 22px rgba(34, 211, 238, 0.40),
    0 0 0 1px rgba(255, 255, 255, 0.10),
    inset 0 1px 0 rgba(255, 255, 255, 0.45),
    inset 0 -2px 8px rgba(0, 0, 0, 0.22);
}
.btn-primary:active {
  transform: translateY(0) scale(0.985);
  filter: brightness(0.96);
  box-shadow:
    0 6px 16px rgba(139, 92, 246, 0.40),
    inset 0 2px 6px rgba(0, 0, 0, 0.30),
    inset 0 1px 0 rgba(255, 255, 255, 0.20);
}
.btn-primary:focus-visible {
  outline: 2px solid rgba(236, 72, 153, 0.75);
  outline-offset: 3px;
}
.btn-primary svg {
  stroke: currentColor; stroke-width: 2.3; opacity: 0.95;
  transition: transform .5s cubic-bezier(.2,.7,.3,1);
}
.btn-primary:hover svg { transform: rotate(-90deg); }

/* Reset rotation — now lives in its own row OUTSIDE the rings, so it must
   be readable at rest. Small refined ghost pill with a discreet danger tint
   on hover. */
.reset-row {
  display: flex; justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}
.btn-reset {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 7px;
  /* Push only the button row down — leaves the rings/disc layout untouched. */
  margin-top: 28px;
  padding: 8px 18px;
  font: inherit; font-size: 12px; font-weight: 500;
  letter-spacing: 0.02em;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-mute);
  border-radius: 999px;
  cursor: pointer;
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  box-shadow:
    inset 0 1px 0 var(--bevel),
    0 1px 2px rgba(0, 0, 0, 0.04);
  transition:
    color .2s ease,
    border-color .2s ease,
    background .2s ease,
    box-shadow .25s ease,
    transform .18s cubic-bezier(.2,.7,.3,1);
}
.btn-reset svg { opacity: 0.85; transition: transform .25s ease; }
.btn-reset:hover {
  color: #ff7a8a;
  border-color: rgba(255, 122, 138, 0.55);
  background: rgba(255, 122, 138, 0.08);
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 0 var(--bevel),
    0 6px 18px rgba(255, 122, 138, 0.22);
}
.btn-reset:hover svg { transform: rotate(-12deg); }
.btn-reset:active {
  transform: translateY(0) scale(0.97);
  background: rgba(255, 122, 138, 0.14);
}
.btn-reset:focus-visible {
  outline: 2px solid rgba(255, 122, 138, 0.6);
  outline-offset: 2px;
}

/* Backup / Restore — same chrome as .btn-reset, cyan accent on hover so it
   reads as utility (not danger). Selectors below use `.btn-backup` to override
   the danger-pink hover that `.btn-reset` defines. */
.btn-backup:hover {
  color: #67e8f9;
  border-color: rgba(34, 211, 238, 0.55);
  background: rgba(34, 211, 238, 0.08);
  box-shadow:
    inset 0 1px 0 var(--bevel),
    0 6px 18px rgba(34, 211, 238, 0.22);
}
html[data-theme="light"] .btn-backup:hover { color: #0891b2; }
.btn-backup:hover svg { transform: translateY(-1px); }
.btn-backup:active {
  background: rgba(34, 211, 238, 0.14);
}
.btn-backup:focus-visible {
  outline-color: rgba(34, 211, 238, 0.6);
}

@media (max-width: 540px) {
  .copy-row { grid-template-columns: 1fr; }
  .btn-wide { grid-column: auto; }
  .footer-actions { min-height: 95px; margin-left: -20px; margin-right: -20px; }
  .btn-primary { padding: 12px 30px; min-width: 0; }
}

/* ---------- Profile card ---------- */
.profile-card {
  margin-top: 4px;
  padding: 22px 24px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1), inset 0 1px 0 var(--bevel);
  backdrop-filter: var(--blur-strong);
  position: relative; overflow: hidden;
}
.profile-top { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.profile-avatar {
  width: 52px; height: 52px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #8b5cf6 0%, #ec4899 50%, #22d3ee 100%);
  color: #fff;
  font-family: var(--font-mono); font-weight: 700; font-size: 17px;
  letter-spacing: -0.02em;
  border: 2px solid rgba(255, 255, 255, 0.35);
  box-shadow:
    0 8px 22px rgba(139, 92, 246, 0.45),
    0 0 18px rgba(236, 72, 153, 0.30),
    inset 0 1px 2px rgba(255, 255, 255, 0.45);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  flex-shrink: 0;
}
.profile-meta { min-width: 0; }
.profile-name {
  font-size: 16px; font-weight: 700;
  color: var(--text);
  line-height: 1.2; letter-spacing: -0.005em;
}
.profile-role {
  font-size: 12px; color: var(--text-dim);
  margin-top: 3px; letter-spacing: 0.005em;
}
.profile-bio {
  font-size: 13px; line-height: 1.6;
  color: var(--text-dim);
  margin: 0 0 14px;
}
.profile-socials {
  display: flex; gap: 8px; flex-wrap: wrap;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.social-btn {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-dim);
  text-decoration: none;
  box-shadow: inset 0 1px 0 var(--bevel);
  transition: transform .15s, color .2s, background .2s, border-color .2s, box-shadow .2s;
}
.social-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
  border-color: rgba(124, 92, 255, 0.45);
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(124, 92, 255, 0.22);
}

/* ---------- Footer ---------- */
.app-footer {
  margin-top: 12px;
  text-align: center;
  font-size: 12.5px;
  color: var(--text-mute);
  display: flex; justify-content: center; gap: 8px; flex-wrap: wrap;
}
.app-footer .dot { opacity: 0.5; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%; bottom: 32px;
  transform: translateX(-50%) translateY(24px);
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border-strong);
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow-1), inset 0 1px 0 var(--bevel);
  opacity: 0; pointer-events: none;
  z-index: 100;
  backdrop-filter: var(--blur);
  transition: opacity .2s, transform .2s;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---------- Admin modal (kept; restyled) ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(10, 6, 28, 0.55);
  backdrop-filter: blur(8px);
  display: grid; place-items: center;
  padding: 20px;
  animation: modal-fade .18s ease;
}
.modal-backdrop[hidden] { display: none; }
@keyframes modal-fade { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 26px 24px 22px;
  width: 100%; max-width: 380px;
  box-shadow: var(--shadow-2), inset 0 1px 0 var(--bevel);
  backdrop-filter: var(--blur-strong);
  animation: modal-pop .22s cubic-bezier(.2,.7,.3,1.05);
}
@keyframes modal-pop {
  from { transform: translateY(8px) scale(.98); opacity: 0; }
  to   { transform: none; opacity: 1; }
}
.modal h3 {
  margin: 0 0 6px;
  font-size: 17px; font-weight: 700;
  color: var(--text);
}
.modal-sub {
  margin: 0 0 16px;
  font-size: 13px;
  color: var(--text-dim);
}
.modal input[type="password"], .modal input[type="text"] {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font: inherit; font-size: 14px;
  margin-bottom: 12px;
  outline: none;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.modal input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.22);
}
.modal-actions {
  display: flex; gap: 10px; justify-content: center;
  margin-top: 6px;
}
.modal-actions .btn {
  min-width: 120px;
  padding: 11px 20px;
  font-size: 13px; font-weight: 600;
  letter-spacing: 0.02em;
}
/* Cancel / secondary modal button — slightly more refined than the page-level .btn */
.modal-actions .btn:not([class*="btn-copy"]) {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text-dim);
}
.modal-actions .btn:not([class*="btn-copy"]):hover {
  color: var(--text);
  background: var(--surface-hover);
  border-color: var(--border-strong);
}

.modal-link {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 4px;
  width: 100%;
  margin-top: 8px;
  padding: 7px 0;
  background: transparent; border: none;
  color: var(--text-mute);
  font: inherit; font-size: 12px; font-weight: 500;
  letter-spacing: 0.01em;
  text-align: center;
  cursor: pointer;
  border-radius: 8px;
  transition: color .2s ease, background .2s ease, transform .2s cubic-bezier(.2,.7,.3,1);
}
.modal-link:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}
html[data-theme="light"] .modal-link:hover { background: rgba(15, 23, 42, 0.04); }
.modal-link:active { transform: scale(0.98); }
/* Animate the trailing arrow on hover */
.modal-link::after {
  content: ''; display: inline-block; width: 0; opacity: 0;
  transition: width .2s ease, opacity .2s ease, transform .2s ease;
}
.modal-link:hover { letter-spacing: 0.02em; }

/* Backup / Restore section */
.backup-section {
  margin-bottom: 16px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.backup-section:last-child { margin-bottom: 0; }
.backup-section-label {
  font-family: var(--font-mono);
  font-size: 9px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--text-mute);
  margin-bottom: 10px;
}
.backup-section .btn { width: 100%; }
.backup-section .btn[data-action="pick-file"] {
  margin-bottom: 10px;
  justify-content: flex-start; gap: 10px;
}
.backup-section .btn[data-action="pick-file"] span {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  flex: 1; min-width: 0; text-align: left;
  font-weight: 500;
}
.backup-section .modal-actions { margin-top: 10px; }

/* ---------- User chip (header) ---------- */
.user-chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 13px;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.18), rgba(34, 211, 238, 0.12));
  border: 1px solid rgba(139, 92, 246, 0.40);
  border-radius: 999px;
  font-size: 12px; font-weight: 600;
  color: var(--text);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.18),
    0 4px 14px rgba(139, 92, 246, 0.18);
  max-width: 160px;
  overflow: hidden;
}
.user-chip svg { color: #c9b8ff; flex-shrink: 0; }
html[data-theme="light"] .user-chip svg { color: #6d28d9; }
.user-chip span {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  letter-spacing: 0.01em;
}

/* ---------- Switch user button (in reset-row) ---------- */
.btn-switch-user:hover {
  color: #c9b8ff;
  border-color: rgba(139, 92, 246, 0.55);
  background: rgba(139, 92, 246, 0.08);
  box-shadow:
    inset 0 1px 0 var(--bevel),
    0 6px 18px rgba(139, 92, 246, 0.22);
}
html[data-theme="light"] .btn-switch-user:hover { color: #6d28d9; }
.btn-switch-user:active { background: rgba(139, 92, 246, 0.14); }
.btn-switch-user:focus-visible { outline-color: rgba(139, 92, 246, 0.6); }
.btn-switch-user:hover svg { transform: scale(1.06); }

/* ---------- User-modal: list of saved users ---------- */
.user-list {
  display: flex; flex-direction: column; gap: 7px;
  margin-bottom: 10px;
  max-height: 220px; overflow-y: auto;
}
.user-list-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  font-size: 14px; font-weight: 500;
  color: var(--text);
  transition:
    background .18s ease,
    border-color .18s ease,
    transform .18s cubic-bezier(.2,.7,.3,1),
    box-shadow .25s ease;
}
.user-list-item:hover {
  background: var(--surface-hover);
  border-color: rgba(139, 92, 246, 0.45);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(139, 92, 246, 0.18);
}
.user-list-item.current {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.16), rgba(34, 211, 238, 0.08));
  border-color: rgba(139, 92, 246, 0.55);
}
.user-list-name {
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.user-list-badge {
  font-family: var(--font-mono);
  font-size: 9px; font-weight: 700; letter-spacing: 0.12em;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(139, 92, 246, 0.20);
  color: var(--chip-fg);
  border: 1px solid rgba(139, 92, 246, 0.35);
  flex-shrink: 0;
}
.user-list-item:not(.current) .user-list-badge {
  background: rgba(127, 127, 127, 0.10);
  color: var(--text-mute);
  border-color: var(--border);
}
.user-list-divider {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 9px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.16em;
  color: var(--text-mute);
  margin: 12px 0 10px;
  position: relative;
}
.user-list-divider::before, .user-list-divider::after {
  content: ''; position: absolute; top: 50%;
  width: 30%; height: 1px;
  background: var(--border-strong);
}
.user-list-divider::before { left: 0; }
.user-list-divider::after  { right: 0; }

#user-modal input[type="text"] {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font: inherit; font-size: 14px;
  margin-bottom: 12px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
#user-modal input[type="text"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.22);
}

@media (max-width: 540px) {
  .user-chip { max-width: 110px; font-size: 11.5px; padding: 6px 10px; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .footer-actions::before, .track-fill, .status-dot,
  .btn, .btn-primary, .social-btn { animation: none !important; transition: none !important; }
}
