:root {
  --bg: #0f1724;
  --panel: #0b1220cc;
  --accent: #ffcc00;
  --muted: #000000;
  --glass: rgba(255,255,255,0.03);
  --xp-blue: #0d5ecb;
  --xp-blue-dark: #11408b;
  --xp-cream: #f1efe2;

  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
}

/* --- BASE LAYOUT --- */

html, body {
  height: 100%;
  margin: 0;
  color: #e6eef8;
}

body {
  background: #050914;
  position: relative;
  min-height: 100vh;
  overflow-y: auto;
}

.background {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  z-index: 0;
  pointer-events: none;
}

.sky-layer {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, #0a1433 0%, #152c66 55%, #f5792a 90%);
}

.mountains {
  position: absolute;
  inset: 55vh -5vw -12vh -5vw;
  background: linear-gradient(180deg, rgba(19,28,51,0.95), rgba(8,12,25,0.9));
  clip-path: polygon(0 55%, 10% 45%, 18% 60%, 26% 38%, 35% 58%, 46% 36%, 55% 62%, 64% 40%, 72% 60%, 82% 32%, 90% 55%, 100% 42%, 100% 100%, 0 100%);
  filter: drop-shadow(0 -6px 12px rgba(0,0,0,0.35));
}

.mountains.back {
  inset: 50vh -8vw -10vh -8vw;
  background: linear-gradient(180deg, rgba(24,36,70,0.8), rgba(13,20,40,0.8));
  transform: translateY(4vh) scale(1.05);
  opacity: 0.65;
}

.mountains.mid {
  inset: 55vh -6vw -12vh -6vw;
  background: linear-gradient(180deg, rgba(18,28,52,0.9), rgba(10,15,30,0.92));
  transform: translateY(1vh);
}

.mountains.front {
  inset: 62vh -6vw -14vh -6vw;
  background: linear-gradient(180deg, #0c162c, #050a18);
  transform: translateY(-2vh) scale(1.02);
  clip-path: polygon(0 50%, 7% 38%, 14% 55%, 22% 32%, 32% 56%, 40% 30%, 50% 58%, 60% 35%, 70% 60%, 82% 34%, 92% 58%, 100% 44%, 100% 100%, 0 100%);
}

.energy-beam {
  position: absolute;
  left: -10vw;
  top: 52vh;
  width: 120vw;
  height: 12vh;
  background: linear-gradient(90deg, #b1f4ff 0%, #7df2ff 30%, #f7ff64 60%, #fff59d 75%, #7df2ff 100%);
  box-shadow: 0 0 25px rgba(125, 242, 255, 0.8), 0 0 50px rgba(255, 245, 157, 0.65);
  border-radius: 8vh;
  filter: blur(0.5px);
  animation: beamPulse 2.4s ease-in-out infinite;
  z-index: 3;
}

.energy-beam::after {
  content: '';
  position: absolute;
  inset: 10% 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.9) 25%, rgba(255,255,255,0.6) 45%, transparent 70%);
  mix-blend-mode: screen;
  filter: blur(2px);
}

