/* 基本ユーティリティ */
[hidden] {
    display: none !important;
}

/* CSSカスタムプロパティ（デザインシステム） */
:root {
    --bg-gradient: linear-gradient(135deg, #0f172a, #1e1b4b);
    --card-bg: rgba(30, 41, 59, 0.75);
    --card-border: rgba(255, 255, 255, 0.12);
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --accent: #f43f5e;
    --accent-hover: #e11d48;
    --success: #10b981;
    --focus-ring: #38bdf8;
    --shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    --font-main: 'Noto Sans JP', sans-serif;
    --font-eng: 'Outfit', sans-serif;
}

/* リセット & ベーススタイル */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-main);
    background: var(--bg-gradient);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 1.5rem;
    line-height: 1.6;
    overflow-x: hidden;
}

h1, h2, h3, h4 {
    font-family: var(--font-eng), var(--font-main);
    font-weight: 700;
    letter-spacing: -0.025em;
    text-align: center;
}

h1 {
    font-size: 2.2rem;
    background: linear-gradient(to right, #a5b4fc, #6366f1, #38bdf8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

h2 {
    font-size: 1.5rem;
    margin-bottom: 1.25rem;
    color: var(--text-primary);
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 0.5rem;
}

h3 {
    font-size: 1.15rem;
    margin-bottom: 0.75rem;
    color: var(--text-secondary);
    text-align: left;
}

/* アクセシビリティ：スクリーンリーダー用非表示 */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* スキップリンク */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--primary);
    color: white;
    padding: 8px 16px;
    z-index: 100;
    text-decoration: none;
    font-weight: 600;
    border-radius: 0 0 8px 0;
    transition: top 0.2s;
}
.skip-link:focus {
    top: 0;
    outline: 3px solid var(--focus-ring);
}

/* 共通カードレイアウト */
.card {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--card-border);
    border-radius: 1.25rem;
    padding: 1.75rem;
    width: 100%;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* フォーム要素 */
.form-group {
    margin-bottom: 1.25rem;
    text-align: left;
}

label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

input[type="text"], select {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 0.6rem;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(15, 23, 42, 0.6);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.2s;
}

input[type="text"]:focus, select:focus {
    outline: none;
    border-color: var(--focus-ring);
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.3);
}

/* ボタン */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0.8rem 1.5rem;
    font-family: inherit;
    font-size: 1.05rem;
    font-weight: 600;
    border-radius: 0.6rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
}

.btn:focus-visible {
    outline: 3px solid var(--focus-ring);
    outline-offset: 2px;
}

.btn-primary {
    background: var(--primary);
    color: white;
}
.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px -2px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.15);
}
.btn-secondary:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.18);
    transform: translateY(-2px);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* 区切り線 */
.divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 1.25rem 0;
    color: rgba(255, 255, 255, 0.3);
    font-size: 0.85rem;
}
.divider::before, .divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}
.divider::before { margin-right: 0.75rem; }
.divider::after { margin-left: 0.75rem; }

/* コピー用ボックス */
.copy-box {
    display: flex;
    gap: 0.5rem;
}

/* プレイヤーリスト */
.player-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-bottom: 1.25rem;
}

.player-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(15, 23, 42, 0.5);
    padding: 0.75rem 1rem;
    border-radius: 0.6rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

/* バッジ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.6rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.03em;
}

.badge-host {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.4);
}
.badge-bot {
    background: rgba(148, 163, 184, 0.2);
    color: #cbd5e1;
    border: 1px solid rgba(148, 163, 184, 0.4);
}
.badge-rev {
    background: rgba(239, 68, 68, 0.25);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.5);
    animation: pulse 2s infinite;
}
.badge-11back {
    background: rgba(168, 85, 247, 0.25);
    color: #d8b4fe;
    border: 1px solid rgba(168, 85, 247, 0.5);
}
.badge-lock {
    background: rgba(249, 115, 22, 0.25);
    color: #fdba74;
    border: 1px solid rgba(249, 115, 22, 0.5);
}
.badge-dir {
    background: rgba(59, 130, 246, 0.25);
    color: #93c5fd;
    border: 1px solid rgba(59, 130, 246, 0.5);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* ライブ通知ステータスボックス */
