:root {
  --bg: #ffffff;
  --fg: #101418;
  --muted: #5c6873;
  --line: #e3e8ee;
  --accent: #1b6ef3;
  --field-bg: #ffffff;
  --field-fg: #101418;
  --accent-dark: #1450b8;
  --ok: #0f7a3d;
  --warn: #b45309;
  --err: #b91c1c;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--fg);
  background: var(--bg);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

header.site, footer.site {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1rem 1.5rem; border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
@media (max-width: 640px) {
  header.site { padding: .85rem 1rem; }
  header.site nav { gap: .8rem; }
  /* Secondary nav is footer-only on a phone: six items forced the header to
     wrap to two rows and pushed the page into horizontal scroll. */
  header.site nav a.secondary { display: none; }
}

nav.foot { display: flex; flex-wrap: wrap; gap: 1.25rem; justify-content: flex-end; }
nav.foot .group { display: flex; flex-wrap: wrap; gap: .75rem; }
nav.foot .group + .group { border-left: 1px solid var(--line); padding-left: 1.25rem; }
@media (max-width: 640px) {
  nav.foot { justify-content: flex-start; }
  nav.foot .group + .group { border-left: 0; padding-left: 0; }
}
footer.site { border-bottom: none; border-top: 1px solid var(--line); color: var(--muted); font-size: .875rem; margin-top: 4rem; }
.brand { font-weight: 700; font-size: 1.15rem; color: var(--fg); letter-spacing: -.02em; }
header.site nav { display: flex; align-items: center; gap: 1.1rem; flex-wrap: wrap; }
header.site nav a { color: var(--muted); font-size: .925rem; }
header.site nav a.btn { color: #fff; }

main { max-width: 940px; margin: 0 auto; padding: 2rem 1.5rem; }
main.narrow, .narrow { max-width: 420px; }

h1 { font-size: 2rem; letter-spacing: -.025em; margin: 0 0 .5rem; }
h2 { font-size: 1.25rem; margin: 2rem 0 .75rem; }
h3 { font-size: 1rem; margin: 1.25rem 0 .5rem; }
p.lead { font-size: 1.125rem; color: var(--muted); margin-top: 0; }

.btn {
  display: inline-block; background: var(--accent); color: #fff; border: 0;
  padding: .6rem 1.1rem; border-radius: var(--radius); font-size: .95rem;
  font-weight: 600; cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--accent-dark); text-decoration: none; }
.btn.small { padding: .4rem .8rem; font-size: .875rem; }
.btn.ghost { background: #fff; color: var(--fg); border: 1px solid var(--line); }
.btn.danger { background: #fff; color: var(--err); border: 1px solid var(--line); }
button.link { background: none; border: 0; color: var(--muted); font: inherit; font-size: .925rem; cursor: pointer; padding: 0; }
button.link:hover { text-decoration: underline; }
form.inline { display: inline; }

label { display: block; font-size: .875rem; font-weight: 600; margin: .9rem 0 .3rem; }
input[type=text], input[type=email], input[type=password], input[type=url], textarea, select {
  width: 100%; padding: .6rem .7rem; border: 1px solid var(--line);
  border-radius: var(--radius); font: inherit;
  background: var(--field-bg); color: var(--field-fg);
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
input[type=color] { width: 3rem; height: 2.2rem; padding: 2px; border: 1px solid var(--line); border-radius: 6px; background: var(--field-bg); }
input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
small.hint { color: var(--muted); font-size: .8125rem; display: block; margin-top: .25rem; }

.card { border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; background: #fff; }
.grid { display: grid; gap: 1rem; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.row { display: flex; gap: 1.5rem; flex-wrap: wrap; align-items: flex-start; }

.notice { padding: .7rem .9rem; border-radius: var(--radius); margin: 1rem 0; font-size: .925rem; border: 1px solid; }
.notice.ok { color: var(--ok); border-color: #bfe3cd; background: #f2fbf5; }
.notice.err { color: var(--err); border-color: #f0c4c4; background: #fef4f4; }
.notice.warn { color: var(--warn); border-color: #f0dcb4; background: #fffaf0; }

table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; font-size: .8125rem; text-transform: uppercase; letter-spacing: .03em; }

code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em; }
.slug { background: #f4f6f9; padding: .15rem .4rem; border-radius: 5px; }

.code-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .75rem; }
.code-list li { border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; display: flex; gap: 1rem; align-items: center; }
.code-list img { width: 76px; height: 76px; flex: none; }
.code-list .meta { flex: 1; min-width: 0; }
.code-list .meta a.title { font-weight: 600; color: var(--fg); }
.code-list .dest { color: var(--muted); font-size: .875rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.count { font-weight: 700; font-size: 1.35rem; }
.count small { display: block; font-size: .75rem; font-weight: 500; color: var(--muted); text-transform: uppercase; }

.bar { background: var(--accent); height: 10px; border-radius: 3px; display: inline-block; vertical-align: middle; }
.badge { font-size: .75rem; padding: .15rem .5rem; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.badge.pro { color: var(--accent); border-color: #c5dbfb; background: #f2f7ff; }
.badge.off { color: var(--warn); border-color: #f0dcb4; background: #fffaf0; }

.plans { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.plans .card ul { padding-left: 1.1rem; margin: .75rem 0; }
.plans .card li { margin: .3rem 0; }
.price { font-size: 2rem; font-weight: 700; letter-spacing: -.03em; }
.price span { font-size: .9rem; font-weight: 500; color: var(--muted); }

.qr-preview { border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; background: #fff; display: inline-block; }
.qr-preview img { display: block; width: 220px; height: 220px; image-rendering: pixelated; }

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1216; --fg: #e8edf3; --muted: #97a3b0; --line: #232a33;
    --field-bg: #151a20; --field-fg: #e8edf3;
  }
  body { background: var(--bg); }
  .card, .qr-preview, .btn.ghost, .btn.danger { background: #151a20; }
  .slug { background: #1b222b; }

  /* Only the backgrounds flipped here before, leaving dark text on dark panels
     at ~3:1. Foregrounds have to flip too. */
  .notice.ok   { background: #10231a; color: #57d493; border-color: #1d4531; }
  .notice.err  { background: #26161a; color: #f28b8b; border-color: #4a2226; }
  .notice.warn { background: #241d12; color: #e8b45c; border-color: #4a3a1c; }

  .badge.pro { background: #16233a; color: #8ab4ff; border-color: #2a3d5c; }
  .badge.off { background: #241d12; color: #e8b45c; border-color: #4a3a1c; }
}
