* { margin: 0; padding: 0; box-sizing: border-box; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }

:root {
  --fry: #ffce4d;
  --fry-dark: #e09a18;
  --bag: #e0573a;
  --bag-dark: #a83a26;
  --ink: #0c0f17;
  --paper: #f4f1ea;
  --accent: #ffd95e;
  --good: #5ef0a0;
  --bad: #ff5a6a;
  --glass: rgba(255,255,255,0.06);
  --stroke: rgba(255,255,255,0.12);
  --display: "Clash Display", system-ui, sans-serif;
  --body: "Satoshi", system-ui, -apple-system, sans-serif;
}

html, body {
  height: 100%;
  font-family: var(--body);
  background: #0a0d15;
  color: #fff;
  overflow: hidden;
  touch-action: none;
}

iconify-icon { vertical-align: -0.12em; }

/* ---------- Animated background (layers.to / motion-primitives vibe) ---------- */
#bg-layers { position: fixed; inset: 0; z-index: 0; overflow: hidden; background: #0a0d15; }
#bg-layers::before { /* the real fry-station photo */
  content: ""; position: absolute; inset: 0;
  background: url("assets/fry-station.jpg") center / cover no-repeat;
  transform: scale(1.06);
  filter: saturate(1.05) contrast(1.02);
}
#bg-layers::after { /* readability wash over the photo */
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(10,13,21,0.62) 0%, rgba(10,13,21,0.48) 45%, rgba(10,13,21,0.82) 100%);
}
.blob { position: absolute; border-radius: 50%; filter: blur(70px); opacity: 0.32; mix-blend-mode: screen; }
.b1 { width: 46vmax; height: 46vmax; left: -10vmax; top: -8vmax;
  background: radial-gradient(circle, #ff9d2f, transparent 65%); animation: drift1 22s ease-in-out infinite; }
.b2 { width: 40vmax; height: 40vmax; right: -8vmax; top: 10vmax;
  background: radial-gradient(circle, #e0573a, transparent 65%); animation: drift2 26s ease-in-out infinite; }
.b3 { width: 38vmax; height: 38vmax; left: 20vmax; bottom: -14vmax;
  background: radial-gradient(circle, #4f7cff, transparent 65%); animation: drift3 30s ease-in-out infinite; }
@keyframes drift1 { 50% { transform: translate(8vmax, 6vmax) scale(1.15); } }
@keyframes drift2 { 50% { transform: translate(-7vmax, 9vmax) scale(1.1); } }
@keyframes drift3 { 50% { transform: translate(5vmax, -7vmax) scale(1.2); } }
.grain { position: absolute; inset: 0; opacity: 0.04; pointer-events: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>"); }

#game { position: relative; z-index: 1; width: 100vw; height: 100vh; display: flex; flex-direction: column; }

/* ---------- HUD ---------- */
#hud {
  display: flex; justify-content: space-around; align-items: center;
  padding: 12px 6px;
  background: rgba(10,13,21,0.55);
  border-bottom: 1px solid var(--stroke);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  z-index: 5;
}
.stat { display: flex; flex-direction: column; align-items: center; gap: 2px; line-height: 1; }
.stat .label {
  display: flex; align-items: center; gap: 4px;
  font-family: var(--body); font-weight: 500; font-size: 10px;
  letter-spacing: 1.2px; opacity: 0.65; text-transform: uppercase;
}
.stat .label iconify-icon { font-size: 12px; opacity: 0.9; }
.stat span:last-child { font-family: var(--display); font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat.bump span:last-child { animation: bump 0.3s cubic-bezier(.34,1.56,.64,1); }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.35); color: var(--good); } 100% { transform: scale(1); } }
#time { color: var(--accent); }
#combo { color: var(--good); }
#lives { color: var(--bad); font-size: 15px; letter-spacing: -1px; }

/* ---------- Reward banner ---------- */
#reward-banner {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  text-align: center; font-family: var(--display); font-weight: 600;
  font-size: 12px; letter-spacing: 0.3px; padding: 7px 8px; color: #2a1c05;
  background: linear-gradient(90deg, #ffe27a, #ffb347, #ffe27a);
  background-size: 220% 100%;
  animation: shimmer 5s linear infinite;
  box-shadow: 0 2px 18px rgba(255,179,71,0.35);
  z-index: 5;
}
#reward-banner iconify-icon { font-size: 15px; }
@keyframes shimmer { to { background-position: 220% 0; } }

/* ---------- Playfield ---------- */
#playfield { position: relative; flex: 1; overflow: hidden; }

/* Bag */
#bag {
  position: absolute; bottom: 22px; left: 50%; margin-left: -82px;
  width: 164px; height: 196px;
  background: linear-gradient(180deg, var(--bag) 0%, var(--bag-dark) 100%);
  border-radius: 8px 8px 16px 16px;
  box-shadow: 0 18px 40px rgba(0,0,0,0.5), inset 0 -12px 22px rgba(0,0,0,0.28), inset 0 2px 0 rgba(255,255,255,0.12);
  z-index: 2;
}
#bag::before { /* paper seam */
  content: ""; position: absolute; inset: 10px 22px auto 22px; height: 2px;
  background: rgba(255,255,255,0.16); border-radius: 2px;
}
#bag.target { box-shadow: 0 0 0 3px var(--good), 0 0 28px rgba(94,240,160,0.5), 0 18px 40px rgba(0,0,0,0.5); }
#bag.bad { box-shadow: 0 0 0 3px var(--bad), 0 0 28px rgba(255,90,106,0.55), 0 18px 40px rgba(0,0,0,0.5); }
#bag.pop { animation: bagpop 0.16s cubic-bezier(.34,1.56,.64,1); }
@keyframes bagpop { 50% { transform: scale(1.09); } }
#bag-mouth {
  position: absolute; top: -14px; left: 10px; right: 10px; height: 28px;
  background: var(--bag-dark);
  border-radius: 50% 50% 4px 4px / 80% 80% 4px 4px;
  box-shadow: inset 0 6px 12px rgba(0,0,0,0.55);
}
#bag-fill {
  position: absolute; bottom: 0; left: 0; right: 0; height: 0%;
  background: repeating-linear-gradient(95deg, var(--fry) 0 8px, var(--fry-dark) 8px 13px);
  border-radius: 0 0 14px 14px; transition: height 0.3s cubic-bezier(.34,1.4,.64,1);
}
#bag-label {
  position: absolute; top: 52%; left: 0; right: 0; text-align: center;
  transform: translateY(-50%);
  font-family: var(--display); font-weight: 700; font-size: 30px; letter-spacing: 5px;
  color: rgba(255,255,255,0.9); pointer-events: none; text-shadow: 0 2px 6px rgba(0,0,0,0.3);
}
#bag-logo {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 78%; height: auto; pointer-events: none;
  filter: drop-shadow(0 2px 5px rgba(0,0,0,0.45));
}

