/* -- Fonts -- */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/static/fonts/inter-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
    U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
    U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/static/fonts/inter-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7,
    U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F,
    U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F,
    U+A720-A7FF;
}

@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("/static/fonts/jetbrains-mono-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
    U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
    U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("/static/fonts/jetbrains-mono-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7,
    U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F,
    U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F,
    U+A720-A7FF;
}

/* -- Reset -- */

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

:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --text: #1a1a1a;
  --text-secondary: #6b7280;
  --border: #e5e7eb;
  --accent: #6d28d9;
  --accent-hover: #5b21b6;
  --accent-light: #ede9fe;
  --radius: 12px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", "SF Mono", "Cascadia Code",
    Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f0f0f;
    --surface: #1a1a1a;
    --text: #f0f0f0;
    --text-secondary: #9ca3af;
    --border: #2e2e2e;
    --accent: #a78bfa;
    --accent-hover: #8b5cf6;
    --accent-light: #1e1533;
  }
}

html {
  font-size: 16px;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* -- Header -- */

header {
  padding: 2rem 1.5rem 0;
  text-align: center;
}

header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

header h1 span {
  color: var(--accent);
}

header p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: 0.25rem;
}

/* -- Main -- */

main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  width: 100%;
  max-width: 520px;
}

/* -- Password length control -- */

.length-control {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.length-control label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.length-control .length-value {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.length-control input[type="range"] {
  width: 140px;
  accent-color: var(--accent);
  cursor: pointer;
}

.length-control .length-num {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  min-width: 1.5rem;
  text-align: right;
}

/* -- Password display -- */

.password-display {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem 1rem;
  text-align: center;
  margin-bottom: 1.25rem;
  position: relative;
  min-height: 3.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.password-display p {
  font-family: var(--font-mono);
  font-size: 1.2rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  word-break: break-all;
  line-height: 1.5;
  user-select: all;
}

/* -- Buttons -- */

.actions {
  display: flex;
  gap: 0.75rem;
}

.btn {
  flex: 1;
  padding: 0.7rem 1rem;
  border-radius: 8px;
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--accent);
  color: #ffffff;
}

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

.btn-secondary {
  background: var(--accent-light);
  color: var(--accent);
  border: 1px solid transparent;
}

.btn-secondary:hover {
  border-color: var(--accent);
}

/* -- Copy feedback -- */

.btn-secondary.copied {
  color: #16a34a;
  background: #f0fdf4;
}

@media (prefers-color-scheme: dark) {
  .btn-secondary.copied {
    color: #4ade80;
    background: #052e16;
  }
}

/* -- Strength indicator -- */

.strength {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 1.25rem;
}

.strength-bars {
  display: flex;
  gap: 4px;
  flex: 1;
}

.strength-bar {
  height: 4px;
  flex: 1;
  border-radius: 2px;
  background: var(--border);
  transition: background 0.3s ease;
}

.strength-bar.active.weak {
  background: #ef4444;
}

.strength-bar.active.fair {
  background: #f59e0b;
}

.strength-bar.active.good {
  background: #3b82f6;
}

.strength-bar.active.strong {
  background: #22c55e;
}

.strength-label {
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  min-width: 4rem;
  text-align: right;
}

.strength-label.weak {
  color: #ef4444;
}

.strength-label.fair {
  color: #f59e0b;
}

.strength-label.good {
  color: #3b82f6;
}

.strength-label.strong {
  color: #22c55e;
}

/* -- Footer -- */

footer {
  text-align: center;
  padding: 1.5rem;
}

footer small {
  color: var(--text-secondary);
  font-size: 0.75rem;
}

footer a {
  color: var(--accent);
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

/* -- Responsive -- */

@media (max-width: 480px) {
  .card {
    padding: 1.5rem;
  }

  .password-display p {
    font-size: 1rem;
  }

  .actions {
    flex-direction: column;
  }

  .length-control {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }

  .length-control .length-value {
    justify-content: space-between;
  }

  .length-control input[type="range"] {
    flex: 1;
  }
}
