/* === PassPhrase v22 — Designed by Sky === */
/* Deep security aesthetic with glassmorphism & cyber glow */
/* v6: generate blur→reveal, copy glow, crossfade tabs */
/* v7: PWA install banner, Space shortcut, remember settings */
/* v8: phonetic hint, crack estimate, compare mode */
/* v9: VISUAL IDENTITY — security color system, shield glow, generate animation, glassmorphism cards */
/* v12: generate click sound, password length recommendation, entropy visualization */

/* Google Fonts loaded via preload in index.html */

/* === Dark theme (default) — deep security gradient === */
:root {
  --bg:              #0a0e17;
  --bg-gradient:     linear-gradient(145deg, #0a0e17 0%, #0d1520 30%, #0f1923 60%, #0a1628 100%);
  --bg-elevated:     rgba(20, 30, 48, 0.6);
  --bg-tertiary:     rgba(40, 55, 80, 0.5);
  --glass-border:    rgba(0, 255, 200, 0.08);
  --glass-shine:     rgba(255, 255, 255, 0.03);
  --text-primary:    #e8ecf4;
  --text-secondary:  #8a9bb5;
  --text-muted:      #5a6a82;
  --accent:          #00D4AA;
  --accent-rgb:      0, 212, 170;
  --accent-bg:       rgba(0, 212, 170, 0.1);
  --accent-glow:     0 0 20px rgba(0, 212, 170, 0.15);
  --secondary:       #3B82F6;
  --secondary-rgb:   59, 130, 246;
  --green:           #22C55E;
  --green-rgb:       34, 197, 94;
  --red:             #EF4444;
  --red-rgb:         239, 68, 68;
  --orange:          #F59E0B;
  --yellow:          #EAB308;
  --purple:          #A855F7;
  --cyan:            #00D4AA;
  --gray:            rgba(100, 120, 150, 0.3);

  /* Shield level colors — 5 distinct strength tiers */
  --shield-1:        #EF4444;
  --shield-2:        #F59E0B;
  --shield-3:        #EAB308;
  --shield-4:        #22C55E;
  --shield-5:        #A855F7;

  /* Shield glow intensities per level */
  --shield-glow-1:   0 0 8px rgba(239, 68, 68, 0.3);
  --shield-glow-2:   0 0 12px rgba(245, 158, 11, 0.35);
  --shield-glow-3:   0 0 14px rgba(234, 179, 8, 0.35);
  --shield-glow-4:   0 0 18px rgba(34, 197, 94, 0.4);
  --shield-glow-5:   0 0 24px rgba(168, 85, 247, 0.5);

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

  --app-max-width:   420px;
  --tap-target:      44px;
  --btn-height:      48px;
  --btn-radius:      24px;

  --spacing-xs:      4px;
  --spacing-sm:      8px;
  --spacing-md:      16px;
  --spacing-lg:      24px;
  --spacing-xl:      32px;

  --ease-out:        cubic-bezier(0.25, 0.1, 0.25, 1);
  --ease-spring:     cubic-bezier(0.34, 1.56, 0.64, 1);
  --duration-fast:   150ms;
  --duration-med:    300ms;
  --duration-slow:   500ms;

  --shield-color:    var(--shield-1);
  --shield-glow:     none;

  --history-width:   320px;

  --glass-blur:      16px;
  --glass-bg:        rgba(15, 25, 40, 0.65);
  --glass-border-c:  rgba(0, 212, 170, 0.1);
}

/* === Light theme === */
[data-theme="light"] {
  --bg:              #f0f2f5;
  --bg-gradient:     linear-gradient(145deg, #e8ecf2 0%, #f0f2f5 30%, #e5e9f0 60%, #f0f4f8 100%);
  --bg-elevated:     rgba(255, 255, 255, 0.7);
  --bg-tertiary:     rgba(200, 210, 225, 0.5);
  --glass-border:    rgba(0, 180, 150, 0.12);
  --glass-shine:     rgba(255, 255, 255, 0.5);
  --text-primary:    #1a2030;
  --text-secondary:  #5a6580;
  --text-muted:      #7a859a;
  --accent:          #00a885;
  --accent-rgb:      0, 168, 133;
  --accent-bg:       rgba(0, 168, 133, 0.08);
  --accent-glow:     0 0 20px rgba(0, 168, 133, 0.1);
  --secondary:       #2563EB;
  --secondary-rgb:   37, 99, 235;
  --green:           #16A34A;
  --green-rgb:       22, 163, 74;
  --red:             #DC2626;
  --red-rgb:         220, 38, 38;
  --gray:            rgba(150, 165, 185, 0.3);
  --yellow:          #b8860b;
  --shield-3:        #b8860b;
  --glass-blur:      12px;
  --glass-bg:        rgba(255, 255, 255, 0.6);
  --glass-border-c:  rgba(0, 168, 133, 0.15);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg:              #f0f2f5;
    --bg-gradient:     linear-gradient(145deg, #e8ecf2 0%, #f0f2f5 30%, #e5e9f0 60%, #f0f4f8 100%);
    --bg-elevated:     rgba(255, 255, 255, 0.7);
    --bg-tertiary:     rgba(200, 210, 225, 0.5);
    --glass-border:    rgba(0, 180, 150, 0.12);
    --glass-shine:     rgba(255, 255, 255, 0.5);
    --text-primary:    #1a2030;
    --text-secondary:  #5a6580;
    --text-muted:      #7a859a;
    --accent:          #00a885;
    --accent-rgb:      0, 168, 133;
    --accent-bg:       rgba(0, 168, 133, 0.08);
    --accent-glow:     0 0 20px rgba(0, 168, 133, 0.1);
    --secondary:       #2563EB;
    --secondary-rgb:   37, 99, 235;
    --green:           #16A34A;
    --green-rgb:       22, 163, 74;
    --red:             #DC2626;
    --red-rgb:         220, 38, 38;
    --gray:            rgba(150, 165, 185, 0.3);
    --yellow:          #b8860b;
    --shield-3:        #b8860b;
    --glass-blur:      12px;
    --glass-bg:        rgba(255, 255, 255, 0.6);
    --glass-border-c:  rgba(0, 168, 133, 0.15);
  }
}

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

body {
  background: var(--bg);
  background-image: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text-primary);
  font-family: var(--font-sans);
  display: flex;
  justify-content: center;
  min-height: 100dvh;
  padding: var(--spacing-md);
  padding-bottom: calc(var(--spacing-md) + env(safe-area-inset-bottom, 0px));
  -webkit-font-smoothing: antialiased;
  transition: background var(--duration-med) var(--ease-out),
              color var(--duration-med) var(--ease-out);
  position: relative;
  overflow-x: hidden;
}

/* v9: Deep background with subtle teal radial glows */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(ellipse 600px 400px at 15% 20%, rgba(var(--accent-rgb), 0.07) 0%, transparent 70%),
    radial-gradient(ellipse 500px 500px at 85% 75%, rgba(var(--secondary-rgb), 0.05) 0%, transparent 70%),
    radial-gradient(ellipse 400px 300px at 50% 50%, rgba(var(--accent-rgb), 0.03) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
  animation: bg-glow-drift 20s ease-in-out infinite alternate;
}

@keyframes bg-glow-drift {
  0%   { opacity: 0.8; }
  50%  { opacity: 1; }
  100% { opacity: 0.85; }
}

/* === App container === */
.app {
  width: 100%;
  max-width: var(--app-max-width);
  padding: var(--spacing-md);
  position: relative;
  z-index: 1;
}

/* === Glassmorphism mixin via shared styles === */
.password-display,
.settings,
.checker,
.tabs,
.copy-toast,
.history-panel,
.confirm-dialog,
.shield-label {
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border-c);
  box-shadow:
    0 4px 24px rgba(0, 0, 0, 0.12),
    inset 0 1px 0 var(--glass-shine);
}

