:root {
  --bg: #12110e;
  --raise: #1c1914;
  --sink: #0e0d0b;
  --ink: #f6f1e7;
  --muted: #b3a898;
  --faint: #9a9084;
  --line: #3a342c;
  --amber: #f0a202;
  --amber-2: #ffd27a;
  --ink-on: #1a1203;
  --bad: #ffb0a4;
  --chip: #2a241c;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  --sans: "Avenir Next", "Segoe UI", ui-sans-serif, system-ui, sans-serif;
  --serif: "Iowan Old Style", Palatino, "Palatino Linotype", Georgia, serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1000px 420px at 100% -10%, rgba(240, 162, 2, 0.16), transparent 55%),
    radial-gradient(700px 320px at -10% 0%, rgba(255, 210, 122, 0.06), transparent 50%),
    var(--bg);
  color: var(--ink);
  font: 16px/1.5 var(--sans);
}

body::before {
  content: "";
  display: block;
  height: 4px;
  background: linear-gradient(90deg, var(--amber), transparent 80%);
}

.wrap {
  width: min(960px, calc(100% - 32px));
  margin: 0 auto;
  padding: 20px 0 40px;
}

.skip {
  position: absolute;
  left: 12px;
  top: -48px;
  background: var(--amber);
  color: var(--ink-on);
  padding: 8px 12px;
  border-radius: 999px;
  font-weight: 700;
  z-index: 5;
}
.skip:focus { top: 12px; }

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

.brand { display: flex; gap: 12px; align-items: center; }
.mark { width: 40px; height: 40px; flex: none; }

.eyebrow {
  margin: 0 0 2px;
  color: var(--amber-2);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(2rem, 4vw, 2.6rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 0.95;
}
h1 span { color: var(--amber); }

.lede {
  margin: 0;
  max-width: 36ch;
  color: var(--muted);
}

.panel {
  background: rgba(28, 25, 20, 0.88);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
}

.panel-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  margin-bottom: 12px;
}

label {
  display: block;
  margin: 0 0 6px;
  font-size: 0.82rem;
  font-weight: 700;
}

.muted, .hint, .note { color: var(--faint); }
.hint, .note { margin: 8px 0 0; font-size: 0.88rem; }
.tools { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.kicker {
  margin: 12px 0 6px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

input[type="text"], input[type="search"] {
  width: 100%;
  min-width: 0;
  background: var(--sink);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.8rem 0.9rem;
  font: inherit;
}

.composer-row { display: flex; gap: 8px; align-items: center; }
.composer-row input { flex: 1; }

.btn {
  appearance: none;
  border: 0;
  background: var(--amber);
  color: var(--ink-on);
  font: inherit;
  font-weight: 700;
  padding: 0.8rem 1rem;
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  line-height: 1.2;
}
.btn.small { padding: 0.45rem 0.8rem; font-size: 0.88rem; }
.btn.ghost {
  background: transparent;
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line);
}
.btn:hover { filter: brightness(1.05); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.text-btn {
  appearance: none;
  border: 0;
  padding: 0;
  background: none;
  color: var(--amber-2);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

:focus-visible {
  outline: 2px solid #fff7e8;
  outline-offset: 3px;
}

.error { color: var(--bad); margin: 8px 0 0; font-weight: 600; }
.status {
  min-height: 1.4em;
  margin: 10px 0 0;
  color: var(--amber-2);
  font-weight: 600;
}

.url-block {
  margin: 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--sink);
  border: 1px solid var(--line);
  overflow-wrap: anywhere;
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.45;
}
.url-block.before { color: var(--muted); }

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}
.chips li {
  background: var(--chip);
  color: var(--amber-2);
  border-radius: 999px;
  padding: 3px 8px;
  font-family: var(--mono);
  font-size: 0.75rem;
}

.draft-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-top: 8px;
}
.draft-actions .hint { margin: 0; }

.band {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px 28px;
  align-items: end;
}

.stats { display: flex; gap: 22px; }
.stats p { margin: 0; }
.stats b {
  display: block;
  font-family: var(--serif);
  font-size: 1.8rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.03em;
}
.stats span { color: var(--faint); font-size: 0.82rem; }

.chart {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  height: 84px;
  align-items: end;
}
.bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  min-width: 0;
  height: 84px;
}
.bar .track {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.bar .track i {
  display: block;
  width: min(100%, 22px);
  border-radius: 6px 6px 2px 2px;
  background: linear-gradient(#ffd27a, var(--amber));
  font-style: normal;
}
.bar.is-zero .track i { height: 3px !important; background: #5c5348; }
.bar b, .bar em {
  font-style: normal;
  font-weight: 600;
  font-size: 11px;
  color: var(--faint);
  line-height: 1;
}

#filter-wrap { margin-bottom: 12px; }

.list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.card {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  background: rgba(14, 13, 11, 0.45);
  min-width: 0;
}
.card.flash { border-color: var(--amber); }

.card-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
}

.slug {
  appearance: none;
  border: 0;
  background: none;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.98rem;
  font-weight: 700;
  padding: 0;
  cursor: pointer;
  text-align: left;
  overflow-wrap: anywhere;
}
.slug:hover { color: var(--amber-2); }

.clicks { color: var(--amber-2); font-weight: 700; white-space: nowrap; font-size: 0.88rem; }
.host { margin: 4px 0; color: var(--muted); font-size: 0.85rem; }
.meta { margin: 8px 0 0; color: var(--faint); font-size: 0.8rem; }
.card .url-block { margin-top: 6px; }

.actions, .card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.empty { margin: 0; color: var(--muted); }

.backup { margin-top: 14px; }
.backup summary { cursor: pointer; font-weight: 700; }
.backup summary:hover { color: var(--amber-2); }

.file { position: relative; display: inline-block; }
.file input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

footer { color: var(--faint); font-size: 0.85rem; }
footer p { margin: 0; }

dialog {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--raise);
  color: inherit;
  padding: 22px;
  width: min(520px, calc(100vw - 32px));
  max-height: min(90vh, 640px);
  overflow: auto;
  box-shadow: var(--shadow);
}
dialog::backdrop { background: rgba(8, 7, 5, 0.72); }
dialog h2 {
  margin: 0 0 8px;
  font-family: var(--serif);
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.15;
  overflow-wrap: anywhere;
}
dialog h2 span { color: var(--amber-2); }
dialog .actions { justify-content: flex-end; }

@media (min-width: 800px) {
  .list { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 700px) {
  .top { flex-direction: column; align-items: start; gap: 8px; }
  .lede { max-width: none; }
  .band { grid-template-columns: 1fr; }
  .stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
}

@media (max-width: 560px) {
  .wrap { width: min(100% - 24px, 960px); padding-top: 20px; }
  .composer-row, .draft-actions { flex-direction: column; align-items: stretch; }
  .composer-row .btn, .actions .btn, .card-actions .btn { width: 100%; }
  dialog .actions { flex-direction: column; }
  dialog .actions .btn { width: 100%; }
  #leave-go { order: -1; }
  .stats b { font-size: 1.45rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn:hover { filter: none; }
}
