/* Giggle Court. Pastel court colours on cream, chunky toy-like controls.
   Shape rule: buttons, chips and inputs are pills; panels (cards, team buttons,
   mood cards, sheets) use 28px corners. One accent: butter yellow for primary actions. */

@font-face {
  font-family: "Fredoka";
  src: url("/fonts/fredoka-500.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "Fredoka";
  src: url("/fonts/fredoka-600.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: "Fredoka";
  src: url("/fonts/fredoka-700.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: "Nunito";
  src: url("/fonts/nunito.woff2") format("woff2");
  font-weight: 200 1000;
  font-display: swap;
}

:root {
  --cream: #fff8ec;
  --paper: #fffdf8;
  --ink: #1e2a47;
  --ink-soft: #46516e;
  --blue: #a9d4f5;
  --blue-soft: #dceefc;
  --pink: #f9c9d4;
  --pink-soft: #fde3ea;
  --butter: #ffe38a;
  --butter-soft: #fff1bf;
  --mint: #bdebd3;
  --mint-soft: #ddf5e8;
  --line: 3px solid var(--ink);
  --pop: 0 5px 0 var(--ink);
  --r-panel: 28px;
  --display: "Fredoka", "Arial Rounded MT Bold", ui-rounded, system-ui, sans-serif;
  --body: "Nunito", ui-rounded, system-ui, sans-serif;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  background: var(--cream);
}
body {
  margin: 0;
  min-height: 100dvh;
  background:
    radial-gradient(circle at 0% 0%, var(--blue-soft) 0 180px, transparent 181px),
    radial-gradient(circle at 100% 30%, var(--pink-soft) 0 140px, transparent 141px),
    radial-gradient(circle at 0% 100%, var(--mint-soft) 0 200px, transparent 201px),
    var(--cream);
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--body);
  font-size: 18px;
  line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
}
#app {
  max-width: 520px;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 18px calc(110px + env(safe-area-inset-bottom));
}
h1,
h2 {
  font-family: var(--display);
  font-weight: 700;
  line-height: 1.1;
  margin: 0;
  letter-spacing: -0.01em;
}
h1 {
  font-size: 2.1rem;
}
h2 {
  font-size: 1.45rem;
}
.lede {
  font-size: 1.15rem;
  color: var(--ink-soft);
  max-width: 34ch;
  margin: 0 auto;
}
.help {
  color: var(--ink-soft);
  font-size: 0.98rem;
  margin: 4px 0 10px;
}
.label {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.15rem;
  margin: 0 0 8px;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.screen {
  display: grid;
  gap: 18px;
}
.center {
  text-align: center;
  justify-items: center;
  padding-top: 8vh;
}
:focus-visible {
  outline: 4px solid #f2b705;
  outline-offset: 3px;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 56px;
  padding: 0 26px;
  border-radius: 999px;
  border: var(--line);
  background: var(--paper);
  color: var(--ink);
  font: 600 1.12rem/1 var(--display);
  text-decoration: none;
  cursor: pointer;
  box-shadow: var(--pop);
  transition: transform 0.12s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.12s;
  white-space: nowrap;
  width: 100%;
}
.btn:active:not(:disabled) {
  transform: translateY(3px);
  box-shadow: 0 2px 0 var(--ink);
}
.btn:disabled {
  opacity: 0.45;
  cursor: default;
}
.btn-primary {
  background: var(--butter);
}
.btn-xl {
  min-height: 72px;
  font-size: 1.4rem;
}
.btn-lg {
  min-height: 64px;
}
.btn-ghost {
  background: transparent;
  box-shadow: none;
  border-color: transparent;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 5px;
}
.btn-ghost:active:not(:disabled) {
  transform: translateY(1px);
  box-shadow: none;
}
.icon-btn {
  width: 52px;
  height: 52px;
  border-radius: 999px;
  border: var(--line);
  background: var(--paper);
  color: var(--ink);
  font: 700 0.9rem/1 var(--display);
  letter-spacing: 1px;
  box-shadow: 0 3px 0 var(--ink);
  cursor: pointer;
}

/* ---------- Gigi ---------- */
.gigi-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}
.gigi {
  width: 120px;
}
.gigi-s {
  flex-direction: row;
  text-align: left;
  gap: 12px;
}
.gigi-s .gigi {
  width: 74px;
  flex: none;
}
.gigi-l .gigi {
  width: 170px;
}
.gigi-svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}
.bubble {
  position: relative;
  margin: 0;
  background: var(--paper);
  border: var(--line);
  border-radius: 24px;
  padding: 12px 18px;
  font: 600 1.18rem/1.3 var(--display);
  box-shadow: 0 4px 0 var(--ink);
  max-width: 36ch;
}
.bubble small {
  display: block;
  font: 600 0.95rem/1.35 var(--body);
  color: var(--ink-soft);
  margin-top: 4px;
}
.gigi-wrap:not(.gigi-s) .bubble::before {
  content: "";
  position: absolute;
  top: -12px;
  left: 50%;
  width: 18px;
  height: 18px;
  background: var(--paper);
  border-left: var(--line);
  border-top: var(--line);
  transform: translateX(-50%) rotate(45deg);
}
.gigi-s .bubble::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 22px;
  width: 18px;
  height: 18px;
  background: var(--paper);
  border-left: var(--line);
  border-bottom: var(--line);
  transform: rotate(45deg);
}
.gigi-body,
.gigi-shadow,
.gigi-eyes {
  transform-box: fill-box;
  transform-origin: 50% 100%;
}
.gigi-eyes {
  transform-origin: 50% 50%;
}
@media (prefers-reduced-motion: no-preference) {
  .gigi.idle .gigi-body {
    animation: gigi-bounce 2.6s cubic-bezier(0.45, 0, 0.55, 1) infinite;
  }
  .gigi.idle .gigi-shadow {
    animation: gigi-shadow 2.6s cubic-bezier(0.45, 0, 0.55, 1) infinite;
  }
  .gigi .gigi-eyes {
    animation: gigi-blink 4.2s infinite;
  }
  .gigi.hop .gigi-body {
    animation: gigi-hop 0.55s cubic-bezier(0.2, 0.9, 0.3, 1.2);
  }
  .gigi.cheer .gigi-body {
    animation: gigi-cheer 1.1s cubic-bezier(0.3, 1.4, 0.5, 1) infinite;
  }
  .gigi.dance .gigi-body {
    animation: gigi-dance 1.2s ease-in-out infinite;
  }
  .gigi.dance .gigi-shadow,
  .gigi.cheer .gigi-shadow {
    animation: gigi-shadow 1.1s ease-in-out infinite;
  }
}
@keyframes gigi-bounce {
  0%,
  100% {
    transform: translateY(0) scale(1.03, 0.97);
  }
  50% {
    transform: translateY(-9px) scale(0.98, 1.02);
  }
}
@keyframes gigi-shadow {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.14;
  }
  50% {
    transform: scale(0.8);
    opacity: 0.08;
  }
}
@keyframes gigi-blink {
  0%,
  94%,
  100% {
    transform: scaleY(1);
  }
  96% {
    transform: scaleY(0.1);
  }
}
@keyframes gigi-hop {
  0% {
    transform: translateY(0) scale(1.1, 0.9);
  }
  40% {
    transform: translateY(-26px) scale(0.94, 1.06) rotate(-6deg);
  }
  75% {
    transform: translateY(0) scale(1.08, 0.92);
  }
  100% {
    transform: translateY(0) scale(1);
  }
}
@keyframes gigi-cheer {
  0%,
  100% {
    transform: translateY(0) scale(1.06, 0.94);
  }
  45% {
    transform: translateY(-22px) scale(0.96, 1.05);
  }
}
@keyframes gigi-dance {
  0%,
  100% {
    transform: translateY(0) rotate(0);
  }
  25% {
    transform: translateY(-16px) rotate(-10deg);
  }
  50% {
    transform: translateY(0) rotate(0) scale(1.05, 0.95);
  }
  75% {
    transform: translateY(-16px) rotate(10deg);
  }
}