.live-status-box {
    background: rgba(15, 23, 42, 0.7);
    border-left: 4px solid var(--primary);
    padding: 0.75rem 1rem;
    border-radius: 0 0.5rem 0.5rem 0;
    margin-bottom: 1rem;
    font-size: 0.95rem;
    line-height: 1.5;
    color: #e2e8f0;
}

/* プレイヤー状態チップ */
.player-chip {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.85rem;
    transition: all 0.2s;
}

.player-chip.is-turn {
    background: rgba(99, 102, 241, 0.25);
    border-color: var(--primary);
    box-shadow: 0 0 8px rgba(99, 102, 241, 0.4);
}

.player-chip.is-finished {
    opacity: 0.6;
    text-decoration: line-through;
}

/* トランプカード表示 */
.cards-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    padding: 0.75rem;
    background: rgba(15, 23, 42, 0.5);
    border-radius: 12px;
    min-height: 120px;
}

/* 手札カードボタン（アクセシブル対応チェックボックス型） */
.card-btn {
    appearance: none;
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
    position: relative;
    transition: transform 0.2s ease, filter 0.2s ease;
    border-radius: 6px;
    touch-action: manipulation;
}

.card-btn img {
    display: block;
    width: 65px;
    height: auto;
    border-radius: 6px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    pointer-events: none;
    transition: border 0.2s, box-shadow 0.2s;
}

.card-btn:hover {
    transform: translateY(-6px);
}

.card-btn:focus-visible {
    outline: 3px solid var(--focus-ring);
    outline-offset: 3px;
    border-radius: 6px;
}

/* カード選択状態（チェック時） */
.card-btn[aria-checked="true"] {
    transform: translateY(-16px);
}

.card-btn[aria-checked="true"] img {
    box-shadow: 0 8px 16px rgba(245, 158, 11, 0.5);
    outline: 3px solid #f59e0b;
}

/* 場のカード画像 */
.field-card-img {
    width: 70px;
    height: auto;
    border-radius: 6px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
    animation: dropIn 0.25s ease-out;
}

@keyframes dropIn {
    0% { transform: scale(0.8) translateY(-10px); opacity: 0; }
    100% { transform: scale(1) translateY(0); opacity: 1; }
}

/* ランキングリスト */
.ranking-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 1rem;
}

.ranking-item.rank-1 {
    border-color: #fbbf24;
    background: rgba(245, 158, 11, 0.15);
}

/* レスポンシブ調整 */
@media (max-width: 600px) {
    body {
        padding: 0.75rem;
    }
    .card {
        padding: 1.25rem;
    }
    .card-btn img {
        width: 52px;
    }
    .field-card-img {
        width: 56px;
    }
    h1 {
        font-size: 1.8rem;
    }
}


/* 手札カード選択時のバリデーション通知ボックス */
.validation-status-box {
    display: block;
    font-size: 0.875rem;
    padding: 0.45rem 0.85rem;
    border-radius: 6px;
    margin: 0.5rem 0;
    text-align: center;
    font-weight: 500;
    transition: all 0.2s ease;
}
.validation-status-box.error {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.5);
    color: #fca5a5;
}
.validation-status-box.success {
    background: rgba(16, 185, 129, 0.2);
    border: 1px solid rgba(16, 185, 129, 0.5);
    color: #86efac;
}
.validation-status-box.info {
    background: rgba(148, 163, 184, 0.15);
    border: 1px solid rgba(148, 163, 184, 0.3);
    color: #cbd5e1;
}


/* ----------------------------------------------------
   アクセシビリティ設定：フォントサイズ
   ---------------------------------------------------- */
