:root {
  color-scheme: light;
  --pink: oklch(88% 0.062 14);
  --pink-deep: oklch(69% 0.108 10);
  --cream: oklch(98% 0.015 73);
  --cream-strong: oklch(95% 0.025 74);
  --burgundy: oklch(39% 0.075 17);
  --burgundy-soft: oklch(50% 0.07 18);
  --rose: oklch(61% 0.18 355);
  --rose-dark: oklch(49% 0.16 354);
  --teal: oklch(49% 0.08 202);
  --mint: oklch(89% 0.046 187);
  --sun: oklch(83% 0.13 82);
  --ink: oklch(27% 0.034 28);
  --muted: oklch(47% 0.034 24);
  --line: oklch(82% 0.045 16);
  --shadow: oklch(36% 0.06 18 / 0.18);
  --paper-shadow: 0 12px 35px var(--shadow);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  letter-spacing: 0;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--pink);
}

body {
  min-height: 100%;
  margin: 0;
  background:
    radial-gradient(circle at 12% 8%, oklch(97% 0.025 60 / 0.65), transparent 24rem),
    radial-gradient(circle at 92% 18%, oklch(97% 0.03 355 / 0.65), transparent 22rem),
    linear-gradient(180deg, var(--pink), oklch(92% 0.052 10));
  color: var(--ink);
}

button,
input {
  font: inherit;
  letter-spacing: 0;
}

button {
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
}

button:disabled,
input:disabled {
  cursor: not-allowed;
}

svg {
  width: 1em;
  height: 1em;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.app-root {
  min-height: 100svh;
}

.phone-shell {
  position: relative;
  width: min(100%, 430px);
  min-height: 100svh;
  margin: 0 auto;
  padding: max(14px, env(safe-area-inset-top)) 14px max(96px, calc(82px + env(safe-area-inset-bottom)));
  overflow: hidden;
}

@media (min-width: 720px) {
  body {
    padding: 32px 0;
  }

  .phone-shell {
    min-height: 860px;
    border: 1px solid oklch(75% 0.055 16);
    border-radius: 8px;
    box-shadow: 0 28px 80px oklch(30% 0.055 17 / 0.24);
  }
}

.loading-shell {
  display: grid;
  place-items: center;
  padding-bottom: 14px;
}

.splash-card,
.poster-panel,
.join-panel,
.progress-card,
.challenge-group,
.prize-panel,
.leaderboard-panel,
.admin-panel,
.info-panel {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in oklch, var(--cream) 88%, oklch(100% 0 0));
  box-shadow: var(--paper-shadow);
}

.splash-card {
  width: 100%;
  min-height: 560px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 12px;
  padding: 24px;
  text-align: center;
  overflow: hidden;
}

.splash-card h1,
.poster-blob h1 {
  margin: 0;
  color: var(--burgundy);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.08rem, 10.4vw, 2.8rem);
  font-weight: 500;
  line-height: 1.02;
  max-width: 100%;
  white-space: nowrap;
}

.splash-card p {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.splash-art {
  width: min(320px, 95%);
  aspect-ratio: 2 / 1;
  object-fit: cover;
  border-radius: 8px;
}

.loading-dots {
  display: flex;
  gap: 7px;
  margin-top: 8px;
}

.loading-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--rose);
  animation: dotPulse 900ms ease-in-out infinite alternate;
}

.loading-dots span:nth-child(2) {
  animation-delay: 140ms;
}

.loading-dots span:nth-child(3) {
  animation-delay: 280ms;
}

.gate-screen {
  display: grid;
  align-content: start;
  gap: 12px;
}

.poster-panel {
  min-height: 438px;
  padding: 18px 18px 22px;
  overflow: hidden;
  background: var(--pink);
}

.poster-blob {
  position: relative;
  z-index: 1;
  height: 100%;
  min-height: 402px;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  align-items: start;
  justify-items: center;
  padding: 38px 16px 0;
  border-radius: 44% 48% 45% 50% / 9% 9% 10% 10%;
  background: var(--cream);
  text-align: center;
  overflow: hidden;
}

.poster-blob p {
  margin: 14px 0 0;
  color: var(--burgundy);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.28rem;
  font-style: italic;
  font-weight: 700;
  text-transform: uppercase;
}

