@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&family=Noto+Sans+Armenian:wght@400;500;600;700&display=swap');

/* ---------- Tokens ---------- */
:root {
  --bg       : #8e8e9d;
  --card     : #ffffff;
  --text     : #1f2430;
  --muted    : #5b6070;
  --border   : #d6d8de;
  --soft     : #eef0f3;
  --accent   : #2f6fb0;
  --accent-dk: #24578c;
  --radius   : 10px;

  /* strength scale, zxcvbn score 0-4 */
  --s0: #e5484d;
  --s1: #f76b15;
  --s2: #d9a400;
  --s3: #30a46c;
  --s4: #18794e;
}

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

body {
  font-family: 'Poppins', 'Noto Sans Armenian', system-ui, sans-serif;
  background : var(--bg);
  color      : var(--text);
  line-height: 1.5;
  padding    : 48px 16px;
  /* Always reserve the scrollbar so the card never shifts sideways between pages. */
  overflow-y : scroll;
}

/* ---------- Card ----------
   Fixed width and anchored to the top, so switching between the checker and
   the generator never resizes or moves it. */
.container {
  width        : 100%;
  max-width    : 680px;
  margin       : 0 auto;
  background   : var(--card);
  border-radius: 14px;
  padding      : 28px 32px 32px;
  box-shadow   : 0 10px 30px rgba(0, 0, 0, 0.18);
}

/* ---------- Top bar: tool tabs + language ---------- */
.topbar {
  display        : flex;
  justify-content: space-between;
  align-items    : center;
  gap            : 12px;
  flex-wrap      : wrap;
}

.tabs {
  display      : inline-flex;
  background   : var(--soft);
  border-radius: 999px;
  padding      : 4px;
}

.tab {
  padding        : 6px 16px;
  border-radius  : 999px;
  font-size      : 14px;
  font-weight    : 500;
  color          : var(--muted);
  text-decoration: none;
  transition     : background 0.15s, color 0.15s;
}

.tab:hover { color: var(--text); }

