:root{
  --bg: #0b0f16;
  --panel: rgba(255,255,255,.06);
  --panel2: rgba(255,255,255,.10);
  --text: rgba(255,255,255,.92);
  --muted: rgba(255,255,255,.70);

  --btn: rgba(255,255,255,.12);
  --btn2: rgba(255,255,255,.18);

  --radius: 16px;
}

*{ box-sizing:border-box; }
html, body{ height:100%; }
body{
  margin:0;
  font-family: system-ui, -apple-system, "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

.app{
  min-height: 100%;
  display:flex;
  flex-direction: column;
}

.topbar{
  display:flex;
  align-items:center;
  justify-content: space-between;
  padding: 10px 12px;
  gap: 10px;
  background: linear-gradient(to bottom, rgba(0,0,0,.35), rgba(0,0,0,0));
}

.title .name{
  font-weight: 900;
  letter-spacing: .02em;
  font-size: 18px;
}
.title .meta{
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.menuBtn{
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.08);
  color: var(--text);
  border-radius: 999px;
  padding: 10px 14px;
  font-weight: 900;
  font-size: 14px;
}

.stageWrap{
  flex: 1;
  display:flex;
  align-items:center;
  justify-content:center;
  padding: 10px 12px 16px;
}

.game{
  width: min(96vw, 820px);
  height: min(74vh, 640px);
  background: rgba(255,255,255,.03);
  border-radius: 18px;
  border: 2px solid rgba(255,255,255,.14);
  box-shadow: 0 10px 30px rgba(0,0,0,.35);
  touch-action: none; /* iPadでスクロールを防止 */
}

.overlay{
  position: fixed;
  inset: 0;
  display:flex;
  align-items:center;
  justify-content:center;
  padding: 16px;
  background: rgba(0,0,0,.55);
}

.card{
  width: min(560px, 92vw);
  background: rgba(20,20,24,.92);
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 18px;
  padding: 16px 14px;
  text-align:center;
}

.card h2{
  margin: 0 0 12px;
  font-size: 20px;
  font-weight: 900;
}

.levels{
  display:flex;
  gap: 10px;
  justify-content:center;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.lvBtn{
  border: 1px solid rgba(255,255,255,.18);
  background: var(--btn);
  color: var(--text);
  border-radius: 999px;
  padding: 12px 16px;
  font-weight: 900;
  font-size: 16px;
  min-width: 120px;
}

.lvBtn.is-active{
  background: rgba(120,200,255,.20);
  border-color: rgba(120,200,255,.40);
}

.actions{
  display:flex;
  gap: 10px;
  justify-content:center;
  margin-bottom: 10px;
}

.primaryBtn{
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(120,255,180,.18);
  color: var(--text);
  border-radius: 999px;
  padding: 14px 18px;
  font-weight: 900;
  font-size: 18px;
  min-width: 160px;
}

.ghostBtn{
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.10);
  color: var(--text);
  border-radius: 999px;
  padding: 14px 18px;
  font-weight: 900;
  font-size: 18px;
  min-width: 160px;
}

.note{
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.55;
}

.is-hidden{ display:none; }

.score{
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.08);
  border-radius: 999px;
  padding: 10px 14px;
  font-weight: 900;
  font-size: 14px;
  min-width: 88px;
  text-align: center;
}

.ovScore{
  margin: 6px 0 12px;
  font-size: 18px;
  font-weight: 900;
  color: rgba(255,255,255,.92);
}

#game{
  height: min(72vh, 720px);
}

/* ===== Overlay UI (big & simple) ===== */
.overlay{
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(0,0,0,.55);
  z-index: 9999;
}

.overlay.is-hidden{
  display: none;
}

.ovCard{
  width: min(560px, 100%);
  background: rgba(18,22,30,.96);
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 10px 30px rgba(0,0,0,.45);
}

.ovTitle{
  margin: 0 0 10px;
  font-size: 22px;
  line-height: 1.2;
  color: #fff;
  text-align: center;
}

.ovScore{
  margin: 0 0 12px;
  text-align: center;
  font-size: 18px;
  color: rgba(255,255,255,.9);
}

.levelRow{
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 12px 0 14px;
}

.levelBtn{
  height: 64px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.08);
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  touch-action: manipulation;
}

.levelBtn.is-active{
  background: rgba(120,255,180,.22);
  border-color: rgba(120,255,180,.55);
}

.actionRow{
  margin-top: 8px;
  display: grid;
  gap: 10px;
}

.primaryBtn{
  height: 72px;
  border-radius: 16px;
  border: none;
  background: rgba(120,255,180,.95);
  color: #0b0f16;
  font-size: 22px;
  font-weight: 900;
  touch-action: manipulation;
}

.menuBtn{
  margin-top: 12px;
  width: 100%;
  height: 56px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.20);
  background: rgba(255,255,255,.06);
  color: rgba(255,255,255,.95);
  font-size: 18px;
  font-weight: 700;
  touch-action: manipulation;
}

.is-hidden{ display:none !important; }

.back-btn a {
	position: absolute;text-decoration: none;
	left: 0px;
	top: 0px;
	display: block;
	background: #ff0000;
	color: #fff;
	font-size: 30px;
	padding: 1rem;
	border-radius: 0px 0px 30px 0px;
	z-index: 10000;
}