/* === Header (sticky) === */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--spacing-lg);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: var(--spacing-sm) var(--spacing-md);
  margin-left: calc(-1 * var(--spacing-md));
  margin-right: calc(-1 * var(--spacing-md));
  margin-top: calc(-1 * var(--spacing-md));
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border-bottom: 1px solid var(--glass-border-c);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
}

.header__title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--green) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header__actions {
  display: flex;
  gap: var(--spacing-sm);
}

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--tap-target);
  height: var(--tap-target);
  border-radius: 50%;
  border: 1px solid var(--glass-border-c);
  background: var(--glass-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}

.icon-btn:hover,
.icon-btn:focus-visible {
  background: var(--accent-bg);
  color: var(--accent);
  border-color: rgba(var(--accent-rgb), 0.3);
  box-shadow: 0 0 16px rgba(var(--accent-rgb), 0.15);
  transform: translateY(-1px);
}

.icon-btn:active {
  transform: translateY(0) scale(0.95);
}

/* === Tabs (Phrase / Classic / PIN) === */
.tabs {
  display: flex;
  gap: var(--spacing-xs);
  background: var(--glass-bg);
  border-radius: 14px;
  padding: 4px;
  margin-bottom: var(--spacing-lg);
}

.tab {
  flex: 1;
  padding: 10px 0;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--duration-med) var(--ease-out);
  -webkit-tap-highlight-color: transparent;
  position: relative;
}

.tab:hover:not(.active) {
  color: var(--text-primary);
  background: rgba(var(--accent-rgb), 0.08);
  transform: translateY(-1px);
}

.tab.active {
  background: linear-gradient(135deg, var(--accent) 0%, var(--secondary) 100%);
  color: #FFFFFF;
  box-shadow: 0 2px 16px rgba(var(--accent-rgb), 0.35), 0 0 20px rgba(var(--secondary-rgb), 0.15);
  transform: translateY(-1px);
}

/* === Password display === */
.password-display {
  background: var(--glass-bg);
  border-radius: 20px;
  padding: var(--spacing-lg) var(--spacing-md);
  margin-bottom: var(--spacing-lg);
  text-align: center;
  min-height: 110px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

/* Subtle scan-line effect */
.password-display::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(var(--accent-rgb), 0.015) 2px,
    rgba(var(--accent-rgb), 0.015) 4px
  );
  pointer-events: none;
  border-radius: 20px;
}

.password-text {
  font-family: var(--font-mono);
  font-size: 30px;
  font-weight: 600;
  line-height: 1.5;
  word-break: break-all;
  color: var(--text-primary);
  min-height: 1.5em;
  user-select: all;
  -webkit-user-select: all;
  text-shadow: 0 0 20px rgba(var(--accent-rgb), 0.25);
  animation: password-reveal 0.5s var(--ease-out);
  position: relative;
  z-index: 1;
}

@keyframes password-reveal {
  0% {
    opacity: 0;
    filter: blur(12px);
    transform: scale(0.92);
  }
  40% {
    opacity: 0.6;
    filter: blur(4px);
    transform: scale(0.98);
  }
  100% {
    opacity: 1;
    filter: blur(0);
    transform: scale(1);
  }
}

/* v6: Generate unlock animation */
@keyframes generate-unlock {
  0%   { filter: blur(10px); opacity: 0.3; }
  30%  { filter: blur(6px);  opacity: 0.5; }
  60%  { filter: blur(2px);  opacity: 0.8; }
  100% { filter: blur(0);    opacity: 1;   }
}

.password-text--unlocking {
  animation: generate-unlock 0.5s var(--ease-out) both;
}

/* v6: Password display flash on generate */
@keyframes display-flash {
  0%   { border-color: var(--glass-border-c); box-shadow: 0 4px 24px rgba(0,0,0,0.12), inset 0 1px 0 var(--glass-shine); }
  40%  { border-color: rgba(var(--accent-rgb), 0.4); box-shadow: 0 4px 24px rgba(0,0,0,0.12), 0 0 30px rgba(var(--accent-rgb), 0.15), inset 0 1px 0 var(--glass-shine); }
  100% { border-color: var(--glass-border-c); box-shadow: 0 4px 24px rgba(0,0,0,0.12), inset 0 1px 0 var(--glass-shine); }
}

.password-display--flash {
  animation: display-flash 0.6s var(--ease-out);
}

/* Typewriter cursor */
.password-text--typing::after {
  content: '|';
  animation: blink-cursor 0.6s step-end infinite;
  color: var(--accent);
  font-weight: 300;
  text-shadow: 0 0 8px rgba(var(--accent-rgb), 0.5);
}

@keyframes blink-cursor {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* === Shield === */
.shield-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: var(--spacing-lg);
  gap: var(--spacing-sm);
}

