/* ============================================================
   JUMPER BOT — visual system v4 "INK & INK-LINE" (premium pass)
   Direction: comic-panel structure, dialed back to read premium —
   less "cartoon sticker", more "boutique studio's take on a comic".
   No copyrighted character art, logos, or named IP used anywhere.

   Palette : ink black board / hero red / web blue / pow yellow / newsprint paper
   Type    : Archivo Black (display — cleaner, more premium than a
             hand-lettered comic font, still bold/poster-like)
             + Inter (body, full weight range for real hierarchy)
             + JetBrains Mono (HUD digital readout)
   Layout  : same comic-panel shell (thick gutter border, halftone
             corners) but shadows/borders tightened, ambient motion
             reduced to only what carries meaning (feedback, not
             decoration), and a proper type + spacing scale.
   Signature: unchanged — the play-field as a comic PANEL, with a
   speech-bubble combo callout and a starburst score reveal.

   SETUP: add these to your <head>:
   <link rel="preconnect" href="https://fonts.googleapis.com">
   <link href="https://fonts.googleapis.com/css2?family=Archivo+Black&family=Inter:wght@400;500;600;700;800&display=swap" rel="stylesheet">
   ============================================================ */

:root {
  /* color */
  --ink: #0b0b0f;
  --ink-panel: #16161d;
  --ink-raised: #1e1e27;
  --gutter: #000000;
  --red: #dd2436;
  --red-dim: #7c1420;
  --blue: #3357d6;
  --blue-dim: #1c2c66;
  --pow: #ffcf3f;
  --paper: #f3e8cd;
  --paper-dim: #cbbf9f;
  --text: #f6f2e9;
  --text-dim: #98939f;
  --danger: #ff4747;
  --success: #34d67a;

  /* type */
  --font-display: 'Archivo Black', 'Arial Black', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* spacing + radius scale, kept consistent everywhere for a
     more considered, less improvised feel */
  --sp-1: 4px;  --sp-2: 6px;  --sp-3: 10px; --sp-4: 14px;
  --sp-5: 18px; --sp-6: 24px;
  --r-sm: 6px; --r-md: 8px; --r-lg: 12px;

  /* one shadow language used everywhere instead of one-off values */
  --shadow-flat: 3px 3px 0 var(--gutter);
  --shadow-flat-lg: 5px 5px 0 var(--gutter);
  --shadow-lift: 4px 4px 0 var(--gutter);
}

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

html, body { height: 100%; overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

body {
  background:
    radial-gradient(circle, rgba(221,36,54,0.07) 1px, transparent 1.4px) 0 0/22px 22px,
    var(--ink);
  color: var(--text);
  font-family: var(--font-body);
  height: 100vh;
  height: 100dvh;
  width: 100vw;
  -webkit-font-smoothing: antialiased;
}

:focus-visible { outline: 3px solid var(--pow); outline-offset: 2px; }

#app {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: clamp(var(--sp-2), 1.4vw, var(--sp-4));
  padding: clamp(var(--sp-2), 1.4vw, var(--sp-4));
}

/* ---------- HUD ---------- */

#hud {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--ink-panel);
  border: 2px solid var(--gutter);
  border-radius: var(--r-md);
  padding: var(--sp-3) clamp(var(--sp-4), 2.4vw, var(--sp-5));
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-flat);
}

#hud::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: linear-gradient(var(--red), var(--blue));
}

.hud-brand { display: flex; align-items: center; gap: var(--sp-2); }
.hud-brand-icon {
  color: var(--pow);
  font-size: clamp(15px, 3vw, 20px);
  filter: drop-shadow(1px 1px 0 var(--gutter));
}
.hud-brand-text {
  font-family: var(--font-display);
  letter-spacing: 0.5px;
  font-size: clamp(14px, 2.6vw, 18px);
  color: var(--text);
  text-transform: uppercase;
}
.hud-brand-text .accent { color: var(--red); }

.hud-stats { display: flex; gap: clamp(var(--sp-3), 2vw, var(--sp-5)); }
.stat { display: flex; flex-direction: column; align-items: center; min-width: 34px; }
.stat-label {
  font-family: var(--font-mono);
  font-size: 8.5px;
  font-weight: 500;
  color: var(--text-dim);
  letter-spacing: 1.2px;
}
.stat-value {
  font-family: var(--font-mono);
  font-size: clamp(14px, 2.6vw, 17px);
  font-weight: 700;
  color: var(--pow);
  display: inline-block;
  transition: transform .1s ease;
}
.stat-value.pop { animation: stat-pop 0.3s cubic-bezier(.34,1.56,.64,1); }
@keyframes stat-pop {
  0%   { transform: scale(1);    color: var(--pow); }
  40%  { transform: scale(1.4);  color: var(--success); }
  100% { transform: scale(1);    color: var(--pow); }
}

