/* Photo Booth, Roaring Twenties (Années 20) theme: onyx night, gold fans,
   ivory card with a black and gold Art Deco masthead, champagne medallion. */

@font-face {
  font-family: "Limelight";
  src: url("fonts/limelight.woff2") format("woff2");
  font-display: swap;
}
@font-face {
  font-family: "Poiret One";
  src: url("fonts/poiret-one.woff2") format("woff2");
  font-display: swap;
}
@font-face {
  font-family: "Josefin Sans";
  src: url("fonts/josefin-sans.woff2") format("woff2");
  font-weight: 100 700;
  font-display: swap;
}
@font-face {
  font-family: "Cormorant Garamond";
  src: url("fonts/cormorant-garamond.woff2") format("woff2");
  font-weight: 300 700;
  font-display: swap;
}
@font-face {
  font-family: "Cormorant Garamond";
  src: url("fonts/cormorant-garamond-italic.woff2") format("woff2");
  font-style: italic;
  font-display: swap;
}

:root {
  --onyx: #15141a;
  --ink: #2b2a30;
  --muted: #6f6758;
  --gold: #b08a3e;
  --gold-light: #e6c97e;
  --cream: #f8f2e2;
  --night: #0c0c0f;
  --champagne: #efe3c4;
  --garnet: #8c2633;
  --ok: #2e7d5b;
  --display: "Limelight", "Didot", Georgia, serif;
  --deco: "Poiret One", "Futura", sans-serif;
  --sans: "Josefin Sans", "Futura", "Avenir Next", sans-serif;
  --serif: "Cormorant Garamond", "Iowan Old Style", Georgia, serif;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  padding: max(20px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.45;
  color: var(--ink);
  background-color: var(--night);
  background-image: url("img/pattern.svg"), radial-gradient(ellipse at 50% 0%, #2a2418 0%, var(--night) 60%);
  background-attachment: fixed;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

[hidden] { display: none !important; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* The invitation card */
.paper {
  position: relative;
  width: 100%;
  max-width: 460px;
  padding: 44px 30px 30px;
  background: var(--cream);
  border: 2px solid var(--gold);
  outline: 1px solid var(--gold);
  outline-offset: -9px;
  border-radius: 2px;
  box-shadow: 0 0 0 6px var(--night), 0 0 0 7px var(--gold), 0 24px 60px rgba(0, 0, 0, .6);
  text-align: center;
}

.corner {
  position: absolute;
  z-index: 1;
  width: 92px;
  height: 92px;
  pointer-events: none;
  user-select: none;
}
.corner.tl { top: -6px; left: -6px; }
.corner.tr { top: -6px; right: -6px; transform: scaleX(-1); }
.corner.bl { bottom: -6px; left: -6px; transform: scaleY(-1); }
.corner.br { bottom: -6px; right: -6px; transform: scale(-1, -1); }

/* Black and gold masthead across the top of the card */
.masthead {
  position: relative;
  margin: -44px -30px 24px;
  padding: 40px 30px 18px;
  color: var(--champagne);
  background:
    repeating-conic-gradient(from -90deg at 50% 100%, rgba(201, 162, 77, .10) 0 5deg, transparent 5deg 10deg),
    linear-gradient(180deg, #1d1b22, var(--onyx));
  border-bottom: 2px solid var(--gold);
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

.kicker {
  margin: 0 0 4px;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .34em;
  text-transform: uppercase;
  color: var(--gold-light);
}

h1, h2 {
  font-family: var(--display);
  font-weight: 400;
  color: var(--onyx);
  line-height: 1.1;
}
h1 {
  margin: 8px 0 4px;
  font-size: clamp(30px, 9vw, 42px);
  letter-spacing: .02em;
  overflow-wrap: anywhere;
  text-wrap: balance;
}
.masthead .kicker { padding: 0 26px; letter-spacing: .28em; text-wrap: balance; }
.masthead h1 {
  color: var(--gold-light);
  text-shadow: 0 2px 12px rgba(201, 162, 77, .35);
}
h2 { margin: 6px 0 8px; font-size: 32px; }

.date {
  margin: 0;
  font-style: italic;
  color: var(--champagne);
}

.flourish {
  display: block;
  width: 200px;
  max-width: 70%;
  margin: 14px auto;
}

.view p { margin: 0 0 14px; }

.lead {
  font-style: italic;
  font-size: 22px;
  color: var(--onyx);
}

#subtitle {
  font-weight: 600;
  color: var(--onyx);
}

.hint {
  font-size: 15px;
  font-style: italic;
  color: var(--muted);
}

/* Name field */
.field {
  display: block;
  margin: 22px 0 18px;
  text-align: left;
}
.field span {
  display: block;
  margin-bottom: 4px;
  font-size: 15px;
  letter-spacing: .06em;
  color: var(--muted);
}
.field input {
  width: 100%;
  padding: 10px 12px;
  font: inherit;
  font-size: 19px;
  color: var(--onyx);
  background: #fff;
  border: 1px solid #d8cdb5;
  border-radius: 3px;
  appearance: none;
}
.field input:focus {
  outline: 2px solid var(--gold-light);
  border-color: var(--gold);
}
.field input::placeholder { color: #b3b0a8; font-style: italic; }

/* Buttons */
.button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 58px;
  margin: 6px 0 8px;
  padding: 12px 20px;
  font: inherit;
  font-size: 21px;
  font-weight: 600;
  letter-spacing: .03em;
  border-radius: 3px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform .12s ease, box-shadow .12s ease;
}
.button svg { width: 26px; height: 26px; flex: none; }
.button:active { transform: scale(.98); }
.button.primary {
  color: #f3dc98;
  background: linear-gradient(180deg, #2c2a33, var(--onyx));
  border: 1px solid var(--onyx);
  box-shadow: inset 0 0 0 3px var(--onyx), inset 0 0 0 4px var(--gold), 0 6px 14px rgba(10, 10, 12, .3);
}
.button.secondary {
  color: var(--onyx);
  background: transparent;
  border: 1px solid var(--gold);
}
.button:focus-visible { outline: 3px solid var(--gold-light); outline-offset: 2px; }

/* Upload queue */
.queue {
  list-style: none;
  margin: 16px 0 10px;
  padding: 0;
  text-align: left;
}
.queue li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid #eee4d2;
}
.queue img {
  width: 54px;
  height: 54px;
  flex: none;
  object-fit: cover;
  border: 2px solid #fff;
  outline: 1px solid #d8cdb5;
  border-radius: 2px;
  background: var(--champagne) url("img/seal.svg") center / 60% no-repeat;
}
.queue img.broken { color: transparent; }
.queue li > div { flex: 1; min-width: 0; }
.queue span {
  display: block;
  font-size: 16px;
  font-style: italic;
  color: var(--muted);
}
.queue li.ok span { color: var(--ok); font-style: normal; font-weight: 600; }
.queue li.ok span::before { content: "✓ "; }
.queue li.err span { color: var(--garnet); font-style: normal; font-weight: 600; }

progress {
  display: block;
  width: 100%;
  height: 6px;
  margin-top: 6px;
  border: 0;
  border-radius: 3px;
  background: #efe7d6;
  appearance: none;
  overflow: hidden;
}
progress::-webkit-progress-bar { background: #efe7d6; border-radius: 3px; }
progress::-webkit-progress-value { background: linear-gradient(90deg, var(--gold-light), var(--gold)); border-radius: 3px; }
progress::-moz-progress-bar { background: var(--gold); border-radius: 3px; }
.queue li.ok progress::-webkit-progress-value { background: var(--ok); }
.queue li.ok progress::-moz-progress-bar { background: var(--ok); }
.queue li.err progress { opacity: .35; }

/* Confirmation */
.done .seal {
  display: block;
  width: 116px;
  height: 116px;
  margin: 4px auto 0;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .35));
  animation: stamp .55s cubic-bezier(.2, 1.4, .4, 1) both;
}
@keyframes stamp {
  from { transform: scale(1.8) rotate(-18deg); opacity: 0; }
  to { transform: scale(1) rotate(0); opacity: 1; }
}
#done-text { font-size: 21px; font-weight: 600; color: var(--onyx); }

footer .flourish { margin-top: 22px; }
.signature {
  margin: 0;
  font-style: italic;
  color: var(--muted);
}
.signature span {
  font-family: var(--display);
  font-style: normal;
  font-size: 26px;
  letter-spacing: .04em;
  color: var(--onyx);
}

/* Admin page */
.admin .stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 10px 0 20px;
}
.admin .stat {
  padding: 12px 8px;
  border: 1px solid #e6dcc6;
  border-radius: 3px;
  background: #fff;
}
.admin .stat b {
  display: block;
  font-size: 26px;
  color: var(--onyx);
}
.admin .stat small { color: var(--muted); font-size: 14px; }
a.button { text-decoration: none; }
.admin code {
  display: block;
  margin: 6px 0 16px;
  padding: 8px;
  font-size: 13px;
  word-break: break-all;
  background: #fff;
  border: 1px dashed #d8cdb5;
}

/* Printable QR card */
.qr-card .qr {
  display: block;
  width: 260px;
  max-width: 80%;
  margin: 8px auto 14px;
  padding: 10px;
  background: var(--cream);
  border: 1px solid var(--gold);
}
.qr-card .steps { font-size: 18px; }
.print-only { display: none; }
@media print {
  body { background: #fff; padding: 0; }
  .paper { box-shadow: none; max-width: 14cm; margin: 1cm auto; }
  .button.primary, .masthead { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .no-print { display: none !important; }
  .print-only { display: block; }
}

@media (prefers-reduced-motion: reduce) {
  .done .seal { animation: none; }
  .button { transition: none; }
}

@media (max-width: 360px) {
  .paper { padding: 40px 20px 26px; }
  .masthead { margin: -40px -20px 22px; padding-left: 20px; padding-right: 20px; }
  .corner { width: 72px; height: 72px; }
}

/* Admin gallery */
.paper.wide { max-width: 1100px; }
.button.small {
  width: auto;
  min-height: 42px;
  margin: 0;
  padding: 8px 18px;
  font-size: 17px;
}
.gallery-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: center;
  margin: 0 0 14px;
}
.filter select {
  min-height: 42px;
  max-width: 100%;
  padding: 6px 12px;
  font: inherit;
  font-size: 17px;
  color: var(--onyx);
  background: #fff;
  border: 1px solid var(--gold);
  border-radius: 999px;
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(150px, 100%), 1fr));
  gap: 12px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}
@media (max-width: 480px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .lb-bottom { flex-direction: column; gap: 8px; }
  .lb-bottom p { width: 100%; text-align: center; }
}
.grid li { min-width: 0; }
.grid a {
  display: block;
  padding: 6px 6px 4px;
  color: var(--muted);
  text-decoration: none;
  background: #fff;
  border: 1px solid #e6dcc6;
  border-radius: 3px;
  box-shadow: 0 2px 6px rgba(10, 10, 12, .08);
  transition: transform .12s ease, box-shadow .12s ease;
}
.grid a:hover, .grid a:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(10, 10, 12, .16);
  outline: none;
  border-color: var(--gold);
}
.grid img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: var(--champagne);
}
.grid span { margin-top: 4px; color: var(--onyx); }
.grid small { font-size: 13px; }
.grid .no-thumb img {
  object-fit: contain;
  padding: 30%;
  content: url("img/seal.svg");
}
.grid span, .grid small {
  display: block;
  font-size: 14px;
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Full screen viewer */
body.lb-open { overflow: hidden; }
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  padding: max(10px, env(safe-area-inset-top)) 10px max(12px, env(safe-area-inset-bottom));
  color: var(--cream);
  background: rgba(8, 8, 10, .96);
}
.lb-top, .lb-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
}
.lb-top span { font-size: 16px; letter-spacing: .1em; color: var(--gold-light); }
.lb-bottom p { margin: 0; font-style: italic; font-size: 18px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-bottom .button { color: var(--cream); border-color: var(--gold); flex: none; }
.lb-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lb-stage img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border: 3px solid var(--cream);
  box-shadow: 0 10px 40px rgba(0, 0, 0, .5);
}
.lb-error { text-align: center; color: var(--gold-light); }
.lb-btn {
  width: 48px;
  height: 48px;
  flex: none;
  font: inherit;
  font-size: 26px;
  line-height: 1;
  color: var(--cream);
  background: rgba(10, 10, 12, .7);
  border: 1px solid var(--gold);
  border-radius: 50%;
  cursor: pointer;
}
.lb-btn:disabled { opacity: .25; cursor: default; }
.lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 34px;
}
#lb-prev { left: 4px; }
#lb-next { right: 4px; }
@media (hover: none) {
  /* On phones, swipe; the arrows stay discreet. */
  .lb-nav { opacity: .55; }
}

