/*! 
 * Volleyball Typing Game - style.css (refactored)
 * ------------------------------------------------------------
 * 目的:
 * - 重複していたセレクタ/定義を統合
 * - インデント/段落（余白）を整理
 * - 不足していたコメントアウトを補完（セクション単位 + 重要ポイント）
 *
 * 方針:
 * - .player の移動は「transform + CSS変数」で一本化
 *   （data-player-indexの微調整 / サーブ場外演出 が競合しない）
 * - .server-outside の場外表示は position:absolute を使わず、transform で“スライド”
 *   （Gridレイアウトが詰め直される問題を避ける）
 */

/* =========================================================
   0) Global reset / base
========================================================= */

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;

  font-family: Arial, Helvetica, sans-serif;
  background: #f0f0f0;

  /* ゲームは常時フルスクリーン寄りで運用する想定 */
  overflow: hidden;
}

/* =========================================================
   1) Utility
========================================================= */

/* 共通: 非表示（ただし timer だけは個別に上書きして「領域確保」します） */
.hidden {
  display: none !important;
}

/* =========================================================
   2) Top navigation bar
========================================================= */

.top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;

  display: flex;
  justify-content: flex-end;
  align-items: center;

  padding: 0.5rem 1rem;
  background: rgba(255, 255, 255, 0.85);

  z-index: 1000;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.nav-buttons button {
  margin-left: 0.5rem;
}

/* =========================================================
   3) Overlays (mode selection / pause overlay)
========================================================= */

.overlay {
  position: fixed;
  inset: 0;

  display: flex;
  justify-content: center;
  align-items: center;

  background: rgba(0, 0, 0, 0.6);
  z-index: 2000;
}

/* =========================================================
   一時停止オーバーレイだけは上のトップバーを覆わない
   → 「再開」ボタンをクリックできるようにする
========================================================= */
#pause-overlay{
  inset: 50px 0 0 0;   /* 上50pxは空ける（#game-container の top と同じ） */
  z-index: 900;        /* top-bar(1000) より下にする */
}

.overlay-content {
  background: #ffffff;
  padding: 2rem;
  border-radius: 8px;

  text-align: center;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.mode-buttons button {
  margin: 0.5rem;
  padding: 0.75rem 1.5rem;

  font-size: 1.2rem;
}

/* =========================================================
   3-2) Practice background（打ち込み練習：practice1.jpg を全画面表示）
========================================================= */
.practice-bg{
  position: fixed;
  inset: 0;
  background: url("practice1.jpg") center / cover no-repeat;
  z-index: 5; /* game-container の背面、overlay の前 */
}

/* 打ち込み練習中はコート一式を隠して背景を見せる */
body.mode-practice #facebar,
body.mode-practice #court,
body.mode-practice #scoreboard{
  display: none !important;
}

/* =========================================================
   4) Game container / task UI
========================================================= */

#game-container {
  position: absolute;
  top: 50px; /* top-bar の高さを考慮 */
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;  /* ← これを追加 */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;

  overflow: hidden;
}

/* ---------------------------------------------------------
   4-1) Word display (課題表示)
   - 課題が空でも高さが揺れないように固定
--------------------------------------------------------- */

#word-display {
  margin-top: 1rem;
  margin-bottom: 0.1rem;

  /* ★重要：ruby(ふりがな)込みでも収まる目安。必要なら調整 */
  height: 96px;

  display: flex;
  justify-content: center;
  align-items: center;

  font-size: 2rem;
  font-weight: bold;
  text-align: center;
}

/* ★入力進捗（ローマ字）を見える化 */
#word-display ruby{
  margin: 0 0.15em;
}
#word-display rt{
  font-size: 0.72em;
  letter-spacing: 0.04em;
}
#word-display rt .rt-typed{
  opacity: 0.35;
  text-decoration: line-through;
}
#word-display.mistake{
  animation: tvShake 0.12s linear 0s 2;
}
@keyframes tvShake{
  0%{ transform: translateX(0); }
  25%{ transform: translateX(-3px); }
  50%{ transform: translateX(3px); }
  75%{ transform: translateX(-2px); }
  100%{ transform: translateX(0); }
}