.lives-stat .stat-value { color: var(--red); letter-spacing: 2px; }
.lives-stat.hit { animation: life-lost 0.35s ease; }
@keyframes life-lost {
  0%, 100% { transform: translateX(0); }
  25%      { transform: translateX(-3px); }
  50%      { transform: translateX(3px); }
  75%      { transform: translateX(-2px); }
}

.hud-controls { display: flex; gap: var(--sp-2); }
.icon-btn {
  background: var(--ink-raised);
  border: 2px solid var(--gutter);
  color: var(--text);
  border-radius: var(--r-sm);
  width: clamp(28px, 6vw, 32px);
  height: clamp(28px, 6vw, 32px);
  font-size: 13px;
  cursor: pointer;
  box-shadow: 2px 2px 0 var(--gutter);
  transition: transform .1s ease, box-shadow .1s ease, background .15s ease;
}
.icon-btn:hover { background: var(--ink-panel); transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--gutter); }
.icon-btn:active { transform: translate(1px, 1px); box-shadow: 0 0 0 var(--gutter); }

/* ---------- Stage / canvas ---------- */

#stage {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: clamp(var(--sp-2), 1.4vw, var(--sp-4));
}

#canvas-wrap {
  position: relative;
  width: 100%;
  flex: 1;
  min-height: 0;
  border: 3px solid var(--gutter);
  border-radius: var(--r-lg);
  background: var(--ink-panel);
  overflow: hidden;
  box-shadow: var(--shadow-flat-lg), 0 18px 36px -18px rgba(0,0,0,0.8);
  transition: box-shadow .2s ease;
}

#canvas-wrap.active {
  box-shadow: var(--shadow-flat-lg), 0 0 0 2px var(--blue), 0 18px 36px -18px rgba(0,0,0,0.8);
}

#canvas-wrap.shake { animation: screen-shake 0.26s ease; }
@keyframes screen-shake {
  0%, 100% { transform: translate(0, 0); }
  25%      { transform: translate(-3px, 2px); }
  50%      { transform: translate(3px, -2px); }
  75%      { transform: translate(-2px, 1px); }
}

#canvas-wrap::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, rgba(243,232,205,0.04) 1px, transparent 1.3px) 0 0/16px 16px;
  pointer-events: none;
  z-index: 1;
}

canvas#swingbot {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: crosshair;
  position: relative;
  z-index: 2;
}

/* corner marks — simplified from a busy conic burst to a clean
   quarter-ring accent: reads as premium, not cluttered */
#canvas-wrap .pad-tl, #canvas-wrap .pad-tr,
#canvas-wrap .pad-bl, #canvas-wrap .pad-br {
  content: "";
  position: absolute;
  width: 12px; height: 12px;
  z-index: 3;
  border: 2px solid var(--pow);
  opacity: 0.75;
}
.pad-tl { top: 8px;    left: 8px;  border-right: none;  border-bottom: none; border-top-left-radius: 4px; }
.pad-tr { top: 8px;    right: 8px; border-left: none;   border-bottom: none; border-top-right-radius: 4px; }
.pad-bl { bottom: 8px; left: 8px;  border-right: none;  border-top: none;    border-bottom-left-radius: 4px; }
.pad-br { bottom: 8px; right: 8px; border-left: none;   border-top: none;   border-bottom-right-radius: 4px; }

/* combo callout — speech-bubble, tightened proportions */
.combo-toast {
  position: absolute;
  top: 16px; left: 50%;
  transform: translate(-50%, -8px) scale(0.88);
  font-family: var(--font-display);
  font-size: clamp(12px, 2.6vw, 15px);
  letter-spacing: 0.3px;
  color: var(--gutter);
  background: var(--paper);
  border: 2px solid var(--gutter);
  border-radius: var(--r-md);
  padding: var(--sp-2) var(--sp-4);
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease, transform .22s cubic-bezier(.34,1.56,.64,1);
  z-index: 4;
}
.combo-toast::after {
  content: "";
  position: absolute;
  bottom: -8px; left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--gutter);
}
.combo-toast.show { opacity: 1; transform: translate(-50%, 0) scale(1); }
.combo-toast.show.big {
  background: var(--pow);
  color: var(--red-dim);
  font-size: clamp(15px, 3.6vw, 19px);
  animation: combo-punch 0.36s ease;
}
@keyframes combo-punch {
  0%   { transform: translate(-50%, 0) scale(1.35); }
  100% { transform: translate(-50%, 0) scale(1); }
}