/* Fryer — full-width "orders up" shelf the fries drop from */
#fryer {
  position: absolute; top: 0; left: 0; right: 0;
  height: 46px;
  background: linear-gradient(180deg, #6b7790, #3b4456);
  border-bottom: 2px solid rgba(0,0,0,0.35);
  display: flex; align-items: center; justify-content: center;
  box-shadow: inset 0 4px 10px rgba(255,255,255,0.12), 0 6px 16px rgba(0,0,0,0.4);
  z-index: 1;
}
#fryer-label { font-family: var(--display); font-weight: 600; opacity: 0.6; font-size: 13px; letter-spacing: 1.5px; }

/* Challenge banner */
#challenge {
  position: absolute; top: 98px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 6px;
  background: linear-gradient(180deg, #ff6a76, #d8263a); color: #fff;
  font-family: var(--display); font-weight: 700;
  padding: 9px 20px; border-radius: 999px; font-size: 15px; white-space: nowrap;
  box-shadow: 0 8px 26px rgba(216,38,58,0.5); z-index: 6; display: none;
}
#challenge.show { display: flex; animation: pulse 0.6s ease infinite alternate; }
@keyframes pulse { to { transform: translateX(-50%) scale(1.06); } }

/* Items */
.item { position: absolute; z-index: 3; pointer-events: none; cursor: default; will-change: transform, left, top;
  animation: drop-in 0.2s ease; }
