/* 試し場 (描いて技を出す) の画面: control-draw.js と、story-ui.js の技ノート */

/* ブラウザで: 下へ引っぱる発射が「引っぱって再読みこみ」にならないように */
html, body { overscroll-behavior: none; }

/* 描いた線 (いちばん下の面。さわるのは .st-control そのもの) */
.dr-trail { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

/* 旅のモードの操作の早見は使わない。右下: 説明書に書く技だけの早見 */
.st-control.draw .st-hints { display: none; }
.dr-hints { position: absolute; right: calc(var(--safe-r) + 54px); bottom: var(--safe-b); display: flex; gap: 5px; pointer-events: none; transition: opacity 0.2s; }
.dr-hint { display: flex; flex-direction: column; align-items: center; padding: 3px 8px; background: rgba(7, 5, 26, 0.65); border-bottom: 2px solid var(--c); }
.dr-hint small { font: 700 8.5px var(--font); color: var(--muted); white-space: nowrap; }
.dr-hint b { font: 900 11px var(--font); white-space: nowrap; }
.st-control.countdown .dr-hints { opacity: 0.3; }

/* 自分のコマの回る向き (左下の耐久の上)。円の矢印が、回る向きに回る。左回りは鏡うつし */
.dr-spin { display: flex; align-items: center; gap: 6px; height: 18px; margin-bottom: 2px; color: var(--c, #ffd23d); font: 900 11px var(--font); }
.dr-spin-i { display: inline-flex; width: 16px; height: 16px; }
.dr-spin.left .dr-spin-i { transform: scaleX(-1); }
.dr-spin svg { width: 16px; height: 16px; animation: dr-rot 0.9s linear infinite; filter: drop-shadow(0 0 4px var(--c, #ffd23d)); }
@keyframes dr-rot { to { transform: rotate(360deg); } }

/* 2 本先取のスコア: 点 (CSS の丸) */
.dr-dots { display: inline-flex; gap: 5px; }
.dr-dots i { width: 11px; height: 11px; border-radius: 50%; background: rgba(255, 255, 255, 0.16); box-shadow: inset 0 0 0 1.5px currentColor; }
.dr-dots i.on { background: currentColor; box-shadow: 0 0 8px currentColor; }
.dr-dots.me { color: var(--pink); }
.dr-dots.rival { color: var(--cyan); }

/* 技の名前 (読めたとき、描いた線のそばに一瞬) */
.dr-call { position: absolute; left: 17%; top: 40%; display: flex; flex-direction: column; align-items: center; gap: 2px; opacity: 0; pointer-events: none; transform: translate(-50%, -100%); white-space: nowrap; }
.dr-call b { font: 400 32px var(--display); color: var(--c); transform: skewX(-10deg); text-shadow: 0 0 14px var(--c), 0 0 3px #ffffff, 3px 3px 0 rgba(7, 5, 26, 0.85); }
.dr-call small { padding: 1px 10px; background: rgba(7, 5, 26, 0.82); border-left: 3px solid var(--c); font: 900 12px var(--font); color: #ffffff; transform: skewX(-10deg); }
.dr-call small:empty { display: none; }
.dr-call.dim b { color: #9a97b8; text-shadow: 3px 3px 0 rgba(7, 5, 26, 0.85); }
.dr-call.found b { font-size: 40px; }
.dr-call.show { animation: dr-call 0.95s ease-out forwards; }
.dr-call.show.found { animation-duration: 1.52s; }
@keyframes dr-call {
  0% { opacity: 0; transform: translate(-50%, -70%) scale(0.55); }
  16% { opacity: 1; transform: translate(-50%, -100%) scale(1.14); }
  28% { opacity: 1; transform: translate(-50%, -100%) scale(1); }
  78% { opacity: 1; transform: translate(-50%, -104%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -112%) scale(0.98); }
}

/* 調整モード: 描いた線がどう読まれたか */
.dr-debug { position: absolute; left: var(--safe-l); top: calc(max(8px, env(safe-area-inset-top)) + 40px); display: none; max-width: min(92vw, 560px); padding: 6px 9px; background: rgba(7, 5, 26, 0.8); border-left: 3px solid var(--yellow); color: #e8f7ff; font: 600 10.5px/1.5 ui-monospace, Menlo, Consolas, monospace; white-space: pre-wrap; word-break: break-all; pointer-events: none; }
.st-control.draw.debug .dr-debug { display: block; }
.dr-debug:empty::before { content: "線を描くと、ここに読み取りが出ます"; color: var(--muted); }

/* 試し場の入口: 説明書に書く技 (左は描きかた、右は技の名前と、どうなるか) */
.st-howto-row.dr-how b { background: color-mix(in srgb, var(--c) 22%, transparent); border-left-color: var(--c); }
.dr-how-name { margin-right: 6px; font: 900 12.5px var(--font); font-style: normal; color: var(--c); }
/* 描きかた (左) は 6 字まで (まっすぐ引く・上へはね上げ)。字の途中で折り返さない (「2回タッ / プ」にならないように) */
.st-howto-list:has(.dr-how) .st-howto-row { grid-template-columns: 112px 1fr; }
.st-howto-list:has(.dr-how) .st-howto-row b { white-space: nowrap; padding: 2px 8px; }
body.portrait .st-howto-list:has(.dr-how) .st-howto-row { grid-template-columns: 94px 1fr; }

/* 技一覧 (waza-list.js): 技ごとに、描きかたの絵・名前・描きかた・どうなるか・出した回数 */
.wl-card { display: flex; flex-direction: column; max-height: calc(100vh - 40px); }
.wl-scroll { flex: 1; min-height: 0; max-height: 62vh; overflow-y: auto; margin: 4px 0 10px; padding-right: 4px; overscroll-behavior: contain; }
.wl { display: flex; flex-direction: column; gap: 8px; }
.wl-count { font: 900 12px var(--font); color: var(--muted); }
.wl-row { display: grid; grid-template-columns: 84px 1fr; gap: 12px; align-items: center; padding: 8px 10px 8px 8px; background: rgba(255, 255, 255, 0.045); border-left: 4px solid var(--c); }
.wl-demo { width: 84px; height: 84px; background: rgba(7, 5, 26, 0.75); border-radius: 8px; }
.wl-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.wl-head { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; }
.wl-name { font: 400 16px var(--display); color: var(--c); }
.wl-badge { padding: 1px 8px; border: 1px dashed rgba(255, 255, 255, 0.45); font: 700 10px var(--font); font-style: normal; color: #e8e6ff; }
.wl-how { font: 900 13px/1.4 var(--font); color: #ffffff; }
.wl-what { font: 700 11.5px/1.45 var(--font); color: var(--muted); }
.wl-mine-row { display: flex; align-items: center; gap: 8px; margin-top: 2px; font: 700 10.5px var(--font); color: var(--muted); }
.wl-mine-label { margin-left: 6px; }
.wl-mine { width: 26px; height: 26px; background: rgba(7, 5, 26, 0.6); border-radius: 4px; }
.wl-row.new .wl-name { opacity: 0.85; }
/* 動きを少なくする設定の人には、指の点を出さない (線は描いた形のまま) */
@media (prefers-reduced-motion: reduce) { .wl-finger { display: none; } }
/* 一時停止のメニューの中 (ゲームの絵とは別の大きさ) */
.menu-body .wl-row { grid-template-columns: 96px 1fr; }
.menu-body .wl-demo { width: 96px; height: 96px; }
.menu-body .wl-name { font-size: 20px; }
.menu-body .wl-how { font-size: 16px; }
.menu-body .wl-what { font-size: 14px; }
.menu-body .wl-count, .menu-body .wl-mine-row { font-size: 13px; }

/* 縦持ち: 早見は下の横いっぱい、耐久は右までのばす (必殺のボタンがないので)、読み取りはスコアの下 */
body.portrait .dr-hints { left: var(--safe-l); right: var(--safe-r); bottom: var(--safe-b); justify-content: center; }
body.portrait .dr-hint { padding: 3px 6px; }
body.portrait .dr-hint small { font-size: 8px; }
body.portrait .st-control.draw .st-hud { right: var(--safe-r); }
body.portrait .dr-debug { top: calc(var(--safe-t) + 88px); right: var(--safe-r); max-width: none; font-size: 10px; }
body.portrait .dr-call { left: 50%; top: 74%; }
body.portrait .dr-call b { font-size: 28px; }
body.portrait .dr-call.found b { font-size: 34px; }

/* 技ゲージ・ためは使わない (旅のモードの表示をかくす。左下は名前・回る向き・HP だけ) */
.st-control.draw .st-gauge,
.st-control.draw .st-hud-charge { display: none !important; }
/* クールタイムのあいだは、早見を少し暗く */
.dr-hints.wait { opacity: 0.45; }
