.dg-wrap { max-width: 1000px; }
.dg-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 4px 0 12px; }
.dg-head h1 { margin: 0; font-size: 36px; }
.dg-hud { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.dg-hud .stat .value { font-size: 20px; }
.dg-hearts { display: flex; gap: 3px; }
.dg-hearts svg { width: 22px; height: 22px; }
.dg-hud-btns { display: flex; gap: 6px; }
.dg-icon { padding: 8px 10px; display: grid; place-items: center; }
.dg-icon svg { width: 20px; height: 20px; }
#pauseBtn .i-play { display: none; }
#pauseBtn.paused .i-play { display: inline; }
#pauseBtn.paused .i-pause { display: none; }
#soundBtn .cross { display: none; }
#soundBtn.muted .cross { display: inline; }
#soundBtn.muted .waves { display: none; }
#soundBtn.muted { color: var(--muted); }

.dg-stage {
  position: relative; width: 100%; aspect-ratio: 16 / 10; max-height: calc(100svh - 170px);
  border-radius: 16px; overflow: hidden; background: #0b0b18;
  border: 1px solid var(--line); box-shadow: var(--shadow);
}
#game { display: block; width: 100%; height: 100%; image-rendering: pixelated; touch-action: none; }

.dg-toast {
  position: absolute; left: 50%; top: 56px; transform: translate(-50%, -20px); max-width: calc(100% - 24px); white-space: normal; text-align: center; opacity: 0; pointer-events: none;
  background: rgba(15, 16, 32, .88); border: 1px solid var(--line); color: var(--text);
  font: 700 15px var(--font-display); padding: 8px 14px; border-radius: 999px; transition: opacity .2s, transform .2s;
}
.dg-toast.show { opacity: 1; transform: translate(-50%, 0); }
.dg-toast.gold { color: var(--accent); border-color: var(--accent); }

.dg-overlay {
  position: absolute; inset: 0; display: none; place-items: center; padding: 16px;
  background: rgba(8, 9, 22, .7); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); z-index: 5;
}
.dg-overlay.show { display: grid; }
.dg-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 22px 24px; max-width: 420px; width: 100%;
  text-align: center; box-shadow: var(--shadow); max-height: 100%; overflow: auto;
}
.dg-card h2 { margin: 0 0 10px; font-size: 28px; }
.dg-card p { color: var(--muted); line-height: 1.5; margin: 0 0 10px; }
.dg-card p b { color: var(--text); }
.dg-logo {
  font: 700 46px/1 var(--font-display); color: var(--accent); margin-bottom: 10px; letter-spacing: -.02em;
  text-shadow: 0 4px 0 #8a5a12, 0 8px 18px rgba(0,0,0,.4);
}
.dg-keys { list-style: none; padding: 0; margin: 0 0 10px; display: flex; flex-direction: column; gap: 6px; color: var(--text); font-size: 14px; }
kbd { display: inline-block; min-width: 24px; padding: 2px 6px; margin: 0 2px; border-radius: 6px; background: var(--panel-2); border: 1px solid var(--line); border-bottom-width: 3px; font: 600 12px var(--font-body); color: var(--text); }
.dg-tip { font-size: 13px; }
.dg-big { padding: 14px 26px; font-size: 17px; margin: 6px 0; }
.dg-card .btn.ghost { display: block; margin: 8px auto 0; }
.dg-best { font-size: 13px; margin-top: 8px !important; }
.dg-final { font: 700 54px/1 var(--font-display); color: var(--accent) !important; margin: 6px 0 10px !important; }
.dg-tally { display: grid; grid-template-columns: 1fr auto; gap: 6px 16px; text-align: left; margin: 6px 0 14px; font-size: 15px; }
.dg-tally span { color: var(--muted); }
.dg-tally b { font-family: var(--font-display); text-align: right; }
.dg-tally .total { color: var(--text); font-weight: 600; border-top: 1px solid var(--line); padding-top: 6px; }
.dg-tally b.total { color: var(--accent); }