.shield {
  width: 64px;
  height: 72px;
  position: relative;
  transition: filter var(--duration-med) var(--ease-out);
  filter: var(--shield-glow);
}

.shield svg {
  width: 100%;
  height: 100%;
  transition: all var(--duration-med) var(--ease-out);
}

.shield__base { fill: var(--shield-color); opacity: 0.15; transition: all var(--duration-med) var(--ease-out); }
.shield__outline { fill: none; stroke: var(--shield-color); stroke-width: 1.5; transition: all var(--duration-med) var(--ease-out); }
.shield__icon { fill: var(--shield-color); transition: all var(--duration-med) var(--ease-out); }

/* Shield cracks for level 1 */
.shield__crack {
  stroke: var(--shield-color);
  stroke-width: 1.2;
  fill: none;
  opacity: 0;
  transition: opacity var(--duration-med) var(--ease-out);
}

.shield[data-level="1"] .shield__crack { opacity: 0.7; }
.shield[data-level="1"] .shield__base { opacity: 0.08; }

/* Shield sword for level 4+ */
.shield__sword {
  opacity: 0;
  transform: translateY(4px);
  transition: all var(--duration-med) var(--ease-out);
}

.shield[data-level="4"] .shield__sword,
.shield[data-level="5"] .shield__sword {
  opacity: 1;
  transform: translateY(0);
}

/* Shield crown for level 5 */
.shield__crown {
  opacity: 0;
  transform: translateY(4px);
  transition: all var(--duration-med) var(--ease-out);
}

.shield[data-level="5"] .shield__crown {
  opacity: 1;
  transform: translateY(0);
}

/* v9: Shield glow per level — distinct color + intensity */
.shield[data-level="1"] {
  filter: drop-shadow(0 0 6px rgba(239, 68, 68, 0.25));
}

.shield[data-level="2"] {
  filter: drop-shadow(0 0 10px rgba(245, 158, 11, 0.3));
}

.shield[data-level="3"] {
  filter: drop-shadow(0 0 12px rgba(234, 179, 8, 0.35));
}

.shield[data-level="4"] {
  filter: drop-shadow(0 0 16px rgba(34, 197, 94, 0.4));
  animation: shield-glow-green 2.5s ease-in-out infinite alternate;
}

@keyframes shield-glow-green {
  from { filter: drop-shadow(0 0 12px rgba(34, 197, 94, 0.3)); }
  to   { filter: drop-shadow(0 0 22px rgba(34, 197, 94, 0.55)); }
}

.shield[data-level="5"] {
  filter: drop-shadow(0 0 20px rgba(168, 85, 247, 0.5));
  animation: shield-glow-legendary 2s ease-in-out infinite alternate;
}

@keyframes shield-glow-legendary {
  from { filter: drop-shadow(0 0 14px rgba(168, 85, 247, 0.4)); }
  to   { filter: drop-shadow(0 0 28px rgba(168, 85, 247, 0.7)); }
}

/* v9: Pulsing animation on shield when strong (level 4-5) */
.shield[data-level="4"] svg,
.shield[data-level="5"] svg {
  animation: shield-breathe 3s ease-in-out infinite;
}

@keyframes shield-breathe {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.04); }
}

/* Level pulse animation on change */
.shield--pulse {
  animation: shield-pulse 0.5s var(--ease-spring);
}

@keyframes shield-pulse {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.18); }
  100% { transform: scale(1); }
}

.shield-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--shield-color);
  background: var(--glass-bg);
  padding: 6px 18px;
  border-radius: 20px;
  transition: color var(--duration-med) var(--ease-out),
              background var(--duration-med) var(--ease-out);
}

.shield-time {
  font-size: 13px;
  color: var(--text-secondary);
  text-align: center;
}

/* === Action buttons === */
.actions {
  display: flex;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-lg);
}

.btn {
  flex: 1;
  height: var(--btn-height);
  border: none;
  border-radius: var(--btn-radius);
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
  transition: all var(--duration-fast) var(--ease-out);
  -webkit-tap-highlight-color: transparent;
  position: relative;
  overflow: hidden;
}

/* Button ripple hover */
.btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at var(--x, 50%) var(--y, 50%), rgba(255,255,255,0.15), transparent 60%);
  opacity: 0;
  transition: opacity var(--duration-fast) var(--ease-out);
  pointer-events: none;
}

.btn:hover::before {
  opacity: 1;
}

.btn--primary {
  background: linear-gradient(135deg, var(--accent), rgba(var(--green-rgb), 0.85));
  color: #FFFFFF;
  height: 56px;
  font-size: 17px;
  box-shadow: 0 4px 20px rgba(var(--accent-rgb), 0.3);
}

.btn--primary:hover {
  box-shadow: 0 6px 28px rgba(var(--accent-rgb), 0.45);
  transform: translateY(-1px);
}

.btn--primary:active {
  transform: scale(0.93) translateY(0);
  box-shadow: 0 2px 12px rgba(var(--accent-rgb), 0.25);
  transition: transform 80ms ease-out, box-shadow 80ms ease-out;
}

/* v9: Generate button ripple animation */
@keyframes generate-ripple {
  0%   { transform: scale(0.93); box-shadow: 0 0 0 0 rgba(var(--accent-rgb), 0.4); }
  40%  { transform: scale(1.02); box-shadow: 0 0 0 12px rgba(var(--accent-rgb), 0); }
  100% { transform: scale(1); box-shadow: 0 4px 20px rgba(var(--accent-rgb), 0.3); }
}

.btn--primary.btn--generating {
  animation: generate-ripple 0.5s var(--ease-spring);
}

.btn--secondary {
  background: var(--glass-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--text-primary);
  border: 1.5px solid var(--gray);
}

.btn--secondary:hover {
  border-color: rgba(var(--accent-rgb), 0.4);
  background: var(--accent-bg);
  box-shadow: 0 0 16px rgba(var(--accent-rgb), 0.1);
  transform: translateY(-1px);
}

.btn--secondary:active {
  transform: scale(0.97) translateY(0);
}

/* Copy button states */
.btn__icon-copy,
.btn__icon-check { transition: all var(--duration-fast) var(--ease-out); }
.btn--copied .btn__icon-copy { display: none; }
.btn--copied .btn__icon-check { display: inline; }
.btn:not(.btn--copied) .btn__icon-check { display: none; }