/* ★課題が空のときは「高さは維持して見えない」ようにする */
#word-display:empty {
  opacity: 0;
}

/* ---------------------------------------------------------
   4-2) Countdown timer (制限時間表示)
   - .hidden でも display:none にせず、領域を確保してレイアウト揺れを防ぐ
--------------------------------------------------------- */

#timer-display {
  margin: 0 auto 0.8rem;
  width: fit-content;

  padding: 0.25rem 0.85rem;
  border-radius: 999px;

  font-size: 1.05rem;
  font-weight: 800;

  color: #fff;
  background: rgba(0, 0, 0, 0.35);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
  letter-spacing: 0.04em;

  /* 高さを固定して揺れを防ぐ（推奨） */
  min-height: 34px;
}


/* ★timer は hidden でも領域を確保する（.hidden の display:none を打ち消す） */
#timer-display.hidden {
  display: block !important;
  visibility: hidden;
}

/* =========================================================
   Face-up bar (選手フェイスアップ帯)
========================================================= */

#facebar{
  width: 96%;
  max-width: 1400px;

  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;

  margin: 6px auto 6px;
  padding: 6px 10px;

  /* 背景はスクショの雰囲気に寄せて「薄い白」 */
  background: rgba(255, 140, 0, 0.411);
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.10);
}

/* 左右チームの並び */
.facebar-team{
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

/* 1人ぶん（ボタン） */
.facechip{
  width: 78px;
  text-align: center;

  background: transparent;
  border: none;
  padding: 0;
}

.facechip:focus-visible{
  outline: 3px solid rgba(0,0,0,0.35);
  outline-offset: 4px;
  border-radius: 10px;
}

/* 顔画像枠 */
.facechip .faceimg{
  width: 72px;
  height: 72px;
  object-fit: cover;

  border-radius: 6px;
  background: #fff;
  box-shadow: 0 3px 8px rgba(0,0,0,0.12);
}

/* 左（静岡）= グリーン枠、右（清水）= ピンク枠 */
.facebar-left .facechip .faceimg{
  border: 4px solid #20b26b;
}
.facebar-right .facechip .faceimg{
  border: 4px solid #ff6aa2;
}

/* 名前（英字ラベル） */
.facechip .facename{
  margin-top: 4px;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.04em;
  color: #111;

  /* 白フチっぽくしてコート背景でも読めるように */
  text-shadow:
    0 1px 0 rgba(255,255,255,0.9),
    0 0 6px rgba(255,255,255,0.6);
}

/* =========================================================
   5) Court
========================================================= */

#court {
  position: relative;

  /* ★横幅制限を外して全画面寄りにする */
  width: 100vw;
  max-width: none;

  flex: 1;
  display: flex;

  margin-bottom: 0.5rem;
  border: 4px solid #333;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);

  /* サーブ演出など、場外要素も見せる */
  overflow: visible;

  /* ★コート背景（画像差し替え） */
  background-image: url("coat.jpg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

/* ★背景画像を使うので、左右色分けの疑似要素は無効化 */
#court::before,
#court::after {
  content: none;
  display: none;
}

/* ---------------------------------------------------------
   5-1) Teams (6人配置: 3x2)
--------------------------------------------------------- */

.team {
  flex: 1;

  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(2, 1fr);

  position: relative;
  padding: 1rem;
  z-index: 1;
}

/* ---------------------------------------------------------
   5-2) Net
--------------------------------------------------------- */

#net {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;

  transform: translateX(-50%);
  width: 6px;

  background: repeating-linear-gradient(
    to bottom,
    #444 0px,
    #444 4px,
    transparent 4px,
    transparent 8px
  );

  z-index: 2;
}

/* =========================================================
   6) Players
========================================================= */

/* ---------------------------------------------------------
   6-1) Player base box
--------------------------------------------------------- */

