/* ==== CSS Variables ==== */
:root {
  --bg-color: #333;
  --bg-panel: #444;
  --bg-canvas: #EEE;
  --text-color: white;
  --text-color-alt: lightgray;
  --text-color-alt2: black;
  --btn-start: #28a745;
  --btn-pause: #ff8800;
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
  --font-family: Arial, sans-serif;
}

/* ==== Global Reset ==== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  /* outline: 1px red dashed; */
}

html, body {
  overflow: hidden;
}

/* ==== App Layout ==== */
body {
  background-color: var(--bg-color);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  font-family: var(--font-family);
}

.app {
  width: 370;
  max-width: 370px;
  height: 640;
  max-height: 640px;
  position: relative;
  background-color: var(--bg-color);
  color: var(--text-color);
  box-shadow: var(--shadow);
  border-radius: 12px;
  margin: 10px;
}

/* ==== Header ==== */
.header {
  width: 100%;
  height: 80px;
  background-color: var(--bg-panel);
  display: flex;
  flex-direction: column;
  border-top-left-radius: 12px;
  border-top-right-radius: 12px;
  overflow: hidden;
}

.header-title {
  height: 45px;
  font-family: 'Orbitron', var(--font-family);
  font-size: 28px;
  text-shadow: 2px 2px 4px black;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ==== Header Controls ==== */
.header-content {
  height: 35px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 0 4px;
  font-size: 12px;
}

.header-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#lives {
  display: inline-block;
  transform: translateY(2px) scale(2);
  color: var(--text-color);
  line-height: 1.0;
}

/* ==== Buttons ==== */
#startButton {
  width: 66px;
  padding: 2px 6px;
  font-size: 12px;
  font-weight: bold;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  pointer-events: auto;
  position: relative;
  z-index: 10;
  color: var(--text-color);
}

#startButton.start {
  background-color: var(--btn-start);
}

#startButton.pause {
  background-color: var(--btn-pause);
}

#soundToggle {
  background: none;
  border: none;
  font-size: 16px;
  cursor: pointer;
  pointer-events: auto;
  position: relative;
  z-index: 10;
  color: var(--text-color);
}

/* ==== Main ==== */
.main {
  position: relative;
  width: 100%;
  height: 540px;
  background-color: var(--bg-canvas);
  border: 2px solid #333;
  box-sizing: border-box;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.ball-stats {
  position: absolute;
  bottom: 5px;
  width: 100%;
  padding: 0 8px;
  font-size: 10px;
  display: flex;
  justify-content: space-between;
  color: var(--text-color-alt2);
  pointer-events: none;
}

#ballInfo,
#speedInfo {
  white-space: nowrap;
}

/* ==== Footer ==== */
.footer {
  width: 100%;
  height: 20px;
  background-color: var(--bg-panel);
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 10px;
  border-bottom-left-radius: 12px;
  border-bottom-right-radius: 12px;
  overflow: hidden;
}

.footer-content {
  width: 100%;
  display: flex;
  justify-content: space-between;
  padding: 0 10px;
  color: var(--text-color-alt);
}

.footer a {
  color: var(--text-color-alt);
  text-decoration: none;
}