:root {
  --ink: #5a2010;
  --muted: #8a4a28;
  --card: #fff8e8;
  --accent: #e53935;
  --accent-2: #ffc107;
  --danger: #c62828;
  --ok: #2e7d32;
  --shadow: 0 16px 40px rgba(80, 20, 8, 0.28);
  --font: "Nunito", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--ink);
  background: #ffb347;
  overflow-x: hidden;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.bg {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    url(a/bg.webp) center/cover no-repeat,
    linear-gradient(180deg, #ffd54f 0%, #ff8a3d 48%, #c62828 100%);
}
.bg::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(255, 200, 80, 0.12) 0%, rgba(180, 40, 20, 0.18) 55%, rgba(90, 18, 8, 0.52) 100%);
}
.shell {
  position: relative; z-index: 1;
  max-width: 440px;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 16px 36px;
  animation: rise 0.55s ease both;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}
.hero { text-align: center; margin-bottom: 14px; }
.badge {
  display: inline-block;
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  background: rgba(255,248,232,0.8);
  border: 1px solid rgba(90,32,16,0.15);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 0.45rem;
}
h1 {
  margin: 0;
  font-size: clamp(1.55rem, 5.5vw, 2rem);
  font-weight: 800;
  text-shadow: 0 2px 0 rgba(255,255,255,0.35);
}
.sub {
  margin: 0.45rem auto 0.9rem;
  max-width: 28em;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.45;
  font-weight: 700;
}
.meta { display: flex; justify-content: center; gap: 0.55rem; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  background: rgba(255,248,232,0.88);
  border: 1px solid rgba(90,32,16,0.12);
  font-size: 0.86rem;
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(80,20,8,0.12);
}
.chip b { color: var(--accent); font-variant-numeric: tabular-nums; }
.board {
  position: relative;
  height: min(360px, 54vh);
  border-radius: 24px;
  background: linear-gradient(145deg, rgba(255,248,232,0.55), rgba(255,200,120,0.28));
  border: 1px solid rgba(255,255,255,0.55);
  box-shadow: var(--shadow);
  overflow: hidden;
  backdrop-filter: blur(6px);
}
.tile {
  position: absolute;
  width: 58px; height: 58px;
  border: 0;
  border-radius: 16px;
  padding: 0;
  overflow: hidden;
  display: grid; place-items: center;
  background: var(--card);
  box-shadow:
    0 0 0 2px rgba(255, 228, 160, 0.9),
    0 5px 0 #9a6328,
    0 10px 18px rgba(80, 20, 8, 0.22);
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.12s ease, opacity 0.18s ease;
}
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.tile:active { transform: scale(0.92) translateY(2px); }
.tile.blocked { filter: brightness(0.55) saturate(0.8); cursor: not-allowed; }
.slot-wrap { margin-top: 14px; }
.slot-label {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.35rem;
}
.slot {
  min-height: 72px;
  display: flex; gap: 8px; align-items: center;
  padding: 10px;
  border-radius: 18px;
  background: rgba(255,248,232,0.75);
  border: 1.5px dashed rgba(90,32,16,0.25);
  overflow-x: auto;
}
.slot .tile {
  position: static;
  width: 50px; height: 50px;
  flex: 0 0 auto;
  animation: pop 0.22s ease;
}
@keyframes pop {
  from { transform: scale(0.7); opacity: 0; }
  to { transform: none; opacity: 1; }
}
.msg { min-height: 1.5em; text-align: center; font-weight: 800; margin: 12px 0 8px; }
.msg.bad { color: var(--danger); }
.msg.ok { color: var(--ok); }
.btn {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 999px;
  padding: 13px 18px;
  background: linear-gradient(180deg, #ff8a50, var(--accent));
  color: #fff;
  font: inherit;
  font-weight: 800;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: 0 8px 0 #8a1a10, 0 12px 24px rgba(80,20,8,0.25);
}
.btn:active { transform: translateY(3px); box-shadow: 0 4px 0 #8a1a10; }
.btn.ghost {
  margin-top: 10px;
  background: rgba(255,248,232,0.9);
  color: var(--ink);
  box-shadow: 0 4px 0 rgba(90,32,16,0.15);
}
.overlay {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: center;
  background: rgba(60, 15, 8, 0.55);
  backdrop-filter: blur(4px);
  padding: 16px;
}
.card {
  width: min(340px, 100%);
  background: linear-gradient(#fff9e6, #ffeec2);
  border: 3px solid #c98a4b;
  border-radius: 22px;
  padding: 22px;
  text-align: center;
  box-shadow: 0 18px 40px rgba(0,0,0,0.3);
  color: var(--ink);
}
.card h2 { margin: 0 0 8px; font-size: 1.35rem; }
.card p { margin: 0 0 14px; color: var(--muted); line-height: 1.5; }
.card .btn { width: auto; min-width: 180px; margin: 0 auto; }
[hidden] { display: none !important; }
@media (prefers-reduced-motion: reduce) {
  .shell, .slot .tile { animation: none; }
}