.score-float {
  position: absolute;
  font-family: var(--font-display);
  font-size: clamp(13px, 2.8vw, 16px);
  color: var(--success);
  pointer-events: none;
  z-index: 4;
  animation: score-float-up 0.85s ease-out forwards;
}
@keyframes score-float-up {
  0%   { opacity: 1; transform: translateY(0) scale(0.9); }
  20%  { transform: translateY(-6px) scale(1.1); }
  100% { opacity: 0; transform: translateY(-36px) scale(1); }
}

/* ---------- Overlays ---------- */

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(11, 11, 15, 0.92);
  backdrop-filter: blur(3px);
  z-index: 5;
  padding: var(--sp-4);
}
.overlay.hidden { display: none; }
.hidden { display: none !important; }

#overlay-ad { position: static; flex-shrink: 0; margin-top: var(--sp-3); border-radius: var(--r-md); }

.panel {
  width: 100%;
  max-width: 340px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-3);
  background: var(--ink-panel);
  border: 2px solid var(--gutter);
  border-radius: var(--r-lg);
  padding: clamp(var(--sp-5), 5vw, var(--sp-6)) clamp(var(--sp-4), 4vw, var(--sp-5));
  box-shadow: var(--shadow-flat-lg);
  animation: panel-enter 0.3s cubic-bezier(.2,.9,.3,1.1);
}
@keyframes panel-enter {
  0%   { opacity: 0; transform: scale(0.94) translateY(8px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

.panel-eyebrow {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 2.5px;
  color: var(--blue);
  text-transform: uppercase;
}

.panel h1 {
  font-family: var(--font-display);
  font-size: clamp(22px, 5.6vw, 29px);
  letter-spacing: 0.5px;
  color: var(--text);
  text-shadow: 2px 2px 0 var(--red);
  text-transform: uppercase;
}

.panel-copy {
  font-size: 13px;
  font-weight: 400;
  line-height: 1.55;
  color: var(--text-dim);
  margin-bottom: 2px;
}

.panel-hint {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  margin-top: 2px;
}

.btn-primary {
  font-family: var(--font-display);
  font-size: clamp(13px, 3vw, 15px);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  background: var(--red);
  color: var(--text);
  border: 2px solid var(--gutter);
  padding: 12px 22px;
  border-radius: var(--r-md);
  cursor: pointer;
  width: 100%;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-lift);
  transition: transform .12s ease, box-shadow .12s ease;
}
.btn-primary::before {
  content: "";
  position: absolute;
  top: 0; left: -60%;
  width: 35%; height: 100%;
  background: linear-gradient(120deg, transparent, rgba(255,255,255,0.32), transparent);
  transform: skewX(-20deg);
  opacity: 0;
  transition: opacity .2s ease;
}
.btn-primary:hover::before { opacity: 1; animation: btn-shine 1.1s ease-out; }
@keyframes btn-shine {
  0%   { left: -60%; }
  100% { left: 130%; }
}
.btn-primary:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--gutter); }
.btn-primary:active { transform: translate(2px, 2px); box-shadow: 0 0 0 var(--gutter); }

.btn-ghost {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  background: var(--ink-raised);
  border: 2px dashed var(--blue);
  color: var(--blue);
  padding: 10px 16px;
  border-radius: var(--r-md);
  cursor: pointer;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: border-color .15s ease, color .15s ease, transform .1s ease;
}
.btn-ghost:hover { border-color: var(--pow); color: var(--pow); }
.btn-ghost:active { transform: scale(0.98); }
.btn-ghost:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-sub { font-size: 9px; color: var(--text-dim); font-weight: 400; }

.over-score-row {
  display: flex;
  gap: clamp(var(--sp-5), 6vw, var(--sp-6));
  margin: var(--sp-1) 0 var(--sp-3);
}
.over-score {
  font-family: var(--font-display);
  font-size: clamp(26px, 7.4vw, 33px);
  color: var(--pow);
  animation: score-reveal 0.45s cubic-bezier(.2,.9,.3,1.15);
}
@keyframes score-reveal {
  0%   { opacity: 0; transform: translateY(6px) scale(0.85); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
.over-score-best { color: var(--blue); }
.over-score-best.record { animation: record-glow 1.1s ease-in-out infinite; }
@keyframes record-glow {
  0%, 100% { filter: drop-shadow(0 0 2px rgba(51,87,214,0.4)); }
  50%      { filter: drop-shadow(0 0 8px rgba(51,87,214,0.9)); }
}

.over-caption {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--danger);
  margin-top: -2px;
}

.shield-stat .stat-value { color: var(--blue); }

/* ---------- Character select ---------- */

.char-select {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-2);
  width: 100%;
  margin: 2px 0;
}

