:root {
  --ink: #26263a;
  --muted: #6b6b80;
  --bg: #fffaf2;
  --card: #ffffff;
  --line: #ece4d6;
  --brand: #ff7a45;
  --brand-dark: #e2582a;
  --ok: #2f8f5b;
  --radius: 16px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Nunito", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
  padding-bottom: 110px;
}
h1, h2, .brand, .cta, .tab { font-family: "Fredoka", "Nunito", sans-serif; }
a { color: var(--brand-dark); }

.top { padding: 14px 16px; }
.brand { font-weight: 700; font-size: 1.15rem; color: var(--ink); text-decoration: none; }

.banner {
  margin: 0 16px 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #e7f6ec;
  color: #1d5b39;
  font-size: .95rem;
}

.hero { padding: 4px 16px 12px; text-align: center; }
.hero h1 { font-size: clamp(1.7rem, 6.5vw, 2.8rem); line-height: 1.12; margin: 0 0 8px; }
.hero h1 span { color: var(--brand); }
.hero p { margin: 0 auto; max-width: 34em; color: var(--muted); font-size: 1rem; }
.name-field { display: block; max-width: 420px; margin: 14px auto 0; text-align: left; }
.name-field span { display: block; font-weight: 700; margin-bottom: 4px; }
.name-field input { font-size: 18px; padding: 12px 14px; border: 2px solid var(--brand); }

.builder { display: grid; gap: 18px; padding: 8px 16px 0; max-width: 1080px; margin: 0 auto; }
.preview-wrap {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--bg);
  padding: 8px 0 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