/* Deletion */
.button.danger {
  color: #fff;
  background: linear-gradient(180deg, #a8394a, var(--garnet));
  border: 1px solid var(--garnet);
}
.button:disabled { opacity: .45; cursor: default; transform: none; }
.grid.selecting a { cursor: pointer; }
.grid li { position: relative; }
.grid.selecting li::after {
  content: "";
  position: absolute;
  top: 12px;
  right: 12px;
  width: 26px;
  height: 26px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: rgba(10, 10, 12, .35);
  box-shadow: 0 1px 4px rgba(0, 0, 0, .3);
  pointer-events: none;
}
.grid.selecting li.selected::after {
  content: "✓";
  display: grid;
  place-items: center;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  background: var(--garnet);
}
.grid li.selected a {
  border-color: var(--garnet);
  outline: 2px solid var(--garnet);
}
.grid li.selected img { opacity: .8; }

body.select-open { padding-bottom: 110px; }
.select-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 16px;
  padding: 12px 16px max(12px, env(safe-area-inset-bottom));
  background: var(--cream);
  border-top: 1px solid var(--gold);
  box-shadow: 0 -6px 18px rgba(10, 10, 12, .15);
}
.select-bar span { font-style: italic; color: var(--onyx); }
.select-bar div { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }

.lb-actions { display: flex; gap: 8px; flex: none; }
.lb-bottom .button.danger { color: #fff; border-color: var(--garnet); }

dialog.confirm {
  /* .paper is position: relative, a modal must stay fixed and centred. */
  position: fixed;
  inset: 0;
  width: min(420px, calc(100vw - 32px));
  max-width: none;
  height: fit-content;
  max-height: calc(100dvh - 32px);
  overflow: auto;
  margin: auto;
  padding: 28px 24px 22px;
}
dialog.confirm::backdrop { background: rgba(8, 8, 10, .7); }
dialog.confirm .seal { display: block; width: 64px; height: 64px; margin: 0 auto; }
dialog.confirm h2 { font-size: 28px; margin: 4px 0 6px; }
dialog.confirm p { margin: 0 0 10px; }
dialog.confirm .field { margin: 14px 0 6px; }
.confirm-actions { display: flex; gap: 10px; justify-content: center; margin-top: 16px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 20;
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100vw - 32px);
  text-align: center;
  margin: 0;
  padding: 10px 20px;
  color: var(--cream);
  background: var(--onyx);
  border: 1px solid var(--gold);
  border-radius: 999px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .25);
}
.toast.error { background: var(--garnet); }
body.select-open .toast { bottom: 120px; }
/* In the viewer, keep the buttons at the bottom visible. */
body.lb-open .toast { top: max(70px, env(safe-area-inset-top)); bottom: auto; }

