/* AMAZING GAME PARK 共通スタイル 第2版（大人向け・チャコール×白×Amazingの赤） */
:root {
    --gk-ink: #141416;
    --gk-char: #1E1F24;
    --gk-char2: #2A2B30;
    --gk-line: rgba(255, 255, 255, .16);
    --gk-white: #FFFFFF;
    --gk-mute: rgba(255, 255, 255, .66);
    --gk-red: #E63946;
    --gk-red-l: #FF6B6B;
    --gk-accent: var(--gk-red);
    --gk-disp: "Sora", "Zen Kaku Gothic New", sans-serif;
    --gk-body: "Zen Kaku Gothic New", "Hiragino Sans", sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body {
    background: var(--gk-ink);
    color: var(--gk-white);
    font-family: var(--gk-body);
    font-weight: 500;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}
.gk-backdrop {
    position: fixed; inset: -40px;
    background-size: cover; background-position: center;
    filter: blur(28px) saturate(.9) brightness(.42);
    transform: scale(1.05);
}
.gk-backdrop::after { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 40%, rgba(230,57,70,.18), transparent 60%); }
.gk-stage {
    position: fixed; left: 50%; top: 50%;
    transform: translate(-50%, -50%);
    overflow: hidden;
    background: var(--gk-char);
    border-radius: 20px;
    box-shadow: 0 0 0 1px rgba(255,255,255,.12), 0 30px 90px rgba(0,0,0,.55);
    container-type: size;
}
.gk-stage.gk-full { border-radius: 0; box-shadow: none; }
.gk-stage [hidden] { display: none !important; }
.gk-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* ───── HUD ───── */
.gk-hud {
    position: absolute; left: 0; right: 0; top: 0;
    display: flex; align-items: center; gap: 6px;
    padding: max(10px, env(safe-area-inset-top)) 10px 0;
    pointer-events: none;
    font-size: clamp(11px, 3cqw, 16px);
}
.gk-pill {
    pointer-events: auto;
    background: rgba(20, 20, 22, .72);
    -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
    border: 1px solid var(--gk-line);
    border-radius: 999px;
    padding: 5px 12px 6px;
    display: flex; align-items: baseline; gap: 6px;
    white-space: nowrap;
}
.gk-pill small { font: 600 .66em/1 var(--gk-disp); letter-spacing: .14em; color: var(--gk-mute); }
.gk-pill b { font: 800 1.32em/1 var(--gk-disp); font-variant-numeric: tabular-nums; letter-spacing: .01em; }
.gk-hud .gk-grow { flex: 1; }
.gk-iconbtn {
    pointer-events: auto;
    width: 42px; height: 42px; border-radius: 50%;
    border: 1px solid var(--gk-line); background: rgba(20,20,22,.72);
    -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
    display: grid; place-items: center; color: var(--gk-white); cursor: pointer;
}
.gk-iconbtn:active { transform: scale(.94); }
.gk-time-bar {
    position: absolute; left: 12px; right: 12px; top: calc(max(10px, env(safe-area-inset-top)) + 50px); height: 4px;
    background: rgba(255,255,255,.18); border-radius: 999px; overflow: hidden; pointer-events: none;
}
.gk-time-bar i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #fff, var(--gk-red-l)); transform-origin: left; }
.gk-time-bar.gk-hurry i { background: var(--gk-red); }