.char-chip {
  background: var(--ink-raised);
  border: 2px solid var(--gutter);
  border-radius: var(--r-sm);
  padding: 6px 4px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  box-shadow: 2px 2px 0 var(--gutter);
  transition: transform .12s ease, box-shadow .12s ease;
}
.char-chip:hover { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--gutter); }
.char-chip:active { transform: translate(1px, 1px); box-shadow: 0 0 0 var(--gutter); }
.char-chip.selected {
  border-color: var(--pow);
  box-shadow: 2px 2px 0 var(--pow);
  animation: chip-select-pop 0.25s cubic-bezier(.34,1.56,.64,1);
}
@keyframes chip-select-pop {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.06); }
  100% { transform: scale(1); }
}
.char-chip img { width: 22px; height: 34px; }
.char-chip-name {
  font-family: var(--font-mono);
  font-size: 7.5px;
  font-weight: 500;
  letter-spacing: 0.3px;
  color: var(--text-dim);
  text-align: center;
  line-height: 1.2;
}
.char-chip.selected .char-chip-name { color: var(--text); }

.char-tagline {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: clamp(11px, 2.6vw, 12.5px);
  color: var(--red);
  letter-spacing: 0.2px;
  min-height: 14px;
}

/* ---------- Ad slots ---------- */

.ad-slot {
  border: 2px dashed var(--text-dim);
  border-radius: var(--r-md);
  background: var(--ink-raised);
  display: flex;
  align-items: center;
  justify-content: center;
}
.ad-slot-placeholder {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.5px;
  line-height: 1.6;
}
.ad-slot-note { color: var(--blue); }

.ad-slot-interstitial { width: 280px; max-width: 100%; height: 180px; margin: var(--sp-2) 0; }
.ad-countdown { font-family: var(--font-mono); font-size: 11px; color: var(--text-dim); }

#ad-banner-wrap { flex-shrink: 0; display: flex; justify-content: center; }
.ad-slot-banner { width: 320px; max-width: 100%; height: 50px; }

/* ---------- Recording ---------- */

.rec-indicator {
  position: absolute;
  top: 14px; right: 14px;
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--paper);
  border: 2px solid var(--gutter);
  color: var(--red-dim);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 3px 8px;
  border-radius: 20px;
  z-index: 4;
}
.rec-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--red);
  animation: rec-pulse 1s ease-in-out infinite;
}
@keyframes rec-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.25; }
}

.recording-output {
  flex-shrink: 0;
  display: flex;
  justify-content: center;
  margin-top: 4px;
}
.recording-link {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--blue);
  text-decoration: none;
  border: 2px dashed var(--blue-dim);
  border-radius: var(--r-md);
  padding: 8px 14px;
  transition: border-color .15s ease;
}
.recording-link:hover { border-color: var(--blue); }

/* ============================================================
   RESPONSIVE — desktop, laptop, tablet, mobile portrait & landscape
   ============================================================ */

@media (min-width: 1024px) {
  #app { max-width: 900px; margin: 0 auto; }
  .panel { max-width: 380px; }
}

@media (min-width: 640px) and (max-width: 1023px) {
  #app { max-width: 720px; margin: 0 auto; }
}

@media (max-width: 480px) {
  .char-chip { padding: 4px 2px 6px; }
  .char-chip-name { font-size: 6.6px; }
  .hud-stats { gap: 8px; }
  #hud { padding: 6px 10px; }
}

@media (orientation: landscape) and (max-height: 480px) {
  #app { gap: 4px; padding: 4px; }
  #hud { padding: 4px 10px; }
  .hud-brand-text { font-size: 13px; }
  .panel { padding: 12px 16px; gap: 6px; }
  .panel h1 { font-size: 17px; }
  .panel-copy { font-size: 11px; margin-bottom: 0; }
  .char-select { gap: 4px; }
}

@media (max-width: 340px) {
  .hud-stats { gap: 6px; }
  .stat { min-width: 26px; }
  .icon-btn { width: 28px; height: 28px; }
        }