.btn--copied {
  background: var(--green) !important;
  border-color: var(--green) !important;
  color: #FFFFFF !important;
  box-shadow: 0 4px 20px rgba(var(--green-rgb), 0.35) !important;
  animation: copy-flash 0.4s var(--ease-spring);
}

@keyframes copy-flash {
  0% { transform: scale(1); }
  30% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

/* v6: Copy confirmation green glow */
@keyframes copy-glow {
  0%   { box-shadow: 0 0 0 rgba(var(--green-rgb), 0); }
  30%  { box-shadow: 0 0 24px rgba(var(--green-rgb), 0.4), 0 0 48px rgba(var(--green-rgb), 0.15); }
  100% { box-shadow: 0 4px 20px rgba(var(--green-rgb), 0.35); }
}

.btn--copied {
  animation: copy-flash 0.4s var(--ease-spring), copy-glow 0.6s var(--ease-out);
}

/* v6: Copy confirmation green glow on password container */
@keyframes container-copy-glow {
  0%   { border-color: var(--glass-border-c); box-shadow: 0 4px 24px rgba(0,0,0,0.12), inset 0 1px 0 var(--glass-shine); }
  25%  { border-color: rgba(var(--green-rgb), 0.5); box-shadow: 0 4px 24px rgba(0,0,0,0.12), 0 0 24px rgba(var(--green-rgb), 0.3), 0 0 48px rgba(var(--green-rgb), 0.1), inset 0 1px 0 var(--glass-shine); }
  100% { border-color: var(--glass-border-c); box-shadow: 0 4px 24px rgba(0,0,0,0.12), inset 0 1px 0 var(--glass-shine); }
}

.password-display--copy-glow {
  animation: container-copy-glow 1.5s var(--ease-out);
}

/* v6: Copy toast green glow pulse */
.copy-toast.show {
  box-shadow:
    0 8px 32px rgba(0,0,0,0.25),
    0 0 24px rgba(var(--green-rgb), 0.2),
    0 0 48px rgba(var(--green-rgb), 0.08);
  border-color: rgba(var(--green-rgb), 0.35);
}

/* v6: Mode switch crossfade (0.2s) */
.settings {
  transition: opacity 0.2s var(--ease-out), transform 0.2s var(--ease-out);
}

.settings--fade-out {
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
}

.settings--fade-in {
  animation: settings-fade-in 0.2s var(--ease-out) both;
}

@keyframes settings-fade-in {
  0%   { opacity: 0; transform: translateY(8px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* === Settings panel — v9: enhanced glassmorphism === */
.settings {
  background: var(--glass-bg);
  border-radius: 20px;
  padding: var(--spacing-md);
  margin-bottom: var(--spacing-lg);
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
  border: 1px solid var(--glass-border-c);
  box-shadow:
    0 4px 24px rgba(0, 0, 0, 0.12),
    inset 0 1px 0 var(--glass-shine),
    inset 0 0 0 1px rgba(var(--accent-rgb), 0.03);
  transition: border-color var(--duration-med) var(--ease-out),
              box-shadow var(--duration-med) var(--ease-out),
              opacity 0.2s var(--ease-out),
              transform 0.2s var(--ease-out);
}

.settings:hover {
  border-color: rgba(var(--accent-rgb), 0.15);
  box-shadow:
    0 4px 24px rgba(0, 0, 0, 0.15),
    0 0 20px rgba(var(--accent-rgb), 0.06),
    inset 0 1px 0 var(--glass-shine);
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--tap-target);
}

.setting-label {
  font-size: 14px;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.setting-options {
  display: flex;
  gap: var(--spacing-xs);
  flex-wrap: wrap;
  justify-content: flex-end;
}

.setting-chip {
  height: 32px;
  padding: 0 14px;
  border-radius: 16px;
  border: 1.5px solid var(--gray);
  background: transparent;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}

.setting-chip:hover,
.setting-chip:focus-visible {
  border-color: rgba(var(--accent-rgb), 0.5);
  background: var(--accent-bg);
  transform: translateY(-1px);
}

.setting-chip.active {
  background: linear-gradient(135deg, var(--accent), var(--secondary));
  border-color: transparent;
  color: #FFFFFF;
  font-weight: 600;
  box-shadow: 0 2px 12px rgba(var(--accent-rgb), 0.3);
}

/* Toggle switch */
.toggle {
  position: relative;
  width: 48px;
  height: 28px;
  border-radius: 14px;
  background: var(--gray);
  border: none;
  cursor: pointer;
  transition: all var(--duration-med) var(--ease-out);
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}

.toggle::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #FFFFFF;
  transition: transform var(--duration-med) var(--ease-spring),
              box-shadow var(--duration-med) var(--ease-out);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.toggle:hover::after {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.toggle.active {
  background: linear-gradient(135deg, var(--accent), var(--secondary));
  box-shadow: 0 0 14px rgba(var(--accent-rgb), 0.25), 0 0 6px rgba(var(--secondary-rgb), 0.15);
}

.toggle.active::after {
  transform: translateX(20px);
  box-shadow: 0 2px 10px rgba(var(--accent-rgb), 0.35);
}

/* Slider (for Classic mode length) */
.slider-row {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

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

.slider-value {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 600;
  color: var(--accent);
  min-width: 28px;
  text-align: right;
  text-shadow: 0 0 10px rgba(var(--accent-rgb), 0.3);
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--bg-tertiary);
  outline: none;
  transition: background var(--duration-fast) var(--ease-out);
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--secondary));
  cursor: pointer;
  border: 2px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 2px 8px rgba(var(--accent-rgb), 0.35), 0 0 12px rgba(var(--accent-rgb), 0.2);
  transition: box-shadow var(--duration-fast) var(--ease-out),
              transform var(--duration-fast) var(--ease-out);
}

input[type="range"]::-webkit-slider-thumb:hover {
  box-shadow: 0 2px 16px rgba(var(--accent-rgb), 0.5), 0 0 20px rgba(var(--accent-rgb), 0.3);
  transform: scale(1.15);
}

input[type="range"]::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--green));
  cursor: pointer;
  border: 2px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 2px 8px rgba(var(--accent-rgb), 0.35);
}

/* === History panel (slide from right) === */
.history-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--duration-med) var(--ease-out);
}

