:root {
  --cream: #f2ece0;
  --paper: #fbf7ef;
  --ink: #1d1b18;
  --red: #d2433a;
  --mustard: #e0a83a;
  --teal: #2e9c95;
  --wobble: 255px 18px 225px 18px / 18px 225px 18px 255px;
  --wobble2: 18px 225px 18px 255px / 255px 18px 225px 18px;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--cream);
  /* scattered stars & hearts, like the drawing */
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cg font-size='18' font-family='sans-serif'%3E%3Ctext x='14' y='30' fill='%23e0a83a'%3E%E2%98%85%3C/text%3E%3Ctext x='150' y='60' fill='%23d2433a'%3E%E2%98%85%3C/text%3E%3Ctext x='90' y='130' fill='%232e9c95'%3E%E2%99%A5%3C/text%3E%3Ctext x='30' y='190' fill='%23d2433a'%3E%E2%98%85%3C/text%3E%3Ctext x='180' y='180' fill='%23e0a83a'%3E%E2%98%85%3C/text%3E%3C/g%3E%3C/svg%3E");
  background-size: 220px 220px;
  color: var(--ink);
  font-family: "Gaegu", "Comic Sans MS", "Chalkboard SE", cursive;
  font-size: 21px;
  line-height: 1.35;
}

main {
  max-width: 520px;
  margin: 0 auto;
  padding: 16px 16px calc(32px + env(safe-area-inset-bottom));
}

.hero {
  display: block;
  width: 100%;
  height: auto;
  border: 3px solid var(--ink);
  border-radius: var(--wobble);
  box-shadow: 4px 5px 0 var(--ink);
  transform: rotate(-1deg);
  margin: 4px 0 22px;
}

.card {
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: var(--wobble2);
  box-shadow: 3px 4px 0 var(--ink);
  padding: 18px 18px 20px;
  margin-bottom: 22px;
}

.intro { transform: rotate(0.6deg); }

p { margin: 0 0 10px; }
p:last-child { margin-bottom: 0; }

.big { font-size: 30px; font-weight: 700; line-height: 1.1; }

.tbc { opacity: 0.7; }

.deadline {
  display: inline-block;
  background: var(--mustard);
  padding: 2px 10px;
  border-radius: 6px 14px 8px 12px;
  transform: rotate(-1.5deg);
}

.field { display: block; margin-bottom: 16px; }
.field > span { display: block; font-weight: 700; margin-bottom: 4px; }
small { font-size: 0.8em; opacity: 0.75; font-weight: 400; }

input[type="text"], input:not([type]), textarea {
  width: 100%;
  font: inherit;
  font-size: 22px; /* >= 16px stops iOS zooming */
  color: var(--ink);
  background: #fff;
  border: 2.5px solid var(--ink);
  border-radius: var(--wobble);
  padding: 10px 14px;
  outline: none;
}
textarea { resize: vertical; }
input:focus, textarea:focus { box-shadow: 0 0 0 3px var(--mustard); }

/* hide real checkboxes but keep them accessible */
.toggle input, .date input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  margin-bottom: 18px;
  user-select: none;
}
.box, .tick {
  flex: none;
  width: 30px;
  height: 30px;
  border: 2.5px solid var(--ink);
  border-radius: 6px 10px 7px 9px;
  background: #fff;
  display: grid;
  place-items: center;
  font-size: 26px;
  font-weight: 700;
  line-height: 1;
}
.toggle input:checked + .box::after,
.date input:checked + .tick::after { content: "✓"; transform: rotate(-8deg) translateY(-2px); }
.toggle input:focus-visible + .box,
.date input:focus-visible + .tick { box-shadow: 0 0 0 3px var(--mustard); }

fieldset { border: 0; padding: 0; margin: 0 0 14px; }
legend { font-weight: 700; padding: 0; margin-bottom: 8px; }

.date {
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  user-select: none;
  border: 2.5px solid var(--ink);
  border-radius: var(--wobble);
  padding: 12px 14px;
  margin-bottom: 10px;
  background: #fff;
  transition: transform 0.12s, background 0.12s;
  -webkit-tap-highlight-color: transparent;
}
.date:nth-of-type(2) { transform: rotate(0.5deg); }
.date:active { transform: scale(0.98); }
.date .when { display: flex; flex-direction: column; line-height: 1.1; }
.date b { font-size: 25px; }

.date.red:has(input:checked)  { background: var(--red);  color: #fff; }
.date.teal:has(input:checked) { background: var(--teal); color: #fff; }
.date.grey:has(input:checked) { background: #ddd6c8; }
.date:has(input:checked) .tick { color: var(--ink); }

button {
  font: inherit;
  font-size: 26px;
  font-weight: 700;
  cursor: pointer;
}
button[type="submit"] {
  width: 100%;
  padding: 12px;
  color: var(--ink);
  background: var(--mustard);
  border: 3px solid var(--ink);
  border-radius: var(--wobble2);
  box-shadow: 3px 4px 0 var(--ink);
}
button[type="submit"]:active { transform: translate(2px, 3px); box-shadow: 1px 1px 0 var(--ink); }
button[disabled] { opacity: 0.6; }

.link {
  background: none;
  border: 0;
  padding: 0;
  font-size: 21px;
  font-weight: 400;
  color: var(--teal);
  text-decoration: underline wavy;
}

.error {
  color: var(--red);
  font-weight: 700;
}

.thanks { text-align: center; transform: rotate(-0.6deg); }

footer { text-align: center; opacity: 0.6; font-size: 18px; }

/* results page */
.tally { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 22px; }
.tally .card { margin: 0; text-align: center; }
.tally .num { font-size: 48px; font-weight: 700; line-height: 1; }
.tally .red  { background: var(--red);  color: #fff; }
.tally .teal { background: var(--teal); color: #fff; }
table { width: 100%; border-collapse: collapse; font-size: 19px; }
th, td { text-align: left; padding: 6px 4px; border-bottom: 2px dashed #cfc6b4; vertical-align: top; }
td.c { text-align: center; }
.note { display: block; opacity: 0.75; font-size: 17px; }