#preview {
  height: 36vh;
  max-height: 560px;
  width: auto;
  max-width: 100%;
  display: block;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 6px 20px rgba(60, 40, 10, .14);
}
.page-tabs { display: flex; gap: 4px; background: #f1e9dc; border-radius: 999px; padding: 3px; }
.ptab {
  border: 0;
  background: none;
  border-radius: 999px;
  padding: 6px 11px;
  font: inherit;
  font-size: .82rem;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
}
.ptab.on { background: #fff; color: var(--ink); box-shadow: 0 1px 4px rgba(0,0,0,.1); }

.controls {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 0 2px 10px rgba(60, 40, 10, .06);
}
.field { display: block; margin-bottom: 18px; }
.field > span { display: block; font-weight: 700; margin-bottom: 6px; }
.field small { font-weight: 600; color: var(--muted); }
input[type=text], input[type=number] {
  width: 100%;
  font: inherit;
  font-size: 16px;
  padding: 10px 12px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
}
input:focus { outline: 2px solid var(--brand); outline-offset: 1px; border-color: transparent; }

.tabs-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.tab {
  border: 1.5px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: .95rem;
  cursor: pointer;
  color: var(--ink);
}
.tab.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.tab.add { border-style: dashed; color: var(--brand-dark); }
.link { background: none; border: 0; color: var(--muted); text-decoration: underline; cursor: pointer; font: inherit; font-size: .85rem; }

.pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pill {
  border: 1.5px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 8px 14px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  color: var(--ink);
}
.pill.on { border-color: var(--brand); background: #fff1ea; color: var(--brand-dark); }

.themes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.theme {
  border: 2px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 8px 4px;
  font: inherit;
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: var(--ink);
}
.theme img { width: 28px; height: 28px; }
.theme.on { border-color: var(--c); box-shadow: inset 0 0 0 1px var(--c); }

.chore-list { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 4px; }
.chore-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px 6px 10px;
  background: #faf6ef;
  border-radius: 10px;
}
.chore-list .l { flex: 1; }
.chore-list img { width: 22px; height: 22px; }
.chore-list button {
  border: 0;
  background: none;
  font-size: 1.3rem;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 2px 8px;
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.chip {
  border: 1.5px dashed var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 5px 10px;
  font: inherit;
  font-size: .85rem;
  cursor: pointer;
  color: var(--ink);
}
.chip img { width: 16px; height: 16px; vertical-align: -3px; margin-right: 4px; }
.chip:disabled { opacity: .4; cursor: default; }
.note { margin: 0 0 8px; font-size: .85rem; color: var(--brand-dark); font-weight: 600; }
.custom button:disabled, .custom input:disabled { opacity: .45; }
.custom { display: flex; gap: 6px; }
.custom button {
  border: 0;
  background: var(--ink);
  color: #fff;
  border-radius: 10px;
  padding: 0 16px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.reward-row { display: flex; gap: 8px; }
.reward-row label { font-size: .85rem; color: var(--muted); font-weight: 600; width: 112px; }
.reward-row label.grow { flex: 1; width: auto; }

.cta-bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: rgba(255, 250, 242, .96);
  backdrop-filter: blur(6px);
  border-top: 1px solid var(--line);
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  text-align: center;
  z-index: 10;
}
.cta {
  width: 100%;
  max-width: 480px;
  border: 0;
  border-radius: 14px;
  background: var(--brand);
  color: #fff;
  font-size: 1.2rem;
  font-weight: 700;
  padding: 14px 18px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(255, 122, 69, .35);
}
.cta:hover { background: var(--brand-dark); }
.cta:disabled { opacity: .7; cursor: wait; }
.unlocked .cta { background: var(--ok); box-shadow: 0 4px 14px rgba(47, 143, 91, .3); }
.cta-note { margin: 6px 0 0; font-size: .8rem; color: var(--muted); }

.how, .faq, .giving, .kit { max-width: 680px; margin: 28px auto 0; padding: 0 16px; }
.kit h2 { font-size: 1.4rem; margin: 0 0 4px; }
.kit > p { margin: 0 0 12px; color: var(--muted); }
.kit-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.kit-grid figure { margin: 0; cursor: pointer; text-align: center; }
.kit-grid canvas { width: 100%; height: auto; background: #fff; border-radius: 6px; box-shadow: 0 3px 12px rgba(60, 40, 10, .12); }
.kit-grid figcaption { font-weight: 700; font-size: .9rem; margin-top: 4px; }
@media (min-width: 700px) { .kit-grid { grid-template-columns: repeat(4, 1fr); } }

.unlocked-panel {
  margin: 0 16px 12px;
  padding: 14px 16px;
  border-radius: 14px;
  background: #e7f6ec;
  color: #1d4d33;
}
.unlocked-panel h2 { margin: 0 0 4px; font-size: 1.3rem; }
.unlocked-panel p { margin: 0 0 10px; }
.secondary {
  border: 1.5px solid #2f8f5b;
  background: #fff;
  color: #1d5b39;
  border-radius: 10px;
  padding: 8px 14px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.tip { margin-top: 10px !important; font-size: .92rem; }
.png-links summary { cursor: pointer; font-weight: 600; margin-top: 6px; }
#png-list { display: grid; gap: 4px; margin-top: 6px; }
#png-list a { color: #1d5b39; }
.unlocked .hero h1, .unlocked .hero > p { display: none; }
body.typing .cta-bar { display: none; }
.how h2, .faq h2 { font-size: 1.4rem; margin: 0 0 10px; }
.how ol { padding-left: 1.2em; margin: 0; display: grid; gap: 8px; }
details { background: var(--card); border-radius: 12px; padding: 12px 14px; margin-bottom: 8px; }
summary { font-weight: 700; cursor: pointer; }
details p { margin: 8px 0 0; color: var(--muted); }
.giving p { background: #eef6fb; border-radius: 12px; padding: 12px 14px; font-size: .95rem; margin: 0; }

.foot { text-align: center; color: var(--muted); font-size: .85rem; padding: 28px 16px; line-height: 1.8; }
.foot a { color: var(--muted); }

.doc { max-width: 680px; margin: 0 auto; padding: 8px 16px 40px; }
.doc h1 { font-size: 1.8rem; }

@media (min-width: 900px) {
  .builder { grid-template-columns: 1fr 1fr; align-items: start; }
  .preview-wrap { top: 16px; }
  #preview { height: auto; width: 100%; max-width: 440px; max-height: none; }
  .cta-bar { position: sticky; bottom: 0; }
}
