/* 叩いて被って — 共通デザイン（2026-11-11〜：6色・もちっとポップ）。部品の色は paguon-toy.css を上書き */
:root {
  color-scheme: light dark;
  /* 色合いは yubinoyatsu（ゆびのやつ）を踏襲（依頼者の決定 2026-11-13）：真っ白・インク・青と紫・危ない所はピンク赤 */
  --pg-bg: #ffffff;
  --pg-panel: #ffffff;
  --pg-ink: #0c0d10;
  --pg-shu: #ff3d6e;   /* 危ない物・見るべき所（ゆびのやつの --hot） */
  --pg-me: #0c0d10;    /* 自分＝黒（手前の袖） */
  --pg-line: #e3e5e9;
  --pg-sub: #6b7079;
  --accent: #3b5bff; --accent-2: #8a3dff; --good: #11b886;
  --btn: #0c0d10; --btn-text: #ffffff; --ghost: rgba(12, 13, 16, 0.06);
  --shadow: 0 1px 2px rgba(12, 13, 16, 0.06), 0 12px 32px rgba(12, 13, 16, 0.08);
  --pg-font: 'Mochiy Pop One', 'Hiragino Maru Gothic ProN', system-ui, sans-serif;
  --sb: max(env(safe-area-inset-bottom), var(--vb, 0px)); /* Android の X のアプリ内ブラウザで隠れる下の幅 */
  --on-color: #ffffff; /* 黒・青・紫・ピンク赤の上の文字 */
}
/* ダークモード（端末の設定に合わせる。依頼者の決定 2026-11-13）：インクの面に白い文字。ボタンは白、文字は黒 */
@media (prefers-color-scheme: dark) {
  :root {
    --pg-bg: #0c0d10;
    --pg-panel: #1a1c22;
    --pg-ink: #f4f5f7;
    --pg-me: #f4f5f7;
    --pg-line: #2f323a;
    --pg-sub: #a3a8b0;
    --btn: #f4f5f7; --btn-text: #0c0d10; --ghost: rgba(244, 245, 247, 0.08);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 12px 32px rgba(0, 0, 0, 0.45);
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { font-synthesis: none; }
html, body { margin: 0; height: 100%; height: 100dvh; background: var(--pg-bg); color: var(--pg-ink); overflow: hidden; overscroll-behavior: none;
  font-family: var(--pg-font); font-weight: 800; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
#app { position: relative; height: 100%; overflow: hidden; touch-action: none; --colw: min(100%, 520px); }
[hidden] { display: none !important; }
#gl { position: absolute; inset: 0; }
button { font-family: inherit; }

/* 上：点 */
#hud { position: absolute; left: 0; right: 0; top: calc(8px + env(safe-area-inset-top)); z-index: 2; pointer-events: none;
  display: flex; justify-content: center; gap: 10px; }
#hud .side { display: flex; align-items: center; gap: 6px; background: var(--pg-panel); border-radius: 12px; padding: 4px 10px 5px; font-size: 13px; line-height: 1;
  box-shadow: 0 3px 0 rgba(71,64,74,.16); white-space: nowrap; }
#hud .side.me b { background: var(--pg-me); color: var(--pg-bg); border-radius: 7px; padding: 2px 6px 3px; }
#hud .side b { max-width: 7em; overflow: hidden; text-overflow: ellipsis; }
#hud i { font-style: normal; display: flex; gap: 3px; }
#hud i u { display: block; width: 13px; height: 13px; border-radius: 50%; background: var(--pg-line); }
#hud i u.on { background: var(--pg-ink); }
#hud i u.pop { animation: dotPop .4s ease-out; }
@keyframes dotPop { 0% { transform: scale(.3); } 55% { transform: scale(1.5, .8); } 100% { transform: none; } }
#bPause { position: absolute; right: 10px; top: calc(8px + env(safe-area-inset-top)); z-index: 3; font-size: 12px; padding: 4px 9px; letter-spacing: -2px; }

/* 掛け声（真ん中の大きな文字） */
#call { position: absolute; left: 0; right: 0; top: 30%; transform: translateY(-4px); z-index: 3; pointer-events: none; text-align: center; font-size: clamp(34px, 11vw, 54px); line-height: 1; white-space: nowrap; color: var(--pg-ink);
  text-shadow: 0 3px 0 var(--pg-panel), 0 -3px 0 var(--pg-panel), 3px 0 0 var(--pg-panel), -3px 0 0 var(--pg-panel), 2px 2px 0 var(--pg-panel), -2px -2px 0 var(--pg-panel), 2px -2px 0 var(--pg-panel), -2px 2px 0 var(--pg-panel); }
