/* ============================
   SORTIFY — GAME STYLES
   ============================ */

/* ---- GAME WRAPPER ---- */
.game-wrapper {
  max-width: 900px;
  margin: 0 auto;
  padding: 48px 24px 80px;
  min-height: calc(100vh - 64px);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ---- PAGE HEADER ---- */
.game-page-header {
  text-align: center;
}
.game-page-title {
  font-family: 'Syne', system-ui, sans-serif;
  font-size: clamp(36px, 5vw, 56px);
  font-weight: 800;
  color: var(--forest);
  line-height: 1.1;
  margin-bottom: 12px;
}
.game-page-sub {
  font-size: 16px;
  color: var(--text-mid);
}

/* ---- SCORE BAR ---- */
.score-bar {
  display: flex;
  align-items: center;
  gap: 0;
  background: white;
  border-radius: var(--radius);
  border: 1px solid var(--sand-dark);
  padding: 14px 20px;
  box-shadow: 0 2px 8px rgba(28, 56, 41, 0.06);
}
.score-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 0 20px;
}
.score-num {
  font-family: 'Syne', system-ui, sans-serif;
  font-size: 24px;
  font-weight: 800;
  color: var(--forest);
  line-height: 1;
}
.score-label {
  font-size: 11px;
  color: var(--text-light);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.score-divider {
  width: 1px;
  height: 32px;
  background: var(--sand-dark);
  flex-shrink: 0;
}
.score-spacer { flex: 1; }
.btn-reset {
  background: none;
  border: 1.5px solid var(--sand-dark);
  color: var(--text-mid);
  font-size: 13px;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-family: 'DM Sans', system-ui, sans-serif;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn-reset:hover {
  background: var(--sand);
  border-color: var(--text-light);
  color: var(--text);
}

/* ---- GAME FRAME ---- */
.game-frame {
  background: white;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 8px 40px rgba(28, 56, 41, 0.12), 0 2px 8px rgba(28, 56, 41, 0.06);
  border: 1px solid var(--sand-dark);
}
.game-header {
  background: var(--forest);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.game-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.dot-red    { background: #FF5F57; }
.dot-yellow { background: #FFBD2E; }
.dot-green  { background: #28CA41; }
.game-title {
  margin-left: 8px;
  color: rgba(255, 255, 255, 0.55);
  font-size: 12px;
  font-family: 'DM Sans', system-ui, sans-serif;
}

/* ---- GAME AREA ---- */
.game-area {
  padding: 28px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ---- ITEMS TRAY ---- */
.items-tray {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  min-height: 90px;
  align-items: center;
  padding: 16px;
  background: var(--sand);
  border-radius: var(--radius-sm);
  border: 1px dashed var(--sand-dark);
  transition: background 0.2s;
}
.items-tray.is-empty {
  background: transparent;
  border-style: dashed;
  min-height: 60px;
}

/* ---- FEEDBACK ROW ---- */
.feedback-row {
  display: flex;
  justify-content: center;
}
.feedback-message {
  font-size: 14px;
  font-weight: 500;
  padding: 8px 20px;
  border-radius: 100px;
  transition: background 0.2s, color 0.2s;
  text-align: center;
}
.feedback-message.idle {
  color: var(--text-light);
  background: var(--sand);
}
.feedback-message.correct {
  color: #1A6B3A;
  background: #D4EDDA;
}
.feedback-message.wrong {
  color: #8B2020;
  background: #F8D7DA;
}

/* ---- BINS ROW ---- */
.bins-row {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}
.bin {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: default;
}
.bin-body {
  width: 90px;
  height: 90px;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 2.5px dashed transparent;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
  position: relative;
  overflow: hidden;
}
.bin-body svg { opacity: 0.5; }
.bin-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-mid);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Bin colors */
.bin-recycle .bin-body  { background: rgba(58, 123, 213, 0.15); border-color: rgba(58, 123, 213, 0.3); }
.bin-compost .bin-body  { background: rgba(39, 174, 96, 0.15);  border-color: rgba(39, 174, 96, 0.3); }
.bin-landfill .bin-body { background: rgba(107, 107, 107, 0.15); border-color: rgba(107, 107, 107, 0.3); }
.bin-hazard .bin-body    { background: rgba(180, 60, 60, 0.15);  border-color: rgba(180, 60, 60, 0.3); }
.bin-electronics .bin-body { background: rgba(120, 80, 180, 0.15); border-color: rgba(120, 80, 180, 0.3); }
.bin-textile .bin-body   { background: rgba(200, 100, 50, 0.15);  border-color: rgba(200, 100, 50, 0.3); }

/* Drag-over state */
.bin-body.drag-over {
  transform: scale(1.08);
  box-shadow: 0 0 0 3px rgba(224, 123, 57, 0.5);
  border-color: var(--amber) !important;
  border-style: solid !important;
}
.bin-body.drop-success {
  animation: successPulse 0.5s ease;
}
.bin-body.drop-fail {
  animation: failShake 0.4s ease;
}

@keyframes successPulse {
  0%   { box-shadow: 0 0 0 0 rgba(39, 174, 96, 0.6); }
  50%  { box-shadow: 0 0 0 8px rgba(39, 174, 96, 0); }
  100% { box-shadow: 0 0 0 0 rgba(39, 174, 96, 0); }
}
@keyframes failShake {
  0%   { transform: translateX(0); }
  20%  { transform: translateX(-6px); }
  40%  { transform: translateX(6px); }
  60%  { transform: translateX(-4px); }
  80%  { transform: translateX(4px); }
  100% { transform: translateX(0); }
}

/* ---- GAME FOOTER ---- */
.game-footer {
  background: var(--sand);
  border-top: 1px solid var(--sand-dark);
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}
#game-status {
  font-size: 12px;
  color: var(--text-light);
}

/* ---- DRAGGABLE ITEM CARDS ---- */
.item-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: white;
  border: 1.5px solid var(--sand-dark);
  border-radius: 12px;
  padding: 12px 14px;
  cursor: grab;
  user-select: none;
  width: 86px;
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
  box-shadow: 0 2px 6px rgba(28, 56, 41, 0.08);
  touch-action: none;
}
.item-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(28, 56, 41, 0.14);
  border-color: var(--forest-light);
}
.item-card:active, .item-card.dragging {
  cursor: grabbing;
  transform: scale(1.08) rotate(-2deg);
  box-shadow: 0 12px 24px rgba(28, 56, 41, 0.2);
  opacity: 0.9;
  z-index: 10;
}
.item-card svg {
  width: 40px;
  height: 40px;
  pointer-events: none;
}
.item-name {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-mid);
  text-align: center;
  line-height: 1.3;
  pointer-events: none;
}

/* ---- SORTED (correct) ITEM ---- */
.item-card.sorted {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
  transform: scale(0.8);
  height: 0;
  padding: 0;
  margin: 0;
  border: 0;
  overflow: hidden;
}

/* ---- SORTED TRAY ---- */
.sorted-tray {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sorted-bin-group {
  display: flex;
  align-items: center;
  gap: 8px;
}
.sorted-bin-icon {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.sorted-bin-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-light);
}
.sorted-items {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 12px;
  background: white;
  border-radius: 8px;
  border: 1px solid var(--sand-dark);
  min-height: 38px;
  align-items: center;
}
.sorted-item {
  font-size: 11px;
  color: var(--text-mid);
  background: var(--sand);
  border-radius: 100px;
  padding: 3px 10px;
  font-weight: 500;
}

/* ---- COMPLETION SCREEN ---- */
.completion-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  position: fixed;
  inset: 0;
  background: rgba(28, 56, 41, 0.7);
  backdrop-filter: blur(6px);
  z-index: 200;
  animation: fadeIn 0.3s ease;
}
.completion-card {
  background: white;
  border-radius: 20px;
  padding: 48px 40px;
  text-align: center;
  max-width: 440px;
  width: 90%;
  box-shadow: 0 24px 64px rgba(0,0,0,0.2);
  animation: slideUp 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: translateY(0); } }

