:root {
  color-scheme: light;
  --ink: #2f3240;
  --muted: #6d6a74;
  --paper: #fff8ef;
  --cream: #fff3d8;
  --mint: #75d8bd;
  --coral: #ff7d6e;
  --blue: #59a7ff;
  --yellow: #ffd166;
  --grape: #9a78ff;
  --leaf: #68b86b;
  --shadow: 0 14px 36px rgba(76, 45, 22, 0.18);
  --small-shadow: 0 7px 18px rgba(76, 45, 22, 0.16);
  --radius: 8px;
  font-family: "Trebuchet MS", "Arial Rounded MT Bold", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 10%, rgba(255, 209, 102, 0.38), transparent 24rem),
    radial-gradient(circle at 90% 18%, rgba(117, 216, 189, 0.32), transparent 20rem),
    linear-gradient(145deg, #fff2d2, #ffe0d5 48%, #d9f8ef);
  color: var(--ink);
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
  color: inherit;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  filter: saturate(0.72);
}

.app-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 14px;
}

.phone {
  width: min(100%, 430px);
  min-height: min(850px, calc(100vh - 28px));
  max-height: calc(100vh - 28px);
  overflow: hidden;
  position: relative;
  border-radius: 28px;
  box-shadow: var(--shadow);
  background: var(--paper);
  display: flex;
  flex-direction: column;
  animation: phoneIn 0.28s ease both;
}

.screen {
  flex: 1;
  overflow: auto;
  padding: 18px;
  background:
    linear-gradient(rgba(255, 248, 239, 0.74), rgba(255, 248, 239, 0.82)),
    var(--venue-bg);
  background-size: auto, 120px 120px;
  animation: screenIn 0.22s ease both;
}

.screen.game-screen {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--venue-bg);
  background-size: 120px 120px, 120px 120px, 120px 120px, auto;
}

