/* =========================================================
   FUGA+  board.css — 盤面・演出
   ========================================================= */
.board-host { position: fixed; inset: 0; z-index: 40; background: var(--bg); }
.board-wrap { height: 100dvh; display: flex; flex-direction: column; }

/* ---------- HUD ---------- */
.board-hud {
  display: flex; align-items: center; gap: 8px;
  padding: calc(8px + env(safe-area-inset-top)) 12px 8px;
  background: rgba(24,27,34,.94); border-bottom: 1.5px solid var(--line);
}
.hud-back { font-size: 20px; padding: 4px 10px; opacity: .85; }
.hud-title { font-family: var(--font-d); font-size: 13px; flex: 1; }
.hud-clock { display: flex; gap: 4px; }
.hud-clock i {
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--card2); border: 1.5px solid var(--line);
}
.hud-clock i.on { background: var(--gold); border-color: var(--gold); box-shadow: 0 0 6px rgba(232,167,21,.55); }
.hud-btn { font-size: 17px; padding: 4px 8px; }
.hud-score { font-family: var(--font-d); font-size: 18px; display: flex; gap: 6px; align-items: center; }
.hud-score .sc-a { color: var(--vivid); }
.hud-score .sc-b { color: #ff8d80; }

/* ---------- ステージ ---------- */
.board-stage { flex: 1; position: relative; display: grid; place-items: center; overflow: hidden; padding: 6px; }
.board-svg { height: 100%; max-width: 100%; filter: drop-shadow(0 6px 20px rgba(0,0,0,.45)); border-radius: 12px; }

/* ---------- トークン ---------- */
.tok { transition: transform .28s cubic-bezier(.25,.8,.35,1); cursor: pointer; }
.tok-ring { stroke: rgba(0,0,0,.35); stroke-width: 1.5; }
.tok-name {
  font-size: 9.5px; fill: #FFFFFF; font-family: var(--font-b);
  paint-order: stroke; stroke: rgba(23,38,63,.85); stroke-width: 2.6px;
}
.tok.is-holder .tok-ring { stroke: var(--gold); stroke-width: 3; }
.tok.is-mine .tok-ring { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse {
  0%,100% { stroke-width: 3; filter: none; }
  50% { stroke-width: 5; filter: drop-shadow(0 0 7px var(--gold)); }
}
.ball { transition: transform .3s cubic-bezier(.25,.8,.35,1); pointer-events: none; }

/* ---------- ハイライト・レーン ---------- */
.hl { pointer-events: none; }
.hl-move { fill: rgba(242,193,78,.22); stroke: var(--gold); stroke-width: 1.6; stroke-dasharray: 5 4; animation: hlblink 1.1s ease-in-out infinite; }
@keyframes hlblink { 50% { fill-opacity: .42; } }
.lane { stroke-width: 3; stroke-dasharray: 7 6; animation: dash 1s linear infinite; pointer-events: none; }
@keyframes dash { to { stroke-dashoffset: -13; } }
.lane-ok { stroke: var(--good); }
.lane-cut { stroke: var(--bad); }
.lane-odds { stroke: var(--gold); }
.lane-dribble { stroke: var(--vivid-2); stroke-dasharray: 3 5; }
.badge { stroke-width: 1.5; }
.badge.good { fill: var(--good); stroke: #2c7a30; }
.badge.mid { fill: var(--gold); stroke: #b08c2e; }
.badge.bad { fill: var(--bad); stroke: #9c372e; }
.badge-t { font-family: var(--font-d); font-size: 12.5px; fill: #fff; }

/* ---------- アクションバー ---------- */
.action-bar {
  min-height: 64px; display: flex; align-items: center; justify-content: center;
  flex-wrap: wrap; gap: 6px; padding: 8px 10px calc(10px + env(safe-area-inset-bottom));
  background: rgba(24,27,34,.94); border-top: 1.5px solid var(--line);
}
.ab-info { font-size: 13px; color: var(--sub); width: 100%; text-align: center; }
.ab-toggle {
  display: flex; align-items: center; gap: 7px; background: var(--card2);
  border: 1.5px solid var(--line); border-radius: 99px; padding: 9px 16px; font-size: 13.5px;
}
.ab-toggle input { width: 18px; height: 18px; accent-color: var(--vivid); }
.ab-toggle.on { border-color: var(--vivid); color: var(--vivid); }

/* ---------- 盤面オーバーレイ ---------- */
.board-overlay:empty { display: none; }
.board-overlay {
  position: absolute; inset: 0; z-index: 50; background: rgba(0,0,0,.6);
  display: grid; place-items: center; padding: 16px;
}
.board-overlay .modal { width: min(380px, 92vw); }

/* ---------- シュートモーダル ---------- */
.sm-goal {
  position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; color: #fff;
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,.14) 0 1px, transparent 1px 12px),
    repeating-linear-gradient(0deg, rgba(255,255,255,.14) 0 1px, transparent 1px 12px),
    #17263F;
  border: 3px solid #fff; border-radius: 8px; padding: 26px 10px 10px; margin: 10px 0;
  box-shadow: var(--shadow);
}
.sm-gk { position: absolute; top: 0; transform: translateX(-50%); font-size: 24px; }
.sm-corner {
  background: rgba(244,122,32,.16); border: 2px dashed rgba(255,255,255,.5); color: #fff;
  border-radius: 8px; padding: 12px 6px; font-size: 12.5px; line-height: 1.5;
}
.sm-corner:active { background: rgba(244,122,32,.4); }
.sm-corner b { font-family: var(--font-d); }
.sm-corner .ok { color: #7fe08a; }
.sm-corner .ng { color: #ff9d92; }

/* ---------- ルーレット ---------- */
.rl-wheel {
  --green: 180deg;
  width: 168px; height: 168px; border-radius: 50%; margin: 14px auto;
  background: conic-gradient(var(--good) 0 var(--green), var(--bad) var(--green) 360deg);
  border: 5px solid #fff; position: relative;
  box-shadow: 0 8px 22px rgba(0,0,0,.45), inset 0 0 0 3px rgba(0,0,0,.22);
}
.rl-needle { /* 0degで12時（緑ゲージの始点）を指す。conic-gradientの基準と一致させる */
  position: absolute; left: 50%; top: calc(50% - 76px); width: 5px; height: 76px;
  margin-left: -2.5px;
  background: #fff; border-radius: 4px; transform-origin: 50% 100%;
  transform: rotate(0deg); box-shadow: 0 0 5px rgba(0,0,0,.5);
}
.rl-needle::after {
  content: ''; position: absolute; left: 50%; top: -13px; transform: translateX(-50%);
  border: 8px solid transparent; border-bottom-color: #fff;
}
.rl-center {
  position: absolute; inset: 0; margin: auto; width: 64px; height: 64px;
  background: #17263F; color: #fff; border: 3px solid #fff; border-radius: 50%;
  display: grid; place-items: center; font-family: var(--font-d); font-size: 16px;
}

/* ---------- 演出 ---------- */
.fx-banner {
  position: absolute; top: 38%; left: 50%; transform: translate(-50%, -50%);
  font-family: var(--font-d); font-size: clamp(26px, 7vw, 40px);
  padding: 12px 26px; border-radius: 16px; white-space: nowrap; z-index: 55;
  animation: bannerIn 1.6s cubic-bezier(.2,1.2,.3,1) both; pointer-events: none;
  text-shadow: 0 3px 0 rgba(0,0,0,.4);
}
.fx-banner.goal { background: var(--vivid); color: #fff; box-shadow: 0 0 0 5px rgba(244,122,32,.35), 0 8px 24px rgba(0,0,0,.5); }
.fx-banner.ng { background: var(--card); color: var(--text); border: 2px solid var(--line); box-shadow: 0 8px 24px rgba(0,0,0,.45); }
@keyframes bannerIn {
  0% { transform: translate(-50%,-50%) scale(.4); opacity: 0; }
  14% { transform: translate(-50%,-50%) scale(1.08); opacity: 1; }
  22% { transform: translate(-50%,-50%) scale(1); }
  82% { opacity: 1; }
  100% { opacity: 0; }
}
.fx-toast {
  position: absolute; bottom: 86px; left: 50%; transform: translateX(-50%);
  background: var(--card); color: var(--text); border: 1.5px solid rgba(242,193,78,.55);
  border-radius: 99px; padding: 10px 18px; font-size: 13px; z-index: 56;
  white-space: nowrap; max-width: 92vw; overflow: hidden; text-overflow: ellipsis;
  box-shadow: 0 6px 18px rgba(0,0,0,.4);
  animation: toastIn .25s ease-out both;
}
@keyframes toastIn { from { transform: translate(-50%, 12px); opacity: 0; } to { transform: translateX(-50%); opacity: 1; } }
.fx-flash {
  font-family: var(--font-d); font-size: 15px; fill: #fff;
  paint-order: stroke; stroke: var(--bad); stroke-width: 4px;
  animation: flashUp .9s ease-out both;
}
@keyframes flashUp { from { opacity: 1; } to { opacity: 0; transform: translateY(-14px); } }
.fx-confetti {
  position: absolute; top: -12px; width: 9px; height: 13px; z-index: 54;
  animation: confettiFall 1.6s ease-in both; pointer-events: none;
}
@keyframes confettiFall {
  0% { transform: translateY(0) rotate(0); opacity: 1; }
  100% { transform: translateY(105vh) rotate(560deg); opacity: .7; }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .tok, .ball { transition: none; }
  .lane, .hl-move, .tok.is-mine .tok-ring, .tl-ball { animation: none; }
  .fx-confetti { display: none; }
}

/* ---------- 漫画コマ風カットイン ---------- */
.fx-cutin {
  position: absolute; left: -4%; right: -4%; top: 32%; height: 132px; z-index: 57;
  transform: skewY(-3deg); overflow: hidden; pointer-events: none;
  border-top: 4px solid #0B1326; border-bottom: 4px solid #0B1326;
  background: #F4F0E4;
  animation: cutinSlide .95s cubic-bezier(.15,1,.3,1) both;
  box-shadow: 0 10px 30px rgba(0,0,0,.45);
}
.ci-burst { /* 集中線 */
  position: absolute; inset: -120%;
  background: repeating-conic-gradient(from 0deg at 50% 50%, #0B1326 0 1.1deg, transparent 1.1deg 7deg);
  opacity: .85;
}
.ci-text {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-family: var(--font-d); font-size: clamp(26px, 7.5vw, 44px); color: #0B1326;
  paint-order: stroke; -webkit-text-stroke: 0;
  text-shadow: 3px 3px 0 #F4F0E4, -3px 3px 0 #F4F0E4, 3px -3px 0 #F4F0E4, -3px -3px 0 #F4F0E4;
  transform: skewY(0deg) rotate(-2deg); letter-spacing: 1px;
  white-space: nowrap; padding: 0 14px; line-height: 1.1;
}
.ci-shoot .ci-text { color: var(--vivid); }
.ci-duel .ci-text { color: var(--red); }
.ci-cut .ci-text { color: var(--blue); }
@keyframes cutinSlide {
  0% { transform: skewY(-3deg) translateX(-105%); }
  18% { transform: skewY(-3deg) translateX(0); }
  78% { transform: skewY(-3deg) translateX(0); opacity: 1; }
  100% { transform: skewY(-3deg) translateX(8%); opacity: 0; }
}
.hl-def { fill: rgba(30,95,168,.3); stroke: #6CBEFF; stroke-width: 1.8; stroke-dasharray: 5 4; animation: hlblink 1.1s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .fx-cutin { display: none; } }

/* ---------- つぎの一手ヒント ---------- */
.hl-hint { fill: rgba(242,193,78,.34); stroke: var(--gold); stroke-width: 2.4; stroke-dasharray: 0; animation: hintGlow .9s ease-in-out infinite; }
@keyframes hintGlow { 50% { fill-opacity: .65; stroke-width: 4; } }
.tok.is-hint .tok-ring { stroke: var(--gold); stroke-width: 5; filter: drop-shadow(0 0 9px var(--gold)); }

/* ---------- カットイン: 残像モーション ---------- */
.fx-cutin .ci-fig {
  position: absolute; left: 2%; bottom: -8%; width: 44%; max-width: 200px; height: 116%;
  pointer-events: none;
}
.ci-pose {
  position: absolute; left: 0; bottom: 0; width: 100%; height: 100%;
  animation: ciDash .95s cubic-bezier(.15,1,.3,1) both;
}
.ci-pose:nth-child(1) { opacity: .30; animation-delay: .10s; transform: translateX(-14%) rotate(-3deg); }
.ci-pose:nth-child(2) { opacity: .45; animation-delay: .06s; transform: translateX(-9%) rotate(-2deg); }
.ci-pose:nth-child(3) { opacity: .62; animation-delay: .03s; transform: translateX(-4.5%) rotate(-1deg); }
.ci-pose:nth-child(4) { opacity: 1; }
@keyframes ciDash {
  0% { translate: -90px 0; }
  26% { translate: 0 0; }
  100% { translate: 14px 0; }
}
.ci-text.with-fig { left: 30%; right: 0; }

/* 守備でボールを奪った瞬間の緑フラッシュ */
.fx-flash-screen { position: absolute; inset: 0; pointer-events: none; z-index: 40; animation: flashFade .42s ease-out forwards; }
.fx-flash-screen.good { background: radial-gradient(circle, rgba(69,192,99,.35), transparent 70%); }
@keyframes flashFade { 0% { opacity: 0; } 30% { opacity: 1; } 100% { opacity: 0; } }
