:root {
  color-scheme: dark;
  --bg: #121410;
  --raise: #1b1e18;
  --ink: #f3f0e6;
  --muted: #b7b1a3;
  --line: #34382f;
  --line-strong: #4c5246;
  --ochre: #e2b657;
  --ochre-ink: #2a220f;
  --overdue: #ff7a5c;
  --soon: #e2b657;
  --ok: #8fbf9f;
  --sans: ui-sans-serif, "Segoe UI", system-ui, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Code", "Segoe UI Mono", monospace;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { scrollbar-gutter: stable; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(var(--ochre), var(--ochre)) top / 100% 4px no-repeat,
    var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.45;
}

button, input, select { font: inherit; color: inherit; }

button { cursor: pointer; }

:focus { outline: none; }

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

.skip {
  position: absolute;
  left: 12px;
  top: -48px;
  background: var(--ochre);
  color: var(--ochre-ink);
  padding: 8px 12px;
  border-radius: 8px;
  z-index: 5;
  text-decoration: none;
}

.skip:focus { top: 12px; }

.wrap {
  width: min(1080px, calc(100% - 32px));
  margin: 0 auto;
  padding: 36px 0 72px;
}

.top {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 24px;
  margin-bottom: 28px;
}

.brand { display: flex; gap: 14px; align-items: center; }

.mark { flex: none; border: 1px solid var(--line); border-radius: 12px; }

.eyebrow {
  margin: 0 0 4px;
  color: var(--ochre);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(40px, 6vw, 56px);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 0.95;
}

h2 {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.lede {
  max-width: 36ch;
  margin: 0 0 6px;
  color: var(--muted);
  text-wrap: balance;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 0 0 22px;
  padding: 0;
  list-style: none;
}

.stats button {
  width: 100%;
  text-align: left;
  background: var(--raise);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
}

.stats button:disabled { cursor: default; opacity: 0.5; }

.stats .n {
  display: block;
  min-height: 34px;
  font-family: var(--serif);
  font-size: 34px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.stats [data-jump="overdue"] .n { color: var(--overdue); }
.stats [data-jump="soon"] .n { color: var(--soon); }
.stats [data-jump="ok"] .n { color: var(--ok); }

.stats .k {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 22px;
  align-items: start;
}

.side { display: grid; gap: 14px; position: sticky; top: 16px; }

.panel {
  background: var(--raise);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
}

.fields {
  display: grid;
  grid-template-columns: 1.4fr 1.3fr 0.85fr 0.95fr auto;
  gap: 10px 12px;
  align-items: end;
}

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }

.field > span, .length > span {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.ghostlab { visibility: hidden; }

input, select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  background: #10120e;
  border: 1px solid var(--line-strong);
}

input::placeholder { color: #7d786c; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: #10120e;
  text-decoration: none;
  white-space: nowrap;
}

.btn.primary {
  background: var(--ochre);
  border-color: var(--ochre);
  color: var(--ochre-ink);
  font-weight: 600;
}

.btn.ghost { background: transparent; }

.btn:hover { border-color: var(--ochre); }

.btn.primary:hover { filter: brightness(1.06); }

.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.error {
  min-height: 1.2em;
  margin: 8px 0 0;
  color: var(--overdue);
  font-size: 14px;
}

.banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 14px 0 0;
  padding: 10px 12px;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  color: var(--muted);
  font-size: 14px;
}

.banner.warn { border-style: solid; border-color: var(--soon); color: var(--ink); }

.filter { display: block; margin: 14px 0; }

.filter input { border-radius: 12px; }

.group { margin: 0 0 18px; }

.group h2 { display: flex; justify-content: space-between; }

#group-overdue > h2 { color: var(--overdue); }
#group-soon > h2 { color: var(--soon); }
#group-ok > h2 { color: var(--ok); }

.rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }

.row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  background: var(--raise);
  border: 1px solid var(--line);
  border-left: 3px solid var(--line-strong);
  border-radius: 12px;
}

.row:hover { border-color: var(--line-strong); }

.row[data-state="overdue"] { border-left-color: var(--overdue); }
.row[data-state="soon"] { border-left-color: var(--soon); }
.row[data-state="ok"] { border-left-color: var(--ok); }

.row h3 { margin: 0; font-size: 16px; font-weight: 600; overflow-wrap: anywhere; }

.meta, .hint, .note, footer p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.pill {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 6px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  vertical-align: 1px;
}

.when {
  margin: 0;
  min-width: 9.5rem;
  text-align: right;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.row[data-state="overdue"] .when { color: var(--overdue); }
.row[data-state="soon"] .when { color: var(--soon); }
.row[data-state="ok"] .when { color: var(--ok); }

.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.row select { width: auto; padding: 8px 10px; }

.empty {
  padding: 28px 16px;
  border: 1px dashed var(--line-strong);
  border-radius: 14px;
  text-align: center;
}

.empty p { margin: 0 0 8px; }

.note { min-height: 1.4em; }

.note .btn { margin-left: 8px; min-height: 32px; padding: 4px 10px; }

.secret {
  min-height: 52px;
  margin: 12px 0;
  padding: 12px;
  border-radius: 10px;
  background: #10120e;
  border: 1px dashed var(--line-strong);
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.45;
  letter-spacing: 0.02em;
  overflow-wrap: anywhere;
}

.secret:not(:empty) {
  border-style: solid;
  border-color: var(--ochre);
}

.secret:empty::before {
  content: "Nothing generated yet.";
  color: var(--muted);
  font-family: var(--sans);
  letter-spacing: 0;
}

.length output { color: var(--ink); letter-spacing: 0; }

input[type="range"] { accent-color: var(--ochre); padding: 0; }

.classes {
  display: flex;
  gap: 6px;
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
}

.classes li {
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: #6f6a60;
  font-family: var(--mono);
  font-size: 12px;
}

.classes li.on {
  color: var(--ok);
  border-color: var(--ok);
}

footer { margin-top: 28px; }

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

@media (max-width: 900px) {
  .fields { grid-template-columns: 1fr 1fr; }
  .fields .field:last-child { grid-column: 1 / -1; }
  .ghostlab { display: none; }
  .fields .btn { width: 100%; }
}

@media (max-width: 800px) {
  .layout { grid-template-columns: 1fr; }
  .side { position: static; }
  .top { flex-direction: column; align-items: start; }
}

@media (max-width: 560px) {
  .wrap { width: min(1080px, calc(100% - 24px)); padding-top: 24px; }
  .fields { grid-template-columns: 1fr; }
  .stats { gap: 8px; }
  .stats button { padding: 12px 10px; }
  .stats .n { font-size: 28px; }
  .stats .k { font-size: 12px; }
  .row {
    grid-template-columns: 1fr;
    align-items: start;
  }
  .when { text-align: left; min-width: 0; }
  .banner { flex-direction: column; align-items: stretch; }
  .banner .btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
}