/* Notes for the person celebrated */
.admin .stat.wide-stat { grid-column: 1 / -1; }
.notes {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: grid;
  gap: 14px;
  text-align: left;
}
.letter {
  position: relative;
  padding: 18px 18px 12px;
  background: #fff url("img/pattern.svg") repeat;
  background-color: #fffdf8;
  border: 1px solid #e6dcc6;
  border-left: 3px solid var(--gold);
  border-radius: 3px;
  box-shadow: 0 2px 6px rgba(10, 10, 12, .08);
}
.letter-text {
  margin: 0 0 10px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 19px;
  color: var(--ink);
}
.letter-sign {
  margin: 0;
  font-family: var(--deco);
  font-size: 26px;
  color: var(--onyx);
  text-align: right;
}
.letter-sign small {
  display: block;
  font-family: var(--serif);
  font-size: 14px;
  font-style: italic;
  color: var(--muted);
}
.letter-delete {
  position: absolute;
  bottom: 12px;
  left: 12px;
  padding: 2px 10px;
  font: inherit;
  font-size: 14px;
  color: var(--garnet);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  opacity: .7;
}
.letter-delete:hover, .letter-delete:focus-visible { opacity: 1; border-color: var(--garnet); outline: none; }

/* Counter of what this phone shared */
.tally {
  margin: 4px 0 0;
  padding: 8px 14px;
  font-size: 16px;
  color: var(--ok);
  background: #f1f6ef;
  border: 1px solid #cfe0cb;
  border-radius: 18px;
}
.tally::before { content: "✓ "; font-weight: 700; }
#done-tally { margin-bottom: 14px; }