.tab.active {
  background: var(--card);
  color     : var(--text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.lang {
  display: flex;
  gap    : 4px;
}

.lang a {
  padding        : 4px 8px;
  border-radius  : 6px;
  font-size      : 13px;
  font-weight    : 600;
  color          : var(--muted);
  text-decoration: none;
}

.lang a:hover { background: var(--soft); }
.lang a.active { color: var(--accent); }

/* ---------- Header ---------- */
.brand {
  text-align: center;
  margin    : 20px 0 24px;
}

.brand img {
  width : 88px;
  height: 88px;
}

.brand h1 {
  font-size  : 28px;
  line-height: 1.25;
  margin-top : 8px;
}

.brand .lead {
  color     : var(--muted);
  margin-top: 4px;
}

/* ---------- Password input ---------- */
.input-box {
  position: relative;
}

.input-box input {
  width        : 100%;
  height       : 56px;
  padding      : 0 52px 0 16px;
  border       : 2px solid var(--border);
  border-radius: var(--radius);
  font         : inherit;
  font-size    : 18px;
  font-weight  : 500;
  color        : var(--text);
  outline      : none;
  transition   : border-color 0.15s;
}

.input-box input:focus { border-color: var(--accent); }

.icon-btn {
  position       : absolute;
  right          : 8px;
  top            : 50%;
  transform      : translateY(-50%);
  width          : 40px;
  height         : 40px;
  display        : grid;
  place-items    : center;
  border         : none;
  border-radius  : 8px;
  background     : transparent;
  color          : var(--muted);
  cursor         : pointer;
}

.icon-btn:hover { background: var(--soft); color: var(--text); }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn .eye-off { display: none; }
.icon-btn[aria-pressed="true"] .eye { display: none; }
.icon-btn[aria-pressed="true"] .eye-off { display: block; }

/* ---------- Strength meter (shared by both tools) ---------- */
.meter {
  display              : grid;
  grid-template-columns: repeat(5, 1fr);
  gap                  : 4px;
  margin-top           : 12px;
}

.meter span {
  height       : 6px;
  border-radius: 3px;
  background   : var(--soft);
  transition   : background 0.2s;
}

.meter[data-score="0"] span:nth-child(-n+1) { background: var(--s0); }
.meter[data-score="1"] span:nth-child(-n+2) { background: var(--s1); }
.meter[data-score="2"] span:nth-child(-n+3) { background: var(--s2); }
.meter[data-score="3"] span:nth-child(-n+4) { background: var(--s3); }
.meter[data-score="4"] span                 { background: var(--s4); }

.strength-label {
  margin-top : 8px;
  font-size  : 15px;
  font-weight: 600;
  min-height : 1.5em; /* keeps the layout still while the label is empty */
}

/* ---------- Checker feedback ---------- */
.indicator {
  display: none;
}

.indicator.active {
  display: block;
}

.indicator .crack-time {
  font-size: 14px;
  color    : var(--muted);
}

.indicator .feedback {
  margin   : 8px 0 0 20px;
  font-size: 14px;
  color    : var(--muted);
}

.indicator .feedback li + li { margin-top: 2px; }

/* ---------- Generator ---------- */
.generator {
  display       : flex;
  flex-direction: column;
  gap           : 20px;
}

.result {
  display      : flex;
  align-items  : center;
  gap          : 8px;
  padding      : 8px 8px 8px 16px;
  min-height   : 56px;
  border       : 2px solid var(--border);
  border-radius: var(--radius);
  background   : #fafbfc;
}

.password-output {
  flex       : 1;
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size  : 18px;
  word-break : break-all;
}

.field label,
.chips legend {
  display      : block;
  font-size    : 14px;
  font-weight  : 500;
  color        : var(--muted);
  margin-bottom: 8px;
}

.field label strong {
  color: var(--text);
}

.field input[type="range"] {
  width       : 100%;
  accent-color: var(--accent);
}

.chips {
  border: none;
}

.chips .chip-row {
  display  : flex;
  flex-wrap: wrap;
  gap      : 8px;
}

.chip {
  display      : inline-flex;
  align-items  : center;
  gap          : 6px;
  padding      : 6px 12px;
  border       : 1px solid var(--border);
  border-radius: 999px;
  font-size    : 14px;
  cursor       : pointer;
  user-select  : none;
}

.chip:has(input:checked) {
  border-color: var(--accent);
  background  : #eaf2fb;
}

.chip input { accent-color: var(--accent); }

.form-error {
  color    : var(--s0);
  font-size: 14px;
}

.form-error:empty { display: none; }

/* ---------- Buttons ---------- */
.btn {
  display        : inline-flex;
  align-items    : center;
  justify-content: center;
  gap            : 6px;
  padding        : 8px 16px;
  border         : 1px solid var(--border);
  border-radius  : 8px;
  background     : var(--card);
  color          : var(--text);
  font           : inherit;
  font-size      : 14px;
  font-weight    : 500;
  cursor         : pointer;
  white-space    : nowrap;
  text-decoration: none;
}

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

.btn-primary {
  background  : var(--accent);
  border-color: var(--accent);
  color       : #fff;
  padding     : 12px 20px;
  font-size   : 16px;
}

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

/* ---------- Note ---------- */
.note {
  margin-top  : 28px;
  padding     : 12px 14px;
  border-left : 3px solid var(--border);
  background  : #fafbfc;
  font-size   : 13px;
  color       : var(--muted);
  border-radius: 0 8px 8px 0;
}

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

/* ---------- QR generator ---------- */
.topbar.end {
  justify-content: flex-end;
}

.qr-form {
  display       : flex;
  flex-direction: column;
  gap           : 20px;
}

.text-input {
  width        : 100%;
  height       : 56px;
  padding      : 0 16px;
  border       : 2px solid var(--border);
  border-radius: var(--radius);
  font         : inherit;
  font-size    : 17px;
  color        : var(--text);
  outline      : none;
  transition   : border-color 0.15s;
}

.text-input:focus { border-color: var(--accent); }

.chip input[type="radio"] { accent-color: var(--accent); }

/* Fixed-size square, so the card doesn't grow when the code appears. */
.qr-preview {
  width          : 240px;
  height         : 240px;
  margin         : 0 auto;
  display        : grid;
  place-items    : center;
  border         : 2px dashed var(--border);
  border-radius  : var(--radius);
  background     : #fafbfc;
  color          : var(--muted);
  font-size      : 14px;
  text-align     : center;
  padding        : 12px;
}

.qr-preview.has-code {
  border-style: solid;
  background  : #fff;
}

.qr-preview img,
.qr-preview canvas {
  width : 100%;
  height: 100%;
  image-rendering: pixelated;
}

.qr-actions {
  display        : flex;
  justify-content: center;
  gap            : 8px;
  flex-wrap      : wrap;
}

.btn[disabled],
.btn[aria-disabled="true"] {
  opacity       : 0.5;
  pointer-events: none;
}

.note a { color: inherit; }

/* ---------- Small screens ---------- */
@media (max-width: 520px) {
  body { padding: 16px 10px; }
  .container { padding: 20px 18px 24px; }
  .brand h1 { font-size: 23px; }
  .brand img { width: 72px; height: 72px; }
}
