html, body {
  margin: 0;
  height: 100%;
  background: #120c18;
  overflow: hidden;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  font-family: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
}

canvas#game {
  position: fixed;
  inset: 0;
  display: block;
}

button { font-family: inherit; cursor: pointer; }

/* ---------- touch controls ---------- */
#touch { display: none; }
body.touch[data-state="play"] #touch { display: block; }

.pad {
  position: fixed;
  bottom: calc(12px + env(safe-area-inset-bottom));
}
.pad.left {
  left: calc(14px + env(safe-area-inset-left));
  display: flex;
  gap: 12px;
}
.pad.right {
  right: calc(14px + env(safe-area-inset-right));
  width: 250px;
  height: 196px;
}

.tbtn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.55);
  background: rgba(20, 14, 30, 0.42);
  color: #fff;
  font-size: 26px;
  line-height: 1;
  touch-action: none;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.35);
  transition: transform 0.05s, background 0.05s;
}
.tbtn.active {
  background: rgba(255, 210, 90, 0.55);
  transform: scale(0.92);
}
.tbtn.dir { width: 82px; height: 82px; font-size: 32px; }
.tbtn.big {
  position: absolute; right: 0; bottom: 0;
  width: 100px; height: 100px; font-size: 42px;
  background: rgba(200, 60, 40, 0.5);
}
.tbtn.mid { position: absolute; width: 70px; height: 70px; }
.tbtn.small { position: absolute; width: 52px; height: 52px; font-size: 22px; }
.tbtn[data-action="jump"]    { right: 110px; bottom: 0; }
.tbtn[data-action="block"]   { right: 16px;  bottom: 110px; }
.tbtn[data-action="swap"]    { right: 118px; bottom: 86px; }
.tbtn[data-action="special"] { right: 178px; bottom: 132px; background: rgba(255, 200, 60, 0.35); }

/* ---------- pause / sound buttons ---------- */
#sys {
  position: fixed;
  left: 50%;
  bottom: calc(10px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
}
#sys button {
  width: 44px; height: 44px;
  border-radius: 12px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  background: rgba(20, 14, 30, 0.5);
  color: #fff;
  font-size: 20px;
  padding: 0;
}
body[data-state="title"] #btnPause,
body[data-state="victory"] #btnPause { display: none; }

/* ---------- rotate-device prompt ---------- */
#rotate {
  display: none;
  position: fixed; inset: 0;
  background: #120c18;
  color: #ffd76a;
  font-size: 26px;
  font-weight: 900;
  text-align: center;
  align-items: center;
  justify-content: center;
  line-height: 1.6;
  z-index: 10;
}
body.touch.portrait #rotate { display: flex; }

/* smaller controls on short (landscape phone) screens */
@media (max-height: 440px) {
  .pad.right { width: 196px; height: 156px; }
  .tbtn.dir { width: 62px; height: 62px; font-size: 26px; }
  .tbtn.big { width: 80px; height: 80px; font-size: 34px; }
  .tbtn.mid { width: 56px; height: 56px; font-size: 22px; }
  .tbtn.small { width: 44px; height: 44px; font-size: 18px; }
  .tbtn[data-action="jump"]    { right: 88px; bottom: 0; }
  .tbtn[data-action="block"]   { right: 12px; bottom: 88px; }
  .tbtn[data-action="swap"]    { right: 94px; bottom: 68px; }
  .tbtn[data-action="special"] { right: 142px; bottom: 106px; }
  #sys button { width: 38px; height: 38px; font-size: 17px; }
}
.tbtn { background: rgba(20, 14, 30, 0.32); }