/* Optional note */
.note {
  margin: 0 0 18px;
  text-align: left;
  border: 1px solid #e6dcc6;
  border-radius: 3px;
  background: #fffdf8;
}
.note summary {
  padding: 12px 14px;
  cursor: pointer;
  list-style: none;
  font-size: 18px;
  color: var(--onyx);
}
.note summary::-webkit-details-marker { display: none; }
.note summary::before { content: "✒ "; color: var(--gold); }
.note summary em { color: var(--muted); font-size: 15px; }
.note[open] summary { border-bottom: 1px dashed #e6dcc6; }
.note textarea {
  display: block;
  width: calc(100% - 28px);
  margin: 12px 14px 4px;
  padding: 10px 12px;
  font: inherit;
  font-size: 18px;
  color: var(--onyx);
  background: #fff;
  border: 1px solid #d8cdb5;
  border-radius: 3px;
  resize: vertical;
}
.note textarea:focus { outline: 2px solid var(--gold-light); border-color: var(--gold); }
.note textarea::placeholder { color: #b3b0a8; font-style: italic; }
.note .note-help { margin: 0 14px 8px; font-size: 14px; }
.note .button { margin: 0 14px 14px; }
.note-ok, .note-status, #done-note { margin: 0 14px 14px; font-size: 16px; color: var(--ok); }
.note-status, #done-note { margin: 0 0 12px; }
.note-ok.error, .note-status.error, #done-note.error { color: var(--garnet); }

/* Add to the home screen */
.button.install { margin: 18px auto 0; gap: 8px; }
.button.install svg { width: 20px; height: 20px; }
.install-help { text-align: left; }
.install-help h2 { text-align: center; font-size: 26px; }
.install-help .app-icon {
  display: block;
  width: 72px;
  height: 72px;
  margin: 0 auto 4px;
  border-radius: 16px;
  box-shadow: 0 4px 12px rgba(10, 10, 12, .25);
}
.install-help ol { margin: 6px 0 12px; padding-left: 22px; }
.install-help li { margin: 0 0 10px; }
.install-help .tip { margin: 0 0 10px; font-size: 0.92em; }
.install-help .hint { text-align: center; }
.inline-icon {
  width: 22px;
  height: 22px;
  vertical-align: -5px;
  color: #2f6fdb;
}

/* Notes linked to the photos sent with them */
.note-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  font-style: normal;
  font-size: 15px;
  color: var(--gold);
  background: var(--cream);
  border: 1px solid var(--gold);
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .25);
  pointer-events: none;
}
.lb-note {
  align-self: center;
  max-width: min(640px, 100%);
  max-height: 22vh;
  overflow: auto;
  margin: 10px 0 0;
  padding: 10px 16px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 18px;
  color: var(--onyx);
  background: var(--cream);
  border-left: 3px solid var(--gold);
  border-radius: 3px;
}
.lb-note::before { content: "✒ "; color: var(--gold); }
.letter-photos { margin: 6px 0 0; text-align: right; font-size: 15px; }
.letter-photos a { color: var(--gold); }

