* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: radial-gradient(circle at 50% 0%, #2b3a5c 0%, #121829 65%, #0b0f1c 100%);
  color: #f7fbff;
  font-family: "Segoe UI", "Inter", system-ui, -apple-system, sans-serif;
  overflow-x: hidden;
}

#wrap {
  position: relative;
  width: min(100%, 1040px);
  margin: 0 auto;
  padding: 14px 12px 26px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

canvas#game {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  display: block;
  border-radius: 18px;
  border: 3px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45), inset 0 0 0 1px rgba(255,255,255,.08);
  background: #8ed7ff;
  touch-action: none;
  cursor: pointer;
}

.controls {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  width: 100%;
  user-select: none;
}

.cbtn {
  flex: 1 1 110px;
  max-width: 170px;
  min-height: 54px;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #dfeaf7 100%);
  color: #203352;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: .02em;
  box-shadow: 0 6px 0 #9fb2cc, 0 10px 18px rgba(0,0,0,.25);
  cursor: pointer;
  transition: transform .06s ease, box-shadow .06s ease;
  touch-action: none;
}

.cbtn.main {
  background: linear-gradient(180deg, #ffe27a 0%, #ffb83d 100%);
  box-shadow: 0 6px 0 #c9821a, 0 10px 18px rgba(0,0,0,.25);
}

.cbtn.down {
  transform: translateY(5px);
  box-shadow: 0 1px 0 #9fb2cc, 0 4px 8px rgba(0,0,0,.2);
}

.cbtn.disabled {
  opacity: .28;
  filter: grayscale(.7);
  box-shadow: none;
  cursor: default;
}

.utility {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  width: 100%;
  margin-top: -2px;
}

.utility button {
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.25);
  background: rgba(255,255,255,.08);
  color: #dff1ff;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
}

.utility button:hover,
.utility button:focus-visible {
  background: rgba(255,255,255,.17);
  outline: none;
}

.utility button:disabled {
  opacity: .35;
  cursor: default;
  background: rgba(255,255,255,.04);
}

.tilt { display: none; }
.tilt.on { background: rgba(63, 190, 110, .55); }

@media (pointer: fine) and (min-width: 860px) {
  .controls { opacity: .82; }
  .cbtn { max-width: 140px; min-height: 46px; font-size: 14px; }
}

@media (max-width: 560px) {
  #wrap { padding: 8px 8px 18px; gap: 8px; }
  .cbtn { flex-basis: 44px; min-height: 50px; font-size: 14px; }
  .cbtn.main { flex-basis: 120px; }
  .utility { margin-top: 0; }
  .utility button { padding: 6px 10px; font-size: 11px; }
}