.poster-blob img {
  align-self: end;
  width: calc(100% + 52px);
  height: 220px;
  max-width: none;
  margin-top: 8px;
  object-fit: cover;
  object-position: center bottom;
}

.join-panel {
  display: grid;
  gap: 16px;
  padding: 18px;
}

.join-copy h2,
.section-title h2,
.prize-panel > p:first-of-type,
.leaderboard-panel h2,
.admin-heading h2,
.info-panel h2 {
  margin: 0;
  color: var(--burgundy);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.65rem;
  font-weight: 500;
  line-height: 1.1;
}

.join-copy p,
.soft-note,
.error-note,
.admin-heading p,
.info-list p,
.mode-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

.join-form {
  display: grid;
  gap: 9px;
}

.join-form label,
.pin-form label {
  color: var(--burgundy);
  font-size: 0.83rem;
  font-weight: 850;
}

.join-form input,
.pin-form input {
  width: 100%;
  min-height: 54px;
  border: 1.5px solid color-mix(in oklch, var(--burgundy) 42%, var(--line));
  border-radius: 8px;
  background: oklch(99% 0.01 70);
  color: var(--ink);
  padding: 0 16px;
  outline: none;
}

.join-form input:focus,
.pin-form input:focus {
  border-color: var(--rose);
  box-shadow: 0 0 0 4px color-mix(in oklch, var(--rose) 16%, transparent);
}

.join-form button,
.pin-form button,
.install-button,
.small-button {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 8px;
  background: var(--rose);
  color: oklch(99% 0.012 70);
  font-size: 0.95rem;
  font-weight: 850;
  box-shadow: 0 12px 24px color-mix(in oklch, var(--rose) 28%, transparent);
}

.join-form button:disabled,
.install-button:disabled {
  opacity: 0.56;
  box-shadow: none;
}

.gate-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--burgundy-soft);
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
}

.app-screen {
  display: grid;
  gap: 12px;
}

.app-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 2px;
}

.tiny-label {
  display: block;
  margin-bottom: 4px;
  color: var(--burgundy-soft);
  font-size: 0.73rem;
  font-weight: 900;
  text-transform: uppercase;
}

.app-top h1 {
  margin: 0;
  color: var(--burgundy);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2.1rem;
  font-weight: 500;
  line-height: 1.04;
}

.icon-button {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--cream);
  color: var(--burgundy);
  box-shadow: 0 8px 18px oklch(36% 0.06 18 / 0.12);
}

.progress-card {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.progress-copy {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
}

.progress-copy strong {
  color: var(--rose-dark);
  font-size: 1.65rem;
  font-weight: 950;
}

.progress-copy span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: color-mix(in oklch, var(--pink) 55%, var(--cream));
}

.progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--rose), var(--sun));
  transition: width 260ms ease-out;
}

.view-wrap {
  display: grid;
  gap: 12px;
}

.hero-strip {
  position: relative;
  min-height: 168px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--pink);
  box-shadow: var(--paper-shadow);
}

.hero-strip img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-strip::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 72%;
  background: linear-gradient(0deg, oklch(18% 0.03 20 / 0.42), transparent);
}

.hero-strip > div {
  position: absolute;
  z-index: 2;
  left: 16px;
  right: 16px;
  bottom: 14px;
  color: oklch(99% 0.01 70);
}

.hero-strip h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2rem;
  font-weight: 500;
}

.hero-strip p {
  max-width: 25ch;
  margin: 5px 0 0;
  font-size: 0.91rem;
  font-weight: 650;
  line-height: 1.35;
}

.challenge-group,
.leaderboard-panel,
.admin-panel,
.info-panel {
  padding: 14px;
}

.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.section-title span {
  flex: 0 0 auto;
  color: var(--rose-dark);
  font-size: 0.83rem;
  font-weight: 900;
}

.challenge-list {
  display: grid;
  gap: 8px;
}

.challenge-row {
  position: relative;
  min-height: 68px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 32px;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid color-mix(in oklch, var(--line) 72%, var(--pink));
  border-radius: 8px;
  background: linear-gradient(90deg, oklch(99% 0.012 70), color-mix(in oklch, var(--pink) 18%, oklch(99% 0.012 70)));
  -webkit-tap-highlight-color: transparent;
}

