
/* ==========================================
   ハンドボール作戦ボード CSS
   プレフィックス: hsb-
   Version: 2.0.0（ヘッダー＋フルスクリーン＋右下ツールバー＋一本道ステップ構成）
   ========================================== */

.hsb-root, .hsb-root * { box-sizing: border-box; }

.hsb-root {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: "BIZ UDGothic", "M PLUS Rounded 1c", "Hiragino Kaku Gothic ProN", "Meiryo", sans-serif;
  background: #eef2ec;
  color: #1f2937;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  z-index: 9999;
}

/* ===== ヘッダー ===== */
.hsb-root .hsb-header {
  position: fixed; top: 0; left: 0; right: 0;
  height: 52px;
  background: #1e3a5f;
  color: #fff;
  display: flex; align-items: center;
  padding: 0 16px;
  gap: 12px;
  z-index: 20;
}
.hsb-root .hsb-header h1 { font-size: 16px; font-weight: bold; margin: 0; white-space: nowrap; }
.hsb-root .hsb-edit-names-btn {
  border: none; background: rgba(255,255,255,0.18); color: #fff;
  width: 30px; height: 30px; border-radius: 999px; font-size: 14px; cursor: pointer;
  flex-shrink: 0; -webkit-tap-highlight-color: transparent;
}
.hsb-root .hsb-hint {
  flex: 1;
  font-size: 13px; font-weight: bold;
  background: rgba(255,255,255,0.15);
  padding: 6px 14px; border-radius: 999px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  text-align: center;
}

/* ===== フルスクリーンcourt ===== */
/* 修正: 縦向き・ハーフコート（20m×20m＝正方形）に変更。aspect-ratioで正しい縦横比を維持 */
.hsb-root #hsb-court-wrap {
  position: fixed;
  top: 52px; left: 0; width: 100vw; height: calc(100vh - 52px);
  display: flex; align-items: center; justify-content: center;
  padding: 12px;
}
.hsb-root #hsb-court {
  position: relative;
  /* 修正: 高さをさらに10%低く（400:279.2）。表示サイズ自体も拡大（max-width, 係数UP） */
  width: min(100%, calc((100vh - 52px - 24px) * 400 / 279.2));
  aspect-ratio: 400 / 279.2;
  max-width: 1100px;
  max-height: 100%;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
  touch-action: none;
  background: #2e9e4f;
}
/* 修正: コートはSVGで描画（マーカーより背面） */
.hsb-root #hsb-court-svg {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  display: block;
  z-index: 0;
}

