* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0a0c12;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  color: #e8eaf0;
  user-select: none;
}

#game-canvas {
  display: block;
  width: 100vw;
  height: 100vh;
  cursor: crosshair;
}

#hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 20;
}

.top-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  background: linear-gradient(180deg, rgba(8, 12, 20, 0.82) 0%, rgba(8, 12, 20, 0) 100%);
}

.brand {
  font-size: clamp(1rem, 2vw, 1.35rem);
  font-weight: 700;
  letter-spacing: 0.02em;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.55);
  line-height: 1.2;
}

.brand span {
  color: #f5c842;
}

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  max-width: min(72vw, 820px);
}

.stat {
  background: rgba(16, 22, 36, 0.78);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 7px 12px;
  font-size: clamp(0.72rem, 1.3vw, 0.85rem);
  color: #a8b0c0;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.22);
}

.stat strong {
  color: #f5c842;
  font-variant-numeric: tabular-nums;
  margin-left: 5px;
}

.stat.timer strong {
  color: #7ddea0;
}

.stat.timer.urgent strong {
  color: #ff6b5a;
}

.stat.timer.bonus strong {
  color: #6ec8ff;
}

.stat.boost strong {
  color: #8fd4ff;
}

.crosshair {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 18px;
  transform: translate(-50%, -50%);
  opacity: 0.85;
}

.crosshair::before,
.crosshair::after {
  content: "";
  position: absolute;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.6);
}

.crosshair::before {
  left: 50%;
  top: 2px;
  bottom: 2px;
  width: 2px;
  transform: translateX(-50%);
}

.crosshair::after {
  top: 50%;
  left: 2px;
  right: 2px;
  height: 2px;
  transform: translateY(-50%);
}

.prompt {
  position: absolute;
  top: calc(50% + 28px);
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 12px;
  border-radius: 8px;
  background: rgba(12, 16, 28, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.85rem;
  color: #f0f3fa;
  opacity: 0;
  transition: opacity 0.12s ease;
  white-space: nowrap;
  max-width: 90vw;
  overflow: hidden;
  text-overflow: ellipsis;
}

.prompt.show {
  opacity: 1;
}

.bottom-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 20px 18px 14px;
  background: linear-gradient(0deg, rgba(8, 12, 20, 0.85) 0%, rgba(8, 12, 20, 0) 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.msg {
  font-size: clamp(0.85rem, 1.5vw, 1rem);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.7);
  text-align: center;
}

.hint {
  font-size: clamp(0.68rem, 1.1vw, 0.8rem);
  color: #7a8499;
  text-align: center;
}

kbd {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(40, 48, 64, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-family: inherit;
  font-size: 0.72rem;
  color: #c8d0e0;
  margin: 0 1px;
}

/* Nicolas Cage encouragement bubble */
#cage-bubble {
  position: absolute;
  right: 16px;
  bottom: 88px;
  width: min(300px, 88vw);
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(14, 18, 30, 0.92);
  border: 1px solid rgba(245, 200, 66, 0.35);
  box-shadow: 0 10px 36px rgba(0, 0, 0, 0.45);
  opacity: 0;
  transform: translateY(12px) scale(0.96);
  transition: opacity 0.35s ease, transform 0.35s ease;
  pointer-events: none;
  z-index: 30;
}

#cage-bubble.show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

#cage-bubble img {
  width: 64px;
  height: 64px;
  border-radius: 10px;
  object-fit: cover;
  border: 2px solid rgba(245, 200, 66, 0.5);
  flex-shrink: 0;
}

#cage-bubble .bubble-body {
  min-width: 0;
}

#cage-bubble .bubble-name {
  font-size: 0.72rem;
  font-weight: 700;
  color: #f5c842;
  margin-bottom: 3px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

#cage-bubble .bubble-text {
  font-size: 0.84rem;
  line-height: 1.35;
  color: #e8eaf0;
}

/* Screens */
.screen {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(ellipse at 50% 20%, rgba(60, 80, 140, 0.25), transparent 55%),
    rgba(6, 8, 14, 0.88);
  backdrop-filter: blur(8px);
  pointer-events: auto;
}

.screen.hidden {
  display: none;
}

.panel {
  width: min(520px, 100%);
  background: linear-gradient(165deg, rgba(28, 34, 52, 0.96), rgba(16, 20, 32, 0.98));
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  padding: 28px 26px 24px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  text-align: center;
}

.panel h1 {
  font-size: clamp(1.4rem, 3.5vw, 1.9rem);
  margin-bottom: 8px;
  line-height: 1.2;
}

.panel h1 span {
  color: #f5c842;
}

.panel .subtitle {
  color: #9aa3b5;
  font-size: 0.95rem;
  margin-bottom: 18px;
  line-height: 1.45;
}

.panel ul {
  list-style: none;
  text-align: left;
  margin: 0 auto 20px;
  max-width: 420px;
  color: #c4cad8;
  font-size: 0.9rem;
  line-height: 1.55;
}

.panel ul li {
  padding: 4px 0 4px 18px;
  position: relative;
}

.panel ul li::before {
  content: "▸";
  position: absolute;
  left: 0;
  color: #f5c842;
}

.screen[hidden] {
  display: none !important;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  position: relative;
  z-index: 2;
  border: none;
  border-radius: 12px;
  padding: 12px 22px;
  font: inherit;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  color: #1a1408;
  background: linear-gradient(180deg, #ffd56a, #f0b429);
  box-shadow: 0 8px 22px rgba(240, 180, 41, 0.28);
  transition: transform 0.12s ease, filter 0.12s ease;
  pointer-events: auto;
}

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

.btn:active {
  transform: translateY(1px);
}

.btn.secondary {
  margin-left: 8px;
  color: #e8eaf0;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: none;
}

.win-orange {
  width: min(180px, 50vw);
  height: auto;
  border-radius: 14px;
  margin: 8px auto 16px;
  display: block;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
  border: 2px solid rgba(245, 200, 66, 0.4);
}

.end-title.win {
  color: #7ddea0;
}

.end-title.lose {
  color: #ff8a7a;
}

.mute-btn {
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 60;
  pointer-events: auto;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(16, 22, 36, 0.85);
  color: #e8eaf0;
  cursor: pointer;
  font-size: 1rem;
  display: none;
  align-items: center;
  justify-content: center;
}

.mute-btn.visible {
  display: flex;
}

.carry-badge {
  position: absolute;
  left: 50%;
  bottom: 78px;
  transform: translateX(-50%);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.carry-badge.show {
  opacity: 1;
}

.carry-badge.shelf {
  background: rgba(48, 110, 200, 0.9);
  color: #fff;
  border: 1px solid rgba(160, 200, 255, 0.5);
}

.carry-badge.garbage {
  background: rgba(55, 140, 80, 0.9);
  color: #fff;
  border: 1px solid rgba(160, 230, 180, 0.5);
}
