:root {
  --forest-deep: #154522;
  --forest-main: #1E6B31;
  --teal-main: #0B6E60;
  --reduce-main: #B54736;
  --cream-surface: #F7F5EE;
  --cream-card: #FCFBF7;
  --border-natural: #D3DFCE;
  --ink-primary: #1B2920;
  --ink-muted: #526458;
  --station-stone: #3B4940;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  width: 100%;
  height: 100dvh;
  overflow: hidden;
  font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
  color: var(--ink-primary);
  background: #4F8540;
  user-select: none;
  -webkit-user-select: none;
}

.mono {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
}

.hidden {
  display: none !important;
}

.app-shell {
  width: 100%;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
}

.hud-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 20px;
  background: rgba(252, 251, 247, 0.96);
  border-bottom: 2px solid #C8D9C3;
  box-shadow: 0 4px 18px rgba(21, 69, 34, 0.12);
  z-index: 30;
  flex-shrink: 0;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-emblem {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(145deg, #1E6B31, #0B6E60);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(11, 110, 96, 0.25);
}

.brand-emblem svg {
  width: 22px;
  height: 22px;
}

.brand-copy h1 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.08rem;
  font-weight: 800;
  color: var(--forest-deep);
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.brand-copy p {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--teal-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hud-metrics {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.metric-chip {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 6px 11px;
  border-radius: 10px;
  background: var(--cream-surface);
  border: 1.5px solid var(--border-natural);
}

.metric-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
}

.metric-value {
  font-size: 0.94rem;
  font-weight: 700;
  color: var(--ink-primary);
}

.metric-time .metric-value {
  color: var(--teal-main);
}

.metric-score .metric-value {
  color: var(--forest-main);
}

.metric-mistakes .metric-value {
  color: var(--reduce-main);
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1.5px solid var(--border-natural);
  background: #FFFFFF;
  color: var(--forest-deep);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.16s ease, transform 0.16s ease;
}

.icon-btn:hover {
  background: #EDF5EB;
  transform: translateY(-1px);
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

.park-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  width: 100%;
  overflow: hidden;
}

.park-backdrop,
.park-foreground {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.park-backdrop {
  z-index: 1;
}

.park-floor {
  position: absolute;
  inset: 0 0 46px 0;
}

.park-foreground {
  z-index: 8;
}

.park-foreground svg {
  width: 100%;
  height: 100%;
}

.trash-item {
  position: absolute;
  width: 58px;
  height: 58px;
  transform: translate(-50%, -50%) rotate(var(--rot, 0deg)) scale(var(--scale, 1));
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  touch-action: none;
  z-index: 6;
  transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1), filter 0.2s ease;
}

.trash-item::before {
  content: '';
  position: absolute;
  bottom: 3px;
  left: 50%;
  transform: translateX(-50%);
  width: 42px;
  height: 11px;
  border-radius: 50%;
  background: rgba(24, 52, 22, 0.34);
  filter: blur(2.5px);
  pointer-events: none;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.trash-item-art {
  width: 52px;
  height: 52px;
  position: relative;
  z-index: 2;
  pointer-events: none;
  filter: drop-shadow(0 3px 4px rgba(17, 38, 18, 0.26));
}

.trash-item-art svg {
  width: 100%;
  height: 100%;
  display: block;
}

.trash-item-tag {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 4px);
  transform: translateX(-50%) rotate(calc(var(--rot, 0deg) * -1)) translateY(4px);
  background: rgba(252, 251, 247, 0.96);
  color: var(--ink-primary);
  border: 1.5px solid #B9CDB5;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 5px 14px rgba(18, 45, 22, 0.22);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s ease;
  z-index: 20;
}

.trash-item.tag-below .trash-item-tag {
  bottom: auto;
  top: calc(100% + 4px);
  transform: translateX(-50%) rotate(calc(var(--rot, 0deg) * -1)) translateY(-4px);
}

.trash-item:hover {
  z-index: 25;
  transform: translate(-50%, -56%) rotate(0deg) scale(1.16);
}

.trash-item:hover .trash-item-tag,
.trash-item.selected .trash-item-tag,
.trash-item.dragging .trash-item-tag {
  opacity: 1;
  transform: translateX(-50%) rotate(0deg) translateY(0);
}

.trash-item.selected {
  z-index: 26;
  transform: translate(-50%, -58%) rotate(0deg) scale(1.18);
  filter: drop-shadow(0 0 10px rgba(255, 244, 179, 0.95));
}

.trash-item.dragging {
  position: fixed !important;
  z-index: 9999 !important;
  cursor: grabbing;
  pointer-events: none;
  transition: none;
  transform: translate(-50%, -50%) rotate(-7deg) scale(1.24) !important;
}

.trash-item.dragging::before {
  opacity: 0;
}

.trash-item.dragging .trash-item-art {
  filter: drop-shadow(0 14px 18px rgba(12, 34, 16, 0.34));
}

.trash-item.returning {
  transition: left 0.28s cubic-bezier(0.22, 1, 0.36, 1), top 0.28s cubic-bezier(0.22, 1, 0.36, 1), transform 0.28s ease;
}

.feedback-pill {
  position: absolute;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  z-index: 15;
  width: min(760px, calc(100% - 28px));
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  border-radius: 14px;
  background: rgba(252, 251, 247, 0.95);
  border: 1.5px solid #C6D8C1;
  box-shadow: 0 8px 22px rgba(18, 52, 24, 0.18);
  backdrop-filter: blur(6px);
  transition: background 0.2s ease, border-color 0.2s ease;
}

.feedback-pill.is-correct {
  background: rgba(232, 247, 236, 0.97);
  border-color: #6BB47B;
}

.feedback-pill.is-wrong {
  background: rgba(254, 238, 235, 0.97);
  border-color: #DF877A;
}

.feedback-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--teal-main);
  flex-shrink: 0;
}

