/* ============================================================
   E-計算！ Fortune — 九星気学の相性（kyusei-aisho.html）だけで使う見た目
   共通（../assets/css/ek.css・css/fortune.css）の上に重ねる。色は変数だけを使う。クラスは ka- で始める。
   ============================================================ */

/* ページ上部の要点 */
.ka-quick { margin: 4px 0 20px; }
.ka-quick ul { margin: 2px 0 0; }
.ka-quick li { margin: 2px 0; }

/* ---- 入力（九星気学・四柱推命のページと同じ形：ふつうの文字の欄＋カレンダーのボタン） ---- */
.ka-date { position: relative; display: flex; align-items: center; gap: 8px; min-width: 0; }
html[data-ui="v2"] .ka-date input[type="text"], html[data-ui="v2"] input.ka-text {
  flex: 1 1 auto; width: 100%; min-width: 0; height: 44px; padding: 0 12px; font-size: 15px; font-variant-numeric: tabular-nums;
  color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r);
}
html[data-ui="v2"] .ka-date input[type="text"]:focus, html[data-ui="v2"] input.ka-text:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
html[data-ui="v2"] .ka-date input.bad, html[data-ui="v2"] input.ka-text.bad { border-color: var(--s2, #B4442C); border-width: 2px; }
.ka-pick {
  flex: none; width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; padding: 0;
  border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--surface); color: var(--ink-2); cursor: pointer;
}
.ka-pick:hover { background: var(--accent-soft); color: var(--accent); }
.ka-pick:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.ka-pick svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.ka-native { position: absolute; right: 0; bottom: 0; width: 44px; height: 1px; padding: 0; border: 0; opacity: 0; pointer-events: none; }
@media (max-width: 560px) { html[data-ui="v2"] .ka-date input[type="text"], html[data-ui="v2"] input.ka-text { font-size: 16px; } }
html[data-ui="v2"] select.ka-sel { width: auto; min-width: 0; max-width: 100%; }
.ka-lbl { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; color: var(--ink); }
.ka-form .field { min-width: 0; }
details.ka-more { margin: 4px 0 14px; border-top: 1px solid var(--grid); border-bottom: 1px solid var(--grid); padding: 2px 0; }
details.ka-more > summary { cursor: pointer; padding: 10px 2px; font-size: 13.5px; font-weight: 600; color: var(--accent); }
details.ka-more[open] > summary { margin-bottom: 4px; }
.ka-rule { display: grid; gap: 6px; }
.ka-rule label, .ka-check { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; line-height: 1.6; cursor: pointer; min-width: 0; }
.ka-rule input, .ka-check input { margin-top: 5px; flex: none; }
.ka-hint { margin: 6px 0 0; }
.vp-samples .vp-sample { max-width: 100%; white-space: normal; text-align: left; }

/* ---- 結果 ---- */
html[data-ui="v2"] .ka-out .res-hero .big b { font-size: clamp(30px, 8.6vw, 42px); overflow-wrap: anywhere; }
.ka-f { font-size: 0.5em; font-weight: 600; margin-left: 0.35em; color: var(--ink-2); white-space: nowrap; }
.ka-or { font-size: 0.55em; font-weight: 400; margin: 0 0.35em; color: var(--ink-2); }
/* 小さな箱：長い文字は折り返す（keep-all は使わない） */
html[data-ui="v2"] .ka-out .res-mini > div { min-width: 0; }
html[data-ui="v2"] .ka-out .res-mini .v { overflow-wrap: anywhere; line-height: 1.35; }
html[data-ui="v2"] .ka-out .res-mini .s { overflow-wrap: anywhere; }
@media (max-width: 400px) { html[data-ui="v2"] .ka-out .res-mini .v { font-size: 15px; } }
/* 結果の一番上：本ごとの吉凶をそのまま出す */
.ka-verdict { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; text-align: left; }
.ka-verdict li { padding: 6px 10px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--grid); font-size: 14px; line-height: 1.6; color: var(--ink-2); overflow-wrap: anywhere; }
.ka-verdict li b { color: var(--ink); }
.ka-rel, .ka-case { margin: 8px 0 0; overflow-wrap: anywhere; }
.ka-case { font-weight: 700; color: var(--ink); }
.ka-disc { margin: 8px 0 0; font-size: 12px; color: var(--muted); }
.ka-rule-line { margin: 12px 0 0; font-size: 13px; line-height: 1.7; color: var(--ink-2); padding: 8px 10px; background: var(--page); border-radius: var(--r); overflow-wrap: anywhere; }
/* 読み込み直後（計算の前）は欄の高さを確保する。計算が最初に外す（値は見込み。初めは入力前の案内だけ） */
#resultPanel.ka-pending { min-height: 200px; }
#result { min-height: 0; }
/* 答えの中の箇条（好相性の要素・違い・注意点） */
#resultPanel [hidden] { display: none !important; }
.ka-h3 { margin: 18px 0 6px; font-size: 15px; }
.ka-note { margin-top: 12px; }
.ka-fl { display: block; margin: 0 0 6px; overflow-wrap: anywhere; }