.completion-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  margin: 0 auto 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
}
.completion-icon.perfect { background: #D4EDDA; }
.completion-icon.good   { background: #FFF3CD; }
.completion-icon.ok     { background: #F8D7DA; }

.completion-title {
  font-family: 'Syne', system-ui, sans-serif;
  font-size: 28px;
  font-weight: 800;
  color: var(--forest);
  margin-bottom: 12px;
}
.completion-body {
  font-size: 15px;
  color: var(--text-mid);
  line-height: 1.65;
  margin-bottom: 28px;
}
.completion-stats {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-bottom: 32px;
}
.c-stat { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.c-stat-num {
  font-family: 'Syne', system-ui, sans-serif;
  font-size: 32px;
  font-weight: 800;
  color: var(--forest);
}
.c-stat-label { font-size: 12px; color: var(--text-light); font-weight: 500; text-transform: uppercase; letter-spacing: 0.06em; }

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--forest);
  color: white;
  font-size: 15px;
  font-weight: 600;
  padding: 14px 32px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  font-family: 'DM Sans', system-ui, sans-serif;
  transition: background 0.15s, transform 0.15s;
}
.btn-primary:hover {
  background: var(--forest-light);
  transform: translateY(-1px);
}

/* ---- RESPONSIVE ---- */
@media (max-width: 640px) {
  .game-wrapper { padding: 32px 16px 60px; }
  .bins-row { gap: 10px; }
  .bin-body { width: 70px; height: 70px; }
  .item-card { width: 74px; padding: 10px 10px; }
  .item-card svg { width: 32px; height: 32px; }
  .score-bar { gap: 0; padding: 12px 12px; }
  .score-item { padding: 0 10px; }
  .completion-card { padding: 32px 24px; }
}