.top-row,
.action-row,
.score-row,
.setting-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.top-row {
  justify-content: space-between;
  margin-bottom: 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-mark {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: conic-gradient(from 20deg, var(--coral), var(--yellow), var(--mint), var(--blue), var(--coral));
  box-shadow: var(--small-shadow);
  display: grid;
  place-items: center;
}

.logo-mark::before {
  content: "";
  width: 25px;
  height: 25px;
  border-radius: 6px;
  background: #fffaf1;
  transform: rotate(9deg);
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 2.3rem;
  line-height: 0.94;
  letter-spacing: 0;
}

h2 {
  font-size: 1.55rem;
  line-height: 1;
}

h3 {
  font-size: 1rem;
}

.subtitle {
  color: var(--muted);
  margin-top: 8px;
  line-height: 1.35;
}

.setup-warning {
  margin: 0;
  color: #9f332b;
  background: #ffe1d9;
  border: 2px solid rgba(255, 125, 110, 0.4);
  border-radius: 10px;
  padding: 9px 10px;
  font-weight: 900;
  line-height: 1.25;
}

.kitchen-window {
  height: 190px;
  margin: 18px 0;
  border-radius: 18px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--small-shadow);
  background:
    linear-gradient(#9ee6ff 0 48%, #78d37b 48% 100%);
}

.kitchen-window::before,
.kitchen-window::after {
  content: "";
  position: absolute;
  background: #fff7dc;
}

.kitchen-window::before {
  inset: 0 auto 0 49%;
  width: 10px;
}

.kitchen-window::after {
  left: 0;
  right: 0;
  top: 48%;
  height: 10px;
}

.table-preview {
  position: absolute;
  left: 5%;
  right: 5%;
  bottom: -42px;
  height: 100px;
  border-radius: 50% 50% 10px 10px;
  background: repeating-linear-gradient(90deg, #f6a66b 0 34px, #ffbc83 34px 68px);
  border: 7px solid rgba(122, 72, 36, 0.24);
}

.mini-card {
  position: absolute;
  width: 54px;
  height: 68px;
  border-radius: 8px;
  background: #fffaf1;
  box-shadow: var(--small-shadow);
}

.mini-card.one {
  left: 24%;
  bottom: 34px;
  transform: rotate(-9deg);
}

.mini-card.two {
  right: 22%;
  bottom: 44px;
  transform: rotate(7deg);
}

.mini-card::before {
  content: "";
  position: absolute;
  inset: 13px;
  border-radius: 50%;
  background: var(--coral);
}

.primary-btn,
.secondary-btn,
.icon-btn,
.chip-btn,
.ghost-btn {
  min-height: 48px;
  border-radius: var(--radius);
  transition: transform 0.12s ease, filter 0.12s ease;
}

.primary-btn:active,
.secondary-btn:active,
.icon-btn:active,
.chip-btn:active,
.ghost-btn:active,
.card:active {
  transform: translateY(1px) scale(0.99);
}

.primary-btn {
  width: 100%;
  background: linear-gradient(135deg, var(--coral), #ff9a5c);
  color: white;
  font-weight: 900;
  font-size: 1.1rem;
  box-shadow: var(--small-shadow);
}

.secondary-btn {
  background: #ffffff;
  border: 2px solid rgba(47, 50, 64, 0.08);
  color: var(--ink);
  font-weight: 800;
  padding: 0 14px;
  box-shadow: 0 4px 10px rgba(76, 45, 22, 0.08);
}

.ghost-btn {
  background: transparent;
  color: var(--muted);
  font-weight: 800;
  padding: 0 10px;
}

.icon-btn {
  width: 48px;
  background: #fffaf1;
  font-weight: 900;
  box-shadow: 0 4px 10px rgba(76, 45, 22, 0.1);
}

.button-stack {
  display: grid;
  gap: 10px;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.panel {
  background: rgba(255, 250, 241, 0.88);
  border: 2px solid rgba(255, 255, 255, 0.66);
  border-radius: 16px;
  padding: 14px;
  box-shadow: 0 8px 18px rgba(76, 45, 22, 0.08);
}

.stack {
  display: grid;
  gap: 14px;
}

.player-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.player-row {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  gap: 10px;
  align-items: center;
  background: #fff;
  border-radius: 12px;
  padding: 8px;
  border: 2px solid rgba(47, 50, 64, 0.06);
}

.avatar,
.tiny-avatar {
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  font-weight: 900;
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.08);
}

.avatar {
  width: 44px;
  height: 44px;
}

.tiny-avatar {
  width: 28px;
  height: 28px;
  font-size: 0.8rem;
}

.player-row input {
  width: 100%;
  border: 0;
  background: #fff7e8;
  border-radius: 8px;
  min-height: 42px;
  padding: 0 10px;
  color: var(--ink);
  font-weight: 800;
}

.chip-grid,
.venue-grid,
.photo-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.chip-btn,
.venue-card,
.photo-tile {
  border: 2px solid rgba(47, 50, 64, 0.08);
  background: #fffaf1;
  min-height: 74px;
  border-radius: 12px;
  font-weight: 900;
  box-shadow: 0 5px 12px rgba(76, 45, 22, 0.08);
}

.chip-btn.selected,
.venue-card.selected,
.photo-tile.selected {
  outline: 4px solid rgba(255, 125, 110, 0.32);
  border-color: var(--coral);
}

.venue-card {
  display: grid;
  overflow: hidden;
  padding: 0;
}

.venue-swatch {
  min-height: 58px;
  background: var(--swatch);
}

.venue-label {
  padding: 8px;
  background: rgba(255, 250, 241, 0.92);
}

.photo-tile {
  min-height: 108px;
  display: grid;
  place-items: center;
  padding: 8px;
  overflow: hidden;
  position: relative;
}

.photo-tile img {
  width: 100%;
  height: 90px;
  object-fit: cover;
  border-radius: 8px;
}

.photo-tile input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.lock-note {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-weight: 800;
  font-size: 0.92rem;
}

.score-row {
  justify-content: space-between;
  margin-bottom: 12px;
}

.score-pill,
.turn-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 250, 241, 0.92);
  border-radius: 999px;
  padding: 7px 10px;
  font-weight: 900;
  box-shadow: 0 3px 10px rgba(76, 45, 22, 0.08);
}

.score-pill.active {
  outline: 4px solid rgba(255, 209, 102, 0.42);
}

.board-wrap {
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: center;
  padding-bottom: 8px;
  border-radius: 22px;
}

.board {
  width: min(100%, 390px);
  display: grid;
  grid-template-columns: repeat(var(--cols), 1fr);
  gap: 8px;
}

.card {
  aspect-ratio: 0.78;
  border-radius: 11px;
  background: transparent;
  perspective: 800px;
  padding: 0;
  animation: cardDeal 0.24s ease both;
}

.card-inner {
  display: block;
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.32s ease;
}

.card.flipped .card-inner,
.card.matched .card-inner {
  transform: rotateY(180deg);
}

.card-face {
  position: absolute;
  inset: 0;
  border-radius: 11px;
  backface-visibility: hidden;
  overflow: hidden;
  box-shadow: 0 5px 12px rgba(54, 33, 18, 0.18);
}

.card-back {
  background: var(--card-back);
  background-size: 100% 100%;
  border: 4px solid #fffaf1;
}

.card-front {
  transform: rotateY(180deg);
  background: #fffaf1;
  display: grid;
  place-items: center;
  padding: 7px;
}

.card-front img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
}

