:root {
  --ink: #14281d;
  --muted: #526b5d;
  --bg: #f0f7f3;
  --surface: #ffffff;
  --line: #cfe0d6;
  --green: #10b981;
  --green-dark: #065f46;
  --forest: #047857;
  --sun: #f59e0b;
  --blue: #0284c7;
  --display: "Bricolage Grotesque", system-ui, sans-serif;
  --body: "Lexend", system-ui, sans-serif;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 8px;
  --shadow: 0 8px 30px rgba(6, 95, 70, 0.08);
  --shadow-sm: 0 3px 10px rgba(6, 95, 70, 0.06);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
body { font-family: var(--body); background-color: var(--bg); color: var(--ink); min-height: 100vh; display: flex; flex-direction: column; }

header { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 50; box-shadow: var(--shadow-sm); }
.header-inner { max-width: 1100px; margin: 0 auto; padding: 0.8rem 1.2rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 0.6rem; text-decoration: none; color: var(--ink); }
.brand-icon { width: 40px; height: 40px; background: linear-gradient(135deg, var(--green), var(--green-dark)); border-radius: 10px; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 1.3rem; }
.brand-text h1 { font-family: var(--display); font-size: 1.3rem; font-weight: 800; line-height: 1.1; color: var(--green-dark); }
.brand-text p { font-size: 0.75rem; color: var(--muted); }

.icon-btn {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 0.45rem 0.75rem; cursor: pointer; color: var(--ink); font-size: 0.85rem; font-weight: 600;
  display: flex; align-items: center; gap: 0.3rem; text-decoration: none;
}
.icon-btn:hover { background: var(--bg); border-color: var(--green); }

main { max-width: 960px; width: 100%; margin: 1.5rem auto; padding: 0 1rem; flex: 1; display: flex; flex-direction: column; gap: 1.5rem; }

/* Progress Flag Bar */
.flag-banner {
  background: var(--surface); border-radius: var(--radius-md); padding: 1rem 1.5rem;
  border: 1px solid var(--line); box-shadow: var(--shadow-sm); display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap;
}
.flag-progress { flex: 1; min-width: 200px; background: var(--bg); border: 1px solid var(--line); height: 16px; border-radius: 999px; overflow: hidden; position: relative; }
.flag-fill { background: linear-gradient(90deg, #10b981, #059669); height: 100%; width: 0%; transition: width 0.4s ease; border-radius: 999px; }

/* Item Card to Sort */
.item-stage {
  background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius-lg);
  padding: 2.2rem 1.5rem; text-align: center; box-shadow: var(--shadow); display: flex; flex-direction: column; align-items: center; gap: 0.6rem;
}
.item-emoji { font-size: 4.5rem; animation: float 2s infinite ease-in-out; }
.item-name { font-family: var(--display); font-size: 1.8rem; font-weight: 800; color: var(--green-dark); }
.item-hint { font-size: 0.95rem; color: var(--muted); max-width: 50ch; }

/* 4 Action Bins */
.bins-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
@media (max-width: 768px) { .bins-grid { grid-template-columns: repeat(2, 1fr); } }

.bin-btn {
  background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius-md);
  padding: 1.3rem 0.8rem; display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: 0.5rem; cursor: pointer; transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: var(--shadow-sm); user-select: none;
}
.bin-btn:hover { transform: translateY(-4px); box-shadow: 0 10px 20px rgba(0,0,0,0.08); }
.bin-btn:active { transform: translateY(1px); }

.bin-btn.compost:hover { border-color: #84cc16; background: #f7fee7; }
.bin-btn.recycle:hover { border-color: #0284c7; background: #f0f9ff; }
.bin-btn.energy:hover { border-color: #f59e0b; background: #fffbeb; }
.bin-btn.bio:hover { border-color: #10b981; background: #ecfdf5; }

.bin-icon { font-size: 2.4rem; }
.bin-title { font-family: var(--display); font-size: 1.05rem; font-weight: 800; color: var(--ink); }
.bin-sub { font-size: 0.75rem; color: var(--muted); }

/* Educational Explanation Feedback */
.feedback-box {
  background: #f0fdf4; border: 1px solid rgba(16,185,129,0.3); border-radius: var(--radius-md);
  padding: 0.9rem 1.2rem; font-size: 0.9rem; color: var(--green-dark); text-align: center; min-height: 48px;
  display: flex; align-items: center; justify-content: center;
}

/* Modal */
.modal-overlay {
  position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(6,95,70,0.65);
  backdrop-filter: blur(4px); z-index: 999; display: flex; align-items: center; justify-content: center;
  padding: 1rem; opacity: 0; pointer-events: none; transition: opacity 0.3s;
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }
.modal-card { background: #fff; border-radius: var(--radius-lg); max-width: 480px; width: 100%; padding: 2.2rem; text-align: center; box-shadow: 0 20px 50px rgba(0,0,0,0.25); }

#confetti-canvas { position: fixed; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1000; }

@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }

