* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Fredoka', sans-serif;
  background:
    radial-gradient(circle at 12% 18%, rgba(255, 200, 230, 0.7) 0%, transparent 35%),
    radial-gradient(circle at 88% 70%, rgba(180, 220, 255, 0.55) 0%, transparent 40%),
    linear-gradient(180deg, #fff8ef 0%, #ffe4f2 48%, #e6f3ff 100%);
  min-height: 100vh;
  color: #3a2848;
}

.bd-conveyor-panel {
  background: linear-gradient(180deg, #ffffff 0%, #fff5fa 100%);
  border: 3px solid #ffb8d0;
  border-radius: 18px;
  padding: 14px;
  margin-bottom: 16px;
  box-shadow: 0 8px 0 #f0a0c0, 0 16px 32px rgba(232, 80, 120, 0.18);
}

.bd-box-panel {
  background: linear-gradient(180deg, #e8bc8a 0%, #d4a878 100%);
  border: 4px solid #8b6040;
  border-radius: 16px;
  padding: 16px;
  box-shadow: inset 0 0 0 4px #c89868, 0 10px 0 #6b4830, 0 18px 28px rgba(100, 60, 30, 0.25);
}

.bd-box {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 3px;
  max-width: 360px;
  margin: 0 auto;
}

.bd-box .bd-slot {
  aspect-ratio: 1;
  background: rgba(255, 255, 255, 0.35);
  border: 1px dashed rgba(100, 60, 30, 0.35);
  border-radius: 6px;
  cursor: pointer;
  position: relative;
  transition: transform 0.12s ease, background 0.12s, box-shadow 0.12s;
}

.bd-box .bd-slot:hover {
  background: rgba(255, 240, 210, 0.7);
  transform: scale(1.06);
  box-shadow: 0 0 0 2px rgba(232, 80, 120, 0.4);
}

.bd-box .bd-filled {
  border: none;
  cursor: default;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.15), 0 2px 6px rgba(0, 0, 0, 0.12);
  transform: none;
}

#bd-app {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px 16px 32px;
}

.bd-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}

.bd-brand {
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  opacity: 0.6;
}

.bd-header h1 {
  font-size: clamp(1.1rem, 4vw, 1.5rem);
  color: #e85078;
  line-height: 1.2;
}

.bd-stats {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.75rem;
  text-align: right;
}

.bd-stats strong { color: #4080e0; font-size: 1rem; }

.bd-label {
  font-size: 0.72rem;
  opacity: 0.7;
  margin-bottom: 8px;
}

#bd-conveyor {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 8px;
  background: #f0e8e0;
}

.bd-current {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
}

.bd-preview {
  display: grid;
  gap: 2px;
  padding: 8px;
  background: #f8f0ff;
  border-radius: 10px;
  border: 2px dashed #c0a0e0;
  min-width: 80px;
  min-height: 60px;
}

.bd-preview .bd-cell {
  width: 22px;
  height: 22px;
  border-radius: 4px;
}

.bd-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bd-controls button {
  font-family: inherit;
  font-size: 0.8rem;
  padding: 10px 16px;
  border: none;
  border-radius: 999px;
  background: #58c878;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 3px 0 #389858;
}

.bd-controls button:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #389858;
}

.bd-controls .bd-muted {
  background: #a0a8b8;
  box-shadow: 0 3px 0 #707880;
}

.bd-timer-wrap {
  margin-top: 10px;
  height: 10px;
  background: #e8e0e8;
  border-radius: 999px;
  overflow: hidden;
}

.bd-timer {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #58c878, #f0d040, #e85078);
  border-radius: 999px;
  transition: width 0.1s linear;
}

.bd-msg {
  text-align: center;
  font-size: 0.8rem;
  margin-top: 14px;
  opacity: 0.85;
}

.bd-exit {
  position: fixed;
  top: 12px;
  right: 12px;
  font-size: 0.75rem;
  color: #806090;
  text-decoration: none;
}

.bd-overlay {
  position: fixed;
  inset: 0;
  background: rgba(40, 20, 50, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
}

.bd-overlay[hidden] { display: none !important; }

.bd-overlay-box {
  background: #fff;
  border-radius: 20px;
  padding: 28px;
  text-align: center;
  max-width: 320px;
  border: 4px solid #e85078;
}

.bd-overlay-box h2 {
  color: #e85078;
  margin-bottom: 10px;
}

.bd-overlay-box p {
  font-size: 0.85rem;
  line-height: 1.5;
  margin-bottom: 16px;
}

.bd-overlay-box button {
  font-family: inherit;
  padding: 12px 24px;
  border: none;
  border-radius: 999px;
  background: #4080e0;
  color: #fff;
  cursor: pointer;
  font-size: 0.9rem;
}

.bd-confetti {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 30;
}

.bd-confetti[hidden] { display: none !important; }

@media (max-width: 520px) {
  .bd-current { flex-direction: column; }
  .bd-preview .bd-cell { width: 18px; height: 18px; }
}