html.font-size-large, body.font-size-large {
    font-size: 1.15rem;
}
html.font-size-large, body.font-size-large h1 {
    font-size: 2.2rem;
}
html.font-size-large, body.font-size-large h2 {
    font-size: 1.6rem;
}
html.font-size-large, body.font-size-large h3 {
    font-size: 1.25rem;
}
html.font-size-large, body.font-size-large .btn {
    font-size: 1.05rem;
    padding: 0.75rem 1.4rem;
}
html.font-size-large, body.font-size-large .card-btn img {
    width: 68px;
    height: 98px;
}
html.font-size-large, body.font-size-large .field-card-img {
    width: 68px;
    height: 98px;
}
html.font-size-large, body.font-size-large .badge {
    font-size: 0.85rem;
    padding: 0.35rem 0.75rem;
}

/* ----------------------------------------------------
   アクセシビリティ設定：色彩・白黒反転テーマ
   ---------------------------------------------------- */
/* 1. 白黒反転（高コントラスト黒背景・白文字） */
html[data-theme="high-contrast-dark"], body[data-theme="high-contrast-dark"] {
    --bg-gradient: #000000;
    --card-bg: #121212;
    --card-border: #ffffff;
    --text-primary: #ffffff;
    --text-secondary: #e2e8f0;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --accent: #dc2626;
    --success: #22c55e;
    --focus-ring: #fbbf24;
    background: #000000 !important;
    color: #ffffff !important;
}
html[data-theme="high-contrast-dark"], body[data-theme="high-contrast-dark"] .card-btn {
    border: 2px solid #ffffff;
}
html[data-theme="high-contrast-dark"], body[data-theme="high-contrast-dark"] .badge {
    border: 2px solid #ffffff;
}

/* 2. 白背景・黒文字（高コントラストライト） */
html[data-theme="high-contrast-light"], body[data-theme="high-contrast-light"] {
    --bg-gradient: #ffffff;
    --card-bg: #f8fafc;
    --card-border: #000000;
    --text-primary: #000000;
    --text-secondary: #1e293b;
    --primary: #1d4ed8;
    --primary-hover: #1e40af;
    --accent: #b91c1c;
    --success: #15803d;
    --focus-ring: #0284c7;
    background: #ffffff !important;
    color: #000000 !important;
}
html[data-theme="high-contrast-light"], body[data-theme="high-contrast-light"] header,
html[data-theme="high-contrast-light"], body[data-theme="high-contrast-light"] main,
html[data-theme="high-contrast-light"], body[data-theme="high-contrast-light"] section {
    color: #000000 !important;
}
html[data-theme="high-contrast-light"], body[data-theme="high-contrast-light"] .app-header {
    border-bottom: 2px solid #000000;
}
html[data-theme="high-contrast-light"], body[data-theme="high-contrast-light"] .card-btn {
    border: 2px solid #000000;
}
html[data-theme="high-contrast-light"], body[data-theme="high-contrast-light"] .badge {
    border: 2px solid #000000;
    color: #000000;
    background: #e2e8f0;
}

/* 3. 黄黒（最大コントラスト・弱視者向け） */
html[data-theme="yellow-black"], body[data-theme="yellow-black"] {
    --bg-gradient: #000000;
    --card-bg: #0a0a0a;
    --card-border: #ffff00;
    --text-primary: #ffff00;
    --text-secondary: #ffff55;
    --primary: #ffff00;
    --primary-hover: #e6e600;
    --accent: #ff5555;
    --success: #55ff55;
    --focus-ring: #ffff00;
    background: #000000 !important;
    color: #ffff00 !important;
}
html[data-theme="yellow-black"], body[data-theme="yellow-black"] * {
    color: #ffff00 !important;
    border-color: #ffff00 !important;
}
html[data-theme="yellow-black"], body[data-theme="yellow-black"] .btn-primary {
    background: #ffff00 !important;
    color: #000000 !important;
    font-weight: 900;
}
html[data-theme="yellow-black"], body[data-theme="yellow-black"] .btn-secondary {
    background: #000000 !important;
    color: #ffff00 !important;
    border: 2px solid #ffff00 !important;
}

/* ----------------------------------------------------
   アクセシビリティツールバーのスタイル
   ---------------------------------------------------- */
