:root {
    /* ホワイト基調 × ネイビーアクセント（解析レポートと統一したBtoB向け配色） */
    --navy: #1c223a;
    --bg-color: #f4f6fa;
    --bg-gradient: linear-gradient(180deg, #f4f6fa 0%, #eef2f7 100%);
    --bg: #f4f6fa;
    --bg-dark: #f4f6fa;
    --card-bg: #ffffff;
    --bg-card: #ffffff;
    --header-bg: #1c223a;
    --accent: #0369a1;
    --accent-gradient: linear-gradient(135deg, #1c223a 0%, #2c3e70 100%);
    --primary-gradient: linear-gradient(135deg, #1c223a 0%, #2c3e70 100%);
    --accent-hover: #1c223a;
    --text-main: #111111;
    --text: #111111;
    --text-light: #111111;
    --text-muted: #4b5563;
    --success: #16a34a;
    --line: #e5e7eb;
    --border: #d1d5db;
    --border-highlight: #cbd5e1;
    --glass-bg: #ffffff;
    --glass-border: #d1d5db;
    --glass-shadow: 0 6px 24px -8px rgba(15, 23, 42, 0.18);
    --shadow-xl: 0 12px 32px rgba(15, 23, 42, 0.15);
    --layered-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Inter', 'Noto Sans JP', sans-serif;
    background: var(--bg-color);
    background-image: var(--bg-gradient);
    background-attachment: fixed;
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

/* フェードインアニメーション */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 解析レポートを大きく表示できるよう横幅を拡張 */
.container {
    max-width: 1240px;
    margin: 0 auto;
    padding: 20px;
    animation: fadeInUp 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ネイビーのヘッダーバー（ロゴ・ナビ） */
header {
    text-align: center;
    margin-bottom: 32px;
    padding: 18px 20px 20px;
    background: var(--navy);
    color: #ffffff;
    border-radius: 18px;
    box-shadow: 0 8px 24px rgba(28, 34, 58, 0.25);
}

header img {
    border-radius: 12px;
}

header span {
    color: #ffffff;
}

header a[style*="var(--text-muted)"] {
    color: #cbd5e1 !important;
}

header a[style*="var(--accent)"] {
    color: #7dd3fc !important;
    border-color: #7dd3fc !important;
}

header a[style*="#ffcc00"] {
    color: #fcd34d !important;
    border-color: #fcd34d !important;
}

header span[style*="var(--success)"] {
    color: #4ade80 !important;
}

header h1,
header h2,
header p {
    color: #ffffff !important;
}

.logo {
    font-weight: 700;
    letter-spacing: 2px;
    color: #ffffff;
    font-size: 14px;
    margin-bottom: 8px;
    text-transform: uppercase;
}

h1 {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 5px;
}

.subtitle {
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
}

/* 白カード */
.card {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 32px;
    border: 1px solid var(--border);
    box-shadow: var(--glass-shadow), var(--layered-shadow);
    margin-bottom: 28px;
    position: relative;
    overflow: hidden;
    color: var(--text-main);
}

/* 汎用パネル */
.glass-panel {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
    position: relative;
    overflow: hidden;
    color: var(--text-main);
}

.view-selector {
    display: flex;
    background: #eef2f7;
    padding: 6px;
    border-radius: 14px;
    margin-bottom: 24px;
    border: 1px solid var(--border);
}

.view-btn {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--text-muted);
    padding: 12px;
    font-size: 15px;
    font-weight: 800;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.view-btn.active {
    background: var(--navy);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(28, 34, 58, 0.25);
}

.preview-area {
    width: 100%;
    min-height: 280px;
    background: #f8fafc;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
    border: 2px dashed #cbd5e1;
    overflow: hidden;
    position: relative;
    transition: border-color 0.3s;
    color: var(--text-muted);
}

.preview-area:hover {
    border-color: var(--navy);
}

.preview-area img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.default-msg {
    text-align: center;
    color: var(--text-muted);
    font-weight: 700;
}

.default-msg .icon {
    font-size: 48px;
    display: block;
    margin-bottom: 12px;
    opacity: 0.6;
}

.actions {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

button {
    cursor: pointer;
    font-weight: 700;
    font-family: inherit;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
}

.primary-btn {
    background: #ffffff;
    border: 2px solid var(--border);
    color: #111111;
    padding: 16px;
    border-radius: 14px;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}

.primary-btn:hover {
    background: #f1f5f9;
    border-color: var(--navy);
    transform: translateY(-1px);
}

.analyze-btn {
    background: var(--accent-gradient);
    border: none;
    color: #ffffff;
    padding: 20px;
    border-radius: 14px;
    font-size: 18px;
    font-weight: 900;
    box-shadow: 0 8px 20px rgba(28, 34, 58, 0.3);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
}

.analyze-btn:disabled {
    background: #e5e7eb;
    color: #9ca3af;
    box-shadow: none;
    cursor: not-allowed;
}

.analyze-btn:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(28, 34, 58, 0.4);
}

.analyze-btn:not(:disabled):active {
    transform: translateY(0) scale(0.99);
}

/* Comparison Layout */
.comparison-container {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
}

.comp-card {
    flex: 1;
    min-width: 0;
    padding: 16px !important;
    background: #ffffff;
    border-radius: 16px;
    border: 1px solid var(--border);
}

.comp-label {
    font-size: 13px;
    font-weight: 900;
    color: var(--navy);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.preview-area.small {
    height: 180px !important;
    min-height: 180px !important;
}

#resultImage {
    width: 100%;
    height: auto;
    display: block;
    image-rendering: -webkit-optimize-contrast;
}

/* Loading Overlay */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.94);
    color: #111111;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(8px);
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid #e5e7eb;
    border-top: 4px solid var(--navy);
    border-radius: 50%;
    animation: spin 1s cubic-bezier(0.5, 0.1, 0.4, 0.9) infinite;
    margin: 0 auto 24px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Result Section（解析レポート画像を横幅いっぱいに表示） */
.result-section {
    padding: 28px;
}

.report-wrapper {
    background: #ffffff;
    border-radius: 14px;
    border: none;
    margin-bottom: 30px;
}

.report-wrapper img {
    width: 100%;
    max-width: 100%;
    height: auto;
    display: block;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    box-shadow: 0 6px 20px rgba(15, 23, 42, 0.1);
}

.secondary-btn {
    background: var(--success);
    color: #ffffff;
    text-align: center;
    padding: 18px;
    border-radius: 14px;
    text-decoration: none;
    font-weight: 900;
    font-size: 16px;
    box-shadow: 0 8px 18px rgba(22, 163, 74, 0.25);
    transition: all 0.3s;
}

.secondary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(22, 163, 74, 0.35);
}

/* ログイン画面専用調整 */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 80vh;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 800;
    color: #374151;
    margin-bottom: 8px;
    margin-left: 4px;
}

.form-control {
    width: 100%;
    background: #ffffff !important;
    border: 2px solid #cbd5e1;
    box-shadow: none;
    padding: 14px 18px;
    border-radius: 12px;
    color: #111111 !important;
    font-family: inherit;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.2s;
}

.form-control::placeholder {
    color: #9ca3af;
}

.form-control:focus {
    outline: none;
    border-color: var(--navy) !important;
    box-shadow: 0 0 0 4px rgba(28, 34, 58, 0.12);
}

select.form-control option {
    color: #111111;
    background: #ffffff;
}

/* Footer */
footer {
    opacity: 0.85;
    transition: opacity 0.3s;
    color: var(--text-muted);
}

footer:hover {
    opacity: 1;
}

/* Responsive Mobile */
@media (max-width: 480px) {
    .container {
        padding: 12px;
    }

    .card {
        padding: 20px 16px;
        border-radius: 18px;
    }

    h1 {
        font-size: 24px;
    }

    .result-section {
        padding: 14px;
    }
}

/* 印刷用最適化（Phase 21） */
@media print {
    body {
        background: white !important;
        color: black !important;
    }

    .container {
        max-width: none !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    header,
    .view-selector,
    .view-btn,
    .actions,
    footer,
    .guide-control,
    #singleModeArea .actions,
    .secondary-btn,
    .comparison-slider .slider-input,
    .slider-handle::after,
    #downloadBtn,
    .primary-btn,
    .analyze-btn {
        display: none !important;
    }

    .card {
        background: none !important;
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
    }

    .result-section {
        display: block !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    .report-wrapper {
        border: none !important;
        box-shadow: none !important;
        margin: 0 !important;
    }

    #resultImage {
        width: 100% !important;
        max-height: 250mm;
        object-fit: contain;
    }

    .result-card {
        page-break-inside: avoid;
        border-left: 3px solid #000 !important;
    }

    .container::before {
        content: "シセビズ ｜ AI 姿勢解析診断書";
        display: block;
        text-align: center;
        font-size: 24px;
        font-weight: bold;
        margin-bottom: 20px;
    }
}

/* 比較スライダー（Phase 20） */
.comparison-slider {
    position: relative;
    width: 100%;
    margin-bottom: 20px;
    border-radius: 14px;
    overflow: hidden;
    user-select: none;
    box-shadow: 0 6px 20px rgba(15, 23, 42, 0.12);
    background: #ffffff;
}

.comparison-slider .after-img {
    display: block;
    width: 100%;
    height: auto;
}

.comparison-slider .before-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    overflow: hidden;
}

.comparison-slider .before-img img {
    height: 100% !important;
    width: auto !important;
    object-fit: cover;
    display: block;
}

.slider-handle {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 2px;
    background: var(--navy);
    z-index: 20;
}

.slider-handle::after {
    content: "↔";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 44px;
    height: 44px;
    background: var(--navy);
    color: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: bold;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.slider-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: ew-resize;
    z-index: 30;
    margin: 0;
}

.comp-badge {
    position: absolute;
    top: 15px;
    padding: 6px 12px;
    background: rgba(28, 34, 58, 0.85);
    border-radius: 8px;
    font-size: 12px;
    font-weight: 800;
    color: white;
    z-index: 25;
}

.badge-before {
    left: 15px;
    border-left: 3px solid #7dd3fc;
}

.badge-after {
    right: 15px;
    border-right: 3px solid #4ade80;
}

/* =====================================================================
   旧ダークテーマ時代のインラインスタイル（各テンプレート内 style 属性）を
   ホワイト基調でも読めるように一括補正するルール群
   ===================================================================== */

/* 白文字（自前の背景を持たない要素）→ 黒文字 */
[style*="color: white"]:not([style*="background"]),
[style*="color:white"]:not([style*="background"]),
[style*="color: #fff;"]:not([style*="background"]),
[style*="color:#fff;"]:not([style*="background"]),
[style$="color: #fff"]:not([style*="background"]),
[style$="color:#fff"]:not([style*="background"]),
[style*="color: #ffffff"]:not([style*="background"]),
[style*="color:#ffffff"]:not([style*="background"]),
[style*="color: #e0e0e0"],
[style*="color:#e0e0e0"],
[style*="color: #e8e6f0"],
[style*="color: #ddd"],
[style*="color:#ddd"] {
    color: #111111 !important;
}

/* 半透明白文字・薄いグレー文字 → 読みやすいグレー */
[style*="color: rgba(255,255,255"],
[style*="color:rgba(255,255,255"],
[style*="color: rgba(255, 255, 255"],
[style*="color: #ccc"],
[style*="color:#ccc"],
[style*="color: #aaa"],
[style*="color:#aaa"],
[style*="color: #bbb"],
[style*="color: #999"],
[style*="color: #888"] {
    color: #4b5563 !important;
}

/* ネオン系の文字色 → 白背景で読める濃色 */
[style*="color: #ffcc00"]:not([style*="background"]),
[style*="color:#ffcc00"]:not([style*="background"]),
[style*="color: #ffd700"]:not([style*="background"]),
[style*="color: #ffeb3b"]:not([style*="background"]) {
    color: #b45309 !important;
}

[style*="color: #50e3c2"]:not([style*="background"]),
[style*="color:#50e3c2"]:not([style*="background"]),
[style*="color: #00e5ff"]:not([style*="background"]),
[style*="color: #00e0ff"]:not([style*="background"]),
[style*="color:#00e0ff"]:not([style*="background"]),
[style*="color: #4fc3f7"]:not([style*="background"]),
[style*="color:#4fc3f7"]:not([style*="background"]),
[style*="color: #a78bfa"]:not([style*="background"]) {
    color: #0369a1 !important;
}

[style*="color: #00e676"]:not([style*="background"]),
[style*="color:#00e676"]:not([style*="background"]),
[style*="color: #4caf50"]:not([style*="background"]),
[style*="color:#4caf50"]:not([style*="background"]),
[style*="color: #8bc34a"]:not([style*="background"]) {
    color: #15803d !important;
}

[style*="color: #f06292"]:not([style*="background"]),
[style*="color:#f06292"]:not([style*="background"]) {
    color: #be185d !important;
}

/* 暗い背景のパネル・モーダル → 白背景 */
[style*="background: #161b2e"],
[style*="background:#161b2e"],
[style*="background: #1a2035"],
[style*="background:#1a2035"],
[style*="background: #1e253a"],
[style*="background: #141722"],
[style*="background: #1a1a2e"],
[style*="background:#1a1a2e"],
[style*="background: #0d1117"],
[style*="background: #111827"],
[style*="background: #1f2937"],
[style*="background: rgba(22, 26, 43"],
[style*="background: rgba(22,26,43"],
[style*="background: rgba(15, 18, 30"],
[style*="background: rgba(10, 14, 26"],
[style*="background: rgba(8, 10, 18"],
[style*="background: rgba(6, 10, 20"],
[style*="background:rgba(6,10,20"] {
    background: #ffffff !important;
    color: #111111 !important;
    border-color: #d1d5db !important;
}

/* 透明に近い白背景 → 薄いグレー面 */
[style*="background: rgba(255,255,255,0.0"],
[style*="background:rgba(255,255,255,0.0"],
[style*="background: rgba(255, 255, 255, 0.0"],
[style*="background: rgba(255,255,255,0.1"],
[style*="background: rgba(255, 255, 255, 0.1"],
[style*="background: rgba(0,0,0,0.2"],
[style*="background: rgba(0,0,0,0.3"],
[style*="background: rgba(0,0,0,0.4"],
[style*="background: rgba(0,0,0,0.5"],
[style*="background: rgba(0,0,0,0.6"],
[style*="background: rgba(0, 0, 0, 0.2"],
[style*="background: rgba(0, 0, 0, 0.3"],
[style*="background: rgba(0, 0, 0, 0.4"],
[style*="background: rgba(0, 0, 0, 0.5"],
[style*="background: rgba(0, 0, 0, 0.6"],
[style*="background:rgba(0,0,0,0.5"] {
    background: #f8fafc !important;
}

/* カメラ撮影画面・3D比較コントロールなど、意図的に暗い面の上の文字は白のまま維持 */
#cameraModal p,
#cameraModal span,
#cameraModal button,
#cameraModal div,
#modelControls span,
#aiLoader *,
.overlay-dark * {
    color: #ffffff !important;
}

/* 半透明白の枠線・区切り線 → 薄いグレー線 */
[style*="solid rgba(255,255,255"],
[style*="solid rgba(255, 255, 255"],
[style*="dashed rgba(255,255,255"],
[style*="dashed rgba(255, 255, 255"] {
    border-color: #e2e8f0 !important;
}

/* 内側シャドウ（凹み表現）は白背景では汚れに見えるため除去 */
[style*="box-shadow: inset 0 2px 10px rgba(0,0,0"],
[style*="box-shadow:inset 0 2px 10px rgba(0,0,0"] {
    box-shadow: none !important;
}

/* テーブル */
table th {
    color: #111111;
}

table td {
    color: #1f2937;
}