.history-overlay.open {
  pointer-events: auto;
  opacity: 1;
}

.history-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.history-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: var(--history-width);
  max-width: 85vw;
  height: 100%;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border-left: 1px solid var(--glass-border-c);
  padding: var(--spacing-lg);
  padding-top: calc(var(--spacing-lg) + env(safe-area-inset-top, 0px));
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform var(--duration-med) var(--ease-out);
  display: flex;
  flex-direction: column;
}

.history-overlay.open .history-panel {
  transform: translateX(0);
}

.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--spacing-lg);
  flex-shrink: 0;
}

.history-header__title {
  font-size: 18px;
  font-weight: 700;
}

.history-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--glass-border-c);
  background: var(--glass-bg);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 18px;
  transition: all var(--duration-fast) var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}

.history-close:hover {
  background: var(--accent-bg);
  color: var(--accent);
  border-color: rgba(var(--accent-rgb), 0.3);
}

.history-list {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  overflow-y: auto;
}

.history-item {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border-c);
  border-radius: 14px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color var(--duration-fast) var(--ease-out);
}

.history-item:hover {
  border-color: rgba(var(--accent-rgb), 0.25);
}

.history-item__password {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-primary);
  word-break: break-all;
  cursor: pointer;
  transition: color var(--duration-fast) var(--ease-out);
}

.history-item__password--hidden {
  color: var(--text-muted);
  letter-spacing: 2px;
}

.history-item__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.history-item__date {
  font-size: 11px;
  color: var(--text-muted);
}

.history-item__copy {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}

.history-item__copy:hover {
  background: var(--accent-bg);
  color: var(--accent);
}

.history-item__copy--done { color: var(--green) !important; }

.history-footer {
  flex-shrink: 0;
  padding-top: var(--spacing-md);
  border-top: 1px solid var(--glass-border-c);
  margin-top: var(--spacing-md);
}

.history-warning {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: var(--spacing-sm);
}

.btn--danger {
  width: 100%;
  height: 40px;
  border: 1.5px solid var(--red);
  border-radius: 20px;
  background: transparent;
  color: var(--red);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}

.btn--danger:hover {
  background: rgba(255, 71, 87, 0.12);
  box-shadow: 0 0 16px rgba(255, 71, 87, 0.15);
  transform: translateY(-1px);
}

.history-empty {
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
  padding: var(--spacing-xl) 0;
}

/* === Confirm dialog === */
.confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-fast) var(--ease-out);
}

.confirm-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.confirm-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.confirm-dialog {
  position: relative;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border-c);
  border-radius: 20px;
  padding: var(--spacing-lg);
  width: 100%;
  max-width: 300px;
  text-align: center;
  transform: scale(0.9);
  transition: transform var(--duration-med) var(--ease-spring);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.3);
}

.confirm-overlay.open .confirm-dialog {
  transform: scale(1);
}

.confirm-dialog__text {
  font-size: 15px;
  margin-bottom: var(--spacing-md);
  color: var(--text-primary);
}

.confirm-dialog__actions {
  display: flex;
  gap: var(--spacing-sm);
}

.confirm-dialog__actions .btn {
  font-size: 14px;
  height: 40px;
  border-radius: 20px;
}

/* === Focus visible (v6: all interactive elements) === */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

input[type="range"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn--primary:focus-visible {
  outline: 2px solid #FFF;
  outline-offset: 3px;
  box-shadow: 0 0 0 5px rgba(var(--accent-rgb), 0.25),
              0 4px 20px rgba(var(--accent-rgb), 0.3);
}

.btn--secondary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(var(--accent-rgb), 0.15);
}

.tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  box-shadow: 0 0 0 4px rgba(var(--accent-rgb), 0.15);
}

.setting-chip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(var(--accent-rgb), 0.12);
}

.icon-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.history-close:focus-visible,
.checker__eye:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.history-item__copy:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.history-item__password:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

.copy-toast__keep:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

.btn--danger:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(255, 71, 87, 0.15);
}

.checker__input:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.15),
              0 0 16px rgba(var(--accent-rgb), 0.15);
}

.custom-words__input:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.15);
}

/* === PWA Install Banner (v7) === */
.pwa-install-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 250;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border-top: 1px solid var(--glass-border-c);
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.15);
  padding: 14px var(--spacing-md);
  padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  display: flex;
  align-items: center;
  gap: 12px;
  transform: translateY(100%);
  transition: transform var(--duration-med) var(--ease-out);
}

.pwa-install-banner.show {
  transform: translateY(0);
}

.pwa-install-banner__icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), rgba(var(--green-rgb), 0.85));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(var(--accent-rgb), 0.25);
}

.pwa-install-banner__icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: #fff;
  stroke-width: 2;
  stroke-linecap: round;
}

.pwa-install-banner__text {
  flex: 1;
  min-width: 0;
}

.pwa-install-banner__title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.pwa-install-banner__sub {
  font-size: 12px;
  color: var(--text-secondary);
}

.pwa-install-banner__btn {
  height: 34px;
  padding: 0 16px;
  border-radius: 17px;
  border: none;
  background: linear-gradient(135deg, var(--accent), rgba(var(--green-rgb), 0.85));
  color: #fff;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
  transition: all var(--duration-fast) var(--ease-out);
  box-shadow: 0 2px 10px rgba(var(--accent-rgb), 0.3);
}

.pwa-install-banner__btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(var(--accent-rgb), 0.4);
}

.pwa-install-banner__close {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--duration-fast) var(--ease-out);
}

.pwa-install-banner__close:hover {
  background: var(--accent-bg);
  color: var(--text-secondary);
}

/* === Footer === */
.app-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-xs);
  padding: var(--spacing-md) 0;
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
}

.app-footer svg {
  opacity: 0.5;
}

/* === Shake animation (last toggle guard) === */
@keyframes toggle-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-4px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
}

.toggle--shake {
  animation: toggle-shake 0.4s ease;
}

/* === Hidden utility === */
.hidden { display: none !important; }

/* === Responsive — mobile first (375px) === */

/* Small phones */
@media (max-width: 360px) {
  .password-text { font-size: 22px; }
  .tab { font-size: 12px; padding: 8px 0; }
  .setting-chip { height: 28px; padding: 0 10px; font-size: 12px; }
  .history-panel { width: 100vw; max-width: 100vw; }
}