#call.small { font-size: clamp(24px, 8vw, 36px); }

/* ポップ文字（ピコッ！・ガード！など） */
#pops { position: absolute; inset: 0; pointer-events: none; z-index: 3; overflow: hidden; }
#pops b { position: absolute; transform: translate(-50%, -100%); font-size: 26px; color: var(--pg-ink); white-space: nowrap;
  text-shadow: 0 3px 0 var(--pg-panel), 0 -3px 0 var(--pg-panel), 3px 0 0 var(--pg-panel), -3px 0 0 var(--pg-panel), 2px 2px 0 var(--pg-panel), -2px -2px 0 var(--pg-panel), 2px -2px 0 var(--pg-panel), -2px 2px 0 var(--pg-panel); }
#pops b.big { font-size: 40px; }

/* じゃんけんの手を選ぶ（ぽんまで。押す所＝Soft Pink、選んだ手＝Butter Yellow） */
#picks { position: absolute; left: 50%; top: 60%; transform: translate(-50%, -50%); z-index: 4; display: flex; gap: 12px; }
.pick { width: 68px; height: 68px; border-radius: 50%; border: 0; background: var(--pg-shu); color: var(--on-color); font-size: 15px; padding: 0;
  box-shadow: 0 5px 0 rgba(71,64,74,.28); transition: transform .08s; touch-action: none; }
.pick:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(71,64,74,.28); }
.pick.on { background: var(--pg-me); transform: translateY(2px) scale(1.08); }
#picks.locked .pick { pointer-events: none; }

#slowTag { position: absolute; left: 50%; top: calc(46px + env(safe-area-inset-top)); transform: translateX(-50%); z-index: 3; pointer-events: none;
  background: var(--pg-ink); color: var(--pg-panel); border-radius: 10px; padding: 3px 10px 4px; font-size: 14px; white-space: nowrap; }

/* 画面の板 */
.ov { position: absolute; top: 0; bottom: 0; left: calc(50% - var(--colw) / 2); width: var(--colw); display: none; z-index: 5; pointer-events: none; }
.ov.show { display: block; }
.ov button, .ov input { pointer-events: auto; }
.sheet { display: none; align-items: center; justify-content: center; padding: 16px 16px calc(16px + var(--sb)); pointer-events: auto; }
.sheet.show { display: flex; }
.card { width: min(100%, 340px); max-height: 100%; overflow: auto; background: var(--pg-panel); border-radius: 20px; box-shadow: 0 6px 0 rgba(71,64,74,.22);
  padding: 18px 16px 12px; display: flex; flex-direction: column; align-items: center; gap: 9px; text-align: center; animation: cardIn .35s ease-out both; }