.feedback-pill.is-correct .feedback-dot {
  background: var(--forest-main);
}

.feedback-pill.is-wrong .feedback-dot {
  background: var(--reduce-main);
}

.feedback-pill p {
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--ink-primary);
}

.feedback-pill.is-correct p {
  color: #164D24;
}

.feedback-pill.is-wrong p {
  color: #8E2C1E;
}

.bin-station {
  flex-shrink: 0;
  background: linear-gradient(180deg, #435748 0%, #2C3B31 100%);
  border-top: 4px solid #637967;
  padding: 14px 18px 16px;
  position: relative;
  z-index: 20;
  box-shadow: 0 -8px 24px rgba(15, 38, 19, 0.28);
}

.station-pad {
  max-width: 980px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.recycle-bin {
  position: relative;
  padding-top: 16px;
  cursor: default;
  transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1);
  outline: none;
}

.recycle-bin.bin-ready {
  cursor: pointer;
}

.recycle-bin.bin-ready:hover {
  transform: translateY(-4px);
}

.bin-lid {
  height: 18px;
  width: 94%;
  margin: 0 auto -4px;
  border-radius: 10px 10px 3px 3px;
  position: relative;
  z-index: 3;
  transform-origin: 12% 100%;
  transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.24);
}

.bin-handle {
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 38px;
  height: 6px;
  border-radius: 6px 6px 0 0;
  background: inherit;
  filter: brightness(0.84);
}

.bin-body {
  border-radius: 10px 10px 16px 16px;
  padding: 14px 16px 15px;
  color: #FFFFFF;
  position: relative;
  z-index: 2;
  box-shadow: inset 0 6px 12px rgba(255, 255, 255, 0.14), inset 0 -8px 14px rgba(0, 0, 0, 0.2), 0 8px 18px rgba(0, 0, 0, 0.28);
  transition: box-shadow 0.2s ease, filter 0.2s ease;
}

.bin-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.bin-emblem {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
}

.bin-emblem svg {
  width: 20px;
  height: 20px;
}

.bin-counter {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.22);
}

.bin-body h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.06rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  line-height: 1.1;
}

.bin-body p {
  font-size: 0.76rem;
  font-weight: 500;
  opacity: 0.9;
  margin-top: 3px;
  line-height: 1.25;
}

.bin-recycle .bin-lid {
  background: #0F8474;
}