@keyframes drop-in { from { opacity: 0; transform: translateY(-12px) scale(0.6); } }
.fry {
  width: 16px; height: 64px;
  background: linear-gradient(180deg, #ffe79a 0%, var(--fry) 42%, var(--fry-dark) 100%);
  border-radius: 5px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.4), inset -2px 0 3px rgba(0,0,0,0.22), inset 2px 0 2px rgba(255,255,255,0.4);
}
.fry.golden {
  background: linear-gradient(180deg, #fff6c8 0%, #ffd23f 42%, #c98a00 100%);
  box-shadow: 0 0 16px #ffd23f, 0 4px 8px rgba(0,0,0,0.4);
  animation: drop-in 0.28s cubic-bezier(.34,1.56,.64,1), gleam 1.4s ease-in-out infinite;
}
@keyframes gleam { 50% { filter: brightness(1.25); } }
.ketchup {
  width: 42px; height: 42px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center; font-size: 26px;
  background: radial-gradient(circle at 35% 30%, #ff7363, #b71c1c);
  box-shadow: 0 0 14px rgba(255,60,60,0.55), 0 4px 8px rgba(0,0,0,0.4);
}
.fly {
  width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 23px;
  background: radial-gradient(circle at 35% 30%, #5a5f4a, #23271a);
  box-shadow: 0 0 12px rgba(120,140,60,0.5), 0 4px 8px rgba(0,0,0,0.4);
  animation: drop-in 0.28s cubic-bezier(.34,1.56,.64,1), buzz 0.25s linear infinite;
}
@keyframes buzz { 25% { transform: translate(1px,-1px); } 50% { transform: translate(-1px,1px); } 75% { transform: translate(1px,1px); } }
.fry.urgent {
  filter: saturate(0.55) brightness(0.8);
  animation: drop-in 0.28s cubic-bezier(.34,1.56,.64,1), wilt 0.3s ease-in-out infinite alternate;
}
@keyframes wilt { to { transform: rotate(9deg) translateY(2px); } }
.item.dragging { z-index: 50; cursor: grabbing; transform: scale(1.18) rotate(6deg);
  filter: drop-shadow(0 8px 14px rgba(0,0,0,0.5)); }

/* Popups */
.popup {
  position: absolute; z-index: 40; font-family: var(--display); font-weight: 700; font-size: 21px;
  pointer-events: none; text-shadow: 0 2px 6px rgba(0,0,0,0.6);
  animation: floatUp 0.85s cubic-bezier(.22,1,.36,1) forwards;
}
@keyframes floatUp { to { transform: translateY(-54px); opacity: 0; } }

/* Confetti (golden / win) */
.confetti { position: absolute; width: 9px; height: 14px; z-index: 45; border-radius: 2px;
  pointer-events: none; animation: confetti-fall var(--dur,1s) ease-in forwards; }
@keyframes confetti-fall { to { transform: translate(var(--dx,0), var(--dy,160px)) rotate(540deg); opacity: 0; } }

/* Message */
#message {
  position: absolute; top: 132px; left: 0; right: 0; text-align: center;
  font-family: var(--display); font-weight: 700; font-size: 24px;
  pointer-events: none; z-index: 6; opacity: 0; transition: opacity 0.2s;
  text-shadow: 0 3px 12px rgba(0,0,0,0.5);
}
#message.show { opacity: 1; animation: msg-pop 0.3s cubic-bezier(.34,1.56,.64,1); }
@keyframes msg-pop { from { transform: scale(0.7); } }

/* ---------- Overlays / cards ---------- */
.overlay {
  position: absolute; inset: 0; z-index: 20;
  display: none; align-items: center; justify-content: center;
  background: rgba(8,11,18,0.72); backdrop-filter: blur(8px); padding: 18px;
}
.overlay.show { display: flex; animation: fade 0.25s ease; }
@keyframes fade { from { opacity: 0; } }
.card {
  position: relative; max-width: 392px; width: 100%; text-align: center;
  padding: 30px 26px;
  background: linear-gradient(180deg, rgba(40,55,80,0.85), rgba(20,28,44,0.9));
  border: 1px solid var(--stroke);
  border-radius: 24px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.08);
  animation: card-in 0.35s cubic-bezier(.34,1.4,.64,1);
}
@keyframes card-in { from { opacity: 0; transform: translateY(16px) scale(0.96); } }
.card.wide { max-width: 460px; }
.card h1 {
  font-family: var(--display); font-weight: 700; font-size: 30px; line-height: 1.1;
  margin-bottom: 14px; letter-spacing: -0.5px;
  background: linear-gradient(95deg, #fff 0%, var(--accent) 45%, #ff9d2f 70%, #fff 100%);
  background-size: 200% 100%;
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  animation: title-sheen 6s linear infinite;
}
@keyframes title-sheen { to { background-position: 200% 0; } }
.card p { font-family: var(--body); font-size: 15px; line-height: 1.55; opacity: 0.9; margin-bottom: 14px; }
.card .hint { font-size: 12px; opacity: 0.55; margin: 14px 0 0; }
.reward-line { color: var(--accent); font-weight: 700; }
.reward-line b { color: #fff; }
.prev-winner { font-size: 14px; opacity: 0.95; }

#name-input {
  font-family: var(--body); font-weight: 600; width: 100%; padding: 13px 14px; margin-bottom: 14px;
  border-radius: 12px; border: 1px solid var(--stroke);
  background: rgba(0,0,0,0.32); color: #fff; text-align: center;
  transition: border-color 0.2s, box-shadow 0.2s;
}
#name-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255,217,94,0.18); }
#name-input::placeholder { color: rgba(255,255,255,0.4); font-weight: 400; }

/* Spring buttons (reactbits/componetry vibe) */
button {
  font-family: var(--display); font-weight: 600; font-size: 16px;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 13px 26px; margin: 5px; border: none; border-radius: 999px; cursor: pointer;
  color: #2a1a00;
  background: linear-gradient(180deg, #ffe27a, #f0a72b);
  box-shadow: 0 6px 0 #b9791a, 0 12px 24px rgba(240,167,43,0.35), inset 0 1px 0 rgba(255,255,255,0.5);
  transition: transform 0.08s cubic-bezier(.34,1.56,.64,1), box-shadow 0.08s;
}
button iconify-icon { font-size: 18px; }
button:hover { transform: translateY(-1px); }
button:active { transform: translateY(4px); box-shadow: 0 2px 0 #b9791a, 0 4px 10px rgba(0,0,0,0.3); }
button.ghost {
  background: rgba(255,255,255,0.05); color: var(--accent);
  box-shadow: none; border: 1px solid rgba(255,217,94,0.45); font-size: 14px; padding: 11px 22px;
}
button.ghost:hover { background: rgba(255,217,94,0.12); }
button.ghost:active { transform: translateY(2px); }

/* ---------- Leaderboard ---------- */
.board-tabs { display: flex; gap: 8px; justify-content: center; margin-bottom: 14px; }
.tab {
  font-size: 14px; padding: 9px 18px; margin: 0; color: #fff;
  background: rgba(255,255,255,0.07); box-shadow: none; border: 1px solid transparent;
}
.tab.active { background: rgba(255,217,94,0.16); border-color: var(--accent); color: var(--accent); }
.board-list { list-style: none; text-align: left; margin: 0 0 18px; padding: 0; max-height: 46vh; overflow-y: auto; }
.board-list li {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 13px; border-radius: 12px; margin-bottom: 6px;
  background: rgba(255,255,255,0.05); font-size: 15px;
  animation: row-in 0.3s ease both;
}
@keyframes row-in { from { opacity: 0; transform: translateX(-8px); } }
.board-list li.me { background: rgba(94,240,160,0.16); outline: 1px solid var(--good); }
.board-list li.top1 {
  background: linear-gradient(90deg, rgba(255,217,94,0.28), rgba(255,217,94,0.05));
  outline: 1px solid rgba(255,217,94,0.5);
}
.board-list .pos { width: 30px; font-family: var(--display); font-weight: 700; font-size: 17px; opacity: 0.85; text-align: center; }
.board-list .nm { flex: 1; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-list .sc { font-family: var(--display); font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.board-list li.loading, .board-list li.empty { justify-content: center; opacity: 0.6; background: none; }
#hour-countdown { font-size: 14px; }
#hour-countdown b { font-variant-numeric: tabular-nums; }

/* ---------- Wendy's "now working at" badge (bottom-left) ---------- */
#wendys-badge {
  position: fixed; left: 14px; bottom: 14px; z-index: 8;
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  pointer-events: none;
  filter: drop-shadow(0 6px 16px rgba(0,0,0,0.55));
  animation: wb-in 0.5s cubic-bezier(.34,1.4,.64,1) both;
}
#wendys-badge .wb-tag {
  font-family: var(--display); font-weight: 600; font-size: 11px; letter-spacing: 0.6px;
  text-transform: uppercase; color: #fff;
  background: rgba(10,13,21,0.6); border: 1px solid var(--stroke);
  padding: 3px 9px; border-radius: 999px; backdrop-filter: blur(6px);
}
#wendys-badge img {
  width: 124px; max-width: 34vw; height: auto;
  animation: wb-bob 4s ease-in-out infinite;
}
@keyframes wb-in { from { opacity: 0; transform: translateX(-16px) scale(0.9); } }
@keyframes wb-bob { 50% { transform: translateY(-4px) rotate(-1.5deg); } }

/* scrollbar */
.board-list::-webkit-scrollbar { width: 7px; }
.board-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.16); border-radius: 4px; }