/* Challenges, guest page */
.button.challenge-open { margin-top: 18px; }
.button.challenge-open small { font-size: 15px; font-weight: 400; font-style: italic; color: var(--gold-light); }
.button.challenge-open span { color: var(--gold-light); }
.back-link {
  display: block;
  margin: 0 0 12px;
  padding: 4px 0;
  font: inherit;
  font-size: 17px;
  color: var(--gold);
  background: none;
  border: 0;
  cursor: pointer;
}
.challenges {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: grid;
  gap: 14px;
  text-align: left;
}
.challenges li {
  padding: 14px 16px 16px;
  background: #fffdf8;
  border: 1px solid #e6dcc6;
  border-left: 3px solid var(--gold);
  border-radius: 3px;
}
.challenges li.done { border-left-color: var(--ok); }
.challenges h3 {
  margin: 0 0 4px;
  font-family: var(--display);
  font-weight: 400;
  font-size: 22px;
  line-height: 1.2;
  color: var(--onyx);
}
.challenges p { margin: 0 0 12px; font-size: 17px; }
.challenge-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.challenge-row .button { margin: 0; }
.challenge-done { color: var(--ok); font-weight: 600; font-size: 16px; }
#more-challenges { margin-top: 0; }
.challenge-rule {
  padding: 10px 14px;
  color: var(--onyx);
  background: #fff6dc;
  border: 1px solid var(--gold-light);
  border-radius: 6px;
}