@keyframes cardIn { 0% { transform: translateY(-40px); opacity: 0; } 60% { transform: translateY(0) scale(1.04, .95); opacity: 1; } 100% { transform: none; } }
.card .pg-title { font-size: 34px; }
.card p { margin: 0; font-size: 14px; line-height: 1.5; }
.card .lead { font-size: 18px; }
.card .hint { font-size: 12px; color: var(--pg-sub); }
.card .score { font-size: 30px; font-variant-numeric: tabular-nums; }
.card .best:empty { display: none; }
.card .best { font-size: 13px; color: var(--on-color); background: var(--pg-me); border-radius: 8px; padding: 1px 8px; }
.card .pg-sign { align-self: flex-end; margin-top: 2px; }
.card .err { color: var(--on-color); background: var(--pg-shu); border-radius: 8px; padding: 2px 8px; }
.card .credit { font-size: 10px !important; line-height: 1.4; color: var(--pg-sub); }
.pg-btn.small { font-size: 14px; padding: 6px 12px; border-radius: 11px; }
.pg-btn.big { font-size: 22px; padding: 12px 30px; }
.pg-btn.shu { color: var(--on-color); } /* Soft Pink の上の文字は Warm Charcoal（ダークでも） */
.pg-btn:disabled { opacity: 1; background: var(--pg-line); box-shadow: none; }
.lv { width: 100%; }

/* タイトル：ボタンは見出しのすぐ下（画面の下には置かない） */
#ovTitle.show { display: flex; flex-direction: column; align-items: flex-start; padding: calc(16px + env(safe-area-inset-top)) 18px calc(16px + var(--sb)); }
.tHead .pg-title { font-size: clamp(34px, 11vw, 56px); line-height: 1.15; word-break: keep-all;
  text-shadow: 0 3px 0 var(--pg-bg), 0 -3px 0 var(--pg-bg), 3px 0 0 var(--pg-bg), -3px 0 0 var(--pg-bg); }