.floating-rock {
  position: absolute;
  width: 12vw;
  height: 8vh;
  background: linear-gradient(180deg, #1d2b4b, #0a1025);
  clip-path: polygon(10% 5%, 30% 0%, 60% 8%, 85% 20%, 100% 55%, 80% 80%, 50% 100%, 20% 80%, 0% 45%);
  box-shadow: 0 12px 18px rgba(0,0,0,0.35);
  z-index: 2;
}

.floating-rock.r1 { top: 14vh; left: 18vw; transform: scale(0.9); }
.floating-rock.r2 { top: 20vh; left: 65vw; transform: scale(1.1); }
.floating-rock.r3 { top: 32vh; left: 78vw; transform: scale(0.8) rotate(-4deg); }

.dragon-ball {
  --ball-size: clamp(56px, 6vw, 110px);
  position: absolute;
  width: var(--ball-size);
  height: var(--ball-size);
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #ffe9a3 0%, #ffb347 38%, #ff9100 60%, #d96a00 85%);
  box-shadow: 0 0 14px rgba(255, 145, 0, 0.7), 0 0 28px rgba(255, 138, 0, 0.45);
  z-index: 4;
  display: grid;
  place-items: center;
  animation: orbGlow 3s ease-in-out infinite;
}

.dragon-ball .stars {
  position: relative;
  width: calc(var(--ball-size) * 0.64);
  height: calc(var(--ball-size) * 0.64);
  display: block;
}

.dragon-ball .star {
  --star-size: clamp(6px, calc(var(--ball-size) * 0.16), 16px);
  position: absolute;
  width: var(--star-size);
  height: var(--star-size);
  background: #c00015;
  clip-path: polygon(50% 0%, 63% 35%, 100% 35%, 68% 57%, 82% 92%, 50% 70%, 18% 92%, 32% 57%, 0% 35%, 37% 35%);
  filter: drop-shadow(0 0 3px rgba(192, 0, 21, 0.45));
  opacity: 0.9;
}

.stars-1 .star:nth-child(1) { top: 50%; left: 50%; transform: translate(-50%, -50%); }

.stars-2 .star:nth-child(1) { top: 43%; left: 38%; transform: translate(-50%, -50%); }
.stars-2 .star:nth-child(2) { top: 57%; left: 62%; transform: translate(-50%, -50%); }

.stars-3 .star:nth-child(1) { top: 36%; left: 50%; transform: translate(-50%, -50%); }
.stars-3 .star:nth-child(2) { top: 60%; left: 36%; transform: translate(-50%, -50%); }
.stars-3 .star:nth-child(3) { top: 60%; left: 64%; transform: translate(-50%, -50%); }

.stars-4 .star:nth-child(1) { top: 38%; left: 36%; transform: translate(-50%, -50%); }
.stars-4 .star:nth-child(2) { top: 38%; left: 64%; transform: translate(-50%, -50%); }
.stars-4 .star:nth-child(3) { top: 64%; left: 36%; transform: translate(-50%, -50%); }
.stars-4 .star:nth-child(4) { top: 64%; left: 64%; transform: translate(-50%, -50%); }

.stars-5 .star:nth-child(1) { top: 32%; left: 50%; transform: translate(-50%, -50%); }
.stars-5 .star:nth-child(2) { top: 48%; left: 30%; transform: translate(-50%, -50%); }
.stars-5 .star:nth-child(3) { top: 48%; left: 70%; transform: translate(-50%, -50%); }
.stars-5 .star:nth-child(4) { top: 68%; left: 38%; transform: translate(-50%, -50%); }
.stars-5 .star:nth-child(5) { top: 68%; left: 62%; transform: translate(-50%, -50%); }

.stars-6 .star:nth-child(1) { top: 34%; left: 36%; transform: translate(-50%, -50%); }
.stars-6 .star:nth-child(2) { top: 34%; left: 64%; transform: translate(-50%, -50%); }
.stars-6 .star:nth-child(3) { top: 50%; left: 30%; transform: translate(-50%, -50%); }
.stars-6 .star:nth-child(4) { top: 50%; left: 70%; transform: translate(-50%, -50%); }
.stars-6 .star:nth-child(5) { top: 68%; left: 42%; transform: translate(-50%, -50%); }
.stars-6 .star:nth-child(6) { top: 68%; left: 58%; transform: translate(-50%, -50%); }

.stars-7 .star:nth-child(1) { top: 32%; left: 50%; transform: translate(-50%, -50%); }
.stars-7 .star:nth-child(2) { top: 44%; left: 32%; transform: translate(-50%, -50%); }
.stars-7 .star:nth-child(3) { top: 44%; left: 68%; transform: translate(-50%, -50%); }
.stars-7 .star:nth-child(4) { top: 58%; left: 30%; transform: translate(-50%, -50%); }
.stars-7 .star:nth-child(5) { top: 58%; left: 70%; transform: translate(-50%, -50%); }
.stars-7 .star:nth-child(6) { top: 72%; left: 40%; transform: translate(-50%, -50%); }
.stars-7 .star:nth-child(7) { top: 72%; left: 60%; transform: translate(-50%, -50%); }

.db1 { bottom: 14vh; left: 12vw; }
.db2 { bottom: 18vh; left: 38vw; }
.db3 { bottom: 10vh; left: 62vw; }
.db4 { bottom: 22vh; left: 82vw; }
.db5 { bottom: 28vh; left: 22vw; }
.db6 { bottom: 8vh; left: 30vw; }
.db7 { bottom: 26vh; left: 70vw; }

.flying-cloud {
  position: absolute;
    width: 13.2vw;
  height: 7.2vw;
  min-width: 120px;
  min-height: 66px;
  max-width: 216px;
  max-height: 114px;
  background: radial-gradient(circle at 40% 40%, #ffe891 0%, #f7d94a 45%, #e7b723 78%, #c98f11 100%);
  border-radius: 54% 58% 50% 52%;
  box-shadow: -40px 10px 0 -18px #f7d94a, 32px -6px 0 -14px #f7d94a, -8px -28px 0 -12px #f7d94a,
              12px 30px 0 -12px #e7b723, 44px 22px 0 -16px #f7d94a;
  filter: drop-shadow(0 10px 16px rgba(0,0,0,0.35));
  opacity: 0.9;
  z-index: 3;
}

.flying-cloud::before,
.flying-cloud::after {
  content: '';
  position: absolute;
  background: radial-gradient(circle at 40% 40%, #ffe891 0%, #f7d94a 45%, #e7b723 78%, #c98f11 100%);
}

.flying-cloud::before {
  width: 60%;
  height: 60%;
  top: -18%;
  left: 14%;
  border-radius: 50%;
  box-shadow: 48px 10px 0 -8px #f7d94a, -32px 18px 0 -10px #f7d94a;
}

.flying-cloud::after {
  width: 42%;
  height: 30%;
  right: -26%;
  top: 44%;
  border-radius: 80% 40% 40% 80%;
  transform: skewX(-14deg) rotate(-4deg);
  box-shadow: 26px -8px 0 -6px #d9a41a;
}

.flying-cloud.c1 { top: 18vh; left: 8vw; transform: scale(1.05) rotate(-2deg); }
.flying-cloud.c2 { top: 12vh; left: 48vw; transform: scale(0.92) rotate(3deg); }
.flying-cloud.c3 { top: 26vh; left: 72vw; transform: scale(0.78) rotate(-1deg); }
.flying-cloud.c4 { top: 32vh; left: 26vw; transform: scale(0.88) rotate(2deg); }
.flying-cloud.c5 { top: 8vh; left: 84vw; transform: scale(0.9) rotate(-3deg); }

@keyframes beamPulse {
  0%, 100% { box-shadow: 0 0 18px rgba(125, 242, 255, 0.7), 0 0 40px rgba(255, 245, 157, 0.55); transform: translateY(0); }
  50% { box-shadow: 0 0 32px rgba(125, 242, 255, 0.9), 0 0 72px rgba(255, 245, 157, 0.8); transform: translateY(-1vh) scaleY(1.04); }
}

@keyframes orbGlow {
  0%, 100% { box-shadow: 0 0 14px rgba(255, 145, 0, 0.65), 0 0 26px rgba(255, 138, 0, 0.45); filter: brightness(1); }
  50% { box-shadow: 0 0 20px rgba(255, 145, 0, 0.85), 0 0 40px rgba(255, 138, 0, 0.65); filter: brightness(1.08); }
}

.wrap {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
  z-index: 1;
}

/* --- GAME CARD (600 × 1100 px) --- */

.game-card {
  width: min(600px, calc(100vw - 32px));
  height: min(1100px, calc(100vh - 32px));
  max-width: 600px;
  max-height: 1100px;

  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 16px;
  align-items: start;
}

.game-pane {
  position: relative;
  padding: 5px;
  background: var(--panel);
  border-radius: 14px;
  box-shadow: 0 6px 30px rgba(2,6,23,0.6);
  backdrop-filter: blur(6px);
}

/* --- GAME CANVAS --- */

canvas {
  background: linear-gradient(180deg, #041224, #062033);
  border-radius: 10px;
  display: block;

  width: 100%;
  height: 700px;    /* fits inside 1100px total layout */
  object-fit: cover;
}

/* --- SIDEBAR ---- */

.sidebar {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hud {
  display: flex;
  gap: 12px;
  align-items: center;
}

.score {
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
}

.sub {
  color: var(--muted);
  font-size: 13px;
}

.panel {
  background: rgba(240, 54, 119, 0.9);
  padding: 12px;
  border-radius: 12px;
  color: #f5f7ff;
  backdrop-filter: blur(8px);
  border: 1px solid rgba(189, 18, 86, 0.9);
  box-shadow: 0 12px 30px rgba(240, 54, 119, 0.35);
}

.powerups {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pwr {
  width: 64px;
  height: 64px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

button {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.06);
  color: inherit;
  padding: 10px;
  border-radius: 8px;
  cursor: pointer;
}

.large-btn {
  font-size: 16px;
  padding: 12px;
}

/* --- OVERLAYS --- */

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, rgba(4, 7, 15, 0.8), rgba(4, 7, 15, 0.92));
  padding: 14px;
  box-sizing: border-box;
}

#gameOverScreen {
  background: url('images/gameover.png');
  background-position: center;
  background-size: cover;
}

#startScreen {
  background: url('images/open.png');
  background-position: center;
  background-size: cover;
}

/* --- OVERLAY WINDOWS (energy / fire theme) --- */

.xp-window {␊
  width: min(92vw, 700px);␊
  background: radial-gradient(circle at 22% 18%, rgba(241, 214, 100, 0.12), rgba(68, 29, 70, 0.94)),
    linear-gradient(180deg, rgba(68, 29, 70, 0.94) 0%, rgba(68, 29, 70, 0.98) 100%);
  color: #ffffff;
  border: 3px solid #f1d664;
  border-radius: 14px;␊
  box-shadow: 0 18px 32px rgba(0,0,0,0.55), inset 0 0 10px rgba(241, 214, 100, 0.2);
  overflow: hidden;␊
  text-align: center;␊
  font-family: "Trebuchet MS", Tahoma, sans-serif;␊
}␊
␊
.xp-titlebar {␊
  background: linear-gradient(90deg, rgba(68, 29, 70, 0.94) 0%, rgba(68, 29, 70, 0.98) 100%);
  color: #ffffff;
  padding: 10px 14px;␊
  display: flex;␊
  align-items: center;␊
  justify-content: center;
  font-weight: 800;␊
  letter-spacing: 0.5px;␊
  text-transform: uppercase;␊
  box-shadow: inset 0 1px 0 rgba(241, 214, 100, 0.45), 0 3px 7px rgba(0,0,0,0.4);
}␊
␊
.xp-controls { display: none; gap: 6px; }
.xp-control {␊
  width: 18px;␊
  height: 18px;␊
  border-radius: 4px;
  background: linear-gradient(180deg, #fff2a3 0%, #f7d94a 100%);
  border: 1px solid #f7d94a;
  box-shadow: inset 0 0 4px rgba(255, 246, 200, 0.6);
  display: inline-block;
}
.xp-control.xp-close {
  background: linear-gradient(180deg, #ffe4e0 0%, #e25a2a 100%);
  border-color: #f5b49c;
}

.xp-body {␊
  padding: 18px 20px 22px;␊
  background: linear-gradient(180deg, rgba(68, 29, 70, 0.9) 0%, rgba(68, 29, 70, 0.98) 100%);
  text-align: center;␊
  border-top: 1px solid rgba(241, 214, 100, 0.42);
}␊
␊
.xp-heading {␊
  margin: 0 0 8px;␊
  color: #ffffff;
  text-shadow: 0 2px 8px rgba(0,0,0,0.45);
}␊
␊
.xp-subtext { margin: 0 0 12px; color: #ffffff; }
.xp-footnote { margin-top: 6px; color: #ffffff; }

.xp-field-row {
  display: flex;
  justify-content: center;
  margin: 12px 0;
}

.xp-input {␊
  width: min(360px, 100%);␊
  padding: 12px 14px;␊
  border-radius: 10px;␊
  border: 1px solid #f1d664;
  background: rgba(68, 29, 70, 0.6);
  color: #ffffff;
  font-size: 14px;␊
  box-shadow: inset 0 1px 8px rgba(241, 214, 100, 0.24);
}␊

.xp-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.xp-btn {
  background: linear-gradient(180deg, #f7e68a 0%, #f1d664 70%, #d9c33f 100%);
  border: 1px solid #f1d664;
  color: #000000;
  padding: 12px 16px;
  border-radius: 12px;
  box-shadow: 0 12px 20px rgba(0,0,0,0.32), inset 0 1px 0 rgba(255,248,217,0.8);
  cursor: pointer;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}

.xp-btn.large { padding: 14px 24px; }
.xp-btn:hover { transform: translateY(-1px); filter: none; box-shadow: 0 13px 24px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,248,217,0.9); }
.xp-btn:active { transform: translateY(0); box-shadow: inset 0 2px 8px rgba(0,0,0,0.28); background: linear-gradient(180deg, #e6cd62 0%, #c8ae36 100%); }
.xp-btn:disabled { cursor: not-allowed; color: #2b2300; background: linear-gradient(180deg, #c4b45c 0%, #8b7b33 100%); box-shadow: inset 0 1px 0 rgba(255,255,255,0.05); border-color: #c4b45c; }

.xp-window .sub,
.xp-window .muted { color: #ffffff; }

.dragonballer-title,
#startScreen .xp-heading { color: #d71c1d; }

#startScreen .xp-titlebar span { display: none; }

#startScreen .xp-window,
#gameOverScreen .xp-window {
  position: relative;
  background: linear-gradient(180deg, rgba(57, 25, 59, 0.92) 0%, rgba(38, 16, 39, 0.98) 100%);
  border-width: 6px;
}

#startScreen .xp-window::before,
#gameOverScreen .xp-window::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% -16%, rgba(241, 214, 100, 0.3) 0%, rgba(241, 214, 100, 0.08) 32%, transparent 55%);
  pointer-events: none;
  mix-blend-mode: screen;
}

#startScreen .xp-titlebar,
#startScreen .xp-body,
#gameOverScreen .xp-titlebar,
#gameOverScreen .xp-body {
  background: linear-gradient(180deg, rgba(71, 34, 71, 0.96) 0%, rgba(53, 20, 55, 0.98) 100%);
}

.start-window { max-width: 520px; }
.settings-window { max-width: 720px; }
.gameover-window { max-width: 460px; }

/* --- LEADERBOARD --- */

.lb {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.lb li {
  display: flex;
  justify-content: space-between;
  padding: 6px;
  border-radius: 6px;
}

.muted {
  color: var(--muted);
}

.leaderboard-panel {
  display: flex;
  flex-direction: column;
}

.leaderboard-panel .lb {
  margin: 0;
  padding: 0;
  list-style: none;
  max-height: 320px;
  overflow: auto;
}

/* --- SETTINGS GRID (only background + player skins now) --- */

.settings-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.skin-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  flex-direction: column;
}

.skin-option {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.skin-option input {
  transform: scale(1.05);
}

.skin-option span {
  white-space: nowrap;
  text-align: left;
}

.preview {
  border-radius: 8px;
  background: rgba(255,255,255,0.04);
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-repeat: no-repeat;
  background-position: center;
}

.player-preview {
  height: 96px;
  background-size: contain;
  background-position: center bottom;
  border: 1px solid rgba(17, 64, 139, 0.25);
}

.background-preview {
  height: 140px;
  aspect-ratio: 9 / 16;
  background-size: contain;
  background-position: center top;
  border: 1px solid rgba(17, 64, 139, 0.25);
}

/* --- RESPONSIVE (mobile fallback) --- */

@media (max-width: 860px) {
  body {
    overflow-y: auto;
  }

  .wrap {
    align-items: flex-start;
    padding-top: 28px;
    padding-bottom: 32px;
  }

  .game-card {
    width: 100%;
    max-width: 760px;
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .sidebar {
    flex-direction: column;
  }

  .leaderboard-panel {
    order: 4;
  }

   .leaderboard-panel .lb {
    max-height: min(50vh, 420px);
  }

  canvas {
    height: 60vh;
  }
}














