/* Look: "Candy Cane Parlor". Cream paper, candy-stripe red and white, felt green, a little gold. */

:root {
  --cream: #fdf3e3;
  --paper: #ffffff;
  --reel: #fffaf0;
  --red: #c8102e;
  --red-dark: #8f0f24;
  --green: #17603f;
  --green-dark: #0c3a26;
  --gold: #ffd34d;
  --gold-dark: #b8860b;
  --ink: #3a1a12;
  --muted: #7a5a4e;
  --line: #f0e2c8;
  --ok: #17603f;
  --bad: #b3261e;
  --display: "Mountains of Christmas", Georgia, serif;
  font-family: Nunito, ui-rounded, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100dvh;
  color: var(--ink);
  background: var(--cream);
  line-height: 1.45;
  font-weight: 600;
}

[hidden] { display: none !important; }

/* The striped shop awning across the top of every page. */
.awning { position: sticky; top: 0; z-index: 3; }
.awning::before {
  content: "";
  display: block;
  height: calc(22px + env(safe-area-inset-top));
  background: repeating-linear-gradient(90deg, var(--red) 0 26px, #fff 26px 52px);
  box-shadow: 0 3px 0 var(--red-dark);
}
.awning::after { /* Scalloped edge. */
  content: "";
  display: block;
  height: 14px;
  background:
    radial-gradient(circle at 13px 0, var(--red) 13px, transparent 13.5px) 0 0 / 52px 14px repeat-x,
    radial-gradient(circle at 39px 0, #fff 13px, transparent 13.5px) 0 0 / 52px 14px repeat-x;
  filter: drop-shadow(0 2px 1px rgba(120, 20, 30, 0.18));
}

.page {
  position: relative;
  width: 100%;
  max-width: 460px;
  margin: 0 auto;
  padding: 4px 16px 40px;
}
.page.wide { max-width: 760px; }

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  margin-bottom: 6px;
  font-size: 0.95rem;
}
.top nav { display: flex; gap: 16px; align-items: center; }
.top a, .linkish {
  color: var(--red-dark);
  background: none;
  border: 0;
  padding: 10px 0;
  font: inherit;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.top .brand { font-family: var(--display); font-weight: 700; font-size: 1.5rem; color: var(--red); line-height: 1; }

h1, h2 { margin: 0; line-height: 1.15; }

/* ---------- Cards and forms ---------- */

.card {
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 22px 20px;
  box-shadow: 0 10px 26px rgba(120, 20, 30, 0.12);
  margin-bottom: 18px;
}
#view-login, #view-message { margin-top: 6vh; }
.card h1 { font-family: var(--display); font-weight: 700; font-size: 2.6rem; color: var(--red); line-height: 1; }
.card h2 { font-size: 1.25rem; font-weight: 900; margin-bottom: 6px; }
.card p { margin: 8px 0 0; }
.muted { color: var(--muted); }
.center { text-align: center; }

label { display: block; font-weight: 800; font-size: 0.9rem; margin: 16px 0 6px; }

input[type="text"], input[type="password"] {
  width: 100%;
  font: inherit;
  font-size: 16px; /* Stops iOS zooming in on focus. */
  padding: 12px 14px;
  border: 2px solid #e6d5b8;
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
}
input:focus-visible, button:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 3px solid var(--green);
  outline-offset: 2px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 10px 18px;
  border: 0;
  border-radius: 14px;
  background: var(--red);
  color: #fff;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 4px 0 var(--red-dark);
  transition: transform 0.08s, box-shadow 0.08s;
}
.btn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--red-dark); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn.block { width: 100%; margin-top: 20px; }
.btn.go { background: var(--green); box-shadow: 0 4px 0 var(--green-dark); }
.btn.quiet { background: #f6ead4; color: var(--ink); box-shadow: 0 4px 0 #e0cda8; }
.btn.quiet:active:not(:disabled) { box-shadow: 0 1px 0 #e0cda8; }
.btn.small { min-height: 38px; padding: 6px 12px; font-size: 0.9rem; }

.error { color: var(--bad); font-weight: 800; margin-top: 12px; min-height: 1.4em; }
.notice { background: #fff3cc; border-radius: 12px; padding: 10px 12px; margin-top: 12px; font-size: 0.95rem; }

/* ---------- Slot machine ---------- */

.marquee { text-align: center; margin-bottom: 12px; }
.marquee h1 {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(2.7rem, 14vw, 3.4rem);
  line-height: 0.95;
  color: var(--red);
}
.marquee .tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  padding: 4px 14px;
  border-radius: 999px;
  background: var(--green);
  color: #fff;
  font-weight: 900;
  font-size: 0.8rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}
.marquee .tag svg { width: 14px; height: 14px; fill: var(--gold); }

/* Candy-stripe frame around a white enamel cabinet. */
.machine {
  padding: 8px;
  border-radius: 30px;
  background: repeating-linear-gradient(-45deg, var(--red) 0 14px, #fff 14px 28px);
  box-shadow: 0 14px 30px rgba(120, 20, 30, 0.3);
}
.machine .inner {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px 12px 16px;
  border-radius: 23px;
  background: var(--paper);
  text-align: center;
}

/* Reels on the left, candy cane lever on the right. */
.cabinet { display: flex; align-items: stretch; gap: 8px; }

.reels {
  --tile: 96px;                       /* Height of one tile. app.js reads this. */
  --view: calc(var(--tile) * 1.9);    /* One full tile with a slice above and below. */
  position: relative;
  flex: 1;
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 7px;
  border-radius: 18px;
  background: var(--green);
  box-shadow: inset 0 4px 8px rgba(0, 0, 0, 0.35);
}
.reel {
  position: relative;
  height: var(--view);
  overflow: hidden;
  border-radius: 11px;
  background: var(--reel);
  color: var(--ink);
}
.reel::after { /* Felt-green shading that makes the reel look like a curved drum. */
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(23, 96, 63, 0.8), rgba(23, 96, 63, 0) 28%, rgba(23, 96, 63, 0) 72%, rgba(23, 96, 63, 0.8));
}
.reel.thunk { animation: thunk 0.22s ease-out; }
@keyframes thunk { 40% { transform: translateY(4px); } }
.strip { will-change: transform; }

/* The payline: a dashed red line across the middle. */
.payline {
  position: absolute;
  left: 2px;
  right: 2px;
  top: 50%;
  height: 0;
  border-top: 3px dashed var(--red);
  opacity: 0.75;
  pointer-events: none;
  z-index: 2;
}
.reels.won { animation: glow 0.8s ease-out 3; }
.reels.won .payline { border-top-color: var(--gold); opacity: 1; }
@keyframes glow { 50% { box-shadow: inset 0 4px 8px rgba(0, 0, 0, 0.35), 0 0 0 5px var(--gold), 0 0 30px 8px rgba(255, 211, 77, 0.9); } }

.tile {
  height: var(--tile);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0 2px;
}
.face {
  width: 58px;
  height: 58px;
  flex: none;
  border-radius: 50%;
  border: 3px solid var(--red);
  background: #fff;
  object-fit: cover;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.6rem;
  font-weight: 900;
}
.face.mystery { background: var(--gold); color: var(--red-dark); }
.tile .label {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.82rem;
  font-weight: 900;
  line-height: 1.1;
}

.lever {
  flex: none;
  width: 46px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}
.lever:disabled { cursor: default; }
.lever svg { width: 46px; height: 150px; overflow: visible; }
.lever .cane { transform-box: fill-box; transform-origin: 50% 100%; }
.lever.pulled .cane { animation: pull 0.7s cubic-bezier(.3, 0, .3, 1); }
@keyframes pull { 35%, 50% { transform: scaleY(0.5); } }

.prompt { margin: 0; min-height: 1.4em; color: var(--green); font-size: 0.82rem; font-weight: 900; letter-spacing: 0.14em; text-transform: uppercase; }
.winner {
  margin: 0;
  min-height: 1em;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(3rem, 17vw, 4rem);
  line-height: 1;
  color: var(--red);
  overflow-wrap: anywhere;
}
.winner.pop { animation: pop 0.5s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes pop { from { transform: scale(0.3); opacity: 0; } }

.spin {
  width: 100%;
  min-height: 62px;
  border: 0;
  border-radius: 20px;
  background: var(--green);
  color: #fff;
  font: inherit;
  font-size: 1.4rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 6px 0 var(--green-dark);
  transition: transform 0.08s, box-shadow 0.08s;
}
.spin:active:not(:disabled) { transform: translateY(5px); box-shadow: 0 1px 0 var(--green-dark); }
.spin:disabled { filter: saturate(0.5) brightness(1.1); cursor: default; }
.spin.again { font-size: 1.1rem; }

.ornaments { display: flex; justify-content: center; gap: 14px; margin-top: 2px; }
.ornaments svg { width: 30px; height: 38px; transform-origin: 50% 0; }
.machine.jackpot .ornaments svg { animation: swing 0.6s ease-in-out 5 alternate; }
.machine.jackpot .ornaments svg:nth-child(even) { animation-direction: alternate-reverse; }
@keyframes swing { from { transform: rotate(-14deg); } to { transform: rotate(14deg); } }

.after { text-align: center; margin: 16px 8px 0; color: var(--muted); }

.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 5; }
.confetti i {
  position: absolute;
  top: -20px;
  width: 10px;
  height: 14px;
  border-radius: 2px;
  animation: fall linear forwards;
}
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }

/* ---------- Admin ---------- */

.people-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin-top: 14px; }
.pick {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 10px 12px;
  min-height: 46px;
  border: 2px solid #e6d5b8;
  border-radius: 14px;
  font-weight: 800;
  font-size: 1rem;
  cursor: pointer;
}
.pick:has(input:checked) { border-color: var(--green); background: #e9f5ee; }
.pick input { width: 20px; height: 20px; accent-color: var(--green); }

.rows { list-style: none; margin: 14px 0 0; padding: 0; }
.rows li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.rows .who { font-weight: 900; }
.rows .sub { color: var(--muted); font-size: 0.9rem; }
.rows form { display: flex; gap: 8px; width: 100%; }
.rows form input { flex: 1; min-width: 0; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 0.85rem; font-weight: 900; }
.badge.yes { background: #dff3e7; color: var(--ok); }
.badge.no { background: #f6ead4; color: var(--muted); }
.badge.fail { background: #fbe3e1; color: var(--bad); }

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 16px; }

.checks { list-style: none; margin: 14px 0 0; padding: 0; }
.checks li { display: flex; gap: 10px; align-items: baseline; padding: 6px 0; }
.checks .mark { font-weight: 900; width: 3.2em; flex: none; }
.checks .pass .mark { color: var(--ok); }
.checks .fail .mark { color: var(--bad); }

.add-person { display: grid; gap: 10px; grid-template-columns: 1fr; margin-top: 14px; }
@media (min-width: 620px) { .add-person { grid-template-columns: 1fr 1fr 1fr auto; align-items: end; } }
.add-person label { margin-top: 0; }

details { border-top: 1px solid var(--line); padding: 10px 0; }
details summary { font-weight: 900; cursor: pointer; padding: 4px 0; }
details ul { margin: 8px 0 0; padding-left: 18px; columns: 2; column-gap: 24px; }
details li { break-inside: avoid; padding: 2px 0; }

@media (max-width: 350px) {
  .reels { --tile: 84px; }
  .face { width: 46px; height: 46px; font-size: 1.3rem; }
  .lever, .lever svg { width: 36px; }
  .ornaments { gap: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .reels.won, .reel.thunk, .winner.pop, .lever.pulled .cane, .machine.jackpot .ornaments svg { animation: none; }
}