.bin-recycle .bin-body {
  background: linear-gradient(165deg, #0D7B6B 0%, #07594D 100%);
  border: 1.5px solid #2CA593;
}

.bin-reuse .bin-lid {
  background: #27803D;
}

.bin-reuse .bin-body {
  background: linear-gradient(165deg, #217535 0%, #155325 100%);
  border: 1.5px solid #48A85F;
}

.bin-reduce .bin-lid {
  background: #CA5542;
}

.bin-reduce .bin-body {
  background: linear-gradient(165deg, #BA4937 0%, #8E3022 100%);
  border: 1.5px solid #DF7A6A;
}

.recycle-bin.drag-over {
  transform: translateY(-6px) scale(1.03);
}

.recycle-bin.drag-over .bin-lid {
  transform: rotate(-17deg) translateY(-6px);
}

.recycle-bin.drag-over .bin-body {
  filter: brightness(1.08);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.55), 0 12px 26px rgba(0, 0, 0, 0.36);
}

@keyframes binBounce {
  0% {
    transform: scale(1);
  }
  35% {
    transform: translateY(-7px) scale(1.04);
  }
  70% {
    transform: translateY(1px) scale(0.98);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes binShake {
  0%,
  100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-8px);
  }
  40% {
    transform: translateX(8px);
  }
  60% {
    transform: translateX(-5px);
  }
  80% {
    transform: translateX(5px);
  }
}

.animate-bounce-bin {
  animation: binBounce 0.36s ease-out;
}

.animate-shake-bin {
  animation: binShake 0.38s ease-in-out;
}

@keyframes scoreRise {
  0% {
    opacity: 1;
    transform: translate(-50%, 0) scale(0.88);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -44px) scale(1.12);
  }
}

.score-popup {
  position: fixed;
  z-index: 10000;
  pointer-events: none;
  font-family: 'Outfit', sans-serif;
  font-size: 1.05rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 999px;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.18);
  animation: scoreRise 0.8s ease-out forwards;
}

.score-popup.positive {
  background: #E5F6E9;
  color: #165B28;
  border: 1.5px solid #6FBC80;
}

.score-popup.negative {
  background: #FDECE9;
  color: #A23222;
  border: 1.5px solid #DF877A;
}

@keyframes sparkleBurst {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(0.2);
  }
}

