/* =====================================================
   wizard_v3.css — ViralForge v3 新規プラン追加ウィザード

   設計原則:
   - 全セレクタを #wizardV3Modal 配下にネスト
   - CSS変数は --wv3- プレフィックス
   - クラスは wv3- プレフィックス
   - 既存 index.html の .btn / .toggle 等とは完全分離
   ===================================================== */

#wizardV3Modal {
    --wv3-blue-dark: #1a3a6c;
    --wv3-blue-mid: #2e6db4;
    --wv3-blue-light: #4a9fd4;
    --wv3-blue-pale: #d6e4f7;
    --wv3-blue-bg: #f0f5fc;
    --wv3-white: #ffffff;
    --wv3-gray-dark: #1a1a2e;
    --wv3-gray: #4a4a6a;
    --wv3-gray-light: #8899aa;
    --wv3-border: #dce6f5;
    --wv3-success: #27ae60;
    --wv3-danger: #e74c3c;
    --wv3-warning: #f39c12;
    --wv3-purple: #7c3aed;
}

/* オーバーレイ */
#wizardV3Modal {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Hiragino Sans', sans-serif;
    color: var(--wv3-gray-dark);
    line-height: 1.6;
    align-items: center;
    justify-content: center;
}
#wizardV3Modal.wv3-active {
    display: flex;
}

#wizardV3Modal *,
#wizardV3Modal *::before,
#wizardV3Modal *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* v2 のスケジュールグリッドを wv3 内に埋め込む際の CSS リセット解除
   (.schedule-grid / .cell-time 等は index.html の既存スタイルが効く前提) */
#wizardV3Modal #wv3GridContainer,
#wizardV3Modal #wv3GridContainer * {
    margin: revert;
    padding: revert;
    box-sizing: revert;
}
#wizardV3Modal #wv3GridContainer table { width: 100%; }

#wizardV3Modal .wv3-wizard {
    background: var(--wv3-white);
    border-radius: 16px;
    width: 780px;
    max-width: 92vw;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

#wizardV3Modal .wv3-wizard-header {
    padding: 20px 28px;
    border-bottom: 1px solid var(--wv3-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
#wizardV3Modal .wv3-wizard-header h1 {
    font-size: 18px;
    font-weight: 700;
}
#wizardV3Modal .wv3-wizard-close {
    width: 32px;
    height: 32px;
    border: none;
    background: #f0f0f0;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

#wizardV3Modal .wv3-wizard-steps {
    display: flex;
    padding: 0 28px;
    border-bottom: 1px solid var(--wv3-border);
    background: #fafbfd;
}
#wizardV3Modal .wv3-wiz-step {
    flex: 1;
    padding: 14px 8px;
    text-align: center;
    font-size: 13px;
    font-weight: 500;
    color: var(--wv3-gray-light);
    position: relative;
    cursor: pointer;
    transition: color 0.2s;
}
#wizardV3Modal .wv3-wiz-step.wv3-active {
    color: var(--wv3-blue-dark);
    font-weight: 700;
}
#wizardV3Modal .wv3-wiz-step.wv3-active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 10%;
    right: 10%;
    height: 3px;
    background: var(--wv3-blue-mid);
    border-radius: 3px 3px 0 0;
}
#wizardV3Modal .wv3-wiz-step.wv3-done {
    color: var(--wv3-success);
}
#wizardV3Modal .wv3-wiz-step .wv3-sn {
    display: inline-flex;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    margin-right: 4px;
    background: #e8e8e8;
    color: var(--wv3-gray-light);
}
#wizardV3Modal .wv3-wiz-step.wv3-active .wv3-sn {
    background: var(--wv3-blue-mid);
    color: #fff;
}
#wizardV3Modal .wv3-wiz-step.wv3-done .wv3-sn {
    background: var(--wv3-success);
    color: #fff;
}

#wizardV3Modal .wv3-wizard-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px 28px;
    /* 2026-05-17 fix/new-user-onboarding: step header の help popover が absolute で
       wizard-body 内に anchor するので relative 化 */
    position: relative;
}