.player {
  width: 140px;
  height: 160px;
  margin: auto;
  position: relative;

  cursor: pointer;
  user-select: none;

  /* ----------------------------
     transform で移動を一本化するための変数
     - --adj-x/y   : 個別位置微調整
     - --serve-x/y : サーブ場外演出
  ---------------------------- */
  --adj-x: 0px;
  --adj-y: 0px;
  --serve-x: 0px;
  --serve-y: 0px;

  /* ★重要：ここが最終的な移動式（微調整 + サーブ演出の合算） */
  transform:
    translate(var(--adj-x), var(--adj-y))
    translate(var(--serve-x), var(--serve-y));

  /* スライド（動き） */
  --move-ms: 420ms;
  transition: transform var(--move-ms) cubic-bezier(0.2, 0.9, 0.2, 1);
  will-change: transform;
}

/* 動きを減らしたい環境ではアニメーション停止 */
@media (prefers-reduced-motion: reduce) {
  .player {
    transition: none !important;
  }
}

/* ---------------------------------------------------------
   6-2) Player image (PNG/GIF)
   - コート上のスプライト表示
--------------------------------------------------------- */

.player img.player-sprite {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* 左チーム側は左右反転（ミラー） */
.player.is-left img.player-sprite {
  transform: scaleX(-1);
  transform-origin: center;
}

.player.is-right img.player-sprite {
  transform: none;
}

/* ---------------------------------------------------------
   6-3) Fallback (棒人間: 疑似要素)
--------------------------------------------------------- */

.player::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;

  transform: translateX(-50%);

  width: 30px;
  height: 30px;
  border-radius: 50%;

  background: #ffea87;
  border: 2px solid #333;
}

.player::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;

  transform: translateX(-50%);

  width: 24px;
  height: 30px;

  background: #3366cc;
  border-radius: 4px;
}

/* PNGスプライト表示時は棒人間を消す */
.player.has-sprite::before,
.player.has-sprite::after {
  content: none;
  display: none;
}

/* 読み込み失敗時は棒人間に戻す（保険） */
.player.img-error::before,
.player.img-error::after {
  content: "";
  display: block;
}

/* ---------------------------------------------------------
   6-4) Active player highlight
   - PNG表示時でも見えるように「本体」にも効果を出す
--------------------------------------------------------- */

.player.active {
  filter: drop-shadow(0 10px 12px rgba(0, 0, 0, 0.18));
  outline: 3px solid rgba(255, 255, 255, 0.7);
  outline-offset: 4px;
}

/* 棒人間が有効な場合は “点滅” も追加 */
.player.active::before,
.player.active::after {
  animation: tv-flash 1s infinite;
}

@keyframes tv-flash {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.3;
  }
}

/* ---------------------------------------------------------
   6-5) Server outside (サーブ場外演出)
   - position:absolute を使わず、transform でスライド
   - 既存の .team-left/.team-right / .is-left/.is-right の両方に対応
--------------------------------------------------------- */

.player.server-outside {
  z-index: 5;
  filter: drop-shadow(0 10px 12px rgba(0, 0, 0, 0.25));
  outline: 3px solid rgba(255, 255, 255, 0.85);
  outline-offset: 4px;
}

/* 左チームは左＋下へ、右チームは右＋下へスライド */
.team-left .player.server-outside,
.player.is-left.server-outside {
  --serve-x: clamp(-110px, -8vw, -70px);
  --serve-y: clamp(120px, 10vh, 180px);
}

.team-right .player.server-outside,
.player.is-right.server-outside {
  --serve-x: clamp(110px, 8vw, 70px);
  --serve-y: clamp(120px, 10vh, 180px);
}

/* =========================================================
   7) Ball
========================================================= */

#ball {
  position: absolute;

  /* ★ボール画像（GIF）に変更 */
  width: 30px;
  height: 30px;
  background: url("ball.gif") center / contain no-repeat;

  /* 旧: CSSの円（グラデ/枠）を無効化 */
  border: none;
  border-radius: 0;

  z-index: 3;
  display: none;
  pointer-events: none;
}


/* =========================================================
   8) Scoreboard
========================================================= */

#scoreboard {
  width: 90%;
  max-width: 1200px;

  display: flex;
  justify-content: space-between;

  background: rgba(255, 255, 255, 0.85);
  padding: 0.5rem 1rem;
  border-radius: 5px;

  font-size: 1rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);

  margin-bottom: 0.5rem;
}

.team-score {
  flex: 1;

  display: flex;
  flex-direction: column;
  align-items: center;
}

