/* Cartoon Christmas theme — mobile first. Ink outlines + offset shadows mimic
   the hand-drawn characters in static/img (cut from resources/9648171.jpg). */
:root {
  --ink: #22304a;
  --red: #c62f3b;
  --red-dark: #9e1f2b;
  --green: #1f8a5b;
  --green-dark: #146b45;
  --gold: #ffb800;
  --cream: #fff4e6;
  --peach: #fde3cc;
  --radius: 22px;
  --shadow: 5px 5px 0 var(--ink);
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: "Fredoka", "Baloo 2", system-ui, sans-serif;
  font-size: 18px;
  line-height: 1.4;
  color: var(--ink);
  background-color: var(--red);
  /* falling snow dots */
  background-image:
    radial-gradient(circle, rgba(255,255,255,.35) 2px, transparent 2.5px),
    radial-gradient(circle, rgba(255,255,255,.2) 1.5px, transparent 2px);
  background-size: 46px 46px, 28px 28px;
  background-position: 0 0, 14px 20px;
}

/* admin pages: green with snow, red header so the two colours alternate */
body.green { background-color: var(--green); }
body.green .topbar { background: var(--red); }
body.green footer { background: var(--red-dark); }
body.green .link-btn { background: var(--green); }

/* ---------- header / footer ---------- */
.topbar {
  background: var(--green);
  border-bottom: 4px solid var(--ink);
  color: #fff;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  position: relative;
}
/* candy-cane stripe under the bar */
.topbar::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -14px;
  height: 10px;
  background: repeating-linear-gradient(-45deg, #fff 0 12px, var(--red-dark) 12px 24px);
  border-bottom: 3px solid var(--ink);
}
.brand {
  font-weight: 700;
  font-size: 1.3rem;
  color: #fff;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-right: auto;
  text-shadow: 2px 2px 0 var(--ink);
}
.brand img { width: 34px; height: 34px; object-fit: contain; }
.nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.nav a { color: #fff; font-weight: 600; }
.nav .who { opacity: .9; font-size: .95rem; }

footer {
  margin-top: auto;
  background: var(--green-dark);
  border-top: 4px solid var(--ink);
  color: #e8f5ee;
  text-align: center;
  font-size: .8rem;
  padding: 10px 16px;
}
footer a { color: #fff; }

/* ---------- layout ---------- */
main {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 34px 16px 28px;
}
main.wide { max-width: 760px; }

h1, h2, h3 { margin: 0 0 .5em; line-height: 1.15; }
h1 { font-size: 1.8rem; }
h2 { font-size: 1.35rem; }

.card {
  background: var(--cream);
  border: 3px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 18px;
  margin-bottom: 22px;
}
.card.center { text-align: center; }

/* a character peeking over the top of a card */
.hero {
  display: block;
  margin: 0 auto -18px;
  height: 150px;
  max-width: 70%;
  object-fit: contain;
  position: relative;
  z-index: 1;
  filter: drop-shadow(0 6px 0 rgba(34,48,74,.25));
}
.hero.big { height: 200px; }
.hero + .card { padding-top: 30px; }

/* ---------- flash ---------- */
.flash {
  background: var(--gold);
  border: 3px solid var(--ink);
  border-radius: 16px;
  box-shadow: 3px 3px 0 var(--ink);
  padding: 10px 14px;
  margin: 0 0 18px;
  font-weight: 600;
}

/* ---------- forms ---------- */
label { display: block; font-weight: 600; margin-bottom: 12px; }
input[type=text], input:not([type]), input[type=password], select {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 12px 14px;
  font: inherit;
  font-size: 16px; /* stops iOS zoom on focus */
  color: var(--ink);
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 14px;
}
input:focus, select:focus { outline: 3px solid var(--gold); outline-offset: 2px; }
label.check { display: flex; align-items: center; gap: 8px; }
label.check input { width: 22px; height: 22px; accent-color: var(--green); }

button, .btn {
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  color: #fff;
  background: var(--green);
  border: 3px solid var(--ink);
  border-radius: 999px;
  box-shadow: 3px 3px 0 var(--ink);
  padding: 10px 20px;
  min-height: 44px; /* touch target */
  transition: transform .08s, box-shadow .08s;
}
button:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--ink); }
button:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
button.red { background: var(--red); }
button.ghost { background: #fff; color: var(--ink); }
button.small { padding: 4px 14px; min-height: 36px; font-size: .9rem; }
button.full { width: 100%; }

.link-btn { /* logout looks like a small pill on the green bar */
  background: var(--red);
  padding: 4px 14px;
  min-height: 36px;
  font-size: .9rem;
}

/* ---------- roll ---------- */
.roll-btn {
  display: block;
  width: 100%;
  font-size: 2rem;
  padding: 18px;
  background: var(--gold);
  color: var(--ink);
  box-shadow: 6px 6px 0 var(--ink);
  animation: wiggle 2.4s ease-in-out infinite;
}
.roll-btn:active { animation: none; transform: translate(6px, 6px); box-shadow: none; }
@keyframes wiggle {
  0%, 80%, 100% { transform: rotate(0); }
  85% { transform: rotate(-3deg); }
  90% { transform: rotate(3deg); }
  95% { transform: rotate(-2deg); }
}

.match-name {
  display: inline-block;
  font-size: 2.4rem;
  font-weight: 700;
  color: #fff;
  background: var(--red);
  border: 3px solid var(--ink);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 6px 22px;
  margin: 8px 0 14px;
  transform: rotate(-2deg);
  animation: pop .6s cubic-bezier(.3,1.6,.5,1) both;
  word-break: break-word;
}
@keyframes pop {
  from { transform: scale(0) rotate(-20deg); }
  to { transform: scale(1) rotate(-2deg); }
}
.muted { opacity: .75; font-size: .95rem; }

@media (prefers-reduced-motion: reduce) {
  .roll-btn, .match-name { animation: none; }
}

/* ---------- admin ---------- */
.progress {
  height: 22px;
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 999px;
  overflow: hidden;
  margin: 8px 0 14px;
}
.progress > span {
  display: block;
  height: 100%;
  background: repeating-linear-gradient(-45deg, var(--green) 0 10px, var(--green-dark) 10px 20px);
}

.people { list-style: none; margin: 0 0 16px; padding: 0; }
.people li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 2px dashed rgba(34,48,74,.25);
}
.people li:last-child { border-bottom: 0; }
.people .name { font-weight: 700; margin-right: auto; }
.badge {
  font-size: .75rem;
  font-weight: 700;
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 1px 8px;
  background: var(--gold);
}
.badge.yes { background: var(--green); color: #fff; }
.badge.no { background: #fff; }
.people details { width: 100%; }
.people summary { cursor: pointer; font-size: .9rem; font-weight: 600; color: var(--green-dark); }
.inline-form { display: flex; gap: 8px; margin-top: 8px; }
.inline-form input { margin-top: 0; }

.pair-row { display: flex; gap: 8px; margin-bottom: 12px; }
.pair-row select { margin-top: 0; }
.blocks { list-style: none; padding: 0; margin: 0 0 14px; }
.blocks li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 0; font-weight: 600; }

form.inline { display: inline; }

@media (min-width: 700px) {
  body { font-size: 19px; }
  .hero { height: 190px; }
  .hero.big { height: 240px; }
  main.wide .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 22px; align-items: start; }
}

footer .langs { display: inline-block; margin-left: 8px; }
footer .langs a { font-weight: 700; }

.group-name {
  font-weight: 600;
  background: rgba(255,255,255,.18);
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 2px 12px;
  font-size: .9rem;
}
