:root {
  --bg: #0b0906;
  --bg-soft: #14100a;
  --line: #2a2318;
  --line-soft: #201a11;
  --ink: #f4efe4;
  --muted: #a99e8a;
  --gold: #ffc72c;
  --gold-soft: #ffd968;
  --danger: #ff7a6b;
  --ok: #7ddc9a;
  --radius: 14px;
  --pad: clamp(1rem, 3vw, 2rem);
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(900px 480px at 15% -10%, #241a08 0%, transparent 70%),
    radial-gradient(700px 400px at 95% 0%, #191307 0%, transparent 65%),
    var(--bg);
  color: var(--ink);
  font: 400 16px/1.6 "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--gold-soft); text-decoration: none; }
a:hover { color: #fff3cc; }

code {
  font-family: ui-monospace, "Cascadia Mono", "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.9em;
  color: var(--gold-soft);
  overflow-wrap: anywhere;
}

.bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem var(--pad);
  border-bottom: 1px solid var(--line-soft);
  background: rgba(11, 9, 6, 0.86);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 5;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--gold);
  font-weight: 700;
  letter-spacing: 0.01em;
}

.brand img { border-radius: 7px; }

.wordmark { font-size: 1.15rem; }

.crumb {
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  border-left: 1px solid var(--line);
  padding-left: 0.75rem;
}

.quiet {
  margin-left: auto;
  font-size: 0.88rem;
  color: var(--muted);
}

main {
  width: min(880px, 100%);
  margin: 0 auto;
  padding: clamp(1.5rem, 5vw, 3.25rem) var(--pad) 3rem;
  display: grid;
  gap: clamp(1.5rem, 4vw, 2.5rem);
}

.top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

h1 {
  margin: 0 0 0.4rem;
  font-size: clamp(1.7rem, 4vw, 2.3rem);
  letter-spacing: -0.01em;
}

h2 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.15rem, 2.4vw, 1.4rem);
}

.lede {
  margin: 0;
  color: var(--muted);
  max-width: 62ch;
  font-size: 0.94rem;
}

.count {
  margin: 0;
  font-variant-numeric: tabular-nums;
  color: var(--gold);
  font-weight: 700;
  font-size: 1.05rem;
  white-space: nowrap;
}

.keys {
  display: grid;
  gap: 0.9rem;
}

.empty {
  margin: 0;
  padding: 1.4rem;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
  font-size: 0.94rem;
}

.key {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #171208, #100c07);
  padding: 1rem 1.1rem;
  display: grid;
  gap: 0.7rem;
}

.key.is-expired { border-color: #3a2a1c; opacity: 0.86; }

.key-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.key-code {
  font-family: ui-monospace, "Cascadia Mono", Menlo, Consolas, monospace;
  font-size: clamp(0.95rem, 2.4vw, 1.1rem);
  letter-spacing: 0.06em;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.pill {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
}

.pill.live { color: var(--ok); border-color: #23452f; background: #10201855; }
.pill.dead { color: var(--danger); border-color: #4a2a24; background: #20111055; }

.key-meta {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.84rem;
  font-variant-numeric: tabular-nums;
}

.actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: #191308;
  color: var(--ink);
  font: inherit;
  font-size: 0.85rem;
  padding: 0.45rem 0.8rem;
  border-radius: 9px;
  cursor: pointer;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.btn:hover { border-color: #4a3c22; background: #221a0c; }
.btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.btn[disabled] { opacity: 0.45; cursor: default; }

.btn.gold {
  background: linear-gradient(180deg, var(--gold-soft), var(--gold));
  border-color: #c9971c;
  color: #221a05;
  font-weight: 700;
}

.btn.gold:hover { background: linear-gradient(180deg, #ffe89a, #ffd147); }

.btn.danger:hover { border-color: #6a3630; color: var(--danger); }

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(1.1rem, 3vw, 1.6rem);
  background: #0f0c07b8;
  display: grid;
  gap: 0.9rem;
}

.providers {
  display: grid;
  gap: 0.7rem;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.provider {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.9rem;
  background: #151009;
  display: grid;
  gap: 0.55rem;
}

.provider h3 { margin: 0; font-size: 1rem; }
.provider p { margin: 0; color: var(--muted); font-size: 0.82rem; }

.hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.flow-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; }

.keybox {
  margin: 0;
  padding: 0.8rem 0.9rem;
  border: 1px solid #3c3a1e;
  border-radius: 10px;
  background: #1b1708;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 0.95rem;
  letter-spacing: 0.05em;
  word-break: break-all;
}

.notes ul { margin: 0; padding-left: 1.2rem; display: grid; gap: 0.6rem; }
.notes li { color: var(--muted); font-size: 0.9rem; }
.notes strong { color: var(--ink); }

footer {
  border-top: 1px solid var(--line-soft);
  padding: 1.4rem var(--pad) 2rem;
  color: #7b7260;
  font-size: 0.8rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

footer a { color: #a99e8a; }

.toast {
  position: fixed;
  left: 50%;
  bottom: max(1.2rem, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  margin: 0;
  padding: 0.6rem 1rem;
  border-radius: 10px;
  background: #241c0c;
  border: 1px solid #4a3c1c;
  color: var(--ink);
  font-size: 0.86rem;
  box-shadow: 0 12px 30px #0009;
  z-index: 20;
}

.toast[hidden] { display: none; }

@media (max-width: 520px) {
  .bar { gap: 0.5rem; }
  .crumb { display: none; }
  .quiet { font-size: 0.8rem; }
  .key { padding: 0.9rem; }
  .actions .btn { flex: 1 1 auto; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