/* ---------- top bars ---------- */
.brand,
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 56px;
}
.wordmark {
  font: 700 1.5rem/1 var(--display);
  color: var(--ink);
  text-decoration: none;
}
.wordmark.small {
  font-size: 1.12rem;
}
.round-label {
  font: 600 1.05rem/1.2 var(--display);
  text-align: center;
  flex: 1;
}
.back {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 999px;
  border: var(--line);
  background: var(--paper);
  color: var(--ink);
  font: 700 2rem/1 var(--display);
  text-decoration: none;
  box-shadow: 0 3px 0 var(--ink);
  padding-bottom: 4px;
}
.topbar h1 {
  font-size: 1.6rem;
  flex: 1;
}
.topbar-gigi .gigi {
  width: 52px;
}

/* ---------- home ---------- */
.home-hero {
  display: grid;
  gap: 18px;
  justify-items: center;
  text-align: center;
  padding-top: 8px;
}
.home-hero h1 {
  font-size: 2.6rem;
}
.how {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: grid;
  gap: 10px;
}
.how li {
  display: flex;
  align-items: center;
  gap: 14px;
  font-weight: 700;
  background: var(--paper);
  border-radius: var(--r-panel);
  padding: 12px 16px;
  border: 2px solid rgba(30, 42, 71, 0.15);
}
.how-n {
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  font: 700 1.2rem/1 var(--display);
  border: var(--line);
}
.how li:nth-child(1) .how-n {
  background: var(--blue);
}
.how li:nth-child(2) .how-n {
  background: var(--pink);
}
.how li:nth-child(3) .how-n {
  background: var(--mint);
}

