:root {
  --bg: #07111c;
  --panel: rgba(10, 18, 30, 0.82);
  --line: rgba(120, 229, 255, 0.18);
  --text: #f3f8ff;
  --muted: #9eb8ce;
  --cyan: #62dfff;
  --gold: #ffd249;
  --red: #ff7a69;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.4);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: radial-gradient(circle at top, #13395f 0%, #091726 44%, #02060d 100%);
  color: var(--text);
  font-family: "Arial Black", "Trebuchet MS", sans-serif;
}

button,
a {
  font: inherit;
}

#app,
#gameCanvas {
  width: 100%;
  height: 100%;
}

#app {
  position: relative;
}

#gameCanvas {
  display: block;
}

.hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.topbar {
  position: absolute;
  top: 18px;
  left: 18px;
  right: 18px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  justify-content: space-between;
}

.panel {
  backdrop-filter: blur(12px);
  background: linear-gradient(180deg, rgba(18, 32, 51, 0.95), var(--panel));
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.brand,
.scoreline,
.timer,
.pause-button,
.side,
.controls {
  padding: 12px 16px;
}

.brand {
  min-width: 250px;
}

.eyebrow {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 11px;
}

.title {
  margin-top: 6px;
  font-size: 24px;
  color: #f7fbff;
}

.scoreline {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
}

.scoreline strong {
  min-width: 100px;
  text-align: center;
  font-size: 30px;
  color: var(--gold);
}

.timer {
  font-size: 28px;
  font-weight: 900;
}

.pause-button {
  pointer-events: auto;
  border: 0;
  color: #03121c;
  font-weight: 900;
  cursor: pointer;
  background: linear-gradient(180deg, #f2f7ff, #9dc7de);
}

.side {
  position: absolute;
  top: 92px;
  left: 18px;
  min-width: 250px;
}

.status {
  margin-top: 8px;
  font-size: 15px;
  color: #f4fbff;
}

.controls {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  max-width: min(820px, calc(100vw - 36px));
  text-align: center;
  color: var(--muted);
  line-height: 1.45;
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(4, 9, 16, 0.44);
}

.overlay.hidden {
  display: none;
}

.touch-ui {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.touch-ui.hidden {
  display: none;
}

.touch-stick {
  position: absolute;
  left: 18px;
  bottom: 22px;
  width: 132px;
  height: 132px;
  pointer-events: auto;
  touch-action: none;
}

.touch-stick-base,
.touch-stick-knob {
  position: absolute;
  border-radius: 50%;
}

.touch-stick-base {
  inset: 0;
  background: radial-gradient(circle at 30% 30%, rgba(130, 229, 255, 0.28), rgba(9, 20, 35, 0.78));
  border: 1px solid rgba(120, 229, 255, 0.24);
  box-shadow: var(--shadow);
}

.touch-stick-knob {
  width: 54px;
  height: 54px;
  left: 39px;
  top: 39px;
  background: linear-gradient(180deg, #e7f7ff, #86bfd7);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
}

.touch-actions {
  position: absolute;
  right: 18px;
  bottom: 20px;
  width: 210px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  pointer-events: auto;
}

.touch-btn {
  min-height: 54px;
  border: 0;
  border-radius: 18px;
  color: #05141f;
  font-weight: 900;
  background: linear-gradient(180deg, #f2f7ff, #9dc7de);
  box-shadow: var(--shadow);
  touch-action: manipulation;
}

.touch-btn-wide {
  grid-column: 1 / -1;
}

.overlay-card {
  width: min(580px, calc(100vw - 32px));
  padding: 28px;
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(18, 33, 52, 0.98), rgba(7, 15, 24, 0.98));
  border: 1px solid rgba(120, 229, 255, 0.18);
  box-shadow: var(--shadow);
  text-align: center;
}

.overlay-card h1 {
  margin: 10px 0 8px;
  font-size: 46px;
}

.overlay-card p {
  margin: 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.5;
}

.overlay-actions {
  margin-top: 20px;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}

#startButton,
.back-link {
  pointer-events: auto;
  border: 0;
  border-radius: 999px;
  padding: 14px 26px;
  text-decoration: none;
}

#startButton {
  background: linear-gradient(180deg, #ffd54b, #ff9f1f);
  color: #231300;
  font-weight: 900;
  cursor: pointer;
}

#startButton:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.back-link {
  background: linear-gradient(180deg, #5be4ff, #1699be);
  color: #041722;
}

@media (max-width: 760px) {
  .topbar {
    flex-wrap: wrap;
  }

  .side {
    top: auto;
    bottom: 94px;
    left: 18px;
    right: 18px;
    min-width: 0;
  }

  .controls {
    bottom: 14px;
  }

  .touch-stick {
    width: 118px;
    height: 118px;
    bottom: 18px;
  }

  .touch-stick-knob {
    width: 48px;
    height: 48px;
    left: 35px;
    top: 35px;
  }

  .touch-actions {
    width: 184px;
    bottom: 16px;
  }

  .touch-btn {
    min-height: 50px;
    font-size: 14px;
  }

  .overlay-card h1 {
    font-size: 34px;
  }
}