.accessibility-bar {
    background: rgba(15, 23, 42, 0.85);
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    padding: 0.4rem 1rem;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
}
.accessibility-bar-group {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.accessibility-bar-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}
.accessibility-select {
    background: rgba(30, 41, 59, 0.9);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
    font-size: 0.85rem;
}
.accessibility-btn {
    background: rgba(30, 41, 59, 0.9);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    padding: 0.25rem 0.65rem;
    font-size: 0.85rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}
.accessibility-btn:hover, .accessibility-btn:focus {
    background: rgba(51, 65, 85, 0.9);
    outline: 2px solid var(--focus-ring);
}


/* ----------------------------------------------------
   野球ゲーム専用スタイル（ストライクゾーン・スコア・コントロール）
   ---------------------------------------------------- */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.hero-characters {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}

.hero-char-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(15, 23, 42, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 10px;
    padding: 0.45rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 600;
}

.team-select-fieldset {
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    padding: 0.85rem 1rem;
    background: rgba(15, 23, 42, 0.45);
    margin-bottom: 1.1rem;
}

.team-select-fieldset legend {
    padding: 0 0.5rem;
    font-weight: 700;
    font-size: 0.95rem;
    color: #93c5fd;
}

.team-radio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 0.75rem;
    margin-top: 0.4rem;
}

.team-radio-card {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.65rem 0.8rem;
    border-radius: 8px;
    background: rgba(30, 41, 59, 0.75);
    border: 2px solid rgba(255, 255, 255, 0.15);
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 0;
}

.team-radio-card:hover, .team-radio-card:focus-within {
    border-color: var(--focus-ring);
    background: rgba(51, 65, 85, 0.85);
}

.team-radio-title {
    font-weight: 700;
    font-size: 0.92rem;
    color: var(--text-primary);
}

.team-radio-desc {
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.35;
}

.radio-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.85rem;
    border-radius: 6px;
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    margin-bottom: 0;
    color: var(--text-primary);
}

.sound-categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 0.75rem;
}

.sound-cat-item {
    background: rgba(15, 23, 42, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 8px;
    padding: 0.6rem 0.8rem;
}

.scoreboard-header {
    background: rgba(15, 23, 42, 0.78);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 10px;
    padding: 0.85rem 1rem;
    margin-bottom: 0.85rem;
}

.role-badge {
    display: inline-block;
    padding: 0.3rem 0.8rem;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.88rem;
    background: rgba(37, 99, 235, 0.35);
    border: 1px solid #60a5fa;
    color: #e0f2fe;
}

.score-cards-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.65rem;
}

.score-team-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(30, 41, 59, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    padding: 0.5rem 0.8rem;
}

.score-order-tag {
    font-size: 0.75rem;
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.12);
}

.score-team-name {
    font-weight: 700;
    font-size: 1rem;
}

.score-runs {
    font-weight: 800;
    font-size: 1.25rem;
    color: #fde047;
}

.score-hits {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.bso-runners-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 0.65rem;
    padding-top: 0.6rem;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.bso-group {
    display: flex;
    gap: 1.1rem;
    flex-wrap: wrap;
}

.bso-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.9rem;
    font-weight: 700;
}

.bso-lamps {
    letter-spacing: 0.15em;
    font-size: 1.05rem;
}

