:root {
  --bg-1: #ffd86b;
  --bg-2: #ff8a5c;
  --bg-3: #ff5e8a;
  --ink: #3a1d10;
  --card: #fffaf0;
  --accent: #ff4d4d;
  --accent-dark: #c42b2b;
  --shadow: 0 10px 0 rgba(58, 29, 16, .18), 0 24px 40px rgba(58, 29, 16, .18);
}

* { box-sizing: border-box; }

html, body { margin: 0; }

html { background: var(--bg-2); }

body {
  font-family: "Baloo 2", system-ui, sans-serif;
  color: var(--ink);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: hidden;
}

/* Gradient nền cố định theo màn hình, không bị lặp khi trang dài */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: linear-gradient(135deg, var(--bg-1), var(--bg-2) 50%, var(--bg-3));
  background-size: 200% 200%;
  animation: bgShift 12s ease-in-out infinite;
}

@keyframes bgShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

#fx {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 20;
}

/* Background: rows of food emojis scrolling sideways */
.marquee {
  position: fixed;
  inset: 0;
  z-index: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  overflow: hidden;
  pointer-events: none;
  user-select: none;
}
.marquee__row {
  display: flex;
  width: max-content;
  font-size: clamp(34px, 6vw, 56px);
  opacity: .28;
  animation: scrollLeft var(--dur, 40s) linear infinite;
}
.marquee__row.reverse { animation-name: scrollRight; }
.marquee__row span {
  padding: 0 18px;
  display: inline-block;
  animation: float 3s ease-in-out infinite;
}
.marquee__row span:nth-child(odd) { animation-delay: -1.5s; }

@keyframes scrollLeft { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@keyframes scrollRight { from { transform: translateX(-50%); } to { transform: translateX(0); } }
@keyframes float {
  0%, 100% { transform: translateY(0) rotate(-10deg); }
  50% { transform: translateY(-12px) rotate(10deg); }
}

.app {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 560px;
  padding: 40px 16px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  flex: 1;
}

.hero { text-align: center; }

.badge {
  display: inline-block;
  margin: 0 0 8px;
  padding: 4px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .7);
  font-weight: 700;
  font-size: 15px;
}

h1 {
  margin: 0;
  font-size: clamp(40px, 10vw, 64px);
  font-weight: 800;
  line-height: 1.05;
  color: #fff;
  text-shadow: 0 4px 0 var(--accent-dark), 0 8px 20px rgba(0, 0, 0, .2);
  animation: wobble 3s ease-in-out infinite;
}

@keyframes wobble {
  0%, 100% { transform: rotate(-2deg); }
  50% { transform: rotate(2deg); }
}

.sub {
  margin: 8px 0 0;
  font-size: 18px;
  font-weight: 500;
}