#wizardV3Modal .wv3-wizard-footer {
    padding: 16px 28px;
    border-top: 1px solid var(--wv3-border);
    display: flex;
    justify-content: space-between;
    background: #fafbfd;
    border-radius: 0 0 16px 16px;
}

#wizardV3Modal .wv3-btn {
    /* Wave A hotfix v2 commit 16 (S-6): submit/next/back button の min-width + height +
       font-weight 統一。 旧 padding 10px 24px は維持しつつ最低 120x44 を保証する。 */
    padding: 10px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
    min-width: 120px;
    height: 44px;
}
#wizardV3Modal .wv3-btn:hover { opacity: 0.9; }
#wizardV3Modal .wv3-btn-primary { background: var(--wv3-blue-mid); color: #fff; }
#wizardV3Modal .wv3-btn-success { background: var(--wv3-success); color: #fff; }
#wizardV3Modal .wv3-btn-outline { background: none; border: 1px solid var(--wv3-border); color: var(--wv3-gray); }
/* Wave A-2-β Phase 6.5 hot-patch (CRITICAL-A): wv3-btn-warning 未定義 fix。
   Step 5 「自由入力の内容で再生成」 主 CTA が browser default 灰色で render される
   問題を mock の orange 警告色 で polish。 success/outline と同 system。 */
#wizardV3Modal .wv3-btn-warning {
    background: var(--wv3-warning);
    color: #fff;
    border: 1px solid var(--wv3-warning);
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
#wizardV3Modal .wv3-btn-warning:hover {
    background: #d97706;
}
#wizardV3Modal .wv3-btn-warning:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Wave A hotfix v2 commit 16 (S-6): step indicator dot 間の connector line。
   既存 .wv3-wiz-step dot には touch しない。 連続する dot の間に 1 line を引く。 */
#wizardV3Modal .wv3-step-connector {
    flex: 0 0 auto;
    height: 1px;
    background: var(--wv3-border);
    align-self: center;
    min-width: 16px;
    margin: 0 4px;
    opacity: 0.7;
}

#wizardV3Modal .wv3-step-panel { display: none; }
#wizardV3Modal .wv3-step-panel.wv3-active { display: block; }

#wizardV3Modal .wv3-form-group { margin-bottom: 20px; }
#wizardV3Modal .wv3-form-group > label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--wv3-gray);
    margin-bottom: 6px;
}
#wizardV3Modal .wv3-form-group .wv3-hint {
    font-size: 12px;
    color: var(--wv3-gray-light);
    margin-top: 4px;
}
#wizardV3Modal .wv3-req::after { content: ' *'; color: var(--wv3-danger); }

#wizardV3Modal input[type="text"],
#wizardV3Modal input[type="time"],
#wizardV3Modal textarea,
#wizardV3Modal select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--wv3-border);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
    background: #fff;
    color: var(--wv3-gray-dark);
}
#wizardV3Modal input:focus,
#wizardV3Modal textarea:focus,
#wizardV3Modal select:focus {
    outline: none;
    border-color: var(--wv3-blue-mid);
}
#wizardV3Modal textarea { resize: vertical; min-height: 80px; }

/* PR E: モバイルで 16px 強制できる class (inline font-size 13px の代替) */
#wizardV3Modal .wv3-small-text {
    font-size: 13px;
}

#wizardV3Modal .wv3-schedule-grid { border-collapse: collapse; width: 100%; margin-top: 8px; }
#wizardV3Modal .wv3-schedule-grid th {
    padding: 8px 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--wv3-gray-light);
    text-align: center;
    background: #fafbfd;
}
#wizardV3Modal .wv3-schedule-grid td { padding: 4px; text-align: center; }
#wizardV3Modal .wv3-schedule-grid .wv3-sns-label {
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    padding-left: 8px;
    white-space: nowrap;
    cursor: pointer;
}
#wizardV3Modal .wv3-grid-cell {
    width: 100%;
    height: 36px;
    border: 2px solid #e8e8e8;
    border-radius: 6px;
    background: #fafafa;
    cursor: pointer;
    font-size: 11px;
    color: var(--wv3-gray-light);
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}
#wizardV3Modal .wv3-grid-cell:hover { border-color: var(--wv3-blue-light); }
#wizardV3Modal .wv3-grid-cell.wv3-on {
    border-color: var(--wv3-blue-mid);
    background: var(--wv3-blue-pale);
    color: var(--wv3-blue-dark);
    font-weight: 600;
}
#wizardV3Modal .wv3-sns-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
}

