/* Kerstquiz builder -- styled after "Form kerstquiz.pptx" */
:root {
  --green-dark: #0b423d;
  --green-deep: #08332f;
  --green: #529a48;
  --green-hover: #5fae54;
  --cream: #fff6d1;
  --cream-dim: #f3e8bd;
  --red: #fc3629;
  --red-hover: #ff5045;
  --ink: #0b423d;
  --muted: rgba(255, 246, 209, 0.72);
  --line: rgba(255, 246, 209, 0.28);
  --error: #ffb4ab;
  --pill: 999px;
  --radius: 22px;
  /* Baguet Script (the template's script font) is a Microsoft cloud font and not
     available on the web; Cookie stands in. */
  --script: 'Cookie', Georgia, serif;
  --display: 'Abril Fatface', 'Elephant', Georgia, serif;
  --body: 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { background: var(--green-dark); }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--green-dark);
  color: var(--cream);
  font: 17px/1.5 var(--body);
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

.trees {
  position: relative;
  height: 56px;
  margin-top: 24px;
  pointer-events: none;
  background: url('../assets/icons/trees-row.svg') 0 100% / auto 56px repeat-x;
  z-index: 0;
}

#app { flex: 1; }

.app {
  position: relative;
  z-index: 1;
  max-width: 1120px;
  margin: 0 auto;
  padding: 24px 16px 40px;
}
.form { max-width: 760px; margin: 0 auto; }

/* ---- header ---- */
.topbar { display: flex; justify-content: flex-end; }
.lang-btn {
  background: transparent;
  color: var(--cream);
  border: 2px solid var(--line);
  border-radius: var(--pill);
  padding: 6px 16px;
  font: inherit;
  font-size: 15px;
  cursor: pointer;
}
.lang-btn:hover { border-color: var(--cream); }

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 560px);
  gap: 56px;
  align-items: center;
  margin: 8px 0 72px;
}
.hero .kicker { font-family: var(--script); font-size: 44px; line-height: 1; }
.hero h1 {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(42px, 5.4vw, 68px);
  line-height: 1.02;
  margin: 6px 0 18px;
  max-width: 11ch;
}
.hero .lead { margin: 0 0 22px; max-width: 34ch; color: var(--muted); font-size: 18px; }
.hero .privacy { display: flex; gap: 10px; align-items: center; margin: 0; font-size: 14px; color: var(--muted); max-width: 40ch; }

/* The live cover preview: the one bold element on the page. */
.preview {
  position: relative;
  margin: 0 0 18px;
  container-type: inline-size;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 28px 60px rgba(2, 22, 20, 0.6), 0 0 0 1px rgba(255, 246, 209, 0.14);
}
.preview img { display: block; width: 100%; height: auto; }
/* Geometry of the template's !!Naam pill (1.86,4.93 in; 4.71 x 0.63 in on 13.33 x 7.5 in). */
.pill-name {
  position: absolute;
  left: 13.95%;
  top: 65.73%;
  width: 35.33%;
  height: 8.4%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 0.7cqw;
  color: var(--cream);
  font-family: 'Segoe UI Black', 'Segoe UI', system-ui, sans-serif;
  font-weight: 900;
  font-size: 1.875cqw;
  letter-spacing: 0.3125cqw;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
}
.pill-name.empty { opacity: 0.5; }
.privacy-badge {
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--green);
  color: var(--cream);
  display: grid;
  place-items: center;
}

/* ---- sections ---- */
.step { margin: 0 0 40px; }
.step-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.step-num {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--cream);
  color: var(--green);
  font-family: var(--display);
  font-size: 20px;
  display: grid;
  place-items: center;
  flex: none;
  padding-top: 1px;
}
.step-head h2 { font-family: var(--display); font-weight: 400; font-size: 28px; margin: 0; letter-spacing: 0.3px; }
.help { color: var(--muted); font-size: 14px; margin: 6px 4px 0; }

