:root {
  --tomato: #f04438;
  --pepper: #d92d20;
  --cheese: #ffc53d;
  --mango: #ff9f1c;
  --mint: #2ec4b6;
  --lettuce: #4caf50;
  --cream: #fff7e8;
  --paper: #fffdf7;
  --ink: #2c1810;
  --muted: #7a5b4a;
  --shadow: 0 22px 60px rgba(108, 49, 16, 0.22);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: Inter, Arial, sans-serif;
  background:
    radial-gradient(circle at 14% 8%, rgba(255, 197, 61, 0.42), transparent 28%),
    radial-gradient(circle at 87% 15%, rgba(46, 196, 182, 0.3), transparent 26%),
    linear-gradient(135deg, #fff3cf 0%, #ffe4d6 43%, #e9fff7 100%);
  overflow-x: hidden;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  background-image:
    radial-gradient(circle, rgba(240, 68, 56, 0.14) 0 6px, transparent 7px),
    radial-gradient(circle, rgba(76, 175, 80, 0.14) 0 5px, transparent 6px);
  background-position: 0 0, 28px 32px;
  background-size: 84px 84px;
  animation: floatPattern 18s linear infinite;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.site-shell {
  display: grid;
  grid-template-columns: minmax(120px, 180px) minmax(0, 1fr) minmax(120px, 180px);
  grid-template-areas:
    "top top top"
    "left app right"
    "footer footer footer";
  gap: 18px;
  width: min(1440px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px;
}

.app {
  grid-area: app;
  min-width: 0;
}

.ad-slot {
  display: grid;
  place-items: center;
  min-height: 92px;
  border: 2px dashed rgba(217, 45, 32, 0.34);
  border-radius: 8px;
  color: rgba(44, 24, 16, 0.62);
  background: rgba(255, 253, 247, 0.66);
  backdrop-filter: blur(10px);
  text-align: center;
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

.top-ad {
  grid-area: top;
}

.side-ad {
  position: sticky;
  top: 18px;
  min-height: 520px;
  padding: 28px;
}

.side-ad-left {
  grid-area: left;
}

.side-ad-right {
  grid-area: right;
}

.footer-ad {
  grid-area: footer;
  min-height: 120px;
  padding: 28px;
}

.site-footer {
  grid-area: footer;
  margin-top: 8px;
  padding: 20px 24px;
  border-radius: 16px;
  background: var(--ink);
  color: #f0e6dc;
}

.site-footer .footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.site-footer .made-by {
  font-size: 0.85rem;
  color: #cbb9ab;
}

.site-footer .made-by strong {
  color: #fff;
}

.site-footer a {
  color: var(--mango);
  font-weight: 700;
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}

@media (max-width: 560px) {
  .site-footer .footer-inner {
    flex-direction: column;
    text-align: center;
  }
}

.hero {
  padding: 22px 10px 16px;
  text-align: center;
}

.eyebrow {
  width: fit-content;
  margin: 0 auto 8px;
  padding: 7px 14px;
  border-radius: 999px;
  color: #842018;
  background: rgba(255, 197, 61, 0.66);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0;
}

.hero h1 {
  margin: 0;
  font-family: Fredoka, Inter, sans-serif;
  font-size: clamp(2.25rem, 6vw, 5rem);
  line-height: 0.95;
  color: var(--pepper);
  text-shadow: 0 5px 0 rgba(255, 197, 61, 0.95);
}

.hero p:last-child {
  max-width: 620px;
  margin: 14px auto 0;
  color: var(--muted);
  font-size: 1.05rem;
  font-weight: 700;
}

.food-manager {
  display: flex;
  align-items: end;
  gap: 14px;
  margin: 10px auto 24px;
  padding: 16px;
  border: 2px solid rgba(255, 159, 28, 0.4);
  border-radius: 8px;
  background: rgba(255, 253, 247, 0.8);
  box-shadow: var(--shadow);
}

.add-food {
  flex: 1;
  min-width: 0;
}

label {
  display: block;
  margin-bottom: 8px;
  color: #5f2b17;
  font-weight: 900;
}

.input-action {
  display: flex;
  gap: 10px;
}

input {
  width: 100%;
  min-height: 48px;
  border: 2px solid rgba(240, 68, 56, 0.24);
  border-radius: 8px;
  padding: 0 14px;
  color: var(--ink);
  background: #fff;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

input:focus {
  border-color: var(--tomato);
  box-shadow: 0 0 0 5px rgba(240, 68, 56, 0.13);
}

.input-action button,
.reset-btn,
.modal-actions button,
.ghost-btn {
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  padding: 0 18px;
  color: #fff;
  background: linear-gradient(135deg, var(--tomato), var(--mango));
  font-weight: 900;
  box-shadow: 0 12px 24px rgba(240, 68, 56, 0.25);
  transition: transform 160ms ease, filter 160ms ease;
}

.reset-btn {
  background: linear-gradient(135deg, #3a241c, #8f3d24);
}

button:hover {
  transform: translateY(-2px);
  filter: saturate(1.08);
}

.arena {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(150px, 190px) minmax(0, 1fr);
  align-items: stretch;
  gap: 18px;
  margin-bottom: 24px;
}

.player-card {
  position: relative;
  overflow: visible;
  min-width: 0;
  padding: 20px;
  border: 3px solid rgba(255, 255, 255, 0.82);
  border-radius: 8px;
  background: rgba(255, 253, 247, 0.88);
  box-shadow: var(--shadow);
}

.player-card::before {
  position: absolute;
  inset: -8px;
  z-index: -1;
  border-radius: 14px;
  content: "";
  background: linear-gradient(135deg, rgba(240, 68, 56, 0.55), rgba(255, 197, 61, 0.58), rgba(46, 196, 182, 0.42));
  opacity: 0.72;
  animation: glowPulse 2.4s ease-in-out infinite;
}

.player-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 18px;
}

.player-badge,
.score-pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border-radius: 999px;
  padding: 0 12px;
  font-weight: 900;
}

.player-badge {
  color: #fff;
  background: var(--tomato);
}

.player-two .player-badge {
  background: var(--mint);
}

.score-pill {
  color: #5f2b17;
  background: #ffe9a6;
  font-size: 0.86rem;
}

.plate {
  display: grid;
  position: relative;
  place-items: center;
  width: min(210px, 74%);
  aspect-ratio: 1;
  margin: 0 auto 18px;
  border: 12px solid #fff;
  border-radius: 50%;
  background:
    radial-gradient(circle, #fff7e8 0 48%, #ffe1a6 49% 61%, #fffdf7 62%);
  box-shadow:
    inset 0 -12px 30px rgba(95, 43, 23, 0.12),
    0 16px 32px rgba(95, 43, 23, 0.18);
}

.plate span {
  display: block;
  font-size: clamp(4rem, 9vw, 6.6rem);
  transform-origin: center;
  animation: foodBounce 1.9s ease-in-out infinite;
}

.plate-shine {
  position: absolute;
  width: 44%;
  height: 20%;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.72);
  transform: translate(-25%, -180%) rotate(-16deg);
}

.combo {
  position: relative;
}

.combo-input {
  padding-right: 52px;
}

.combo-toggle {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: var(--mango);
  font-size: 1.35rem;
  font-weight: 900;
}

.combo-list {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 20;
  display: none;
  max-height: 220px;
  overflow-y: auto;
  border: 2px solid rgba(240, 68, 56, 0.22);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 40px rgba(95, 43, 23, 0.22);
}

.combo.open .combo-list {
  display: block;
}

.combo-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 42px;
  border: 0;
  padding: 8px 12px;
  color: var(--ink);
  background: #fff;
  text-align: left;
  font-weight: 800;
}

.combo-option:hover,
.combo-option.active {
  background: #fff1c7;
}

.empty-option {
  padding: 14px;
  color: var(--muted);
  font-weight: 800;
}

.selection {
  min-height: 24px;
  margin: 12px 0 0;
  color: var(--muted);
  font-weight: 800;
}

.battle-center {
  display: grid;
  position: relative;
  align-content: center;
  justify-items: center;
  gap: 16px;
  min-width: 0;
}

.battle-btn {
  display: grid;
  place-items: center;
  width: 148px;
  aspect-ratio: 1;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: conic-gradient(from 120deg, var(--tomato), var(--cheese), var(--mint), var(--tomato));
  box-shadow: 0 18px 40px rgba(240, 68, 56, 0.32);
  animation: buttonPulse 1.7s ease-in-out infinite;
}

.battle-btn span {
  font-size: 1rem;
  font-weight: 900;
  text-transform: uppercase;
}

.battle-btn strong {
  font-family: Fredoka, Inter, sans-serif;
  font-size: 3rem;
  line-height: 0.8;
  text-shadow: 0 4px 0 rgba(95, 43, 23, 0.28);
}

.winner-box {
  width: min(260px, 100%);
  min-height: 72px;
  border: 3px solid #fff;
  border-radius: 8px;
  padding: 14px;
  color: #6f251d;
  background: rgba(255, 247, 232, 0.9);
  box-shadow: 0 16px 36px rgba(95, 43, 23, 0.18);
  text-align: center;
  font-weight: 900;
}

.spark {
  position: absolute;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--cheese);
  opacity: 0.84;
  animation: spinSpark 3.4s linear infinite;
}

.spark-a {
  top: 18%;
  left: 12%;
}

.spark-b {
  right: 8%;
  bottom: 18%;
  background: var(--mint);
  animation-duration: 2.6s;
}

.is-spinning .plate span {
  animation: spinFood 550ms linear infinite;
}

.winner {
  animation: winnerPop 780ms ease both;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(44, 24, 16, 0.48);
}

.modal[hidden] {
  display: none;
}

.modal-panel {
  width: min(390px, 100%);
  border: 3px solid #fff;
  border-radius: 8px;
  padding: 22px;
  background: var(--paper);
  box-shadow: var(--shadow);
  text-align: center;
}

.modal-panel p {
  margin: 0 0 16px;
  font-family: Fredoka, Inter, sans-serif;
  font-size: 1.45rem;
  font-weight: 700;
}

.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.modal-actions button:last-child {
  background: linear-gradient(135deg, var(--mint), var(--lettuce));
}

.ghost-btn {
  width: 100%;
  margin-top: 10px;
  color: var(--ink);
  background: #ffe9a6;
  box-shadow: none;
}

@keyframes floatPattern {
  to {
    background-position: 84px 84px, 112px 116px;
  }
}

@keyframes glowPulse {
  50% {
    opacity: 0.95;
    transform: scale(1.012);
  }
}

@keyframes foodBounce {
  50% {
    transform: translateY(-8px) rotate(3deg);
  }
}

@keyframes buttonPulse {
  50% {
    transform: scale(1.045);
  }
}

@keyframes spinSpark {
  to {
    transform: rotate(360deg);
  }
}

@keyframes spinFood {
  to {
    transform: rotate(360deg) scale(1.05);
  }
}

@keyframes winnerPop {
  0% {
    transform: scale(1);
  }
  45% {
    transform: scale(1.08) rotate(-1deg);
  }
  100% {
    transform: scale(1);
  }
}

@media (max-width: 1020px) {
  .site-shell {
    grid-template-columns: 1fr;
    grid-template-areas:
      "top"
      "app"
      "left"
      "right"
      "footer";
  }

  .side-ad {
    position: static;
    min-height: 100px;
  }
}

@media (max-width: 780px) {
  .site-shell {
    padding: 12px;
    gap: 12px;
  }

  .food-manager,
  .input-action {
    flex-direction: column;
  }

  .food-manager {
    align-items: stretch;
  }

  .add-food,
  .input-action input,
  .input-action button,
  .reset-btn {
    width: 100%;
  }

  .arena {
    grid-template-columns: 1fr;
  }

  .battle-center {
    min-height: 220px;
  }

  .battle-btn {
    width: 140px;
  }

  .player-card {
    padding: 16px;
  }
}

@media (max-width: 440px) {
  .hero {
    padding-inline: 0;
  }

  .hero h1 {
    font-size: 2.55rem;
  }

  .player-topline,
  .modal-actions {
    grid-template-columns: 1fr;
    display: grid;
  }

  .player-badge,
  .score-pill {
    justify-content: center;
  }
}