#wizardV3Modal .wv3-segment {
    display: inline-flex;
    border: 1px solid var(--wv3-border);
    border-radius: 8px;
    overflow: hidden;
    background: #f5f7fa;
}
#wizardV3Modal .wv3-seg-btn {
    padding: 8px 16px;
    border: none;
    background: none;
    font-size: 13px;
    cursor: pointer;
    color: var(--wv3-gray);
    transition: all 0.2s;
    font-weight: 500;
}
#wizardV3Modal .wv3-seg-btn.wv3-active { background: var(--wv3-blue-mid); color: #fff; }
#wizardV3Modal .wv3-seg-btn:hover:not(.wv3-active) { background: var(--wv3-blue-pale); }
#wizardV3Modal .wv3-seg-btn + .wv3-seg-btn { border-left: 1px solid var(--wv3-border); }

#wizardV3Modal .wv3-toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}
#wizardV3Modal .wv3-toggle input { opacity: 0; width: 0; height: 0; }
#wizardV3Modal .wv3-toggle-track {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #ccc;
    border-radius: 24px;
    transition: 0.3s;
}
#wizardV3Modal .wv3-toggle-track:before {
    content: '';
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.3s;
}
#wizardV3Modal .wv3-toggle input:checked + .wv3-toggle-track { background: var(--wv3-success); }
#wizardV3Modal .wv3-toggle input:checked + .wv3-toggle-track:before { transform: translateX(20px); }

#wizardV3Modal .wv3-num-picker {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--wv3-border);
    border-radius: 8px;
    overflow: hidden;
}
#wizardV3Modal .wv3-num-picker button {
    width: 34px;
    height: 34px;
    border: none;
    background: #f5f7fa;
    cursor: pointer;
    font-size: 16px;
    color: var(--wv3-gray);
}
#wizardV3Modal .wv3-num-picker button:hover { background: var(--wv3-blue-pale); }
#wizardV3Modal .wv3-num-picker .wv3-val {
    width: 40px;
    text-align: center;
    font-size: 15px;
    font-weight: 700;
    border-left: 1px solid var(--wv3-border);
    border-right: 1px solid var(--wv3-border);
    line-height: 34px;
}

#wizardV3Modal .wv3-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--wv3-border);
}
#wizardV3Modal .wv3-section-title { font-size: 15px; font-weight: 700; color: var(--wv3-gray-dark); }
#wizardV3Modal .wv3-section-sub { font-size: 12px; color: var(--wv3-gray-light); }

#wizardV3Modal .wv3-info-box {
    padding: 10px 14px;
    background: #f8f9fb;
    border-radius: 8px;
    border-left: 3px solid var(--wv3-blue-mid);
    font-size: 12px;
    color: var(--wv3-gray);
    line-height: 1.6;
    margin-bottom: 16px;
}
#wizardV3Modal .wv3-info-box.wv3-info-purple { border-left-color: var(--wv3-purple); }
#wizardV3Modal .wv3-info-box.wv3-info-success { border-left-color: var(--wv3-success); }

#wizardV3Modal .wv3-cost-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: linear-gradient(135deg, #f0f7ff, #e8f0fe);
    border-radius: 8px;
    border: 1px solid var(--wv3-blue-pale);
    font-size: 13px;
    margin-top: 8px;
}
#wizardV3Modal .wv3-cost-bar.wv3-cost-total {
    background: linear-gradient(135deg, #e8f5e9, #f0f7ff);
    border-color: #c8e6c9;
    margin-top: 16px;
}
#wizardV3Modal .wv3-cost-val { font-weight: 700; color: var(--wv3-blue-dark); }

