        :root { --primary: #005a9c; --secondary: #004080; --bg: #f4f5f7; --border: #ccc; }
        body { font-family: 'Meiryo', sans-serif; margin: 0; padding: 20px; background: var(--bg); color: #333; font-size: 13px; }
        .container { max-width: 1850px; margin: auto; background: #fff; padding: 20px; border-radius: 5px; box-shadow: 0 2px 10px rgba(0,0,0,0.1); }
        h1 { border-bottom: 2px solid var(--primary); padding-bottom: 5px; color: var(--primary); font-size: 1.4em; margin-top: 0; }
        h2 { background: #eef4f9; padding: 6px 10px; border-left: 5px solid var(--primary); font-size: 1.1em; margin-top: 20px; }
        
        .sticky-header { background: #fff; padding-bottom: 0; margin: -20px -20px 0; padding: 20px 20px 0; }
        .tabs { display: flex; border-bottom: 2px solid #ddd; margin-bottom: 15px; flex-wrap: wrap; position: sticky; top: 0; z-index: 100; background: #fff; padding: 6px 0 0; }
        .tab-link { padding: 8px 25px; cursor: pointer; border: 1px solid #ddd; border-bottom: none; background: #f8f8f8; margin-right: 4px; font-weight: bold; color: #666; transition: 0.2s; }
        .tab-link:hover { background: #eee; }
        .tab-link.active { background: #fff; border-bottom: 2px solid #fff; color: var(--primary); border-top: 3px solid var(--primary); }
        /* 高速化: タブ切替の fadeIn を 0.3s → 0.12s に短縮して体感速度向上 */
        .tab-content { display: none; animation: fadeIn 0.12s ease-out; content-visibility: auto; }
        .tab-content.active { display: block; content-visibility: visible; }
        @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

        /* 壁量計算用スタイル */
        .hekiryo-section { background:#f8fafc; border:1px solid #cce; border-radius:6px; padding:15px; margin:15px 0; }
        .hekiryo-section h3 { margin:0 0 10px; color:#005a9c; font-size:1.05em; border-bottom:1px solid #cce; padding-bottom:5px; }
        .hekiryo-grid { display:grid; grid-template-columns:repeat(auto-fit, minmax(200px,1fr)); gap:10px; margin-bottom:10px; }
        .hekiryo-grid .input-group { margin:0; }
        .wc-table { width:100%; border-collapse:collapse; font-size:0.9em; margin:10px 0; }
        .wc-table th { background:#eef4f9; padding:6px 8px; border:1px solid #cce; text-align:center; font-size:0.85em; }
        .wc-table td { padding:4px 6px; border:1px solid #ddd; }
        .wc-table input { border:1px solid #ccc; padding:3px; font-size:0.9em; }
        .wc-table .select-btn { padding:2px 8px; font-size:0.8em; background:#eef; border:1px solid #aac; border-radius:3px; cursor:pointer; margin-left:4px; white-space:nowrap; }
        .wc-judge { display:inline-block; padding:4px 16px; border-radius:4px; font-weight:bold; font-size:1.1em; }
        .wc-result-card { display:inline-block; background:#f0f4f8; border:1px solid #cce; border-radius:6px; padding:10px 18px; margin:5px; text-align:center; }
        .wc-result-card .label { font-size:0.85em; color:#666; }
        .wc-result-card .value { font-size:1.3em; font-weight:bold; color:#005a9c; }
        .wc-4div-panel { background:#fff; border:1px solid #ddd; border-radius:6px; padding:12px; margin:10px 0; }
        .wc-4div-panel h4 { margin:0 0 8px; font-size:0.95em; color:#333; }
        .zone-btn { padding:4px 10px; margin:2px; border:1px solid #aac; background:#f9f9f9; cursor:pointer; border-radius:3px; font-size:0.85em; transition:0.15s; }
        .zone-btn.selected { background:#3498db; color:#fff; border-color:#2980b9; }
        .zone-btn:hover { background:#e0e8f0; }
        .zone-btn.selected:hover { background:#2980b9; }
        .wq-plan-wrap { width:100%; min-height:300px; position:relative; overflow:hidden; display:flex; }
        .wq-plan-body { flex:1; position:relative; overflow:hidden; cursor:grab; background:#f8f9fa; }
        .wq-plan-body.grabbing { cursor:grabbing; }
        .wq-plan-legend { position:absolute; bottom:6px; left:6px; background:rgba(255,255,255,0.92); border:1px solid #ccc; border-radius:4px; padding:5px 8px; font-size:0.78em; line-height:1.6; pointer-events:none; z-index:1; max-height:60%; overflow-y:auto; }
        .wq-plan-legend span { display:inline-block; width:18px; height:3px; vertical-align:middle; margin-right:4px; }
        .wq-layer-panel { width:150px; min-width:120px; background:#fff; border-left:1px solid #ddd; overflow-y:auto; font-size:12px; flex:0 0 150px; }
        .wq-layer-panel .wq-lp-head { background:#e9ecef; padding:6px 8px; font-weight:bold; border-bottom:1px solid #ddd; color:#495057; font-size:11px; }
        .wq-layer-panel .wq-lp-item { padding:5px 8px; cursor:pointer; display:flex; align-items:center; gap:5px; border-bottom:1px solid #f8f8f8; transition:0.1s; user-select:none; }
        .wq-layer-panel .wq-lp-item:hover { background:#f1f3f5; }
        .wq-layer-panel .wq-lp-item.off { opacity:0.4; color:#adb5bd; }
        .wq-layer-panel .wq-lp-item .wq-lp-eye { font-size:10px; width:16px; text-align:center; }
        .wq-layer-panel .wq-lp-item .wq-lp-col { display:inline-block; width:12px; height:12px; border-radius:2px; border:1px solid #ccc; vertical-align:middle; }
        .wq-summary-table { width:100%; border-collapse:collapse; font-size:0.88em; margin:10px 0; }
        .wq-summary-table th { background:#eef4f9; padding:5px 8px; border:1px solid #cce; text-align:center; font-size:0.85em; white-space:nowrap; }
        .wq-summary-table td { padding:4px 8px; border:1px solid #ddd; text-align:center; }
        .wq-summary-table .ok { color:#27ae60; font-weight:bold; }
        .wq-summary-table .ng { color:#e74c3c; font-weight:bold; }
        .wq-detail-log { background:#fafafa; border:1px solid #ddd; border-radius:4px; padding:12px; margin-top:20px; max-height:600px; overflow-y:auto; font-size:0.88em; }
        .wq-detail-log h3 { margin:0 0 8px; font-size:1em; color:#333; }
        .heki-log-box { background:#fafafa; border:1px solid #ddd; border-radius:4px; padding:10px; margin-top:15px; max-height:500px; overflow-y:auto; font-size:0.88em; }
        .heki-log-box h3 { margin:0 0 8px; font-size:1em; color:#333; }
        .heki-log-box h4 { margin:12px 0 4px; font-size:0.95em; color:#005a9c; border-bottom:1px dotted #cce; padding-bottom:2px; }
        .heki-log-row { display:flex; gap:8px; padding:2px 0; border-bottom:1px dotted #eee; }
        .heki-log-key { min-width:180px; color:#555; }
        .heki-log-val { font-weight:bold; color:#333; }
        .heki-log-formula { color:#888; font-size:0.9em; }
        .heki-log-note { color:#999; font-size:0.85em; font-style:italic; }
        .auto-weight-section { background:#fffbf0; border:2px solid #f0d060; border-radius:8px; padding:15px; margin:20px 0; }
        .auto-weight-section h3 { margin:0 0 10px; color:#b8860b; font-size:1.05em; }

        .input-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 15px; margin-bottom: 10px; }
        .input-group { background: #fff; padding: 8px; border: 1px solid var(--border); border-radius: 3px; }
        .input-group label { display: block; font-weight: bold; margin-bottom: 4px; font-size: 0.9em; color: #555; }
        .input-group input, .input-group select { width: 95%; padding: 4px; border: 1px solid #999; text-align: right; }
        .input-group select { text-align: left; }

        /* 復元力特性入力：PC幅では各階X/Y 2列表示 */
        .force-editor { display: flex; flex-wrap: wrap; gap: 10px; }
        .force-column { flex: 0 0 calc(50% - 5px); max-width: calc(50% - 5px); min-width: 0; box-sizing: border-box; border: 1px solid var(--border); padding: 10px; border-radius: 3px; background: #fafafa; }
        .force-floor-sep { flex: 0 0 100%; height: 0; border: none; border-top: 3px solid var(--primary); margin: 4px 0; }
        .force-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 5px; font-weight: bold; color: var(--secondary); }
        
        /* 計算結果画面：3階以上で縦並びにするためのクラス */
        .result-box.vertical-layout { flex-direction: column; }
        .result-box.vertical-layout .result-panel { width: 100%; min-width: auto; }
        
        /* 計算書：判定結果サマリー表の分割表示用スタイル */
        .split-summary-table { width: 100%; margin-bottom: 20px; page-break-inside: avoid; }

        /* 計算書：判定結果ページ（表＋変形モード図＋Q-変形角グラフ）を1ページ内に収める */
        .rep-result-layout {
            display: block;
            width: 100%;
            box-sizing: border-box;
        }
        .rep-result-box {
            border: 1px solid #ccc;
            padding: 2.5mm;
            box-sizing: border-box;
            background: #fff;
            overflow: hidden;
            display: flex;
            flex-direction: column;
        }
        .rep-result-box + .rep-result-box { margin-top: 4mm; }
        .rep-result-box-title {
            font-size: 9pt;
            font-weight: bold;
            margin: 0 0 2mm 0;
            font-family: sans-serif;
        }
        .rep-result-box-body {
            flex: 1 1 auto;
            min-height: 0;
        }
        .rep-result-mode-box { height: 78mm; }
        .rep-result-chart-box { height: 78mm; }
        .rep-result-box-body canvas { width: 100%; height: 100%; display: block; }
        .rep-result-box-body img { width: 100%; height: 100%; object-fit: contain; display: block; }

        /* 計算書：変形モード図＋Q-変形角グラフを1ページ高さにフィットさせる（専用ページ） */
        .report-page.rep-flex-page { display: flex; flex-direction: column; }
        .report-page.rep-flex-page .report-section { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
        /* flexの縮み込みで高さが潰れるケースがあるため、2段グリッドで常に高さを配分 */
        .rep-fig-layout {
            flex: 1 1 auto;
            min-height: 0;
            display: grid;
            grid-template-rows: 1fr 1fr;
            gap: 4mm;
        }
        @media print {
            .rep-flex-page {
                height: auto; /* 印刷余白設定に応じて自動調整（固定高だと余白分オーバーフローし空白ページ発生） */
                page-break-inside: avoid;
                overflow: visible;
            }
            .rep-fig-layout {
                gap: 2mm; /* ギャップを少し詰める */
                grid-template-rows: 1fr 1fr;
            }
            .rep-result-mode-box, .rep-result-chart-box {
                /* 高さがページを超えないように調整 */
                max-height: 110mm; 
            }
        }

        /* 計算書PDF（html2canvas）専用レイアウト調整 */
        .pdf-export .rep-flex-page {
            height: 285mm; /* A4判の高さ確保 */
            page-break-inside: avoid;
            overflow: visible;
        }
        .pdf-export .rep-fig-layout {
            gap: 2mm; /* ギャップを少し詰める */
            grid-template-rows: 1fr 1fr;
        }
        .pdf-export .rep-result-mode-box,
        .pdf-export .rep-result-chart-box {
            /* 高さがページを超えないように調整 */
            max-height: 100mm;
        }
        .pdf-export .rep-result-box-title {
            margin: 0 0 1mm 0;
            font-size: 8pt;
        }
        .pdf-export .report-page.rep-flex-page .rep-result-box-body > canvas,
        .pdf-export .report-page.rep-flex-page .rep-result-box-body > img {
            width: 100%;
            height: 100%;
            object-fit: contain;
        }

        .rep-fig-layout .rep-result-box { height: 100%; min-height: 0; margin-top: 0; }
        .rep-fig-layout .rep-result-box + .rep-result-box { margin-top: 0 !important; }
        .report-page.rep-flex-page .rep-result-mode-box,
        .report-page.rep-flex-page .rep-result-chart-box { height: auto; }
        .report-page.rep-flex-page .rep-result-box-body { display: flex; flex-direction: column; min-height: 0; }
        .report-page.rep-flex-page .rep-result-box-body > canvas,
        .report-page.rep-flex-page .rep-result-box-body > img { flex: 1 1 auto; min-height: 0; }

        /* 計算書：判定表の詰め（はみ出し防止） */
        .report-page .split-summary-table { margin-bottom: 4mm; table-layout: fixed; }
        .report-page .split-summary-table th,
        .report-page .split-summary-table td { word-break: break-word; }
        .report-page .data-table { font-size: 7.5pt; }
        .report-page .data-table th { padding: 2px 2px; }
        .report-page .data-table td { padding: 1px 2px; }
        .report-page .rating-box { font-size: 9pt; padding: 3px; }
        
        /* 計算書：層せん断力比較表のスタイル調整 */
        .shear-result-table th, .shear-result-table td { padding: 4px 2px !important; font-size: 8pt !important; }
        
        /* Wall Selection Styles */
        .wall-selector { margin-bottom: 10px; padding: 5px; background: #e8f0fe; border: 1px solid #b3d7ff; border-radius: 3px; }
        .wall-selector-row { display: flex; gap: 5px; margin-bottom: 5px; align-items: center; }
        .wall-selector select { flex: 1; padding: 4px; font-size: 0.9em; }
        .wall-selector input { width: 50px; text-align: right; padding: 4px; }
        .btn-add-wall { background: var(--primary); color: white; border: none; cursor: pointer; padding: 2px 8px; border-radius: 3px; }
        /* 追加表示欄（耐力壁/筋交い/貫/小壁/柱など）の一覧枠は、縦方向リサイズ可（マウス操作） */
        .wall-list { 
            height: auto; 
            max-height: 300px; /* 一覧が多すぎる場合はスクロール */
            min-height: 0; 
            resize: vertical; 
            overflow: auto; 
            background: #fff; 
            border: 1px solid #ccc; 
            margin-bottom: 5px; 
            font-size: 0.85em; 
            box-sizing: border-box; 
        }
        .wall-list:empty { 
            display: none; 
            border: none; 
            margin: 0; 
            padding: 0; 
        }
        .wall-item { display: flex; justify-content: space-between; padding: 3px 5px; border-bottom: 1px solid #eee; align-items: center; }
        .wall-item:last-child { border-bottom: none; }
        .wall-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

        .csv-src-row { display:flex; align-items:center; gap:6px; flex-wrap:wrap; font-size:0.75em; color:#555; margin:4px 0 6px; }
        .csv-src-row .csv-src-label { font-weight:bold; color:#333; white-space:nowrap; }
        .csv-src-row .csv-src-name { font-weight:bold; color:#0d47a1; white-space:nowrap; }
        .csv-file-info { font-size:11px; color:#444; align-self:center; white-space:nowrap; }
        .csv-file-info b { color:#005a9c; }
        
        /* Free Input List Styles */
        /* 追加要素（自由入力）の一覧枠は、縦方向リサイズ可（マウス操作） */
        .free-input-list { height: 40px; min-height: 40px; resize: vertical; overflow: auto; background: #fff; border: 1px solid #ccc; margin-bottom: 5px; font-size: 0.85em; box-sizing: border-box; }
        .free-input-list:empty { display: none; }

        .data-table { width: 100%; border-collapse: collapse; margin-bottom: 5px; font-size: 0.9em; background: #fff; }
        .data-table th { background: #e0e0e0; border: 1px solid #999; padding: 4px; text-align: center; }
        .data-table td { border: 1px solid #999; padding: 2px; text-align: center; }
        .data-table input { width: 90%; border: none; text-align: right; font-family: inherit; }
        
        .btn-sm { padding: 1px 6px; cursor: pointer; font-size: 0.85em; background: #ddd; border: 1px solid #999; border-radius: 2px; }
        .btn-calc { display: block; width: 200px; margin: 20px auto; padding: 12px; font-size: 1.2em; background: var(--primary); color: white; border: none; border-radius: 4px; cursor: pointer; font-weight: bold; box-shadow: 0 2px 5px rgba(0,0,0,0.2); transition: 0.2s; }
        .btn-calc:hover { background: var(--secondary); transform: translateY(-1px); }
        .btn-sheet { background: #fff; border: 1px solid var(--primary); color: var(--primary); cursor: pointer; padding: 2px 8px; font-size: 0.85em; border-radius: 3px; }

        .log-section { margin-top: 20px; border-top: 2px solid #ccc; padding-top: 10px; }
        .log-wrapper { overflow: auto; border: 1px solid #999; max-height: 500px; background: #fff; position: relative; margin-bottom: 20px; }
        .log-table { border-collapse: separate; border-spacing: 0; font-family: 'Consolas', 'Monaco', monospace; font-size: 11px; white-space: nowrap; width: 100%; }
        .log-table thead { position: sticky; top: 0; z-index: 10; }
        .log-table th { background: #f0f0f0; border: 1px solid #ccc; padding: 4px 6px; text-align: center; }
        .log-table td { border: 1px solid #ccc; padding: 2px 6px; text-align: right; }
        .log-table tr:nth-child(even) { background: #f9f9f9; }

        .formula-box { background: #f8f9fa; border: 1px solid #ddd; padding: 20px; margin-top: 20px; border-radius: 5px; }
        .formula-grid { display:grid; grid-template-columns: 1fr 1fr; gap:30px; }
        .formula-item { margin-bottom: 20px; border-bottom: 1px dotted #ccc; padding-bottom: 10px; }
        .formula-desc { color: #555; font-size: 0.9em; margin-top: 5px; line-height: 1.5; }
        .formula-eq { font-family: "Times New Roman", serif; font-size: 1.15em; background: #fff; padding: 4px 8px; display: inline-block; border-radius: 3px; border:1px solid #eee; margin-top:5px; }

        .result-box { display: flex; gap: 15px; flex-wrap: wrap; margin-bottom: 20px; }
        .result-panel { flex: 1; min-width: 450px; padding: 10px; border: 1px solid #ddd; border-top: 3px solid var(--primary); background: #fff; }
        .chart-wrapper { height: 400px; position: relative; width: 100%; }

        .modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 2000; justify-content: center; align-items: center; }
        .modal-content { background: #fff; padding: 15px; width: 800px; height: 80%; display: flex; flex-direction: column; border-radius: 5px; box-shadow: 0 5px 15px rgba(0,0,0,0.3); }
        .progress-modal { background: #fff; padding: 30px; width: 400px; border-radius: 10px; box-shadow: 0 5px 20px rgba(0,0,0,0.4); text-align: center; }
        .progress-bar { width: 100%; height: 30px; background: #e0e0e0; border-radius: 15px; overflow: hidden; margin: 20px 0; }
        .progress-fill { height: 100%; background: linear-gradient(90deg, #005a9c, #0080d0); transition: width 0.3s; border-radius: 15px; }
        #spreadsheet-container { flex: 1; overflow: hidden; margin-bottom: 10px; border: 1px solid #ccc; }

        .badge { padding: 3px 8px; border-radius: 3px; font-weight: bold; font-size: 0.9em; color: white; }
        .badge-ok { background: #28a745; }
        .badge-warn { background: #ffc107; color:#333; }
        .badge-ng { background: #dc3545; }
        .rating-box { margin-top:5px; font-weight:bold; padding:5px; border:1px solid #ccc; background:#fafafa; text-align:center; }

        .story-2-only { transition: opacity 0.3s; }
        
        /* Input Graph Styles */
        .input-chart-wrapper { height: 250px; width: 100%; background: white; border: 1px solid #eee; margin-bottom: 5px; display: flex; flex-direction: column; box-sizing: border-box; }
        .input-chart-wrapper canvas { width: 100% !important; flex: 1 1 auto; min-height: 0; display: block; }

        /* 時刻歴アニメーション：固定高さwrapperだと操作部と重なるため専用枠を用意 */
        .th-anim-wrapper { width: 100%; background: white; border: 1px solid #eee; margin: 10px 0 18px 0; padding: 8px; box-sizing: border-box; position: relative; }
        .th-anim-canvas-box { height: 260px; width: 100%; margin-top: 8px; position: relative; overflow: hidden; }
        .th-anim-canvas-box canvas { width: 100% !important; height: 100% !important; display: block; }
        /* リサイズハンドル */
        .th-anim-resize-handle { position: absolute; right: 0; bottom: 0; width: 18px; height: 18px; cursor: nwse-resize; background: linear-gradient(135deg, transparent 50%, #aaa 50%, #aaa 60%, transparent 60%, transparent 72%, #aaa 72%, #aaa 82%, transparent 82%); opacity: 0.6; z-index: 10; border-radius: 0 0 4px 0; }
        .th-anim-resize-handle:hover { opacity: 1.0; }

        .th-pre-story { margin-top: 10px; margin-bottom: 18px; }
        .th-pre-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; align-items: start; }
        .th-pre-grid .input-chart-wrapper { width: 100% !important; margin: 0 !important; max-width: 480px; }
        .th-time-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; align-items: start; }
        @media (max-width: 900px) {
            .th-time-grid { grid-template-columns: 1fr; }
        }

        /* SVG Diagram Styles */
        .diagram-container { text-align: center; margin: 15px 0; border: 1px solid #eee; padding: 10px; background: white; }
        .diagram-svg { max-width: 100%; height: auto; }
        .diagram-label { font-size: 10px; fill: #333; font-family: sans-serif; }

        /* --- Ultimate CAD v6.0 Style --- */
        :root { --c-bg:#fff; --c-ui:#f8f9fa; --c-bd:#ced4da; --c-prim:#0d6efd; --c-warn:#dc3545; --c-caution:#ffc107; --c-ok:#198754; --c-ghost:#adb5bd; }
        .plan-wrap {
            display:flex; flex-direction:column; border:1px solid var(--c-bd);
            background:var(--c-bg); height:85vh; min-height:750px; font-family:'Segoe UI', sans-serif;
            position:relative; margin:10px 0; box-shadow:0 4px 12px rgba(0,0,0,0.05); border-radius:6px; overflow:hidden;
        }

        /* Full screen edit mode (plan only) */
        body.pl-fullscreen { overflow:hidden; }
        body.pl-fullscreen #plan-unified {
            display:block !important;
            position:fixed; inset:0; z-index:5000;
            background:var(--c-bg);
            margin:0; padding:0;
        }
        body.pl-fullscreen #plan-unified .plan-wrap {
            height:100vh; min-height:0;
            margin:0;
            border-radius:0;
        }
        body.pl-fullscreen #pl-unified-charts-area { display:none !important; }

        /* Fullscreen API (browser/OS fullscreen) — documentElement をフルスクリーン化 */
        body.pl-browser-fs { overflow:hidden; }
        body.pl-browser-fs #plan-unified {
            display:block !important;
            position:fixed; inset:0; z-index:5000;
            background:var(--c-bg);
            margin:0; padding:0;
        }
        body.pl-browser-fs #plan-unified .plan-wrap { height:100vh; min-height:0; margin:0; border-radius:0; }
        body.pl-browser-fs #pl-unified-charts-area { display:none !important; }
        /* body直下モーダルを plan-unified(z:5000) より上に表示 */
        body.pl-browser-fs .modal-overlay,
        body.pl-fullscreen .modal-overlay { z-index: 6000; }

        /* Legacy fallback: #plan-unified 単体フルスクリーン（旧方式） */
        #plan-unified:fullscreen { background:var(--c-bg); overflow:hidden; }
        #plan-unified:fullscreen .plan-wrap { height:100vh; min-height:0; margin:0; border-radius:0; }
        #plan-unified:fullscreen #pl-unified-charts-area { display:none !important; }

        /* vendor prefixes */
        #plan-unified:-webkit-full-screen { background:var(--c-bg); overflow:hidden; }
        #plan-unified:-webkit-full-screen .plan-wrap { height:100vh; min-height:0; margin:0; border-radius:0; }
        #plan-unified:-webkit-full-screen #pl-unified-charts-area { display:none !important; }
        /* Toolbar */
        .plan-bar {
            padding:6px 10px; background:var(--c-ui); border-bottom:1px solid var(--c-bd);
            display:flex; flex-direction:column; gap:6px; z-index:20;
            overflow-x:hidden; overflow-y:hidden;
        }
        .plan-bar-row {
            display:flex; gap:6px; align-items:center; flex-wrap:wrap;
            overflow-x:hidden;
        }
        .plan-grp { display:flex; gap:1px; background:#dee2e6; padding:1px; border-radius:4px; }
        .plan-btn {
            border:none; background:#fff; padding:5px 10px; font-size:12px; cursor:pointer;
            color:#444; display:flex; align-items:center; gap:4px; min-width:34px; justify-content:center; transition:0.15s;
        }
        .plan-btn:hover { background:#e9ecef; }
        .plan-btn.active { background:var(--c-prim); color:#fff; }
        .plan-ico { font-size:12px; line-height:1; opacity:0.9; }
        .plan-sep { width:1px; height:20px; background:#ccc; margin:0 4px; }

        /* Main Area */
        .plan-body { display:flex; flex:1; overflow:hidden; position:relative; }

        /* Side Panel */
        .plan-side {
            width:160px; background:#fff; border-right:1px solid var(--c-bd);
            display:flex; flex-direction:column; font-size:12px; z-index:10;
        }
        .plan-head { background:#e9ecef; padding:8px; font-weight:bold; border-bottom:1px solid #ddd; color:#495057; }
        .plan-item { padding:7px 10px; cursor:pointer; display:flex; align-items:center; gap:6px; border-bottom:1px solid #f8f8f8; transition:0.1s; }
        .plan-item:hover { background:#f1f3f5; }
        .plan-item.off { opacity:0.5; color:#adb5bd; }
        .plan-item.plan-item-disabled { opacity:0.45; color:#999; }

        /* Canvas */
        .plan-cvs { flex:1; position:relative; overflow:hidden; cursor:crosshair; background:var(--c-bg); }
        .plan-info { position:absolute; bottom:0; left:0; background:rgba(255,255,255,0.9); padding:2px 8px; font-size:11px; border-top-right-radius:4px; pointer-events:none; border:1px solid #ccc; }

        /* Axis overlay (fixed to screen, not zoom-scaled) */
        .plan-axis-overlay { position:absolute; inset:0; pointer-events:none; z-index:15; contain:layout style; }
        #plan-unified { --pl-text-scale: 1; }
        .plan-axis-item {
            position:absolute; font-size:calc(12px * var(--pl-text-scale, 1)); line-height:1; color:#666;
            background:rgba(255,255,255,0.85); padding:2px 4px; border-radius:3px;
            border:1px solid #ddd; white-space:nowrap;
            contain:layout style;
        }
        .plan-axis-name { font-weight:bold; color:#444; pointer-events:auto; cursor:grab; }
        .plan-axis-name:active { cursor:grabbing; }
        .plan-axis-dim { pointer-events:auto; cursor:pointer; }

        /* Smart HUD */
        .plan-hud {
            position:absolute; top:10px; right:10px; width:260px;
            background:rgba(255,255,255,0.96); border:1px solid #ccc; border-radius:4px;
            box-shadow:0 4px 15px rgba(0,0,0,0.1); padding:10px; font-size:11px; pointer-events:auto;
        }
        .plan-hud h4 { margin:0 0 8px 0; border-bottom:2px solid var(--c-prim); padding-bottom:4px; font-size:12px; color:var(--c-prim); }
        .plan-row { display:flex; justify-content:space-between; margin-bottom:4px; align-items:center; }
        .plan-val { font-weight:bold; font-family:monospace; font-size:1.15em; }
        .val-ok { color:var(--c-ok); } .val-warn { color:var(--c-caution); } .val-ng { color:var(--c-warn); }
        .plan-overlay-panel {
            position:absolute; right:10px; bottom:10px; width:320px; max-width:min(320px, calc(100% - 20px));
            display:flex; flex-direction:column; gap:8px; pointer-events:none; z-index:3;
        }
        .plan-overlay-section {
            background:rgba(255,255,255,0.96); border:1px solid #ccc; border-radius:6px;
            box-shadow:0 4px 15px rgba(0,0,0,0.12); padding:10px 12px; font-size:11px; color:#333;
        }
        .plan-overlay-title {
            font-weight:bold; font-size:12px; color:var(--c-prim); border-bottom:2px solid var(--c-prim);
            padding-bottom:4px; margin-bottom:8px;
        }
        .plan-overlay-legend-row { display:flex; align-items:center; gap:8px; margin-bottom:5px; }
        .plan-overlay-symbol { display:inline-block; flex:0 0 auto; }
        .plan-overlay-symbol-g { width:10px; height:10px; border-radius:50%; background:#d32f2f; }
        .plan-overlay-symbol-k { width:0; height:0; border-left:7px solid transparent; border-right:7px solid transparent; border-bottom:12px solid #2e7d32; }
        .plan-overlay-symbol-zone15,
        .plan-overlay-symbol-zone30 { width:26px; height:10px; position:relative; }
        .plan-overlay-symbol-zone15::before,
        .plan-overlay-symbol-zone30::before,
        .plan-overlay-symbol-zone15::after,
        .plan-overlay-symbol-zone30::after {
            content:''; position:absolute; top:1px; width:6px; height:6px; border-radius:50%;
        }
        .plan-overlay-symbol-zone15::before,
        .plan-overlay-symbol-zone30::before { left:2px; }
        .plan-overlay-symbol-zone15::after,
        .plan-overlay-symbol-zone30::after { right:2px; }
        .plan-overlay-symbol-zone15::before,
        .plan-overlay-symbol-zone15::after { background:#1565c0; }
        .plan-overlay-symbol-zone30::before,
        .plan-overlay-symbol-zone30::after { background:#d32f2f; }
        .plan-overlay-symbol-missing {
            width:28px; height:10px; position:relative;
            background: linear-gradient(135deg, #c8e6c9 0%, #7cb342 100%);
            border-left: 2px solid #7cb342;
            border-right: 2px solid #7cb342;
        }
        .plan-overlay-note { color:#666; line-height:1.45; margin:6px 0 8px; }

        /* Property */
        .plan-right {
            width:320px; min-width:220px; max-width:620px;
            background:#fff; border-left:1px solid var(--c-bd);
            display:flex; flex-direction:column; overflow:hidden; z-index:10;
        }
        .plan-vsplit {
            width:6px; cursor:col-resize;
            background:linear-gradient(to right, transparent, rgba(0,0,0,0.04), transparent);
            flex:0 0 6px;
        }
        .plan-vsplit:hover { background:linear-gradient(to right, transparent, rgba(13,110,253,0.18), transparent); }

        .plan-hsplit {
            height:6px;
            cursor:row-resize;
            background:linear-gradient(to bottom, transparent, rgba(0,0,0,0.04), transparent);
            flex:0 0 6px;
        }
        .plan-hsplit:hover { background:linear-gradient(to bottom, transparent, rgba(13,110,253,0.18), transparent); }

        .plan-prop { width:auto; background:transparent; border-left:none; display:flex; flex-direction:column; overflow:hidden; z-index:10; min-height:0; flex:1 1 0; }
        .plan-prop > .plan-head { flex: 0 0 auto; }
        #pl-prop-body { flex: 1 1 0; overflow-y: auto; min-height: 0; }
        .plan-layers { border-top:1px solid var(--c-bd); overflow:auto; flex:0 0 320px; min-height:120px; }
        .plan-p-grp { padding:12px; border-bottom:1px solid #eee; }
        .plan-p-row { margin-bottom:8px; }
        .plan-p-row label { display:block; color:#666; margin-bottom:3px; font-size:11px; }
        .plan-p-row input:not([type="checkbox"]):not([type="radio"]) { width:100%; padding:5px; border:1px solid #ced4da; border-radius:3px; font-size:13px; }
        .plan-p-row input[type="checkbox"], .plan-p-row input[type="radio"] { width:auto; margin:0; cursor:pointer; }
        .plan-2col { display:flex; gap:8px; }

        /* Legend list (below plan input) */
        .plan-legend {
            border-top:1px solid var(--c-bd);
            background:var(--c-ui);
            padding:8px 10px;
            font-size:12px;
            line-height:1.5;
            overflow:auto;
            max-height:140px;
            display:flex;
            flex-wrap:wrap;
            gap:4px 14px;
        }
        .plan-legend b { color:#495057; width:100%; }
        .plan-legend > div { display:inline-flex; gap:4px; align-items:baseline; }
        .plan-legend .plan-legend-empty { color:var(--c-ghost); }

        /* Modals */
        .plan-modal {
            position:fixed; top:50%; left:50%; transform:translate(-50%,-50%);
            background:#fff; padding:20px; border-radius:6px; box-shadow:0 10px 40px rgba(0,0,0,0.3);
            z-index:7000; display:none; border:1px solid #999;
            max-width:calc(100vw - 24px);
            max-height:calc(100vh - 24px);
            overflow:auto;
        }
        .plan-modal-overlay {
            position:fixed; inset:0; background:rgba(0,0,0,0.25);
            z-index:6990; display:none;
        }
        .plan-key { background:#f8f9fa; padding:2px 6px; border-radius:4px; border:1px solid #dee2e6; font-family:monospace; font-weight:bold; }

        /* Damper modal layout - top row (form + preview), bottom (Q loop) */
        #pl-damper-modal .pl-damper-layout {
            flex: 1 1 0%;
            min-height: 0;
            display: flex;
            flex-direction: row;
            gap: 12px;
            overflow: hidden;
            width: 100%;
            box-sizing: border-box;
            justify-content: center;
            align-items: stretch;
        }
        /* 左半分: フォーム + Qループ */
        #pl-damper-modal .pl-damper-left {
            flex: 1 1 0%;
            min-width: 280px;
            max-width: calc(50% - 6px);
            display: flex;
            flex-direction: column;
            gap: 10px;
            overflow-y: auto;
            overflow-x: hidden;
        }
        #pl-damper-modal .pl-damper-form {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
            gap: 6px 10px;
            min-width: 0;
            width: 100%;
            padding: 4px 2px;
            font-size: 0.92em;
            box-sizing: border-box;
            align-content: start;
            flex-shrink: 0;
        }
        #pl-damper-modal .pl-damper-form > .pl-damper-form-wide {
            grid-column: 1 / -1;
        }
        /* 右半分: 配置イメージ（正面図） */
        #pl-damper-modal .pl-damper-preview-panel {
            flex: 1 1 0%;
            min-width: 200px;
            max-width: calc(50% - 6px);
            border: 1px solid #e0e0e0;
            border-radius: 8px;
            padding: 8px;
            background: #fafafa;
            overflow: hidden;
            display: flex;
            flex-direction: column;
            box-sizing: border-box;
        }
        #pl-damper-modal #pl-damper-preview {
            flex: 1;
            min-height: 140px;
            width: 100%;
        }
        #pl-damper-modal #pl-damper-preview svg { display: block; width: 100%; height: 100%; }
        #pl-damper-modal .pl-damper-loop-wrap {
            border: 1px solid #e0e0e0;
            border-radius: 8px;
            padding: 8px;
            background: #fafafa;
            overflow: hidden;
            display: flex;
            flex-direction: column;
            min-width: 0;
            width: 100%;
            flex: 1;
            min-height: 420px;
            box-sizing: border-box;
        }
        #pl-damper-modal #pl-damper-loop-panel {
            flex: 1;
            min-height: 160px;
            width: 100%;
            display: flex;
            flex-direction: column;
        }
        #pl-damper-modal #pl-damper-loop-canvas {
            flex: 1;
            width: 100%;
            min-height: 120px;
        }
        #pl-damper-modal #pl-damper-vq-loop-panel {
            flex: 1;
            min-height: 160px;
            width: 100%;
            display: flex;
            flex-direction: column;
        }
        #pl-damper-modal #pl-damper-vq-loop-canvas {
            flex: 1;
            width: 100%;
            min-height: 120px;
        }
        @media (max-width: 980px) {
            #pl-damper-modal .pl-damper-layout { flex-direction: column; align-items: center; }
            #pl-damper-modal .pl-damper-left { flex: none; width: 100%; max-width: 100%; min-width: 0; }
            #pl-damper-modal .pl-damper-preview-panel { min-height: 200px; width: 100%; max-width: 100%; }
        }
        @media (max-width: 680px) {
            #pl-damper-modal .pl-damper-form { grid-template-columns: 1fr; }
        }

        /* Help window (draggable + resizable) */
        #pl-help.pl-help-win {
            position:fixed;
            top:80px;
            left:80px;
            transform:none;
            width:min(920px, calc(100vw - 40px));
            height:min(720px, calc(100vh - 40px));
            padding:0;
            border-radius:6px;
            overflow:hidden;
            border:1px solid var(--c-bd);
            box-shadow:0 10px 40px rgba(0,0,0,0.3);
            z-index:6500;
        }
        #pl-help-head {
            height:34px;
            display:flex;
            align-items:center;
            gap:8px;
            padding:0 10px;
            background:var(--c-ui);
            color:#333;
            user-select:none;
            cursor:grab;
            border-bottom:1px solid var(--c-bd);
        }
        #pl-help-head:active { cursor:grabbing; }
        #pl-help-title { font-size:12px; color:#495057; font-weight:bold; }

        /* Grid modal (draggable) */
        #pl-grid-head { cursor:grab; user-select:none; }
        #pl-grid-head:active { cursor:grabbing; }
        #pl-help-body {
            position:relative;
            height:calc(100% - 34px);
            overflow:auto;
            padding:12px 14px;
            font-size:12px;
            line-height:1.55;
            color:#333;
            background:#fff;
        }
        #pl-help-body h4 {
            margin:10px 0 6px 0;
            font-size:12px;
            color:#495057;
            border-bottom:1px solid var(--c-bd);
            padding-bottom:4px;
        }
        #pl-help-body .pl-help-note { color:var(--c-ghost); font-size:12px; }
        #pl-help-body ul { margin:6px 0 8px 18px; padding:0; }
        #pl-help-body li { margin:2px 0; }
        #pl-help-resize {
            position:absolute;
            right:2px;
            bottom:2px;
            width:16px;
            height:16px;
            cursor:nwse-resize;
            z-index:20;
            background:linear-gradient(135deg, rgba(0,0,0,0) 0%, rgba(0,0,0,0) 55%, rgba(0,0,0,0.25) 56%, rgba(0,0,0,0.25) 60%, rgba(0,0,0,0) 61%);
            opacity:0.8;
        }
        #pl-help-close {
            background:#fff;
            border:1px solid var(--c-bd);
            padding:0 10px;
            cursor:pointer;
            font-weight:bold;
            border-radius:4px;
            height:24px;
        }

        /* 3D Container */
        #pl-3d-modal {
            position:fixed; top:60px; left:60px; transform:none;
            width:min(980px, calc(100vw - 40px));
            height:min(720px, calc(100vh - 40px));
            padding:0; border-radius:6px; overflow:hidden;
            z-index:6000;
        }
        #pl-3d-modal.pl-3d-max { top:10px; left:10px; width:calc(100vw - 20px); height:calc(100vh - 20px); }
        #pl-3d-container { width:100%; height:100%; position:relative; overflow:hidden; background:#000; display:flex; flex-direction:column; }
        #pl-3d-head {
            height:34px; display:flex; align-items:center; gap:8px;
            padding:0 10px; background:#111; color:#fff; user-select:none; cursor:grab;
            border-bottom:1px solid rgba(255,255,255,0.15);
        }
        #pl-3d-head:active { cursor:grabbing; }
        #pl-3d-title { font-size:12px; opacity:0.9; }
        #pl-3d-body { position:relative; flex:1; min-height:0; }
        #pl-3d-close { background:#fff; border:none; padding:0 10px; cursor:pointer; font-weight:bold; border-radius:4px; height:24px; }
        #pl-3d-guide {
            position:absolute;
            top:10px;
            left:10px;
            width:300px;
            max-width:calc(100% - 20px);
            background:rgba(0,0,0,0.55);
            color:#fff;
            border:1px solid rgba(255,255,255,0.18);
            border-radius:6px;
            padding:8px 10px;
            font-size:12px;
            line-height:1.5;
            z-index:30;
            pointer-events:auto;
        }
        #pl-3d-guide b { opacity:0.95; }
        #pl-3d-guide .pl-3d-guide-head { display:flex; align-items:center; justify-content:space-between; gap:8px; }
        #pl-3d-guide .pl-3d-guide-head .pl-3d-guide-title { font-weight:bold; }
        #pl-3d-guide .pl-3d-guide-head .pl-3d-guide-toggle { color:#fff; opacity:0.9; text-decoration:underline; cursor:pointer; user-select:none; }
        #pl-3d-guide.collapsed { width:auto; }
        #pl-3d-guide.collapsed .pl-3d-guide-body { display:none; }
        #pl-3d-legend-panel {
            position:absolute;
            top:10px;
            right:10px;
            width:260px;
            max-width:calc(100% - 20px);
            max-height:calc(100% - 20px);
            overflow:auto;
            background:rgba(255,255,255,0.92);
            border:1px solid var(--c-bd);
            border-radius:6px;
            padding:8px 10px;
            font-size:12px;
            line-height:1.5;
            display:none;
            z-index:30;
        }
        #pl-3d-legend-panel b { color:#495057; }
        #pl-3d-legend-panel .plan-legend-empty { color:var(--c-ghost); }
        #pl-3d-resize {
            position:absolute; right:2px; bottom:2px; width:16px; height:16px;
            cursor:nwse-resize; z-index:20;
            background:linear-gradient(135deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0) 55%, rgba(255,255,255,0.65) 56%, rgba(255,255,255,0.65) 60%, rgba(255,255,255,0) 61%);
            opacity:0.8;
        }

        /* === TH 3Dアニメーション モーダル === */
        #th3d-modal {
            position:fixed; top:40px; left:40px; transform:none;
            width:min(1060px, calc(100vw - 60px));
            height:min(760px, calc(100vh - 60px));
            padding:0; border-radius:8px; overflow:hidden;
            z-index:7000; display:none;
            background:transparent; border:none;
            max-width:none; max-height:none;
            box-shadow: 0 8px 32px rgba(0,0,0,0.45);
        }
        #th3d-modal.th3d-max { top:5px; left:5px; width:calc(100vw - 10px); height:calc(100vh - 10px); border-radius:4px; }
        #th3d-container { width:100%; height:100%; position:relative; overflow:hidden; background:#1a1a2e; display:flex; flex-direction:column; }
        #th3d-head {
            height:38px; display:flex; align-items:center; gap:8px;
            padding:0 12px; background:linear-gradient(90deg, #1a1a2e, #16213e); color:#fff;
            user-select:none; cursor:grab;
            border-bottom:1px solid rgba(255,255,255,0.12);
            flex-shrink:0;
        }
        #th3d-head:active { cursor:grabbing; }
        #th3d-title { font-size:13px; font-weight:bold; opacity:0.95; }
        #th3d-body { position:relative; flex:1; min-height:0; }
        #th3d-controls {
            height:auto; min-height:44px; display:flex; align-items:center; gap:8px;
            padding:6px 12px; background:rgba(0,0,0,0.6); color:#fff;
            flex-shrink:0; flex-wrap:wrap;
        }
        #th3d-controls button {
            background:rgba(255,255,255,0.15); color:#fff; border:1px solid rgba(255,255,255,0.25);
            padding:3px 10px; border-radius:4px; cursor:pointer; font-size:12px; font-weight:bold;
        }
        #th3d-controls button:hover { background:rgba(255,255,255,0.28); }
        #th3d-controls button:active { background:rgba(111,66,193,0.4); }
        /* Control row wrappers: transparent on desktop */
        .th3d-ctrl-row1, .th3d-ctrl-row2 { display: contents; }
        #th3d-controls input[type=range] { flex:1; min-width:180px; accent-color:#6f42c1; }
        #th3d-controls select { background:#222; color:#fff; border:1px solid rgba(255,255,255,0.25); border-radius:4px; padding:2px 6px; font-size:12px; }
        #th3d-controls .th3d-time { font-size:13px; min-width:85px; text-align:center; font-variant-numeric:tabular-nums; }
        #th3d-controls .th3d-scale-label { font-size:11px; color:rgba(255,255,255,0.6); }
        #th3d-resize-handle {
            position:absolute; right:2px; bottom:2px; width:16px; height:16px;
            cursor:nwse-resize; z-index:20;
            background:linear-gradient(135deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0) 55%, rgba(255,255,255,0.5) 56%, rgba(255,255,255,0.5) 60%, rgba(255,255,255,0) 61%);
            opacity:0.7;
        }

        /* 地震波情報オーバーレイ（左上） */
        .th3d-eq-info {
            position:absolute; top:8px; left:8px;
            background:rgba(10,10,30,0.7); border-radius:5px;
            border:1px solid rgba(255,255,255,0.15);
            padding:5px 10px; z-index:10; pointer-events:none;
            font-size:12px; color:rgba(255,255,255,0.88);
            line-height:1.5; white-space:nowrap;
            text-shadow:0 1px 3px rgba(0,0,0,0.6);
        }

        /* 層間変形グラフオーバーレイ */
        #th3d-drift-panel, .th3d-drift-panel-sub {
            position:absolute; bottom:8px;
            right:8px; left:auto;
            width:380px; height:110px;
            background:rgba(10,10,30,0.75); border-radius:6px;
            border:1px solid rgba(255,255,255,0.2);
            z-index:10; display:none;
            box-shadow: 0 2px 12px rgba(0,0,0,0.4);
        }
        .th3d-drift-panel-left {
            right:auto !important; left:8px !important;
        }
        .th3d-drift-panel-right {
            left:auto !important; right:8px !important;
        }
        #th3d-drift-panel canvas, .th3d-drift-panel-sub canvas {
            width:100%; height:100%; border-radius:6px;
        }
        #th3d-drift-legend, .th3d-drift-legend-sub {
            position:absolute; top:6px; right:10px;
            font-size:10px; color:rgba(255,255,255,0.85);
            display:flex; flex-direction:column; gap:2px;
            pointer-events:none;
        }
        #th3d-drift-legend span {
            display:flex; align-items:center; gap:4px;
        }
        #th3d-drift-legend span i {
            display:inline-block; width:14px; height:3px; border-radius:1px;
        }
        .th3d-rec-indicator {
            display:inline-block; width:10px; height:10px; border-radius:50%;
            background:#ff3333; margin-right:4px; animation: th3d-rec-blink 1s infinite;
        }
        @keyframes th3d-rec-blink { 0%,100%{opacity:1;} 50%{opacity:0.3;} }

        /* === 3Dアニメーション 全画面モード === */
        /* Fullscreen API active state */
        :fullscreen #th3d-container, ::backdrop { background:#1a1a2e; }
        :-webkit-full-screen #th3d-container { background:#1a1a2e; }
        /* iOS Safari 疑似全画面 */
        #th3d-modal.th3d-pseudo-fullscreen {
            position:fixed !important; top:0 !important; left:0 !important;
            width:100vw !important; height:100vh !important; height:100dvh !important;
            border-radius:0 !important; box-shadow:none !important;
            max-width:none !important; max-height:none !important;
            z-index:999999 !important;
        }
        /* 全画面(API/疑似) + 横向き: ヘッダ・コントロール最小化で3D表示領域最大化 */
        @media (max-height:500px) and (orientation:landscape) {
            :fullscreen #th3d-head,
            #th3d-modal.th3d-pseudo-fullscreen #th3d-head {
                height:24px; gap:3px; padding:0 6px;
            }
            :fullscreen #th3d-title,
            #th3d-modal.th3d-pseudo-fullscreen #th3d-title {
                display:none;
            }
            :fullscreen #th3d-head button,
            :fullscreen #th3d-head select,
            #th3d-modal.th3d-pseudo-fullscreen #th3d-head button,
            #th3d-modal.th3d-pseudo-fullscreen #th3d-head select {
                height:20px !important; font-size:10px !important; padding:0 5px !important;
            }
            :fullscreen #th3d-controls,
            #th3d-modal.th3d-pseudo-fullscreen #th3d-controls {
                flex-direction:row; flex-wrap:wrap; padding:2px 6px; gap:2px;
                padding-bottom:max(2px, env(safe-area-inset-bottom, 2px));
            }
            :fullscreen .th3d-ctrl-row1,
            :fullscreen .th3d-ctrl-row2,
            #th3d-modal.th3d-pseudo-fullscreen .th3d-ctrl-row1,
            #th3d-modal.th3d-pseudo-fullscreen .th3d-ctrl-row2 {
                display:contents;
            }
            :fullscreen #th3d-controls button,
            #th3d-modal.th3d-pseudo-fullscreen #th3d-controls button {
                padding:1px 5px !important; font-size:10px !important; min-height:22px;
            }
            :fullscreen #th3d-controls select,
            #th3d-modal.th3d-pseudo-fullscreen #th3d-controls select {
                font-size:9px !important; padding:1px 3px !important; min-height:20px;
            }
            :fullscreen .th3d-time,
            #th3d-modal.th3d-pseudo-fullscreen .th3d-time {
                font-size:9px !important; min-width:55px !important;
            }
            :fullscreen .th3d-scale-label,
            #th3d-modal.th3d-pseudo-fullscreen .th3d-scale-label {
                font-size:8px !important;
            }
        }

        /* === 3Dアニメーション共有モード === */
        html.th3d-share-mode body { margin:0; padding:0; overflow:hidden; background:#1a1a2e; }
        html.th3d-share-mode body > *:not(#th3d-modal):not(.th3d-share-load-overlay) { display:none !important; }
        html.th3d-share-mode #th3d-modal {
            display:block !important; position:fixed !important;
            top:0 !important; left:0 !important;
            width:100vw !important; height:100vh !important; height:100dvh !important;
            border-radius:0 !important; box-shadow:none !important;
            z-index:7000;
        }
        .th3d-share-load-overlay {
            position:fixed; top:0; left:0; width:100vw; height:100vh;
            background:#1a1a2e; z-index:99999;
            display:flex; flex-direction:column; justify-content:center; align-items:center;
            color:#fff; font-family:'Meiryo','Hiragino Sans',sans-serif;
        }
        .th3d-share-load-overlay .ld-title { font-size:18px; margin-bottom:16px; opacity:0.9; }
        .th3d-share-load-overlay .ld-sub { font-size:12px; color:rgba(255,255,255,0.5); margin-top:12px; }
        .th3d-share-load-overlay .ld-spinner {
            width:40px; height:40px; border:4px solid rgba(255,255,255,0.15);
            border-top-color:#6f42c1; border-radius:50%;
            animation: th3d-ld-spin 0.8s linear infinite;
        }
        @keyframes th3d-ld-spin { to { transform:rotate(360deg); } }
        /* 共有モード: 閉じる・最大化ボタン非表示 */
        html.th3d-share-mode button[onclick*="closeTH3D"] { display:none !important; }
        html.th3d-share-mode button[onclick*="th3dToggleMax"] { display:none !important; }
        /* スマホ縦向き */
        @media (max-width:600px) {
            html.th3d-share-mode #th3d-head { height:34px; gap:4px; padding:0 8px; }
            html.th3d-share-mode #th3d-head button, html.th3d-share-mode #th3d-head select { height:28px !important; font-size:11px !important; padding:0 6px !important; }
            html.th3d-share-mode #th3d-title { font-size:11px; }
            html.th3d-share-mode #th3d-controls {
                flex-direction:column; gap:4px; padding:6px 8px;
                padding-bottom:max(8px, env(safe-area-inset-bottom, 8px));
            }
            html.th3d-share-mode .th3d-ctrl-row1 {
                display:flex; align-items:center; gap:6px; width:100%;
            }
            html.th3d-share-mode .th3d-ctrl-row2 {
                display:flex; align-items:center; gap:5px; width:100%; flex-wrap:wrap;
            }
            html.th3d-share-mode #th3d-rewind, html.th3d-share-mode #th3d-play {
                min-height:38px; min-width:38px; font-size:14px !important;
                padding:4px 8px !important; flex-shrink:0;
            }
            html.th3d-share-mode #th3d-slider { flex:1; min-width:60px; height:24px; }
            html.th3d-share-mode .th3d-time { font-size:12px !important; min-width:68px !important; flex-shrink:0; }
            html.th3d-share-mode .th3d-ctrl-row2 select { min-height:32px; font-size:12px !important; }
            html.th3d-share-mode .th3d-ctrl-row2 label { font-size:12px !important; }
            html.th3d-share-mode .th3d-ctrl-row2 input[type="checkbox"] { width:20px; height:20px; }
            html.th3d-share-mode .th3d-scale-label { font-size:10px !important; }
        }
        /* スマホ横向き: コンパクトだが全ボタン表示 */
        @media (max-height:500px) and (orientation:landscape) {
            html.th3d-share-mode #th3d-head {
                height:28px; gap:3px; padding:0 6px;
                border-bottom:1px solid rgba(255,255,255,0.08); flex-shrink:0;
            }
            html.th3d-share-mode #th3d-head button, html.th3d-share-mode #th3d-head select { height:22px !important; font-size:10px !important; padding:0 5px !important; }
            html.th3d-share-mode #th3d-title { font-size:10px; }
            html.th3d-share-mode #th3d-controls {
                flex-direction:row; flex-wrap:wrap; padding:2px 6px; gap:3px;
                padding-bottom:max(2px, env(safe-area-inset-bottom, 2px));
            }
            html.th3d-share-mode .th3d-ctrl-row1, html.th3d-share-mode .th3d-ctrl-row2 { display:contents; }
            html.th3d-share-mode #th3d-controls button { padding:1px 6px !important; font-size:10px !important; min-height:24px; }
            html.th3d-share-mode #th3d-controls select { font-size:9px !important; padding:1px 3px !important; min-height:22px; }
            html.th3d-share-mode .th3d-time { font-size:9px !important; min-width:58px !important; }
            html.th3d-share-mode .th3d-scale-label { font-size:8px !important; }
            html.th3d-share-mode #th3d-slider { min-width:60px; }
        }

        /* === 地震波詳細・新規作成ポップアップ === */
        #eq-detail-overlay {
            display:none; position:fixed; top:0; left:0; width:100%; height:100%;
            background:rgba(0,0,0,0.55); z-index:8000;
            justify-content:center; align-items:center;
        }
        #eq-detail-modal {
            background:#fff; width:min(1100px, calc(100vw - 40px)); max-height:calc(100vh - 40px);
            border-radius:8px; box-shadow:0 8px 32px rgba(0,0,0,0.4);
            display:flex; flex-direction:column; overflow:hidden;
        }
        #eq-detail-header {
            display:flex; align-items:center; justify-content:space-between;
            padding:12px 18px; background:linear-gradient(135deg,#005a9c,#0080d0); color:#fff;
            flex-shrink:0;
        }
        #eq-detail-header h3 { margin:0; font-size:16px; }
        #eq-detail-header button { background:none; border:none; color:#fff; font-size:22px; cursor:pointer; line-height:1; padding:0 4px; }
        #eq-detail-body {
            flex:1; overflow-y:auto; padding:18px;
        }
        .eq-detail-stats {
            display:grid; grid-template-columns:repeat(auto-fill, minmax(200px, 1fr));
            gap:10px; margin-bottom:16px;
        }
        .eq-detail-stat-card {
            background:#f4f8fc; border:1px solid #d0dde8; border-radius:6px;
            padding:10px 14px; text-align:center;
        }
        .eq-detail-stat-card .stat-label { font-size:0.8em; color:#555; margin-bottom:4px; }
        .eq-detail-stat-card .stat-value { font-size:1.3em; font-weight:bold; color:#005a9c; font-variant-numeric:tabular-nums; }
        .eq-detail-chart-wrap {
            background:#fafafa; border:1px solid #ddd; border-radius:6px;
            padding:10px; margin-bottom:12px; position:relative;
        }
        .eq-detail-chart-wrap .eq-chart-container { position:relative; width:100%; height:170px; }
        .eq-detail-chart-wrap .eq-chart-container.eq-chart-spectrum { height:200px; }
        .eq-detail-chart-wrap h4 { margin:0 0 6px 0; font-size:13px; color:#333; }
        .eq-spectrum-controls {
            display:flex; align-items:center; gap:12px; margin-bottom:10px; flex-wrap:wrap;
        }
        .eq-spectrum-controls label { font-size:0.85em; color:#555; }
        .eq-spectrum-controls input, .eq-spectrum-controls select {
            padding:3px 6px; border:1px solid #bbb; border-radius:4px; font-size:0.85em;
        }

        /* 新規地震波作成ポップアップ */
        #eq-new-overlay {
            display:none; position:fixed; top:0; left:0; width:100%; height:100%;
            background:rgba(0,0,0,0.55); z-index:8000;
            justify-content:center; align-items:center;
        }
        #eq-new-modal {
            background:#fff; width:calc(100vw - 40px); max-height:calc(100vh - 40px);
            border-radius:8px; box-shadow:0 8px 32px rgba(0,0,0,0.4);
            display:flex; flex-direction:column; overflow:hidden;
        }
        #eq-new-header {
            display:flex; align-items:center; justify-content:space-between;
            padding:12px 18px; background:linear-gradient(135deg,#28a745,#20c997); color:#fff;
            flex-shrink:0;
        }
        #eq-new-header h3 { margin:0; font-size:16px; }
        #eq-new-header button { background:none; border:none; color:#fff; font-size:22px; cursor:pointer; line-height:1; padding:0 4px; }
        #eq-new-body {
            flex:1; overflow-y:auto; padding:18px;
        }
        .eq-new-form { display:grid; grid-template-columns:1fr 1fr; gap:12px; margin-bottom:16px; }
        .eq-new-form .full-width { grid-column: 1 / -1; }
        .eq-new-form label { font-size:0.85em; color:#555; display:block; margin-bottom:3px; }
        .eq-new-form input, .eq-new-form select {
            width:100%; padding:6px 8px; border:1px solid #bbb; border-radius:4px; font-size:0.9em; box-sizing:border-box;
        }
        .eq-new-form textarea {
            width:100%; height:min(200px, 30vh); padding:8px; border:1px solid #bbb; border-radius:4px;
            font-family:monospace; font-size:0.85em; resize:vertical; box-sizing:border-box;
        }
        .eq-new-preview { background:#fafafa; border:1px solid #ddd; border-radius:6px; padding:10px; margin-bottom:16px; }
        .eq-new-preview-chart-wrap { position:relative; width:100%; height:min(250px, 30vh); }
        .eq-new-preview canvas { width:100%; height:100%; }
        .eq-new-actions { display:flex; gap:10px; justify-content:flex-end; }
        .eq-new-actions button {
            padding:8px 20px; border:none; border-radius:4px; font-weight:bold; cursor:pointer; font-size:0.9em;
        }
        .eq-new-btn-register { background:#005a9c; color:#fff; }
        .eq-new-btn-register:hover { background:#004080; }
        .eq-new-btn-cancel { background:#ccc; color:#333; }
        .eq-new-btn-cancel:hover { background:#aaa; }
        .eq-new-btn-preview { background:#17a2b8; color:#fff; }
        .eq-new-btn-preview:hover { background:#138496; }

        /* --- 計算書出力用 高品質スタイル --- */
        #report-view { display: none; width: 210mm; background-color: #fff; }

        /* PDF生成時はreport-viewをcloneしてidを変更するため、クラス基準でも同じ設定を適用する */
        .report-view-root { width: 210mm; background-color: #fff; }

        /* PDF(html2canvas)出力ではscreen CSSが使われるため、report-view内だけstickyヘッダを無効化 */
        #report-view .log-table thead { position: static !important; top: auto !important; z-index: auto !important; }
        #report-view .log-table th { position: static !important; z-index: auto !important; }
        .report-view-root .log-table thead { position: static !important; top: auto !important; z-index: auto !important; }
        .report-view-root .log-table th { position: static !important; z-index: auto !important; }
        
        /* report-view内のログ表は「印刷用」の体裁を常時適用（nowrap由来の見出し欠け対策） */
        #report-view .log-print-wrapper { font-size: 6pt; }
        #report-view .log-print-wrapper table { border-collapse: collapse; width: 100%; table-layout: fixed; }
        #report-view .log-print-wrapper th,
        #report-view .log-print-wrapper td {
            border: 1px solid #000;
            padding: 1px 2px;
            text-align: center;
            font-size: 6pt;
            word-wrap: break-word;
            white-space: normal;
            overflow: visible;
        }
        #report-view .log-print-wrapper th {
            background: #e0e0e0 !important;
            -webkit-print-color-adjust: exact;
            print-color-adjust: exact;
            font-weight: bold;
        }
        #report-view .log-print-wrapper .log-header-group th {
            background: #d0d0d0 !important;
            -webkit-print-color-adjust: exact;
            print-color-adjust: exact;
        }
        #report-view .log-print-wrapper thead th:first-child { min-width: 60px; width: 60px; }
        #report-view .log-print-wrapper .log-rhdr { min-width: 80px; width: 80px; font-size: 5.5pt; line-height: 1.05; }

        .report-view-root .log-print-wrapper { font-size: 6pt; }
        .report-view-root .log-print-wrapper table { border-collapse: collapse; width: 100%; table-layout: fixed; }
        .report-view-root .log-print-wrapper th,
        .report-view-root .log-print-wrapper td {
            border: 1px solid #000;
            padding: 1px 2px;
            text-align: center;
            font-size: 6pt;
            word-wrap: break-word;
            white-space: normal;
            overflow: visible;
        }
        .report-view-root .log-print-wrapper th {
            background: #e0e0e0 !important;
            -webkit-print-color-adjust: exact;
            print-color-adjust: exact;
            font-weight: bold;
        }
        .report-view-root .log-print-wrapper .log-header-group th {
            background: #d0d0d0 !important;
            -webkit-print-color-adjust: exact;
            print-color-adjust: exact;
        }
        .report-view-root .log-print-wrapper thead th:first-child { min-width: 60px; width: 60px; }
        .report-view-root .log-print-wrapper .log-rhdr { min-width: 80px; width: 80px; font-size: 5.5pt; line-height: 1.05; }
        .report-page { 
            width: 210mm; 
            height: 297mm; 
            box-sizing: border-box; 
            padding: 22mm 20mm 14mm 20mm; 
            background: white; 
            overflow: hidden; 
            position: relative; 
            page-break-after: always; 
            font-family: "Times New Roman", "YuMincho", "Hiragino Mincho ProN", serif; 
            color: #000; 
            display: flex;
            flex-direction: column;
        }
        .report-page > .report-header { flex-shrink: 0; }
        .report-page > .report-section { flex: 1 1 auto; min-height: 0; overflow: hidden; }
        .page-number { 
            position: absolute;
            bottom: 4mm;
            left: 0;
            right: 0;
            text-align: center;
            font-size: 10pt; 
            font-family: sans-serif; 
            color: #333; 
        }
        
        /* ヘッダー装飾 */
        .report-header {
            border-bottom: 2px solid #000;
            margin-bottom: 15px;
            padding-bottom: 5px;
            display: flex;
            justify-content: space-between;
            align-items: flex-end;
        }
        .report-header h1 {
            margin: 0;
            font-size: 16pt;
            font-weight: bold;
            color: #000;
            border: none;
        }
        .report-prop-name {
            font-size: 10pt;
            font-weight: normal;
        }
        
        /* セクション見出し */
        .report-section h3 {
            font-size: 12pt;
            border-left: 5px solid #000;
            border-bottom: 1px solid #ccc;
            padding: 5px 10px;
            background: transparent;
            margin: 15px 0 10px 0;
            color: #000;
        }
        
        /* テーブル装飾（構造計算書スタイル） */
        .report-table {
            width: 100%;
            border-collapse: collapse;
            font-size: 9pt;
            margin-bottom: 10px;
            font-family: "Consolas", "Monaco", "MS Gothic", monospace;
        }
        .report-table th {
            background: #f0f0f0 !important;
            color: #000;
            border: 1px solid #000 !important;
            padding: 4px;
            font-weight: bold;
            text-align: center;
            -webkit-print-color-adjust: exact;
            print-color-adjust: exact;
        }
        .report-table td {
            border: 1px solid #000 !important;
            padding: 4px;
            text-align: center;
            color: #000;
        }
        
        /* ログテーブルの微調整 */
        .log-print-wrapper table {
            font-size: 7pt;
            border: 1px solid #000;
        }
        .log-print-wrapper th {
            background: #e0e0e0 !important;
            border: 1px solid #000 !important;
            padding: 2px;
        }
        .log-print-wrapper td {
            border: 1px solid #000 !important;
            padding: 2px;
        }
        
        /* グラフ画像の枠 */
        .report-chart-img {
            border: 1px solid #000 !important;
        }

        /* 計算書：第1章 平面図（各階1ページ、凡例は枠外の下部） */
        .report-plan-page-grid { display: flex; flex-direction: column; gap: 4mm; }
        .report-plan-box { box-sizing: border-box; }
        .report-plan-box-title { font-weight: bold; font-size: 10pt; margin: 0 0 2mm 0; }
        .report-plan-frame { border: 1px solid #000; padding: 2mm; box-sizing: border-box; display: flex; align-items: center; justify-content: center; max-height: 118mm; overflow: hidden; }
        .report-plan-img { max-width: 100%; max-height: 112mm; width: auto; height: auto; object-fit: contain; display: block; }
        .report-plan-legend { margin-top: 1.5mm; font-size: 7.5pt; line-height: 1.25; display: flex; flex-wrap: wrap; gap: 1mm 5mm; }
        .report-plan-legend-title { width: 100%; font-weight: bold; margin-bottom: 1mm; }
        .report-plan-legend-item { display: inline-flex; gap: 2mm; align-items: baseline; max-width: 100%; }
        .report-plan-legend-code { font-weight: bold; white-space: nowrap; }
        .report-plan-legend-name { white-space: normal; word-break: break-word; }

        /* 計算書：第2章 復元力特性グラフ（凡例を下に配置して文字切れ防止） */
        .rep-force-chart-wrapper {
            border: 1px solid #ccc;
            margin-top: 5px;
            background: #fff;
        }
        .rep-force-chart-title {
            font-size: 9pt;
            font-weight: bold;
            padding: 2px 5px;
            background: #f0f0f0;
        }
        .rep-force-canvas-box {
            height: 150px;
        }
        .rep-force-legend {
            padding: 2px 4px 4px;
            font-size: 6pt;
            line-height: 1.2;
            display: flex;
            flex-wrap: wrap;
            gap: 2px 8px;
        }
        .rep-force-legend-item {
            display: inline-flex;
            align-items: flex-start;
            gap: 3px;
            max-width: 100%;
        }
        .rep-force-legend-color {
            width: 8px;
            height: 8px;
            margin-top: 2px;
            border: 1px solid #333;
            flex: 0 0 auto;
        }
        .rep-force-legend-text {
            white-space: normal;
            word-break: break-word;
        }
        
        /* キャンバスをPDF用に高解像度化 */
        canvas {
            max-width: 100%;
        }
        
        @media print {
            @page { size: A4; margin: 0; }
            body { background: white; padding: 0; font-size: 9pt; margin:0; }
            .no-print { display: none !important; }
            #report-view { display: block !important; }
            .container { box-shadow: none; padding: 0; max-width: 100%; width: 100%; margin: 0; }

            .report-page {
                width: auto;
                min-height: 297mm;
                height: auto;
                box-sizing: border-box;
                padding: 15mm 15mm 14mm 15mm;
                margin: 0;
                position: relative;
                page-break-after: always;
                page-break-inside: avoid;
                background: white;
                overflow: visible;
                display: block;
            }
            .report-page:last-child { page-break-after: auto; }
            /* 表示されている最終ページの後ろに空白ページが出ることがあるため、JSで最終ページにマーカーを付与して抑止 */
            .report-page.__print-last-page {
                page-break-after: auto !important;
                break-after: auto !important;
            }
            /* 空コンテナが空白ページを生成しないようにする */
            #rep-appendix-container:empty { display: none; }
            .report-view-root > *:not(.report-page) { page-break-after: avoid; page-break-before: avoid; }
            /* ページ番号: 印刷時はページ最下部中央に絶対配置 */
            .page-number {
                position: absolute;
                bottom: 4mm;
                left: 0;
                right: 0;
                text-align: center;
                font-size: 9pt;
                color: #333;
            }

            .report-header { display: flex; justify-content: space-between; align-items: flex-end; border-bottom: 2px solid #000; margin-bottom: 10px; padding-bottom: 5px; }
            .report-header h1 { margin: 0; font-size: 16pt; color: #000; border: none; font-weight: bold; }
            .report-header .report-title-box { flex: 1; }
            .report-header .report-prop-name { font-size: 12pt; font-weight: bold; text-align: right; }
            
            .report-section { margin-bottom: 12px; break-inside: avoid; page-break-inside: avoid; }
            .report-section h3 { font-size: 12pt; border-left: 5px solid #000; padding-left: 8px; background: transparent; margin: 8px 0 5px 0; break-after: avoid; page-break-after: avoid; }
            
            .report-table { width: 100%; border-collapse: collapse; font-size: 9pt; margin-bottom: 8px; break-inside: avoid; page-break-inside: avoid; }
            .report-table thead { display: table-header-group; }
            .report-table tfoot { display: table-footer-group; }
            .report-table tr { break-inside: avoid; page-break-inside: avoid; }
            .report-table th { background: #f0f0f0 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; color: #000; border: 1px solid #000; padding: 4px; font-size: 9pt; font-weight: bold; }
            .report-table td { border: 1px solid #000; padding: 3px 5px; text-align: center; font-size: 9pt; }

            .report-chart-img { width: 100%; max-height: 180mm; height: auto; border: 1px solid #000; object-fit: contain; margin: 5px 0; }

            .report-plan-page-grid { display: flex; flex-direction: column; gap: 6mm; }
            .report-plan-box { border: 1px solid #000; padding: 3mm; box-sizing: border-box; }
            .report-plan-box-title { font-weight: bold; font-size: 10pt; margin: 0 0 2mm 0; }

            /* 時刻歴応答解析レポート用印刷スタイル */
            body.th-printing .container { display: none !important; }
            body.th-printing #report-view { display: none !important; }
            body.th-printing #progressModal { display: none !important; }
            body.th-printing .modal-overlay { display: none !important; }
            .app-statusbar { display: none !important; }
            #th-report-host { display: block !important; width: auto; margin: 0; padding: 0; }
            .th-report-page {
                width: auto !important;
                min-height: 297mm !important;
                height: auto !important;
                box-sizing: border-box;
                padding: 15mm 15mm 14mm 15mm !important;
                margin: 0;
                page-break-after: always;
                page-break-inside: avoid;
                background: white;
                position: relative;
                overflow: visible !important;
                display: block !important;
            }
            .th-report-page:last-child { page-break-after: auto; }
            .th-report-page .page-number {
                position: absolute !important;
                bottom: 4mm !important;
                left: 0;
                right: 0;
                text-align: center !important;
                margin-top: 0 !important;
                padding-top: 0;
            }
            .th-report-page img { max-width: 100%; height: auto; }
            .report-plan-frame { border: 1px solid #000; padding: 2mm; box-sizing: border-box; display: flex; align-items: center; justify-content: center; max-height: 118mm; overflow: hidden; }
            .report-plan-img { max-width: 100%; max-height: 112mm; width: auto; height: auto; object-fit: contain; display: block; }
            
            .log-print-wrapper { font-size: 6pt; }
            .log-print-wrapper table { border-collapse: collapse; width: 100%; table-layout: fixed; }
            .log-print-wrapper th, .log-print-wrapper td { border: 1px solid #000; padding: 1px 2px; text-align: center; font-size: 6pt; word-wrap: break-word; white-space: normal; overflow: visible; }
            /* html2canvas + stickyヘッダの相性で見出しが欠けることがあるため、印刷時はstickyを無効化 */
            .log-print-wrapper .log-table thead { position: static !important; }
            .log-print-wrapper .log-table th { position: static !important; z-index: auto !important; }

            .log-print-wrapper th { background: #e0e0e0 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; font-weight: bold; }
            .log-print-wrapper .log-header-group th { background: #d0d0d0 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
            .log-print-wrapper .log-table th { background: #e0e0e0 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
            .log-print-wrapper thead th:first-child { min-width: 50px; }

            /* 先頭見出し（層間変形角R(rad)）が狭い環境でも欠けないよう微調整 */
            .log-print-wrapper .log-table thead tr:last-child th:first-child { font-size: 5.5pt; line-height: 1.05; }
            
            .logic-print { font-size: 9pt; line-height: 1.4; }
            .logic-print h4 { margin: 5px 0; }
            .logic-print .logic-figure-img { width: 90% !important; max-width: 90% !important; height: auto; }

            /* 数式ボックスがページ境界で分断されないようにする */
            .formula-box { break-inside: avoid; page-break-inside: avoid; }
            .formula-item { break-inside: avoid; page-break-inside: avoid; }
        }

        .th-progress {
            flex: 1;
            height: 10px;
            background: #f2f2f2;
            border-radius: 6px;
            border: 1px solid #c9c9c9;
            overflow: hidden;
        }

        .th-progress-bar {
            height: 100%;
            width: 0%;
            background: linear-gradient(90deg, #4caf50, #2e7d32);
            transition: width 0.2s ease;
        }

        /* ステータスバー（トースト通知） */
        .app-statusbar {
            position: fixed;
            bottom: 24px;
            left: 50%;
            transform: translateX(-50%) translateY(80px);
            min-width: 280px;
            max-width: 520px;
            padding: 12px 24px;
            background: #323232;
            color: #fff;
            font-size: 14px;
            font-weight: 500;
            border-radius: 6px;
            box-shadow: 0 4px 16px rgba(0,0,0,0.3);
            z-index: 100000;
            opacity: 0;
            pointer-events: none;
            transition: opacity 0.3s ease, transform 0.3s ease;
            text-align: center;
        }
        .app-statusbar.app-statusbar--visible {
            opacity: 1;
            pointer-events: auto;
            transform: translateX(-50%) translateY(0);
        }
        .app-statusbar.app-statusbar--success { background: #2e7d32; }
        .app-statusbar.app-statusbar--error   { background: #c62828; }
        .app-statusbar.app-statusbar--info    { background: #1565c0; }
        .app-statusbar.app-statusbar--warn    { background: #e65100; }

        /* ========== CSV読込プログレスオーバーレイ ========== */
        .csv-loading-overlay {
            position: fixed; top: 0; left: 0; width: 100%; height: 100%;
            background: rgba(0,0,0,0.45);
            z-index: 100001;
            display: flex; align-items: center; justify-content: center;
        }
        .csv-loading-overlay .csv-loading-box {
            background: #fff; border-radius: 12px; padding: 30px 50px; text-align: center;
            box-shadow: 0 4px 20px rgba(0,0,0,0.3); min-width: 340px;
        }
        .csv-loading-overlay .csv-loading-label {
            font-size: 1.1em; font-weight: bold; color: #333; margin-bottom: 15px;
        }
        .csv-loading-overlay .csv-loading-track {
            background: #e0e0e0; border-radius: 8px; height: 22px; overflow: hidden; position: relative;
        }
        .csv-loading-overlay .csv-loading-bar {
            background: linear-gradient(90deg, #1976d2, #42a5f5); height: 100%; width: 0%;
            border-radius: 8px; transition: width 0.3s ease;
            animation: csvLoadingPulse 1.5s ease-in-out infinite;
        }
        @keyframes csvLoadingPulse {
            0%, 100% { opacity: 1; }
            50% { opacity: 0.7; }
        }
        .csv-loading-overlay .csv-loading-pct {
            margin-top: 8px; font-size: 0.9em; color: #666;
        }

        /* ========== 共有リンクポップアップ ========== */
        .share-link-overlay {
            position: fixed; top: 0; left: 0; width: 100%; height: 100%;
            background: rgba(0,0,0,0.45);
            z-index: 100002;
            display: flex; align-items: center; justify-content: center;
        }
        .share-link-box {
            background: #fff; border-radius: 12px; padding: 25px 30px; min-width: 420px; max-width: 680px;
            box-shadow: 0 4px 20px rgba(0,0,0,0.3); position: relative;
        }
        .share-link-box h3 { margin: 0 0 15px; color: #005a9c; font-size: 1.1em; }
        .share-link-box .share-link-close {
            position: absolute; top: 10px; right: 14px; font-size: 1.4em; cursor: pointer;
            color: #999; border: none; background: none; line-height: 1;
        }
        .share-link-box .share-link-close:hover { color: #333; }
        .share-link-row { margin-bottom: 14px; }
        .share-link-row label { display: block; font-weight: bold; font-size: 0.85em; color: #555; margin-bottom: 4px; }
        .share-link-row .share-link-input-wrap {
            display: flex; gap: 6px; align-items: stretch;
        }
        .share-link-row input[type="text"] {
            flex: 1; padding: 7px 10px; border: 1px solid #bbb; border-radius: 4px; font-size: 0.85em;
            background: #f8f9fa; color: #333; word-break: break-all;
        }
        .share-link-row .share-copy-btn {
            padding: 6px 14px; background: #007bff; color: #fff; border: none; border-radius: 4px;
            cursor: pointer; font-weight: bold; font-size: 0.85em; white-space: nowrap;
        }
        .share-link-row .share-copy-btn:hover { background: #0056b3; }
        .share-link-note { font-size: 0.8em; color: #888; margin-top: 10px; }

        /* ========== ローディングオーバーレイ ========== */
        #loading-overlay {
            position: fixed; top: 0; left: 0; width: 100%; height: 100%;
            background: rgba(244,245,247,0.97);
            z-index: 999999;
            display: flex; flex-direction: column; align-items: center; justify-content: center;
            transition: opacity 0.4s ease;
        }
        #loading-overlay.hide { opacity: 0; pointer-events: none; }
        .loading-popup {
            background: #fff; border-radius: 16px; padding: 40px 50px; text-align: center;
            box-shadow: 0 8px 40px rgba(0,0,0,0.15); max-width: 420px; width: 90%;
        }
        .loading-popup h2 { margin: 0 0 8px; color: #005a9c; font-size: 1.3em; }
        .loading-popup p { margin: 0 0 24px; color: #666; font-size: 0.9em; }
        .loading-spinner {
            width: 48px; height: 48px; margin: 0 auto 20px;
            border: 4px solid #e0e0e0; border-top: 4px solid #005a9c;
            border-radius: 50%; animation: spin 0.8s linear infinite;
        }
        @keyframes spin { to { transform: rotate(360deg); } }
        .loading-progress-bar {
            width: 100%; height: 6px; background: #e0e0e0; border-radius: 3px; overflow: hidden; margin-bottom: 10px;
        }
        .loading-progress-fill {
            height: 100%; width: 0%; background: linear-gradient(90deg, #005a9c, #0288d1);
            border-radius: 3px; transition: width 0.3s ease;
        }
        .loading-status { color: #888; font-size: 0.82em; min-height: 1.4em; }
        /* ========== ローディング進捗ステータスバー（画面下部） ========== */
        #loading-statusbar {
            position: fixed; bottom: 0; left: 0; width: 100%; z-index: 999998;
            background: #005a9c; color: #fff; font-size: 12px; font-family: 'Meiryo', sans-serif;
            display: flex; align-items: center; height: 28px; padding: 0 16px; box-sizing: border-box;
            transition: opacity 0.4s ease;
        }
        #loading-statusbar.hide { opacity: 0; pointer-events: none; }
        #loading-statusbar .ls-icon { margin-right: 8px; animation: spin 1s linear infinite; display: inline-block; }
        #loading-statusbar .ls-text { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
        #loading-statusbar .ls-pct { margin-left: 12px; font-weight: bold; }

        /* ================================================================
           レスポンシブ対応 — タブレット (≤768px)
           ================================================================ */
        @media (max-width: 768px) {
            html { overflow-x: hidden; }
            body { padding: 8px; font-size: 12px; overflow-x: hidden; }
            .container { padding: 10px; overflow-x: hidden; box-sizing: border-box; max-width: 100vw; }
            h1 { font-size: 1.15em; }
            #app-sub-title { display: none; }

            /* タブ */
            .tabs { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; gap: 2px; }
            .tabs::-webkit-scrollbar { display: none; }
            .tab-link { flex-shrink: 0; padding: 7px 14px; font-size: 0.85em; white-space: nowrap; }

            /* データ入出力バー */
            .tabs ~ div > div[style*="display:flex"][style*="justify-content:flex-end"] { flex-wrap: wrap; gap: 6px; }
            .tabs ~ div > div[style*="display:flex"][style*="justify-content:flex-end"] button { padding: 7px 12px; font-size: 0.85em; }

            /* 結果パネル — 縦積み */
            .result-box { flex-direction: column; }
            .result-panel { min-width: auto; width: 100%; }

            /* モーダル共通 — 幅の上限制約 */
            .modal-content { max-width: 95vw !important; box-sizing: border-box; }
            .modal-overlay > .modal-content:not([style*="max-width"]) { width: min(800px, 95vw); }
            .progress-modal { width: min(90vw, 400px); }

            /* プランエディタ */
            .plan-right { width: 100% !important; max-width: 100% !important; min-width: 0 !important; }
            .plan-side { width: 120px; }
            .plan-hud { width: 200px; }

            /* 共有リンク・CSVローディング */
            .share-link-box { min-width: auto; width: calc(100vw - 30px); max-width: 680px; padding: 20px; }
            .csv-loading-overlay .csv-loading-box { min-width: auto; width: calc(100vw - 40px); padding: 20px 24px; }

            /* 数式グリッド */
            .formula-grid { grid-template-columns: 1fr; gap: 15px; }

            /* sheet-modal 内部2カラム→縦積み */
            #sheet-modal .modal-content > div[style*="display:flex"][style*="gap:20px"][style*="height"] {
                flex-direction: column; height: auto !important; max-height: calc(100vh - 200px);
            }
            #sheet-modal .modal-content > div[style*="display:flex"][style*="gap:20px"][style*="height"] > div { min-width: 0 !important; }
            #sheet-modal #spreadsheet-container { min-height: 200px; }

            /* large-nuki / sashigamoi 内部2カラム→縦積み */
            #large-nuki-modal .modal-content > div > div[style*="display: flex"][style*="gap: 20px"],
            #sashigamoi-modal .modal-content > div > div[style*="display: flex"][style*="gap: 20px"] {
                flex-direction: column;
            }
            #large-nuki-modal .modal-content > div > div > div[style*="min-width: 350px"],
            #sashigamoi-modal .modal-content > div > div > div[style*="min-width: 350px"] {
                min-width: 0 !important; width: 100%;
            }

            /* mudwall-detail-modal 内部2カラム→縦積み */
            #mudwall-detail-modal .modal-content > div[style*="display:flex"][style*="gap:15px"] {
                flex-direction: column;
            }
            #mudwall-detail-modal .modal-content > div > div[style*="max-width:52%"],
            #mudwall-detail-modal .modal-content > div > div[style*="max-width:48%"] {
                max-width: 100% !important; width: 100%;
            }

            /* gridwall-detail-modal 内部2カラム→縦積み */
            #gridwall-detail-modal .modal-content > div[style*="display:flex"][style*="gap:15px"] {
                flex-direction: column;
            }
            #gridwall-detail-modal .modal-content > div > div[style*="max-width:50%"] {
                max-width: 100% !important; width: 100%;
            }

            /* independent-column / tarewall-column 内部2カラム→縦積み */
            #independent-column-modal .modal-content > div[style*="display:flex"][style*="gap:20px"],
            #tarewall-column-modal .modal-content > div[style*="display:flex"][style*="gap:15px"] {
                flex-direction: column;
            }
            #tarewall-column-modal .modal-content > div > div[style*="max-width:55%"],
            #tarewall-column-modal .modal-content > div > div[style*="max-width:45%"] {
                max-width: 100% !important; width: 100%;
            }

            /* isolation-settings-modal 内部2カラム→縦積み */
            #isolation-settings-modal > div > div[style*="display:flex"][style*="gap:14px"] {
                flex-direction: column;
            }
            #isolation-settings-modal > div > div > div[style*="min-width:300px"] {
                min-width: 0 !important; width: 100%;
            }

            /* wave-modal ヘッダ2カラム→縦積み */
            #wave-modal .modal-content > div[style*="display:flex"][style*="gap:20px"][style*="background:#f5f5f5"] {
                flex-direction: column; gap: 10px;
            }

            /* eq-detail-modal stats */
            .eq-detail-stats { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }

            /* eq-new-modal form */
            .eq-new-form { grid-template-columns: 1fr; }

            /* 時刻歴グリッド — 1列 */
            .th-pre-grid { grid-template-columns: 1fr; }

            /* ログテーブル — 横スクロール可 */
            .log-wrapper { -webkit-overflow-scrolling: touch; }

            /* pl-help (ドラッグモーダル) → モバイルではフルスクリーン的表示 */
            #pl-help.pl-help-win {
                top: 10px !important; left: 10px !important;
                width: calc(100vw - 20px) !important; height: calc(100vh - 20px) !important;
                cursor: default;
            }
            #pl-help-head { cursor: default; }

            /* pl-3d-modal → モバイル配置 */
            #pl-3d-modal {
                top: 5px !important; left: 5px !important;
                width: calc(100vw - 10px) !important; height: calc(100vh - 10px) !important;
            }

            /* pl-gridwall-modal 内部2カラム→縦積み */
            #pl-gridwall-modal > div[style*="display:flex"][style*="gap:15px"] {
                flex-direction: column;
            }
            #pl-gridwall-modal > div[style*="display:flex"] > div[style*="min-width:300px"] {
                min-width: 0 !important; width: 100%;
            }

            /* pl-mudwall-modal 内部グリッド→1列 */
            #pl-mudwall-modal > div[style*="display:grid"][style*="grid-template-columns"] {
                grid-template-columns: 1fr !important;
            }

            /* データ入出力バー — flex-wrap */
            #data-io-bar { gap: 6px; }
            #data-io-bar button { font-size: 0.82em; padding: 6px 10px; flex-shrink: 0; }

            /* 串団子モデルコンテナ — 幅レスポンシブ化 */
            #model-container { width: 100% !important; min-width: 0 !important; max-width: 360px; }

            /* =====================================================
               壁セレクター行 — 折り返し有効化 (全インスタンス)
               ===================================================== */
            .wall-selector-row { flex-wrap: wrap !important; }

            /* 壁セレクター内 固定幅select(160px/140px)→レスポンシブ化 */
            .wall-selector-row select[style*="width:160px"],
            .wall-selector-row select[style*="width: 160px"] {
                width: min(160px, 100%) !important; min-width: 0; flex: 1 1 140px;
            }
            .wall-selector-row select[style*="width:140px"],
            .wall-selector-row select[style*="width: 140px"] {
                width: min(140px, 100%) !important; min-width: 0; flex: 1 1 120px;
            }
            /* 壁セレクター内 固定幅input(110px/80px/70px)→レスポンシブ化 */
            .wall-selector-row input[style*="width:110px"],
            .wall-selector-row input[style*="width: 110px"] {
                width: min(110px, calc(50% - 8px)) !important; flex: 1 1 80px; min-width: 60px;
            }
            .wall-selector-row input[style*="width:80px"],
            .wall-selector-row input[style*="width: 80px"] {
                width: min(80px, calc(40% - 8px)) !important; flex: 0 1 80px; min-width: 50px;
            }

            /* 壁セレクターのselect(無幅指定)→折り返し時に十分な幅を確保 */
            .wall-selector select { min-width: 0; }
            .wall-selector-row > select:not([style*="width"]) {
                flex: 1 1 100%; min-width: 120px;
            }
            /* 壁セレクター内 固定幅select(70px: 柱形状等)→レスポンシブ化 */
            .wall-selector-row select[style*="width:70px"],
            .wall-selector-row select[style*="width: 70px"] {
                width: min(70px, 100%) !important; min-width: 60px; flex: 0 1 70px;
            }
            /* 壁セレクター内 固定幅input(60px: 壁幅等)→最小幅確保 */
            .wall-selector-row input[style*="width:60px"],
            .wall-selector-row input[style*="width: 60px"] {
                width: 60px !important; min-width: 50px; flex: 0 1 60px;
            }
            /* 壁セレクター内 固定幅input(50px: 箇所数等)→最小幅確保 */
            .wall-selector-row input[style*="width:50px"],
            .wall-selector-row input[style*="width: 50px"] {
                width: 50px !important; min-width: 44px; flex: 0 1 50px;
            }
            /* 壁セレクター内 固定幅input(70px: 柱幅/軸力等)→最小幅確保 */
            .wall-selector-row input[style*="width:70px"],
            .wall-selector-row input[style*="width: 70px"] {
                width: min(70px, calc(40% - 8px)) !important; min-width: 55px; flex: 0 1 70px;
            }

            /* 復元力特性トップバー — 折り返し */
            .force-topbar { display: flex; flex-wrap: wrap; gap: 6px 16px; }
            .force-topbar label { font-size: 0.9em; }

            /* 復元力ヘッダー — ボタンとテキスト折り返し */
            .force-header { flex-wrap: wrap; gap: 5px; }
            .wall-selector > div:first-child { flex-wrap: wrap !important; gap: 4px; }

            /* 結果タブ: min-widthコンテナのオーバーフロー防止 */
            #tab-result div[style*="min-width:400px"],
            #tab-result div[style*="min-width:350px"],
            #tab-result div[style*="min-width:280px"] {
                min-width: 0 !important; width: 100%;
            }

            /* 計算書出力設定 — 折り返し */
            .print-options-section { box-sizing: border-box; max-width: 100%; overflow: hidden; }
            .print-options-section div[style*="display:flex"] { flex-wrap: wrap !important; }

            /* =====================================================
               制振ダンパ インラインフォーム — 全子span flex-wrap有効化
               ===================================================== */
            .wall-selector-row > span[id^="d-"] {
                flex-wrap: wrap !important;
            }
            .wall-selector-row > span[id^="d-"] > span[id^="d-"] {
                flex-wrap: wrap !important;
            }
            /* ダンパ種類select (120px) */
            .wall-selector-row select[style*="width:120px"],
            .wall-selector-row select[style*="width: 120px"] {
                width: min(120px, 100%) !important; min-width: 0; flex: 1 1 100px;
            }
            /* ダンパ粘弾性モデルselect (130px) */
            .wall-selector-row select[style*="width:130px"],
            .wall-selector-row select[style*="width: 130px"] {
                width: min(130px, 100%) !important; min-width: 0; flex: 1 1 110px;
            }
            /* オイルダンパC単位select (150px) */
            .wall-selector-row select[style*="width:150px"],
            .wall-selector-row select[style*="width: 150px"] {
                width: min(150px, 100%) !important; min-width: 0; flex: 1 1 120px;
            }
            /* 履歴型ダンパ壁種別 (180px) */
            .wall-selector-row select[style*="width:180px"],
            .wall-selector-row select[style*="width: 180px"] {
                width: min(180px, 100%) !important; min-width: 0; flex: 1 1 140px;
            }
            /* オイルダンパモデルselect (100px) */
            .wall-selector-row select[style*="width:100px"],
            .wall-selector-row select[style*="width: 100px"] {
                width: min(100px, 100%) !important; min-width: 0; flex: 1 1 90px;
            }
            /* ダンパ数値入力 (55px/56px/46px) — 最小幅確保 */
            .wall-selector-row input[style*="width:55px"],
            .wall-selector-row input[style*="width: 55px"],
            .wall-selector-row input[style*="width:56px"],
            .wall-selector-row input[style*="width: 56px"],
            .wall-selector-row input[style*="width:46px"],
            .wall-selector-row input[style*="width: 46px"] {
                width: 52px !important; min-width: 44px; flex: 0 1 52px;
            }
            /* ダンパ距離入力 (92px) */
            .wall-selector-row input[style*="width:92px"],
            .wall-selector-row input[style*="width: 92px"] {
                width: min(92px, calc(50% - 8px)) !important; flex: 1 1 70px; min-width: 60px;
            }

            /* ダンパモーダル C単位select (140px) — モーダル内 */
            #pl-damper-modal select[style*="width:140px"],
            #pl-damper-modal select[style*="width: 140px"] {
                width: 100% !important; max-width: none !important;
            }

            /* 自由入力行 — free-qty inputs */
            input[id^="free-qty-"] {
                width: 50px !important; min-width: 44px; flex: 0 0 auto;
            }
        }

        /* ================================================================
           レスポンシブ対応 — スマホ (≤600px)
           ================================================================ */
        @media (max-width: 600px) {
            body { padding: 4px; }
            .container { padding: 6px; border-radius: 0; }
            h1 { font-size: 1em; padding-bottom: 4px; }
            h2 { font-size: 0.95em; padding: 4px 8px; }

            /* タブ — コンパクト */
            .tab-link { padding: 6px 10px; font-size: 0.78em; }

            /* ボタン — タッチターゲット拡大 */
            .btn-sm { padding: 6px 12px; min-height: 36px; font-size: 0.88em; display: inline-flex; align-items: center; justify-content: center; }
            .btn-calc { width: auto; min-width: 140px; max-width: 90%; padding: 10px 16px; font-size: 1em; }
            .btn-sheet { padding: 6px 12px; min-height: 36px; }

            /* 入力フィールド — タッチ対応 & iOS自動ズーム防止 */
            .input-group input, .input-group select { padding: 8px 4px; min-height: 36px; font-size: 16px; }
            select, input[type="number"], input[type="text"] { font-size: 16px; }

            /* 結果パネル圧縮 */
            .result-panel { padding: 6px; }
            .chart-wrapper { height: 280px; }

            /* プランエディタ — サイドパネル非表示 */
            .plan-side { display: none; }
            .plan-bar-row { gap: 3px; }
            .plan-btn { padding: 4px 6px; font-size: 11px; min-width: 28px; }

            /* ローディングポップアップ */
            .loading-popup { padding: 24px 20px; }

            /* データ入出力バー — 縦積み */
            #data-io-bar { flex-direction: column; align-items: stretch; }
            #data-io-bar > span { text-align: center; }
            #data-io-bar button { width: 100%; text-align: center; }

            /* プランエディタ body レイアウト → 縦積み */
            .plan-body { flex-direction: column; }
            .plan-right { height: auto; border-left: none; border-top: 1px solid var(--c-bd); }
            .plan-vsplit { display: none; }

            /* 層間変形グラフ — 小さくする */
            #th3d-drift-panel, .th3d-drift-panel-sub { width: 240px; height: 80px; }

            /* 壁量計算テーブル横スクロール */
            .wc-table, .wq-summary-table, .data-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }

            /* =====================================================
               壁セレクター — スマホ用コンパクト化
               ===================================================== */
            .wall-selector { padding: 4px; overflow: hidden; }
            .wall-selector-row { gap: 3px 4px; }

            /* 固定幅select → 全幅(折り返し後に1行使う) */
            .wall-selector-row select[style*="width:160px"],
            .wall-selector-row select[style*="width: 160px"],
            .wall-selector-row select[style*="width:140px"],
            .wall-selector-row select[style*="width: 140px"] {
                width: 100% !important; max-width: none !important; flex: 1 1 100%;
            }
            /* 固定幅input名称欄 → 縮小可能に */
            .wall-selector-row input[style*="width:110px"],
            .wall-selector-row input[style*="width: 110px"] {
                width: 80px !important; flex: 1 1 70px; min-width: 50px;
            }
            /* 固定幅input(80px等)→ 縮小可能 */
            .wall-selector-row input[style*="width:80px"],
            .wall-selector-row input[style*="width: 80px"] {
                width: 60px !important; flex: 0 1 60px; min-width: 40px;
            }
            .wall-selector-row input[style*="width:70px"],
            .wall-selector-row input[style*="width: 70px"] {
                width: 55px !important; flex: 0 1 55px; min-width: 40px;
            }
            /* 壁セレクター内select — 最小幅を確保しつつスマホ対応 */
            .wall-selector select { min-width: 0; font-size: 14px; }
            .wall-selector input { font-size: 14px; }
            /* メインselect(インライン幅なし: 耐力壁/筋交い/小壁/貫)→全幅化 */
            .wall-selector-row > select:not([style*="width"]) {
                flex: 1 1 100% !important; min-width: 0; width: 100% !important;
            }
            /* 柱形状select (70px)→全幅化 */
            .wall-selector-row select[style*="width:70px"],
            .wall-selector-row select[style*="width: 70px"] {
                width: 100% !important; max-width: none !important; flex: 0 1 70px; min-width: 60px;
            }
            /* 壁幅input (60px)→最小幅確保 */
            .wall-selector-row input[style*="width:60px"],
            .wall-selector-row input[style*="width: 60px"] {
                width: 55px !important; min-width: 45px; flex: 0 1 55px;
            }
            /* 箇所数/本数input (50px)→最小幅確保 */
            .wall-selector-row input[style*="width:50px"],
            .wall-selector-row input[style*="width: 50px"] {
                width: 46px !important; min-width: 40px; flex: 0 1 46px;
            }
            /* 柱幅/軸力input (70px)→縮小可能 */
            .wall-selector-row input[style*="width:70px"],
            .wall-selector-row input[style*="width: 70px"] {
                width: 60px !important; min-width: 45px; flex: 0 1 60px;
            }
            /* 柱名称input (80px)→縮小可能 */
            .wall-selector-row input[style*="width:80px"],
            .wall-selector-row input[style*="width: 80px"] {
                width: 60px !important; min-width: 45px; flex: 0 1 60px;
            }

            /* 壁セレクター > ヘッダー行（タイトル+ボタン）の折り返し */
            .wall-selector > div:first-child { 
                flex-wrap: wrap !important; gap: 3px;
            }
            .wall-selector > div:first-child .btn-sheet,
            .wall-selector > div:first-child .btn-sm {
                font-size: 0.7em !important; padding: 2px 4px !important; white-space: nowrap;
            }
            /* 壁リストのアイテム — コンパクト */
            .wall-item { font-size: 0.75em; gap: 3px; padding: 2px 4px; flex-wrap: wrap; }
            .wall-item span { min-width: 0; font-size: 0.85em; }

            /* btn-add-wall タッチターゲット */
            .btn-add-wall { padding: 6px 12px; min-height: 32px; font-size: 0.85em; }

            /* 復元力特性トップバー — 縦積み */
            .force-topbar { flex-direction: column; gap: 4px; align-items: flex-start; }
            .force-topbar label { font-size: 0.82em; }
            .force-topbar span { font-size: 0.75em; }

            /* 復元力 ボタン行 — 折り返し+コンパクト */
            #tab-force-x > div[style*="display:flex"][style*="gap:10px"],
            #tab-force-y > div[style*="display:flex"][style*="gap:10px"] {
                gap: 4px !important;
            }

            /* 結果タブ — 2カラム→縦 */
            #tab-result > div > div[style*="display:flex"][style*="gap:20px"] {
                flex-direction: column !important;
            }
            #tab-result div[style*="min-width:400px"],
            #tab-result div[style*="min-width:350px"],
            #tab-result div[style*="min-width:280px"],
            #tab-result div[style*="min-width:200px"] {
                min-width: 0 !important; width: 100%;
            }

            /* 計算書出力設定 — コンパクト */
            .print-options-section { padding: 8px; margin: 0 4px 10px !important; }
            .print-options-section label { font-size: 0.82em; white-space: nowrap; }

            /* 地震層せん断力関連の入力欄 */
            #shear-input-area .input-grid { grid-template-columns: 1fr 1fr; gap: 8px; }

            /* free-input行のコンパクト化 */
            .free-input-list + div { gap: 3px !important; }

            /* オーバーフロー防止 */
            .tab-content { overflow-x: hidden; }
            .force-column { overflow: hidden; flex: 0 0 100% !important; max-width: 100% !important; }
            .force-editor { overflow: hidden; }

            /* 時刻歴タブのinput-grid — 2列 */
            #tab-time-history .input-grid { grid-template-columns: 1fr; }

            /* 壁量計算タブのコンパクト化 */
            #tab-wallqty .hekiryo-grid { grid-template-columns: 1fr; }

            /* =====================================================
               制振ダンパ インラインフォーム — 全子spanをflex-wrap + select全幅化
               ===================================================== */
            .wall-selector-row > span[id^="d-"] {
                flex-wrap: wrap !important; width: 100%;
            }
            .wall-selector-row > span[id^="d-"] > span[id^="d-"] {
                flex-wrap: wrap !important; width: 100%;
            }
            /* ダンパ種類select全幅化 (120px/130px/150px/180px/100px/140px) */
            .wall-selector-row select[style*="width:120px"],
            .wall-selector-row select[style*="width: 120px"],
            .wall-selector-row select[style*="width:130px"],
            .wall-selector-row select[style*="width: 130px"],
            .wall-selector-row select[style*="width:150px"],
            .wall-selector-row select[style*="width: 150px"],
            .wall-selector-row select[style*="width:180px"],
            .wall-selector-row select[style*="width: 180px"],
            .wall-selector-row select[style*="width:100px"],
            .wall-selector-row select[style*="width: 100px"] {
                width: 100% !important; max-width: none !important; flex: 1 1 100%;
            }
            /* ダンパ数値入力 (55-92px) — 最小幅確保しつつ収縮可 */
            .wall-selector-row input[style*="width:55px"],
            .wall-selector-row input[style*="width: 55px"],
            .wall-selector-row input[style*="width:56px"],
            .wall-selector-row input[style*="width: 56px"] {
                width: 50px !important; min-width: 42px; flex: 0 1 50px;
            }
            .wall-selector-row input[style*="width:46px"],
            .wall-selector-row input[style*="width: 46px"] {
                width: 46px !important; min-width: 40px; flex: 0 1 46px;
            }
            .wall-selector-row input[style*="width:92px"],
            .wall-selector-row input[style*="width: 92px"] {
                width: 80px !important; min-width: 60px; flex: 1 1 70px;
            }

            /* ダンパ設置方法select (160px) — 600pxでは全幅 */
            .wall-selector-row select[style*="width:160px"],
            .wall-selector-row select[style*="width: 160px"] {
                width: 100% !important; max-width: none !important; flex: 1 1 100%;
            }

            /* ダンパモーダル内 — C単位/全selectを全幅化 */
            #pl-damper-modal select[style*="width:140px"],
            #pl-damper-modal select[style*="width: 140px"] {
                width: 100% !important; max-width: none !important; flex: 1 1 100%;
            }
            #pl-damper-modal .modal-content input,
            #pl-damper-modal .modal-content select {
                min-width: 0; box-sizing: border-box;
            }

            /* 自由入力行 — 折り返し+全幅化 */
            .free-input-list + div {
                flex-wrap: wrap !important;
            }
            input[id^="free-name-"] { min-width: 60px !important; }
            input[id^="free-qty-"] { width: 50px !important; min-width: 44px; flex: 0 0 auto; }
        }

        /* ================================================================
           レスポンシブ対応 — 小型スマホ (≤480px)
           ================================================================ */
        @media (max-width: 480px) {
            /* タブ — さらにコンパクト */
            .tab-link { padding: 5px 8px; font-size: 0.72em; }

            /* pl-confirm-modal, pl-calib-modal */
            .plan-modal { max-width: calc(100vw - 16px) !important; }
            #pl-confirm-modal { width: calc(100vw - 24px) !important; }
            #pl-mudwall-modal { width: 95vw !important; max-width: 95vw !important; }

            /* ヘキロウグリッド */
            .hekiryo-grid { grid-template-columns: 1fr; }
            .input-grid { grid-template-columns: 1fr; }

            /* 壁量テーブルスクロール */
            .wc-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
            .wq-summary-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }

            /* snap/mudwall/gridwall モーダル内のグリッド→1列 */
            #pl-snap-modal > div[style*="display:grid"] { grid-template-columns: 1fr !important; }
            #pl-mudwall-modal > div[style*="display:grid"] { grid-template-columns: 1fr !important; }

            /* 壁セレクター — 全入力を縮小 */
            .wall-selector-row input[style*="width:50px"],
            .wall-selector-row input[style*="width: 50px"] {
                width: 40px !important; min-width: 36px;
            }
            .wall-selector-row input[style*="width:60px"],
            .wall-selector-row input[style*="width: 60px"] {
                width: 48px !important; min-width: 40px;
            }
            .wall-selector-row span { font-size: 0.65em !important; }

            /* 壁セレクターの全select → 全幅 */
            .wall-selector select { width: 100% !important; max-width: 100% !important; }

            /* force-header内のボタンを100%幅 */
            .force-header .btn-sm { font-size: 0.7em; padding: 4px 8px; }

            /* 地震層せん断力入力 — 1列 */
            #shear-input-area .input-grid { grid-template-columns: 1fr; }

            /* 柱セレクターにおけるselectの固定幅解除 */
            .wall-selector-row select[style*="width:70px"],
            .wall-selector-row select[style*="width: 70px"] {
                width: 60px !important; flex: 0 1 60px; min-width: 50px;
            }

            /* データ入出力バー — 縦積み */
            #tab-input > div:first-child { flex-direction: column !important; align-items: stretch !important; }
            #tab-input > div:first-child button { width: 100%; }
            #tab-input > div:first-child span { text-align: center; }

            /* =====================================================
               制振ダンパ インラインフォーム — 超小型端末の全幅化
               ===================================================== */
            .wall-selector-row > span[id^="d-"] {
                flex-wrap: wrap !important; width: 100%;
            }
            .wall-selector-row > span[id^="d-"] > span[id^="d-"] {
                flex-wrap: wrap !important; width: 100%;
            }
            /* 全ダンパselect → 全幅 */
            .wall-selector-row select[style*="width:120px"],
            .wall-selector-row select[style*="width: 120px"],
            .wall-selector-row select[style*="width:130px"],
            .wall-selector-row select[style*="width: 130px"],
            .wall-selector-row select[style*="width:150px"],
            .wall-selector-row select[style*="width: 150px"],
            .wall-selector-row select[style*="width:180px"],
            .wall-selector-row select[style*="width: 180px"],
            .wall-selector-row select[style*="width:100px"],
            .wall-selector-row select[style*="width: 100px"],
            .wall-selector-row select[style*="width:140px"],
            .wall-selector-row select[style*="width: 140px"] {
                width: 100% !important; max-width: 100% !important; flex: 1 1 100%;
            }
            /* ダンパ数値入力 (46-92px) — 最小確保 */
            .wall-selector-row input[style*="width:46px"],
            .wall-selector-row input[style*="width: 46px"] {
                width: 42px !important; min-width: 38px;
            }
            .wall-selector-row input[style*="width:55px"],
            .wall-selector-row input[style*="width: 55px"],
            .wall-selector-row input[style*="width:56px"],
            .wall-selector-row input[style*="width: 56px"] {
                width: 46px !important; min-width: 40px;
            }
            .wall-selector-row input[style*="width:92px"],
            .wall-selector-row input[style*="width: 92px"] {
                width: 70px !important; min-width: 56px; flex: 1 1 60px;
            }
        }

        /* Accessibility: focus-visible */
        :focus-visible {
            outline: 2px solid var(--primary);
            outline-offset: 2px;
        }
        button:focus-visible, .tab-link:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
            outline: 2px solid var(--primary);
            outline-offset: 2px;
        }

        /* Accessibility: prefers-reduced-motion */
        @media (prefers-reduced-motion: reduce) {
            *, *::before, *::after {
                animation-duration: 0.01ms !important;
                animation-iteration-count: 1 !important;
                transition-duration: 0.01ms !important;
            }
        }

/* 面格子壁 詳細設定: 数式コンテナ内のMathJax SVGサイズを抑制 */
#gridwall-formula-container .MathJax_SVG_Display {
    font-size: 0.85em;
    margin: 4px 0;
}
#gridwall-formula-container .MathJax_SVG {
    font-size: 0.9em;
}