/* Desktop */
@media (min-width: 600px) {
  body { padding: var(--spacing-xl); }
  .password-text { font-size: 32px; }
}

/* === Password Strength Checker === */
.checker {
  background: var(--glass-bg);
  border-radius: 20px;
  padding: var(--spacing-md);
  margin-bottom: var(--spacing-lg);
}

.checker__header {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-md);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
}

.checker__input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.checker__input {
  width: 100%;
  height: 44px;
  background: rgba(0, 0, 0, 0.2);
  border: 1.5px solid var(--glass-border-c);
  border-radius: 12px;
  padding: 0 44px 0 14px;
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--duration-fast) var(--ease-out),
              box-shadow var(--duration-fast) var(--ease-out);
}

.checker__input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 16px rgba(var(--accent-rgb), 0.15);
}

.checker__input::placeholder {
  color: var(--text-muted);
  font-family: var(--font-sans);
}

.checker__eye {
  position: absolute;
  right: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color var(--duration-fast) var(--ease-out);
}

.checker__eye:hover { color: var(--accent); }
.checker__eye .eye-closed { display: none; }
.checker__eye.active .eye-open { display: none; }
.checker__eye.active .eye-closed { display: inline; }

.checker__result {
  margin-top: var(--spacing-md);
}

.checker__bar-track {
  width: 100%;
  height: 6px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: var(--spacing-sm);
  position: relative;
}

.checker__bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 3px;
  transition: width var(--duration-med) var(--ease-out),
              background var(--duration-med) var(--ease-out);
  position: relative;
  overflow: hidden;
}

/* Animated shine on strength bar */
.checker__bar-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  animation: bar-shine 2s ease-in-out infinite;
}

@keyframes bar-shine {
  0% { left: -100%; }
  100% { left: 200%; }
}

.checker__verdict {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 4px;
}

.checker__details {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* === Copy Toast === */
.copy-toast {
  position: fixed;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%) translateY(120px);
  background: var(--glass-bg);
  border: 1px solid rgba(var(--green-rgb), 0.2);
  border-radius: 16px;
  padding: 12px 20px 8px;
  min-width: 240px;
  text-align: center;
  z-index: 500;
  opacity: 0;
  pointer-events: none;
  transition: transform var(--duration-med) var(--ease-spring),
              opacity var(--duration-med) var(--ease-out);
  box-shadow:
    0 8px 32px rgba(0,0,0,0.25),
    0 0 20px rgba(var(--green-rgb), 0.1);
}

.copy-toast.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.copy-toast__text {
  font-size: 13px;
  font-weight: 600;
  color: var(--green);
  text-shadow: 0 0 10px rgba(var(--green-rgb), 0.2);
}

.copy-toast__bar {
  height: 3px;
  background: linear-gradient(90deg, var(--green), var(--accent));
  border-radius: 2px;
  margin-top: 8px;
  width: 100%;
  transform-origin: left;
  transition: none;
}

.copy-toast__bar.animating {
  transition: width linear;
  width: 0% !important;
}

/* === Strength Meter (generated password) === */
.strength-meter {
  margin-bottom: var(--spacing-md);
  padding: 0 4px;
}

.strength-meter__bar-track {
  width: 100%;
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 6px;
}

.strength-meter__bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 3px;
  transition: width 0.8s cubic-bezier(0.22, 1, 0.36, 1),
              background 0.6s var(--ease-out);
  position: relative;
  overflow: hidden;
}

/* v9: Strength meter glow effect */
.strength-meter__bar-fill::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 3px;
  box-shadow: 0 0 8px currentColor;
  opacity: 0.4;
  pointer-events: none;
}

.strength-meter__bar-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  animation: bar-shine 2s ease-in-out infinite;
}

.strength-meter__info {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.strength-meter__label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: color var(--duration-med) var(--ease-out);
}

.strength-meter__bits {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* === Custom Words === */
.setting-row--custom-words {
  flex-direction: column;
  align-items: stretch;
  gap: var(--spacing-sm);
}

.custom-words {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.custom-words__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.custom-words__count {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.custom-words__input {
  width: 100%;
  background: rgba(0, 0, 0, 0.2);
  border: 1.5px solid var(--glass-border-c);
  border-radius: 12px;
  padding: 10px 14px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-primary);
  outline: none;
  resize: vertical;
  min-height: 48px;
  max-height: 120px;
  transition: border-color var(--duration-fast) var(--ease-out),
              box-shadow var(--duration-fast) var(--ease-out);
}

.custom-words__input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 16px rgba(var(--accent-rgb), 0.15);
}

.custom-words__input::placeholder {
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 12px;
}

.custom-words__actions {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.custom-words__toggle-label {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  margin-left: auto;
}

/* === Toast Keep Button === */
.copy-toast__content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
}

.copy-toast__keep {
  background: transparent;
  border: 1.5px solid rgba(var(--green-rgb), 0.4);
  border-radius: 12px;
  padding: 4px 12px;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  color: var(--green);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}

.copy-toast__keep:hover {
  background: rgba(var(--green-rgb), 0.15);
  border-color: var(--green);
}

/* === Password Score Badge === */
.password-display__top {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-md);
  width: 100%;
  position: relative;
  z-index: 1;
}

.password-score {
  display: flex;
  align-items: baseline;
  gap: 1px;
  background: var(--bg-tertiary);
  border: 1px solid var(--glass-border-c);
  border-radius: 12px;
  padding: 6px 10px;
  flex-shrink: 0;
  transition: border-color var(--duration-med) var(--ease-out),
              box-shadow var(--duration-med) var(--ease-out);
}

.password-score__value {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 700;
  transition: color var(--duration-med) var(--ease-out);
}

.password-score__max {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

/* === Breach Warning === */
.breach-warning {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  background: rgba(255, 71, 87, 0.1);
  border: 1px solid rgba(255, 71, 87, 0.3);
  border-radius: 14px;
  padding: 10px 16px;
  margin-bottom: var(--spacing-md);
  animation: breach-fade-in 0.3s var(--ease-out);
}

.breach-warning__icon {
  font-size: 18px;
  flex-shrink: 0;
}

.breach-warning__text {
  font-size: 13px;
  font-weight: 500;
  color: var(--red);
  line-height: 1.4;
}

@keyframes breach-fade-in {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* === v22: HIBP Breach Check === */
.hibp-section {
  margin-bottom: var(--spacing-md);
}

.hibp-actions {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  flex-wrap: wrap;
}

.btn--hibp {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--glass-border);
  border-radius: var(--btn-radius);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease-out),
              border-color var(--duration-fast) var(--ease-out),
              opacity var(--duration-fast);
  white-space: nowrap;
}