#wizardV3Modal .wv3-pool-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: #f8f9fb;
    border-radius: 8px;
    border: 1px solid #eef1f6;
    margin-bottom: 6px;
    flex-wrap: wrap;
}
#wizardV3Modal .wv3-pool-item .wv3-name {
    flex: 1;
    font-size: 13px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
#wizardV3Modal .wv3-pool-empty {
    padding: 16px;
    text-align: center;
    color: var(--wv3-gray-light);
    font-size: 13px;
    background: #fafbfd;
    border-radius: 8px;
    border: 1px dashed var(--wv3-border);
}

#wizardV3Modal .wv3-sns-card {
    border: 1px solid var(--wv3-border);
    border-radius: 10px;
    padding: 14px 18px;
    margin-bottom: 10px;
}
#wizardV3Modal .wv3-sns-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
}
/* PR-B-8: SNS Simple Icons SVG (14x14) を badge 内に表示 */
#wizardV3Modal .wv3-sns-badge img {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    display: inline-block;
}

#wizardV3Modal .wv3-cred-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border: 1px solid var(--wv3-border);
    border-radius: 8px;
    margin-bottom: 8px;
}
#wizardV3Modal .wv3-cred-ok { color: var(--wv3-success); font-size: 12px; font-weight: 600; }
#wizardV3Modal .wv3-cred-warn { color: var(--wv3-warning); font-size: 12px; font-weight: 600; }

#wizardV3Modal .wv3-overlay-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: #f8f9fb;
    border-radius: 10px;
    margin-bottom: 10px;
    border: 1px solid #dfe4ec;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
    flex-wrap: wrap;
}
#wizardV3Modal .wv3-overlay-row:hover {
    background: #f1f4f9;
    border-color: #c9d3e1;
}
/* 追加指示 accordion の余白統一 */
#wizardV3Modal .wv3-overlay-row details {
    width: 100%;
}
#wizardV3Modal .wv3-overlay-row details > summary {
    padding: 4px 0;
}