.team-header {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.team-name {
  font-weight: bold;
}

.current-score {
  font-size: 1.6rem;
}

.set-scores {
  display: flex;
  gap: 0.25rem;
  margin-top: 0.25rem;
}

.set-score {
  width: 1.6rem;
  text-align: center;

  border: 1px solid #333;
  border-radius: 4px;

  padding: 0.1rem;
  background: #eeeeee;

  font-size: 0.8rem;
}

/* =========================================================
   9) Generic modals (set summary / ranking / status / gameover)
========================================================= */

.modal {
  position: fixed;
  inset: 0;

  display: flex;
  justify-content: center;
  align-items: center;

  background: rgba(0, 0, 0, 0.6);
  z-index: 3000;
}

.modal-content {
  background: #ffffff;
  padding: 2rem;
  border-radius: 8px;

  width: 90%;
  max-width: 600px;

  text-align: center;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.modal-buttons {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-top: 1rem;
}

/* ---------------------------------------------------------
   9-1) Ranking table
--------------------------------------------------------- */

#ranking-modal table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  font-size: 0.9rem;
}

#ranking-modal th,
#ranking-modal td {
  border: 1px solid #cccccc;
  padding: 0.4rem;
}

#ranking-modal th {
  background: #f5f5f5;
}

/* =========================================================
   10) Player Card Modal (click player -> show)
   - 上帯（ローマ字/日本語名）
   - 左：画像(GIF) / 右：ステータス
========================================================= */

#player-card-modal {
  z-index: 3600; /* 既存 modal (3000) より上 */

  /* テーマカラー（data-theme で切り替え） */
  --pc-accent: #0aa57a; /* デフォルト：静岡温泉グリーン */
  --pc-accent-text: #0aa57a;
  --pc-ink: #0f172a;
  --pc-bg: #ffffff;
  --pc-border: #0aa57a;
}

#player-card-modal[data-theme="onsen"] {
  --pc-accent: #0aa57a;
  --pc-accent-text: #0aa57a;
  --pc-border: #0aa57a;
}

#player-card-modal[data-theme="sakuraebi"] {
  --pc-accent: #f08fb6;      /* 桜ピンク */
  --pc-accent-text: #e85c94; /* 文字は少し濃いピンク */
  --pc-border: #f08fb6;
}

/* カード本体 */
#player-card-modal .pc-content {
  position: relative;

  width: min(980px, 92vw);

  /* ★高さ制限：画面に収める */
  max-height: 88vh;

  /* 最終行が切れる場合は、ここを auto にする（ただしスクロールが出る） */
  overflow: hidden;

  background: var(--pc-bg);
  border: 4px solid var(--pc-border);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.35);
}

/* 閉じるボタン（右上） */
#player-card-modal .pc-close {
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 2;

  width: 44px;
  height: 44px;

  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.85);

  background: rgba(0, 0, 0, 0.18);
  color: #fff;

  font-size: 24px;
  font-weight: 900;
  line-height: 1;
}

#player-card-modal .pc-close:hover {
  background: rgba(0, 0, 0, 0.28);
}

/* 上帯 */
#player-card-modal .pc-header {
  background: var(--pc-accent);
  padding: 14px 20px 12px;
  color: #fff;
}

/* ローマ字（上） */
#player-card-modal .pc-roman {
  text-align: center;
  font-weight: 900;
  letter-spacing: 0.10em;
  font-size: clamp(22px, 3vw, 38px);
  line-height: 1.05;
}

/* 日本語名（大） */
#player-card-modal .pc-jp {
  text-align: center;
  font-weight: 1000;
  font-size: clamp(34px, 5vw, 62px);
  line-height: 1.05;

  margin-top: 4px;
  text-shadow: 0 4px 0 rgba(0, 0, 0, 0.15);
}

/* サブ（高校/ポジション） */
#player-card-modal .pc-sub {
  text-align: center;
  font-weight: 800;
  font-size: 14px;
  opacity: 0.95;
  margin-top: 6px;
}

/* 本文（左画像 / 右ステ） */
#player-card-modal .pc-body {
  display: grid;
  grid-template-columns: 0.38fr 0.62fr;
  background: #fff;
}