.btn--hibp:hover {
  background: var(--bg-tertiary);
  border-color: var(--accent);
}

.btn--hibp:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn--loading {
  position: relative;
}

.hibp-privacy-note {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.3;
  flex: 1;
  min-width: 140px;
}

.hibp-result {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: 10px 16px;
  border-radius: 14px;
  margin-bottom: var(--spacing-sm);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  animation: breach-fade-in 0.3s var(--ease-out);
  transition: background var(--duration-med), border-color var(--duration-med);
}

.hibp-result.hidden {
  display: none;
}

.hibp-result--loading {
  background: var(--bg-elevated);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
}

.hibp-result--loading .hibp-spinner {
  display: inline-block;
}

.hibp-result--danger {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: var(--red);
}

.hibp-result--safe {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.35);
  color: var(--green);
}

.hibp-result--info {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: var(--orange);
}

.hibp-result__text {
  flex: 1;
}

.hibp-spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid var(--glass-border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: hibp-spin 0.7s linear infinite;
  flex-shrink: 0;
}

@keyframes hibp-spin {
  to { transform: rotate(360deg); }
}

/* === QR / Transfer Button === */
.btn--qr {
  flex: 0 0 48px;
  padding: 0;
}

/* === Transfer Modal === */
.transfer-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-fast) var(--ease-out);
}

.transfer-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.transfer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.transfer-dialog {
  position: relative;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border-c);
  border-radius: 20px;
  padding: var(--spacing-lg);
  width: 100%;
  max-width: 380px;
  text-align: center;
  transform: scale(0.9);
  transition: transform var(--duration-med) var(--ease-spring);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.3);
}

.transfer-overlay.open .transfer-dialog {
  transform: scale(1);
}

.transfer-dialog__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--spacing-lg);
}

.transfer-dialog__title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.transfer-dialog__password {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 700;
  color: var(--accent);
  word-break: break-all;
  line-height: 1.5;
  padding: var(--spacing-lg);
  background: rgba(0, 0, 0, 0.2);
  border-radius: 16px;
  border: 1px solid var(--glass-border-c);
  text-shadow: 0 0 20px rgba(var(--accent-rgb), 0.3);
  user-select: all;
  -webkit-user-select: all;
}

.transfer-dialog__hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: var(--spacing-md);
}

/* === v8: Phonetic Hint === */
.phonetic-hint {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: 8px 14px;
  margin-bottom: var(--spacing-sm);
  background: var(--accent-bg);
  border: 1px solid rgba(var(--accent-rgb), 0.15);
  border-radius: 12px;
  font-size: 13px;
  color: var(--text-secondary);
  animation: breach-fade-in 0.3s var(--ease-out);
}

.phonetic-hint__label {
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
  flex-shrink: 0;
}

.phonetic-hint__text {
  font-family: var(--font-mono);
  font-size: 12px;
  word-break: break-all;
  color: var(--text-primary);
}

/* === v8: Crack Estimate === */
.crack-estimate {
  font-size: 12px;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: var(--spacing-md);
  padding: 6px 12px;
  font-weight: 500;
}

.crack-estimate:empty {
  display: none;
}

/* === v8: Compare Overlay === */
.compare-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-md);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-fast) var(--ease-out);
}

.compare-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.compare-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.compare-dialog {
  position: relative;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border-c);
  border-radius: 20px;
  padding: var(--spacing-lg);
  width: 100%;
  max-width: 420px;
  transform: scale(0.9);
  transition: transform var(--duration-med) var(--ease-spring);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.3);
}

.compare-overlay.open .compare-dialog {
  transform: scale(1);
}

.compare-dialog__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--spacing-lg);
}

.compare-dialog__title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.compare-cards {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
}

.compare-card {
  background: var(--bg-tertiary);
  border: 1px solid var(--glass-border-c);
  border-radius: 16px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.compare-card__mode {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--accent);
}

.compare-card__password {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  word-break: break-all;
  line-height: 1.5;
  user-select: all;
  -webkit-user-select: all;
}

.compare-card__stats {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  font-size: 11px;
  color: var(--text-secondary);
}

.compare-card__bar-track {
  flex: 1;
  height: 4px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 2px;
  overflow: hidden;
}

.compare-card__bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.6s var(--ease-out);
}

.compare-card__score {
  font-family: var(--font-mono);
  font-weight: 700;
  min-width: 40px;
  text-align: right;
}

/* === v9: Copy feedback — green pulse border + checkmark draw === */
@keyframes copy-pulse-border {
  0%   { border-color: var(--glass-border-c); box-shadow: 0 4px 24px rgba(0,0,0,0.12), inset 0 1px 0 var(--glass-shine); }
  20%  { border-color: rgba(34, 197, 94, 0.6); box-shadow: 0 4px 24px rgba(0,0,0,0.12), 0 0 20px rgba(34, 197, 94, 0.3), 0 0 40px rgba(34, 197, 94, 0.1), inset 0 1px 0 var(--glass-shine); }
  40%  { border-color: rgba(34, 197, 94, 0.3); }
  60%  { border-color: rgba(34, 197, 94, 0.5); box-shadow: 0 4px 24px rgba(0,0,0,0.12), 0 0 16px rgba(34, 197, 94, 0.2), inset 0 1px 0 var(--glass-shine); }
  100% { border-color: var(--glass-border-c); box-shadow: 0 4px 24px rgba(0,0,0,0.12), inset 0 1px 0 var(--glass-shine); }
}

.password-display--copy-pulse {
  animation: copy-pulse-border 1.2s var(--ease-out);
}

/* v9: SVG checkmark draw animation */
@keyframes checkmark-draw {
  0%   { stroke-dashoffset: 24; }
  100% { stroke-dashoffset: 0; }
}

.btn--copied .btn__icon-check svg polyline {
  stroke-dasharray: 24;
  stroke-dashoffset: 0;
  animation: checkmark-draw 0.35s var(--ease-out);
}

