/* KEYGEN — local password generator level */

@font-face { font-family: "Press Start 2P"; font-style: normal; font-weight: 400; font-display: swap; src: url("/press-start-2p.woff2") format("woff2"); }
@font-face { font-family: "Press Start 2P Fallback"; src: local("Courier New"); size-adjust: 166.64%; ascent-override: 60%; descent-override: 0%; line-gap-override: 0%; }

:root {
  --bg: #0a0a12;
  --surface: #12121d;
  --surface-2: #1a1a2a;
  --line: #28283c;
  --text: #e9e9f2;
  --dim: #9aa0b5;
  --cyan: #45f0ff;
  --magenta: #ff3d8b;
  --gold: #ffc857;
  --green: #41ff8b;
  --red: #ff5560;
  --pixel: "Press Start 2P", "Press Start 2P Fallback", "Courier New", monospace;
  --body: -apple-system, "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --glow-cyan: 0 0 14px rgba(69, 240, 255, 0.35);
  --space-gutter: clamp(16px, 4vw, 48px);
}

*, *::before, *::after { box-sizing: border-box; }
html { color-scheme: dark; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: radial-gradient(1200px 500px at 50% -10%, rgba(69, 240, 255, 0.05), transparent 70%), var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
::selection { background: rgba(69, 240, 255, 0.3); }
[hidden] { display: none !important; }
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.skip-link {
  position: absolute;
  left: 12px; top: -48px;
  z-index: 200;
  background: var(--cyan);
  color: #05050d;
  padding: 10px 16px;
  border-radius: 6px;
  font-family: var(--mono);
  font-weight: 700;
  text-decoration: none;
  transition: transform 0.2s var(--ease-out);
}
.skip-link:focus-visible { transform: translateY(60px); }
:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
  box-shadow: 0 0 0 5px rgba(69, 240, 255, 0.15);
}
a { color: var(--cyan); }
.site-header {
  padding: 26px var(--space-gutter) 10px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.lab-link {
  align-self: flex-start;
  font-family: var(--pixel);
  font-size: 10px;
  color: var(--dim);
  text-decoration: none;
  padding: 6px 2px;
  transition: color 0.15s, text-shadow 0.15s;
}
.lab-link:hover { color: var(--cyan); text-shadow: var(--glow-cyan); }
.level {
  margin: 0;
  font-family: var(--pixel);
  font-size: 9px;
  letter-spacing: 3px;
  color: var(--gold);
}
.wordmark {
  margin: 6px 0 4px;
  font-family: var(--pixel);
  font-size: clamp(22px, 4.5vw, 34px);
  letter-spacing: 3px;
  color: var(--text);
  text-shadow: 0 0 16px rgba(69, 240, 255, 0.55), 3px 3px 0 var(--magenta);
}
.tagline {
  margin: 0;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--dim);
}
.cursor { color: var(--cyan); animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
main {
  flex: 1;
  width: 100%;
  max-width: 1160px;
  margin: 0 auto;
  padding: 20px var(--space-gutter) 72px;
}
.generator { display: grid; gap: 16px; }
.hero-panel, .output-card, .panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.hero-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
}
.badge {
  margin: 0;
  display: inline-flex;
  color: var(--green);
  font-family: var(--mono);
  font-size: 12px;
}
.toggle, .check-grid label {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
}
input[type="checkbox"] { accent-color: var(--cyan); width: 18px; height: 18px; }
.output-card {
  padding: clamp(16px, 4vw, 26px);
  display: grid;
  gap: 14px;
}
.password-output {
  min-height: 88px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #080812;
  font-family: var(--mono);
  font-size: clamp(18px, 4vw, 34px);
  line-height: 1.35;
  overflow-wrap: anywhere;
  color: var(--text);
}
.slot {
  display: inline-block;
  min-width: 0.68em;
  color: var(--cyan);
  text-shadow: 0 0 10px rgba(69, 240, 255, 0.45);
}
.slot.locked { color: var(--text); text-shadow: none; }
.copy-status { margin: 0; min-height: 21px; color: var(--dim); font-family: var(--mono); font-size: 13px; }
.action-row { display: flex; flex-wrap: wrap; gap: 10px; }
.workspace { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr); gap: 16px; }
.panel { padding: 16px; min-width: 0; }
.panel-title {
  margin: 0 0 12px;
  font-family: var(--pixel);
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--cyan);
  text-shadow: 0 0 8px rgba(69, 240, 255, 0.4);
}
.panel-head { display: flex; justify-content: space-between; align-items: start; gap: 10px; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.tab, .chip {
  min-height: 40px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--dim);
  font-family: var(--mono);
  font-size: 12px;
  cursor: pointer;
  padding: 8px 12px;
}
.tab:hover, .chip:hover { border-color: var(--cyan); color: var(--text); }
.tab.is-active {
  border-color: var(--cyan);
  color: var(--cyan);
  background: rgba(69, 240, 255, 0.08);
  box-shadow: inset 0 0 0 1px rgba(69, 240, 255, 0.35);
}
.mode-panel { display: grid; gap: 14px; }
.range-field, .field {
  display: grid;
  gap: 8px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--dim);
}
output { color: var(--gold); }
input[type="range"] { width: 100%; accent-color: var(--cyan); }
select {
  min-height: 44px;
  width: 100%;
  background: var(--bg);
  border: 1px solid #5e5e80;
  border-radius: 6px;
  color: var(--text);
  font: 14px var(--mono);
  padding: 8px 10px;
}
.check-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; }
.wide { grid-column: 1 / -1; }
.btn, .icon-btn {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text);
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.5px;
  padding: 10px 14px;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.12s var(--ease-out), border-color 0.12s, box-shadow 0.12s, color 0.12s;
}
.btn:hover, .icon-btn:hover {
  border-color: var(--cyan);
  box-shadow: 0 0 12px rgba(69, 240, 255, 0.22);
  transform: translateY(-1px);
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--cyan); border-color: var(--cyan); color: #05050d; }
.btn-primary:hover { box-shadow: 0 0 18px rgba(69, 240, 255, 0.5); }
.btn-big { font-family: var(--pixel); font-size: 11px; padding: 14px 20px; }
.icon-btn { width: 40px; padding: 0; border-radius: 50%; }
.rank-meter {
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  margin: 4px 0 14px;
}
.rank-meter span {
  min-height: 30px;
  display: grid;
  place-items: center;
  background: var(--bg);
  border: 1px solid var(--line);
  font-family: var(--pixel);
  font-size: 9px;
}
#rankNeedle {
  position: absolute;
  left: 0;
  bottom: -7px;
  width: 20%;
  height: 3px;
  background: var(--gold);
  transition: transform 0.18s var(--ease-out), background 0.18s;
}
.bits { margin: 0 0 12px; font-family: var(--mono); }
.bits strong { font-size: 24px; color: var(--gold); }
#rankOut { color: var(--cyan); margin-left: 8px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 12px; }
caption { text-align: left; color: var(--dim); margin-bottom: 6px; }
th, td { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; }
th { color: var(--dim); font-weight: 600; }
.note { margin: 0 0 12px; color: var(--dim); font-size: 12.5px; }
.history-list {
  list-style: decimal;
  padding-left: 20px;
  margin: 0;
  display: grid;
  gap: 8px;
}
.history-list li { color: var(--dim); font-family: var(--mono); font-size: 12px; overflow-wrap: anywhere; }
.history-item { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.history-item code { color: var(--text); }
.history-item button { flex: 0 0 auto; }
.privacy-note {
  margin: 2px auto 0;
  max-width: 520px;
  text-align: center;
  font-size: 12.5px;
  color: var(--dim);
}
.site-footer {
  border-top: 1px solid var(--line);
  padding: 22px var(--space-gutter);
  text-align: center;
  color: var(--dim);
  font-size: 13px;
}
.site-footer p { margin: 0 0 8px; }
.site-footer p:last-child { margin-bottom: 0; }
.privacy-footer { font-size: 12.5px; }
.site-footer a { color: var(--cyan); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; text-shadow: var(--glow-cyan); }
.toasts {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(440px, calc(100vw - 32px));
  pointer-events: none;
}
.toast {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--red);
  color: var(--text);
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 13.5px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  animation: toast-in 0.22s var(--ease-out) both;
}
.toast-info { border-left-color: var(--cyan); }
.toast-success { border-left-color: var(--green); }
.toast.out { opacity: 0; transform: translateY(6px); transition: opacity 0.25s, transform 0.25s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }
.dialog {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 24px;
  max-width: min(480px, calc(100vw - 32px));
}
.dialog::backdrop { background: rgba(5, 5, 12, 0.72); }
.dialog-title { margin: 0 0 12px; font-family: var(--pixel); font-size: 12px; color: var(--gold); }
.dialog p { margin: 0 0 18px; color: var(--dim); line-height: 1.55; }
@media (max-width: 820px) { .workspace { grid-template-columns: 1fr; } }
@media (max-width: 520px) {
  .check-grid { grid-template-columns: 1fr; }
  .hero-panel, .action-row { align-items: stretch; flex-direction: column; }
  .wordmark { letter-spacing: 1px; }
}
@media (pointer: coarse) {
  .btn, .tab, .chip, .icon-btn { min-height: 44px; }
}
@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;
  }
  .cursor { animation: none; }
}
