:root {
  --bg: #05060f;
  --panel: rgba(10, 14, 30, 0.92);
  --accent: #00e5ff;
  --accent2: #ff3df0;
  --text: #e8f0ff;
}

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

html, body {
  height: 100%;
  background:
    radial-gradient(circle at 50% 0%, #16204a 0%, var(--bg) 60%);
  color: var(--text);
  font-family: "Segoe UI", system-ui, sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.frame {
  width: min(94vw, 840px);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ---------- HUD ---------- */
.hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 18px;
  background: var(--panel);
  border: 1px solid rgba(0, 229, 255, 0.25);
  border-radius: 12px;
  box-shadow: 0 0 24px rgba(0, 229, 255, 0.12);
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 1px;
  min-width: 70px;
}

.stat .label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 2px;
  color: var(--accent);
  opacity: 0.8;
}

.stat.lives span:last-child { color: var(--accent2); }

.stat.speed { min-width: 92px; }
.stat.speed span:last-child {
  font-size: 17px;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

/* ---------- Stage / Canvas ---------- */
.stage {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(0, 229, 255, 0.3);
  box-shadow: 0 0 40px rgba(0, 229, 255, 0.15), inset 0 0 60px rgba(0, 0, 0, 0.6);
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  background:
    linear-gradient(180deg, #070a1c 0%, #0b1030 100%);
  cursor: none;
  touch-action: none;
}

/* ---------- Overlay ---------- */
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(3, 5, 15, 0.78);
  backdrop-filter: blur(4px);
  transition: opacity 0.25s ease;
}

.overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.panel {
  text-align: center;
  padding: 36px 44px;
  max-width: 460px;
}

.panel h1 {
  font-size: 54px;
  letter-spacing: 6px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 30px rgba(0, 229, 255, 0.4);
  margin-bottom: 10px;
}

.panel p {
  font-size: 16px;
  opacity: 0.85;
  margin-bottom: 18px;
}

.help {
  list-style: none;
  text-align: left;
  display: inline-block;
  margin-bottom: 24px;
  font-size: 14px;
  line-height: 1.9;
  opacity: 0.8;
}

.help b { color: var(--accent); }

.btn {
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 2px;
  color: #04111a;
  background: linear-gradient(90deg, var(--accent), #6df5ff);
  border: none;
  padding: 14px 34px;
  border-radius: 999px;
  cursor: pointer;
  margin: 6px;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  box-shadow: 0 0 22px rgba(0, 229, 255, 0.5);
}

.btn:hover { transform: translateY(-2px); box-shadow: 0 0 30px rgba(0, 229, 255, 0.8); }

.btn.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid rgba(232, 240, 255, 0.35);
  box-shadow: none;
}

.tip {
  text-align: center;
  font-size: 13px;
  line-height: 1.4;
  opacity: 0.55;
  letter-spacing: 0.5px;
  /* Fixed two-line box so swapping between the long default tip and
     short power-up/editor messages never reflows the layout (which
     would re-center the flex frame and jerk the canvas). */
  height: 2.8em;            /* 2 lines @ line-height 1.4 */
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* ---------- Menu extra buttons ---------- */
.extra-row {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin: 4px 0 2px;
}

#ov-custom[disabled] {
  opacity: 0.35;
  cursor: not-allowed;
}

/* ---------- Level editor ---------- */
.stage.editing canvas { cursor: crosshair; }

.editor-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--panel);
  border: 1px solid rgba(0, 229, 255, 0.25);
  border-radius: 12px;
  box-shadow: 0 0 24px rgba(0, 229, 255, 0.12);
}

.editor-bar.hidden { display: none; }

.palette, .eactions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.ebl {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--accent);
  opacity: 0.8;
}

.ptool {
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--text);
  background: transparent;
  border: 1px solid rgba(232, 240, 255, 0.3);
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.12s ease;
}

.ptool:hover { border-color: var(--accent); }

.ptool.active {
  color: #04111a;
  background: linear-gradient(90deg, var(--accent), #6df5ff);
  border-color: transparent;
  box-shadow: 0 0 14px rgba(0, 229, 255, 0.5);
}

.btn.sm {
  font-size: 13px;
  padding: 9px 18px;
  margin: 0;
}