/* v9: Toast countdown bar with enhanced gradient */
.copy-toast__bar.animating {
  background: linear-gradient(90deg, var(--green), var(--accent), var(--secondary));
}

/* v9: Password display enhanced with accent border glow on hover */
.password-display {
  transition: border-color var(--duration-med) var(--ease-out),
              box-shadow var(--duration-med) var(--ease-out);
}

.password-display:hover {
  border-color: rgba(var(--accent-rgb), 0.2);
  box-shadow:
    0 4px 24px rgba(0, 0, 0, 0.15),
    0 0 16px rgba(var(--accent-rgb), 0.08),
    inset 0 1px 0 var(--glass-shine);
}

/* v9: Checker section enhanced glass */
.checker {
  transition: border-color var(--duration-med) var(--ease-out),
              box-shadow var(--duration-med) var(--ease-out);
}

.checker:hover {
  border-color: rgba(var(--accent-rgb), 0.15);
}

/* v9: Shield label enhanced */
.shield-label {
  transition: color var(--duration-med) var(--ease-out),
              background var(--duration-med) var(--ease-out),
              box-shadow var(--duration-med) var(--ease-out);
}

/* === Reduced motion === */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .shield[data-level="4"],
  .shield[data-level="5"] {
    animation: none;
  }
  .shield[data-level="4"] svg,
  .shield[data-level="5"] svg {
    animation: none;
  }
  .shield--pulse {
    animation: none;
  }
  .password-text--typing::after {
    animation: none;
    opacity: 1;
  }
  .checker__bar-fill::after,
  .strength-meter__bar-fill::after {
    animation: none;
  }
  .btn--primary.btn--generating {
    animation: none;
  }
  body::before {
    animation: none;
  }
}
/* === Onboarding Overlay === */
.onboarding-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transition: opacity .4s ease;
}
.onboarding-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}
.onboarding-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 10, 18, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.onboarding-card {
  position: relative;
  max-width: 380px;
  width: 90%;
  padding: 40px 32px 36px;
  background: rgba(16, 24, 40, 0.75);
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  border: 1px solid rgba(0, 212, 170, 0.15);
  border-radius: 20px;
  box-shadow:
    0 0 60px rgba(0, 212, 170, 0.08),
    0 0 120px rgba(0, 212, 170, 0.04),
    0 24px 64px rgba(0, 0, 0, 0.5);
  text-align: center;
  animation: onboardCardIn .5s cubic-bezier(.16,1,.3,1) both;
}
@keyframes onboardCardIn {
  from { opacity: 0; transform: translateY(30px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.onboarding-icon {
  font-size: 48px;
  margin-bottom: 8px;
  filter: drop-shadow(0 0 12px rgba(0, 212, 170, 0.4));
}
.onboarding-title {
  font-size: 28px;
  font-weight: 800;
  background: linear-gradient(135deg, #00D4AA 0%, #3B82F6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 6px;
}
.onboarding-tagline {
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: 28px;
}
.onboarding-features {
  list-style: none;
  padding: 0;
  margin: 0 0 32px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.onboarding-feature {
  font-size: 14px;
  color: var(--text-primary);
  padding: 12px 16px;
  background: rgba(0, 212, 170, 0.06);
  border: 1px solid rgba(0, 212, 170, 0.1);
  border-radius: 12px;
  animation: onboardFeatureIn .5s cubic-bezier(.16,1,.3,1) both;
}
@keyframes onboardFeatureIn {
  from { opacity: 0; transform: translateX(-16px); }
  to   { opacity: 1; transform: translateX(0); }
}
.onboarding-cta {
  width: 100%;
  padding: 14px 24px;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  color: #fff;
  background: linear-gradient(135deg, #00D4AA 0%, #00b894 100%);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 0 24px rgba(0, 212, 170, 0.25);
  transition: transform .15s ease, box-shadow .15s ease;
}
.onboarding-cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 32px rgba(0, 212, 170, 0.35);
}
.onboarding-cta:active {
  transform: scale(0.97);
}
@media (prefers-reduced-motion: reduce) {
  .onboarding-card, .onboarding-feature { animation: none; }
  .onboarding-overlay { transition: none; }
}

/* === v12: Password length recommendation hint === */
.setting-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  font-weight: 500;
  letter-spacing: 0.01em;
  opacity: 0.85;
}

/* === v12: Entropy visualization chart === */
.entropy-chart {
  margin-top: var(--spacing-sm);
  margin-bottom: var(--spacing-md);
  padding: 12px 14px;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border-c);
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}
.entropy-chart.hidden { display: none; }
.entropy-chart__title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.entropy-chart__bars { display: flex; flex-direction: column; gap: 5px; }
.entropy-bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.entropy-bar-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 52px;
  text-align: right;
  white-space: nowrap;
}
.entropy-bar-track {
  flex: 1;
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: 3px;
  overflow: hidden;
}
.entropy-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 2px;
}
.entropy-bar-value {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-secondary);
  min-width: 24px;
  font-family: var(--font-mono);
}

.oc-footer{text-align:center;padding:20px 16px 24px;margin-top:24px}
.oc-footer a{font-size:.78rem;color:var(--text-muted,var(--text-secondary,#888));text-decoration:none;opacity:.6;transition:opacity .2s}
.oc-footer a:hover{opacity:1}

/* === Print Styles === */
/* Security note: only prints the currently visible password + strength info.
   History panel and settings are hidden. */
@media print{
  .onboarding-overlay,.skip-link,.pwa-banner,.oc-footer,.toast,
  .header,.tabs,.shield-container,.entropy-chart,
  .settings-panel,.history-panel,.phonetic-hint,.crack-estimate,
  .icon-btn,
  button{display:none!important}
  body{background:#fff!important;color:#000!important;font-size:14pt}
  .app{max-width:100%;padding:0;margin:0;background:#fff!important}
  .password-display{border:2px solid #000;background:#fff!important;padding:16px;break-inside:avoid}
  .password-text{color:#000!important;font-size:16pt;word-break:break-all}
  .password-score{color:#000!important}
  .strength-meter{break-inside:avoid;margin-top:8px}
  .strength-meter__bar-fill{-webkit-print-color-adjust:exact;print-color-adjust:exact}
  .strength-meter__label,.strength-meter__bits{color:#000!important}
  @page{margin:2cm;size:auto}
}