/* ===== 選手マーカー ===== */
/* 修正: マーカーを20%拡大（40px→48px、フォント12px→14px） */
.hsb-root .player {
  position: absolute;
  width: 48px; height: 48px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: bold; color: #fff;
  cursor: grab;
  transform: translate(-50%, -50%);
  box-shadow: 0 2px 6px rgba(0,0,0,0.35);
  border: 3px solid rgba(255,255,255,0.85);
  touch-action: none;
  transition: box-shadow .1s;
  z-index: 3;
}
.hsb-root .player.offense { background: linear-gradient(135deg, #FF6B6B, #FF8E53); }
.hsb-root .player.defense { background: linear-gradient(135deg, #4ECDC4, #44A08D); }
.hsb-root .player.dragging { cursor: grabbing; box-shadow: 0 4px 14px rgba(0,0,0,0.5); z-index: 6; }

/* 修正: ボールマーカー（ハンドボールアイコンが無いため、黄×黒のサッカーボール風柄で代用） */
.hsb-root .player.ball {
  width: 28px; height: 28px;
  font-size: 0;
  background: #f4d13a;
  border: 2px solid rgba(255,255,255,0.9);
  overflow: hidden;
  z-index: 5;
}
.hsb-root .player.ball svg { display: block; width: 100%; height: 100%; pointer-events: none; }
.hsb-root .player.ball.dragging { z-index: 7; }

/* ===== 記録中インジケーター ===== */
.hsb-root .hsb-recording-indicator {
  position: fixed; left: 16px; top: 64px;
  display: none;
  background: #ef4444; color: #fff; font-size: 12px; font-weight: bold;
  padding: 6px 14px; border-radius: 999px; z-index: 15;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* ===== 速度パネル（右側・ツールバーの上に縦配置） ===== */
.hsb-root .hsb-speed-panel {
  position: fixed; right: 16px; bottom: 380px;
  width: 60px;
  background: #fff; border-radius: 999px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.18);
  padding: 12px 0 10px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  z-index: 10;
}
.hsb-root .hsb-speed-val { font-size: 12px; font-weight: bold; color: #1e3a5f; }
.hsb-root .hsb-speed-label { font-size: 10px; font-weight: bold; color: #6b7e99; }
.hsb-root .hsb-speed-slider {
  width: 8px;
  height: 110px;
  writing-mode: vertical-lr;
  direction: rtl;
  accent-color: #d4af37;
  cursor: pointer;
}

/* ===== 右下ツールバー ===== */
.hsb-root .hsb-toolbar {
  position: fixed; right: 16px; bottom: 20px;
  display: flex; flex-direction: column; gap: 12px; z-index: 10;
}
.hsb-root .hsb-btn {
  width: 60px; height: 60px; border-radius: 999px; border: none;
  font-size: 22px; cursor: pointer; box-shadow: 0 3px 8px rgba(0,0,0,0.25);
  display: flex; align-items: center; justify-content: center;
  transition: transform .1s; -webkit-tap-highlight-color: transparent;
  background: #fff; color: #7F8C8D; border: 2px solid #dde4ef;
}
.hsb-root .hsb-btn:active { transform: scale(0.92); }
.hsb-root .hsb-btn:disabled { opacity: 0.35; cursor: default; }
.hsb-root .hsb-btn:disabled:active { transform: none; }
.hsb-root .hsb-btn-confirm { background: #10b981; color: #fff; }
.hsb-root .hsb-btn-danger { background: #fff; color: #ef4444; border-color: #ef4444; }
.hsb-root .hsb-btn-primary { background: #d4af37; color: #fff; }
.hsb-root .hsb-btn-setting { background: #fff; color: #1e3a5f; border: 2px solid #1e3a5f; }

.hsb-root .hsb-ball-btn { border: none; }
.hsb-root .hsb-ball-btn.hsb-ball-offense { background: linear-gradient(135deg, #FF6B6B, #FF8E53); }
.hsb-root .hsb-ball-btn.hsb-ball-defense { background: linear-gradient(135deg, #4ECDC4, #44A08D); }
.hsb-root .hsb-ball-btn.hsb-ball-ball { background: #fff; padding: 6px; }
.hsb-root .hsb-ball-btn.hsb-ball-ball svg { width: 100%; height: 100%; border-radius: 50%; display: block; }

/* 戻る／進む（アンドゥ・リドゥ）のペアボタン（縦積み） */
.hsb-root .hsb-btn-pair {
  display: flex; flex-direction: column;
  border-radius: 999px; overflow: hidden;
  box-shadow: 0 3px 8px rgba(0,0,0,0.25);
}
.hsb-root .hsb-btn-pair button {
  width: 60px; height: 30px; border: none; background: #fff; color: #7F8C8D;
  font-size: 16px; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.hsb-root .hsb-btn-pair button:first-child { border-bottom: 1px solid #dde4ef; }
.hsb-root .hsb-btn-pair button:disabled { opacity: 0.35; cursor: default; }
.hsb-root .hsb-btn-pair button:active { background: #eef2f6; }

/* ===== フレームメッセージ ===== */
.hsb-root .hsb-frame-message {
  position: fixed; left: 50%; top: 64px; transform: translateX(-50%);
  display: none;
  background: rgba(30,58,95,0.9); color: #fff; font-size: 13px; font-weight: bold;
  padding: 8px 18px; border-radius: 999px; z-index: 16;
}

/* ===== 進捗モーダル ===== */
.hsb-root .hsb-progress-modal {
  display: none;
  position: fixed; inset: 0; background: rgba(30,58,95,0.6);
  align-items: center; justify-content: center; z-index: 100;
}
.hsb-root .hsb-progress-modal.hsb-show { display: flex; }
.hsb-root .hsb-progress-content {
  background: #fff; border-radius: 16px; padding: 26px; text-align: center;
  width: min(90vw, 320px);
}
.hsb-root .hsb-progress-content h3 { font-size: 16px; color: #1e3a5f; margin: 0 0 10px; }
.hsb-root .hsb-progress-frames { font-size: 12px; color: #6b7e99; margin: 0 0 12px; }
.hsb-root .hsb-progress-bar { width: 100%; height: 10px; background: #eef2f6; border-radius: 999px; overflow: hidden; margin-bottom: 10px; }
.hsb-root .hsb-progress-fill { height: 100%; width: 0%; background: #d4af37; transition: width .2s; }
.hsb-root .hsb-progress-content p { font-size: 13px; color: #6b7e99; margin: 0; }

/* ===== 選手名編集モーダル ===== */
.hsb-root .hsb-name-edit-modal {
  display: none;
  position: fixed; inset: 0; background: rgba(30,58,95,0.6);
  align-items: center; justify-content: center; z-index: 100; padding: 16px;
}
.hsb-root .hsb-name-edit-content {
  background: #fff; border-radius: 16px; padding: 24px;
  width: min(94vw, 460px); max-height: 88vh; overflow-y: auto;
}
.hsb-root .hsb-name-edit-content h3 { font-size: 17px; color: #1e3a5f; margin: 0 0 14px; text-align: center; }
.hsb-root .hsb-name-edit-content h4 { font-size: 13px; margin: 14px 0 8px; }
.hsb-root .hsb-offense-label { color: #e8534a; }
.hsb-root .hsb-defense-label { color: #2196a8; }
.hsb-root .hsb-name-input-group { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.hsb-root .hsb-name-input-group label { width: 40px; font-size: 13px; font-weight: bold; flex-shrink: 0; }
.hsb-root .hsb-name-input-group input {
  flex: 1; padding: 8px 10px; border-radius: 8px; border: 2px solid #dde4ef;
  font-size: 13px; font-family: inherit;
}

.hsb-root .hidden { display: none !important; }

