:root {
  color-scheme: light;
  --ink: #16325c;
  --muted: #5c6b80;
  --line: #d5deea;
  --paper: #f3f6fb;
  --card: #ffffff;
  --accent: #1f5fbf;
  --accent-ink: #ffffff;
  --press: #e7f0ff;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
  font-size: 1.125rem;
  color: var(--ink);
  background:
    linear-gradient(180deg, #e8eef8 0, transparent 22rem),
    var(--paper);
}

main {
  width: min(48rem, calc(100% - 2.5rem));
  margin: 2.5rem auto 3.5rem;
}

.stage {
  display: grid;
  grid-template-columns: minmax(0, 26rem) 15rem;
  gap: 1.35rem;
  align-items: start;
  justify-content: start;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 1.35rem;
  padding: 1.4rem 1.5rem 1.5rem;
  box-shadow: 0 18px 40px rgba(22, 50, 92, 0.06);
}

h1 {
  margin: 0 0 0.15rem;
  display: flex;
  justify-content: center;
}

.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;
}

h1 a {
  display: block;
  width: min(16.5rem, 78%);
  margin-inline: auto;
  line-height: 0;
}

h1 img {
  display: block;
  width: 100%;
  height: auto;
}

.password {
  display: flex;
  align-items: center;
  min-height: 4.25rem;
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  border-radius: 0.85rem;
  background: #10233f;
  color: #f4f7fb;
  font-family: ui-monospace, "Source Code Pro", monospace;
  font-size: 1.45rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
  word-break: break-all;
}

.types {
  margin: 0;
  padding: 0;
  border: 0;
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.types legend {
  font-weight: 700;
  font-size: 1.05rem;
  margin-bottom: 0.55rem;
}

.sets {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.set {
  text-align: left;
  background: #f4f7fb;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  padding: 0.7rem 0.85rem;
  font-size: 1.05rem;
  line-height: 1.25;
}

.set[aria-pressed="true"] {
  background: var(--press);
  border-color: var(--accent);
}

.set small {
  display: block;
  margin-top: 0.15rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.toolbar {
  margin-top: 0.85rem;
}

.length-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 0.85rem;
  padding: 0.55rem 0.55rem 0.55rem 1.1rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
}

.slider-side {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
}

.slider-side label {
  font-weight: 700;
  font-size: 1.05rem;
  white-space: nowrap;
}

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

input[type="number"] {
  justify-self: end;
  width: 4.8rem;
  padding: 0.55rem 0.4rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f7f9fc;
  color: var(--ink);
  font: inherit;
  font-size: 1.05rem;
  text-align: center;
}

.actions {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
}

#actionButtons {
  display: flex;
  justify-content: center;
  gap: 0.55rem;
}

#actionButtons[hidden],
#turnstileGate[hidden] {
  display: none !important;
}

.turnstile-msg {
  margin: 0.35rem 0 0;
  color: #b91c1c;
  font-size: 0.85rem;
  text-align: center;
}

button {
  font: inherit;
  font-size: 1.05rem;
  font-weight: 600;
  border: 0;
  border-radius: 999px;
  padding: 0.7rem 1.35rem;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.primary,
.secondary {
  background: var(--accent);
  color: var(--accent-ink);
  border: 0;
  box-shadow: 0 6px 14px rgba(31, 95, 191, 0.28);
}

.primary:hover:not(:disabled),
.secondary:hover:not(:disabled) {
  background: #184f9e;
}

.meta, .note {
  margin: 0.75rem 0 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.4;
  text-align: center;
}

.note[hidden] { display: none; }

@media (max-width: 760px) {
  .stage { grid-template-columns: 1fr; }
  h1 a { width: min(13rem, 78%); }
  .password { font-size: 1.2rem; min-height: 3.6rem; }
  .length-bar {
    grid-template-columns: 1fr;
    border-radius: 1rem;
    padding: 0.7rem;
  }
  .actions { order: 3; }
  input[type="number"] { justify-self: start; }
}
