:root {
  --panel: #0b1220cc;
  --muted: #000000;

  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: #000000;
  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;
  background: #000000;
}

.sky-layer {
  position: absolute;
  inset: 0;
  background: #000000;
}

.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;
  position: relative;
  z-index: 1;

  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: #ffffff;
}

.sub {
  color: var(--muted);
  font-size: 13px;
}

.panel {
  --panel-row-height: clamp(28px, 6vw, 36px);
  --panel-rule-size: 2px;
  background: repeating-linear-gradient(
    180deg,
    #f9d85b 0,
    #f9d85b calc(var(--panel-row-height) - var(--panel-rule-size)),
    #2f76c8 calc(var(--panel-row-height) - var(--panel-rule-size)),
    #2f76c8 calc(var(--panel-row-height) + var(--panel-rule-size)),
    #f6cf46 calc(var(--panel-row-height) + var(--panel-rule-size)),
    #f6cf46 var(--panel-row-height)
  );
  background-position: 0 0;
  background-size: 100% var(--panel-row-height);
  line-height: var(--panel-row-height);
  padding: calc(var(--panel-row-height) / 2) 12px;
  border-radius: 12px;
  color: #ffffff;
  backdrop-filter: none;
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: none;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

.panel > * {
  line-height: inherit;
}

.panel .sub,
.panel .muted {
  color: #ffffff;
}

.panel button {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.8);
  color: #ffffff;
}

.sidebar .panel {
  background: linear-gradient(180deg, #f9d85b 0%, #f6cf46 100%);
  background-size: auto;
  background: #6B3A1E;
  border-radius: 8px;
}

.sidebar .panel:nth-of-type(1) {
  background: #F4D900;
}

.sidebar .leaderboard-panel {
  background: #D52B1E;
}

.sidebar .info-panel {
  background: #0033A0;
}
.info-panel {
  padding: 10px 12px;
}

.info-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.info-table .label {
  font-weight: 600;
  padding: 0 8px 0 0;
  white-space: nowrap;
  color: #ffffff;
  height: var(--panel-row-height);
}

.info-table .value {
  padding: 0;
  vertical-align: middle;
  height: var(--panel-row-height);
  width: 100%;
}

.x-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 8px;
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  text-decoration: none;
}

.x-link:hover {
  background: rgba(255, 255, 255, 0.16);
}

.x-icon {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.copyable {
  display: inline-block;
  max-width: 100%;
  background: #ffffff;
  border: 1px solid #000000;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
  position: relative;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.copyable[data-status="copied"]::after {
  content: "Copied!";
  position: absolute;
  right: 8px;
  top: -18px;
  font-size: 11px;
  background: #000000;
  color: #ffffff;
  padding: 2px 6px;
  border-radius: 8px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

.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;
  z-index: 2;
}

#startScreen,
#settingsModal,
#gameOverScreen {
  z-index: 3;
}

#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(0, 51, 160, 0.94)),
    linear-gradient(180deg, rgba(0, 51, 160, 0.94) 0%, rgba(0, 51, 160, 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(0, 51, 160, 0.94) 0%, rgba(0, 51, 160, 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(0, 51, 160, 0.9) 0%, rgba(0, 51, 160, 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(0, 51, 160, 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(0, 51, 160, 0.92) 0%, rgba(0, 51, 160, 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(0, 51, 160, 0.96) 0%, rgba(0, 51, 160, 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: 0;
}

.lb li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: var(--panel-row-height);
  padding: 0 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 (choose somale) --- */

.settings-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.skin-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  flex-direction: row;
  flex-wrap: wrap;
}

.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 .lb {
    max-height: min(50vh, 420px);
  }

  canvas {
    height: 60vh;
  }
}





