/* ===== FLOWカルテ（3カラムレイアウト）===== */

/* --- 3カラムグリッド --- */
.flow-layout { display: grid; grid-template-columns: 240px 508px minmax(180px, auto); gap: 16px; align-items: start; justify-content: center; }

/* --- 左カラム：ゴールカード --- */
.side { display: flex; flex-direction: column; gap: 8px; }

/* --- 右カラム：世帯年収＋結果詳細 --- */
.col-right { display: flex; flex-direction: column; gap: 12px; min-width: 180px; }
.income-shared {
    width: 100%;
    background: var(--bg-warm, #F5F0E8);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 12px;
}
.is-title { font-size: 12px; font-weight: 800; color: var(--text-main); margin-bottom: 8px; }
.income-save-btn {
    width: 100%;
    padding: 7px;
    margin-top: 6px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 800;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s;
}
.income-save-btn:hover { opacity: 0.9; }
.income-save-btn:active { transform: scale(0.97); }
.income-saved-msg {
    text-align: center;
    font-size: 11px;
    font-weight: 700;
    color: var(--accent);
    margin-top: 4px;
}
.income-saved-msg.hidden { display: none; }

/* --- 節税カード --- */
.tax-card {
    width: 100%;
    background: var(--bg-warm, #F5F0E8);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 12px;
}
.tax-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 8px;
}
.tax-toggle input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
    cursor: pointer;
}
.tax-result { display: flex; flex-direction: column; gap: 4px; }
.tax-result.hidden { display: none; }
.tax-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 700;
}
.tax-row strong {
    font-size: 12px;
    font-weight: 900;
    color: var(--text-main);
}
.tax-row.tax-total {
    margin-top: 4px;
    padding-top: 6px;
    border-top: 1px solid var(--border);
}
.tax-row.tax-total strong { color: var(--accent); font-size: 13px; }

.g-card {
    background: var(--card-bg, #fff);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.25s;
}
.g-card:hover { border-color: var(--accent); transform: translateY(-1px); box-shadow: 0 3px 10px rgba(0,0,0,0.05); }
.g-card.active { border-color: var(--flow); background: rgba(255,140,66,0.04); }
.g-card.diagnosed-flow { border-left: 4px solid var(--flow); }
.g-card.diagnosed-anxiety { border-left: 4px solid rgba(90,60,90,0.5); }
.g-card.diagnosed-bored { border-left: 4px solid rgba(136,153,170,0.5); }

.g-head { display: flex; align-items: center; gap: 8px; }
.g-icon { font-size: 20px; }
.g-name { font-size: 12px; font-weight: 800; }
.g-badge { font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 20px; margin-top: 4px; display: inline-block; }
.g-badge.flow { background: rgba(255,140,66,0.1); color: var(--flow); }
.g-badge.anxiety { background: rgba(90,60,90,0.08); color: rgba(90,60,90,0.8); }
.g-badge.bored { background: rgba(136,153,170,0.08); color: rgba(136,153,170,0.8); }
.g-badge.none { background: var(--bg-warm); color: var(--text-muted); }
.g-val { font-size: 16px; font-weight: 900; margin-top: 2px; }
.g-hint { font-size: 10px; color: var(--text-muted); margin-top: 2px; }

/* --- フォーム展開（max-heightアニメーション）--- */
.g-form { max-height: 0; overflow: hidden; transition: max-height 0.4s ease; }
.g-card.active .g-form { max-height: 600px; margin-top: 10px; border-top: 1px solid var(--border); padding-top: 10px; }

.f-row { margin-bottom: 8px; }
.f-row label { display: block; font-size: 10px; font-weight: 700; color: var(--text-muted); margin-bottom: 3px; }
.f-row .wrap { display: flex; align-items: center; gap: 6px; }
.f-row input {
    flex: 1;
    padding: 7px 9px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    font-family: inherit;
    color: var(--text-main);
    outline: none;
    transition: border 0.2s;
    -webkit-appearance: none;
    background: var(--card-bg, #fff);
}
.f-row input:focus { border-color: var(--accent); }
.f-row .unit { font-size: 10px; font-weight: 700; color: var(--text-muted); white-space: nowrap; }
.f-hint { font-size: 9px; color: var(--accent); margin-top: 2px; }

/* --- 進路選択チップ --- */
.flow-sel-row { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; margin-top: 4px; }
.flow-sel-chip {
    padding: 7px 6px;
    border-radius: 8px;
    border: 1.5px solid var(--border);
    text-align: center;
    cursor: pointer;
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    transition: all 0.15s;
}
.flow-sel-chip.on {
    border-color: var(--flow);
    color: var(--flow);
    background: rgba(255,140,66,0.06);
}

/* --- 診断ボタン --- */
.calc-btn {
    width: 100%;
    padding: 9px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 800;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s;
    margin-top: 4px;
}
.calc-btn:hover { opacity: 0.9; }
.calc-btn:active { transform: scale(0.97); opacity: 0.85; }

/* --- 中央カラム：チャート＋ステータス＋結果＋戻る --- */
.col-chart { display: flex; flex-direction: column; gap: 12px; }

/* --- チャート --- */
.chart-container { width: 100%; max-width: 508px; aspect-ratio: 1; position: relative; }
.chart-box {
    position: relative;
    width: 100%;
    height: 100%;
    border-left: 2.5px solid var(--text-main);
    border-bottom: 2.5px solid var(--text-main);
    overflow: hidden;
    background: var(--card-bg, #FAFAF7);
}
.chart-box canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.axis-y {
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%) rotate(-90deg);
    font-size: 10px;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: 3px;
    white-space: nowrap;
    opacity: 0.35;
    z-index: 2;
}
.axis-x {
    position: absolute;
    bottom: 6px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: 3px;
    opacity: 0.35;
    z-index: 2;
}
.c-inner { position: absolute; z-index: 2; font-size: 8px; font-weight: 700; color: var(--text-muted); }
.flow-label { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); z-index: 2; text-align: center; }
.flow-label .main { font-size: 24px; font-weight: 900; color: var(--flow); letter-spacing: 4px; text-shadow: 0 2px 8px rgba(255,140,66,0.25); }
.flow-label .sub { font-size: 9px; font-weight: 700; color: var(--flow); margin-top: 6px; }
.zone-label { position: absolute; z-index: 2; font-size: 20px; font-weight: 900; }

/* --- マーカー --- */
.marker {
    position: absolute;
    z-index: 10;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--flow);
    border: 3px solid #fff;
    box-shadow: 0 2px 8px rgba(255,140,66,0.4);
    transform: translate(-50%,-50%);
    transition: all 0.6s cubic-bezier(0.34,1.56,0.64,1);
    display: none;
}
.marker.show { display: block; }
.marker.default-pos { background: var(--accent); box-shadow: 0 2px 8px rgba(91,140,106,0.4); }
.marker.default-pos::after { border-color: rgba(91,140,106,0.3); }
.marker::after {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 2px solid rgba(255,140,66,0.3);
    animation: fc-pulse 2s infinite;
}
@keyframes fc-pulse {
    0%, 100% { opacity: 0.6; transform: scale(1); }
    50% { opacity: 0; transform: scale(1.8); }
}