/* 左：画像 */
#player-card-modal .pc-avatar {
  display: flex;
  align-items: flex-end;
  justify-content: center;

  padding: 18px 10px 14px;
  background: #fff;
}

#player-card-modal .pc-avatar img {
  width: 100%;
  max-width: 340px;
  max-height: 520px;

  object-fit: contain;
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.18));

  /* ★GIFの位置調整（Y軸） */
  transform: translateY(-140px);
}

/* 右：ステータス */
#player-card-modal .pc-right {
  padding: 18px 18px 14px 10px;
  color: var(--pc-accent-text);
}

/* ステータスの集合体（dl想定でもdiv想定でも崩れないように） */
#player-card-modal .pc-stats {
  margin: 0;
  padding: 0;

  /* 最終行が切れる対策：行間を詰める */
  display: grid;
  gap: 4px;
}

/* 1行ずつ：ラベル/値（dlの dt/dd でも、divでも使えるように） */
#player-card-modal .pc-row,
#player-card-modal .pc-stat {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;

  gap: 12px;

  /* 最終行が切れる対策：上下余白を詰める */
  padding: 3px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);

  /* 最終行が切れる対策：行高を少し詰める */
  line-height: 1.05;
}

/* dt / dd の場合 */
#player-card-modal .pc-row dt {
  margin: 0;
  font-weight: 900;
  letter-spacing: 0.02em;
  font-size: clamp(18px, 2.2vw, 28px);
}

#player-card-modal .pc-row dd {
  margin: 0;
  font-weight: 1000;
  font-size: clamp(18px, 2.2vw, 30px);

  min-width: 3ch;
  text-align: right;
}

/* div の場合（.pc-stat 内で span などを想定） */
#player-card-modal .pc-stat > :first-child {
  font-weight: 900;
  letter-spacing: 0.02em;
  font-size: clamp(18px, 2.2vw, 28px);
}

#player-card-modal .pc-stat > :last-child {
  font-weight: 1000;
  font-size: clamp(18px, 2.2vw, 30px);

  min-width: 3ch;
  text-align: right;
}

/* 「現在のレベル」行など、見出し的な塊の余白（存在する場合だけ効く） */
#player-card-modal .pc-levelrow {
  margin: 6px 0 10px;
}

/* 紹介文 */
#player-card-modal .pc-intro {
  margin-top: 12px;
  color: rgba(15, 23, 42, 0.86);

  font-weight: 700;
  font-size: 14px;
  line-height: 1.55;
}

/* スキル */
#player-card-modal .pc-skills {
  margin-top: 12px;
}

#player-card-modal .pc-skills-title {
  font-weight: 1000;
  color: rgba(15, 23, 42, 0.88);
  font-size: 13px;
  margin-bottom: 6px;
}

#player-card-modal .pc-skill-list {
  margin: 0;
  padding-left: 18px;

  color: rgba(15, 23, 42, 0.80);
  font-size: 13px;
  line-height: 1.45;
}

/* スマホ時：縦積み */
@media (max-width: 720px) {
  #player-card-modal .pc-body {
    grid-template-columns: 1fr;
  }

  #player-card-modal .pc-right {
    padding: 12px 16px 14px;
  }

  #player-card-modal .pc-avatar img {
    max-height: 340px;
  }
}

/* =========================================================
   11) Buttons (global)
========================================================= */

button {
  cursor: pointer;

  padding: 0.5rem 1rem;
  border: none;
  border-radius: 4px;

  background: #007bff;
  color: #ffffff;

  font-size: 1rem;
  transition: background 0.2s;
}

button:hover {
  background: #0056b3;
}

button:disabled {
  background: #aaaaaa;
  cursor: not-allowed;
}

/* =========================================================
   12) 個別位置微調整（data-player-index単位）
   +x：右へ、-x：左へ、+y：下へ、-y：上へ
========================================================= */

/*
 * 重要:
 * - 微調整は transform 直書きをやめ、変数（--adj-x/y）で持つ
 * - サーブ場外はさらに別変数（--serve-x/y）を足す
 * - transform に transition を付けるので “スライド移動” になる
 */

