/* お絵かき・絵しりとり固有の見た目（共通は ../common/base.css） */
[hidden] { display: none !important; }
/* 5〜8人目の色（1〜4人目は共通の --p-red・blue・green・yellow）。色と番号の両方で区別する */
:root { --p-purple: #7B52AB; --p-orange: #C96A1E; --p-teal: #1F8A8A; --p-pink: #C2477F; }

/* 遊ぶ人の番号の丸 */
.pb { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--c); color: #FFFFFF; font-weight: 700; font-size: 15px; line-height: 1; font-variant-numeric: tabular-nums; }
.pb.dark { color: #1F2328; }
.status { gap: 8px; flex-wrap: wrap; row-gap: 0; }
.status .st-sub { color: var(--ink-sub); font-weight: 600; font-size: 15px; }
.message.ng { color: var(--ng); }
.turnbar { position: relative; }
.turnbar .status, .turnbar .message { padding-right: 52px; }

/* 時間の輪（手番のバーの右） */
.timer { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; }
.timer svg { width: 44px; height: 44px; transform: rotate(-90deg); }
.timer circle { fill: none; stroke-width: 4; }
.t-bg { stroke: var(--line); }
.t-fg { stroke: var(--accent); stroke-linecap: round; }
.timer.low .t-fg { stroke: var(--ng); }
.timer > span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-weight: 700; font-variant-numeric: tabular-nums; font-size: 15px; }
.timer.low > span { color: var(--ng); }

.board-wrap { max-width: 640px; }
.scr { position: relative; }
/* 紙・絵・カードは、ノートパソコンの低い画面でも道具まで入る大きさに（幅は高さから決める） */
.paper-wrap, .sheet, .pass, .odai-card { max-width: max(300px, calc((100vh - 310px) * 4 / 3)); margin-left: auto; margin-right: auto; }
@supports (height: 100svh) { .paper-wrap, .sheet, .pass, .odai-card { max-width: max(300px, calc((100svh - 310px) * 4 / 3)); } }

/* ---------- 紙 ---------- */
.paper-wrap { position: relative; width: 100%; aspect-ratio: 4 / 3; border: 1px solid var(--line-strong); border-radius: var(--radius); overflow: hidden; background: #FFFFFF; }
#paper { display: block; width: 100%; height: 100%; touch-action: none; cursor: crosshair; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.paper-wrap.eraser #paper { cursor: cell; }
/* 前の絵（左上に小さく。押すと大きく） */
.ref { position: absolute; left: 6px; top: 6px; width: 22%; aspect-ratio: 4 / 3; padding: 0; border: 2px solid var(--c, var(--accent)); border-radius: 4px; background: #FFFFFF; cursor: zoom-in; overflow: hidden; filter: var(--shadow-piece); }
.ref img { display: block; width: 100%; height: 100%; object-fit: contain; }
.draw-tag { position: absolute; right: 6px; top: 6px; max-width: 60%; padding: 4px 10px; background: rgba(255, 255, 255, .92); border: 1.5px solid #D9D6CE; border-radius: 4px; color: #1F2328; font-weight: 700; font-size: 16px; pointer-events: none; }
.draw-tag rt { font-weight: 400; }

/* ---------- 道具 ---------- */
.tools { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin-top: 8px; }
.tool {
  appearance: none; font: inherit; min-height: var(--tap); padding: 2px 2px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  border: 1.5px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); color: var(--ink); cursor: pointer; font-size: 14px; line-height: 1.2; touch-action: manipulation;
}
.tool svg { width: 20px; height: 20px; fill: currentColor; }
.tool.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 700; box-shadow: inset 0 0 0 1px var(--accent); }
.tool[data-size].on svg circle { fill: var(--pen, currentColor); stroke: var(--accent); stroke-width: .8; }
.tool.armed { border-color: var(--ng); color: var(--ng); font-weight: 700; }
.tool:active:not(:disabled) { transform: translateY(1px); }
.tool:disabled { opacity: .45; cursor: not-allowed; border-style: dashed; }
.tool:focus-visible, .sw:focus-visible, .ref:focus-visible, .thumb:focus-visible { outline: 3px solid var(--warn); outline-offset: 2px; }

.palette { display: grid; grid-template-columns: repeat(12, 1fr); gap: 6px; margin-top: 6px; }
.sw { appearance: none; font: inherit; min-height: var(--tap); padding: 0; border: 1.5px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); cursor: pointer; display: flex; align-items: center; justify-content: center; touch-action: manipulation; position: relative; }
.sw-dot { width: 26px; height: 26px; border-radius: 50%; background: var(--sw); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .18); }
.sw-name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.sw.on { border-color: var(--accent); box-shadow: inset 0 0 0 2px var(--accent); background: var(--accent-soft); }
.sw.on .sw-dot { box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .18), 0 0 0 3px var(--surface), 0 0 0 5px var(--sw); }