/* --- ステータスボックス --- */
.status-box {
    width: 100%;
    padding: 12px;
    border-radius: 12px;
    text-align: center;
    border: 2px solid var(--accent);
    background: var(--bg-warm);
    transition: all 0.3s;
}
.status-box .emoji { font-size: 22px; }
.status-box .title { font-size: 14px; font-weight: 900; margin-top: 2px; color: var(--accent); }
.status-box .detail { font-size: 10px; color: var(--text-muted); margin-top: 2px; font-weight: 700; }

/* --- 結果ボックス --- */
.result-box {
    width: 100%;
    background: var(--card-bg, #fff);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    font-size: 11px;
    line-height: 1.8;
}
.result-box strong { color: var(--accent); }
.result-box.hidden { display: none; }

/* --- 戻るボタン --- */
.back-btn {
    width: 100%;
    padding: 9px;
    background: var(--card-bg, #fff);
    border: 2px solid var(--border);
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-muted);
    text-align: center;
}
.back-btn:hover { border-color: var(--accent); color: var(--accent); }
.back-btn.hidden { display: none; }

/* --- CTAバナー --- */
.cta-full {
    padding: 14px 20px;
    background: linear-gradient(135deg, var(--bg-warm), rgba(255,140,66,0.08));
    border: 2px dashed var(--accent);
    border-radius: 14px;
    text-align: center;
}
.cta-full .cta-text { font-size: 12px; font-weight: 800; color: var(--accent); }
.cta-full .cta-sub { font-size: 10px; color: var(--text-muted); margin-top: 4px; font-weight: 700; }
.cta-full.hidden { display: none; }

/* --- モバイル：1カラム切り替え --- */
@media (max-width: 768px) {
    .flow-layout { grid-template-columns: 1fr; gap: 12px; }
    .col-chart { order: -1; }
    .chart-container { max-width: 340px; margin: 0 auto; }
    .status-box, .income-shared, .result-box, .back-btn { max-width: 100%; }
}

/* --- ホーム画面 FLOW要約カード --- */
.home-sec-flow .flow-zone-label {
    font-weight: 800;
    font-size: 0.85rem;
}
.home-sec-flow .flow-zone-value {
    font-family: 'M PLUS Rounded 1c', sans-serif;
    font-weight: 900;
    font-size: 0.82rem;
}

/* --- FLOW prefers-reduced-motion --- */
@media (prefers-reduced-motion: reduce) {
    .marker::after { animation: none !important; }
}
