* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; font-family: system-ui, "Segoe UI", Tahoma, Arial, sans-serif; background: #dde3ea; }

/* ---------- Fixed HUD ---------- */
#hudBar {
  position: fixed; top: 0; left: 0; right: 0; height: 72px; z-index: 50;
  display: none; align-items: center; justify-content: space-between;
  background: #26527E; color: #fff; padding: 0 18px;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.hud-left { display: flex; flex-direction: column; gap: 2px; }
#hudTitle { font-weight: 700; font-size: 15px; }
.hud-find { font-size: 13px; color: #cfe0f2; }
.hud-center { text-align: center; }
.hud-time-label { font-size: 10px; color: #9fc0e0; letter-spacing: 1px; }
#hudTimer { font-size: 30px; font-weight: 800; color: #ffd24d; line-height: 1; }
.hud-right { text-align: right; min-width: 130px; }
.hud-bal-label { font-size: 10px; color: #9fc0e0; letter-spacing: 1px; }
.hud-money-wrap { display: flex; align-items: baseline; gap: 8px; justify-content: flex-end; }
#hudMoney { font-size: 26px; font-weight: 800; color: #7CFC9A; }
#hudDelta { font-size: 15px; font-weight: 700; opacity: 0; transition: opacity .2s; }

/* ---------- Scene ---------- */
#scene { padding-top: 88px; padding-bottom: 60px; min-height: 100vh; }
#scene canvas { cursor: crosshair; border-radius: 4px; box-shadow: 0 2px 10px rgba(0,0,0,.12); }

/* ---------- Overlay (intro / SAM / rest / done) ---------- */
#overlay {
  position: fixed; inset: 0; z-index: 100; display: none;
  align-items: center; justify-content: center;
  background: rgba(20,30,45,.86); backdrop-filter: blur(2px);
}
.card {
  background: #fff; border-radius: 14px; padding: 30px 34px; max-width: 540px; width: 90%;
  text-align: center; box-shadow: 0 10px 40px rgba(0,0,0,.35);
}
.card .q { font-size: 18px; color: #223; margin: 14px 0 10px; font-weight: 600; }
.card input {
  font-size: 16px; padding: 11px 14px; width: 80%; border: 2px solid #cbd4e0; border-radius: 8px; margin: 8px 0;
}
.card .btn {
  margin-top: 18px; background: #26527E; color: #fff; border: none; border-radius: 9px;
  font-size: 17px; font-weight: 700; padding: 12px 30px; cursor: pointer;
}
.card .btn:disabled { background: #9fb0c4; cursor: default; }
.langs { display: flex; gap: 8px; justify-content: center; margin: 10px 0; }
.langs button {
  border: 2px solid #26527E; background: #fff; color: #26527E; border-radius: 8px;
  padding: 8px 16px; font-size: 15px; cursor: pointer;
}
.big { font-size: 30px; font-weight: 800; color: #26527E; margin-top: 10px; }

/* SAM scales */
.scale { display: flex; align-items: center; gap: 6px; justify-content: center; flex-wrap: wrap; margin-bottom: 6px; }
.scale .lab { font-size: 12px; color: #667; width: 70px; }
.scale button {
  width: 34px; height: 34px; border-radius: 50%; border: 2px solid #c2cdda; background: #f4f7fb;
  font-weight: 700; color: #345; cursor: pointer;
}
.scale button.sel { background: #26527E; color: #fff; border-color: #26527E; }

/* ---------- Object-list tray (bottom, fixed) ---------- */
#tray {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  display: none; flex-wrap: wrap; gap: 8px 10px; padding: 8px 16px;
  max-height: 168px; overflow-y: auto;
  background: rgba(20,30,45,.94); box-shadow: 0 -2px 10px rgba(0,0,0,.3);
  justify-content: center; align-content: flex-start;
}
.tray-item {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  min-width: 64px; max-width: 84px; padding: 5px 7px; border-radius: 8px;
  background: rgba(255,255,255,.1); color: #fff; font-size: 11px;
  transition: opacity .3s;
}
.tray-item img { width: 36px; height: 36px; object-fit: contain; }
.tray-item.found { opacity: .35; text-decoration: line-through; }
.tray-item.found::after { content: " ✓"; color: #7CFC9A; }
/* leave room above the tray so it doesn't cover the bottom of the scene */
#scene { padding-bottom: 180px; }

/* ---------- Toast (correct/wrong feedback) ---------- */
#toast {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%);
  z-index: 200; padding: 16px 34px; border-radius: 12px;
  color: #fff; font-size: 22px; font-weight: 800;
  opacity: 0; transition: opacity .25s; pointer-events: none;
  box-shadow: 0 6px 24px rgba(0,0,0,.4);
}

/* ---------- Level 2 end summary ---------- */
.summary { width: 100%; border-collapse: collapse; margin: 14px 0; font-size: 16px; }
.summary td { padding: 8px 6px; border-bottom: 1px solid #e6e9ef; text-align: left; }
.summary td:last-child { text-align: right; font-weight: 700; }
.summary .pos { color: #16a34a; }
.summary .neg { color: #e23; }
.summary tr.tot td { border-bottom: none; font-size: 19px; font-weight: 800; padding-top: 12px; }
.miss-title { font-size: 14px; color: #666; margin: 10px 0 6px; }
.miss-wrap { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.miss-chip { background: #fdecec; color: #c0392b; border: 1px solid #f3c0c0;
  border-radius: 14px; padding: 4px 12px; font-size: 13px; }

/* ---------- Floating +25 / -25 at cursor ---------- */
.float-penalty {
  position: fixed; z-index: 300; pointer-events: none;
  font-size: 28px; font-weight: 900; transform: translate(-50%, -50%);
  text-shadow: 0 2px 6px rgba(0,0,0,.6);
  transition: transform .9s ease-out, opacity .9s ease-out;
  opacity: 1;
}
.float-penalty.neg { color: #ff4d4d; }
.float-penalty.pos { color: #5BE584; }
.float-penalty.go {
  transform: translate(-50%, -120px) scale(1.25);
  opacity: 0;
}