/* ---------- setup ---------- */
form {
  display: grid;
  gap: 22px;
}
fieldset {
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
}
legend {
  font: 700 1.4rem/1.2 var(--display);
  padding: 0;
}
.names {
  display: grid;
  gap: 10px;
  margin-bottom: 10px;
}
.name-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.input {
  flex: 1;
  min-width: 0;
  height: 60px;
  border-radius: 999px;
  border: var(--line);
  background: var(--paper);
  color: var(--ink);
  font: 700 1.2rem var(--body);
  padding: 0 22px;
}
.input::placeholder {
  color: #6b7490;
  font-weight: 600;
}
.remove {
  flex: none;
  width: 52px;
  height: 52px;
  border-radius: 999px;
  border: var(--line);
  background: var(--pink-soft);
  color: var(--ink);
  font: 700 1.5rem/1 var(--display);
  cursor: pointer;
}
.moods {
  display: grid;
  gap: 12px;
  margin-top: 10px;
}
.mood {
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
  padding: 16px 18px;
  border-radius: var(--r-panel);
  border: 3px solid rgba(30, 42, 71, 0.18);
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  transition: transform 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}
.mood[aria-checked="true"] {
  border: var(--line);
  box-shadow: var(--pop);
}
.mood-fun[aria-checked="true"] {
  background: var(--pink);
}
.mood-mix[aria-checked="true"] {
  background: var(--blue);
}
.mood-compete[aria-checked="true"] {
  background: var(--butter);
}
.mood:active {
  transform: scale(0.98);
}
.mood-emoji {
  font-size: 2.2rem;
  flex: none;
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--cream);
}
.mood-title {
  display: block;
  font: 700 1.3rem/1.2 var(--display);
}
.mood-body {
  display: block;
  font-size: 1rem;
  color: var(--ink);
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.chip {
  min-height: 56px;
  min-width: 64px;
  padding: 8px 20px;
  border-radius: 999px;
  border: var(--line);
  background: var(--paper);
  color: var(--ink);
  font: 700 1.15rem/1.15 var(--display);
  cursor: pointer;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.chip small {
  font: 600 0.82rem/1.2 var(--body);
}
.chip[aria-checked="true"],
.chip[aria-pressed="true"] {
  background: var(--ink);
  color: var(--cream);
}
.team-preview {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.team-pill {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 999px;
  border: var(--line);
  font-weight: 800;
}
.team-a {
  background: var(--blue);
}
.team-b {
  background: var(--pink);
}
.vs {
  font: 700 1rem var(--display);
  color: var(--ink-soft);
}
.form-error {
  margin: 0;
  min-height: 1.4em;
  color: #a3123a;
  font-weight: 800;
}
.form-error:empty {
  display: none;
}

/* ---------- share / join ---------- */
.share,
.join {
  text-align: center;
  justify-items: center;
}
.link-box {
  width: 100%;
  background: var(--paper);
  border: 2px dashed var(--ink);
  border-radius: var(--r-panel);
  padding: 14px 16px;
  font-weight: 800;
  overflow-wrap: anywhere;
}
.qr {
  margin: 0;
  display: grid;
  justify-items: center;
  gap: 6px;
  color: var(--ink-soft);
  font-size: 0.95rem;
}
.qr svg {
  width: 180px;
  height: 180px;
  background: #fff;
  border-radius: 20px;
  border: var(--line);
}
.name-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.name-chip {
  min-height: 76px;
  border-radius: 999px;
  border: var(--line);
  box-shadow: var(--pop);
  font: 700 1.35rem/1.1 var(--display);
  color: var(--ink);
  cursor: pointer;
  padding: 6px 12px;
  overflow-wrap: anywhere;
}
.name-chip:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 var(--ink);
}
.c0 {
  background: var(--blue);
}
.c1 {
  background: var(--pink);
}
.c2 {
  background: var(--butter);
}
.c3 {
  background: var(--mint);
}

/* ---------- play ---------- */
.play {
  gap: 14px;
}
.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  background: var(--paper);
  border: var(--line);
  border-radius: 999px;
  padding: 5px;
}
.tab {
  min-height: 48px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font: 700 1.05rem var(--display);
  cursor: pointer;
}
.tab[aria-selected="true"] {
  background: var(--ink);
  color: var(--cream);
}
.status {
  margin: 0;
  padding: 12px 16px;
  border-radius: var(--r-panel);
  background: var(--butter-soft);
  font-weight: 800;
  text-align: center;
}
.status.mint {
  background: var(--mint);
}
.matchup {
  margin: 4px 0 0;
  text-align: center;
  font-size: 1.1rem;
}
.court-tag {
  display: inline-block;
  font: 700 0.85rem/1 var(--display);
  background: var(--ink);
  color: var(--cream);
  border-radius: 999px;
  padding: 5px 10px;
  vertical-align: 2px;
}
.mini-score {
  margin: -4px 0 0;
  text-align: center;
  font: 600 1.05rem var(--display);
  color: var(--ink-soft);
}
.team-btns {
  display: grid;
  gap: 14px;
}
.team-btn {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "names score"
    "plus score";
  align-items: center;
  gap: 4px 12px;
  min-height: 150px;
  padding: 18px 22px;
  border-radius: var(--r-panel);
  border: var(--line);
  box-shadow: 0 7px 0 var(--ink);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  font: inherit;
  touch-action: manipulation;
  transition: transform 0.1s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.1s;
}
.team-btn:active:not(:disabled) {
  transform: translateY(5px);
  box-shadow: 0 2px 0 var(--ink);
}
.team-btn:disabled {
  opacity: 0.6;
  cursor: default;
}
.team-names {
  grid-area: names;
  font: 700 1.35rem/1.15 var(--display);
  overflow-wrap: anywhere;
}
.team-score {
  grid-area: score;
  font: 700 4.6rem/1 var(--display);
  min-width: 1.4ch;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.team-plus {
  grid-area: plus;
  justify-self: start;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 6px 14px;
  font: 700 1rem/1.1 var(--display);
}
.btn-help {
  margin-top: 6px;
}
.net-banner {
  margin: 0;
  text-align: center;
  font-weight: 800;
  background: var(--pink-soft);
  border-radius: var(--r-panel);
  padding: 10px 14px;
}

/* ---------- between rounds ---------- */
.between {
  text-align: center;
}
.between h2 {
  margin-top: 6px;
}
.results,
.next-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}
.result {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: var(--mint);
  border: var(--line);
  border-radius: var(--r-panel);
  padding: 14px 18px;
  font-weight: 800;
  text-align: left;
}
.result-score {
  font: 700 1.6rem var(--display);
}
.next-match {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

/* ---------- end ---------- */
.end {
  text-align: center;
}
.card {
  background: var(--paper);
  border: var(--line);
  border-radius: var(--r-panel);
  padding: 20px 18px;
  display: grid;
  gap: 12px;
  text-align: left;
}
.awards,
.highlights {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}
.award {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 22px;
}
.award:nth-child(4n + 1) {
  background: var(--blue-soft);
}
.award:nth-child(4n + 2) {
  background: var(--pink-soft);
}
.award:nth-child(4n + 3) {
  background: var(--butter-soft);
}
.award:nth-child(4n + 4) {
  background: var(--mint-soft);
}
.award-emoji {
  font-size: 2.2rem;
  flex: none;
}
.award-title {
  display: block;
  font: 700 1.2rem/1.2 var(--display);
}
.award-who {
  display: block;
  font-weight: 800;
}
.award-detail {
  display: block;
  font-size: 0.95rem;
  color: var(--ink-soft);
}
.highlights li {
  position: relative;
  padding-left: 30px;
  font-weight: 700;
}
.highlights li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 0.45em;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: #f7c948;
  border: 2px solid var(--ink);
}
.vote {
  background: var(--butter-soft);
}
.vote-group {
  display: grid;
  gap: 4px;
}
.vote-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.points-table {
  width: 100%;
  border-collapse: collapse;
  font-weight: 700;
}
.points-table th {
  text-align: left;
  font: 600 0.95rem var(--display);
  color: var(--ink-soft);
  padding: 6px 4px;
}
.points-table td {
  padding: 10px 4px;
  border-top: 2px solid rgba(30, 42, 71, 0.12);
}
.card-preview {
  width: 100%;
  border-radius: 20px;
  border: var(--line);
  display: block;
}
.skeleton {
  aspect-ratio: 4 / 5;
  background: linear-gradient(100deg, var(--cream) 30%, var(--butter-soft) 50%, var(--cream) 70%);
  background-size: 300% 100%;
}
@media (prefers-reduced-motion: no-preference) {
  .skeleton {
    animation: shimmer 1.4s linear infinite;
  }
}
@keyframes shimmer {
  to {
    background-position: -150% 0;
  }
}
.card-actions {
  display: grid;
  gap: 10px;
}

/* ---------- overlays ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(480px, calc(100% - 28px));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--ink);
  color: var(--cream);
  border-radius: 24px;
  padding: 10px 10px 10px 20px;
  font-weight: 800;
  overflow: hidden;
  z-index: 20;
}
.toast-undo {
  min-height: 52px;
  padding: 0 22px;
  border-radius: 999px;
  border: 0;
  background: var(--butter);
  color: var(--ink);
  font: 700 1.1rem var(--display);
  cursor: pointer;
}
.toast-bar {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 4px;
  width: 100%;
  background: var(--butter);
  transform-origin: left;
  animation-name: drain;
  animation-timing-function: linear;
  animation-fill-mode: forwards;
}
@keyframes drain {
  to {
    transform: scaleX(0);
  }
}
.scrim {
  position: fixed;
  inset: 0;
  background: rgba(30, 42, 71, 0.4);
  z-index: 30;
}
.sheet {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(520px, 100%);
  max-height: 88dvh;
  overflow-y: auto;
  background: var(--cream);
  border: var(--line);
  border-bottom: 0;
  border-radius: var(--r-panel) var(--r-panel) 0 0;
  padding: 22px 18px calc(22px + env(safe-area-inset-bottom));
  display: grid;
  gap: 12px;
  z-index: 40;
}
@media (prefers-reduced-motion: no-preference) {
  .sheet {
    animation: sheet-in 0.32s cubic-bezier(0.16, 1, 0.3, 1);
  }
}
@keyframes sheet-in {
  from {
    transform: translate(-50%, 40px);
    opacity: 0;
  }
}
.faq {
  margin: 0;
  display: grid;
  gap: 10px;
}
.faq div {
  background: var(--paper);
  border-radius: 22px;
  padding: 12px 16px;
  border: 2px solid rgba(30, 42, 71, 0.15);
}
.faq dt {
  font: 700 1.12rem/1.25 var(--display);
}
.faq dd {
  margin: 4px 0 0;
}
.noscript {
  padding: 24px;
  font-weight: 800;
}