.runners-status-box {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.diamond-mini {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.base-dot {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.15);
    color: var(--text-secondary);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.base-dot.occupied {
    background: #facc15;
    color: #000000;
    border-color: #fef08a;
    box-shadow: 0 0 8px rgba(250, 204, 21, 0.7);
}

.judge-banner {
    background: linear-gradient(90deg, rgba(30, 58, 138, 0.65), rgba(15, 23, 42, 0.85));
    border: 2px solid rgba(96, 165, 250, 0.45);
    border-radius: 10px;
    padding: 0.7rem 1rem;
    margin-bottom: 0.85rem;
    text-align: center;
}

.judge-call-text {
    font-size: 1.25rem;
    font-weight: 800;
    color: #fde047;
}

.judge-detail-text {
    font-size: 0.9rem;
    color: var(--text-primary);
    margin-top: 0.2rem;
}

.field-stage {
    display: grid;
    grid-template-columns: 130px 1fr 130px;
    align-items: center;
    gap: 0.75rem;
    background: radial-gradient(circle at center, rgba(22, 101, 52, 0.45), rgba(15, 23, 42, 0.85));
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 12px;
    padding: 0.85rem;
    margin-bottom: 0.65rem;
}

@media (max-width: 640px) {
    .field-stage {
        grid-template-columns: 1fr;
    }
}

.field-char-column {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.char-stage-label {
    font-size: 0.78rem;
    font-weight: 700;
    padding: 0.1rem 0.5rem;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.4);
    margin-bottom: 0.25rem;
}

.strike-zone-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.strike-zone-title {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
}

.strike-zone-outer {
    position: relative;
    width: 210px;
    height: 210px;
    background: rgba(15, 23, 42, 0.75);
    border: 2px dashed rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    cursor: crosshair;
    overflow: hidden;
    touch-action: none;
}

.strike-zone-outer:focus {
    outline: 3px solid var(--focus-ring);
}

.strike-zone-inner {
    position: absolute;
    left: 21%;
    top: 21%;
    width: 58%;
    height: 58%;
    border: 2px solid rgba(255, 255, 255, 0.85);
    background: rgba(59, 130, 246, 0.12);
}

.sz-grid-line {
    position: absolute;
    background: rgba(255, 255, 255, 0.25);
}
.sz-v1 { left: 33.3%; top: 0; bottom: 0; width: 1px; }
.sz-v2 { left: 66.6%; top: 0; bottom: 0; width: 1px; }
.sz-h1 { top: 33.3%; left: 0; right: 0; height: 1px; }
.sz-h2 { top: 66.6%; left: 0; right: 0; height: 1px; }

.bat-cursor-marker {
    position: absolute;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 3px solid #facc15;
    background: rgba(250, 204, 21, 0.22);
    transform: translate(-50%, -50%);
    left: 50%;
    top: 50%;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: width 0.15s, height 0.15s;
}

.bat-cursor-marker.power-mode {
    width: 42px;
    height: 42px;
    border-color: #f43f5e;
    background: rgba(244, 63, 94, 0.25);
}

.bat-cursor-core {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ffffff;
}

.pitch-target-marker {
    position: absolute;
    font-size: 1.35rem;
    font-weight: 800;
    color: #4ade80;
    transform: translate(-50%, -50%);
    left: 50%;
    top: 50%;
    pointer-events: none;
    text-shadow: 0 0 6px #000;
}

.ball-flight-marker {
    position: absolute;
    font-size: 1.2rem;
    transform: translate(-50%, -50%) scale(0.5);
    left: 50%;
    top: 50%;
    pointer-events: none;
    transition: transform 0.08s linear;
}

.sub-motion-bar {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 0.75rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.sub-motion-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.control-panel {
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    padding: 1rem;
}

.controls-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.swing-mode-box {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.btn-toggle-mode {
    padding: 0.4rem 0.75rem;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(30, 41, 59, 0.85);
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

.btn-toggle-mode.active {
    background: #2563eb;
    border-color: #93c5fd;
    color: #ffffff;
}

.dpad-group {
    display: grid;
    grid-template-columns: repeat(3, minmax(84px, 108px));
    grid-template-rows: repeat(3, auto);
    gap: 0.4rem;
    justify-content: center;
    align-items: center;
    margin: 0.35rem auto;
}

.dpad-group [data-dir="up"] {
    grid-column: 2;
    grid-row: 1;
}

.dpad-group [data-dir="left"] {
    grid-column: 1;
    grid-row: 2;
}

.dpad-group [data-dir="center"] {
    grid-column: 2;
    grid-row: 2;
    background: rgba(37, 99, 235, 0.35);
    border-color: rgba(147, 197, 253, 0.55);
}

.dpad-group [data-dir="right"] {
    grid-column: 3;
    grid-row: 2;
}

.dpad-group [data-dir="down"] {
    grid-column: 2;
    grid-row: 3;
}

.btn-dpad, .btn-dpad-pitch {
    width: 100%;
    padding: 0.5rem 0.4rem;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.28);
    background: rgba(51, 65, 85, 0.88);
    color: var(--text-primary);
    font-size: 0.82rem;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    touch-action: manipulation;
}

.btn-dpad:hover, .btn-dpad-pitch:hover {
    background: rgba(71, 85, 105, 0.95);
}

.btn-subtle-reload {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: var(--text-secondary);
    opacity: 0.65;
    font-size: 0.72rem;
    padding: 0.12rem 0.45rem;
    border-radius: 4px;
    cursor: pointer;
    width: auto;
}

.btn-subtle-reload:hover, .btn-subtle-reload:focus-visible {
    opacity: 1.0;
    border-color: rgba(255, 255, 255, 0.4);
}

.action-buttons-row {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.btn-huge-action {
    flex: 1;
    font-size: 1.15rem;
    padding: 1rem 1.25rem;
    font-weight: 800;
}

.pitch-type-grid {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.btn-pitch-type {
    padding: 0.45rem 0.85rem;
    border-radius: 6px;
    border: 2px solid rgba(255, 255, 255, 0.22);
    background: rgba(30, 41, 59, 0.9);
    color: var(--text-primary);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
}

.btn-pitch-type.selected {
    background: #16a34a;
    border-color: #86efac;
    color: #ffffff;
}

.gauge-section {
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 8px;
    padding: 0.6rem 0.8rem;
}

.pitch-gauge-track {
    position: relative;
    height: 22px;
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 999px;
    overflow: hidden;
}

.pitch-gauge-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #22c55e, #eab308);
    transition: width 0.04s linear;
}

.pitch-gauge-sweet {
    position: absolute;
    left: 78%;
    width: 12%;
    top: 0;
    bottom: 0;
    border-left: 2px solid #ffffff;
    border-right: 2px solid #ffffff;
    background: rgba(250, 204, 21, 0.35);
}

/* 上部固定ヘッダーバー（スマホの画面スクロールに巻き込まれず常に最上部に横1列4ボタンで表示） */
.sticky-top-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    max-width: 860px;
    width: 100%;
    margin: 0 auto 0.6rem auto;
    padding: 0.35rem 0.4rem;
    background: rgba(15, 23, 42, 0.96);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 8px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.45);
}

.sticky-header-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.35rem;
    align-items: stretch;
    width: 100%;
}

.sticky-header-btn {
    width: 100%;
    min-width: 0;
    justify-content: center;
    text-align: center;
    padding: 0.38rem 0.35rem;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.25;
    white-space: normal;
    word-break: keep-all;
    overflow-wrap: anywhere;
}

/* カテゴリ別音量プッシュボタン行と音量バッジ */
.sound-vol-badge {
    font-size: 0.82rem;
    font-weight: 700;
    color: #93c5fd;
    background: rgba(30, 41, 59, 0.9);
    border: 1px solid rgba(147, 197, 253, 0.35);
    border-radius: 4px;
    padding: 0.12rem 0.45rem;
}

.sound-vol-btn-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.45rem;
    flex-wrap: wrap;
}

.sound-vol-btn-row .btn {
    width: auto;
    flex: 1 1 auto;
    padding: 0.35rem 0.6rem;
    font-size: 0.8rem;
}

/* 試合中画面の表示順制御（PCでは進行情報→操作エリア、スマホでは操作エリア→進行情報の順に表示） */
.playing-layout-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    width: 100%;
}

.playing-info-section {
    order: 1;
    width: 100%;
}

.playing-controls-section {
    order: 2;
    width: 100%;
}

@media (max-width: 768px) {
    .playing-controls-section {
        order: 1;
    }
    .playing-info-section {
        order: 2;
    }
    .sticky-header-btn {
        font-size: 0.7rem;
        padding: 0.32rem 0.2rem;
        line-height: 1.2;
    }
}

@media (max-width: 600px) {
    body {
        padding: 0.5rem;
    }
    .card {
        padding: 1rem;
    }
}

