:root {
  --bg: #0b1020;
  --panel: #121a33;
  --panel-2: #0e162b;
  --text: #e7ecff;
  --muted: #b8c0e0;
  --accent: #7aa2ff;
  --ok: #3ecf8e;
  --warn: #f7c948;
  --bad: #ef6c6c;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.02);
  --radius: 16px;
}
* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial,
    "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", sans-serif;
  line-height: 1.45;
  background: linear-gradient(180deg, #070b18, var(--bg));
  color: var(--text);
  padding: 0;
}

.wrap {
  width: min(980px, 100%);
  margin: 0 auto;
  padding: 28px 16px;
  display: grid;
  gap: 18px;
}

.site-header {
  position: relative;
  background: transparent;
  border-bottom: 1px solid #1b2448;
  backdrop-filter: blur(0.5px);
}
.site-header .wrap {
  padding-top: 20px;
  padding-bottom: 16px;
}
.site-header nav a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  margin-right: 10px;
}
.site-header nav a:hover,
.site-header nav a:focus {
  color: var(--text);
  text-decoration: underline;
}
.site-header.sticky {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(11, 16, 32, 0.7);
}

.title {
  font-size: clamp(1.6rem, 2.2vw + 1rem, 2.2rem);
  font-weight: 800;
  margin: 0;
}
.subtitle {
  color: var(--muted);
  margin: 6px 0 0 0;
}

.card {
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid #1b2448;
  box-shadow: var(--shadow);
  border-radius: var(--radius);
  padding: 18px;
}

/* Layout grids */
.grid {
  display: grid;
  gap: 14px;
}
@media (min-width: 880px) {
  .grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* ===== Generator row (output + buttons) ===== */
.row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
}

/* Button cluster */
.split {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Output box: resilient wrapping for long phrases/separators */
.out {
  width: 100%;
  font: 600 18px ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", "Courier New", monospace;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid #22305b;
  background: #0b1330;
  color: var(--text);

  white-space: pre-wrap; /* keep spaces, allow wrapping */
  word-break: break-word; /* break long tokens */
  overflow-wrap: anywhere; /* last resort wrap */
  overflow-x: auto; /* scroll if truly necessary */
  max-width: 100%;
  min-height: 48px;
}

/* ===== Mobile optimizations for the generator box ===== */
@media (max-width: 700px) {
  /* Stack output above the buttons */
  .row {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  /* Make buttons a responsive grid (3 across by default) */
  .split {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
    justify-items: stretch;
  }

  /* Full-width buttons on mobile */
  .btn {
    width: 100%;
    padding: 12px;
  }

  /* Slightly smaller, comfier output on small screens */
  .out {
    font-size: 16px;
    padding: 12px;
  }
}

/* Very tiny phones: 2-wide buttons so nothing squishes */
@media (max-width: 360px) {
  .split {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Buttons */
.btn {
  border: 0;
  cursor: pointer;
  padding: 12px 14px;
  border-radius: 12px;
  font-weight: 700;
  background: #15214a;
  color: var(--text);
  border: 1px solid #21408a;
  transition: transform 0.06s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.btn:hover,
.btn:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(122, 162, 255, 0.25);
  outline: none;
}
.btn:active {
  transform: translateY(1px);
}
.btn.primary {
  background: linear-gradient(180deg, #2348c9, #1b39a1);
  border-color: #2d57de;
}

/* Tabs – allow horizontal scroll on narrow screens */
.tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.tab {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #274081;
  background: #0d1838;
  cursor: pointer;
  font-weight: 700;
  white-space: nowrap;
}
.tab.active {
  background: linear-gradient(180deg, #2348c9, #1b39a1);
  border-color: #2d57de;
}

/* Options */
.opt {
  padding: 12px;
  background: #0b1330;
  border: 1px solid #22305b;
  border-radius: 12px;
}
.checks {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.ch {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Strength meter */
.strength {
  display: grid;
  gap: 8px;
  margin-top: 6px;
}
.bar {
  height: 12px;
  border-radius: 999px;
  background: #10193a;
  border: 1px solid #22305b;
  overflow: hidden;
}
.fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--bad), var(--warn), var(--ok));
  transition: width 0.25s ease;
}

/* Footer */
.footer {
  color: #91a0d9;
  font-size: 13px;
  text-align: center;
  padding: 8px 0 20px;
}

/* Utilities */
.hide {
  display: none;
}

/* QR responsiveness */
#qrbox {
  max-width: 90vw;
}
#qrbox canvas,
#qrbox img,
#qrbox table {
  width: 100% !important;
  height: auto !important;
}

/* Focus styles */
:focus-visible {
  outline: 3px solid rgba(122, 162, 255, 0.5);
  outline-offset: 2px;
  border-radius: 8px;
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
  .fill {
    transition: none;
  }
  .btn {
    transition: none;
  }
}

/* Screen-reader only */
.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 1px, 1px);
  white-space: nowrap;
  border: 0;
}

/* Extra safety: avoid layout blowouts site-wide */
.wrap,
.card,
.opt,
.out,
.subtitle {
  overflow-wrap: anywhere;
}