/* ---- pills ---- */
.pill-input, .pill-area, .pill-select {
  display: block;
  width: 100%;
  border: 0;
  border-radius: var(--pill);
  background: var(--cream);
  color: var(--ink);
  font: inherit;
  font-size: 19px;
  padding: 14px 26px;
  outline: none;
}
.pill-area { border-radius: 28px; resize: none; overflow: hidden; min-height: 56px; line-height: 1.35; }
.pill-input::placeholder, .pill-area::placeholder { color: rgba(11, 66, 61, 0.55); }
.pill-input:focus-visible, .pill-area:focus-visible, .pill-select:focus-visible,
button:focus-visible, .upload:focus-within, .choice:focus-within {
  box-shadow: 0 0 0 3px var(--green-dark), 0 0 0 6px var(--green-hover);
}
.invalid { box-shadow: 0 0 0 3px var(--green-dark), 0 0 0 6px var(--red) !important; }

/* ---- question-type dropdown (custom listbox, glass panel) ---- */
.dd { position: relative; }
.dd-trigger {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  border: 0;
  border-radius: var(--pill);
  background: var(--red);
  color: var(--cream);
  font: inherit;
  font-size: 19px;
  padding: 9px 22px 9px 10px;
  cursor: pointer;
  text-align: left;
}
.dd-trigger:hover { background: var(--red-hover); }
.dd-trigger .dd-ico {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 246, 209, 0.2);
  display: grid;
  place-items: center;
  flex: none;
}
.dd-label { flex: 1; }
.dd-chev { display: grid; transition: transform 0.2s ease; }
.dd.open .dd-chev { transform: rotate(180deg); }
.dd-list {
  position: absolute;
  z-index: 20;
  left: 0;
  right: 0;
  top: calc(100% + 8px);
  margin: 0;
  padding: 8px;
  list-style: none;
  border-radius: 28px;
  background: rgba(11, 66, 61, 0.62);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  backdrop-filter: blur(18px) saturate(150%);
  border: 1px solid rgba(255, 246, 209, 0.3);
  box-shadow: 0 20px 44px rgba(0, 0, 0, 0.38), inset 0 1px 0 rgba(255, 246, 209, 0.14);
  outline: none;
  animation: dd-in 0.14s ease-out;
}
.dd-list[hidden] { display: none; }
.dd-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px 8px 8px;
  border-radius: var(--pill);
  cursor: pointer;
  color: var(--cream);
  font-size: 17px;
}
.dd-list li + li { margin-top: 2px; }
.dd-list .dd-ico {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 246, 209, 0.12);
  display: grid;
  place-items: center;
  flex: none;
}
.dd-list li.active { background: rgba(255, 246, 209, 0.14); }
.dd-list li.selected { background: var(--cream); color: var(--ink); }
.dd-list li.selected .dd-ico { background: var(--red); color: var(--cream); }
.dd-check { margin-left: auto; color: var(--green); display: grid; }
.dd-list:focus-visible { box-shadow: 0 20px 44px rgba(0, 0, 0, 0.38), 0 0 0 3px var(--green-hover); }
@keyframes dd-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .dd-list { animation: none; } .dd-chev { transition: none; } }

/* ---- rounds ---- */
.round {
  border: 2px solid var(--line);
  border-radius: 32px;
  padding: 20px 18px 22px;
  margin-bottom: 22px;
  background: rgba(8, 51, 47, 0.45);
}
.round-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.round-title { display: flex; align-items: baseline; gap: 10px; }
.round-title .script { font-family: var(--script); font-size: 22px; color: var(--muted); }
.round-title h3 { font-family: var(--display); font-weight: 400; font-size: 30px; margin: 0; }
.round-title .bauble {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--cream);
  color: var(--green);
  font-family: var(--display);
  font-size: 22px;
  padding-top: 1px;
}