.acts { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.acts .btn { flex: 1 1 0; white-space: nowrap; padding: 0 10px; }
.acts .btn.big, .btn.big { min-height: 52px; font-size: 18px; }
#acts-odai #got { flex: 1.4 1 0; }

/* ---------- 渡す画面 ---------- */
.pass { display: flex; align-items: center; justify-content: center; aspect-ratio: 4 / 3; border: 2px dashed var(--c, var(--accent)); border-radius: var(--radius); background: var(--board); color: #1F2328; }
.pass-card { text-align: center; padding: 16px; max-width: 460px; }
.pass-who { display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 1.5rem; font-weight: 700; margin: 0 0 8px; }
.pass-who .pb { width: 38px; height: 38px; font-size: 21px; }
.pass-text { font-size: 1.1rem; font-weight: 700; margin: 0 0 6px; }
.pass-sub { color: #5B616B; margin: 0 0 16px; }
.pass .btn.big { min-width: 220px; }

/* ---------- 絵を見る・答え ---------- */
.sheet { margin: 0; aspect-ratio: 4 / 3; border: 2px solid var(--c, var(--line)); border-radius: var(--radius); background: #FFFFFF; overflow: hidden; }
.sheet img { display: block; width: 100%; height: 100%; object-fit: contain; }
.ask { font-weight: 700; margin: 10px 0 0; line-height: 1.5; }
.ask .head { color: var(--accent); }
.row-btns { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.row-btns .btn { flex: 1 1 0; white-space: nowrap; }

/* 答えを入れる */
.word-top { display: flex; gap: 12px; align-items: center; }
.thumb { flex: none; width: 34%; aspect-ratio: 4 / 3; padding: 0; border: 2px solid var(--c, var(--line)); border-radius: var(--radius); background: #FFFFFF; overflow: hidden; cursor: zoom-in; }
.thumb img { display: block; width: 100%; height: 100%; object-fit: contain; }
.word-top .ask { margin: 0; }
.word-form { margin-top: 14px; }
.word-label { display: block; font-size: 15px; color: var(--ink-sub); margin-bottom: 6px; }
.word-row { display: flex; gap: 8px; }
#word { flex: 1; min-width: 0; min-height: 52px; padding: 0 12px; font: inherit; font-size: 24px; font-weight: 700; border: 2px solid var(--accent); border-radius: var(--radius); background: var(--surface); color: var(--ink); }
#word::placeholder { font-size: 16px; font-weight: 400; color: var(--ink-sub); }
#word.shake { animation: shake .3s; }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.word-row .btn { min-height: 52px; font-size: 18px; padding: 0 18px; }
.word-note { margin: 8px 0 0; font-size: 15px; color: var(--ink-sub); }
.word-note.ng { color: var(--ng); font-weight: 700; }
input[type=search] { -webkit-appearance: none; appearance: none; }
input[type=search]::-webkit-search-cancel-button, input[type=search]::-webkit-search-decoration { display: none; -webkit-appearance: none; }

/* お題カード */
.odai-card { position: relative; aspect-ratio: 4 / 3; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 16px; border: 2px solid var(--c, var(--accent)); border-radius: var(--radius); background: var(--board); color: #1F2328; text-align: center; filter: var(--shadow-piece); }
.odai-card.flip { animation: flip .35s ease-out; }
@keyframes flip { from { transform: rotateY(90deg); } to { transform: none; } }
.odai-lv { position: absolute; left: 12px; top: 10px; font-size: 14px; color: #5B616B; border: 1px solid #D9D6CE; border-radius: 999px; padding: 1px 10px; background: #FFFFFF; }
.odai-word { font-size: clamp(34px, 9vw, 56px); font-weight: 700; margin: 0 0 12px; line-height: 1.5; }
.odai-word rt { font-size: max(.36em, 12px); font-weight: 400; color: #5B616B; }
.odai-note { font-size: 15px; color: #5B616B; margin: 0; max-width: 26em; }

/* 当てた人 */
.who-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin-top: 10px; }
.who-btn { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 56px; font-size: 18px; border-color: var(--c); color: var(--ink); }

/* お題あての答え */
.ans-line { font-size: 1.4rem; font-weight: 700; text-align: center; margin: 10px 0 2px; }
.ans-line rt { font-size: max(.45em, 11px); font-weight: 400; }
.ans-sub { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 6px; margin: 0; font-weight: 700; }

/* 答え合わせ */
.rv-count { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font-weight: 700; }
.rv-count .st-sub { margin-left: auto; color: var(--ink-sub); font-size: 15px; }
.rv-box { min-height: 96px; display: flex; flex-direction: column; align-items: center; justify-content: center; margin-top: 8px; text-align: center; }
.rv-ask { margin: 0; color: var(--ink-sub); font-weight: 700; }
.rv-word { margin: 0; font-size: 2rem; font-weight: 700; letter-spacing: .04em; animation: pop-in .25s ease-out; }
.rv-link { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 6px 8px; margin: 4px 0 0; font-size: 17px; }
.lk-prev, .lk-next { font-weight: 600; }
.lk-arr { color: var(--ink-sub); }
.lk-ok, .lk-ng { font-weight: 700; font-size: 20px; padding: 2px 12px; border: 2px solid currentColor; border-radius: 999px; animation: pop-in .25s ease-out; }
.lk-ok { color: var(--ok); }
.lk-ng { color: var(--ng); }
b.tl { color: var(--accent); text-decoration: underline 2px; text-underline-offset: 4px; }
.hd { color: var(--accent); text-decoration: underline 2px; text-underline-offset: 4px; font-weight: 700; }
@keyframes pop-in { from { transform: scale(.85); opacity: 0; } to { transform: none; opacity: 1; } }

/* まとめ */
.sum-title { font-size: 1.4rem; text-align: center; margin: 4px 0; }
.sum-main { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 6px; text-align: center; font-weight: 700; font-size: 1.1rem; margin: 0 0 10px; }
.rank { list-style: none; padding: 0; margin: 0 auto 12px; max-width: 320px; }
.rank li { display: flex; align-items: center; gap: 8px; padding: 4px 0; border-bottom: 1px solid var(--line); }
.rank .rk { width: 3em; font-weight: 700; }
.rank .sc { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; }
.sum-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.sum-list li { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; padding: 6px; border: 1.5px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.sum-list li.ng { border-color: var(--ng); }
.sum-list img { width: 100%; aspect-ratio: 4 / 3; object-fit: contain; background: #FFFFFF; border-radius: 4px; border: 1px solid var(--line); }
.sum-list .sl-w { font-weight: 700; display: flex; flex-direction: column; line-height: 1.3; }
.sum-list small { font-weight: 400; font-size: 14px; color: var(--ink-sub); }
.sum-list .sl-mark { position: absolute; left: 10px; top: 8px; width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; background: var(--surface); color: var(--ok); border: 2px solid var(--ok); z-index: 1; font-size: 16px; }
.sum-list li.ng .sl-mark { color: var(--ng); border-color: var(--ng); }
.sum-list .sl-start { justify-content: center; flex-direction: column; background: var(--board); color: #1F2328; min-height: 80px; }
.sum-list .sl-start .st-sub { font-size: 14px; color: #5B616B; }
.note { color: var(--ink-sub); font-size: 15px; margin: 10px 0 0; text-align: center; }
.controls.center { justify-content: center; }

/* 作品 */
.works { list-style: none; padding: 0; margin: 10px 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.works li { display: flex; flex-direction: column; gap: 6px; padding: 6px; border: 1.5px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.works li.empty { grid-column: 1 / -1; color: var(--ink-sub); border-style: dashed; padding: 16px; }
.works img { width: 100%; aspect-ratio: 4 / 3; object-fit: contain; background: #FFFFFF; border-radius: 4px; border: 1px solid var(--line); }
.wk-d { font-size: 14px; color: var(--ink-sub); }
.wk-b { display: flex; gap: 4px; }
.btn.small { flex: 1 1 0; min-height: var(--tap); padding: 0 4px; font-size: 14px; white-space: nowrap; }
.btn.armed { border-color: var(--ng); color: var(--ng); }

/* 大きく見る */
.zoom { position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 8px; background: color-mix(in srgb, var(--surface) 94%, transparent); }
.zoom img { max-width: 100%; max-height: calc(100% - 64px); aspect-ratio: 4 / 3; object-fit: contain; background: #FFFFFF; border: 2px solid var(--line-strong); border-radius: var(--radius); cursor: zoom-out; }

.controls.bar { margin-top: 10px; }
.linkbtn { display: inline-flex; align-items: center; text-decoration: none; }
.rules-detail summary { cursor: pointer; color: var(--accent); font-weight: 600; min-height: var(--tap); display: flex; align-items: center; }
.rule-row { margin: 8px 0 12px; }
.rl { display: block; font-size: 14px; color: var(--ink-sub); margin-bottom: 4px; }

@media (max-width: 560px) {
  .palette { grid-template-columns: repeat(6, 1fr); }
}
@media (max-width: 480px) {
  .stage { padding: 8px; }
  .tools { gap: 4px; }
  .tool { font-size: 14px; padding: 2px 0; letter-spacing: -.02em; }
  .tool svg { width: 18px; height: 18px; }
  .palette { gap: 4px; }
  .sw { min-height: 40px; }
  .acts .btn { font-size: 15px; padding: 0 6px; }
  .acts .btn.big { font-size: 17px; }
  #acts-free .btn { flex: 1 1 40%; }
  .controls .btn.icon { padding: 0 9px; }
  .pass-who { font-size: 1.3rem; }
  .pass-sub { margin-bottom: 12px; }
  .pass-text { font-size: 1rem; }
  .rv-word { font-size: 1.6rem; }
  .odai-note { font-size: 14px; }
  .sum-list { grid-template-columns: repeat(2, 1fr); }
  .works { grid-template-columns: repeat(2, 1fr); }
  .wk-b { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
  #word.shake, .odai-card.flip, .rv-word, .lk-ok, .lk-ng { animation: none; }
}
/* 上のバーの高さを一定に（No.93。数字は一番長い文が画面の幅（360px・375px 以上・641px 以上）で何行になるか。--tb-rt はふりがなの分。base.css・turnbar.js） */
.turnbar { --tb-msg-lines: 3; --tb-st-lines: 1; --tb-rt: 0px; --tb-st-rt: 0px; }
@media (min-width: 375px) { .turnbar { --tb-msg-lines: 3; --tb-st-lines: 1; } }
@media (min-width: 641px) { .turnbar { --tb-msg-lines: 1; --tb-st-lines: 1; } }
/* 上のバーの高さ ここまで */