/* 五行の図（インラインSVG） */
.ka-fig { margin: 12px 0 0; display: grid; grid-template-columns: minmax(0, 200px) minmax(0, 1fr); gap: 12px; align-items: center; }
@media (max-width: 480px) { .ka-fig { grid-template-columns: minmax(0, 1fr); justify-items: center; } }
.ka-fig svg { width: 100%; max-width: 200px; height: auto; display: block; }
.ka-fig figcaption { font-size: 13px; line-height: 1.7; color: var(--ink-2); min-width: 0; overflow-wrap: anywhere; }
.ka-svg-node { fill: var(--surface); stroke: var(--line-strong); stroke-width: 1.5; }
.ka-svg-node.on { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 2.5; }
.ka-svg-t { font-size: 15px; font-weight: 700; fill: var(--ink); text-anchor: middle; dominant-baseline: central; }
.ka-svg-who { font-size: 10px; fill: var(--accent); text-anchor: middle; font-weight: 700; }
.ka-svg-sei { stroke: var(--ink-2); stroke-width: 1.3; fill: none; }
.ka-svg-koku { stroke: var(--muted); stroke-width: 1; fill: none; stroke-dasharray: 4 3; }
.ka-svg-sei.on, .ka-svg-koku.on { stroke: var(--accent); stroke-width: 3; stroke-dasharray: none; }
.ka-svg-head { fill: var(--ink-2); }
.ka-svg-head-k { fill: var(--muted); }
.ka-svg-head-on { fill: var(--accent); }
.ka-legend { list-style: none; padding: 0; margin: 6px 0 0; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--ink-2); }
.ka-legend i { display: inline-block; width: 18px; height: 0; margin-right: 6px; vertical-align: middle; border-top: 2px solid var(--ink-2); }
.ka-legend i.k { border-top: 1.5px dashed var(--muted); }

/* 組み合わせ・本ごとの比較表 */
html[data-ui="v2"] table.data.ka-cmp { width: 100%; }
html[data-ui="v2"] table.data.ka-cmp th, html[data-ui="v2"] table.data.ka-cmp td { vertical-align: middle; }
html[data-ui="v2"] table.data.ka-cmp td { white-space: nowrap; }
html[data-ui="v2"] table.data.ka-cmp td.ka-w { white-space: normal; min-width: 8.5em; }
html[data-ui="v2"] table.data.ka-cmp tr.ka-main td { background: var(--accent-soft); }
html[data-ui="v2"] table.data.ka-cmp td.ka-diff { font-weight: 700; color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
html[data-ui="v2"] table.data.ka-cmp tr.ka-ref td { color: var(--ink-2); }
.ka-cmp-note { margin: 6px 0 0; }

/* 解釈（本の考え方の紹介）：計算と見た目で分ける */
.ka-interp-box { margin: 16px 0 0; padding: 12px 14px; border: 1px dashed var(--grid); border-radius: var(--r); background: var(--page); min-width: 0; }
.ka-interp-box .ka-h3 { margin-top: 10px; }
.ka-interp-tag { display: inline-block; margin: 4px 0 8px; padding: 1px 10px; border-radius: 999px; font-size: 12px; background: var(--page); color: var(--ink-2); border: 1px solid var(--grid); }
.ka-interp-sec .ka-interp-tag { margin-top: 0; }
.ka-books { display: grid; gap: 8px; }
.ka-book { min-width: 0; padding: 8px 10px; background: var(--surface); border: 1px solid var(--grid); border-radius: var(--r); }
.ka-book > b { display: block; font-size: 12.5px; color: var(--ink-2); margin-bottom: 2px; }
.ka-book .ka-v { display: inline-block; margin-right: 6px; padding: 0 8px; border-radius: 999px; font-size: 13px; font-weight: 700; background: var(--accent-soft); color: var(--accent); white-space: normal; overflow-wrap: anywhere; max-width: 100%; margin-bottom: 2px; }
.ka-book .ka-v.none { background: var(--page); color: var(--muted); font-weight: 600; }
.ka-book p { margin: 2px 0 0; font-size: 14px; line-height: 1.75; overflow-wrap: anywhere; }
.ka-in-note { margin: 4px 0 6px; }
.ka-caution { margin: 10px 0 0; padding: 8px 10px; border-left: 3px solid var(--accent); background: var(--surface); font-size: 14px; line-height: 1.75; overflow-wrap: anywhere; }

/* 81通りの早見表 */
.ka-ctl { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end; margin-bottom: 10px; }
.ka-ctl .field { margin-bottom: 0; flex: 0 1 auto; min-width: 0; max-width: 100%; }
html[data-ui="v2"] table.data.ka-81 { width: 100%; }
html[data-ui="v2"] table.data.ka-81 th, html[data-ui="v2"] table.data.ka-81 td { text-align: center; white-space: nowrap; padding: 6px 5px; font-size: 13px; vertical-align: middle; }
html[data-ui="v2"] table.data.ka-81 td .sub { font-size: 10.5px; }
html[data-ui="v2"] table.data.ka-81 td.sousei { background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }
html[data-ui="v2"] table.data.ka-81 td.soukoku { color: var(--ink-2); }
html[data-ui="v2"] table.data.ka-81 td.none { color: var(--muted); }
html[data-ui="v2"] table.data.ka-81 td.hit { outline: 2px solid var(--accent); outline-offset: -2px; font-weight: 700; }
html[data-ui="v2"] table.data.ka-81 th.ka-corner { font-size: 11px; line-height: 1.4; white-space: normal; min-width: 4.5em; }

/* 本文 */
html[data-ui="v2"] table.data.ka-mt th, html[data-ui="v2"] table.data.ka-mt td { white-space: normal; vertical-align: top; font-size: 13.5px; line-height: 1.7; }
html[data-ui="v2"] table.data.ka-mt td { min-width: 7em; }
html[data-ui="v2"] table.data.ka-mt td.ka-nw { white-space: nowrap; min-width: 0; }