.challenge-row input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.challenge-row input:disabled {
  cursor: not-allowed;
}

.challenge-row:has(input:focus-visible) {
  outline: 3px solid color-mix(in oklch, var(--rose) 22%, transparent);
  outline-offset: 2px;
}

.challenge-icon,
.checkmark {
  display: grid;
  place-items: center;
  color: var(--rose);
}

.challenge-icon {
  width: 36px;
  height: 36px;
  border: 1px solid color-mix(in oklch, var(--rose) 36%, var(--line));
  border-radius: 50%;
  background: color-mix(in oklch, var(--pink) 34%, var(--cream));
}

.challenge-text {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.challenge-text strong {
  color: var(--burgundy);
  font-size: 0.93rem;
  font-weight: 800;
  line-height: 1.25;
}

.challenge-text small {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1.2;
}

.checkmark {
  width: 30px;
  height: 30px;
  border: 1px solid color-mix(in oklch, var(--rose) 44%, var(--line));
  border-radius: 50%;
  background: var(--cream);
}

.challenge-row.is-done {
  background: color-mix(in oklch, var(--mint) 52%, var(--cream));
  border-color: color-mix(in oklch, var(--teal) 42%, var(--line));
}

.challenge-row.is-done .challenge-icon,
.challenge-row.is-done .checkmark {
  background: var(--teal);
  border-color: var(--teal);
  color: oklch(98% 0.012 190);
}

.challenge-row.is-locked {
  opacity: 0.62;
}

.locked-group {
  background: color-mix(in oklch, var(--cream) 78%, var(--pink));
}

.prize-panel {
  min-height: 430px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 18px;
  padding: 24px;
  overflow: hidden;
  text-align: center;
  background:
    radial-gradient(circle at 18% 18%, oklch(97% 0.025 80 / 0.76), transparent 8rem),
    color-mix(in oklch, var(--pink) 72%, var(--cream));
}

.prize-panel > p:first-of-type {
  font-size: 1.35rem;
  font-style: italic;
}

.gift-card {
  width: min(100%, 284px);
  min-height: 142px;
  display: grid;
  align-content: center;
  gap: 2px;
  padding: 18px;
  border: 1px dashed var(--burgundy-soft);
  border-radius: 8px;
  background:
    linear-gradient(135deg, oklch(98% 0.018 72), oklch(92% 0.034 80));
  color: var(--burgundy);
  box-shadow: 0 18px 35px oklch(36% 0.06 18 / 0.16);
  transform: rotate(1.5deg);
}

.gift-card span {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2.2rem;
  font-weight: 600;
}

.gift-card strong {
  font-size: 1rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.gift-card small {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 800;
  text-transform: uppercase;
}

.lock-medallion {
  width: 76px;
  height: 76px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: color-mix(in oklch, var(--cream) 76%, var(--pink));
  color: var(--burgundy);
  box-shadow: inset 0 0 0 1px var(--line), 0 12px 28px oklch(36% 0.06 18 / 0.14);
  font-size: 2rem;
}

.prize-hint {
  max-width: 28ch;
  margin: 0;
  color: var(--burgundy-soft);
  font-size: 0.95rem;
  font-weight: 750;
  line-height: 1.45;
}

.leaderboard-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.leaderboard-list li {
  min-height: 52px;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: oklch(99% 0.012 70);
}

.leaderboard-list li > span {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--pink);
  color: var(--burgundy);
  font-weight: 900;
}

.leaderboard-list strong {
  color: var(--burgundy);
}

.leaderboard-list em {
  color: var(--rose-dark);
  font-style: normal;
  font-weight: 950;
}

.leaderboard-list .is-current {
  border-color: var(--rose);
  background: color-mix(in oklch, var(--pink) 26%, var(--cream));
}

.admin-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.admin-heading p {
  max-width: 24ch;
}

.small-button {
  min-height: 38px;
  padding: 0 12px;
  flex: 0 0 auto;
  background: var(--burgundy);
  font-size: 0.8rem;
  box-shadow: none;
}

.pin-form {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.pin-form > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 86px;
  gap: 8px;
}

.pin-form input {
  min-height: 46px;
}

.pin-form button {
  min-height: 46px;
  box-shadow: none;
}

.error-note {
  padding: 10px 12px;
  border: 1px solid color-mix(in oklch, var(--rose) 48%, var(--line));
  border-radius: 8px;
  background: color-mix(in oklch, var(--pink) 42%, var(--cream));
  color: var(--burgundy);
  font-weight: 750;
}

.admin-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
}