.results-banner {
  display: block;
  margin: 0 0 18px;
  padding: 12px 16px;
  color: var(--onyx);
  text-decoration: none;
  font-weight: 600;
  background: linear-gradient(180deg, #fff6dc, #f7e7bd);
  border: 1px solid var(--gold);
  border-radius: 6px;
  box-shadow: 0 3px 10px rgba(184, 151, 90, .25);
}
.results-banner span { display: block; font-weight: 400; font-style: italic; color: var(--muted); }

/* Challenges, admin gallery */
.challenge-tag {
  display: block;
  margin-top: 2px;
  color: var(--gold) !important;
  font-style: normal !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.grid .medal {
  position: absolute;
  bottom: 52px;
  right: 10px;
  font-style: normal;
  font-size: 30px;
  line-height: 1;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .35));
  pointer-events: none;
}
.lb-podium {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 14px;
  margin: 10px 0 0;
  color: var(--gold-light);
}
.lb-podium div { display: flex; gap: 8px; }
.lb-podium button {
  min-height: 44px;
  padding: 6px 14px;
  font: inherit;
  font-size: 17px;
  font-weight: 600;
  color: var(--cream);
  background: rgba(10, 10, 12, .7);
  border: 1px solid var(--gold);
  border-radius: 999px;
  cursor: pointer;
}
.lb-podium button.on { color: var(--onyx); background: linear-gradient(180deg, #fff1c9, var(--gold-light)); }

/* Challenges, admin overview */
.publish-box {
  margin: 0 0 20px;
  padding: 14px 16px;
  text-align: left;
  background: #fff;
  border: 1px solid #e6dcc6;
  border-left: 3px solid var(--gold);
  border-radius: 3px;
}
.publish-box.on { border-left-color: var(--ok); background: #f6faf4; }
.publish-box p { margin: 0 0 8px; }
.publish-box code { word-break: break-all; }
.challenge-admin {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
  gap: 14px;
  text-align: left;
}
.challenge-admin > li {
  padding: 14px 16px;
  background: #fffdf8;
  border: 1px solid #e6dcc6;
  border-radius: 3px;
}
.challenge-admin h2 { margin: 0 0 4px; font-size: 22px; }
.challenge-admin .hint { margin: 0 0 10px; }
.mini-podium { list-style: none; display: flex; gap: 8px; margin: 0 0 12px; padding: 0; }
.mini-podium li { flex: 1; min-width: 0; text-align: center; font-size: 14px; }
.mini-podium img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 3px; border: 1px solid #e6dcc6; }
.mini-podium span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-podium .empty { padding: 18px 8px; font-style: italic; color: var(--muted); border: 1px dashed #d8cdb5; border-radius: 3px; }

/* Public pages: winners and album */
.tabs {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin: 0 0 20px;
  padding: 4px;
  background: #f1e9d8;
  border-radius: 999px;
}
.tabs a {
  flex: 1;
  max-width: 260px;
  padding: 10px 12px;
  font-size: 17px;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  border-radius: 999px;
}
.tabs a[aria-current="page"] { color: var(--cream); background: var(--onyx); }
.soon .seal { display: block; width: 96px; margin: 8px auto 0; }
.soon h2 { font-size: 28px; }
.podium-card { margin: 24px 0 8px; }
.podium-card h2 { margin-bottom: 2px; font-size: 26px; }
.podium {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.podium li { margin: 0; }
.podium .place-1 { grid-column: 1 / -1; }
.podium img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: var(--champagne);
  border: 4px solid #fff;
  outline: 1px solid #e6dcc6;
  box-shadow: 0 6px 16px rgba(10, 10, 12, .15);
}
.podium .place-1 img { aspect-ratio: auto; max-height: 70vh; object-fit: contain; border-color: var(--gold-light); }
.podium p { margin: 6px 0 0; font-style: italic; color: var(--muted); }
.medal-big { font-style: normal; font-size: 26px; vertical-align: -3px; }

/* A challenge taken up: greyed out, no more photo button */
.challenges li.done {
  background: #f1efea;
  border-left-color: #b9b4a8;
  filter: grayscale(1);
  opacity: .62;
}
.challenges li.done h3 { color: var(--muted); }
.challenges li.done .challenge-done { color: var(--ink); }

/* Podium chosen in the viewer, validated with one button */
.lb-podium { flex-direction: column; }
.lb-places { display: flex; gap: 8px; }
.lb-podium-sum { margin: 0; font-size: 16px; color: var(--cream); white-space: pre; }
.lb-podium .button.primary {
  min-height: 44px;
  color: var(--onyx);
  background: linear-gradient(180deg, #f6e2a8, var(--gold));
  border-color: var(--gold);
  box-shadow: 0 4px 12px rgba(0, 0, 0, .35);
}
.lb-podium .button:disabled { opacity: .6; }
.challenge-admin > li.just-saved { border-color: var(--ok); box-shadow: 0 0 0 3px #d9ead4; }
.challenge-admin > li:target { scroll-margin-top: 20px; }

/* A4 sheet of four A6 QR cards (105 x 148 mm), to cut */
@page { size: A4 portrait; margin: 0; }
body.sheet-page { display: block; padding: 16px; }
.sheet-bar {
  max-width: 210mm;
  margin: 0 auto 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: center;
  color: var(--champagne);
  text-align: center;
}
.sheet-bar .hint { width: 100%; margin: 0; color: var(--champagne); }
.qr-sheet {
  width: 210mm;
  height: 296mm;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 105mm 105mm;
  grid-template-rows: 148mm 148mm;
  background: #fff;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}
.a6 {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 0 5mm;
  overflow: hidden;
  text-align: center;
  color: var(--ink);
  background: var(--cream);
  outline: 1px dashed #b9b3a5;
  outline-offset: -0.5px;
  box-shadow: inset 0 0 0 4mm var(--cream), inset 0 0 0 calc(4mm + 1.2px) var(--gold);
}
.a6-head {
  position: relative;
  width: calc(100% - 8mm);
  margin: 4mm 4mm 0;
  padding: 6mm 6mm 3mm;
  background:
    repeating-conic-gradient(from -90deg at 50% 100%, rgba(201, 162, 77, .12) 0 5deg, transparent 5deg 10deg),
    linear-gradient(180deg, #1d1b22, var(--onyx));
  border-bottom: 1.2px solid var(--gold);
}
.a6-head .kicker { font-size: 7.5pt; letter-spacing: .3em; margin: 0 0 1mm; }
.a6-head h1 {
  margin: 0;
  font-size: 19pt;
  line-height: 1.1;
  color: var(--gold-light);
  text-wrap: balance;
}
.a6-corner { position: absolute; width: 13mm; height: 13mm; top: 1.5mm; }
.a6-corner.tl { left: 1.5mm; }
.a6-corner.tr { right: 1.5mm; transform: scaleX(-1); }
.a6-flourish { display: block; width: 38mm; margin: 2.5mm auto 0; }
.a6-lead { margin: 3.5mm 0 0; font-style: italic; font-size: 12pt; color: var(--onyx); }
.a6-text { margin: 1mm 9mm 0; font-size: 10pt; line-height: 1.3; text-wrap: balance; }
.a6-qr {
  width: 54mm;
  height: 54mm;
  margin: 4mm 0 0;
  padding: 1.5mm;
  background: var(--cream);
  border: 1px solid var(--gold);
}
.a6-hint { margin: 2mm 9mm 0; font-style: italic; font-size: 8.5pt; color: var(--muted); }
.a6-foot { margin-top: auto; }
.a6-foot .a6-flourish { margin-top: 0; }
.a6-foot p { margin: 1mm 0 0; font-family: var(--display); font-size: 12pt; letter-spacing: .04em; color: var(--onyx); }
@media print {
  body.sheet-page { padding: 0; background: #fff; }
  .qr-sheet { margin: 0; }
}
@media screen and (max-width: 840px) {
  .qr-sheet { zoom: .45; }
}