.card-front svg {
  width: 92%;
  height: 92%;
}

.matched .card-front {
  outline: 5px solid rgba(117, 216, 189, 0.64);
}

.game-message {
  min-height: 34px;
  text-align: center;
  font-weight: 900;
  color: var(--muted);
}

.overlay {
  position: absolute;
  inset: 0;
  background: rgba(47, 50, 64, 0.2);
  display: grid;
  place-items: center;
  padding: 18px;
  backdrop-filter: blur(2px);
}

.modal {
  width: min(100%, 340px);
  background: #fffaf1;
  border-radius: 20px;
  padding: 18px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  animation: popIn 0.22s ease both;
}

.pass-card {
  text-align: center;
}

.pass-card .avatar {
  width: 76px;
  height: 76px;
  margin: 16px auto;
  font-size: 1.6rem;
}

.leader-row {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  padding: 8px;
  background: #fff;
  border-radius: 12px;
  font-weight: 900;
}

.setting-row {
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid rgba(47, 50, 64, 0.08);
}

.toggle {
  width: 58px;
  height: 34px;
  border-radius: 999px;
  background: #dad5c8;
  padding: 4px;
}

.toggle.on {
  background: var(--mint);
}

.toggle::before {
  content: "";
  display: block;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s ease;
}

.toggle.on::before {
  transform: translateX(24px);
}

.hidden {
  display: none !important;
}

.confetti {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.confetti span {
  position: absolute;
  top: -22px;
  width: 12px;
  height: 18px;
  border-radius: 3px;
  background: var(--coral);
  animation: confettiDrop 1.8s ease-in-out infinite;
}

.confetti span:nth-child(1) {
  left: 12%;
  background: var(--yellow);
}

.confetti span:nth-child(2) {
  left: 28%;
  background: var(--mint);
  animation-delay: 0.2s;
}

.confetti span:nth-child(3) {
  left: 45%;
  background: var(--blue);
  animation-delay: 0.34s;
}

.confetti span:nth-child(4) {
  left: 62%;
  background: var(--coral);
  animation-delay: 0.12s;
}

.confetti span:nth-child(5) {
  left: 78%;
  background: var(--grape);
  animation-delay: 0.46s;
}

.confetti span:nth-child(6) {
  left: 90%;
  background: var(--leaf);
  animation-delay: 0.28s;
}

@keyframes phoneIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes screenIn {
  from {
    opacity: 0.35;
    transform: translateX(8px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes cardDeal {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes popIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes confettiDrop {
  0% {
    transform: translateY(-20px) rotate(0deg);
    opacity: 0;
  }
  18% {
    opacity: 1;
  }
  100% {
    transform: translateY(220px) rotate(260deg);
    opacity: 0;
  }
}

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

@media (max-width: 370px) {
  .screen {
    padding: 14px;
  }

  h1 {
    font-size: 2rem;
  }

  .board {
    gap: 6px;
  }

  .score-pill {
    font-size: 0.88rem;
    padding: 6px 8px;
  }
}