/* ===== Responsive (max-width: 600px) ===== */
@media (max-width: 600px) {
    #wizardV3Modal { align-items: flex-start; padding: 0; }
    #wizardV3Modal .wv3-wizard { width: 100%; max-width: 100%; max-height: 100vh; border-radius: 0; }
    #wizardV3Modal .wv3-wizard-header { padding: 14px 16px; }
    #wizardV3Modal .wv3-wizard-header h1 { font-size: 16px; }
    #wizardV3Modal .wv3-wizard-steps {
        padding: 0 8px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    #wizardV3Modal .wv3-wiz-step {
        font-size: 11px;
        padding: 10px 4px;
        white-space: nowrap;
    }
    #wizardV3Modal .wv3-wiz-step .wv3-sn {
        width: 18px;
        height: 18px;
        font-size: 10px;
        margin-right: 2px;
    }
    #wizardV3Modal .wv3-wizard-body { padding: 16px; }
    #wizardV3Modal .wv3-wizard-footer { padding: 12px 16px; }
    #wizardV3Modal .wv3-btn { padding: 10px 16px; font-size: 13px; }

    #wizardV3Modal .wv3-schedule-grid { font-size: 10px; }
    #wizardV3Modal .wv3-schedule-grid th { padding: 6px 3px; font-size: 10px; }
    #wizardV3Modal .wv3-schedule-grid td { padding: 2px; }
    #wizardV3Modal .wv3-schedule-grid .wv3-sns-label { font-size: 11px; padding-left: 4px; }
    #wizardV3Modal .wv3-grid-cell { height: 30px; font-size: 9px; }

    #wizardV3Modal .wv3-segment { flex-wrap: wrap; }
    #wizardV3Modal .wv3-seg-btn { padding: 6px 10px; font-size: 11px; }

    #wizardV3Modal .wv3-pool-item { gap: 6px; padding: 10px; }
    #wizardV3Modal .wv3-pool-item .wv3-name { min-width: 60%; }

    #wizardV3Modal .wv3-pool-add-btn {
        width: 100% !important;
        padding: 14px !important;
        font-size: 14px !important;
        text-align: center;
        background: var(--wv3-blue-pale) !important;
        color: var(--wv3-blue-dark) !important;
        border-color: var(--wv3-blue-mid) !important;
    }

    #wizardV3Modal .wv3-overlay-row { gap: 6px; }
    #wizardV3Modal .wv3-sns-card { padding: 10px 12px; }
    #wizardV3Modal .wv3-section-header { flex-wrap: wrap; gap: 8px; }
    #wizardV3Modal .wv3-cost-bar { flex-wrap: wrap; gap: 4px; font-size: 12px; }
    #wizardV3Modal .wv3-cred-row { flex-wrap: wrap; gap: 6px; padding: 10px 12px; }
    #wizardV3Modal .wv3-num-picker button { width: 40px; height: 40px; font-size: 20px; }
    #wizardV3Modal .wv3-num-picker .wv3-val { width: 44px; line-height: 40px; font-size: 17px; }
    #wizardV3Modal .wv3-info-box { font-size: 11px; padding: 8px 10px; }
    #wizardV3Modal #wv3OrgSelect { width: 100% !important; }

    /* PR E (2026-04-22): モバイル追加対応 (両 review 指摘) */

    /* iOS Safari focus-zoom 回避: inputs は 16px 固定 */
    #wizardV3Modal input,
    #wizardV3Modal select,
    #wizardV3Modal textarea {
        font-size: 16px !important;
    }

    /* SNS × 曜日 table: 横スクロール対応のみ (sticky SNS 列は別 PR で再設計、
       wv3-grid-cell flex rule との衝突で layout 崩れたため hotfix で撤回)。
       土曜見切れ対策は wrap による overflow-x scroll で担保。 */
    #wizardV3Modal .wv3-table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* 下部 CTA を sticky で画面下に固定 + notch 安全領域対応 */
    #wizardV3Modal .wv3-wizard-footer {
        position: sticky;
        bottom: 0;
        background: var(--wv3-white, #fff);
        border-top: 1px solid var(--wv3-border, #e0e0e0);
        padding-bottom: max(12px, env(safe-area-inset-bottom));
        z-index: 5;
    }

    /* 現 step の breadcrumb (オプション、tabs 上で step 位置を示す) */
    #wizardV3Modal .wv3-wiz-step.wv3-active .wv3-step-label {
        font-weight: 700;
    }
}

/* tap target 拡大: タッチ端末のみ適用 (desktop mouse には適用しない) */
@media (pointer: coarse) and (max-width: 600px) {
    #wizardV3Modal .wv3-btn,
    #wizardV3Modal .wv3-seg-btn,
    #wizardV3Modal .wv3-wiz-step {
        min-height: 44px;
    }
    /* wv3-num-picker は既に 40x40 あるので 44 に底上げ */
    #wizardV3Modal .wv3-num-picker button {
        min-width: 44px;
        min-height: 44px;
    }
}

/* =====================================================
   2026-05-17 fix/new-user-onboarding
   - step ヘッダー (タイトル + help icon)
   - SNS 行ラベルの 連携済/未連携 badge
   - 未連携クリック時の inline message
   - help popover
   ===================================================== */

#wizardV3Modal .wv3-step-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--wv3-border);
}
#wizardV3Modal .wv3-step-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--wv3-gray-dark);
}
#wizardV3Modal .wv3-step-help-btn {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 1px solid var(--wv3-blue-mid);
    background: var(--wv3-white);
    color: var(--wv3-blue-mid);
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
}
#wizardV3Modal .wv3-step-help-btn:hover {
    background: var(--wv3-blue-pale);
}