/* ---- question card ---- */
.question { padding: 18px 0 6px; border-top: 1px solid var(--line); }
.question:first-of-type { border-top: 0; }
.q-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.q-label { font-family: var(--script); font-size: 38px; color: var(--red); line-height: 1; }
.q-tools { display: flex; gap: 6px; }
.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: transparent;
  color: var(--cream);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.icon-btn .icon, .thumb button .icon { display: grid; place-items: center; }
.icon svg { display: block; }
.icon-btn:hover:not(:disabled) { border-color: var(--cream); }
.icon-btn:disabled { opacity: 0.3; cursor: default; }
.icon-btn.danger:hover:not(:disabled) { border-color: var(--red); color: var(--red); }

.stack { display: grid; gap: 12px; }
.options { display: grid; gap: 10px; margin-left: 48px; }
.option { display: flex; align-items: center; gap: 10px; }
.option .letter {
  flex: none;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--red);
  color: var(--cream);
  font-family: var(--display);
  font-size: 26px;
  display: grid;
  place-items: center;
  margin-right: -36px;
  position: relative;
  z-index: 1;
}
.option .pill-input { padding-left: 50px; }
.correct {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 2px solid var(--line);
  cursor: pointer;
  position: relative;
}
.correct input { position: absolute; opacity: 0; inset: 0; cursor: pointer; margin: 0; }
/* The svg sits in an inline span; without this it rides the text baseline, off-centre. */
.correct > span { display: grid; place-items: center; }
.correct svg { width: 22px; height: 22px; opacity: 0.25; display: block; }
.correct:has(input:checked) { background: var(--green); border-color: var(--green); }
.correct:has(input:checked) svg { opacity: 1; }
.correct:focus-within { box-shadow: 0 0 0 3px var(--green-dark), 0 0 0 6px var(--green-hover); }
.option-tools { display: flex; gap: 8px; align-items: center; margin-left: 48px; flex-wrap: wrap; }
.text-btn {
  background: none;
  border: 0;
  color: var(--cream);
  font: inherit;
  font-size: 15px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 4px 6px;
}
.text-btn:disabled { opacity: 0.35; cursor: default; }
.hint { color: var(--muted); font-size: 14px; margin-left: 4px; }

.answer-pill { background: var(--green); color: var(--cream); }
.answer-pill::placeholder { color: rgba(255, 246, 209, 0.75); }

/* ---- upload rows ---- */
.upload {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 58px;
  border: 2px solid var(--cream);
  border-radius: var(--pill);
  padding: 0 22px 0 0;
  cursor: pointer;
  transition: background 0.15s;
}
.upload:hover { background: rgba(255, 246, 209, 0.06); }
.upload input[type='file'] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.upload .ico {
  flex: none;
  width: 58px;
  height: 58px;
  margin: -2px 0 -2px -2px;
  border-radius: 50%;
  background: var(--red);
  display: grid;
  place-items: center;
}
.upload .ico img { width: 30px; height: 30px; }
.upload .label { flex: 1; font-size: 18px; }
.upload .cloud { width: 40px; height: 40px; flex: none; }

.files { display: flex; flex-wrap: wrap; gap: 10px; }
.file-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--green-deep);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 6px 8px 6px 6px;
  max-width: 100%;
}
.file-chip img, .file-chip video {
  width: 64px;
  height: 48px;
  object-fit: cover;
  border-radius: 10px;
  background: #000;
  flex: none;
}
.file-chip .meta { min-width: 0; font-size: 14px; }
.file-chip .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; display: block; }
.file-chip .size { color: var(--muted); font-size: 13px; }
.file-chip audio { width: 220px; height: 36px; }