.participant-cards {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

.participant-cards article {
  min-height: 70px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: oklch(99% 0.012 70);
}

.participant-cards strong {
  color: var(--burgundy);
}

.participant-cards span {
  color: var(--rose-dark);
  font-weight: 950;
}

.participant-cards small {
  grid-column: 1 / -1;
  color: var(--muted);
  font-weight: 700;
}

.matrix-scroll {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.matrix-scroll table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
  background: var(--cream);
}

.matrix-scroll th,
.matrix-scroll td {
  min-width: 48px;
  height: 42px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 6px;
  text-align: center;
  font-size: 0.74rem;
}

.matrix-scroll thead th {
  color: var(--burgundy-soft);
  font-weight: 950;
  background: var(--cream-strong);
}

.matrix-scroll th:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  min-width: 128px;
  color: var(--burgundy);
  text-align: left;
  background: var(--cream);
}

.matrix-scroll thead th:first-child {
  z-index: 2;
  background: var(--cream-strong);
}

.matrix-scroll td.done {
  color: var(--teal);
  font-weight: 900;
}

.matrix-scroll td.done span {
  margin-left: 3px;
  color: var(--muted);
}

.info-panel {
  display: grid;
  gap: 14px;
}

.info-list {
  display: grid;
  gap: 10px;
}

.info-list article {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: oklch(99% 0.012 70);
}

.info-list article > svg {
  color: var(--rose);
  font-size: 1.45rem;
}

.info-list strong {
  color: var(--burgundy);
}

.install-button {
  width: 100%;
}

.mode-note {
  margin: 0;
  text-align: center;
}

.bottom-nav {
  position: fixed;
  left: max(10px, env(safe-area-inset-left));
  right: max(10px, env(safe-area-inset-right));
  bottom: max(10px, env(safe-area-inset-bottom));
  z-index: 10;
  width: min(calc(100% - 20px), 402px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in oklch, var(--cream) 88%, oklch(100% 0 0));
  box-shadow: 0 14px 36px oklch(30% 0.06 18 / 0.2);
}

.bottom-nav button {
  min-width: 0;
  min-height: 52px;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 4px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
}

.bottom-nav svg {
  font-size: 1.22rem;
}

.bottom-nav .is-active {
  background: color-mix(in oklch, var(--pink) 48%, var(--cream));
  color: var(--rose-dark);
}

.doodles {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  color: color-mix(in oklch, var(--rose-dark) 80%, var(--burgundy));
}

.doodle {
  position: absolute;
  opacity: 0.72;
  transform: rotate(var(--turn, 0deg));
}

.doodle svg {
  stroke-width: 1.55;
}

.doodle.ring {
  top: 22px;
  left: 16px;
  font-size: 2.5rem;
  --turn: -18deg;
}

.doodle.bow {
  right: 24px;
  top: 14px;
  font-size: 2.7rem;
  --turn: 14deg;
}

.doodle.disco {
  right: 18px;
  bottom: 68px;
  font-size: 3rem;
  --turn: -6deg;
}

.doodle.sparkle {
  left: 20px;
  bottom: 34px;
  font-size: 2.2rem;
  --turn: 10deg;
}

.hero-strip .doodles {
  display: none;
}

@keyframes dotPulse {
  from {
    transform: translateY(0);
    opacity: 0.5;
  }
  to {
    transform: translateY(-4px);
    opacity: 1;
  }
}

@media (max-width: 360px) {
  .phone-shell {
    padding-left: 10px;
    padding-right: 10px;
  }

  .poster-blob h1 {
    font-size: 2.04rem;
  }

  .splash-card h1 {
    font-size: 2.45rem;
  }

  .poster-panel {
    min-height: 414px;
  }

  .poster-blob {
    min-height: 378px;
    padding-top: 36px;
  }

  .challenge-row {
    grid-template-columns: 34px minmax(0, 1fr) 28px;
    gap: 8px;
    padding: 9px;
  }

  .challenge-icon {
    width: 32px;
    height: 32px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }
}