/* SNS 行ラベル横の auth badge */
#wizardV3Modal .wv3-auth-badge {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 7px;
    border-radius: 9px;
    font-size: 10px;
    font-weight: 700;
    line-height: 1.4;
    vertical-align: middle;
}
#wizardV3Modal .wv3-auth-ok {
    background: #e1f5e8;
    color: var(--wv3-success);
    border: 1px solid var(--wv3-success);
}
#wizardV3Modal .wv3-auth-warn {
    background: #fff4e0;
    color: var(--wv3-warning);
    border: 1px solid var(--wv3-warning);
}
/* 未認証行はうっすら警告色を帯びさせる (cell click を奪うだけだとフィードバックが弱いため) */
#wizardV3Modal tr.wv3-unauth-row td.sns-name {
    background: rgba(243, 156, 18, 0.06);
}

/* 未認証 SNS をクリックした時の inline message */
#wizardV3Modal .wv3-unauth-msg {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    padding: 10px 14px;
    background: #fff4e0;
    color: #6b4f00;
    border: 1px solid var(--wv3-warning);
    border-left: 4px solid var(--wv3-warning);
    border-radius: 6px;
    font-size: 13px;
}
#wizardV3Modal .wv3-unauth-msg-icon {
    display: inline-block;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--wv3-warning);
    color: #fff;
    text-align: center;
    line-height: 20px;
    font-weight: 700;
    font-size: 13px;
    flex-shrink: 0;
}
#wizardV3Modal .wv3-unauth-msg-cta {
    margin-left: auto;
    font-size: 12px;
    padding: 4px 12px;
}

/* help popover (step header の ? ボタンから開く) */
#wizardV3Modal .wv3-help-popover {
    position: absolute;
    top: 60px;
    right: 24px;
    width: min(360px, calc(100% - 48px));
    background: var(--wv3-white);
    border: 1px solid var(--wv3-blue-mid);
    border-radius: 10px;
    padding: 14px 18px 14px 14px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
    z-index: 30;
}
#wizardV3Modal .wv3-help-popover-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--wv3-blue-dark);
    margin-bottom: 6px;
}
#wizardV3Modal .wv3-help-popover-body {
    font-size: 12px;
    line-height: 1.7;
    color: var(--wv3-gray);
}
#wizardV3Modal .wv3-help-popover-close {
    position: absolute;
    top: 4px;
    right: 6px;
    width: 22px;
    height: 22px;
    border: none;
    background: transparent;
    color: var(--wv3-gray-light);
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
}
#wizardV3Modal .wv3-help-popover-close:hover {
    color: var(--wv3-gray-dark);
}

/* ===================================================
   Wave A-2-α commit 3 (2026-05-23): Step 1 パッケージ枠確認 UI。
   mock viralforge_3stage_mock.html L220-231 の .pkg-card / .pkg-name /
   .pkg-price / .pkg-desc / .pkg-feats を wv3- prefix で scope する。
   =================================================== */
#wizardV3Modal .wv3-pkg-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}
#wizardV3Modal .wv3-pkg-card {
    background: #fff;
    border: 2px solid var(--wv3-border);
    border-radius: 10px;
    padding: 14px;
    cursor: pointer;
    transition: all 0.15s;
    position: relative;
    user-select: none;
}
#wizardV3Modal .wv3-pkg-card:hover {
    border-color: var(--wv3-blue-light);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transform: translateY(-1px);
}
#wizardV3Modal .wv3-pkg-card:focus {
    outline: 2px solid var(--wv3-blue-mid);
    outline-offset: 2px;
}
#wizardV3Modal .wv3-pkg-card.wv3-pkg-card-current {
    border-color: var(--wv3-blue-mid);
    background: #eff6ff;
}
#wizardV3Modal .wv3-pkg-card.wv3-pkg-card-selected {
    border-color: #10b981;
    background: #ecfdf5;
    box-shadow: 0 0 0 3px rgba(16,185,129,0.15);
}
#wizardV3Modal .wv3-pkg-card.wv3-pkg-card-selected.wv3-pkg-card-current {
    background: linear-gradient(135deg, #eff6ff 0%, #ecfdf5 100%);
}
#wizardV3Modal .wv3-pkg-card.wv3-pkg-card-recommended::before {
    content: "おすすめ";
    position: absolute;
    top: -10px;
    left: 12px;
    background: var(--wv3-warning);
    color: #fff;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
}
#wizardV3Modal .wv3-pkg-name {
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 6px;
    color: var(--wv3-gray-dark);
}
#wizardV3Modal .wv3-pkg-kind {
    font-size: 10px;
    font-weight: 700;
    color: var(--wv3-blue-mid);
    letter-spacing: 1px;
    margin-bottom: 4px;
    text-transform: uppercase;
}
#wizardV3Modal .wv3-pkg-desc {
    font-size: 12px;
    color: var(--wv3-gray-light);
    margin-bottom: 6px;
    line-height: 1.5;
}
#wizardV3Modal .wv3-quota-bar {
    width: 100%;
    height: 8px;
    background: var(--wv3-border);
    border-radius: 4px;
    overflow: hidden;
}
#wizardV3Modal .wv3-quota-bar > div {
    height: 100%;
    background: var(--wv3-blue-mid);
}