/* 左チーム（0〜5） */
.player[data-player-index="0"] { --adj-x: 120px; --adj-y: -10px; }
.player[data-player-index="1"] { --adj-x:  50px; --adj-y: -10px; }
.player[data-player-index="2"] { --adj-x:   0px; --adj-y: -10px; }
.player[data-player-index="3"] { --adj-x:  80px; --adj-y: -20px; }
.player[data-player-index="4"] { --adj-x:  20px; --adj-y: -20px; }
.player[data-player-index="5"] { --adj-x: -20px; --adj-y: -20px; }

/* 右チーム（6〜11） */
.player[data-player-index="6"]  { --adj-x:  -20px; --adj-y: -20px; }
.player[data-player-index="7"]  { --adj-x:  -80px; --adj-y: -20px; }
.player[data-player-index="8"]  { --adj-x: -150px; --adj-y: -20px; }
.player[data-player-index="9"]  { --adj-x:    0px; --adj-y: -20px; }
.player[data-player-index="10"] { --adj-x:  -50px; --adj-y: -20px; }
.player[data-player-index="11"] { --adj-x: -120px; --adj-y: -20px; }

/* =========================================================
   Player Card Modal: 微調整（intro切れ対策 + ステータス一段小さく）
   - 既存定義を「追記で上書き」するため、ここは style.css の一番下に置く
========================================================= */

/* ステータス行どうしの間隔を少し詰める */
#player-card-modal .pc-stats{
  gap: 3px; /* 4px → 3px */
}

/* ステータス各行：上下余白 & 行高を少し詰める */
#player-card-modal .pc-row,
#player-card-modal .pc-stat{
  padding: 2px 0;   /* 3px → 2px */
  line-height: 1.0; /* 1.05 → 1.0 */
}

/* dl(dt/dd) の場合：フォントを一段小さく */
#player-card-modal .pc-row dt{
  font-size: clamp(16px, 2.0vw, 26px); /* (18/2.2/28) → (16/2.0/26) */
}
#player-card-modal .pc-row dd{
  font-size: clamp(16px, 2.0vw, 28px); /* (18/2.2/30) → (16/2.0/28) */
}

/* div(.pc-stat) の場合：フォントを一段小さく（保険） */
#player-card-modal .pc-stat > :first-child{
  font-size: clamp(16px, 2.0vw, 26px);
}
#player-card-modal .pc-stat > :last-child{
  font-size: clamp(16px, 2.0vw, 28px);
}

/* intro：行間を詰めて、少し小さくして、上余白も詰める */
#player-card-modal .pc-intro{
  margin-top: 8px;   /* 12px → 8px */
  font-size: 13px;   /* 14px → 13px */
  line-height: 1.4;  /* 1.55 → 1.4 */
}


/* =========================================================
   Face-up：ボール保有中は転倒＋点灯
   - JS側で .has-ball を付与します
   - 左右で回転角度を変える（左右対称配置の見え方を補正）
========================================================= */

/* 画像の回転アニメーションを滑らかに */
.facechip img,
.facechip .faceimg,
.facechip .avatar,
.facechip .thumb {
  transition: transform .18s ease, filter .18s ease;
  transform-origin: 50% 60%;
}

/* 点灯（共通）：明るさ＋彩度＋影（落ち影）
   ※発光色はチーム別に下で上書きします */
.facechip.has-ball img,
.facechip.has-ball .faceimg,
.facechip.has-ball .avatar,
.facechip.has-ball .thumb {
  /* 点灯のベース */
  filter:
    brightness(1.18)
    saturate(1.25)
    drop-shadow(0 10px 14px rgba(0,0,0,0.22)); /* 落ち影は共通 */
}

/* 左（静岡温泉高校）：黄〜緑寄りに発光 + 右上へ倒す */
.facebar-left .facechip.has-ball img,
.facebar-left .facechip.has-ball .faceimg,
.facebar-left .facechip.has-ball .avatar,
.facebar-left .facechip.has-ball .thumb {
  transform: rotate(-30deg);
  filter:
    brightness(1.18)
    saturate(1.25)
    /* 黄〜緑の発光 */
    drop-shadow(0 0 10px rgba(230, 255, 170, 0.95))
    drop-shadow(0 0 18px rgba(130, 255, 120, 0.55))
    /* 落ち影 */
    drop-shadow(0 10px 14px rgba(0,0,0,0.22));
}