.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 8px; }
.thumb { position: relative; aspect-ratio: 3 / 4; border-radius: 12px; overflow: hidden; background: var(--green-deep); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb button {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 0;
  background: rgba(11, 66, 61, 0.85);
  color: var(--cream);
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
}
.count { color: var(--muted); font-size: 14px; }

.field-error { color: var(--error); font-size: 14px; margin: 2px 6px 0; }

/* ---- add buttons ---- */
.divider { border: 0; border-top: 1px solid var(--line); margin: 18px 0 14px; }
.add-q { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.plus {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: 0;
  background: var(--green);
  color: var(--cream);
  font-size: 38px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding-bottom: 4px;
}
.plus:hover { background: var(--green-hover); }
.add-q span { font-size: 14px; color: var(--muted); }

.round-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 16px; }
.toggle { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.toggle .track {
  width: 50px;
  height: 28px;
  border-radius: var(--pill);
  background: rgba(255, 246, 209, 0.25);
  position: relative;
  transition: background 0.15s;
  flex: none;
}
.toggle .track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--cream);
  transition: transform 0.15s;
}
.toggle input:checked + .track { background: var(--green); }
.toggle input:checked + .track::after { transform: translateX(22px); }
.toggle input:focus-visible + .track { box-shadow: 0 0 0 3px var(--green-dark), 0 0 0 6px var(--green-hover); }

.outline-btn {
  border: 2px solid var(--cream);
  background: transparent;
  color: var(--cream);
  border-radius: var(--pill);
  padding: 12px 24px;
  font: inherit;
  font-size: 17px;
  cursor: pointer;
}
.outline-btn:hover { background: rgba(255, 246, 209, 0.08); }
.add-round { width: 100%; }

/* ---- answer mode ---- */
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.choice {
  position: relative;
  border: 2px solid var(--line);
  border-radius: 24px;
  padding: 16px 18px;
  cursor: pointer;
}
.choice input { position: absolute; opacity: 0; }
.choice strong { display: block; font-size: 18px; margin-bottom: 4px; }
.choice span { color: var(--muted); font-size: 14px; }
.choice:has(input:checked) { border-color: var(--cream); background: rgba(255, 246, 209, 0.08); }
.choice:has(input:checked) strong::before { content: '✓ '; color: var(--green-hover); }

/* ---- generate ---- */
.generate-bar { text-align: center; }
.big-btn {
  border: 0;
  background: var(--red);
  color: var(--cream);
  font: inherit;
  font-family: var(--body);
  font-weight: 700;
  font-size: 20px;
  padding: 18px 40px;
  border-radius: var(--pill);
  cursor: pointer;
  width: 100%;
  max-width: 460px;
}
.big-btn:hover { background: var(--red-hover); }
.big-btn:disabled { opacity: 0.5; cursor: default; }
.summary { color: var(--muted); font-size: 14px; margin-top: 10px; }
.errors {
  text-align: left;
  border: 2px solid var(--red);
  border-radius: 20px;
  padding: 14px 20px;
  margin: 0 0 18px;
  background: rgba(252, 54, 41, 0.08);
}
/* Autosave notice above the form ("your quiz is back" / "start over" / "undo"). */
.notice {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 2px solid var(--line);
  border-radius: var(--pill);
  padding: 8px 8px 8px 10px;
  margin: 0 0 28px;
  background: rgba(82, 154, 72, 0.12);
}
.notice-badge {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--green);
  color: var(--cream);
  display: grid;
  place-items: center;
}
.notice-badge .icon { display: grid; place-items: center; }
.notice-text { flex: 1; font-size: 15px; }
/* Heavy-quiz warning above the generate button: same pill, bauble-red accent. */
.notice-warn { border-color: rgba(252, 54, 41, 0.55); background: rgba(252, 54, 41, 0.08); border-radius: var(--radius); text-align: left; padding-right: 18px; }
.notice-warn .notice-badge { background: var(--red); }
.generate-bar .notice { margin: 0 0 18px; }
.file-tip { margin: -2px 6px 0; }
.notice .text-btn { white-space: nowrap; }
.notice-close { width: 32px; height: 32px; flex: none; }
@media (max-width: 520px) {
  /* Row 1: badge, text, close. Row 2: the action, aligned with the text. */
  .notice { flex-wrap: wrap; border-radius: var(--radius); align-items: flex-start; row-gap: 4px; }
  .notice-badge, .notice-close { margin-top: 1px; }
  .notice-text { flex-basis: calc(100% - 90px); padding-top: 5px; }
  .notice-close { order: 2; }
  .notice .text-btn { order: 3; margin-left: 36px; }
}
.errors strong { display: block; margin-bottom: 4px; }
.errors ul { margin: 0; padding-left: 20px; }
.errors li { font-size: 15px; }

