/* ゲーム共通の画面部品。色は各ゲームが :root の変数で上書きする。 */
:root {
  --ink: #2b1a0c;
  --card: #fff7e8;
  --paper: #f3e6cf;
  --accent: #f2b705;
  --accent-dark: #b98a00;
  --sub: #7a5a3a;
  --chip: #6b3f17;
  --chip-ink: #fff7e8;
  --title: #6b3f17;
  --title-shadow: #3a210a;
  --bg: #111;
  --display: "Dela Gothic One", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  --body: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", system-ui, sans-serif;
  color-scheme: light;
}
html, body { height: 100%; margin: 0; background: var(--bg); overscroll-behavior: none; }
body {
  position: fixed; inset: 0; overflow: hidden; touch-action: none;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent;
  font-family: var(--body); color: var(--ink);
}
#stage { position: absolute; top: 0; bottom: 0; left: 50%; transform: translateX(-50%); width: min(100%, 520px, 62vh); width: min(100%, 520px, 62dvh); overflow: hidden; }
canvas { display: block; width: 100%; height: 100%; touch-action: none; }
[hidden] { display: none !important; }

.btn {
  font: inherit; font-weight: 900; border: 0; border-radius: 14px; padding: 13px 18px; cursor: pointer; color: var(--ink);
  text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; touch-action: manipulation;
}
.btn:focus-visible { outline: 3px solid var(--chip); outline-offset: 2px; }
.btn.primary { background: var(--accent); font-family: var(--display); font-weight: 400; font-size: 22px; padding: 14px 44px; box-shadow: 0 5px 0 var(--accent-dark); }
.btn.primary:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--accent-dark); }

/* タイトル */
.title { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: calc(env(safe-area-inset-top, 0px) + 7vh) 20px 0; pointer-events: none; }
.title > * { pointer-events: auto; }
.logo { font-family: var(--display); font-size: clamp(64px, 21vw, 112px); line-height: 1; color: var(--title); letter-spacing: .02em;
  text-shadow: 0 5px 0 var(--title-shadow), 0 10px 24px rgba(0, 0, 0, .25); }
.tag { font-weight: 900; font-size: 17px; color: var(--title); margin: 16px 0 14px; }
.how { list-style: none; padding: 0; margin: 0 0 22px; display: grid; gap: 7px; font-size: 14px; font-weight: 700; }
.how b { background: rgba(242, 183, 5, .4); padding: 0 4px; border-radius: 4px; }
.best { margin: 14px 0 0; font-size: 13px; font-weight: 800; min-height: 1em; }

/* 結果 */
.result { position: absolute; inset: 0; display: flex; align-items: flex-end; justify-content: center;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0) 15%, rgba(20, 10, 0, .5));
  padding: 0 max(12px, env(safe-area-inset-right, 0px)) calc(env(safe-area-inset-bottom, 0px) + 12px) max(12px, env(safe-area-inset-left, 0px)); }
.card { width: 100%; max-width: 440px; background: var(--card); border-radius: 22px; padding: 16px 16px 12px; text-align: center;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .35); animation: card-up .5s cubic-bezier(.2, .9, .3, 1.15) both; }
@keyframes card-up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.r-reason { font-family: var(--display); color: var(--chip); font-size: 18px; }
.r-big { font-family: var(--display); font-size: clamp(48px, 15vw, 72px); line-height: 1.05; font-variant-numeric: tabular-nums; margin-top: 2px; }
.r-big small { font-size: .38em; margin-left: .1em; }
.r-rank { display: inline-flex; gap: 6px; align-items: center; margin: 6px 0 2px; padding: 4px 12px; border-radius: 999px; background: var(--chip); color: var(--chip-ink); font-weight: 900; font-size: 14px; }
.newbest { background: var(--accent); color: var(--ink); border-radius: 999px; padding: 1px 8px; font-size: 12px; }
.r-comment { margin: 8px 0 2px; font-weight: 900; font-size: 16px; }
.r-sub { margin: 0 0 10px; font-size: 13px; color: var(--sub); font-weight: 700; min-height: 1em; }
.r-stats { display: flex; justify-content: center; gap: 24px; margin: 0 0 12px; font-size: 12px; color: var(--sub); }
.r-stats div { display: grid; gap: 2px; }
.r-stats dt { font-weight: 700; }
.r-stats dd { margin: 0; font-weight: 900; font-size: 16px; color: var(--ink); font-variant-numeric: tabular-nums; }
.card .btn.primary { width: 100%; }
.share { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.share .btn { font-size: 13px; padding: 11px 4px; background: var(--paper); border-radius: 12px; }
.share .btn.x { background: #111; color: #fff; }
.share .btn.line { background: #06c755; color: #fff; }
.btn.ghost { width: 100%; box-sizing: border-box; margin-top: 8px; background: transparent; border: 2px solid var(--chip); color: var(--chip); font-size: 14px; padding: 9px; }
.btn.next { width: 100%; box-sizing: border-box; margin-top: 8px; background: var(--ink); color: var(--card); font-size: 14px; padding: 11px; }
.tip { margin: 8px 0 0; font-size: 12px; color: var(--sub); font-weight: 700; }

/* 演出 */
.boom { position: absolute; left: 0; right: 0; top: 38%; text-align: center; pointer-events: none;
  font-family: var(--display); font-size: clamp(48px, 15vw, 76px); color: #fff; text-shadow: 0 4px 0 var(--chip), 0 0 30px rgba(0, 0, 0, .35);
  animation: boom .5s cubic-bezier(.2, 1.6, .4, 1) both; }
@keyframes boom { from { transform: scale(.3) rotate(-8deg); opacity: 0; } to { transform: rotate(-4deg); opacity: 1; } }
.mute { position: absolute; top: calc(env(safe-area-inset-top, 0px) + 10px); right: 10px; width: 38px; height: 38px; border-radius: 50%; z-index: 5;
  border: 0; background: rgba(0, 0, 0, .25); color: #fff; display: grid; place-items: center; cursor: pointer; touch-action: manipulation; }
.mute svg { width: 20px; height: 20px; }
.mute .off { display: none; }
.mute.muted .on { display: none; }
.mute.muted .off { display: block; }

body.ogp-mode #stage { width: 100%; left: 0; transform: none; }
body.ogp-mode .feed-hint, body.ogp-mode .mute { display: none !important; }

@media (prefers-reduced-motion: reduce) { .card, .boom { animation-duration: .01s; } }
