/* ピードリゲームの共通部品 PG の見た目（pg.js と一緒に読む）。クラスは全部 pg- で始め、ゲームの CSS とぶつけない */
/* ゲームごとの色（PG.init({ accent }) が入れる。入れなければ今までの見た目のまま）*/
:root { --pg-accent: #ffd257; --pg-accent-ink: #1a1235; }

/* ゲームの中: 長押しのメニュー・文字の選択・ダブルタップの拡大を止める。縦のスクロールは止めない（下の説明 .pg-about まで読める）。
   指で操作する canvas#cv の touch-action: none は各ゲームが持つ（結果の中の canvas までは止めない）*/
#app { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
#app img { -webkit-user-drag: none; }
#app input, #app textarea, #app [contenteditable] { -webkit-user-select: text; user-select: text; -webkit-touch-callout: default; }
.pg-reveal, .pg-chban, .pg-toast { -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
.pg-btn { appearance: none; border: 0; border-radius: 999px; font: inherit; font-weight: 800; font-size: 15px; padding: 13px 18px; color: #1a1235; background: linear-gradient(180deg, #fff, #dcd6ff); cursor: pointer; text-decoration: none; text-align: center; display: block; width: 100%; }
.pg-btn.ghost { background: transparent; color: #f6f3ff; border: 1.5px solid rgba(255,255,255,.3); }
.pg-btn.store { background: linear-gradient(180deg, #5d9bff, #3a6fe0); color: #fff; }
.pg-btn.challenge { background: linear-gradient(180deg, #ff8f6b, #e8506a); color: #fff; }
.pg-btn:active { transform: scale(.97); }
.pg-row { display: flex; gap: 8px; width: 100%; } .pg-row .pg-btn { flex: 1; } .pg-row[hidden] { display: none; }
.pg-sub { font-size: 13px; color: #b9b2dd; text-align: center; margin: 0; line-height: 1.6; }
.pg-h { font-size: 17px; font-weight: 900; text-align: center; }
.pg-result { display: flex; flex-direction: column; align-items: stretch; gap: 8px; width: 100%; max-width: 420px; }

/* トースト・光・紙吹雪 */
.pg-toast { position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); transform: translate(-50%, 20px); max-width: min(92vw, 420px); background: rgba(20,17,43,.96); color: #fff; border: 1px solid rgba(255,255,255,.18); border-radius: 14px; padding: 11px 16px; font-size: 13.5px; font-weight: 700; text-align: center; z-index: 2000; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; box-shadow: 0 8px 24px rgba(0,0,0,.4); }
.pg-toast.on { opacity: 1; transform: translate(-50%, 0); }
.pg-flash { position: fixed; inset: 0; pointer-events: none; z-index: 1500; animation: pg-flash .8s ease-out forwards; }
@keyframes pg-flash { from { opacity: 1; } to { opacity: 0; } }
.pg-fx { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1400; }

/* 発表（reveal） */
.pg-reveal { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; background: rgba(6,4,18,0); transition: background .25s; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; color: #fff; font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", sans-serif; }
.pg-reveal.on { background: rgba(6,4,18,.9); }
.pg-reveal.out { opacity: 0; transition: opacity .25s; }
.pg-rv-rays { position: absolute; left: 50%; top: 45%; width: 190vmax; height: 190vmax; transform: translate(-50%, -50%); background: repeating-conic-gradient(from 0deg, var(--pg-ray, rgba(255,210,87,.2)) 0deg 9deg, transparent 9deg 18deg); -webkit-mask: radial-gradient(circle, #000 0, transparent 55%); mask: radial-gradient(circle, #000 0, transparent 55%); opacity: 0; transition: opacity .5s; animation: pg-spin 14s linear infinite; pointer-events: none; }
.pg-reveal.rays .pg-rv-rays { opacity: 1; }
.pg-t-silver { --pg-ray: rgba(207,214,255,.16); }
@keyframes pg-spin { to { transform: translate(-50%, -50%) rotate(360deg); } }
.pg-rv-box { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 20px; max-width: 460px; width: 100%; text-align: center; opacity: 0; transform: scale(.94); transition: opacity .25s, transform .25s; }
.pg-reveal.on .pg-rv-box { opacity: 1; transform: none; }
.pg-rv-label { font-size: 14px; letter-spacing: .2em; color: #b9b2dd; }
.pg-rv-score { font-size: 104px; font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums; }
.pg-rv-score small { font-size: 28px; margin-left: 4px; }
.pg-reveal.roll .pg-rv-score b { animation: pg-roll .09s linear infinite; display: inline-block; }
@keyframes pg-roll { 50% { transform: translateY(-3px); opacity: .6; } }
.pg-rv-score.over b, .pg-t-gold .pg-rv-score b { background: linear-gradient(180deg, #fff3b0, #ffd257); -webkit-background-clip: text; background-clip: text; color: transparent; }
.pg-rv-bonus { font-size: 18px; font-weight: 900; color: var(--pg-accent, #ffd257); opacity: 0; transform: translateX(40px); transition: all .3s ease-out; min-height: 24px; }
.pg-rv-bonus.on { opacity: 1; transform: none; }
.pg-rv-sub { font-size: 15px; color: #b9b2dd; min-height: 20px; }
.pg-rv-title { font-size: clamp(26px, 8.5vw, 40px); font-weight: 900; line-height: 1.25; opacity: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.pg-rv-emoji { font-size: 1.5em; }
.pg-rv-title.stamp { animation: pg-stamp .42s cubic-bezier(.2,1.6,.4,1) forwards; }
@keyframes pg-stamp { 0% { opacity: 0; transform: scale(2.8) rotate(-10deg); } 60% { opacity: 1; transform: scale(.92) rotate(-3deg); } 100% { opacity: 1; transform: scale(1) rotate(-3deg); } }
.pg-t-gold .pg-rv-title span:last-child { color: #ffd257; text-shadow: 0 0 24px rgba(255,210,87,.6); }
.pg-t-silver .pg-rv-title span:last-child { color: #e6eaff; text-shadow: 0 0 18px rgba(207,214,255,.5); }
.pg-t-bad .pg-rv-title span:last-child { color: #ff8b8b; }
.pg-rv-new { font-size: 12px; font-weight: 900; color: #14112b; background: #6be3a0; border-radius: 999px; padding: 4px 12px; opacity: 0; transform: scale(.6); transition: all .25s cubic-bezier(.2,1.6,.4,1); }
.pg-rv-new.on { opacity: 1; transform: none; }
.pg-rv-line { font-size: 14px; color: #dcd6ff; max-width: 340px; opacity: 0; transition: opacity .4s; min-height: 20px; }
.pg-rv-line.on { opacity: 1; }
.pg-rv-tap { margin-top: 14px; font-size: 12px; color: rgba(255,255,255,.55); opacity: 0; }
.pg-reveal.done .pg-rv-tap { opacity: 1; animation: pg-blink 1.4s ease-in-out infinite; }
@keyframes pg-blink { 50% { opacity: .35; } }
/* 発表にシェア画像を敷く（数え上げの間は暗く、ハンコのあとで明るく＝発表のスクショがシェア画像と同じになる）*/
.pg-rv-art { position: absolute; left: 50%; top: 47%; width: auto; height: auto; max-width: 94vw; max-height: 80dvh; transform: translate(-50%, -50%) scale(1.03); border-radius: 14px; box-shadow: 0 18px 50px rgba(0,0,0,.55); filter: brightness(.3) saturate(.7) blur(3px); opacity: 0; transition: filter .45s, transform .45s, opacity .3s; pointer-events: none; -webkit-user-drag: none; }
.pg-reveal.on .pg-rv-art[src] { opacity: 1; }
.pg-reveal.final .pg-rv-art { filter: none; transform: translate(-50%, -50%) scale(1); }
.pg-reveal.final .pg-rv-box { opacity: 0; transform: scale(1.04); transition: opacity .35s, transform .35s; }
.pg-rv-foot { position: absolute; left: 0; right: 0; bottom: 0; padding: 32px 16px max(14px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; background: linear-gradient(rgba(6,4,18,0), rgba(6,4,18,.85) 45%); pointer-events: none; }
.pg-rv-foot .pg-rv-tap { margin-top: 4px; }

/* 小窓・図鑑 */
.pg-modal { position: fixed; inset: 0; z-index: 1200; background: rgba(0,0,0,.7); display: flex; align-items: center; justify-content: center; padding: 16px; opacity: 0; transition: opacity .2s; }
.pg-modal.on { opacity: 1; }
.pg-card { width: 100%; max-width: 420px; max-height: 86dvh; overflow-y: auto; background: #1d1840; color: #f6f3ff; border: 1px solid rgba(255,255,255,.14); border-radius: 18px; padding: 18px 16px; display: flex; flex-direction: column; gap: 10px; }
.pg-input { font: inherit; font-size: 17px; padding: 12px 14px; border-radius: 12px; border: 1.5px solid rgba(255,255,255,.25); background: rgba(255,255,255,.06); color: #fff; text-align: center; -webkit-user-select: text; user-select: text; }
.pg-prev { max-width: 100%; max-height: 62dvh; border-radius: 12px; align-self: center; -webkit-touch-callout: default; -webkit-user-select: auto; user-select: auto; }
.pg-zk { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pg-zk-c { background: rgba(255,255,255,.07); border-radius: 12px; padding: 10px 4px; text-align: center; display: flex; flex-direction: column; gap: 4px; min-height: 84px; justify-content: center; }
.pg-zk-c span { font-size: 28px; } .pg-zk-c b { font-size: 11.5px; line-height: 1.3; }
.pg-zk-c.pg-t-gold { background: linear-gradient(160deg, rgba(255,210,87,.3), rgba(255,210,87,.08)); }
.pg-zk-c.pg-t-silver { background: linear-gradient(160deg, rgba(207,214,255,.25), rgba(207,214,255,.06)); }
.pg-zk-no { opacity: .45; } .pg-zk-no span { font-weight: 900; color: #b9b2dd; }

/* 挑戦状 */
.pg-chban { position: fixed; left: 50%; top: max(8px, env(safe-area-inset-top)); transform: translateX(-50%); z-index: 900; width: min(94vw, 440px); display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px; background: linear-gradient(180deg, #ff8f6b, #e8506a); color: #fff; box-shadow: 0 8px 24px rgba(0,0,0,.4); animation: pg-drop .4s cubic-bezier(.2,1.4,.4,1); transition: opacity .3s; }
.pg-chban.out { opacity: 0; }
.pg-chban > span { font-size: 26px; } .pg-chban div { flex: 1; min-width: 0; } .pg-chban b { display: block; font-size: 15px; } .pg-chban small { font-size: 12px; opacity: .92; }
.pg-chban button { appearance: none; border: 0; background: rgba(0,0,0,.18); color: #fff; width: 28px; height: 28px; border-radius: 50%; font-size: 16px; cursor: pointer; }
@keyframes pg-drop { from { transform: translate(-50%, -30px); opacity: 0; } }
.pg-vs { background: linear-gradient(160deg, rgba(255,143,107,.22), rgba(232,80,106,.12)); border: 1.5px solid rgba(255,143,107,.5); border-radius: 16px; padding: 12px; display: flex; flex-direction: column; gap: 8px; text-align: center; }
.pg-vs-h { font-size: 13px; font-weight: 900; color: #ffc2b0; }
.pg-vs-row { display: flex; align-items: center; gap: 6px; } .pg-vs-row > div { flex: 1; display: flex; flex-direction: column; } .pg-vs-row > span { font-weight: 900; color: #ffc2b0; }
.pg-vs-row small { font-size: 12px; color: #dcd6ff; } .pg-vs-row b { font-size: 26px; font-weight: 900; } .pg-vs-row i { font-style: normal; font-size: 11.5px; color: #b9b2dd; }
.pg-vs-msg { font-size: 18px; font-weight: 900; } .pg-vs-win .pg-vs-msg { color: #ffd257; } .pg-vs-lose .pg-vs-msg { color: #ffb0b0; }

/* アプリとほかのゲーム */
.pg-promo { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.pg-app { display: block; background: rgba(255,255,255,.07); border-radius: 14px; padding: 12px; color: inherit; text-decoration: none; text-align: center; }
.pg-app p { margin: 0 0 8px; font-size: 13px; }
.pg-promo-h { font-size: 12px; color: #b9b2dd; text-align: center; margin-top: 6px; letter-spacing: .1em; }
.pg-game { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 14px; background: rgba(255,255,255,.06); color: inherit; text-decoration: none; text-align: left; }
.pg-game:active { transform: scale(.98); }
.pg-ic { flex: 0 0 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 26px; font-weight: 900; color: #f5e663; overflow: hidden; }
.pg-game b { display: block; font-size: 14.5px; margin-bottom: 2px; } .pg-game small { color: #b9b2dd; font-size: 11.5px; line-height: 1.45; display: block; }

/* ゲームごとの色を入れたとき（.pg-accented は PG.init が html に付ける）。color-mix が無い端末は1行目の単色 */
.pg-accented .pg-btn:not(.ghost):not(.store):not(.challenge) { background: var(--pg-accent); background: linear-gradient(180deg, color-mix(in srgb, var(--pg-accent) 55%, #fff), var(--pg-accent)); color: var(--pg-accent-ink); }
.pg-accented .pg-rv-label, .pg-accented .pg-promo-h { color: var(--pg-accent); }
.pg-accented .pg-t-normal .pg-rv-title span:last-child { text-shadow: 0 0 22px color-mix(in srgb, var(--pg-accent) 55%, transparent); }
.pg-accented .pg-sheet { border-color: color-mix(in srgb, var(--pg-accent) 45%, transparent); }

/* ページの中のシェア画面（アプリ内ブラウザ）・動画用の合成 canvas・大きな印 */
.pg-sheet .pg-prev { max-height: 50dvh; }
.pg-sheet video.pg-prev { width: 100%; background: #000; }
.pg-clipcv { position: fixed; left: 0; top: 0; width: 2px; height: 2px; opacity: 0; pointer-events: none; z-index: -1; }
.pg-mark { position: fixed; left: 50%; top: 40%; transform: translate(-50%, -50%); z-index: 1300; pointer-events: none; font: 900 min(26vw, 120px)/1 -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", sans-serif; text-align: center; color: var(--pg-accent); text-shadow: 0 4px 18px rgba(0,0,0,.5); opacity: 0; animation: pg-mk .8s ease-out forwards; white-space: nowrap; }
.pg-mark small { display: block; font-size: 16px; color: #fff; margin-top: 6px; }
@keyframes pg-mk { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.3); } 20% { opacity: 1; transform: translate(-50%, -50%) scale(1.15); } 35% { transform: translate(-50%, -50%) scale(1); } 75% { opacity: 1; } 100% { opacity: 0; } }

/* 図鑑のヒントと小さな絵（2026-11-04 UG との差を埋める） */
.pg-zk-img { width: 100%; max-width: 96px; aspect-ratio: 960 / 690; object-fit: cover; border-radius: 8px; align-self: center; }
.pg-zk-hint { font-size: 10px; line-height: 1.35; color: #dcd6ff; opacity: .9; padding: 0 2px; }
.pg-zk-no .pg-zk-hint { opacity: 1; }
.pg-zk-c.pg-zk-no { opacity: 1; } .pg-zk-no span, .pg-zk-no b { opacity: .45; }

/* 今日のお題・タイトル画面の掃除 */
.pg-today { display: inline-flex; align-self: center; align-items: center; gap: 4px; padding: 5px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 800; color: var(--pg-accent-ink); background: var(--pg-accent); box-shadow: 0 4px 14px rgba(0,0,0,.35); white-space: nowrap; }
.pg-today[hidden] { display: none; }
.pg-ts-sub { margin: 0; font-size: 14px; font-weight: 700; color: #fff; text-align: center; text-shadow: 0 1px 6px rgba(0,0,0,.7); }
.pg-ts-row { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; }
.pg-ts-sound { font-size: 12px; color: rgba(255,255,255,.8); text-shadow: 0 1px 6px rgba(0,0,0,.7); }
.pg-zchip { appearance: none; font: inherit; font-size: 12px; font-weight: 800; color: #fff; background: rgba(0,0,0,.35); border: 1px solid rgba(255,255,255,.28); border-radius: 999px; padding: 5px 11px; cursor: pointer; }
.pg-legal p { margin: 6px 0 0; }
.pg-btn.pg-loading, button.pg-loading { opacity: .6; cursor: progress; }

/* 自己表現（固定の選択肢のチップ） */
.pg-choice-slot { width: 100%; display: flex; justify-content: center; }
.pg-choice { display: flex; flex-direction: column; align-items: center; gap: 5px; max-width: 100%; }
.pg-choice-l { font-size: 11.5px; font-weight: 700; color: rgba(255,255,255,.82); letter-spacing: .08em; text-shadow: 0 1px 6px rgba(0,0,0,.7); }
.pg-chips { display: flex; gap: 6px; overflow-x: auto; max-width: min(92vw, 440px); padding: 2px 4px 4px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.pg-chips::-webkit-scrollbar { display: none; }
.pg-chip { appearance: none; flex: 0 0 auto; display: inline-flex; align-items: center; gap: 5px; font: inherit; font-size: 13px; font-weight: 800; color: #fff; background: rgba(0,0,0,.4); border: 1.5px solid rgba(255,255,255,.22); border-radius: 999px; padding: 6px 11px; cursor: pointer; white-space: nowrap; -webkit-tap-highlight-color: transparent; }
.pg-chip i { width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid rgba(255,255,255,.7); flex: 0 0 auto; }
.pg-chip.on { border-color: var(--pg-accent); background: color-mix(in srgb, var(--pg-accent) 30%, rgba(0,0,0,.4)); box-shadow: 0 0 0 2px color-mix(in srgb, var(--pg-accent) 40%, transparent); }
.pg-chip:active { transform: scale(.95); }

/* 画面内のヒント1行・進み具合のメーター */
.pg-hint { position: fixed; left: 50%; bottom: calc(max(12px, env(safe-area-inset-bottom)) + 64px); transform: translate(-50%, 8px); max-width: min(90vw, 420px); padding: 8px 14px; border-radius: 999px; background: rgba(10,8,30,.82); color: #fff; font-size: 14px; font-weight: 700; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; z-index: 950; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.pg-hint.on { opacity: 1; transform: translate(-50%, 0); }
.pg-progress { position: fixed; left: 0; right: 0; top: 0; height: 4px; background: rgba(255,255,255,.12); z-index: 950; pointer-events: none; opacity: 0; transition: opacity .2s; }
.pg-progress.on { opacity: 1; }
.pg-progress i { display: block; height: 100%; background: var(--pg-accent); transform-origin: 0 50%; transform: scaleX(0); transition: transform .12s linear; }

/* 結果: 今日のベスト・もう1回 / 別のお題 */
.pg-daily { text-align: center; font-size: 13px; font-weight: 800; color: #f6f3ff; background: rgba(255,255,255,.07); border-radius: 12px; padding: 8px 10px; }
.pg-daily b { color: var(--pg-accent); font-size: 15px; }
.pg-daily i { font-style: normal; margin-left: 6px; font-size: 11px; color: #14112b; background: #6be3a0; border-radius: 999px; padding: 2px 8px; }

/* 結果の4秒後の全画面1枚（アプリかほかのゲーム） */
.pg-full { position: fixed; inset: 0; z-index: 1250; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(6,4,18,.86); opacity: 0; transition: opacity .2s; }
.pg-full.on { opacity: 1; }
.pg-full-card { position: relative; width: 100%; max-width: 360px; background: #1d1840; color: #f6f3ff; border: 2px solid var(--pg-accent); border-radius: 22px; padding: 28px 18px 18px; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; transform: scale(.94); transition: transform .25s cubic-bezier(.2,1.4,.4,1); }
.pg-full.on .pg-full-card { transform: none; }
.pg-full-x { position: absolute; right: 8px; top: 8px; width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgba(255,255,255,.12); color: #fff; font-size: 20px; cursor: pointer; }
.pg-full-ic { width: 96px; height: 96px; border-radius: 24px; display: flex; align-items: center; justify-content: center; font-size: 54px; box-shadow: 0 8px 24px rgba(0,0,0,.4); }
.pg-full-app { background: linear-gradient(160deg, #5d9bff, #3a6fe0); }
.pg-full-k { font-size: 11px; letter-spacing: .2em; color: #b9b2dd; margin-top: 4px; }
.pg-full-n { font-size: 20px; line-height: 1.35; }
.pg-full-l { margin: 0 0 6px; font-size: 13.5px; line-height: 1.6; color: #dcd6ff; }