.tLead { display: inline-block; margin: 10px 0 0; font-size: 14px; line-height: 1.5; background: var(--pg-panel); border-radius: 8px; padding: 2px 8px; }
.tBest { margin: 6px 0 0; font-size: 13px; }
.tBest:empty { display: none; }
.tBest span { background: var(--pg-panel); border-radius: 8px; padding: 2px 8px; }
.tFoot { margin-top: clamp(16px, 4vh, 36px); display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
#bCpu { max-width: calc(100vw - 36px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tSign { background: var(--pg-panel); border-radius: 6px; padding: 3px 6px; }

/* 文字の動き（textfx.js） */
.fx-c, .fx-j { display: inline-block; }
.fx-c { transform-origin: 50% 80%; }
.pg-goal-word { white-space: nowrap; }
.pg-goal-label { color: var(--on-color) !important; }

/* タイトル：対戦／オンラインで */
#bOnline { min-width: 0; }

/* オンライン画面：上から 対戦台・ランク戦・ともだちと。縦に流す（下に固定しない） */
.page { pointer-events: auto; overflow-y: auto; -webkit-overflow-scrolling: touch; background: var(--pg-bg);
  padding: calc(12px + env(safe-area-inset-top)) 16px calc(24px + var(--sb)); }
.page.show { display: flex; flex-direction: column; gap: 12px; align-items: stretch; }
.oTop { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.oTop .nameChip { margin-left: auto; }
.nameChip { font: inherit; font-size: 13px; color: var(--pg-ink); background: var(--pg-panel); border: 2px solid var(--pg-ink); border-radius: 999px; padding: 4px 10px;
  max-width: 12em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nameChip:empty { display: none; }
.oHead { margin: 6px 0 0; font-size: 22px; line-height: 1.2; display: flex; align-items: center; gap: 8px; }
.oHead::before { content: ''; width: 10px; height: 10px; border-radius: 50%; background: var(--pg-shu); box-shadow: 0 0 0 4px rgba(232,166,166,.35); animation: live 1.2s ease-in-out infinite; }
@keyframes live { 50% { box-shadow: 0 0 0 7px rgba(232,166,166,.12); } }
.tables { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tableCard { font: inherit; text-align: left; color: #F8F3EA; background: #47404A; border: 0; border-radius: 16px; padding: 10px 10px 12px; min-height: 128px;
  box-shadow: 0 5px 0 rgba(0,0,0,.28); display: flex; flex-direction: column; gap: 6px; position: relative; overflow: hidden; }
.tableCard:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(0,0,0,.28); }
.tableCard .tcHead { display: flex; justify-content: space-between; align-items: center; font-size: 13px; }
.tableCard .tcLive { font-size: 10px; color: #47404A; background: var(--pg-shu); border-radius: 6px; padding: 1px 6px; }
.tableCard .tcLive.idle { background: #9ACDC3; }
.tableCard .tcVs { display: flex; flex-direction: column; gap: 3px; font-size: 13px; line-height: 1.25; }
.tableCard .tcVs span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tableCard .tcVs em { font-style: normal; font-size: 10px; color: #47404A; background: #F2D98F; border-radius: 6px; padding: 0 5px; margin-left: 4px; }
.tableCard .tcFoot { margin-top: auto; font-size: 11px; color: #D9D1DC; }
.wide { width: 100%; display: flex; justify-content: center; align-items: baseline; gap: 8px; }
.wide small { font-size: 13px; }
.oStatus { margin: 0; font-size: 12px; color: var(--pg-sub); text-align: center; }
.oStatus:empty { display: none; }
.card .col { display: flex; flex-direction: column; gap: 8px; align-items: center; width: 100%; }
#roomInput, #roomLink, #namingInput { font: inherit; font-size: 16px; width: 100%; padding: 8px 12px; border: 2.5px solid var(--pg-ink); border-radius: 12px;
  background: var(--pg-panel); color: var(--pg-ink); -webkit-user-select: text; user-select: text; text-align: center; }
#namingInput { font-size: 20px; }
#ovNaming { padding-bottom: calc(16px + max(var(--sb), var(--kb, 0px))); }
.card .rankLine:empty { display: none; }
.card .rankLine { font-size: 14px; }
.card .rankLine b { color: var(--on-color); background: var(--pg-me); border-radius: 6px; padding: 0 6px; }

/* 手を選ぶ残り時間（オンライン） */
#pickTimer { position: absolute; left: 50%; transform: translateX(-50%); z-index: 4; pointer-events: none; font-size: 13px;
  background: var(--pg-panel); color: var(--pg-ink); border-radius: 10px; padding: 2px 10px 3px; white-space: nowrap; }

/* ===== 対戦台の観戦：スポーツ中継風（Warm Charcoal を多めに、Soft Pink・Butter Yellow で差す） ===== */
#watch { position: absolute; inset: 0; z-index: 4; pointer-events: none; color: #F8F3EA; }
#watch button { pointer-events: auto; }
.wTop { position: absolute; left: 10px; right: 10px; top: calc(8px + env(safe-area-inset-top)); display: flex; align-items: center; gap: 8px; }
.wTitle { font-size: 13px; background: #47404A; border-radius: 8px; padding: 3px 9px; }
.wViewers { margin-left: auto; font-size: 11px; background: rgba(71,64,74,.85); border-radius: 8px; padding: 3px 8px; }
.wViewers:empty { display: none; }
.wBoard { position: absolute; left: 50%; transform: translateX(-50%); top: calc(48px + env(safe-area-inset-top)); display: flex; align-items: stretch;
  background: #47404A; border-radius: 12px; overflow: hidden; box-shadow: 0 4px 0 rgba(0,0,0,.3); max-width: calc(100% - 20px); }
.wSide { display: flex; align-items: center; gap: 6px; padding: 6px 10px; font-size: 13px; min-width: 0; }
.wSide.l { background: #F2D98F; color: #47404A; }
.wSide.r { background: #B4A0DD; color: #47404A; }
.wName { max-width: 6.5em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wDots { font-style: normal; display: flex; gap: 3px; }
.wDots u { display: block; width: 11px; height: 11px; border-radius: 50%; background: rgba(71,64,74,.25); }
.wDots u.on { background: #47404A; }
.wNo { display: flex; align-items: center; padding: 0 8px; font-size: 11px; white-space: nowrap; }
.wStreak { position: absolute; top: 34%; z-index: 4; pointer-events: none; font-size: 15px; white-space: nowrap; color: #47404A;
  background: #F2D98F; border-radius: 10px; padding: 3px 10px 4px; box-shadow: 0 3px 0 rgba(0,0,0,.25); }
.wStreak.l { left: 12px; }
.wStreak.r { right: 12px; }
.wBottom { position: absolute; left: 10px; right: 10px; bottom: calc(18px + var(--sb)); display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
.wQueue { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pg-btn.queue { font-size: 14px; padding: 8px 6px; line-height: 1.25; white-space: normal; }
.pg-btn.queue.l { background: #F2D98F; color: #47404A; border-color: #47404A; }
.pg-btn.queue.r { background: #B4A0DD; color: #47404A; border-color: #47404A; }
.pg-btn.queue.mine { outline: 3px solid #E8A6A6; outline-offset: 2px; }
.wVote, .wTurn { background: rgba(71,64,74,.94); border-radius: 14px; padding: 8px 10px 10px; text-align: center; }
.wVote p, .wTurn p { margin: 0 0 6px; font-size: 14px; }
.wVoteRow { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pg-btn.vote { font-size: 14px; padding: 7px 6px; display: flex; flex-direction: column; align-items: center; gap: 2px; color: #47404A; border-color: #47404A; }
.pg-btn.vote.l { background: #F2D98F; }
.pg-btn.vote.r { background: #B4A0DD; }
.pg-btn.vote.on { outline: 3px solid #E8A6A6; outline-offset: 2px; }
.pg-btn.vote .vn { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pg-btn.vote .vp { font-size: 12px; }
.wTurn .pg-btn { color: #47404A; }
/* 長い帯（まもなく試合がはじまります！など）は、小さく・折り返してよい */
#call.small { font-size: clamp(18px, 6vw, 30px); white-space: normal; padding: 0 14px; line-height: 1.25; }
/* 対戦台で自分が対戦しているあいだは、観客用の表示を隠す（自分の点の表示は上の HUD） */
#watch.playing .wTop, #watch.playing .wBoard, #watch.playing .wStreak, #watch.playing .wBottom { display: none; }

/* ===== 色合い：yubinoyatsu を踏襲（ボタンは丸い錠剤の形、ふち線なし。おもな操作は黒、ランク戦は青→紫） ===== */
.pg-btn { border: 0; border-radius: 999px; background: var(--ghost); color: var(--pg-ink); box-shadow: none; margin-bottom: 0; }
.pg-btn:active { transform: scale(0.97); box-shadow: none; }
.pg-btn.shu { background: var(--btn); color: var(--btn-text); box-shadow: 0 10px 24px rgba(12, 13, 16, 0.22); }
.pg-btn:disabled { background: var(--ghost); color: var(--pg-sub); border: 0; transform: none; }
#bRanked { color: #fff; background: linear-gradient(110deg, var(--accent) 0%, var(--accent-2) 55%, var(--pg-shu) 110%); box-shadow: 0 12px 30px rgba(91, 76, 255, 0.35); }
.pick { background: var(--btn); color: var(--btn-text); box-shadow: 0 8px 20px rgba(12, 13, 16, 0.25); }
.pick.on { background: var(--accent); color: #fff; }
.card { border-radius: 22px; box-shadow: var(--shadow); }
.card .err { color: #fff; background: var(--pg-shu); }
.card .best { color: #fff; background: var(--accent); }
.card .rankLine b { color: #fff; background: var(--accent); }
.nameChip { border: 0; background: var(--ghost); }
#hud .side, .tLead, .tBest span, #pickTimer { box-shadow: var(--shadow); }
.tSign { background: transparent; }
.oHead::before { box-shadow: 0 0 0 4px rgba(255, 61, 110, .3); }
.tableCard { background: #0c0d10; color: #fff; box-shadow: 0 10px 24px rgba(12, 13, 16, 0.22); }
.tableCard .tcLive { color: #fff; background: var(--pg-shu); }
.tableCard .tcLive.idle { background: var(--good); }
.tableCard .tcVs em { color: #fff; background: var(--accent); }
.tableCard .tcFoot { color: #a3a8b0; }
@media (prefers-color-scheme: dark) { .tableCard { background: #1a1c22; } }
#roomInput, #roomLink, #namingInput { border: 0; background: var(--ghost); }
#namingInput:focus { outline: 3px solid var(--accent); }
.pg-goal-label { color: #fff !important; background: var(--accent) !important; }
/* 対戦台：左＝青、右＝紫、連勝はグラデーション（ゆびのやつのランクの色） */
.wTitle { background: #0c0d10; color: #fff; }
.wViewers { background: rgba(12, 13, 16, .85); color: #fff; }
.wBoard { background: #0c0d10; color: #fff; }
.wSide.l { background: var(--accent); color: #fff; }
.wSide.r { background: var(--accent-2); color: #fff; }
.wDots u { background: rgba(255, 255, 255, .3); }
.wDots u.on { background: #fff; }
.wStreak { color: #fff; background: linear-gradient(110deg, var(--accent), var(--accent-2) 60%, var(--pg-shu)); }
.pg-btn.queue.l, .pg-btn.vote.l { background: var(--accent); color: #fff; }
.pg-btn.queue.r, .pg-btn.vote.r { background: var(--accent-2); color: #fff; }
.pg-btn.queue.mine, .pg-btn.vote.on { outline: 3px solid #fff; outline-offset: 2px; }
.wVote, .wTurn { background: rgba(12, 13, 16, .92); color: #fff; }
.wTurn .pg-btn { color: var(--btn-text); }
@media (prefers-color-scheme: dark) { .wTurn .pg-btn.shu { background: #fff; color: #0c0d10; } }

/* タイトル：文字とボタンが景色にとけないよう、上を白くぼかす。ボタンは大きく、はっきり（依頼者「タイトル画面のボタン、みづらい」） */
#ovTitle.show { background: linear-gradient(to bottom, rgba(255,255,255,.96) 0%, rgba(255,255,255,.9) 42%, rgba(255,255,255,0) 64%); }
@media (prefers-color-scheme: dark) { #ovTitle.show { background: linear-gradient(to bottom, rgba(12,13,16,.96) 0%, rgba(12,13,16,.9) 42%, rgba(12,13,16,0) 64%); } }
#ovTitle .tFoot { width: min(100%, 340px); align-items: stretch; gap: 12px; }
#ovTitle .tFoot .pg-btn.big { width: 100%; font-size: 22px; padding: 15px 20px; }
#bOnline { color: #fff; background: linear-gradient(110deg, var(--accent) 0%, var(--accent-2) 60%, var(--pg-shu) 115%); box-shadow: 0 12px 30px rgba(91, 76, 255, 0.35); }
#ovTitle .tSign { align-self: flex-start; }
#ovTitle .tLead { box-shadow: none; background: transparent; padding-left: 0; }

/* 対戦台で挑戦者を待つあいだの CPU 練習：観客用の表示は隠し、「もどる」だけ残す（上の点の表示の下へ） */
#watch.practice .wBoard, #watch.practice .wStreak, #watch.practice .wBottom, #watch.practice .wTitle, #watch.practice .wViewers { display: none; }
#watch.practice .wTop { top: calc(52px + env(safe-area-inset-top)); }
/* 会場（暗い）の上の「もどる」は白く */
#bWatchBack { background: #fff; color: #0c0d10; box-shadow: 0 6px 16px rgba(0,0,0,.25); }
