/* ===========================================================
   GAME PAGE — upload screen + game stage.
   Ported from the handoff desktop_en.html inline <style>.
   =========================================================== */

html, body {
  height: 100%;
  overflow: hidden;
  background: #faf3e4;
}
body { background-image: none; }
#root { height: 100%; width: 100%; position: relative; }

.hidden { display: none !important; }

/* ------------------------------------------------------------
   UPLOAD SCREEN — three-column landing + form
   ------------------------------------------------------------ */
.d-upload-screen {
  position: absolute; inset: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background:
    radial-gradient(circle at 15% 20%, #ffe9a8 0%, transparent 45%),
    radial-gradient(circle at 85% 80%, #ffd1c2 0%, transparent 45%),
    #faf3e4;
  overflow: hidden;
}

.d-upload-main {
  display: grid;
  grid-template-columns: 1.2fr 1.05fr 0.85fr;
  gap: 32px;
  padding: 32px 48px;
  overflow-y: auto;
  align-items: stretch;
  position: relative;
}

/* LEFT — hero text */
.d-hero {
  position: relative;
  display: flex; flex-direction: column;
  justify-content: center;
  gap: 22px;
  padding-right: 12px;
}
.d-hero-tag {
  display: inline-flex; align-items: center; gap: 8px;
  align-self: flex-start;
  padding: 6px 14px;
  background: #1a1410; color: #ffd93d;
  border-radius: 50px;
  font-size: 11px; font-weight: 800; letter-spacing: 2px;
}
.d-hero-title {
  font-size: clamp(56px, 6vw, 96px);
  font-weight: 900;
  line-height: 0.92;
  letter-spacing: -3px;
}
.d-hero-title .accent {
  display: inline-block;
  background: #e8532b; color: #fff;
  padding: 0 14px;
  transform: rotate(-2deg);
  box-shadow: 6px 6px 0 #1a1410;
}
.d-hero-sub {
  font-size: 18px; line-height: 1.5;
  color: #1a1410; max-width: 540px;
  font-weight: 500;
}
.d-hero-sub b { color: #e8532b; font-weight: 900; }
.d-hero-feats {
  display: flex; gap: 24px; flex-wrap: wrap;
  font-size: 12px; color: #8a7a6a; font-weight: 700;
  letter-spacing: 0.8px;
}
.d-hero-feat { display: flex; align-items: center; gap: 8px; }
.d-hero-feat-dot { width: 7px; height: 7px; border-radius: 50%; background: #e8532b; }

/* CENTER — upload panel (no card chrome) */
.d-upload-panel {
  display: flex; flex-direction: column;
  justify-content: center;
  gap: 18px;
  border-left: 2px dashed rgba(26, 20, 16, 0.18);
  border-right: 2px dashed rgba(26, 20, 16, 0.18);
  padding: 0 32px;
  position: relative;
}
.d-panel-step {
  font-size: 11px; color: #8a7a6a; font-weight: 800;
  letter-spacing: 2px; text-transform: uppercase;
  display: flex; align-items: center; gap: 10px;
}
.d-panel-step::after {
  content: ''; flex: 1; height: 2px;
  background: repeating-linear-gradient(90deg, #d3c4b0 0 6px, transparent 6px 12px);
}
.d-panel-title {
  font-size: 36px; font-weight: 900;
  line-height: 1; letter-spacing: -1.5px;
}
.d-panel-sub {
  font-size: 13px; color: #8a7a6a; font-weight: 600;
  margin-top: -8px;
}
.d-upload-row {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 24px;
  align-items: center;
  margin-top: 8px;
}
.d-photo-drop {
  width: 180px; height: 180px;
  border: 3px dashed #1a1410;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.5);
  transition: transform 0.15s, background 0.2s;
  overflow: hidden;
  flex-shrink: 0;
}
.d-photo-drop:hover { transform: scale(1.04) rotate(-3deg); background: rgba(255, 247, 230, 0.85); }
.d-photo-drop:active { transform: scale(0.97); }
.d-photo-drop.has-photo { border-style: solid; background: #fff; }
.d-photo-drop img { width: 100%; height: 100%; object-fit: cover; display: block; }
.d-photo-placeholder {
  display: flex; flex-direction: column;
  align-items: center; gap: 8px;
  color: #1a1410;
}
.d-photo-placeholder .icon { font-size: 50px; }
.d-photo-placeholder .text {
  font-size: 12px; font-weight: 800;
  letter-spacing: 0.5px; text-align: center;
  padding: 0 12px;
}
.d-upload-fields { display: flex; flex-direction: column; gap: 8px; }
.d-field-label {
  font-size: 11px; font-weight: 900; letter-spacing: 1.5px;
  color: #8a7a6a; text-transform: uppercase;
}
.d-name-input {
  width: 100%;
  padding: 14px 16px;
  font-size: 18px;
  font-weight: 700;
  font-family: inherit;
  border: 2px solid #1a1410;
  border-radius: 10px;
  background: #fff;
  color: #1a1410;
  outline: none;
  transition: transform 0.1s, box-shadow 0.1s;
}
.d-name-input:focus { transform: translateY(-2px); box-shadow: 4px 4px 0 #1a1410; }
.d-name-input::placeholder { color: #bfae9a; font-weight: 500; }
.d-name-counter {
  font-size: 11px; color: #bfae9a; font-weight: 700;
  text-align: right; font-family: 'JetBrains Mono', monospace;
}
.d-start-btn {
  margin-top: 4px;
  width: 100%;
  padding: 18px;
  font-size: 22px;
  font-weight: 900;
  font-family: inherit;
  background: #e8532b;
  color: #fff;
  border: 3px solid #1a1410;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 6px 6px 0 #1a1410;
  transition: all 0.1s;
  letter-spacing: 3px;
}
.d-start-btn:not(:disabled):hover { transform: translate(-3px, -3px); box-shadow: 9px 9px 0 #1a1410; }
.d-start-btn:not(:disabled):active { transform: translate(3px, 3px); box-shadow: 2px 2px 0 #1a1410; }
.d-start-btn:disabled {
  background: #d3c4b0; cursor: not-allowed;
  box-shadow: 3px 3px 0 #8a7a6a; border-color: #8a7a6a;
}
.d-disclaimer {
  font-size: 11px; color: #8a7a6a; line-height: 1.5;
  text-align: center;
}

/* RIGHT — stats / leaderboard preview / how-to */
.d-side-info {
  display: flex; flex-direction: column;
  gap: 18px;
  overflow: hidden;
}
.d-info-block {
  background: rgba(255, 255, 255, 0.6);
  border: 2px solid rgba(26, 20, 16, 0.12);
  border-radius: 14px;
  padding: 16px 18px;
}
.d-info-block h4 {
  font-size: 11px; font-weight: 900;
  letter-spacing: 1.5px; color: #8a7a6a;
  text-transform: uppercase;
  margin-bottom: 12px;
  display: flex; align-items: center; gap: 8px;
}
.d-info-block h4 .pip,
.lb-section-label .pip {
  display: inline-block;
  width: 6px; height: 6px;
  background: #e8532b;
  border-radius: 50%;
}
.d-stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.d-stat-cell {
  display: flex; flex-direction: column; gap: 2px;
  padding: 10px 12px;
  background: #fff;
  border-radius: 10px;
  border: 1.5px solid rgba(26, 20, 16, 0.08);
}
.d-stat-cell .num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 22px; font-weight: 800;
  color: #1a1410; line-height: 1;
}
.d-stat-cell .num.accent { color: #e8532b; }
.d-stat-cell .lbl {
  font-size: 10px; color: #8a7a6a; font-weight: 700;
  letter-spacing: 1px; text-transform: uppercase;
  margin-top: 4px;
}
.d-mini-lb { display: flex; flex-direction: column; gap: 4px; }
.d-mini-lb-row {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 6px 8px;
  border-radius: 8px;
  font-size: 13px;
  background: #fff;
  border: 1.5px solid rgba(26, 20, 16, 0.06);
}
.d-mini-lb-row .rk {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 800; font-size: 12px;
  color: #8a7a6a; text-align: center;
}
.d-mini-lb-row.top1 { background: #fff7e6; border-color: #ffd93d; }
.d-mini-lb-row.top1 .rk { color: #e8532b; }
.d-mini-lb-row .nm { font-weight: 700; color: #1a1410; }
.d-mini-lb-row .sc { font-family: 'JetBrains Mono', monospace; font-weight: 800; color: #1a1410; }
.d-howto { display: flex; flex-direction: column; gap: 10px; }
.d-howto-step {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px;
  align-items: flex-start;
  font-size: 13px;
  line-height: 1.4;
  color: #1a1410;
  font-weight: 500;
}
.d-howto-step .n {
  width: 24px; height: 24px;
  background: #1a1410; color: #ffd93d;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px; font-weight: 800;
  flex-shrink: 0;
}
.d-howto-step b { color: #e8532b; font-weight: 900; }

/* Bottom strip */
.d-bottom-strip {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 48px;
  border-top: 2px solid rgba(26, 20, 16, 0.08);
  background: rgba(26, 20, 16, 0.04);
  font-size: 11px; color: #8a7a6a; font-weight: 700;
  letter-spacing: 1.2px;
  flex-wrap: wrap; gap: 12px;
}
.d-bottom-strip .bs-features { display: flex; gap: 28px; flex-wrap: wrap; }
.d-bottom-strip .bs-feat { display: flex; align-items: center; gap: 8px; }
.d-bottom-strip .bs-feat-dot { width: 5px; height: 5px; border-radius: 50%; background: #e8532b; }

/* ------------------------------------------------------------
   GAME SCREEN — left/center/right with paw + popup animations
   ------------------------------------------------------------ */
.d-game-screen {
  position: absolute; inset: 0;
  display: grid;
  grid-template-columns: 320px 1fr 320px;
  gap: 0;
  background:
    radial-gradient(circle at 25% 15%, #ffe0a8 0%, transparent 50%),
    radial-gradient(circle at 75% 85%, #ffc8b8 0%, transparent 50%),
    #faf3e4;
  overflow: hidden;
}

.d-side-panel {
  padding: 28px 24px;
  display: flex; flex-direction: column;
  gap: 18px;
  background: rgba(255, 247, 230, 0.55);
  border-right: 3px solid #1a1410;
  overflow-y: auto;
  z-index: 10;
}
.d-side-panel.right { border-right: none; border-left: 3px solid #1a1410; }

.d-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 0 0 14px 0;
  border: none; border-bottom: 2px dashed #d3c4b0;
  background: transparent;
  font-family: inherit;
  text-align: left;
  width: 100%;
  cursor: pointer;
  transition: opacity 0.1s;
}
.d-brand:hover { opacity: 0.78; }
.d-brand:active { opacity: 0.6; }
.d-brand-mark {
  width: 38px; height: 38px;
  background: #1a1410; color: #ffd93d;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  box-shadow: 3px 3px 0 #e8532b;
  flex-shrink: 0;
}
.d-brand-text { font-weight: 900; font-size: 13px; letter-spacing: 1.2px; line-height: 1.2; }
.d-brand-text small { display: block; font-size: 10px; color: #8a7a6a; letter-spacing: 1px; font-weight: 700; }

.d-target-card {
  background: #fff;
  border: 3px solid #1a1410;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 5px 5px 0 #1a1410;
}
.d-target-card-banner {
  background: #1a1410; color: #fff;
  padding: 8px 14px;
  display: flex; align-items: center; justify-content: space-between;
  font-size: 11px; font-weight: 800; letter-spacing: 2px;
}
.d-target-card-banner .pip {
  width: 7px; height: 7px; background: #e8532b; border-radius: 50%;
  animation: pulse 1.5s infinite;
  display: inline-block;
}
.d-target-card-body {
  padding: 16px;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.d-target-thumb {
  width: 96px; height: 96px;
  border-radius: 50%;
  overflow: hidden;
  border: 4px solid #1a1410;
  box-shadow: 4px 4px 0 #e8532b;
}
.d-target-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.d-target-name {
  font-weight: 900; font-size: 18px;
  text-align: center; max-width: 100%;
  word-break: break-word; line-height: 1.2;
}
.d-target-meta {
  font-size: 10px; color: #8a7a6a; font-weight: 700;
  letter-spacing: 1.2px; text-transform: uppercase;
}

.d-counter-card {
  background: #1a1410; color: #fff;
  border: 3px solid #1a1410;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 5px 5px 0 #e8532b;
  position: relative;
}
.d-counter-head {
  padding: 10px 14px;
  background: #e8532b;
  border-bottom: 3px solid #1a1410;
  display: flex; align-items: center; justify-content: space-between;
  font-size: 11px; font-weight: 900; letter-spacing: 2px;
}
.d-counter-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 64px; font-weight: 800;
  line-height: 1;
  text-align: center;
  padding: 22px 14px 16px;
  color: #ffd93d;
  letter-spacing: -2px;
}
.d-counter-foot {
  background: rgba(255, 255, 255, 0.05);
  padding: 8px 14px;
  display: flex; justify-content: space-between;
  font-size: 10px; font-weight: 700;
  letter-spacing: 1.2px;
  color: rgba(255, 255, 255, 0.6);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.d-counter-foot b { color: #ffd93d; font-family: 'JetBrains Mono', monospace; }

.d-combo-card {
  background: #fff;
  border: 3px solid #1a1410;
  border-radius: 16px;
  padding: 14px;
  box-shadow: 4px 4px 0 #1a1410;
}
.d-combo-card-title {
  font-size: 11px; font-weight: 900; letter-spacing: 1.5px;
  color: #8a7a6a; text-transform: uppercase;
  margin-bottom: 10px;
  display: flex; align-items: center; justify-content: space-between;
}
.d-combo-card-title b { color: #e8532b; font-family: 'JetBrains Mono', monospace; font-size: 14px; }
.d-combo-bar {
  height: 14px; background: #faf3e4;
  border: 2px solid #1a1410; border-radius: 8px;
  overflow: hidden; position: relative;
}
.d-combo-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #ffd93d, #e8532b);
  border-right: 2px solid #1a1410;
  transition: width 0.2s ease-out;
  width: 0%;
}
.d-combo-card-tier {
  margin-top: 8px;
  font-size: 11px;
  font-weight: 700;
  color: #1a1410;
  display: flex; justify-content: space-between;
}
.d-combo-card-tier .tier-label { color: #e8532b; font-weight: 900; }

/* WEAPON SHOP — sits below the combo card. Locked weapons are
   greyscaled with their unlock cost shown underneath. */
.d-weapon-card {
  background: #fff;
  border: 3px solid #1a1410;
  border-radius: 16px;
  padding: 14px;
  box-shadow: 4px 4px 0 #1a1410;
}
.d-weapon-card-title {
  font-size: 11px; font-weight: 900; letter-spacing: 1.5px;
  color: #8a7a6a; text-transform: uppercase;
  margin-bottom: 10px;
}
.d-weapon-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.d-weapon-cell {
  position: relative;
  border: 2px solid #1a1410;
  border-radius: 10px;
  background: #fff7e6;
  padding: 8px 4px 6px;
  cursor: pointer;
  display: flex; flex-direction: column;
  align-items: center;
  gap: 4px;
  font-family: inherit;
  transition: transform 0.1s, box-shadow 0.1s;
  text-align: center;
}
.d-weapon-cell:hover { transform: translate(-1px, -1px); box-shadow: 2px 2px 0 #1a1410; }
.d-weapon-cell.active {
  background: #ffe9a8;
  border-color: #e8532b;
  box-shadow: 3px 3px 0 #e8532b;
}
.d-weapon-cell.locked {
  cursor: not-allowed;
  background: rgba(255, 255, 255, 0.55);
  opacity: 0.85;
}
.d-weapon-cell.locked:hover { transform: none; box-shadow: none; }
.d-weapon-cell.locked .d-weapon-img {
  filter: grayscale(1) opacity(0.55);
}
.d-weapon-img {
  width: 44px; height: 44px;
  object-fit: contain;
  pointer-events: none;
}
.d-weapon-name {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #1a1410;
  text-transform: uppercase;
  line-height: 1.1;
  word-break: break-word;
}
.d-weapon-cost {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 800;
  color: #e8532b;
  display: flex; align-items: center; gap: 3px;
}
.d-weapon-cost::before {
  content: '🪙';
  font-size: 9px;
}
.d-weapon-cell.active .d-weapon-cost { display: none; }
.d-weapon-cell.unlocked:not(.active) .d-weapon-cost { color: #8a7a6a; }
.d-weapon-cell.unlocked:not(.active) .d-weapon-cost::before { content: '✓'; color: #19a558; }

/* Size slider — scales the weapon when it animates onto the stage.
   100% = default 220px, 250% ≈ matches the target face (~540px). */
.d-weapon-size { margin-top: 12px; }
.d-weapon-size-row {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 10px; font-weight: 800; letter-spacing: 1.2px;
  color: #8a7a6a; text-transform: uppercase; margin-bottom: 6px;
}
.d-weapon-size-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; font-weight: 800;
  color: #e8532b; letter-spacing: 0;
}
.d-weapon-size-range {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 8px; background: #faf3e4;
  border: 2px solid #1a1410; border-radius: 6px;
  outline: none; cursor: pointer;
  padding: 0;
}
.d-weapon-size-range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 18px; height: 18px;
  border: 2px solid #1a1410;
  border-radius: 50%;
  background: #ffd93d;
  cursor: pointer;
  box-shadow: 2px 2px 0 #1a1410;
}
.d-weapon-size-range::-moz-range-thumb {
  width: 18px; height: 18px;
  border: 2px solid #1a1410;
  border-radius: 50%;
  background: #ffd93d;
  cursor: pointer;
  box-shadow: 2px 2px 0 #1a1410;
}

.d-recent-card {
  background: #fff;
  border: 3px solid #1a1410;
  border-radius: 16px;
  padding: 14px;
  box-shadow: 4px 4px 0 #1a1410;
  flex: 1;
  min-height: 140px;
  display: flex; flex-direction: column;
}
.d-recent-title {
  font-size: 11px; font-weight: 900; letter-spacing: 1.5px;
  color: #8a7a6a; text-transform: uppercase;
  margin-bottom: 10px;
  display: flex; align-items: center; gap: 6px;
}
.d-recent-list {
  list-style: none; flex: 1;
  display: flex; flex-direction: column; gap: 4px;
  overflow-y: auto;
}
.d-recent-item {
  display: flex; align-items: baseline; gap: 8px;
  font-size: 12px; line-height: 1.4;
  padding: 4px 6px;
  border-radius: 6px;
  animation: feed-in 0.25s ease-out;
}
.d-recent-item:nth-child(odd) { background: #fff7e6; }
.d-recent-item .ts {
  font-family: 'JetBrains Mono', monospace;
  color: #bfae9a; font-weight: 700;
  flex-shrink: 0; font-size: 10px;
}
.d-recent-item .label { font-weight: 800; color: #1a1410; }
.d-recent-item.mega .label { color: #e8532b; }
@keyframes feed-in {
  from { transform: translateX(-8px); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}
.d-recent-empty {
  color: #bfae9a; font-size: 12px; font-style: italic;
  text-align: center; padding: 20px 0;
}

/* ---------- Center stage ---------- */
.d-stage-wrap {
  position: relative;
  overflow: hidden;
  cursor: pointer;
}
.d-stage-wrap::before {
  content: '';
  position: absolute; inset: 0;
  background-image: radial-gradient(circle at 50% 50%, rgba(255, 217, 61, 0.08) 0%, transparent 60%);
  pointer-events: none;
}
.d-stage {
  position: absolute; inset: 0;
  overflow: hidden;
}

.d-target-wrap {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.d-target-face {
  width: min(60vmin, 540px);
  height: min(60vmin, 540px);
  border-radius: 50%;
  overflow: hidden;
  border: 8px solid #1a1410;
  box-shadow: 0 14px 0 rgba(26, 20, 16, 0.15), 12px 12px 0 #1a1410;
  background: #fff;
  position: relative;
  will-change: transform;
}
.d-target-face img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }

.d-paw {
  position: absolute;
  top: 50%;
  width: min(28vmin, 220px);
  height: min(28vmin, 220px);
  pointer-events: none;
  will-change: transform, opacity;
  z-index: 15;
  transform: translateY(-50%);
  opacity: 0;
}
.d-paw img {
  width: 100%; height: 100%;
  object-fit: contain;
  filter: drop-shadow(3px 4px 0 rgba(26, 20, 16, 0.35));
  pointer-events: none;
}
.d-paw-left  { left: -12vmin; }
.d-paw-right { right: -12vmin; }

@keyframes d-slap-left {
  0%   { transform: translate(-30vw, -50%) rotate(-45deg) scale(0.7); opacity: 0; }
  35%  { transform: translate(20vw, -55%)  rotate(15deg)  scale(1.15); opacity: 1; }
  55%  { transform: translate(18vw, -50%)  rotate(20deg)  scale(1.05); opacity: 1; }
  100% { transform: translate(-25vw, -50%) rotate(-60deg) scale(0.6); opacity: 0; }
}
@keyframes d-slap-right {
  0%   { transform: translate(30vw, -50%)  rotate(45deg)  scale(0.7); opacity: 0; }
  35%  { transform: translate(-20vw, -55%) rotate(-15deg) scale(1.15); opacity: 1; }
  55%  { transform: translate(-18vw, -50%) rotate(-20deg) scale(1.05); opacity: 1; }
  100% { transform: translate(25vw, -50%)  rotate(60deg)  scale(0.6); opacity: 0; }
}
.d-paw-left.active  { animation: d-slap-left 0.45s cubic-bezier(0.22, 1, 0.36, 1); }
.d-paw-right.active { animation: d-slap-right 0.45s cubic-bezier(0.22, 1, 0.36, 1); }

@keyframes d-hit-left {
  0%   { transform: translate(0, 0) rotate(0) scale(1); }
  20%  { transform: translate(-40px, 6px) rotate(-14deg) scale(0.96, 1.05); }
  45%  { transform: translate(-26px, 3px) rotate(-10deg) scale(0.98, 1.02); }
  100% { transform: translate(0, 0) rotate(0) scale(1); }
}
@keyframes d-hit-right {
  0%   { transform: translate(0, 0) rotate(0) scale(1); }
  20%  { transform: translate(40px, 6px) rotate(14deg) scale(0.96, 1.05); }
  45%  { transform: translate(26px, 3px) rotate(10deg) scale(0.98, 1.02); }
  100% { transform: translate(0, 0) rotate(0) scale(1); }
}
@keyframes d-hit-left-mega {
  0%   { transform: translate(0, 0) rotate(0) scale(1); }
  15%  { transform: translate(-68px, 14px) rotate(-22deg) scale(0.88, 1.12); }
  35%  { transform: translate(-44px, 8px)  rotate(-14deg) scale(0.94, 1.06); }
  60%  { transform: translate(14px, -3px)  rotate(4deg)   scale(1.02, 0.98); }
  100% { transform: translate(0, 0) rotate(0) scale(1); }
}
@keyframes d-hit-right-mega {
  0%   { transform: translate(0, 0) rotate(0) scale(1); }
  15%  { transform: translate(68px, 14px) rotate(22deg) scale(0.88, 1.12); }
  35%  { transform: translate(44px, 8px)  rotate(14deg) scale(0.94, 1.06); }
  60%  { transform: translate(-14px, -3px) rotate(-4deg) scale(1.02, 0.98); }
  100% { transform: translate(0, 0) rotate(0) scale(1); }
}
.d-target-face.hit-left      { animation: d-hit-left 0.45s ease-out; }
.d-target-face.hit-right     { animation: d-hit-right 0.45s ease-out; }
.d-target-face.hit-left-mega { animation: d-hit-left-mega 0.55s ease-out; }
.d-target-face.hit-right-mega{ animation: d-hit-right-mega 0.55s ease-out; }

@keyframes d-shake-small {
  0%, 100% { transform: translate(0, 0); }
  20% { transform: translate(-5px, 3px); }
  40% { transform: translate(4px, -2px); }
  60% { transform: translate(-4px, -2px); }
  80% { transform: translate(3px, 2px); }
}
@keyframes d-shake-big {
  0%, 100% { transform: translate(0, 0) rotate(0); }
  15% { transform: translate(-16px, 8px) rotate(-0.6deg); }
  30% { transform: translate(14px, -10px) rotate(0.5deg); }
  45% { transform: translate(-10px, -5px) rotate(-0.4deg); }
  60% { transform: translate(10px, 8px) rotate(0.3deg); }
  80% { transform: translate(-5px, 3px) rotate(-0.2deg); }
}
.d-stage.shake-small { animation: d-shake-small 0.3s ease-out; }
.d-stage.shake-big   { animation: d-shake-big 0.5s ease-out; }

/* paw marks */
.paw-mark {
  position: absolute;
  width: 90px; height: 90px;
  pointer-events: none;
  opacity: 0.85;
  animation: mark-appear 0.2s ease-out backwards, mark-fade 3s ease-in 3s forwards;
  z-index: 5;
}
@keyframes mark-appear {
  0%   { transform: translate(-50%, -50%) scale(0.3) rotate(var(--r, 0deg)); opacity: 0; }
  60%  { transform: translate(-50%, -50%) scale(1.1) rotate(var(--r, 0deg)); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1)   rotate(var(--r, 0deg)); opacity: 0.85; }
}
@keyframes mark-fade {
  0%   { opacity: 0.85; }
  100% { opacity: 0; }
}
.paw-mark svg,
.paw-mark img {
  width: 100%; height: 100%; display: block;
  pointer-events: none;
}
/* Weapon-specific PNG marks reuse the paw-mark fade timeline, so they
   share the 0.85 baseline opacity from the .paw-mark rule above. */

/* combo + cat popup */
.cat-popup {
  position: absolute;
  pointer-events: none;
  z-index: 25;
  animation: cat-enter 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards,
             cat-exit 0.4s ease-in 5s forwards;
  will-change: transform, opacity;
}
@keyframes cat-enter {
  0%   { transform: scale(0) rotate(-20deg); opacity: 0; }
  70%  { transform: scale(1.15) rotate(5deg); opacity: 1; }
  100% { transform: scale(1) rotate(var(--cat-tilt, -3deg)); opacity: 1; }
}
@keyframes cat-exit {
  0%   { opacity: 1; transform: scale(1) rotate(var(--cat-tilt, -3deg)); }
  100% { opacity: 0; transform: scale(0.8) translateY(20px) rotate(var(--cat-tilt, -3deg)); }
}
.cat-popup .cat-head {
  width: 150px; height: 150px;
  filter: drop-shadow(2px 3px 4px rgba(0, 0, 0, 0.25));
}
.cat-popup .cat-head img {
  width: 100%; height: 100%;
  object-fit: contain;
  pointer-events: none;
}
.cat-popup .bubble {
  background: #fff;
  border: 4px solid #1a1410;
  border-radius: 16px;
  padding: 12px 18px;
  font-weight: 900;
  font-size: 18px;
  color: #1a1410;
  box-shadow: 4px 4px 0 #1a1410;
  position: relative;
  margin-top: -6px;
  max-width: 280px;
  text-align: center;
  line-height: 1.3;
}
.cat-popup .bubble::before {
  content: ''; position: absolute;
  top: -12px; left: 30px;
  width: 0; height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-bottom: 14px solid #1a1410;
}
.cat-popup .bubble::after {
  content: ''; position: absolute;
  top: -7px; left: 33px;
  width: 0; height: 0;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-bottom: 10px solid #fff;
}
.cat-popup.flipped .bubble::before { left: auto; right: 30px; }
.cat-popup.flipped .bubble::after  { left: auto; right: 33px; }

.combo-text {
  position: absolute;
  pointer-events: none;
  font-weight: 900;
  color: #e8532b;
  -webkit-text-stroke: 3px #1a1410;
  text-shadow: 4px 4px 0 #1a1410;
  z-index: 18;
  animation: combo-float 0.8s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  will-change: transform, opacity;
  white-space: nowrap;
}
@keyframes combo-float {
  0%   { transform: translate(-50%, -50%) scale(0.3) rotate(var(--r, 0deg)); opacity: 0; }
  25%  { transform: translate(-50%, -50%) scale(1.3) rotate(var(--r, 0deg)); opacity: 1; }
  100% { transform: translate(-50%, calc(-50% - 100px)) scale(1) rotate(var(--r, 0deg)); opacity: 0; }
}

/* Big "POINTS" HUD pinned to the top of the stage. Same JetBrains Mono
   weight + size as the side-panel counter, but black instead of gold. */
.d-points-hud {
  position: absolute;
  top: 28px; left: 50%;
  transform: translateX(-50%);
  text-align: center;
  pointer-events: none;
  z-index: 8;
  user-select: none;
}
.d-points-label {
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 4px;
  color: #1a1410;
  opacity: 0.55;
  margin-bottom: 2px;
}
.d-points-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 64px;
  font-weight: 800;
  line-height: 1;
  color: #1a1410;
  letter-spacing: -2px;
}

.d-tap-hint {
  position: absolute;
  bottom: 40px; left: 50%;
  transform: translateX(-50%);
  background: rgba(26, 20, 16, 0.92);
  color: #fff;
  padding: 12px 24px;
  border-radius: 50px;
  font-size: 16px;
  font-weight: 800;
  z-index: 10;
  animation: hint-pulse 1.5s ease-in-out infinite;
  pointer-events: none;
  letter-spacing: 1px;
}
@keyframes hint-pulse {
  0%, 100% { transform: translateX(-50%) scale(1);    opacity: 0.92; }
  50%      { transform: translateX(-50%) scale(1.05); opacity: 1; }
}

/* ---------- Right panel actions + sound ---------- */
/* Share is the primary action so it gets 3× the width of Reset.
   .d-action-btn.full (= leaderboard link) still spans both columns. */
.d-action-row { display: grid; grid-template-columns: 3fr 1fr; gap: 10px; }
.d-action-btn {
  padding: 14px 12px;
  background: #fff;
  border: 3px solid #1a1410;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 4px 4px 0 #1a1410;
  font-family: inherit;
  display: flex; flex-direction: column;
  align-items: center; gap: 4px;
  transition: all 0.1s;
  font-weight: 900;
  font-size: 12px;
  letter-spacing: 1px;
  color: #1a1410;
  text-decoration: none;
}
.d-action-btn .icon { font-size: 26px; }
.d-action-btn:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 #1a1410; }
.d-action-btn:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 #1a1410; }
.d-action-btn.danger { background: #e8532b; color: #fff; }

/* Idle attract — after >3s of no slapping the share / leaderboard /
   weapon-card black borders flash bright yellow. Hard, hard to miss
   — replaces the earlier subtle box-shadow halo. */
@keyframes attract-flash {
  0%, 100% { border-color: #1a1410; background-color: #fff; }
  50%      { border-color: #ffd93d; background-color: #fff7c2; }
}
.attract {
  animation: attract-flash 0.55s ease-in-out infinite;
}
/* The leaderboard CTA in the action row is `.d-action-btn.full` — same
   border treatment, picks up the same flash. The weapon-card has the
   same `border: 3px solid #1a1410` so the override applies cleanly. */
.d-action-btn.full {
  grid-column: span 2;
  flex-direction: row;
  padding: 12px 16px;
  justify-content: center;
  gap: 10px;
}
.d-action-btn.full .icon { font-size: 22px; }

.d-sound-card {
  background: #fff;
  border: 3px solid #1a1410;
  border-radius: 16px;
  padding: 14px;
  box-shadow: 4px 4px 0 #1a1410;
}
.d-sound-head {
  display: flex; align-items: center; justify-content: space-between;
  padding-bottom: 10px;
  border-bottom: 2px solid #f0e6d2;
  margin-bottom: 10px;
}
.d-sound-head label { font-weight: 900; font-size: 13px; letter-spacing: 1px; }
.d-sound-section { margin-bottom: 10px; }
.d-sound-section:last-child { margin-bottom: 0; }
.d-sound-section-title {
  font-weight: 900; font-size: 10px;
  letter-spacing: 1.5px; color: #8a7a6a;
  margin-bottom: 6px; text-transform: uppercase;
}
.d-sound-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.1s;
  font-size: 13px;
  margin-bottom: 2px;
}
.d-sound-row:hover { background: #fff7e6; }
.d-sound-row.active { background: #ffe9a8; }
.d-sound-radio {
  width: 14px; height: 14px;
  border: 2px solid #1a1410;
  border-radius: 50%;
  flex-shrink: 0;
  background: #fff;
  position: relative;
}
.d-sound-row.active .d-sound-radio::after {
  content: ''; position: absolute;
  inset: 2px;
  border-radius: 50%;
  background: #e8532b;
}
.d-sound-label { flex: 1; font-weight: 700; color: #1a1410; }
.d-sound-play {
  background: #1a1410; color: #fff;
  border: none; border-radius: 6px;
  width: 22px; height: 22px;
  font-size: 10px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-family: inherit;
  flex-shrink: 0;
}
.d-sound-play:hover { background: #e8532b; }
.d-toggle {
  width: 44px; height: 24px;
  background: #d3c4b0;
  border-radius: 12px;
  border: 2px solid #1a1410;
  position: relative;
  cursor: pointer;
  transition: background 0.15s;
}
.d-toggle::after {
  content: '';
  position: absolute;
  top: 1px; left: 1px;
  width: 16px; height: 16px;
  background: #fff;
  border: 2px solid #1a1410;
  border-radius: 50%;
  transition: left 0.15s;
}
.d-toggle.on { background: #e8532b; }
.d-toggle.on::after { left: 21px; }

/* ---------- Modal ---------- */
.modal-overlay {
  position: absolute; inset: 0;
  background: rgba(26, 20, 16, 0.78);
  z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  animation: fade-in 0.2s;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.modal-card {
  background: #fff;
  border: 4px solid #1a1410;
  border-radius: 20px;
  padding: 28px;
  max-width: 540px;
  width: 100%;
  box-shadow: 10px 10px 0 #e8532b;
  text-align: center;
}
.modal-title { font-size: 26px; font-weight: 900; margin-bottom: 6px; }
.modal-sub { font-size: 14px; color: #8a7a6a; margin-bottom: 12px; }
.modal-warning {
  font-size: 13px;
  font-weight: 700;
  color: #1a1410;
  background: #fff3d0;
  border: 2px solid #e8532b;
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 16px;
  line-height: 1.4;
}
.modal-btns { display: flex; gap: 10px; }
.modal-btn {
  flex: 1;
  padding: 13px;
  font-size: 15px;
  font-weight: 900;
  font-family: inherit;
  border: 3px solid #1a1410;
  border-radius: 10px;
  cursor: pointer;
  box-shadow: 3px 3px 0 #1a1410;
  transition: all 0.1s;
}
.modal-btn:hover  { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 #1a1410; }
.modal-btn:active { transform: translate(2px, 2px);   box-shadow: 1px 1px 0 #1a1410; }
.modal-btn.primary   { background: #e8532b; color: #fff; }
.modal-btn.secondary { background: #fff;    color: #1a1410; }
.modal-btn.danger    { background: #1a1410; color: #fff; }

/* Toast */
/* SHARE CARD — rendered off-screen, captured by html2canvas to PNG.
   Designed at a fixed 600×880 size for portrait social shares. */
.share-card {
  position: fixed;
  left: -9999px; top: 0;
  width: 600px;
  /* height auto so weapons row + popup don't overflow */
  background:
    radial-gradient(circle at 18% 12%, #ffe9a8 0%, transparent 45%),
    radial-gradient(circle at 82% 88%, #ffd1c2 0%, transparent 45%),
    #faf3e4;
  padding: 36px 36px 28px;
  border: 6px solid #1a1410;
  border-radius: 28px;
  box-shadow: 12px 12px 0 #e8532b;
  font-family: 'Inter', -apple-system, sans-serif;
  color: #1a1410;
  box-sizing: border-box;
}
.sc-head { display: flex; align-items: center; gap: 12px; }
.sc-logo {
  width: 56px; height: 56px;
  background: #1a1410; color: #ffd93d;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 30px; box-shadow: 4px 4px 0 #e8532b;
}
.sc-brand { font-size: 17px; font-weight: 900; letter-spacing: 2px; line-height: 1.2; }
.sc-brand small { display: block; font-size: 11px; letter-spacing: 1.5px; color: #8a7a6a; font-weight: 700; }

.sc-target {
  display: flex; flex-direction: column; align-items: center;
  gap: 14px; margin-top: 22px;
}
/* Stack wrapper gives the slap mark something to absolute-position
   against without breaking the photo's circular clip. */
.sc-target-img-stack {
  position: relative;
  width: 180px; height: 180px;
}
.sc-target-photo-wrap {
  width: 180px; height: 180px;
  border-radius: 50%;
  border: 6px solid #1a1410;
  box-shadow: 6px 6px 0 #e8532b;
  overflow: hidden;
  background: #fff;
  position: relative;
  z-index: 1;
}
.sc-target-photo-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* Batman slap print over the photo's bottom-right shoulder — sized
   close to the photo so it reads as "just slapped" but offset enough
   that the face is still recognisable. */
.sc-slap-mark {
  position: absolute;
  bottom: -22px;
  right: -38px;
  width: 150px;
  height: 150px;
  pointer-events: none;
  z-index: 2;
  transform: rotate(-15deg);
  filter: drop-shadow(3px 4px 5px rgba(26, 20, 16, 0.35));
}
.sc-target-name {
  font-size: 32px; font-weight: 900; letter-spacing: -1px;
  text-align: center;
  background: #ffd93d;
  padding: 4px 18px;
  transform: rotate(-1deg);
  box-shadow: 4px 4px 0 #1a1410;
  max-width: 100%;
  word-break: break-word;
}

.sc-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 20px;
}
.sc-stat {
  background: #fff;
  border: 3px solid #1a1410;
  border-radius: 14px;
  padding: 12px 10px 14px;
  text-align: center;
  box-shadow: 3px 3px 0 #1a1410;
}
.sc-stat-label {
  font-size: 10px; font-weight: 800;
  letter-spacing: 1.4px;
  color: #8a7a6a;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.sc-stat-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 28px;
  font-weight: 800;
  color: #1a1410;
  line-height: 1;
}
.sc-stat-value.sc-rank {
  font-family: 'Inter', -apple-system, sans-serif;
  font-size: 16px;
  letter-spacing: 0;
  line-height: 1.2;
}

.sc-popup {
  display: flex; align-items: flex-start; gap: 12px;
  margin-top: 20px;
}
.sc-cat-head {
  width: 96px; height: 96px;
  flex-shrink: 0;
  filter: drop-shadow(2px 3px 4px rgba(0, 0, 0, 0.18));
}
.sc-cat-head img { width: 100%; height: 100%; object-fit: contain; }
.sc-bubble {
  background: #fff;
  border: 4px solid #1a1410;
  border-radius: 16px;
  padding: 12px 16px;
  font-weight: 800;
  font-size: 18px;
  line-height: 1.35;
  box-shadow: 4px 4px 0 #1a1410;
  flex: 1;
  position: relative;
  margin-top: 14px;
}
.sc-bubble::before {
  content: ''; position: absolute;
  top: -12px; left: 18px;
  width: 0; height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-bottom: 14px solid #1a1410;
}
.sc-bubble::after {
  content: ''; position: absolute;
  top: -7px; left: 21px;
  width: 0; height: 0;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-bottom: 10px solid #fff;
}

.sc-weapons {
  margin-top: 22px;
  background: rgba(255, 255, 255, 0.65);
  border: 2px dashed #1a1410;
  border-radius: 14px;
  padding: 12px 16px;
}
.sc-weapons-label {
  font-size: 10px; font-weight: 900; letter-spacing: 1.5px;
  color: #8a7a6a; text-transform: uppercase;
  margin-bottom: 8px;
}
.sc-weapons-row {
  display: flex; align-items: center; gap: 10px;
  flex-wrap: wrap;
}
.sc-weapons-row img {
  width: 48px; height: 48px;
  object-fit: contain;
  background: #fff;
  border: 2px solid #1a1410;
  border-radius: 10px;
  padding: 4px;
}

.sc-footer {
  margin-top: 18px;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: #8a7a6a;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

/* Share preview modal */
.share-modal-card { max-width: 520px; }
.share-modal-card .modal-preview {
  width: 100%;
  max-height: 60vh;
  object-fit: contain;
  border: 3px solid #1a1410;
  border-radius: 12px;
  background: #faf3e4;
  margin-bottom: 14px;
}

.share-toast {
  position: fixed; top: 90px; left: 50%;
  transform: translateX(-50%) translateY(-16px);
  background: #1a1410; color: #fff;
  padding: 13px 24px; border-radius: 50px;
  border: 3px solid #e8532b;
  font-size: 14px; font-weight: 800; letter-spacing: 0.5px;
  box-shadow: 6px 6px 0 #e8532b;
  z-index: 200; opacity: 0; pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}
.share-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Responsive collapses to keep things readable on smaller windows */
@media (max-width: 1280px) {
  .d-upload-main { grid-template-columns: 1.1fr 1fr; gap: 24px; padding: 28px 36px; }
  .d-side-info { display: none; }
}
@media (max-width: 1100px) {
  .d-game-screen { grid-template-columns: 260px 1fr 260px; }
  .d-side-panel { padding: 20px 16px; gap: 14px; }
  .d-counter-num { font-size: 52px; }
}
@media (max-width: 880px) {
  .d-upload-main { grid-template-columns: 1fr; overflow-y: auto; padding: 24px; }
  .d-upload-panel { border: none; padding: 0; }
  .d-topbar { padding: 14px 24px; }
  .d-bottom-strip { padding: 12px 24px; }
}
