:root {
  font-family: "Fredoka", system-ui, sans-serif;
  color: #301640;
  background: #fff0b8;
  font-synthesis: none;
  --ink: #301640;
  --purple: #7434d9;
  --pink: #ff3d9a;
  --orange: #ff8a22;
  --lime: #c9ef48;
  --teal: #24d6c3;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: #fff0b8;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(circle at 10% 4%, #ffb5d9 0 10%, transparent 25%),
    radial-gradient(circle at 95% 15%, #a9f7df 0 9%, transparent 24%),
    linear-gradient(155deg, #fff3ae, #ffd7eb 48%, #d9fff2);
  overflow-x: hidden;
}

button,
input,
textarea,
select {
  font: inherit;
  font-size: 16px;
}

button,
select {
  touch-action: manipulation;
}

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

button:active {
  transform: translateY(3px) scale(0.98);
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 4px solid #3d9cff;
  outline-offset: 3px;
}

button:disabled {
  cursor: default;
  opacity: 0.65;
}

.hidden {
  display: none !important;
}

.background-shapes {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}

.background-shapes span {
  position: absolute;
  font-size: 3.5rem;
  opacity: 0.23;
  transform: rotate(-18deg);
}

.background-shapes span:nth-child(1) { top: 22%; left: -20px; }
.background-shapes span:nth-child(2) { top: 47%; right: -14px; transform: rotate(25deg); }
.background-shapes span:nth-child(3) { bottom: 17%; left: -18px; transform: rotate(12deg); }
.background-shapes span:nth-child(4) { bottom: 5%; right: -16px; }

.app-shell {
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
}

.app-header {
  margin: 0 12px;
  padding: max(22px, env(safe-area-inset-top)) 18px 16px;
  border-radius: 0 0 30px 30px;
  color: #fff;
  background: linear-gradient(125deg, #ff3d9a, #ff6f61 38%, #ff922e 68%, #783bdc);
  box-shadow: 0 7px 0 #5d258f;
  position: relative;
  overflow: hidden;
}

.app-header::after {
  content: "";
  position: absolute;
  width: 150px;
  height: 150px;
  border: 20px solid #ffffff20;
  border-radius: 50%;
  right: -60px;
  top: -55px;
}

.brand-row,
.who-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: relative;
  z-index: 1;
}

.eyebrow {
  margin: 0 0 5px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.app-header h1 {
  margin: 0;
  font-family: "Bungee", "Arial Black", sans-serif;
  font-size: clamp(2.2rem, 10vw, 3.5rem);
  font-weight: 400;
  line-height: 0.96;
  letter-spacing: -0.04em;
  text-shadow: 3px 3px 0 #92225c;
  transform: rotate(-2deg);
}

.app-header h1 span {
  color: #eeff65;
}

.header-cocktail {
  font-size: 4.4rem;
  filter: drop-shadow(3px 5px 0 #8b2557);
  transform: rotate(12deg);
  animation: cheers 3s ease-in-out infinite;
}

.who-row {
  margin-top: 18px;
  align-items: flex-end;
}

.person-pill {
  min-height: 44px;
  max-width: 68%;
  padding: 8px 13px;
  border: 2px solid #ffffff75;
  border-radius: 999px;
  background: #40156c55;
  color: #fff;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.sync-status {
  padding-bottom: 10px;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 600;
  text-align: right;
}

.sync-status.pending {
  color: #ffffaf;
}

.main-content {
  padding: 24px 14px calc(184px + env(safe-area-inset-bottom));
}

.section-kicker {
  display: inline-block;
  margin: 0 0 8px;
  padding: 5px 11px;
  border-radius: 8px;
  background: var(--lime);
  color: #294000;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transform: rotate(-1deg);
}

.section-title,
.results-heading {
  margin: 0 0 8px;
  font-family: "Bungee", "Arial Black", sans-serif;
  font-size: 1.75rem;
  font-weight: 400;
  line-height: 1.15;
}

.section-intro {
  margin: 0 0 22px;
  font-size: 1.05rem;
  line-height: 1.4;
}

.house-list {
  display: grid;
  gap: 18px;
}

.house-card {
  --house-color: #ff3d9a;
  --house-soft: #fff0f7;
  --house-ink: #fff;
  background: #fff;
  border: 3px solid var(--house-color);
  border-radius: 25px;
  box-shadow: 0 6px 0 var(--house-color);
  overflow: hidden;
  scroll-margin-top: 16px;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.house-card.is-open {
  box-shadow: 0 8px 0 var(--house-color), 0 14px 30px #5a226626;
  animation: card-arrive 300ms ease-out;
}

.house-summary {
  width: 100%;
  min-height: 90px;
  display: grid;
  grid-template-columns: 50px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 15px 13px;
  border: 0;
  text-align: left;
  background: linear-gradient(115deg, var(--house-color), var(--house-soft) 165%);
  color: var(--house-ink);
}

.house-number {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border: 3px solid currentColor;
  border-radius: 50%;
  font-family: "Bungee", "Arial Black", sans-serif;
  font-size: 1.2rem;
  background: #ffffff24;
}

.house-title-wrap {
  min-width: 0;
}

.house-title {
  display: block;
  font-size: 1.22rem;
  font-weight: 700;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.house-meta {
  display: block;
  margin-top: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  opacity: 0.9;
}

.house-emoji {
  font-size: 2.55rem;
  filter: drop-shadow(2px 2px 0 #ffffff70);
}

.house-details {
  padding: 18px 14px 16px;
  background: linear-gradient(#fff, var(--house-soft));
}

.current-label {
  display: inline-block;
  margin-bottom: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--house-color);
  color: var(--house-ink);
  font-size: 0.8rem;
  font-weight: 700;
}

.house-theme {
  margin: -4px 0 14px;
  font-weight: 600;
}

.field-label,
.category-title,
.picker-label {
  display: block;
  font-size: 1rem;
  font-weight: 700;
}

.drink-field {
  margin-bottom: 20px;
  padding: 13px;
  border: 2px dashed var(--house-color);
  border-radius: 17px;
  background: #ffffffc9;
}

.drink-field input {
  width: 100%;
  min-height: 48px;
  margin-top: 7px;
  padding: 11px 12px;
  border: 2px solid #d4c0db;
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font-weight: 600;
}

.shared-hint {
  display: block;
  margin-top: 6px;
  color: #654971;
  font-size: 0.82rem;
}

.drink-display {
  display: block;
  margin: 9px 0 4px;
  color: var(--ink);
  font-size: 1.65rem;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.star-anchors {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 3px;
  color: #684b73;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.25;
}

.star-anchors span {
  width: 45%;
}

.star-anchors span:last-child {
  text-align: right;
}

.rating-row {
  margin: 0 0 12px;
  padding: 13px 10px 10px;
  border: 2px solid #eee0ef;
  border-radius: 17px;
  background: #fff;
}

.rating-topline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.rating-number {
  flex: 0 0 auto;
  padding: 3px 8px;
  border-radius: 999px;
  background: #f1e8f5;
  color: #634772;
  font-size: 0.78rem;
  font-weight: 600;
}

.stars {
  display: grid;
  grid-template-columns: repeat(5, minmax(44px, 1fr));
  gap: 4px;
  margin-top: 7px;
}

.star {
  min-width: 44px;
  min-height: 50px;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #bbaac3;
  font-size: 2.25rem;
  line-height: 1;
  text-shadow: 0 2px 0 #e8dbe9;
}

.star.is-filled {
  color: #ff9a19;
  text-shadow: 0 3px 0 #d54e72;
  animation: star-pop 180ms ease-out;
}

.no-vote {
  margin: 4px 0 18px;
  padding: 18px 14px;
  border: 3px dashed var(--house-color);
  border-radius: 18px;
  background: #fff;
  text-align: center;
}

.no-vote strong {
  display: block;
  margin: 4px 0;
  font-size: 1.2rem;
}

.no-vote span {
  font-size: 2.4rem;
}

.no-vote p {
  margin: 5px 0 0;
}

.notes-field textarea {
  width: 100%;
  min-height: 100px;
  margin-top: 7px;
  padding: 12px;
  resize: vertical;
  border: 2px solid #d4c0db;
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  line-height: 1.4;
}

.next-button,
.primary-button,
.secondary-button {
  width: 100%;
  min-height: 56px;
  padding: 13px 18px;
  border: 0;
  border-radius: 16px;
  font-weight: 700;
  font-size: 1.12rem;
}

.next-button,
.primary-button {
  margin-top: 17px;
  background: linear-gradient(110deg, #7638db, #ff3d9a);
  color: #fff;
  box-shadow: 0 5px 0 #4b237f;
}

.secondary-button {
  border: 2px solid #81549b;
  background: #fff;
  color: #59316e;
  box-shadow: 0 4px 0 #cbaed6;
}

.save-hint {
  margin: 13px 0 0;
  color: #6c5076;
  font-size: 0.85rem;
  text-align: center;
}

.tab-bar {
  position: fixed;
  z-index: 20;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 100%;
  max-width: 600px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  border-top: 3px solid #6b327c;
  background: #fffdf2f2;
  backdrop-filter: blur(12px);
}

.tab-button {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 17px;
  background: transparent;
  font-size: 1.05rem;
  font-weight: 700;
}

.tab-button span {
  font-size: 1.5rem;
}

.tab-button[aria-current="page"] {
  background: linear-gradient(120deg, var(--purple), var(--pink));
  color: #fff;
  box-shadow: 0 4px 0 #4e2182;
}

.identity-gate {
  position: fixed;
  z-index: 50;
  inset: 0;
  overflow-y: auto;
  padding: max(22px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
  background:
    radial-gradient(circle at 90% 0%, #f0ff6c 0 6%, transparent 27%),
    radial-gradient(circle at 0% 80%, #50ead3 0 8%, transparent 28%),
    linear-gradient(145deg, #ff4fa4, #ff8955 46%, #9949e9);
}

.identity-panel {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding: 24px 18px 20px;
  border: 4px solid #fff;
  border-radius: 30px;
  background: #fffbed;
  box-shadow: 0 9px 0 #632287, 0 18px 50px #47104e55;
}

.identity-emoji {
  display: block;
  font-size: 3.8rem;
  text-align: center;
  animation: cheers 2.5s ease-in-out infinite;
}

.identity-panel h1 {
  margin: 5px 0 8px;
  font-family: "Bungee", "Arial Black", sans-serif;
  font-size: clamp(1.9rem, 9vw, 2.8rem);
  font-weight: 400;
  line-height: 1.1;
  text-align: center;
}

.identity-subtitle {
  margin: 0 0 20px;
  text-align: center;
  font-size: 1.08rem;
}

.people-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.person-choice {
  min-height: 54px;
  padding: 10px 8px;
  border: 2px solid #c8aed4;
  border-radius: 15px;
  background: #fff;
  font-weight: 700;
  overflow-wrap: anywhere;
  box-shadow: 0 3px 0 #d5c2dd;
}

.person-choice:nth-child(5n + 1) { background: #ffe4f1; border-color: #ff87ba; }
.person-choice:nth-child(5n + 2) { background: #fff0d4; border-color: #ffb352; }
.person-choice:nth-child(5n + 3) { background: #e3fff9; border-color: #50d9c7; }
.person-choice:nth-child(5n + 4) { background: #f0e6ff; border-color: #b790ee; }
.person-choice:nth-child(5n + 5) { background: #f3ffd0; border-color: #b6d946; }

.add-person {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 3px dashed #d5bddd;
}

.add-person-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.add-person input {
  min-width: 0;
  width: 100%;
  min-height: 52px;
  padding: 11px 12px;
  border: 2px solid #ac8fba;
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
}

.add-person button {
  flex: 0 0 auto;
  min-height: 52px;
  padding: 10px 14px;
  border: 0;
  border-radius: 14px;
  background: var(--purple);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 4px 0 #482074;
}

.identity-error {
  min-height: 1.3em;
  margin: 7px 0 0;
  color: #a41951;
  font-weight: 600;
}

.cancel-switch {
  display: block;
  min-height: 44px;
  margin: 12px auto 0;
  padding: 8px 16px;
  border: 0;
  background: transparent;
  color: #633377;
  font-weight: 600;
  text-decoration: underline;
}

.vote-banner {
  margin-bottom: 20px;
  padding: 17px;
  border: 3px solid #7434d9;
  border-radius: 23px;
  background: linear-gradient(130deg, #f5ff99, #d4fff3);
  box-shadow: 0 6px 0 #7434d9;
}

.vote-banner h2 {
  margin: 0 0 3px;
  font-size: 1.35rem;
}

.vote-banner p {
  margin: 0 0 12px;
}

.drunkest-picker {
  width: 100%;
  min-height: 54px;
  padding: 10px 12px;
  border: 3px solid #7434d9;
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  font-weight: 600;
}

.results-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.refresh-button {
  min-width: 48px;
  min-height: 48px;
  padding: 8px 12px;
  border: 2px solid #794e8a;
  border-radius: 14px;
  background: #fff;
  font-weight: 700;
}

.local-notice,
.loading-notice,
.error-notice {
  padding: 12px 14px;
  border-radius: 15px;
  background: #fff5cd;
  border: 2px solid #e4b429;
  font-weight: 600;
}

.loading-notice {
  margin-bottom: 15px;
  text-align: center;
  animation: soft-pulse 1s ease-in-out infinite alternate;
}

.reveal-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 22px 0 13px;
}

.reveal-toolbar h2 {
  margin: 0;
  font-family: "Bungee", "Arial Black", sans-serif;
  font-size: 1.35rem;
  font-weight: 400;
}

.reveal-all {
  min-height: 44px;
  padding: 8px 12px;
  border: 0;
  border-radius: 999px;
  background: var(--lime);
  color: #354000;
  font-weight: 700;
}

.reveal-list {
  display: grid;
  gap: 18px;
}

.reveal-card {
  --winner-color: #ff3d9a;
  border: 3px solid var(--winner-color);
  border-radius: 23px;
  background: #fff;
  box-shadow: 0 6px 0 var(--winner-color);
  overflow: hidden;
}

.reveal-trigger {
  width: 100%;
  min-height: 124px;
  padding: 20px;
  border: 0;
  background: linear-gradient(120deg, #ffedf6, #f5eaff);
  text-align: left;
}

.reveal-trigger .mystery-emoji {
  float: right;
  margin-left: 10px;
  font-size: 2.4rem;
  animation: mystery-wiggle 2s ease-in-out infinite;
}

.reveal-category-number {
  display: block;
  color: #754283;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.reveal-trigger strong {
  display: block;
  margin: 7px 0 12px;
  font-size: 1.25rem;
  line-height: 1.2;
}

.tap-reveal {
  display: inline-block;
  padding: 7px 13px;
  border-radius: 999px;
  background: var(--pink);
  color: #fff;
  font-weight: 700;
}

.revealed-content {
  position: relative;
  padding: 18px 14px 14px;
  overflow: hidden;
}

.revealed-content h3 {
  position: relative;
  z-index: 2;
  margin: 0 0 13px;
  font-size: 0.95rem;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.winner-stage {
  position: relative;
  z-index: 2;
  padding: 20px 12px;
  border-radius: 18px;
  background: linear-gradient(130deg, var(--winner-color), #ff9a38);
  color: #fff;
  text-align: center;
  overflow: hidden;
  animation: winner-pop 650ms cubic-bezier(0.2, 1.6, 0.4, 1);
}

.winner-emoji {
  display: block;
  font-size: 3.7rem;
  filter: drop-shadow(3px 3px 0 #00000025);
  animation: winner-bounce 1.1s ease-in-out infinite;
}

.winner-name {
  display: block;
  margin: 6px 0;
  font-family: "Bungee", "Arial Black", sans-serif;
  font-size: clamp(1.35rem, 7vw, 2rem);
  font-weight: 400;
  line-height: 1.15;
  overflow-wrap: anywhere;
  text-shadow: 2px 2px 0 #712354;
}

.winner-drink {
  display: block;
  font-size: 1.08rem;
  font-weight: 600;
}

.winner-score {
  display: inline-block;
  margin-top: 10px;
  padding: 6px 12px;
  border-radius: 999px;
  background: #fff;
  color: #5a236e;
  font-weight: 700;
}

.no-winner {
  margin: 0;
  color: #fff;
  font-size: 1.2rem;
  font-weight: 700;
}

.confetti {
  position: absolute;
  z-index: 1;
  inset: 0;
  pointer-events: none;
}

.confetti i {
  position: absolute;
  left: 50%;
  top: 48%;
  width: 9px;
  height: 15px;
  border-radius: 2px;
  background: var(--confetti);
  opacity: 0;
  animation: confetti-burst 1.25s var(--delay) ease-out both;
}

.standings {
  margin-top: 16px;
}

.standings h4 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.standing-row {
  display: grid;
  grid-template-columns: 26px 1fr auto;
  gap: 7px;
  align-items: center;
  min-height: 46px;
  padding: 8px 5px;
  border-top: 1px solid #e7d8eb;
}

.standing-row:first-of-type {
  background: #fff7d8;
}

.standing-rank {
  font-weight: 700;
  text-align: center;
}

.standing-name {
  min-width: 0;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.standing-score {
  text-align: right;
  font-size: 0.9rem;
  font-weight: 700;
  white-space: nowrap;
}

.standing-votes {
  display: block;
  color: #6c5375;
  font-size: 0.75rem;
  font-weight: 500;
}

.noscript {
  margin: 40px auto;
  max-width: 400px;
  padding: 20px;
  border-radius: 20px;
  background: #fff;
  font-size: 1.2rem;
}

@keyframes cheers {
  0%, 100% { transform: rotate(8deg) translateY(0); }
  50% { transform: rotate(-6deg) translateY(-5px); }
}

@keyframes card-arrive {
  from { transform: scale(0.98); }
  to { transform: scale(1); }
}

@keyframes star-pop {
  0% { transform: scale(0.65) rotate(-12deg); }
  80% { transform: scale(1.15) rotate(5deg); }
  100% { transform: scale(1); }
}

@keyframes winner-pop {
  from { opacity: 0; transform: scale(0.5) rotate(-4deg); }
  to { opacity: 1; transform: scale(1) rotate(0); }
}

@keyframes winner-bounce {
  0%, 100% { transform: translateY(0) rotate(-6deg); }
  50% { transform: translateY(-8px) rotate(6deg); }
}

@keyframes confetti-burst {
  0% { opacity: 1; transform: translate(0, 0) rotate(0); }
  75% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--x), var(--y)) rotate(var(--spin)); }
}

@keyframes mystery-wiggle {
  0%, 100% { transform: rotate(-8deg); }
  50% { transform: rotate(8deg) scale(1.1); }
}

@keyframes soft-pulse {
  from { opacity: 0.65; }
  to { opacity: 1; }
}

@media (max-width: 370px) {
  .main-content { padding-left: 10px; padding-right: 10px; }
  .house-details { padding-left: 10px; padding-right: 10px; }
  .stars { gap: 0; }
  .star { font-size: 2rem; }
  .identity-panel { padding-left: 13px; padding-right: 13px; }
  .add-person-row { flex-direction: column; }
}

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

.restored-banner {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 15px;
  background: #e8fffb;
  border: 2px solid #26d9c7;
  font-weight: 600;
}

.link-button {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
}

.results-note {
  font-size: 0.9rem;
  opacity: 0.8;
}