/* ===================================================
   Wave A-2-α commit 4 (2026-05-23): Step 2 survey-grid / opt-grid。
   mock viralforge_3stage_mock.html L167-184 を wv3- prefix で移植。
   Phase A / Phase C は inline style で管理、 Phase B の chip grid のみ
   class-based で再利用性を確保する。
   =================================================== */
#wizardV3Modal .wv3-survey-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px 28px;
}
#wizardV3Modal .wv3-survey-item {
    padding: 0;
    background: transparent;
    border: none;
}
#wizardV3Modal .wv3-survey-item-full {
    grid-column: 1 / -1;
}
#wizardV3Modal .wv3-survey-item .wv3-q-label {
    display: block;
    font-weight: 700;
    font-size: 13px;
    margin-bottom: 8px;
    color: var(--wv3-gray-dark);
}
#wizardV3Modal .wv3-opt-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}
#wizardV3Modal .wv3-opt-grid.cols4 {
    grid-template-columns: repeat(4, 1fr);
}
#wizardV3Modal .wv3-opt {
    padding: 9px 8px;
    border: 2px solid var(--wv3-border);
    border-radius: 4px;
    text-align: center;
    font-size: 12px;
    cursor: pointer;
    background: #fff;
    color: var(--wv3-gray-dark);
    transition: all 0.15s;
}
#wizardV3Modal .wv3-opt:hover {
    border-color: var(--wv3-blue-mid);
}
#wizardV3Modal .wv3-opt.selected,
#wizardV3Modal .wv3-opt.wv3-sopt-sel {
    background: #eff6ff;
    border-color: var(--wv3-blue-mid);
    color: var(--wv3-blue-mid);
    font-weight: 700;
}

/* ===================================================
   Wave A-2-α commit 5 (2026-05-23): Step 3 mock 単純化 (day-grid / mode-card)。
   mock viralforge_3stage_mock.html L189-197 を wv3- prefix で移植。
   =================================================== */
#wizardV3Modal .wv3-day-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
}
#wizardV3Modal .wv3-day {
    padding: 12px 0;
    text-align: center;
    border: 2px solid var(--wv3-border);
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: var(--wv3-gray-light);
    background: #fff;
    user-select: none;
    transition: all 0.15s;
}
#wizardV3Modal .wv3-day:hover {
    border-color: var(--wv3-blue-mid);
}
#wizardV3Modal .wv3-day.selected,
#wizardV3Modal .wv3-day.wv3-day-selected {
    border-color: var(--wv3-blue-mid);
    background: #eff6ff;
    color: var(--wv3-blue-mid);
}
#wizardV3Modal .wv3-mode-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 6px;
}
#wizardV3Modal .wv3-mode-card {
    border: 2px solid var(--wv3-border);
    border-radius: 8px;
    padding: 16px;
    cursor: pointer;
    background: #fff;
    transition: all 0.15s;
}
#wizardV3Modal .wv3-mode-card:hover {
    border-color: var(--wv3-blue-mid);
}
#wizardV3Modal .wv3-mode-card.wv3-mode-card-selected {
    border-color: var(--wv3-blue-mid);
    background: #eff6ff;
}
#wizardV3Modal .wv3-advanced-accordion {
    border: 1px solid var(--wv3-border);
    border-radius: 6px;
    padding: 0 14px;
    background: #fff;
}
#wizardV3Modal .wv3-advanced-accordion summary {
    list-style: none;
    outline: none;
}
#wizardV3Modal .wv3-advanced-accordion summary::-webkit-details-marker {
    display: none;
}
#wizardV3Modal .wv3-advanced-accordion summary::after {
    content: "▼";
    float: right;
    font-size: 10px;
    color: var(--wv3-gray-light);
}
#wizardV3Modal .wv3-advanced-accordion[open] summary::after {
    content: "▲";
}