/* 右（清水桜エビ高校）：ピンク寄りに発光 + 左右反転ぶん補正して倒す */
.facebar-right .facechip.has-ball img,
.facebar-right .facechip.has-ball .faceimg,
.facebar-right .facechip.has-ball .avatar,
.facebar-right .facechip.has-ball .thumb {
  transform: rotate(30deg);
  filter:
    brightness(1.18)
    saturate(1.25)
    /* ピンクの発光 */
    drop-shadow(0 0 10px rgba(255, 170, 220, 0.95))
    drop-shadow(0 0 18px rgba(255, 90, 170, 0.60))
    /* 落ち影 */
    drop-shadow(0 10px 14px rgba(0,0,0,0.22));
}

/* =========================================================
   Opening title screen
========================================================= */

.opening-screen{
  position: fixed;
  inset: 0;
  z-index: 2500;

  display: flex;
  justify-content: center;
  align-items: center;

  /* オープニング画像 */
  background: url("opening_tittle.jpg") center / cover no-repeat;
}

.opening-screen::before{
  content:"";
  position:absolute;
  inset:0;
  background: linear-gradient(
    to bottom,
    rgba(0,0,0,0.10),
    rgba(0,0,0,0.55)
  );
}

.opening-inner{
  position: relative;
  width: min(980px, 92vw);
  padding: 28px 18px 22px;

  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
}

.opening-lines{
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* 文字の“バック”に、透過ピンクライン（フレックスボックスの行） */
.opening-row{
  position: relative;
  width: min(860px, 92vw);
  padding: 10px 16px;

  display: flex;
  justify-content: center;
  align-items: center;
}

.opening-row::before{
  content:"";
  position:absolute;
  left:0;
  right:0;
  height: 60px;

  border-radius: 999px;
  background: rgba(255, 105, 180, 0.75);
  box-shadow: 0 2px 10px rgba(255,105,180,0.22);
}

.opening-text{
  position: relative;
  z-index: 1;

  color: #fff;
  font-weight: 1000;
  letter-spacing: 0.05em;

  text-shadow:
    0 4px 18px rgba(0,0,0,0.55),
    0 2px 0 rgba(0,0,0,0.35);
}

.opening-title{
  font-size: clamp(40px, 6vw, 72px);
}

.opening-subtitle{
  font-size: clamp(24px, 4vw, 46px);
}

/* 左→中央 / 右→中央 のスライドイン + 点滅 */
.opening-row1 .opening-text{
  animation:
    tv-slide-left 900ms cubic-bezier(0.15,0.9,0.2,1) both,
    tv-title-blink 1.25s 1.2s infinite;
}

.opening-row2 .opening-text{
  animation:
    tv-slide-right 900ms cubic-bezier(0.15,0.9,0.2,1) both,
    tv-title-blink 1.25s 1.2s infinite;
}

@keyframes tv-slide-left{
  from { transform: translateX(-110%); opacity: 0; }
  to   { transform: translateX(0);     opacity: 1; }
}

@keyframes tv-slide-right{
  from { transform: translateX(110%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

@keyframes tv-title-blink{
  0%,100% { opacity: 1; }
  50%     { opacity: 0.35; }
}

/* PRESS ENTER */
.opening-press{
  margin-top: 8px;
  text-align: center;

  font-weight: 1000;
  letter-spacing: 0.12em;
  color: #fff;
  font-size: clamp(18px, 2.6vw, 26px);

  padding: 10px 18px;
  border-radius: 999px;

  background: rgba(0,0,0,0.28);
  border: 2px solid rgba(255,255,255,0.55);

  cursor: pointer;
  user-select: none;

  text-shadow: 0 3px 12px rgba(0,0,0,0.6);
  animation: tv-press-pulse 1.1s infinite;
}

.opening-press:focus-visible{
  outline: 4px solid rgba(255,255,255,0.65);
  outline-offset: 4px;
}

.opening-press-sub{
  margin-top: 6px;
  font-size: 12px;
  letter-spacing: 0.06em;
  opacity: 0.92;
}

@keyframes tv-press-pulse{
  0%,100% { transform: scale(1); }
  50%     { transform: scale(1.03); }
}

/* 動きを減らしたい環境ではアニメーション停止 */
@media (prefers-reduced-motion: reduce){
  .opening-row1 .opening-text,
  .opening-row2 .opening-text,
  .opening-press{
    animation: none !important;
  }
}

/* =========================================================
   Practice end modal (10問終了 → もう一度 / 終了)
========================================================= */
#practice-end-modal #practice-summary{
  white-space: pre-wrap;
  text-align: left;
  margin: 0.75rem 0 0;
  padding: 0.75rem 0.9rem;

  background: rgba(0,0,0,0.04);
  border-radius: 6px;

  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.95rem;
  line-height: 1.5;
}

/* =========================================================
   Practice typing hit FX (ball.gif fly + kana blow away)
   - JS spawns elements into #tv-fx-layer
========================================================= */
#tv-fx-layer{
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1600;
}

.tv-fx-ball{
  position: fixed;
  left: 0;
  top: 0;
  background: url("ball.gif") center / contain no-repeat;
  will-change: transform, opacity;
  filter: drop-shadow(0 10px 18px rgba(0,0,0,0.28));
}

.tv-fx-kana{
  position: fixed;
  left: 0;
  top: 0;
  will-change: transform, opacity;
  pointer-events: none;
}

.tv-fx-ring{
  position: fixed;
  left: 0;
  top: 0;
  border: 3px solid rgba(255,255,255,0.95);
  border-radius: 999px;
  box-shadow: 0 0 18px rgba(255,255,255,0.55);
  will-change: transform, opacity;
}

/* =========================================================
   13) Word display typography (Requested)
   - Input target text (JP) + romaji: white text with black drop shadow
   - Slightly larger size for better readability
   ※ placed at EOF to override earlier definitions safely
========================================================= */

/* 打ち込み練習（practice）だけ、課題表示を下に下げる下へ */
body.mode-practice #word-display{
  margin-top: 8.5rem; /* ここを増やす：1.6〜3.0rem あたりで調整 */
}

#word-display{
  color: #fff;
  text-shadow:
    0 4px 0 rgba(0,0,0,0.65),
    0 12px 28px rgba(0,0,0,0.45);

  /* Bigger than previous 2rem; responsive without breaking layout */
  font-size: clamp(24px, 4.8vw, 32px);
  line-height: 1.05;

  /* Ensure ruby (romaji) line doesn't get clipped */
  height: 132px;
}

