* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: #000; overflow: hidden; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: #fff; }

/* Khung dọc 9:16, luôn nằm giữa màn hình */
#stage {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(100vw, calc(100dvh * 9 / 16)); aspect-ratio: 9 / 16; overflow: hidden; background: #07041a;
}
#game { width: 100%; height: 100%; display: block; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; }

#menuBtn {
  position: absolute; top: 1.2%; right: 2%; width: 36px; height: 36px; border-radius: 50%;
  background: rgba(255, 255, 255, .12); font-size: 17px; opacity: .55;
}
#menuBtn:hover, #menuBtn:focus-visible { opacity: 1; }

#panel {
  position: absolute; top: 7%; right: 2%; width: min(88%, 310px); max-height: 86%; overflow: auto;
  background: rgba(14, 9, 38, .96); border: 1px solid rgba(255, 255, 255, .18); border-radius: 14px; padding: 12px;
  font-size: 13px; z-index: 5;
}
#panel[hidden] { display: none; }
#panel h3 { margin: 12px 0 6px; font-size: 12px; color: #ffd23f; }
#closePanel { background: none; font-size: 16px; padding: 2px 6px; }
.row { display: flex; align-items: center; gap: 6px; }
.between { justify-content: space-between; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.grid button { background: rgba(255, 255, 255, .1); padding: 9px 4px; border-radius: 9px; }
.grid button:hover { background: rgba(255, 255, 255, .2); }
.grid button.on { background: #ff3fa8; }
.field { display: block; margin-top: 10px; }
.field input { display: block; width: 100%; margin-top: 4px; }

input {
  font: inherit; color: #fff; background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .25);
  border-radius: 9px; padding: 9px 10px; width: 100%; min-width: 0;
}
input:focus { outline: 2px solid #ff3fa8; }

#setup {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 5%;
  background: radial-gradient(circle at 50% 30%, rgba(90, 30, 150, .6), rgba(5, 3, 18, .94)); z-index: 6; overflow: auto;
}
#setup[hidden], #tapAudio[hidden] { display: none; }
.card { width: 100%; max-width: 430px; }
.wordmark { display: block; width: min(72%, 300px); margin: 0 auto 10px; }
.card h1 {
  margin: 0; text-align: center; font-size: clamp(38px, 11vw, 60px); font-style: italic; font-weight: 900;
  background: linear-gradient(90deg, #ffd23f, #ff3fa8, #6c7bff); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.tag { text-align: center; margin: 4px 0 14px; color: #e5ddff; }
.card ul { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 7px; font-size: 14px; }
.card li { background: rgba(255, 255, 255, .07); padding: 8px 10px; border-radius: 10px; }
.card label { font-weight: 700; font-size: 14px; display: block; margin-bottom: 6px; }
.at { font-weight: 800; font-size: 18px; }
.primary, .ghost { width: 100%; padding: 13px; border-radius: 12px; font-weight: 800; font-size: 16px; margin-top: 10px; }
.primary { background: linear-gradient(90deg, #ff3fa8, #ff8a1f); }
.ghost { background: rgba(255, 255, 255, .12); }
.muted { color: #bdb4dc; }
.small { font-size: 12px; text-align: center; margin: 12px 0 0; }
.error { color: #ff8b8b; font-size: 13px; margin: 8px 0 0; }

#tapAudio {
  position: absolute; left: 50%; top: 55%; transform: translateX(-50%); padding: 14px 20px; border-radius: 30px;
  font-weight: 800; background: #ff3fa8; box-shadow: 0 6px 24px rgba(0, 0, 0, .5); white-space: nowrap; z-index: 4;
}
