:root {
  --bg: #12142a;
  --text: #f4f1ea;
  --muted: #a9a9c4;
  --accent: #ffd166;
  --accent2: #ef476f;
  --card: #1d2042;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font-family: "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", system-ui, sans-serif; }
button { font: inherit; }

#game {
  position: relative; margin: 0 auto;
  width: 100%; max-width: 560px;
  height: 88svh; min-height: 420px;
  overflow: hidden; touch-action: none;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  background: #f6c8a8;
}
@media (min-width: 700px) { #game { height: min(92svh, 960px); border-radius: 0 0 18px 18px; } }
#c { display: block; width: 100%; height: 100%; }

#hud { position: absolute; inset: 0 0 auto 0; padding: 14px 16px; pointer-events: none;
  display: flex; justify-content: space-between; align-items: flex-start; }
#score { font-size: 52px; font-weight: 900; line-height: 1; color: #fff;
  text-shadow: 0 3px 0 rgba(0,0,0,.25); font-variant-numeric: tabular-nums; }
#gems { display: flex; align-items: center; gap: 6px; font-size: 22px; font-weight: 800; color: #fff;
  text-shadow: 0 2px 0 rgba(0,0,0,.25); margin-top: 6px; margin-right: 44px; }
.gem-ico { width: 16px; height: 16px; background: #4cc9f0; transform: rotate(45deg); border-radius: 3px;
  box-shadow: 0 0 10px #4cc9f0; display: inline-block; }
#gems.bump { animation: bump .25s; }
@keyframes bump { 50% { transform: scale(1.3); } }

#popups { position: absolute; inset: 0; pointer-events: none; }
.pop { position: absolute; left: 50%; top: 38%; transform: translateX(-50%);
  font-weight: 900; font-size: 26px; color: #fff; text-shadow: 0 3px 0 rgba(0,0,0,.3);
  animation: pop .8s ease-out forwards; white-space: nowrap; }
.pop.edge { color: var(--accent); }
@keyframes pop { 0% { opacity: 0; transform: translate(-50%, 10px) scale(.7); }
  20% { opacity: 1; transform: translate(-50%, 0) scale(1.1); }
  100% { opacity: 0; transform: translate(-50%, -40px) scale(1); } }

.icon-btn { position: absolute; top: 12px; right: 12px; width: 36px; height: 36px; border-radius: 50%;
  border: 0; background: rgba(0,0,0,.25); color: #fff; font-size: 18px; cursor: pointer; z-index: 5; }
.icon-btn.off { opacity: .45; text-decoration: line-through; }

.overlay { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center;
  justify-content: center; text-align: center; padding: 24px; gap: 8px;
  background: linear-gradient(180deg, rgba(18,20,42,.15), rgba(18,20,42,.55)); }
.overlay[hidden], #hud[hidden] { display: none; }
.logo { margin: 0; font-size: 64px; line-height: .9; font-weight: 900; letter-spacing: 2px; color: #fff;
  text-shadow: 0 5px 0 var(--accent2), 0 10px 24px rgba(0,0,0,.3); }
.sub { margin: 4px 0 18px; font-weight: 700; color: #fff; opacity: .9; }
.how { background: rgba(0,0,0,.3); border-radius: 14px; padding: 12px 18px; line-height: 1.9; color: #fff; }
.how b { color: var(--accent); }
.best-line { margin: 10px 0 0; color: #fff; font-weight: 700; }
.tap { margin-top: 26px; font-size: 22px; font-weight: 900; color: #fff; }
.blink { animation: blink 1.1s infinite; }
@keyframes blink { 50% { opacity: .35; } }

.over-label { margin: 0; font-weight: 900; letter-spacing: 3px; color: #fff; opacity: .9; }
.final { font-size: 88px; font-weight: 900; line-height: 1; color: #fff; text-shadow: 0 5px 0 rgba(0,0,0,.25); }
.newrec { margin: 0; color: var(--accent); font-weight: 900; font-size: 20px; animation: blink .6s infinite; }
.btns { display: flex; flex-direction: column; gap: 10px; margin-top: 22px; width: min(280px, 100%); }
.btn { border: 0; border-radius: 999px; padding: 14px 18px; font-weight: 900; font-size: 17px; cursor: pointer;
  box-shadow: 0 4px 0 rgba(0,0,0,.25); }
.btn:disabled { opacity: .6; cursor: default; }
.btn:active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(0,0,0,.25); }
.btn-main { background: var(--accent); color: #2b2100; }
.btn-ad { background: var(--accent2); color: #fff; }
.btn-sub { background: rgba(255,255,255,.9); color: #1b1f3b; }

.below { max-width: 640px; margin: 0 auto; padding: 18px 16px 40px; line-height: 1.8; }
.below h2 { font-size: 1.15rem; margin: 28px 0 6px; border-left: 4px solid var(--accent); padding-left: 10px; }
.below a { color: var(--accent); }
.below ul { padding-left: 1.3em; }
.ad-slot { min-height: 100px; margin: 18px 0; border: 1px dashed rgba(255,255,255,.15); border-radius: 8px; }
footer { margin-top: 40px; display: flex; justify-content: space-between; color: var(--muted); font-size: .9rem; }

.policy { max-width: 720px; margin: 0 auto; padding: 24px 16px 60px; line-height: 1.85; }
.policy h2 { font-size: 1.05rem; margin-top: 28px; }
.policy a { color: var(--accent); }

/* ===== インクリメンタル版の追加 ===== */
#score small, .final small { font-size: .45em; margin-left: 2px; opacity: .85; }
.hud-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; margin-right: 44px; }
.coin-line { display: flex; align-items: center; gap: 6px; font-size: 24px; font-weight: 900; color: #fff;
  text-shadow: 0 2px 0 rgba(0,0,0,.25); font-variant-numeric: tabular-nums; }
#gems { margin: 0; font-size: 18px; }
#shields { margin-top: 6px; font-size: 18px; letter-spacing: 2px; }
.coin-ico { width: 18px; height: 18px; border-radius: 50%; display: inline-block; flex: none;
  background: radial-gradient(circle at 35% 35%, #fff3b0, #ffd166 45%, #e09f1f); box-shadow: 0 0 0 2px rgba(0,0,0,.15); }

.wallet { display: inline-flex; align-items: center; gap: 8px; background: rgba(0,0,0,.35); color: #fff;
  border-radius: 999px; padding: 6px 14px; font-weight: 900; font-size: 20px; font-variant-numeric: tabular-nums; }
#title .wallet { position: absolute; top: 12px; left: 12px; }
.idle-line { position: absolute; top: 54px; left: 16px; margin: 0; color: #fff; font-size: 13px; font-weight: 700; opacity: .9; }
.inf { color: var(--accent); }
.how-small { font-size: 13px; opacity: .85; }
#starLine { margin-left: 10px; color: var(--accent); }
.btn-shop { background: #7cf2c9; color: #0d3b2e; position: relative; margin-top: 14px; min-width: 200px; }
.shop-badge { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent2); color: #fff; font-size: 14px; line-height: 22px; animation: blink 1s infinite; }
.shop-badge[hidden] { display: none; }
#title .tap { margin-top: 16px; }

.earn { background: rgba(0,0,0,.3); border-radius: 14px; padding: 10px 16px; color: #fff; min-width: 220px; margin-top: 6px; }
.earn-rows { font-size: 14px; line-height: 1.7; }
.earn-rows div { display: flex; justify-content: space-between; gap: 16px; }
.earn-total { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 28px; font-weight: 900;
  color: var(--accent); margin-top: 4px; font-variant-numeric: tabular-nums; }
.earn-total.big { font-size: 38px; margin: 10px 0; }
#over .btns { margin-top: 12px; }
#over .btn-shop { margin-top: 0; }

.panel { position: absolute; inset: 0; z-index: 10; background: rgba(14,16,36,.94); color: #fff;
  display: flex; flex-direction: column; touch-action: pan-y; }
.panel[hidden] { display: none; }
.panel-head { display: flex; justify-content: space-between; align-items: center; padding: 12px; }
.btn-close { width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgba(255,255,255,.12); color: #fff;
  font-size: 24px; cursor: pointer; }
.panel-body { overflow-y: auto; padding: 0 12px 24px; -webkit-overflow-scrolling: touch; }
.panel-body h2 { font-size: 16px; margin: 10px 4px 8px; color: var(--muted); }
.upg { display: flex; align-items: center; gap: 10px; background: var(--card); border-radius: 14px; padding: 10px 12px; margin-bottom: 8px; }
.upg-ico { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; font-size: 22px; flex: none;
  background: rgba(255,255,255,.08); }
.upg-main { flex: 1; min-width: 0; }
.upg-name { font-weight: 900; }
.upg-name small { color: var(--muted); font-weight: 700; margin-left: 6px; }
.upg-desc { font-size: 12px; color: var(--muted); line-height: 1.5; }
.upg-desc b { color: #7cf2c9; }
.upg-buy { flex: none; min-width: 92px; border: 0; border-radius: 12px; padding: 10px 8px; font-weight: 900; cursor: pointer;
  background: var(--accent); color: #2b2100; display: flex; align-items: center; justify-content: center; gap: 5px;
  font-variant-numeric: tabular-nums; }
.upg-buy .coin-ico { width: 14px; height: 14px; }
.upg-buy:disabled { background: #3a3d63; color: #8d8fb0; cursor: default; }
.upg-buy.max { background: #2e5e4f; color: #7cf2c9; }
.upg.flash { animation: flash .35s; }
@keyframes flash { 50% { background: #35407a; } }

.prestige { background: var(--card); border-radius: 14px; padding: 12px 14px; font-size: 14px; line-height: 1.7; }
.prestige p { margin: 0 0 8px; }
.prestige b { color: var(--accent); }
.pres-info { color: #fff; font-weight: 700; }
.btn-prestige { background: linear-gradient(90deg, #ffd166, #ef476f); color: #fff; width: 100%; }
.btn-prestige:disabled { background: #3a3d63; color: #8d8fb0; }

.modal { align-items: center; justify-content: center; padding: 20px; background: rgba(14,16,36,.8); }
.modal-box { background: var(--card); border-radius: 18px; padding: 22px 20px; text-align: center; width: min(340px, 100%); }
.modal-box h2 { margin: 0 0 10px; font-size: 20px; }
.modal-box p { margin: 0; line-height: 1.7; }
.modal-box .btns { margin: 16px auto 0; }