#word-display ruby,
#word-display rb,
#word-display .kana{
  color: #fff;
  text-shadow: inherit;
}

/* Romaji line */
#word-display rt{
  color: #fff;
  text-shadow:
    0 3px 0 rgba(0,0,0,0.65),
    0 10px 22px rgba(0,0,0,0.35);

  /* Make romaji a bit larger too (relative to main) */
  font-size: 0.70em;
  font-weight: 800;
}

/* Typed part remains “dimmed” but still white */
#word-display rt .rt-typed{
  opacity: 0.45;
}

/* =========================================================
   Practice progress dots (TIMEの下に 〇×10 / ball.gif で埋める)
========================================================= */
#practice-progress{
  margin: 0.35rem auto 0.65rem;
  width: fit-content;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(10px, 2.0vw, 20px);
  min-height: clamp(40px, 6.0vw, 58px);
}

/* ★hidden でも領域を確保（レイアウト揺れ防止） */
#practice-progress.hidden{
  display: flex !important;
  visibility: hidden;
}

/* 試合中は表示しない */
body:not(.mode-practice) #practice-progress{
  display: none !important;
}

.practice-dot{
  width: clamp(36px, 4.3vw, 54px);
  height: clamp(36px, 4.3vw, 54px);
  border-radius: 999px;
  background: rgba(210,210,210,0.90);
  box-shadow: 0 10px 18px rgba(0,0,0,0.35);
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
}

.practice-dot.is-done{
  background-color: transparent;
  background-image: url("ball.gif");
  filter: drop-shadow(0 10px 18px rgba(0,0,0,0.28));
}