/* touch controls (shown on touch screens) */
.dg-touch { display: none; justify-content: space-between; align-items: center; gap: 12px; margin-top: 12px; user-select: none; -webkit-user-select: none; }
.dg-touch button {
  appearance: none; border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
  border-radius: 14px; font: 700 18px var(--font-display); touch-action: none; -webkit-tap-highlight-color: transparent;
  box-shadow: inset 0 -4px 0 rgba(0,0,0,.25);
}
.dg-touch button.on { background: #3a3f80; transform: translateY(1px); box-shadow: inset 0 -2px 0 rgba(0,0,0,.25); }
.dg-pad { display: grid; grid-template-columns: repeat(3, 54px); grid-template-rows: repeat(2, 50px); gap: 6px; }
.dg-pad .up { grid-column: 2; grid-row: 1; }
.dg-pad .left { grid-column: 1; grid-row: 1 / 3; }
.dg-pad .right { grid-column: 3; grid-row: 1 / 3; }
.dg-pad .down { grid-column: 2; grid-row: 2; }
.dg-actions { display: grid; grid-template-columns: auto auto; gap: 8px 10px; justify-items: center; }
.dg-actions .tnt { grid-column: 1 / 3; width: 100%; height: 36px; border-radius: 12px; font-size: 14px; background: #d7262b; color: #fff; border-color: transparent; letter-spacing: .08em; }
.dg-actions .tnt.on { background: #a3161c; }
.dg-actions button:not(.tnt) { width: 74px; height: 74px; border-radius: 50%; font-size: 16px; }
.dg-actions .jump { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.dg-actions .jump.on { background: #e6b52b; }
.dg-actions .dig { background: #4fd1c5; color: #062421; border-color: transparent; }
.dg-actions .dig.on { background: #3bb3a8; }
.dg-keys-touch { display: none; }

@media (pointer: coarse) {
  .dg-touch { display: flex; }
  .dg-keys-desk { display: none; }
  .dg-keys-touch { display: block; }
}
@media (max-width: 700px) {
  .dg-head { margin: 0 0 8px; }
  .dg-head h1 { font-size: 24px; }
  .dg-hud { gap: 12px; }
  .dg-hud .stat .value { font-size: 16px; }
  .dg-hud .stat .label { font-size: 10px; }
  .dg-hearts svg { width: 18px; height: 18px; }
  .dg-hide-sm { display: none; }
  .dg-stage { aspect-ratio: auto; height: min(calc(100svh - 330px), 120vw); min-height: 300px; max-height: none; }
  .dg-logo { font-size: 36px; }
  .dg-card { padding: 16px; }
  .dg-card p { font-size: 14px; }
}
@media (max-width: 380px) {
  .dg-pad { grid-template-columns: repeat(3, 48px); grid-template-rows: repeat(2, 46px); }
  .dg-actions button:not(.tnt) { width: 66px; height: 66px; }
}

/* ---- Big Corp intro ---- */
.dg-corp { position: absolute; inset: 0; z-index: 6; display: none; place-items: center; overflow: hidden; pointer-events: none; }
.dg-corp.show { display: grid; animation: corpOut .45s ease-in 2.5s forwards; }
.dg-corp::before { content: ""; position: absolute; inset: 0; background: #fff; animation: corpFlash .5s ease-out forwards; z-index: 2; }
.dg-corp-burst {
  position: absolute; width: 260%; aspect-ratio: 1; left: 50%; top: 50%; transform: translate(-50%, -50%);
  background: repeating-conic-gradient(#1a1b2e 0 10deg, #2b1f4a 10deg 20deg);
  animation: corpSpin 6s linear infinite;
}
.dg-corp-inner { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; animation: corpSlam .5s cubic-bezier(.2, 1.6, .4, 1) .15s both; }
.dg-corp-boss { width: min(46vw, 230px); filter: drop-shadow(0 10px 24px rgba(0,0,0,.55)); animation: corpBob 1s ease-in-out .6s infinite alternate; }
.dg-corp-title {
  font: 700 clamp(44px, 9vw, 84px)/1 var(--font-display); letter-spacing: -.02em; color: #ffcc33;
  text-shadow: 0 5px 0 #8a5a12, 0 10px 24px rgba(0,0,0,.6); animation: corpSlam .45s cubic-bezier(.2, 1.6, .4, 1) .45s both;
}
.dg-corp-sub { color: #fff; font: 600 clamp(14px, 3vw, 19px) var(--font-body); text-shadow: 0 2px 6px rgba(0,0,0,.7); animation: corpFade .4s ease .8s both; }
.dg-corp-sub b { color: #ff6b6b; }
@keyframes corpFlash { from { opacity: 1; } to { opacity: 0; } }
@keyframes corpSpin { to { transform: translate(-50%, -50%) rotate(360deg); } }
@keyframes corpSlam { from { transform: scale(2.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes corpFade { from { opacity: 0; transform: translateY(8px); } }
@keyframes corpBob { to { transform: translateY(-6px) rotate(-2deg); } }
@keyframes corpOut { to { opacity: 0; transform: scale(1.15); } }
