:root {
  --bg: #0b1020;
  --bg-glow-1: #1e3a8a;
  --bg-glow-2: #6d28d9;
  --surface: rgba(20, 27, 48, 0.72);
  --surface-2: rgba(255, 255, 255, 0.04);
  --border: rgba(255, 255, 255, 0.10);
  --border-strong: rgba(255, 255, 255, 0.18);
  --text: #e7ecf6;
  --text-dim: #9aa6c2;
  --accent: #6366f1;
  --accent-2: #22d3ee;
  --accent-grad: linear-gradient(135deg, #818cf8 0%, #22d3ee 100%);
  --success: #34d399;
  --danger: #f87171;
  --radius: 16px;
  --radius-sm: 10px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Fira Code", Menlo, monospace;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  background-image:
    radial-gradient(60rem 40rem at 12% -10%, rgba(109, 40, 217, 0.35), transparent 60%),
    radial-gradient(55rem 38rem at 110% 10%, rgba(30, 58, 138, 0.45), transparent 55%);
  background-attachment: fixed;
  line-height: 1.5;
  display: flex;
  justify-content: center;
}

.shell {
  width: 100%;
  max-width: 720px;
  padding: clamp(1.5rem, 4vw, 3.5rem) 1.25rem 4rem;
}

/* ---- Hero ---- */
.hero { text-align: center; margin-bottom: 2rem; }

.badge {
  display: inline-grid;
  place-items: center;
  width: 64px;
  height: 64px;
  font-size: 30px;
  border-radius: 18px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  box-shadow: 0 8px 30px rgba(99, 102, 241, 0.25);
  margin-bottom: 1rem;
}

.hero h1 {
  margin: 0;
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  background: var(--accent-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.subtitle { margin: 0.6rem 0 0; color: var(--text-dim); font-size: 1.02rem; }

/* ---- Card ---- */
.card {
  background: var(--surface);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(1.25rem, 3vw, 2rem);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 520px) {
  .field-row { grid-template-columns: 1fr; }
}

.field { display: flex; flex-direction: column; gap: 0.45rem; }

label {
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-dim);
  text-transform: uppercase;
}

.hint { text-transform: none; font-weight: 400; color: var(--text-dim); opacity: 0.8; }

select, input[type="number"] {
  width: 100%;
  padding: 0.7rem 0.85rem;
  font-size: 1rem;
  font-family: inherit;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

select { -webkit-appearance: none; appearance: none; cursor: pointer; }

.select-wrap { position: relative; }
.select-wrap::after {
  content: "";
  position: absolute;
  right: 0.95rem;
  top: 50%;
  width: 0.5rem;
  height: 0.5rem;
  border-right: 2px solid var(--text-dim);
  border-bottom: 2px solid var(--text-dim);
  transform: translateY(-65%) rotate(45deg);
  pointer-events: none;
}

select:focus, input[type="number"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
}

input.invalid { border-color: var(--danger); }
input.invalid:focus { box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.25); }

.error { margin: 0; font-size: 0.8rem; color: var(--danger); }

/* ---- Button ---- */
.btn {
  position: relative;
  width: 100%;
  padding: 0.85rem 1.25rem;
  font-size: 1.02rem;
  font-weight: 600;
  font-family: inherit;
  color: #0b1020;
  background: var(--accent-grad);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.2s, filter 0.2s;
  box-shadow: 0 10px 30px rgba(99, 102, 241, 0.35);
}

.btn:hover { filter: brightness(1.05); box-shadow: 0 14px 38px rgba(99, 102, 241, 0.45); }
.btn:active { transform: translateY(1px); }
.btn:disabled { cursor: progress; filter: saturate(0.7) brightness(0.9); }

.spinner {
  display: none;
  width: 16px;
  height: 16px;
  margin-left: 0.6rem;
  vertical-align: -3px;
  border: 2px solid rgba(11, 16, 32, 0.35);
  border-top-color: #0b1020;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.btn.loading .spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Results ---- */
.results { margin-top: 2rem; }

.results-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}
.results-head h2 { margin: 0; font-size: 1.1rem; font-weight: 600; }
.results-meta { font-size: 0.85rem; color: var(--text-dim); }

.pw-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.6rem; }

.pw-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0.85rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  animation: rise 0.25s ease both;
}
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.pw-item.pending { opacity: 0.6; }
.pw-item.error { border-color: rgba(248, 113, 113, 0.5); }

.pw-index {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-dim);
  background: var(--surface-2);
  border-radius: 8px;
}

.pw-value {
  flex: 1 1 auto;
  min-width: 0;
  font-family: var(--mono);
  font-size: 0.92rem;
  word-break: break-all;
  color: var(--text);
}
.pw-value.muted { color: var(--text-dim); font-family: var(--font); }
.pw-value.err { color: var(--danger); }

.timing {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.55rem;
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  color: var(--accent-2);
  background: rgba(34, 211, 238, 0.10);
  border: 1px solid rgba(34, 211, 238, 0.25);
  border-radius: 999px;
  white-space: nowrap;
}
.timing::before { content: "⏱"; font-size: 0.8em; }

.copy-btn {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  color: var(--text-dim);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.copy-btn:hover { color: var(--text); border-color: var(--border-strong); background: var(--surface-2); }
.copy-btn.copied { color: var(--success); border-color: rgba(52, 211, 153, 0.5); }

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