/* Result card */
.card {
  width: 100%;
  min-height: 240px;
  padding: 28px 20px;
  border-radius: 28px;
  background: var(--card);
  border: 4px solid var(--ink);
  box-shadow: var(--shadow);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.emoji {
  font-size: 72px;
  line-height: 1;
}

.dish {
  font-size: clamp(28px, 7vw, 40px);
  font-weight: 800;
  line-height: 1.15;
}

.note {
  font-size: 17px;
  opacity: .75;
}

.card.spinning .emoji { animation: shake .12s linear infinite; }
.card.spinning .dish { opacity: .6; filter: blur(.5px); }

@keyframes shake {
  0%, 100% { transform: rotate(-10deg) scale(1); }
  50% { transform: rotate(10deg) scale(1.08); }
}

.card.reveal { animation: pop .7s cubic-bezier(.2, 1.6, .4, 1); }
.card.reveal .emoji { animation: bounce 1s ease .1s; }
.card.reveal .dish {
  color: var(--accent);
  animation: rainbow 2.4s linear infinite;
}

@keyframes pop {
  0% { transform: scale(.7) rotate(-4deg); }
  60% { transform: scale(1.08) rotate(2deg); }
  100% { transform: scale(1) rotate(0); }
}

@keyframes bounce {
  0%, 100% { transform: translateY(0) scale(1); }
  30% { transform: translateY(-30px) scale(1.25); }
  60% { transform: translateY(0) scale(.95); }
}

@keyframes rainbow {
  0%   { color: #ff4d4d; }
  25%  { color: #ff9f1c; }
  50%  { color: #2ec4b6; }
  75%  { color: #9b5de5; }
  100% { color: #ff4d4d; }
}

/* Big button */
.spin-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 16px 32px;
  border: 4px solid var(--ink);
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-size: clamp(20px, 5vw, 26px);
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 8px 0 var(--ink);
  transition: transform .1s, box-shadow .1s, background .2s;
}
.spin-btn:hover { background: #ff6262; transform: translateY(-2px); box-shadow: 0 10px 0 var(--ink); }
.spin-btn:active { transform: translateY(6px); box-shadow: 0 2px 0 var(--ink); }
.spin-btn:focus-visible { outline: 4px solid #fff; outline-offset: 4px; }
.spin-btn:disabled { cursor: wait; background: #e07070; }
.spin-btn__icon { display: inline-block; font-size: 1.2em; }
.spin-btn:not(:disabled) .spin-btn__icon { animation: wobble 1.2s ease-in-out infinite; }
.spin-btn:disabled .spin-btn__icon { animation: roll .4s linear infinite; }

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

/* History */
.history { width: 100%; text-align: center; }
.history h2 { margin: 0 0 8px; font-size: 18px; }
.history ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}
.history li {
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .75);
  border: 2px solid var(--ink);
  font-weight: 600;
  font-size: 15px;
  animation: pop .4s ease;
}

/* Filters */
.filters {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: center;
}
.label { margin: 0 0 6px; font-weight: 800; font-size: 17px; }
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.chip {
  padding: 6px 14px;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: rgba(255, 255, 255, .85);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
  box-shadow: 0 3px 0 var(--ink);
  transition: transform .1s, box-shadow .1s, background .2s;
}
.chip:hover { transform: translateY(-2px); }
.chip:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.chip[aria-pressed="true"] { background: var(--ink); color: #fff; }
.chip:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }

/* Place suggestions */
.places {
  width: 100%;
  padding: 20px 16px;
  border-radius: 24px;
  background: rgba(255, 250, 240, .92);
  border: 4px solid var(--ink);
  box-shadow: 0 6px 0 rgba(58, 29, 16, .18);
  text-align: center;
  animation: pop .5s ease;
}
.places h2 { margin: 0; font-size: 22px; }
.places__hint { margin: 2px 0 14px; opacity: .7; font-size: 15px; }
.places ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}
.place-btn {
  width: 100%;
  padding: 10px 12px;
  border: 3px solid var(--ink);
  border-radius: 16px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 4px 0 var(--ink);
  transition: transform .1s, box-shadow .1s, background .2s;
}
.place-btn:hover { background: #fff3d6; transform: translateY(-2px); }
.place-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.place-btn strong { display: block; font-size: 17px; line-height: 1.2; }
.place-btn small { font-size: 14px; opacity: .7; }

/* Map modal */
.modal { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 16px; }
.modal[hidden] { display: none; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(30, 12, 5, .55); }
.modal__box {
  position: relative;
  width: 100%;
  max-width: 720px;
  padding: 16px;
  border-radius: 24px;
  background: var(--card);
  border: 4px solid var(--ink);
  box-shadow: var(--shadow);
  animation: pop .45s cubic-bezier(.2, 1.6, .4, 1);
}
.modal__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.modal__head h3 { margin: 0; font-size: 20px; line-height: 1.2; }
.modal__close {
  flex: none;
  width: 40px; height: 40px;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
}
.modal__map { border-radius: 16px; overflow: hidden; border: 3px solid var(--ink); background: #eee; }
.modal__map iframe { display: block; width: 100%; height: min(60vh, 440px); border: 0; }
.modal__open {
  display: inline-block;
  margin-top: 12px;
  color: var(--accent-dark);
  font-weight: 800;
  text-decoration: none;
}
.modal__open:hover { text-decoration: underline; }

.foot {
  position: relative;
  z-index: 1;
  padding: 16px;
  font-size: 14px;
  opacity: .8;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
