* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: #1c1026;
  color: #fff6e6;
  font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", "Heiti TC", "Noto Sans CJK TC", sans-serif;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#stage {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

#frame {
  position: relative;
  width: min(100vw, calc((100vh - 44px) * 1.5));
  width: min(100vw, calc((100dvh - 44px) * 1.5));
  aspect-ratio: 3 / 2;
  container-type: inline-size;
  background: #2a1838;
  box-shadow: 0 8px 40px rgba(0, 0, 0, .6);
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  outline: none;
}
#game:focus-visible { outline: 3px solid #ffd35c; outline-offset: -3px; }

button {
  font: inherit;
  font-weight: 700;
  color: #fff6e6;
  background: rgba(34, 18, 48, .88);
  border: 2px solid #ffd35c;
  border-radius: 10px;
  cursor: pointer;
  touch-action: manipulation;
}
button:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
button:active { background: #6b3a5a; }

#topButtons {
  position: absolute;
  top: 1.2%;
  right: 1%;
  display: flex;
  gap: 6px;
}
#topButtons button {
  min-width: 40px;
  min-height: clamp(30px, 5.6cqw, 40px);
  padding: 2px clamp(5px, 1cqw, 10px);
  font-size: clamp(11px, 1.7cqw, 16px);
  white-space: nowrap;
}

#btnDash {
  position: absolute;
  right: 2.5%;
  bottom: 4%;
  width: clamp(64px, 12%, 110px);
  aspect-ratio: 1;
  border-radius: 50%;
  font-size: clamp(14px, 2.4cqw, 22px);
  background: rgba(196, 60, 48, .9);
  border-color: #fff6e6;
}
#btnDash[hidden] { display: none; }
#btnDash.cooling { opacity: .45; }

#hint {
  margin: 0;
  padding: 0 8px;
  font-size: 13px;
  line-height: 1.4;
  color: #f3dcc0;
  text-align: center;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

@media (max-height: 420px) {
  #hint { display: none; }
  #frame { width: min(100vw, calc(100vh * 1.5)); width: min(100vw, calc(100dvh * 1.5)); }
}