.park-sparkle {
  position: fixed;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 9998;
  animation: sparkleBurst 0.5s ease-out forwards;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(15, 42, 22, 0.56);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.modal-card {
  width: min(560px, 100%);
  max-height: 92dvh;
  overflow-y: auto;
  background: var(--cream-card);
  border: 2px solid #C8DAC4;
  border-radius: 22px;
  box-shadow: 0 24px 60px rgba(10, 32, 16, 0.36);
  padding: 28px;
}

.modal-header-art {
  text-align: center;
}

.campaign-kicker {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 999px;
  background: #E4F2E7;
  color: var(--forest-main);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.modal-header-art h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 2rem;
  font-weight: 800;
  color: var(--forest-deep);
  letter-spacing: -0.02em;
}

.modal-lead {
  font-size: 0.92rem;
  color: var(--ink-muted);
  line-height: 1.5;
  margin-top: 8px;
}

.mini-legend {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 20px 0;
}

.legend-item {
  padding: 11px 12px;
  border-radius: 14px;
  border: 1.5px solid transparent;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.legend-item strong {
  font-family: 'Outfit', sans-serif;
  font-size: 0.88rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.legend-item span {
  font-size: 0.74rem;
  line-height: 1.3;
  color: var(--ink-muted);
}

.legend-recycle {
  background: #E9F6F4;
  border-color: #B4DDD6;
}

.legend-recycle strong {
  color: var(--teal-main);
}

.legend-reuse {
  background: #EAF6EC;
  border-color: #B8DFBF;
}

.legend-reuse strong {
  color: var(--forest-main);
}

.legend-reduce {
  background: #FDEEEB;
  border-color: #EBC1BA;
}

.legend-reduce strong {
  color: var(--reduce-main);
}

.start-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.start-form label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--forest-deep);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.name-row {
  display: flex;
  gap: 10px;
}

.name-row input {
  flex: 1;
  min-width: 0;
  padding: 12px 14px;
  border-radius: 12px;
  border: 2px solid #C6D8C1;
  background: #FFFFFF;
  font-family: inherit;
  font-size: 0.96rem;
  font-weight: 600;
  color: var(--ink-primary);
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.name-row input:focus {
  border-color: var(--teal-main);
  box-shadow: 0 0 0 3px rgba(11, 110, 96, 0.15);
}

.name-row input.invalid {
  border-color: var(--reduce-main);
  animation: binShake 0.32s ease;
}

.input-error {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--reduce-main);
}

.btn-primary,
.btn-secondary,
.btn-ghost {
  border: none;
  border-radius: 12px;
  padding: 12px 20px;
  font-family: 'Outfit', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.15s ease, filter 0.15s ease, background 0.15s ease;
}

.btn-primary {
  background: linear-gradient(135deg, #1E6B31, #0B6E60);
  color: #FFFFFF;
  box-shadow: 0 8px 18px rgba(18, 84, 52, 0.25);
}

.btn-primary:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

.btn-primary svg {
  width: 18px;
  height: 18px;
}

.btn-secondary {
  background: #E8F2E9;
  color: var(--forest-deep);
  border: 1.5px solid #BED7C1;
}

.btn-secondary:hover {
  background: #DCECDF;
}

.btn-ghost {
  background: transparent;
  color: var(--ink-muted);
  border: 1.5px solid #D5DFD2;
}

.btn-ghost:hover {
  background: #F1F5EF;
  color: var(--ink-primary);
}

.end-banner {
  text-align: center;
  margin-bottom: 18px;
}

.rank-pill {
  display: inline-block;
  padding: 5px 14px;
  border-radius: 999px;
  background: linear-gradient(135deg, #E2F4E6, #DCF1EE);
  border: 1.5px solid #AED7BA;
  color: var(--forest-deep);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.end-banner h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.9rem;
  font-weight: 800;
  color: var(--forest-deep);
}

.end-player-line {
  font-size: 0.94rem;
  font-weight: 600;
  color: var(--teal-main);
  margin-top: 4px;
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.result-tile {
  padding: 14px 16px;
  border-radius: 15px;
  border: 1.5px solid var(--border-natural);
  background: var(--cream-surface);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tile-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
}

.result-tile strong {
  font-size: 1.65rem;
  font-weight: 800;
  line-height: 1.15;
}

.result-tile small {
  font-size: 0.76rem;
  color: var(--ink-muted);
  font-weight: 500;
}

.tile-score {
  background: #EDF7EF;
  border-color: #BBDCC2;
}

.tile-score strong {
  color: var(--forest-main);
}

.tile-time {
  background: #EAF6F4;
  border-color: #B5DDD7;
}

.tile-time strong {
  color: var(--teal-main);
}

.tile-correct strong {
  color: var(--forest-deep);
}

.tile-wrong {
  background: #FDF0EE;
  border-color: #EBC4BD;
}

.tile-wrong strong {
  color: var(--reduce-main);
}

.end-message {
  text-align: center;
  font-size: 0.86rem;
  color: var(--ink-muted);
  line-height: 1.45;
  margin-bottom: 18px;
}

.end-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.end-actions .btn-primary {
  width: 100%;
}

.secondary-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

@media (max-width: 760px) {
  .hud-bar {
    padding: 8px 12px;
    flex-wrap: wrap;
  }

  .brand-copy h1 {
    font-size: 0.94rem;
  }

  .hud-metrics {
    width: 100%;
    justify-content: space-between;
  }

  .metric-chip {
    padding: 5px 8px;
    gap: 4px;
  }

  .trash-item {
    width: 48px;
    height: 48px;
  }

  .trash-item-art {
    width: 44px;
    height: 44px;
  }

  .bin-station {
    padding: 10px 10px 12px;
  }

  .station-pad {
    gap: 10px;
  }

  .bin-body {
    padding: 10px 10px 11px;
  }

  .bin-body h3 {
    font-size: 0.88rem;
  }

  .bin-body p {
    font-size: 0.66rem;
  }

  .mini-legend {
    grid-template-columns: 1fr;
  }

  .name-row {
    flex-direction: column;
  }

  .modal-card {
    padding: 20px;
  }
}
