:root {
  --bg: #f6f3ec;
  --bg-2: #efe9dd;
  --ink: #1c1b18;
  --muted: #6a665c;
  --line: #d9d2c2;
  --accent: #c8553d;
  --accent-2: #2f5d62;
  --ok: #5a7a4a;
  --warn: #b07d2a;
  --card: #fffdf7;
  --shadow: 0 1px 2px rgba(28,27,24,.04), 0 8px 24px rgba(28,27,24,.06);
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif; letter-spacing: -.2px; }
h1 { font-size: clamp(1.8rem, 3.2vw, 2.6rem); line-height: 1.15; margin: 0 0 .6rem; }
h2 { font-size: clamp(1.4rem, 2.2vw, 1.8rem); margin: 0 0 .5rem; }
h3 { font-size: 1.05rem; margin: 0 0 .4rem; }
p { margin: 0 0 .8rem; color: #3a3832; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 28px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo {
  width: 38px; height: 38px; border-radius: 10px;
  background: var(--accent); color: #fff;
  display: grid; place-items: center;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text strong { font-family: "Iowan Old Style", Georgia, serif; font-size: 1.1rem; }
.brand-sub { font-size: .78rem; color: var(--muted); }
.topnav { display: flex; gap: 18px; flex-wrap: wrap; }
.topnav a { color: var(--ink); font-size: .92rem; }

main { max-width: 1180px; margin: 0 auto; padding: 28px 20px 60px; }

section { margin-bottom: 56px; }

.hero {
  display: grid; grid-template-columns: 1.3fr 1fr; gap: 32px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 32px; box-shadow: var(--shadow);
  align-items: center;
}
.hero-text p { font-size: 1.05rem; max-width: 52ch; }
.hero-actions { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 16px; border-radius: 10px; font-size: .95rem; cursor: pointer;
  border: 1px solid transparent; background: transparent; color: var(--ink);
  transition: transform .05s ease, background .15s ease, border-color .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { background: #b34731; }
.btn.ghost { border-color: var(--line); background: #fff; }
.btn.ghost:hover { border-color: var(--ink); }

.hero-card {
  display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: center;
  background: var(--bg-2); border-radius: var(--radius); padding: 20px;
}
.ring { position: relative; width: 160px; height: 160px; }
.ring-label {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-family: "Iowan Old Style", Georgia, serif; text-align: center;
}
.ring-label strong { font-size: 1.6rem; display: block; }
.ring-label span { font-size: .78rem; color: var(--muted); }
.hero-stats { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.hero-stats li { display: flex; justify-content: space-between; border-bottom: 1px dashed var(--line); padding-bottom: 4px; }
.hero-stats span { color: var(--muted); }

.tracker { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.cat-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; border-bottom: 1px solid var(--line); padding-bottom: 10px; }
.cat-tab {
  border: 1px solid transparent; background: transparent; padding: 8px 14px; border-radius: 999px;
  cursor: pointer; font-size: .92rem; color: var(--muted);
}
.cat-tab.active { background: var(--ink); color: #fff; }

.tracker-grid { display: grid; grid-template-columns: 340px 1fr; gap: 28px; }
.sidepanel { display: grid; gap: 18px; align-content: start; }
.side-desc { color: var(--muted); font-size: .92rem; margin: 0 0 8px; }

.progress-card { background: var(--bg-2); border-radius: var(--radius); padding: 16px; }
.progress-top { display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: center; }
.progress-ring { position: relative; width: 120px; height: 120px; }
.progress-label { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; font-family: "Iowan Old Style", Georgia, serif; }
.progress-label strong { font-size: 1.4rem; }
.progress-label span { font-size: .72rem; color: var(--muted); display: block; }
.progress-meta { display: grid; gap: 6px; }
.progress-meta div { display: flex; justify-content: space-between; font-size: .92rem; }
.progress-meta span { color: var(--muted); }
.rarity-bar { display: flex; height: 8px; border-radius: 99px; overflow: hidden; margin-top: 12px; background: #e7e4dd; }
.rarity-bar span { display: block; height: 100%; }

.add-form { display: grid; gap: 10px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.add-form label { display: grid; gap: 4px; font-size: .88rem; }
.add-form label span { color: var(--muted); }
.add-form input, .add-form select, .add-form textarea {
  font: inherit; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink);
}
.add-form .row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.io-row { display: flex; flex-wrap: wrap; gap: 8px; }

.collection-panel { display: grid; gap: 14px; align-content: start; }
.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; }
.filter-bar input, .filter-bar select {
  font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff;
}
.filter-bar input { flex: 1; min-width: 160px; }
.collection-header { display: flex; justify-content: space-between; align-items: baseline; }
.collection-count { color: var(--muted); font-size: .9rem; }

.collection-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.collection-item {
  display: grid; grid-template-columns: 28px 1fr auto auto; gap: 12px; align-items: center;
  padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff;
}
.collection-item .dot { width: 14px; height: 14px; border-radius: 50%; background: var(--line); }
.collection-item.owned .dot { background: var(--ok); }
.collection-item.wishlist .dot { background: var(--accent); }
.collection-item.repair .dot { background: var(--warn); }
.collection-item.variant .dot { background: var(--accent-2); }
.collection-item .title { font-weight: 600; }
.collection-item .meta { font-size: .85rem; color: var(--muted); }
.collection-item .rarity { font-size: .78rem; padding: 2px 8px; border-radius: 99px; background: var(--bg-2); }
.collection-item .actions { display: flex; gap: 6px; }
.collection-item .actions button {
  border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 4px 8px; cursor: pointer; font-size: .8rem;
}
.collection-item .actions button:hover { border-color: var(--ink); }
.collection-item .story {
  grid-column: 1 / -1; font-size: .9rem; color: #3a3832; padding: 6px 0 0 40px;
}

.empty-state {
  text-align: center; padding: 30px 20px; color: var(--muted);
  border: 1px dashed var(--line); border-radius: 10px;
}
.empty-state[hidden] { display: none; }

.gap-box { background: var(--bg-2); border-radius: var(--radius); padding: 16px; }
.gap-box h3 { margin-bottom: 4px; }
.gap-note { color: var(--muted); font-size: .9rem; margin: 0 0 10px; }
.gap-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; max-height: 220px; overflow: auto; }
.gap-list li { display: flex; justify-content: space-between; padding: 8px 10px; background: #fff; border: 1px solid var(--line); border-radius: 8px; font-size: .92rem; }
.gap-list li .rarity { font-size: .75rem; color: var(--muted); }

.milestones h2 { text-align: center; }
.section-lede { text-align: center; color: var(--muted); max-width: 60ch; margin: 0 auto 20px; }
.milestone-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.milestone {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; text-align: center;
}
.milestone .badge {
  width: 56px; height: 56px; border-radius: 50%; margin: 0 auto 10px;
  display: grid; place-items: center; font-family: "Iowan Old Style", Georgia, serif; font-size: 1.2rem;
  background: var(--bg-2); color: var(--muted);
}
.milestone.reached .badge { background: var(--accent); color: #fff; }
.milestone h3 { margin-bottom: 4px; }
.milestone p { color: var(--muted); font-size: .88rem; margin: 0; }

.guide { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow); }
.guide-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.guide-grid article { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 16px; }
.sample { margin-top: 24px; }
.sample-table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.sample-table th, .sample-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: .92rem; }
.sample-table th { background: var(--bg-2); font-family: "Iowan Old Style", Georgia, serif; }

.faq { margin-top: 24px; }
.faq details { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; margin-bottom: 8px; background: #fff; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq details[open] summary { margin-bottom: 6px; }

.caveats { margin-top: 24px; background: var(--bg-2); border-radius: 10px; padding: 16px; }
.caveats ul { margin: 0; padding-left: 18px; color: #3a3832; }
.caveats li { margin-bottom: 4px; }

.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 999px;
  font-size: .9rem; opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.footer {
  background: var(--ink); color: #e7e4dd; padding: 32px 20px 18px; margin-top: 40px;
}
.footer-inner { max-width: 1180px; margin: 0 auto; display: grid; grid-template-columns: 1.4fr 1fr; gap: 24px; }
.footer-inner ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.footer-inner a { color: #fff; }
.footer-bottom { max-width: 1180px; margin: 18px auto 0; display: flex; gap: 18px; flex-wrap: wrap; color: #a8a59c; font-size: .85rem; border-top: 1px solid #3a3832; padding-top: 12px; }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; padding: 24px; }
  .tracker-grid { grid-template-columns: 1fr; }
  .topnav { gap: 12px; }
  .footer-inner { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .topbar { flex-direction: column; align-items: flex-start; gap: 10px; }
  .collection-item { grid-template-columns: 20px 1fr; }
  .collection-item .rarity, .collection-item .actions { grid-column: 1 / -1; }
  .collection-item .story { padding-left: 28px; }
}

@media print {
  body { background: #fff; }
  .topbar, .sidepanel, .filter-bar, .io-row, .actions, .footer, .toast, .gap-box, .milestones, .guide, .hero-card { display: none !important; }
  main { padding: 0; }
  .collection-item { break-inside: avoid; border: 1px solid #ccc; }
  .collection-item .dot { border: 1px solid #999; background: #fff !important; }
  h1, h2, h3 { color: #000; }
}



/* Factory-injected deployment helpers. The AI owns the site design above this block. */
.ad-unit {
  width: min(100%, 720px);
  min-height: 120px;
  margin: 24px auto;
  display: block;
}

.legal-page {
  width: min(900px, calc(100% - 32px));
  margin: 40px auto;
}

.factory-fallback-nav {
  width: min(900px, calc(100% - 32px));
  margin: 24px auto 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  font-size: 0.95rem;
}

.factory-fallback-nav a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}