/* ───── 画面（タイトル・一時停止・結果） ───── */
.gk-screen {
    position: absolute; inset: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 2.2cqh; padding: 6cqh 7cqw;
    text-align: center;
    background: linear-gradient(180deg, rgba(20,20,22,.25) 0%, rgba(20,20,22,.72) 55%, rgba(20,20,22,.9) 100%);
    opacity: 0; visibility: hidden; transition: opacity .3s, visibility .3s;
}
.gk-screen.gk-on { opacity: 1; visibility: visible; }
.gk-screen[data-screen="result"] { background: linear-gradient(180deg, rgba(20,20,22,.55) 0%, rgba(20,20,22,.86) 40%, rgba(20,20,22,.94) 100%); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.gk-screen.gk-dim { background: rgba(20,20,22,.78); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.gk-logo { width: 94%; max-width: 620px; filter: drop-shadow(0 12px 30px rgba(0,0,0,.45)); }
.gk-card {
    width: 100%;
    background: rgba(30, 31, 36, .78);
    -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
    border: 1px solid var(--gk-line); border-radius: 18px;
    padding: 2.2cqh 5cqw;
}
.gk-howto { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.3cqh; text-align: left; }
.gk-howto li { display: flex; align-items: flex-start; gap: 12px; font-size: clamp(13px, 3.7cqw, 17px); line-height: 1.6; font-weight: 500; word-break: auto-phrase; }
.gk-howto b {
    flex: none; width: 1.9em; height: 1.9em; border-radius: 8px;
    display: grid; place-items: center; margin-top: .1em;
    background: var(--gk-red); color: #fff;
    font: 800 .82em/1 var(--gk-disp);
}
.gk-btn {
    appearance: none; cursor: pointer;
    display: inline-flex; flex-direction: column; align-items: center; gap: 4px;
    font: 800 clamp(20px, 6cqw, 30px)/1 var(--gk-disp); letter-spacing: .14em;
    color: #fff;
    background: linear-gradient(180deg, #F04A57 0%, var(--gk-red) 100%);
    border: 0; border-radius: 999px;
    padding: .62em 2.2em .58em;
    box-shadow: 0 10px 30px rgba(230,57,70,.45), inset 0 1px 0 rgba(255,255,255,.35);
    transition: transform .12s, box-shadow .2s;
}
.gk-btn span { font: 700 .42em/1 var(--gk-body); letter-spacing: .08em; opacity: .9; }
.gk-btn:hover { box-shadow: 0 14px 40px rgba(230,57,70,.6), inset 0 1px 0 rgba(255,255,255,.35); }
.gk-btn:active { transform: scale(.96); }
.gk-btn:focus-visible, .gk-btn-sub:focus-visible, .gk-iconbtn:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.gk-btn-sub {
    appearance: none; cursor: pointer;
    display: inline-flex; align-items: center; gap: .4em;
    font: 700 clamp(12px, 3.6cqw, 15px)/1.2 var(--gk-body);
    color: #fff; background: rgba(255,255,255,.06);
    border: 1px solid var(--gk-line); border-radius: 999px;
    padding: .75em 1.3em; text-decoration: none;
}
.gk-btn-sub:hover { background: rgba(255,255,255,.12); }
.gk-btn-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.gk-best { font: 600 clamp(11px, 3.3cqw, 14px)/1.4 var(--gk-disp); letter-spacing: .06em; color: var(--gk-mute); margin: 0; }

/* カウントダウン */
.gk-count {
    position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none;
    font: 800 clamp(90px, 34cqw, 200px)/1 var(--gk-disp);
    color: #fff;
    text-shadow: 0 0 40px rgba(230,57,70,.6), 0 8px 30px rgba(0,0,0,.4);
}
.gk-count span { animation: gk-pop .65s cubic-bezier(.2,1.4,.4,1) both; }
@keyframes gk-pop { 0% { transform: scale(1.6); opacity: 0; filter: blur(8px); } 100% { transform: scale(1); opacity: 1; filter: none; } }

/* 結果 */
.gk-rank {
    font: 800 clamp(110px, 40cqw, 230px)/.9 var(--gk-disp);
    color: #fff;
    text-shadow: 0 0 50px rgba(255,255,255,.25);
    animation: gk-pop .8s cubic-bezier(.2,1.4,.4,1) both;
}
.gk-rank[data-rank="S"] { color: var(--gk-red); text-shadow: 0 0 60px rgba(230,57,70,.7); }
.gk-rank-label { font: 600 clamp(11px, 3.2cqw, 14px)/1 var(--gk-disp); letter-spacing: .3em; color: var(--gk-mute); margin-top: .8cqh; }
.gk-score { font: 800 clamp(34px, 11cqw, 58px)/1 var(--gk-disp); font-variant-numeric: tabular-nums; margin: 0; }
.gk-newbest {
    display: inline-block; margin-top: 8px;
    font: 800 clamp(11px, 3.2cqw, 14px)/1 var(--gk-disp); letter-spacing: .2em;
    color: #fff; background: var(--gk-red); border-radius: 999px; padding: 6px 14px;
}
.gk-lines { margin: 10px 0 0; font-size: clamp(13px, 3.7cqw, 16px); line-height: 1.7; color: rgba(255,255,255,.88); word-break: auto-phrase; }
.gk-top { list-style: none; margin: 12px 0 0; padding: 10px 0 0; border-top: 1px solid var(--gk-line); display: grid; gap: 4px; text-align: left; }
.gk-top:empty { display: none; }
.gk-top li { display: grid; grid-template-columns: 2em 1fr 2em; align-items: center; font: 600 clamp(12px, 3.4cqw, 14px)/1.6 var(--gk-disp); color: var(--gk-mute); font-variant-numeric: tabular-nums; }
.gk-top li b { color: #fff; }
.gk-top li i { font-style: normal; text-align: right; }
.gk-top li.gk-me { color: #fff; }
.gk-top li.gk-me span::after { content: "  ← NOW"; color: var(--gk-red-l); font-size: .85em; letter-spacing: .1em; }
.gk-top .gk-top-head { display: block; font-size: clamp(10px, 3cqw, 12px); letter-spacing: .2em; color: var(--gk-mute); margin-bottom: 2px; }
.gk-cta-note { font-size: clamp(11px, 3.2cqw, 13px); color: var(--gk-mute); margin: 0; }

@media (prefers-reduced-motion: reduce) {
    .gk-count span, .gk-rank { animation: none; }
}

/* ───── 字幕（ナレーションと同時に出す） ───── */
.gk-caption {
    position: absolute; left: 50%; top: calc(max(10px, env(safe-area-inset-top)) + 72px); transform: translateX(-50%);
    width: max-content; max-width: 88%;
    padding: 10px 18px; border-radius: 12px;
    background: rgba(20,20,22,.82); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
    border: 1px solid var(--gk-line);
    font: 700 clamp(13px, 3.8cqw, 17px)/1.6 var(--gk-body); color: #fff; text-align: center;
    word-break: auto-phrase; pointer-events: none; z-index: 6;
    animation: gk-cap-in .25s ease-out both;
}
.gk-caption.gk-cap-out { opacity: 0; transition: opacity .35s; }
@keyframes gk-cap-in { from { opacity: 0; transform: translate(-50%, 8px); } }

/* ───── 案内（チュートリアル） ───── */
.gk-coach { position: absolute; inset: 0; z-index: 5; background: radial-gradient(ellipse at 50% 50%, rgba(20,20,22,.05), rgba(20,20,22,.45)); touch-action: none; }
.gk-coach-card {
    position: absolute; left: 6%; right: 6%; top: 30%;
    background: rgba(20,20,22,.86); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,.18); border-left: 3px solid var(--gk-red);
    border-radius: 14px; padding: 14px 18px;
    animation: gk-cap-in .3s ease-out both;
}
.gk-coach-step { display: block; font: 700 clamp(10px, 2.9cqw, 12px)/1 var(--gk-disp); letter-spacing: .24em; color: var(--gk-red-l); margin-bottom: 6px; }
.gk-coach-step:empty { display: none; }
.gk-coach-card p { margin: 0; font: 700 clamp(14px, 4cqw, 18px)/1.6 var(--gk-body); color: #fff; word-break: auto-phrase; }
.gk-coach-hand { position: absolute; width: clamp(48px, 13cqw, 72px); transform: translate(-30%, -8%); pointer-events: none; filter: drop-shadow(0 6px 14px rgba(0,0,0,.45)); }
.gk-coach-hand svg { display: block; width: 100%; }
.gk-coach-hand i { position: absolute; left: 30%; top: 8%; width: 40%; aspect-ratio: 1; border-radius: 50%; border: 2px solid #fff; transform: translate(-50%, -50%); opacity: 0; }
.gk-coach[data-gesture="tap"] .gk-coach-hand { animation: gk-tap 1.1s ease-in-out infinite; }
.gk-coach[data-gesture="tap"] .gk-coach-hand i { animation: gk-ripple 1.1s ease-out infinite; }
.gk-coach[data-gesture="hold"] .gk-coach-hand { animation: gk-hold 1.6s ease-in-out infinite; }
.gk-coach[data-gesture="hold"] .gk-coach-hand i { animation: gk-ripple 1.6s ease-out infinite; }
.gk-coach[data-gesture="swipe-right"] .gk-coach-hand { animation: gk-swr 1.3s cubic-bezier(.5,0,.3,1) infinite; }
.gk-coach[data-gesture="swipe-left"] .gk-coach-hand { animation: gk-swl 1.3s cubic-bezier(.5,0,.3,1) infinite; }
@keyframes gk-tap { 0%, 100% { transform: translate(-30%, -8%) scale(1); } 45% { transform: translate(-30%, -8%) scale(.86); } }
@keyframes gk-hold { 0% { transform: translate(-30%, -8%) scale(1); } 25%, 80% { transform: translate(-30%, -8%) scale(.86); } 100% { transform: translate(-30%, -8%) scale(1); } }
@keyframes gk-ripple { 0% { opacity: 0; width: 20%; } 40% { opacity: .9; } 100% { opacity: 0; width: 140%; } }
@keyframes gk-swr { 0% { transform: translate(-80%, -8%); opacity: 0; } 15% { opacity: 1; } 75% { transform: translate(60%, -8%); opacity: 1; } 100% { transform: translate(60%, -8%); opacity: 0; } }
@keyframes gk-swl { 0% { transform: translate(40%, -8%); opacity: 0; } 15% { opacity: 1; } 75% { transform: translate(-100%, -8%); opacity: 1; } 100% { transform: translate(-100%, -8%); opacity: 0; } }
.gk-coach-skip {
    position: absolute; right: 12px; bottom: calc(max(14px, env(safe-area-inset-bottom)) + 12px);
    font: 700 13px/1 var(--gk-body); color: #fff; background: rgba(20,20,22,.7);
    border: 1px solid var(--gk-line); border-radius: 999px; padding: 10px 14px; cursor: pointer;
}
.gk-howto-btn { margin-top: -6px; }
@media (prefers-reduced-motion: reduce) { .gk-coach-hand, .gk-coach-hand i { animation: none !important; } }