/* ---- modal ---- */
.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 30, 27, 0.78);
  display: grid;
  place-items: center;
  padding: 16px;
  z-index: 10;
}
.modal {
  background: var(--green-dark);
  border: 2px solid var(--cream);
  border-radius: 32px;
  padding: 28px 24px 26px;
  width: 100%;
  max-width: 460px;
  text-align: center;
}
.modal h2 { font-family: var(--display); font-weight: 400; font-size: 32px; margin: 0 0 6px; }
.modal p { color: var(--muted); margin: 0 0 18px; }
.modal form { display: grid; gap: 12px; text-align: left; }
.modal .consent { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--muted); }
.modal .consent input { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--green); flex: none; }
.modal .row { display: flex; gap: 10px; justify-content: center; margin-top: 6px; flex-wrap: wrap; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.modal .row-links { gap: 22px; margin-top: 14px; }
.modal .gate-email { color: var(--cream); font-weight: 600; overflow-wrap: anywhere; }
.modal .gate-note { font-size: 14px; }
.modal .gate-status { font-size: 14px; margin: -6px 0 14px; }
.modal .gate-status:empty { display: none; }
.big-btn:disabled { opacity: 0.7; cursor: progress; }
.busy-bar div { width: 35%; animation: busy 1.1s ease-in-out infinite alternate; }
@keyframes busy { from { margin-left: 0; } to { margin-left: 65%; } }
@media (prefers-reduced-motion: reduce) { .busy-bar div { animation: none; width: 100%; opacity: 0.5; } }

.progress { height: 14px; border-radius: var(--pill); background: rgba(255, 246, 209, 0.15); overflow: hidden; margin: 18px 0 10px; }
.progress div { height: 100%; background: var(--green); border-radius: var(--pill); transition: width 0.2s; }
.progress-label { font-size: 14px; color: var(--muted); min-height: 21px; }
.done-mark { font-family: var(--script); font-size: 76px; color: var(--green-hover); line-height: 1; }

.noscript { text-align: center; padding: 40px; }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; gap: 28px; margin-bottom: 52px; }
  .hero h1 { max-width: none; }
}

@media (max-width: 560px) {
  body { font-size: 16px; }
  .pill-input, .pill-area, .pill-select { font-size: 17px; padding: 12px 20px; }
  .options, .option-tools { margin-left: 0; }
  .option .letter { width: 44px; height: 44px; font-size: 22px; margin-right: -32px; }
  .option .pill-input { padding-left: 42px; }
  .correct { width: 42px; height: 42px; }
  .choices { grid-template-columns: 1fr; }
  .round { padding: 16px 12px 18px; border-radius: 26px; }
  .upload .label { font-size: 16px; }
  .upload .cloud { width: 32px; height: 32px; }
  .file-chip .name { max-width: 150px; }
  .file-chip audio { width: 160px; }
}

/* ---- printable answer sheet / key buttons (done screen) ---- */
.printables { display: grid; gap: 10px; margin: 22px 0 8px; text-align: left; }
.printables-label { font-size: 15px; color: var(--muted); text-align: center; }
.pdf-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  border: 2px solid var(--cream);
  background: transparent;
  color: var(--cream);
  border-radius: var(--pill);
  padding: 6px 20px 6px 6px;
  font: inherit;
  font-size: 16px;
  cursor: pointer;
}
.pdf-btn:hover { background: rgba(255, 246, 209, 0.08); }
.pdf-btn .icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--green);
  display: grid;
  place-items: center;
  flex: none;
}
.pdf-btn.busy { opacity: 0.6; cursor: progress; }
