﻿:root {
  --sky-top: #f2d5a8;
  --sky-bottom: #f3d3a2;
  --city-back: #d9aa96;
  --city-front: #c99188;
  --park-top: #8eca8e;
  --park-bottom: #68a979;
  --text: #243540;
  --glass: rgba(255, 255, 255, 0.22);
  --glass-line: rgba(255, 255, 255, 0.38);
}

* { box-sizing: border-box; }

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Segoe UI", system-ui, sans-serif;
}

body {
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, var(--sky-top) 0%, var(--sky-bottom) 52%, #a8d89f 100%);
}

.scene { position: fixed; inset: 0; overflow: hidden; }

.cloud {
  position: absolute;
  width: 250px;
  height: 80px;
  border-radius: 999px;
  background: rgba(255, 247, 231, 0.85);
}
.cloud::before,
.cloud::after { content: ""; position: absolute; border-radius: 999px; background: inherit; }
.cloud::before { width: 110px; height: 90px; left: 22px; top: -30px; }
.cloud::after { width: 120px; height: 75px; right: 20px; top: -18px; }
.cloud-1 { top: 95px; left: 70px; }
.cloud-2 { top: 95px; right: 90px; }

.cityline {
  position: absolute;
  left: -5%;
  right: -5%;
  border-radius: 30% 30% 0 0;
  filter: blur(2px);
}
.cityline-back {
  bottom: 36%;
  height: 34%;
  background: repeating-linear-gradient(90deg, var(--city-back) 0 90px, #cf9d8f 90px 160px, #d7a89a 160px 230px);
  clip-path: polygon(0 100%, 0 48%, 6% 54%, 10% 42%, 14% 56%, 20% 35%, 24% 58%, 31% 38%, 36% 60%, 43% 30%, 48% 56%, 55% 33%, 60% 58%, 67% 42%, 73% 60%, 80% 36%, 86% 57%, 92% 44%, 100% 53%, 100% 100%);
  opacity: 0.45;
}
.cityline-front {
  bottom: 31%;
  height: 28%;
  background: repeating-linear-gradient(90deg, var(--city-front) 0 95px, #b9827d 95px 165px, #ca958d 165px 240px);
  clip-path: polygon(0 100%, 0 52%, 8% 58%, 14% 40%, 21% 64%, 28% 34%, 35% 60%, 42% 44%, 49% 66%, 56% 36%, 63% 58%, 70% 40%, 77% 63%, 84% 34%, 92% 54%, 100% 46%, 100% 100%);
  opacity: 0.55;
}

.park {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 44%;
  background: radial-gradient(circle at 50% 12%, rgba(192, 231, 168, 0.9), transparent 54%), linear-gradient(180deg, var(--park-top), var(--park-bottom));
}

.tree { position: absolute; bottom: 17%; width: 120px; height: 220px; }
.tree::before { content: ""; position: absolute; bottom: 0; left: 52px; width: 16px; height: 70px; background: #6e5548; border-radius: 8px; }
.tree::after { content: ""; position: absolute; bottom: 58px; left: 0; width: 120px; height: 120px; background: radial-gradient(circle at 40% 40%, #68a173, #447c55); border-radius: 50%; }
.tree-1 { left: 40px; }
.tree-2 { right: 50px; }

.bush { position: absolute; bottom: -55px; height: 190px; border-radius: 50%; background: radial-gradient(circle at 50% 40%, #5f9b70, #356f4d); }
.bush-1 { left: -90px; width: 340px; }
.bush-2 { right: -110px; width: 360px; }
.bush-3 { left: 35%; width: 260px; opacity: 0.5; }

.game {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 18px;
  gap: 16px;
}

.glass-pill,
.glass-blob {
  background: var(--glass);
  border: 1px solid var(--glass-line);
  backdrop-filter: blur(12px);
  box-shadow: 0 14px 30px rgba(84, 93, 116, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.42);
}

.hud {
  width: min(760px, 96vw);
  border-radius: 999px;
  padding: 12px 18px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 14px;
}

.menu-btn {
  border: 0;
  background: transparent;
  font-size: 24px;
  color: #3a4a56;
}

.hud-progress {
  height: 12px;
  border-radius: 999px;
  background: rgba(129, 116, 101, 0.26);
  overflow: hidden;
}

.hud-progress span {
  display: block;
  height: 100%;
  width: 8%;
  background: linear-gradient(90deg, #8954df, #b986ff);
  transition: width 220ms ease;
}

.hud-stats { display: flex; gap: 16px; font-size: 20px; color: #2e3b43; align-items: center; }
.hud-stats strong { font-size: 38px; line-height: 1; }
.hud-stats strong span { font-size: 42px; }
.hud-stats > span { font-size: 28px; }

.board {
  width: min(860px, 96vw);
  border-radius: 42px 56px 46px 58px / 46px 34px 54px 36px;
  padding: 24px 24px 20px;
  color: var(--text);
}

.board h1 { margin: 0 0 16px; text-align: center; font-size: clamp(30px, 4vw, 48px); }

.zones {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.zone {
  border: 2px solid rgba(255, 255, 255, 0.6);
  background: rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  min-height: 128px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 6px;
  color: #2d3a42;
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}

.zone:hover { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(89, 95, 113, 0.22); }
.zone.over { border-color: #ffffff; box-shadow: 0 0 0 4px rgba(255,255,255,0.25); }
.zone.ok { animation: glowOk 280ms ease; }
.zone.bad { animation: shake 280ms ease; }

.zone-icon { font-size: 36px; }
.zone-name { font-size: 27px; font-weight: 600; }

.item-stage {
  margin-top: 20px;
  min-height: 200px;
  display: grid;
  place-items: center;
}

.item-card {
  width: min(220px, 70vw);
  border-radius: 24px;
  border: 1px solid rgba(255,255,255,0.65);
  background: rgba(255, 255, 255, 0.65);
  box-shadow: 0 16px 26px rgba(78, 83, 98, 0.25);
  display: grid;
  place-items: center;
  gap: 8px;
  padding: 14px;
  cursor: grab;
  touch-action: none;
  transition: transform 180ms ease, opacity 160ms ease;
}

.item-card.dragging { opacity: 0.55; transform: scale(0.96); }
.item-card.done { transform: scale(0.75) translateY(18px); opacity: 0; }

.item-emoji { font-size: 72px; }
.item-name { margin: 0; font-size: 26px; text-align: center; }

.feedback {
  margin: 10px 0 8px;
  text-align: center;
  font-size: 24px;
  font-weight: 600;
  min-height: 32px;
}

.finish-btn {
  display: block;
  margin: 0 auto;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: #2f3a42;
  font-weight: 600;
  padding: 12px 30px;
  font-size: 24px;
}

.result-modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(20, 24, 28, 0.38);
  backdrop-filter: blur(4px);
  z-index: 20;
}

.result-modal.hidden { display: none; }

.result-card {
  border-radius: 24px;
  padding: 20px;
  min-width: min(420px, 90vw);
  text-align: center;
  color: #2d3a42;
}

@keyframes glowOk {
  0% { transform: scale(1); }
  40% { transform: scale(1.04); box-shadow: 0 0 0 4px rgba(125, 255, 188, 0.3); }
  100% { transform: scale(1); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  50% { transform: translateX(4px); }
  75% { transform: translateX(-3px); }
}

@media (max-width: 920px) {
  .hud { grid-template-columns: 1fr; }
  .hud-stats { grid-column: 1 / -1; justify-content: center; }
  .zones { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 520px) {
  .board { padding: 18px 14px; }
  .zone-name { font-size: 20px; }
  .feedback { font-size: 18px; }
  .finish-btn { font-size: 18px; }
  .hud-stats strong { font-size: 28px; }
  .hud-stats strong span { font-size: 32px; }
  .hud-stats > span { font-size: 20px; }
}

/* Paleta de reciclaje adaptada a glassmorphism */
.zone[data-type="papel"] {
  border-color: rgba(117, 220, 255, 0.85);
  background: radial-gradient(circle at 30% 20%, rgba(146, 229, 255, 0.5), rgba(83, 198, 244, 0.18));
  box-shadow: inset 0 0 24px rgba(117, 220, 255, 0.22);
}

.zone[data-type="vidrio"] {
  border-color: rgba(128, 241, 205, 0.88);
  background: radial-gradient(circle at 30% 20%, rgba(166, 250, 226, 0.52), rgba(103, 222, 183, 0.18));
  box-shadow: inset 0 0 24px rgba(128, 241, 205, 0.22);
}

.zone[data-type="plastico"] {
  border-color: rgba(255, 230, 126, 0.9);
  background: radial-gradient(circle at 30% 20%, rgba(255, 241, 167, 0.56), rgba(255, 219, 91, 0.2));
  box-shadow: inset 0 0 24px rgba(255, 230, 126, 0.22);
}

.zone[data-type="organico"] {
  border-color: rgba(199, 243, 147, 0.9);
  background: radial-gradient(circle at 30% 20%, rgba(218, 250, 181, 0.54), rgba(171, 224, 120, 0.2));
  box-shadow: inset 0 0 24px rgba(199, 243, 147, 0.2);
}

.zone .zone-icon {
  filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.35));
}

/* Hover al arrastrar: receptor listo */
.zone.over {
  border-color: rgba(255, 255, 255, 0.95);
  box-shadow:
    0 0 0 3px rgba(255, 255, 255, 0.24),
    0 0 22px rgba(167, 234, 255, 0.42),
    inset 0 0 14px rgba(255, 255, 255, 0.22);
  transform: translateY(-2px) scale(1.015);
}

/* Feedback avanzado: acierto y fallo */
.zone {
  position: relative;
}

.zone::after {
  content: "";
  position: absolute;
  top: 8px;
  right: 12px;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: rgba(39, 187, 96, 0.92);
  color: #ffffff;
  font-weight: 800;
  font-size: 16px;
  line-height: 26px;
  text-align: center;
  opacity: 0;
  transform: scale(0.6);
  pointer-events: none;
  display: none;
}

.zone.ok {
  animation: zonePulse 420ms ease;
}

.zone.ok::after {
  display: none;
}

.zone.bad {
  animation: zoneError 420ms ease;
}

.item-card.error-bounce {
  animation: itemBounceBack 520ms ease;
}

@keyframes zonePulse {
  0% { box-shadow: 0 0 0 0 rgba(85, 231, 171, 0.0); }
  45% { box-shadow: 0 0 0 8px rgba(85, 231, 171, 0.26), 0 0 24px rgba(85, 231, 171, 0.34); }
  100% { box-shadow: 0 0 0 0 rgba(85, 231, 171, 0.0); }
}

@keyframes checkPop {
  0% { opacity: 0; transform: scale(0.5); }
  35% { opacity: 1; transform: scale(1.08); }
  100% { opacity: 0; transform: scale(0.88); }
}

@keyframes zoneError {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 120, 128, 0); }
  30% { box-shadow: 0 0 0 7px rgba(255, 120, 128, 0.26), 0 0 22px rgba(255, 120, 128, 0.28); }
  55% { box-shadow: 0 0 0 3px rgba(255, 120, 128, 0.18); }
}

@keyframes itemBounceBack {
  0% { transform: translate(0, 0) rotate(0deg); }
  30% { transform: translate(18px, -8px) rotate(7deg); }
  55% { transform: translate(-8px, 5px) rotate(-4deg); }
  100% { transform: translate(0, 0) rotate(0deg); }
}


.item-image {
  width: 84px;
  height: 84px;
  object-fit: contain;
  filter: drop-shadow(0 14px 10px rgba(0,0,0,0.22));
  user-select: none;
  pointer-events: none;
}
.drag-image-ghost {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 12000;
  pointer-events: none;
  user-select: none;
  object-fit: contain;
  filter: drop-shadow(0 14px 12px rgba(0,0,0,0.28));
  will-change: transform;
}



.item-card.error-bounce {
  animation: itemBounceBack 520ms ease;
}

@keyframes itemBounceBack {
  0% { transform: translate(0, 0) rotate(0deg); }
  30% { transform: translate(18px, -8px) rotate(7deg); }
  55% { transform: translate(-8px, 5px) rotate(-4deg); }
  100% { transform: translate(0, 0) rotate(0deg); }
}

/* Efectos de feedback: partículas, choque y puff */
.item-card.crash {
  animation: itemCrash 280ms ease;
}

.particle-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 60;
}

.particle {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  opacity: 0.95;
  box-shadow: 0 0 10px currentColor;
  animation: particleFly 620ms ease-out forwards;
}

.puff {
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(255,255,255,0.75), rgba(196,206,216,0.25) 65%, transparent 75%);
  filter: blur(0.5px);
  pointer-events: none;
  animation: puffOut 420ms ease-out forwards;
}

@keyframes itemCrash {
  0% { transform: translate(0, 0) scale(1); }
  35% { transform: translate(16px, -2px) scale(0.98); }
  70% { transform: translate(-6px, 2px) scale(1.01); }
  100% { transform: translate(0, 0) scale(1); }
}

@keyframes particleFly {
  0% { transform: translate(0,0) scale(1); opacity: 0.95; }
  100% { transform: translate(var(--dx), var(--dy)) scale(0.2); opacity: 0; }
}

@keyframes puffOut {
  0% { transform: translate(-50%, -50%) scale(0.5); opacity: 0.7; }
  100% { transform: translate(-50%, -50%) scale(2.2); opacity: 0; }
}

.streak-star {
  position: absolute;
  color: #fff5a8;
  font-size: 16px;
  line-height: 1;
  text-shadow: 0 0 10px rgba(255, 243, 148, 0.65);
  animation: streakSpark 560ms ease-out forwards;
}

.score-float {
  position: absolute;
  transform: translate(-50%, 0);
  font-size: 24px;
  font-weight: 900;
  letter-spacing: 0.3px;
  color: #4ade80;
  text-shadow: 0 0 10px rgba(74, 222, 128, 0.85), 0 2px 6px rgba(31, 39, 52, 0.35);
  pointer-events: none;
  z-index: 10000;
  animation: scoreFloatUp 780ms ease-out forwards;
}

@keyframes streakSpark {
  0% { transform: translate(0, 0) scale(0.7); opacity: 0.95; }
  100% { transform: translate(var(--dx), var(--dy)) scale(0.2); opacity: 0; }
}

@keyframes scoreFloatUp {
  0% {
    opacity: 0;
    transform: translate(-50%, 8px) scale(0.9);
  }
  18% {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -28px) scale(1.05);
  }
}

/* Refuerzo visual de particulas */
.particle-layer {
  z-index: 9999;
}

.particle {
  width: 12px;
  height: 12px;
  box-shadow: 0 0 14px currentColor, 0 0 24px currentColor;
}

.streak-star {
  font-size: 22px;
  text-shadow: 0 0 14px rgba(255, 243, 148, 0.95), 0 0 26px rgba(255, 214, 96, 0.7);
}

.fx-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 45;
}



/* Mobile tuning */
.zone::after {
  content: '';
  display: none;
}

@media (max-width: 768px) {
  html, body {
    min-height: 100dvh;
  }

  body {
    overflow: auto;
  }

  .scene {
    position: fixed;
  }

  .game {
    min-height: 100dvh;
    justify-content: flex-start;
    padding: 12px;
    gap: 10px;
  }

  .hud {
    width: 100%;
    padding: 10px 12px;
    gap: 10px;
  }

  .hud-progress {
    height: 10px;
  }

  .hud-stats {
    justify-content: space-between;
    width: 100%;
    gap: 10px;
    font-size: 14px;
  }

  .hud-stats strong {
    font-size: 20px;
  }

  .hud-stats strong span {
    font-size: 24px;
  }

  .hud-stats > span {
    font-size: 16px;
  }

  .board {
    width: 100%;
    padding: 14px 12px 16px;
    border-radius: 24px;
  }

  .board h1 {
    margin-bottom: 10px;
    font-size: 30px;
    line-height: 1.1;
  }

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

  .zone {
    min-height: 92px;
    border-radius: 22px;
    gap: 2px;
  }

  .zone-icon {
    font-size: 24px;
  }

  .zone-name {
    font-size: 16px;
  }

  .item-stage {
    margin-top: 12px;
    min-height: 150px;
  }

  .item-card {
    width: min(170px, 64vw);
    padding: 8px;
    border-radius: 16px;
    gap: 4px;
  }

  .item-media {
    width: 78px;
    height: 78px;
    border-radius: 14px;
    display: grid;
    place-items: center;
  }

  .item-image {
    width: 18px;
    height: 18px;
    display: block;
    margin: 0 auto;
    object-position: center center;
    justify-self: center;
    align-self: center;
  }

  .item-name {
    font-size: 15px;
    line-height: 1.1;
  }

  .feedback {
    font-size: 16px;
    min-height: 24px;
    margin-top: 8px;
  }

  .result-card {
    min-width: min(360px, 92vw);
    padding: 16px;
  }
}

@media (max-width: 420px) {
  .board h1 {
    font-size: 26px;
  }

  .zone {
    min-height: 84px;
  }

  .item-card {
    width: min(152px, 64vw);
    padding: 6px;
    gap: 3px;
  }

  .item-image {
    width: 16px;
    height: 16px;
    display: block;
    margin: 0 auto;
    object-position: center center;
    justify-self: center;
    align-self: center;
  }

  .item-media {
    width: 70px;
    height: 70px;
    border-radius: 12px;
  }

  .item-name {
    font-size: 13px;
  }

  .item-name {
    font-size: 16px;
  }
}

/* Visual polish v2 */
:root {
  --accent-cyan: #7ee8ff;
  --accent-violet: #9e7dff;
  --panel-tint: rgba(255, 255, 255, 0.28);
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(900px 420px at 18% 20%, rgba(255,255,255,0.18), transparent 65%),
    radial-gradient(700px 380px at 82% 16%, rgba(255,255,255,0.12), transparent 65%),
    linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0));
  z-index: 1;
}

.game {
  gap: 14px;
}

.hud {
  background: linear-gradient(135deg, rgba(255,255,255,0.34), rgba(255,255,255,0.18));
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 16px 32px rgba(66, 63, 95, 0.24), inset 0 1px 0 rgba(255,255,255,0.55);
}

.hud-progress {
  background: rgba(68, 74, 83, 0.22);
  border: 1px solid rgba(255,255,255,0.3);
}

.hud-progress span {
  background: linear-gradient(90deg, var(--accent-violet), var(--accent-cyan));
  box-shadow: 0 0 16px rgba(151, 126, 255, 0.55);
}

.hud-stats {
  color: #24323b;
  text-shadow: 0 1px 0 rgba(255,255,255,0.35);
}

.board {
  background: linear-gradient(145deg, rgba(255,255,255,0.33), rgba(255,255,255,0.18));
  border: 1px solid rgba(255,255,255,0.45);
  box-shadow: 0 22px 42px rgba(58, 62, 84, 0.22), inset 0 1px 0 rgba(255,255,255,0.52);
}

.board h1 {
  letter-spacing: 0.2px;
  color: #17232d;
  text-shadow: 0 2px 0 rgba(255,255,255,0.28);
}

.zones {
  gap: 12px;
}

.zone {
  border-width: 2px;
  border-color: rgba(255,255,255,0.72);
  box-shadow: 0 10px 20px rgba(55, 61, 74, 0.18), inset 0 1px 0 rgba(255,255,255,0.35);
  transition: transform 140ms ease, box-shadow 160ms ease, filter 160ms ease;
}

.zone:hover {
  transform: translateY(-3px) scale(1.015);
  filter: saturate(1.08);
}

.zone-icon {
  font-size: clamp(30px, 2.8vw, 42px);
}

.zone-name {
  font-size: clamp(17px, 1.7vw, 24px);
}

.item-card {
  background: linear-gradient(160deg, rgba(255,255,255,0.78), rgba(255,255,255,0.58));
  border: 1px solid rgba(255,255,255,0.82);
  box-shadow: 0 18px 30px rgba(63, 67, 83, 0.26), inset 0 1px 0 rgba(255,255,255,0.68);
}


.item-image {
  width: 84px;
  height: 84px;
  object-fit: contain;
  filter: drop-shadow(0 14px 10px rgba(0,0,0,0.22));
  user-select: none;
  pointer-events: none;
}
.drag-image-ghost {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 12000;
  pointer-events: none;
  user-select: none;
  object-fit: contain;
  filter: drop-shadow(0 14px 12px rgba(0,0,0,0.28));
  will-change: transform;
}



.feedback {
  color: #1f2f39;
  text-shadow: 0 1px 0 rgba(255,255,255,0.36);
}

.result-card {
  background: linear-gradient(160deg, rgba(255,255,255,0.78), rgba(255,255,255,0.58));
  border: 1px solid rgba(255,255,255,0.78);
  box-shadow: 0 20px 34px rgba(55, 61, 75, 0.3);
}

.finish-btn {
  background: linear-gradient(90deg, #ffffff, #f3f7ff);
  box-shadow: 0 10px 20px rgba(68, 72, 91, 0.22);
}

.finish-btn:hover {
  transform: translateY(-1px);
}

@media (max-width: 768px) {
  .hud {
    border-radius: 20px;
  }

  .board {
    border-radius: 22px;
  }

  .zone {
    box-shadow: 0 8px 16px rgba(55, 61, 74, 0.16);
  }
}


/* Educational feedback + summary */
.hint-card {
  margin: 8px auto 0;
  max-width: min(680px, 92%);
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.6);
  background: linear-gradient(145deg, rgba(255,255,255,0.78), rgba(255,255,255,0.58));
  color: #233540;
  font-weight: 600;
  text-align: center;
  box-shadow: 0 10px 20px rgba(52, 58, 72, 0.18);
}

.hint-card.hidden {
  display: none;
}

.result-actions {
  margin-top: 12px;
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.final-message {
  margin: 8px 0 0;
  color: #233a47;
  font-weight: 600;
}

.finish-btn-secondary {
  background: linear-gradient(90deg, #e6edf8, #dbe7f7);
}

@media (max-width: 768px) {
  .hint-card {
    font-size: 14px;
    padding: 9px 11px;
  }

  .result-actions {
    flex-direction: column;
    align-items: center;
  }

  .result-actions .finish-btn {
    width: min(260px, 90%);
  }
}

/* Result modal modern */
.result-modal {
  backdrop-filter: blur(8px);
  background: rgba(15, 20, 31, 0.45);
}

.result-card {
  position: relative;
  max-width: min(520px, 92vw);
  border-radius: 26px;
  padding: 22px 20px 18px;
  background: linear-gradient(160deg, rgba(255,255,255,0.9), rgba(242,248,255,0.72));
  border: 1px solid rgba(255,255,255,0.85);
  box-shadow: 0 26px 40px rgba(19, 31, 53, 0.28), inset 0 1px 0 rgba(255,255,255,0.92);
  animation: modalRise 180ms ease;
}

.result-badge {
  width: 54px;
  height: 54px;
  margin: 0 auto 8px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 24px;
  background: linear-gradient(140deg, rgba(133,238,255,0.9), rgba(160,143,255,0.9));
  color: #0f2b3b;
  box-shadow: 0 8px 16px rgba(66, 104, 162, 0.28);
}

.result-card h2 {
  margin: 2px 0 12px;
  text-align: center;
  color: #1d3140;
  font-size: 30px;
}

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

.result-item {
  padding: 10px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.75);
  background: linear-gradient(140deg, rgba(255,255,255,0.72), rgba(235,243,255,0.58));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.6);
  text-align: center;
}

.result-item span {
  display: block;
  font-size: 13px;
  color: #4e5f6e;
}

.result-item strong {
  display: block;
  margin-top: 4px;
  font-size: 24px;
  color: #132838;
}

.result-rewards {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.78);
  background: linear-gradient(130deg, rgba(151, 126, 255, 0.2), rgba(126, 232, 255, 0.2));
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.result-rewards span {
  font-size: 13px;
  color: #3d4f5f;
}

.result-rewards strong {
  font-size: 18px;
  color: #1a3040;
}

.final-message {
  margin-top: 12px;
  text-align: center;
  font-size: 15px;
  line-height: 1.35;
}

.result-actions {
  margin-top: 12px;
}

.result-actions .finish-btn {
  min-width: 170px;
}

@keyframes modalRise {
  from { transform: translateY(8px) scale(0.985); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

@media (max-width: 520px) {
  .result-card {
    padding: 16px 14px 14px;
    border-radius: 18px;
  }

  .result-card h2 {
    font-size: 24px;
  }

  .result-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .result-item strong {
    font-size: 20px;
  }

  .result-rewards {
    gap: 8px;
  }

  .result-rewards strong {
    font-size: 16px;
  }
}

/* Result modal match reference */
.result-modal {
  background: rgba(15, 20, 31, 0.34);
  backdrop-filter: blur(6px);
}

.result-card {
  max-width: min(820px, 94vw);
  border-radius: 34px;
  padding: 26px 30px 24px;
  background: linear-gradient(180deg, rgba(245,247,251,0.97), rgba(237,240,246,0.93));
  border: 1px solid rgba(255,255,255,0.92);
  box-shadow: 0 34px 50px rgba(17, 30, 53, 0.28), inset 0 1px 0 rgba(255,255,255,0.96);
}

.result-badge {
  width: 56px;
  height: 56px;
  border-radius: 999px;
  background: linear-gradient(160deg, #45d172, #2ebc5e);
  color: #fff;
  font-size: 34px;
  font-weight: 800;
  box-shadow: 0 10px 20px rgba(45, 190, 97, 0.34);
}

.result-card h2 {
  margin: -50px 0 6px 70px;
  text-align: left;
  font-size: clamp(34px, 4.2vw, 54px);
  color: #213345;
}

.result-grid {
  margin-top: 14px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.result-item {
  min-height: 68px;
  padding: 12px 14px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255,255,255,0.78), rgba(243,245,250,0.8));
  border: 1px solid rgba(214,220,231,0.95);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.result-item span {
  display: inline;
  font-size: clamp(22px, 2.5vw, 38px);
  font-weight: 700;
  color: #25384a;
}

.result-item strong {
  margin: 0;
  display: inline;
  font-size: clamp(22px, 2.5vw, 38px);
  color: #1d2f41;
}

.result-item:nth-child(1)::before,
.result-item:nth-child(2)::before,
.result-item:nth-child(3)::before {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 20px;
  font-weight: 800;
  box-shadow: 0 6px 12px rgba(0,0,0,0.18);
}

.result-item:nth-child(1)::before { content: '\2713'; background: linear-gradient(145deg,#45d173,#2ebc5e); }
.result-item:nth-child(2)::before { content: '\00D7'; background: linear-gradient(145deg,#ff7b6b,#ef5a4f); }
.result-item:nth-child(3)::before { content: '\1F525'; background: linear-gradient(145deg,#f5c24f,#e4a83b); }

.result-rewards {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(214,220,231,0.95);
  background: linear-gradient(180deg, rgba(255,255,255,0.83), rgba(243,246,251,0.8));
  justify-content: center;
  gap: 12px;
}

.result-rewards span {
  font-size: clamp(20px, 2.2vw, 34px);
  color: #25374a;
  font-weight: 700;
}

.result-rewards strong {
  border-radius: 999px;
  padding: 6px 14px;
  border: 1px solid rgba(212,220,233,0.95);
  background: linear-gradient(180deg, rgba(245,248,253,0.95), rgba(231,236,245,0.95));
  font-size: clamp(22px, 2.3vw, 34px);
}

#finalXp::before { content: '\26A1\00A0'; }
#finalCoins::before { content: '\1FA99\00A0'; }

.final-message {
  margin-top: 10px;
  font-size: clamp(22px, 2.1vw, 32px);
  color: #4a5a6b;
}

.result-actions {
  margin-top: 14px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.result-actions .finish-btn {
  min-width: 0;
  width: 100%;
  border-radius: 999px;
  font-size: clamp(20px, 2.2vw, 34px);
  padding: 12px 20px;
  font-weight: 700;
}

.result-actions .finish-btn {
  background: linear-gradient(180deg, #5d8ef2, #446fd4);
  color: #fff;
}

.result-actions .finish-btn-secondary {
  background: linear-gradient(180deg, rgba(255,255,255,0.94), rgba(243,246,251,0.94));
  color: #223547;
}

@media (max-width: 820px) {
  .result-card h2 {
    margin: -48px 0 8px 64px;
    font-size: 38px;
  }

  .result-grid {
    grid-template-columns: 1fr;
  }

  .result-actions {
    grid-template-columns: 1fr;
  }

  .final-message {
    font-size: 16px;
  }
}

/* Result layout tweak */
.result-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-bottom: 4px;
}

.result-header .result-badge {
  margin: 0;
  flex-shrink: 0;
}

.result-header h2 {
  margin: 0;
  text-align: left;
}

.result-score {
  text-align: center;
  margin: 8px 0 10px;
}

.result-score strong {
  display: block;
  font-size: clamp(56px, 8vw, 86px);
  line-height: 0.95;
  color: #19344a;
}

.result-score span {
  display: block;
  margin-top: 8px;
  font-size: clamp(18px, 2vw, 30px);
  color: #506173;
}

.result-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.result-item::before {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 20px;
  font-weight: 800;
  box-shadow: 0 6px 12px rgba(0,0,0,0.18);
}

.result-item-correct::before { content: '\2713'; background: linear-gradient(145deg,#45d173,#2ebc5e); }
.result-item-wrong::before { content: '\00D7'; background: linear-gradient(145deg,#ff7b6b,#ef5a4f); }
.result-item-streak::before { content: '\1F525'; background: linear-gradient(145deg,#f5c24f,#e4a83b); }

@media (max-width: 820px) {
  .result-header {
    justify-content: flex-start;
  }

  .result-grid {
    grid-template-columns: 1fr;
  }
}

/* Mobile modal fix v20260310 */
@media (max-width: 768px) {
  .result-modal {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 12px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .result-card {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    border-radius: 18px;
    padding: 14px 12px 12px;
    max-height: calc(100dvh - 24px);
    overflow-y: auto;
  }

  .result-header {
    gap: 10px;
    justify-content: flex-start;
    align-items: center;
  }

  .result-header .result-badge {
    width: 40px;
    height: 40px;
    font-size: 22px;
  }

  .result-header h2 {
    margin: 0;
    font-size: 22px;
    line-height: 1.15;
    text-align: left;
  }

  .result-score {
    margin: 8px 0;
    text-align: left;
  }

  .result-score strong {
    font-size: 42px;
    line-height: 1;
  }

  .result-score span {
    margin-top: 4px;
    font-size: 14px;
  }

  .result-grid {
    margin-top: 8px;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .result-item {
    min-height: auto;
    padding: 10px;
  }

  .result-item span,
  .result-item strong {
    font-size: 18px;
  }

  .result-rewards {
    margin-top: 10px;
    padding: 10px;
    justify-content: flex-start;
    gap: 8px;
  }

  .result-rewards span {
    font-size: 14px;
  }

  .result-rewards strong {
    font-size: 15px;
    padding: 5px 10px;
  }

  .final-message {
    margin-top: 10px;
    font-size: 14px;
    line-height: 1.35;
  }

  .result-actions {
    margin-top: 10px;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .result-actions .finish-btn {
    width: 100%;
    font-size: 16px;
    padding: 10px 14px;
  }
}

@media (max-width: 420px) {
  .result-modal {
    padding: 8px;
  }

  .result-card {
    border-radius: 16px;
    padding: 12px 10px 10px;
    max-height: calc(100dvh - 16px);
  }

  .result-header h2 {
    font-size: 20px;
  }

  .result-score strong {
    font-size: 36px;
  }

  .result-item span,
  .result-item strong {
    font-size: 16px;
  }
}

/* Mobile modal compact fix v20260310b */
@media (max-width: 768px) {
  .result-card {
    padding: 10px 9px 9px;
    border-radius: 14px;
    max-height: calc(100dvh - 18px);
  }

  .result-header {
    gap: 8px;
    margin-bottom: 2px;
  }

  .result-header .result-badge {
    width: 32px;
    height: 32px;
    font-size: 18px;
  }

  .result-header h2 {
    font-size: 16px;
    line-height: 1.1;
  }

  .result-score {
    margin: 4px 0 6px;
  }

  .result-score strong {
    font-size: 32px;
  }

  .result-score span {
    font-size: 12px;
    margin-top: 2px;
  }

  .result-grid {
    margin-top: 4px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .result-item {
    padding: 7px 6px;
    border-radius: 10px;
    gap: 4px;
  }

  .result-item::before {
    width: 20px;
    height: 20px;
    font-size: 12px;
    box-shadow: 0 3px 6px rgba(0,0,0,0.14);
  }

  .result-item span,
  .result-item strong {
    font-size: 12px;
    line-height: 1.05;
  }

  .result-rewards {
    margin-top: 6px;
    padding: 7px;
    border-radius: 10px;
    gap: 6px;
  }

  .result-rewards span {
    font-size: 12px;
  }

  .result-rewards strong {
    font-size: 12px;
    padding: 3px 8px;
  }

  .final-message {
    margin-top: 6px;
    font-size: 12px;
    line-height: 1.25;
  }

  .result-actions {
    margin-top: 7px;
    gap: 7px;
  }

  .result-actions .finish-btn {
    font-size: 13px;
    padding: 8px 10px;
    border-radius: 999px;
  }
}

@media (max-width: 420px) {
  .result-modal {
    padding: 6px;
  }

  .result-card {
    padding: 9px 8px 8px;
    border-radius: 12px;
    max-height: calc(100dvh - 12px);
  }

  .result-header h2 {
    font-size: 15px;
  }

  .result-score strong {
    font-size: 28px;
  }

  .result-item span,
  .result-item strong,
  .result-rewards span,
  .result-rewards strong {
    font-size: 11px;
  }

  .result-actions .finish-btn {
    font-size: 12px;
    padding: 7px 9px;
  }
}

/* Mobile modal ultra-compact v20260310c */
@media (max-width: 768px) {
  .result-modal {
    padding: 4px;
  }

  .result-card {
    padding: 8px 7px 7px;
    border-radius: 10px;
    max-height: calc(100dvh - 8px);
  }

  .result-header {
    gap: 6px;
    margin-bottom: 0;
  }

  .result-header .result-badge {
    width: 26px;
    height: 26px;
    font-size: 14px;
  }

  .result-header h2 {
    font-size: 14px;
    line-height: 1.05;
  }

  .result-score {
    margin: 2px 0 4px;
  }

  .result-score strong {
    font-size: 24px;
  }

  .result-score span {
    font-size: 11px;
    margin-top: 1px;
  }

  .result-grid {
    margin-top: 3px;
    gap: 4px;
  }

  .result-item {
    padding: 5px;
    border-radius: 8px;
    min-height: 0;
    gap: 3px;
  }

  .result-item::before {
    width: 16px;
    height: 16px;
    font-size: 10px;
    box-shadow: none;
  }

  .result-item span,
  .result-item strong {
    font-size: 10px;
    line-height: 1;
  }

  .result-rewards {
    margin-top: 4px;
    padding: 5px;
    border-radius: 8px;
    gap: 4px;
  }

  .result-rewards span,
  .result-rewards strong {
    font-size: 10px;
    padding: 2px 6px;
  }

  .final-message {
    margin-top: 4px;
    font-size: 10px;
    line-height: 1.15;
  }

  .result-actions {
    margin-top: 5px;
    gap: 5px;
  }

  .result-actions .finish-btn {
    font-size: 11px;
    padding: 6px 8px;
  }
}

@media (max-width: 420px) {
  .result-card {
    padding: 7px 6px 6px;
    max-height: calc(100dvh - 6px);
  }

  .result-header h2 {
    font-size: 13px;
  }

  .result-score strong {
    font-size: 22px;
  }

  .result-item span,
  .result-item strong,
  .result-rewards span,
  .result-rewards strong,
  .final-message {
    font-size: 9px;
  }

  .result-actions .finish-btn {
    font-size: 10px;
    padding: 6px 7px;
  }
}

/* Mobile modal balanced v20260310d */
@media (max-width: 768px) {
  .result-modal {
    padding: 8px;
  }

  .result-card {
    padding: 14px 12px 12px;
    border-radius: 16px;
    max-height: calc(100dvh - 16px);
  }

  .result-header {
    gap: 8px;
    margin-bottom: 4px;
  }

  .result-header .result-badge {
    width: 36px;
    height: 36px;
    font-size: 20px;
  }

  .result-header h2 {
    font-size: 32px;
    line-height: 1.05;
  }

  .result-score {
    margin: 4px 0 8px;
    text-align: left;
  }

  .result-score strong {
    font-size: 48px;
    line-height: 0.95;
  }

  .result-score span {
    font-size: 24px;
    margin-top: 4px;
  }

  .result-grid {
    margin-top: 6px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .result-item {
    padding: 8px 7px;
    border-radius: 10px;
    gap: 5px;
  }

  .result-item::before {
    width: 22px;
    height: 22px;
    font-size: 13px;
  }

  .result-item span,
  .result-item strong {
    font-size: 13px;
    line-height: 1.1;
  }

  .result-rewards {
    margin-top: 8px;
    padding: 8px;
    border-radius: 10px;
    gap: 6px;
  }

  .result-rewards span,
  .result-rewards strong {
    font-size: 13px;
    padding: 3px 8px;
  }

  .final-message {
    margin-top: 8px;
    font-size: 12px;
    line-height: 1.25;
  }

  .result-actions {
    margin-top: 8px;
    gap: 8px;
  }

  .result-actions .finish-btn {
    font-size: 15px;
    padding: 8px 10px;
  }
}

@media (max-width: 420px) {
  .result-card {
    padding: 12px 10px 10px;
  }

  .result-header h2 {
    font-size: 28px;
  }

  .result-score strong {
    font-size: 42px;
  }

  .result-score span {
    font-size: 20px;
  }

  .result-item span,
  .result-item strong,
  .result-rewards span,
  .result-rewards strong {
    font-size: 12px;
  }

  .result-actions .finish-btn {
    font-size: 14px;
  }
}

/* Mobile name-safe override */
@media (max-width: 768px) {
  .item-media {
    width: 82px !important;
    height: 82px !important;
    overflow: hidden;
    display: grid;
    place-items: center;
  }

  .item-image {
    width: 60px !important;
    height: 60px !important;
    max-width: 60px !important;
    max-height: 60px !important;
    object-fit: contain;
  }

  .item-name {
    margin-top: 4px;
    min-height: 18px;
    line-height: 1.1;
    position: relative;
    z-index: 2;
  }
}

@media (max-width: 420px) {
  .item-media {
    width: 74px !important;
    height: 74px !important;
  }

  .item-image {
    width: 60px !important;
    height: 60px !important;
    max-width: 60px !important;
    max-height: 60px !important;
  }
}