/* ===================================================
   Wave A-2-α commit 6 (2026-05-23): data-stage scoped CSS。
   open() で /api/wizard/state から lifecycle_stage を取得し、 modal の
   dataset.stage に "1" / "2" / "3" / "loading" を set する (V4 mode のみ)。
   stage 1=free_adjustment、 2=final_adjustment、 3=production。
   mock viralforge_3stage_mock.html L247-253 を element-scope に正規化。
   =================================================== */
#wizardV3Modal[data-stage="1"] .only-s2,
#wizardV3Modal[data-stage="1"] .only-s3 { display: none !important; }
#wizardV3Modal[data-stage="2"] .only-s1,
#wizardV3Modal[data-stage="2"] .only-s3 { display: none !important; }
#wizardV3Modal[data-stage="3"] .only-s1,
#wizardV3Modal[data-stage="3"] .only-s2 { display: none !important; }
#wizardV3Modal[data-stage="1"] .hide-s1 { display: none !important; }
#wizardV3Modal[data-stage="2"] .hide-s2 { display: none !important; }
#wizardV3Modal[data-stage="3"] .hide-s3 { display: none !important; }

/* ===================================================
   Wave A-2-β commit 6 (2026-05-23): Step 4 SNS (3 default + 4 折り畳み S-1)
   mock viralforge_3stage_mock.html L720-727 から literal、 wv3- prefix scope。
   =================================================== */
#wizardV3Modal #wv3StepV4Sns table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}
#wizardV3Modal #wv3StepV4Sns table th {
    text-align: left;
    padding: 10px 8px;
    background: #f8fafc;
    color: var(--wv3-gray-light);
    font-weight: 600;
    border-bottom: 1px solid var(--wv3-border);
}
#wizardV3Modal #wv3StepV4Sns table td {
    padding: 10px 8px;
    border-bottom: 1px solid var(--wv3-border);
    vertical-align: middle;
}
#wizardV3Modal .wv3-sns-advanced details {
    border: 1px solid var(--wv3-border);
    border-radius: 6px;
    padding: 0 14px;
    background: #fff;
    margin-top: 8px;
}
#wizardV3Modal .wv3-sns-advanced details summary {
    list-style: none;
    outline: none;
    padding: 12px 0;
}
#wizardV3Modal .wv3-sns-advanced details summary::-webkit-details-marker {
    display: none;
}
#wizardV3Modal .wv3-sns-advanced details summary::after {
    content: "▼";
    float: right;
    font-size: 10px;
    color: var(--wv3-gray-light);
}
#wizardV3Modal .wv3-sns-advanced details[open] summary::after {
    content: "▲";
}

/* loading state: stage 取得中は wizard body を skeleton 化して flicker 防止 */
#wizardV3Modal[data-stage="loading"] .wv3-wizard-body {
    opacity: 0.3;
    pointer-events: none;
    position: relative;
}
#wizardV3Modal[data-stage="loading"] .wv3-wizard-body::before {
    content: "ステージ情報を読み込み中…";
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 12px;
    color: var(--wv3-gray-light);
    background: #fff;
    padding: 4px 12px;
    border-radius: 4px;
    z-index: 5;
}
