:root {
  --ink: #fff8ee;
  --dim: rgba(255, 248, 238, 0.68);
  --glass: rgba(24, 16, 10, 0.42);
  --line: rgba(255, 255, 255, 0.18);
  --accent: #9fe3ff;
  --bg: #1a130c;
  --sans: system-ui, -apple-system, "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", sans-serif;
  --round: "Hiragino Maru Gothic ProN", "Arial Rounded MT Bold", "BIZ UDPGothic", var(--sans);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); overflow: hidden; }
body { font-family: var(--sans); -webkit-tap-highlight-color: transparent; -webkit-user-select: none; user-select: none; }

canvas {
  position: fixed; inset: 0; width: 100%; height: 100%; display: block;
  touch-action: none; outline: none; cursor: pointer;
}

.bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 5;
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: max(12px, env(safe-area-inset-top)) 16px 0;
  pointer-events: none;
}
.bar > * { pointer-events: auto; }
.bar__btns { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.home {
  color: var(--ink); text-decoration: none; font-size: 13px; letter-spacing: .04em;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.6);
}
.pill {
  font: inherit; font-size: 12px; color: var(--ink); text-decoration: none; white-space: nowrap;
  background: var(--glass); border: 1px solid var(--line);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border-radius: 999px; padding: 7px 12px; cursor: pointer;
}
.pill:hover { background: rgba(40, 28, 18, 0.6); }
.pill:focus-visible, .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pill--strong { font-weight: 700; }

/* ---------- プレイ中 ---------- */
.hud { position: fixed; inset: 0; pointer-events: none; z-index: 3; }
.hud[hidden] { display: none; }
.counter {
  position: absolute; left: 50%; top: max(52px, calc(env(safe-area-inset-top) + 44px)); transform: translateX(-50%);
  display: flex; align-items: baseline; gap: 6px;
  font-family: var(--round); text-shadow: 0 2px 14px rgba(0, 0, 0, 0.55), 0 0 2px rgba(0, 0, 0, 0.5);
}
.counter b { font-size: clamp(36px, 7vw, 58px); font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: .01em; }
.counter span { font-size: 15px; font-weight: 700; color: var(--dim); }
.sub {
  position: absolute; left: 50%; top: max(118px, calc(env(safe-area-inset-top) + 108px)); transform: translateX(-50%);
  font-size: 12px; color: var(--dim); white-space: nowrap; letter-spacing: .03em;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.7);
}
.sub b { color: var(--ink); font-variant-numeric: tabular-nums; font-weight: 600; }
.dock {
  position: absolute; left: 50%; bottom: max(18px, calc(env(safe-area-inset-bottom) + 10px)); transform: translateX(-50%);
  display: flex; gap: 8px; pointer-events: auto;
}

.fx { position: fixed; inset: 0; pointer-events: none; z-index: 2; overflow: hidden; }
.pop-text {
  position: absolute; transform: translate(-50%, -50%);
  font-family: var(--round); font-weight: 800; font-size: 26px; color: #fff;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
  animation: float 1.05s ease-out forwards;
}
.pop-text--big { font-size: 40px; color: #fff3c4; }
.pop-text--fart { font-size: 30px; color: #f3f0a0; transform-origin: center; text-shadow: 0 2px 10px rgba(60, 50, 0, 0.55); }
.pop-text--dud { font-size: 18px; color: rgba(255, 255, 255, 0.85); font-weight: 600; }
@keyframes float {
  0% { opacity: 0; transform: translate(-50%, -30%) scale(.7); }
  15% { opacity: 1; transform: translate(-50%, -70%) scale(1.06); }
  100% { opacity: 0; transform: translate(-50%, -160%) scale(1); }
}

.toast {
  position: fixed; left: 50%; bottom: max(76px, calc(env(safe-area-inset-bottom) + 68px)); z-index: 6;
  transform: translate(-50%, 12px); margin: 0; max-width: calc(100vw - 32px);
  padding: 10px 18px; border-radius: 999px; font-size: 14px; font-weight: 600; text-align: center;
  background: rgba(20, 14, 9, 0.72); border: 1px solid var(--line);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  opacity: 0; transition: opacity .3s, transform .3s; pointer-events: none;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.toast:empty { display: none; }

/* ---------- タイトル ---------- */
.screen {
  position: fixed; inset: 0; z-index: 4; display: grid; place-items: center; padding: 72px 16px 24px;
  background: radial-gradient(ellipse at 50% 45%, rgba(20, 13, 8, 0.35), rgba(12, 8, 5, 0.78));
}
.screen[hidden] { display: none; }
.screen__inner {
  width: min(460px, 100%); text-align: center;
  padding: 30px 22px 24px; border-radius: 22px;
  background: rgba(22, 15, 10, 0.55); border: 1px solid var(--line);
  -webkit-backdrop-filter: blur(14px) saturate(1.2); backdrop-filter: blur(14px) saturate(1.2);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}
.logo {
  margin: 0; font-family: var(--round); font-weight: 800; line-height: 1.05;
  font-size: clamp(22px, 5vw, 28px); letter-spacing: .2em; color: var(--dim);
}
.logo span {
  display: block; margin-top: 6px; letter-spacing: .04em; color: #fff;
  font-size: clamp(48px, 13vw, 72px);
  text-shadow: 0 0 1px #fff, 0 4px 0 rgba(150, 210, 240, 0.35), 0 10px 30px rgba(140, 210, 255, 0.35);
}
.lead { margin: 14px 0 18px; font-size: 15px; color: var(--ink); }
.steps { margin: 0 0 22px; padding: 0; list-style: none; text-align: left; font-size: 13.5px; line-height: 1.7; color: var(--dim); }
.steps li { padding-left: 1.3em; position: relative; margin: 4px 0; }
.steps li::before { content: ""; position: absolute; left: 0; top: .55em; width: .72em; height: .72em; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff, rgba(190, 230, 255, 0.5) 45%, rgba(190, 230, 255, 0.15)); }
.steps b { color: var(--ink); }
.btn {
  font: inherit; font-family: var(--round); font-size: 18px; font-weight: 800; letter-spacing: .08em;
  color: #2a1a0c; background: linear-gradient(#fff, #dff3ff); border: 0; border-radius: 999px;
  padding: 14px 40px; cursor: pointer; box-shadow: 0 6px 0 rgba(120, 170, 200, 0.55), 0 10px 26px rgba(0, 0, 0, 0.35);
  transition: transform .08s, box-shadow .08s;
}
.btn:active { transform: translateY(4px); box-shadow: 0 2px 0 rgba(120, 170, 200, 0.55), 0 6px 16px rgba(0, 0, 0, 0.35); }
.best { margin: 16px 0 0; font-size: 13px; color: var(--ink); min-height: 1em; }
.best:empty { display: none; }
.hint { margin: 14px 0 0; font-size: 11.5px; line-height: 1.7; color: var(--dim); }

.nogl-msg { display: none; }
body.nogl .nogl-msg { display: block; position: fixed; left: 16px; right: 16px; top: 45%; text-align: center; z-index: 9; }
body.nogl .screen, body.nogl canvas { display: none; }

@media (max-width: 420px) {
  .pill { padding: 6px 10px; font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) {
  .pop-text { animation-duration: .6s; }
}

body.shot .bar, body.shot .hud, body.shot .toast { display: none !important; }
