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

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

/* ---- 入力（九星気学・相性のページと同じ形：ふつうの文字の欄＋カレンダーのボタン） ---- */
.kh-date { position: relative; display: flex; align-items: center; gap: 8px; min-width: 0; }
html[data-ui="v2"] .kh-date input[type="text"], html[data-ui="v2"] input.kh-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"] .kh-date input[type="text"]:focus, html[data-ui="v2"] input.kh-text:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
html[data-ui="v2"] .kh-date input.bad, html[data-ui="v2"] input.kh-text.bad { border-color: var(--s2, #B4442C); border-width: 2px; }
.kh-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;
}
.kh-pick:hover { background: var(--accent-soft); color: var(--accent); }
.kh-pick:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.kh-pick svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.kh-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"] .kh-date input[type="text"], html[data-ui="v2"] input.kh-text { font-size: 16px; } }
html[data-ui="v2"] select.kh-sel { width: 100%; min-width: 0; max-width: 100%; }
.kh-lbl { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; color: var(--ink); }
.kh-form .field { min-width: 0; }
details.kh-more { margin: 4px 0 14px; border-top: 1px solid var(--grid); border-bottom: 1px solid var(--grid); padding: 2px 0; }
details.kh-more > summary { cursor: pointer; padding: 10px 2px; font-size: 13.5px; font-weight: 600; color: var(--accent); }
details.kh-more[open] > summary { margin-bottom: 4px; }
.kh-rule { display: grid; gap: 6px; }
.kh-rule label, .kh-check { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; line-height: 1.6; cursor: pointer; min-width: 0; }
.kh-rule input, .kh-check input { margin-top: 5px; flex: none; }
.kh-hint { margin: 6px 0 0; }
.vp-samples .vp-sample { max-width: 100%; white-space: normal; text-align: left; }
.kh-pt { display: grid; gap: 6px; min-width: 0; }
.kh-pt [hidden] { display: none !important; }

/* ---- 結果 ---- */
html[data-ui="v2"] .kh-out .res-hero .big b { font-size: clamp(28px, 8vw, 40px); overflow-wrap: anywhere; }
.kh-or { font-size: 0.55em; font-weight: 400; margin: 0 0.35em; color: var(--ink-2); }
html[data-ui="v2"] .kh-out .res-mini > div { min-width: 0; }
html[data-ui="v2"] .kh-out .res-mini .v { overflow-wrap: anywhere; line-height: 1.35; }
html[data-ui="v2"] .kh-out .res-mini .s { overflow-wrap: anywhere; }
@media (max-width: 400px) { html[data-ui="v2"] .kh-out .res-mini .v { font-size: 15px; } }
.kh-verdict { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; text-align: left; }
.kh-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; }
.kh-verdict li b { color: var(--ink); }
.kh-none { margin: 8px 0 0; font-weight: 700; color: var(--ink); overflow-wrap: anywhere; }
.kh-case { margin: 10px 0 0; font-weight: 700; color: var(--ink); overflow-wrap: anywhere; }
.kh-disc { margin: 8px 0 0; font-size: 12px; color: var(--muted); }
.kh-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.kh-pending { min-height: 720px; }
#geoPanel.kh-pending { min-height: 360px; }
#result { min-height: 220px; }
#resultPanel [hidden], #geoPanel [hidden] { display: none !important; }
.kh-h3 { margin: 18px 0 6px; font-size: 15px; }
.kh-note { margin-top: 12px; }
.kh-fl { display: block; margin: 0 0 6px; overflow-wrap: anywhere; }

/* 方位盤（インラインSVG。南が上） */
/* 器の幅に合わせる：1枚が308px（図の元の大きさ）より狭くなるときは1列（画面の幅ではなく結果の欄の幅で決まる） */
.kh-boards { margin: 14px 0 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(308px, 100%), 1fr)); gap: 12px; }
.kh-board { margin: 0; min-width: 0; text-align: center; }
.kh-board svg { width: 100%; max-width: 308px; height: auto; display: block; margin: 0 auto; }
.kh-board figcaption { font-size: 12.5px; line-height: 1.6; color: var(--ink-2); overflow-wrap: anywhere; margin-top: 4px; }
.kh-sec { stroke: var(--line-strong); stroke-width: 1; fill: var(--surface); }
.kh-sec.kichi { fill: color-mix(in srgb, var(--accent) 22%, var(--surface)); stroke: var(--accent); stroke-width: 1.5; }
.kh-sec.kyo { fill: var(--page); }
.kh-sec.daikyo { fill: color-mix(in srgb, var(--ink) 12%, var(--surface)); }
.kh-mid { fill: var(--page); stroke: var(--line-strong); stroke-width: 1; }
.kh-t-dir { font-size: 13px; font-weight: 700; fill: var(--ink-2); text-anchor: middle; dominant-baseline: central; }
.kh-t-star { font-size: 14px; font-weight: 700; fill: var(--ink); text-anchor: middle; dominant-baseline: central; }
.kh-t-lab { font-size: 12px; fill: var(--ink-2); text-anchor: middle; dominant-baseline: central; }
.kh-t-shi { font-size: 13px; font-weight: 700; fill: var(--ink); text-anchor: middle; dominant-baseline: central; }
.kh-t-lab.k { fill: var(--accent); font-weight: 700; }
.kh-t-c { font-size: 14px; font-weight: 700; fill: var(--ink); text-anchor: middle; dominant-baseline: central; }
.kh-t-cs { font-size: 12px; fill: var(--ink-2); text-anchor: middle; dominant-baseline: central; }
.kh-legend { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--ink-2); justify-content: center; }
.kh-legend i { display: inline-block; width: 14px; height: 14px; margin-right: 5px; vertical-align: -2px; border: 1px solid var(--line-strong); background: var(--surface); }
.kh-legend i.kichi { background: color-mix(in srgb, var(--accent) 22%, var(--surface)); border-color: var(--accent); }
.kh-legend i.kyo { background: var(--page); }
.kh-legend i.daikyo { background: color-mix(in srgb, var(--ink) 12%, var(--surface)); }

/* 方位ごとの表・比較表・月の表 */
html[data-ui="v2"] table.data.kh-t { width: 100%; }
html[data-ui="v2"] table.data.kh-t th, html[data-ui="v2"] table.data.kh-t td { vertical-align: middle; font-size: 13.5px; line-height: 1.6; }
html[data-ui="v2"] table.data.kh-t td { white-space: nowrap; }
html[data-ui="v2"] table.data.kh-t td.kh-w { white-space: normal; min-width: 8em; }
html[data-ui="v2"] table.data.kh-t td.kichi { background: color-mix(in srgb, var(--accent) 12%, var(--surface)); font-weight: 700; }
html[data-ui="v2"] table.data.kh-t td.daikyo { color: var(--ink-2); }
html[data-ui="v2"] table.data.kh-t td.kyo { color: var(--ink-2); }
html[data-ui="v2"] table.data.kh-t tr.kh-main td { background: var(--accent-soft); }
html[data-ui="v2"] table.data.kh-t td.kh-diff { font-weight: 700; color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
html[data-ui="v2"] table.data.kh-t tr.hit td, html[data-ui="v2"] table.data.kh-t tr.hit th { outline: 2px solid var(--accent); outline-offset: -2px; }
.kh-tnote { margin: 6px 0 0; }
.kh-ctl { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end; margin-bottom: 10px; }
.kh-ctl .field { margin-bottom: 0; flex: 0 1 auto; min-width: 0; max-width: 100%; }
details.kh-days { margin: 14px 0 0; }
details.kh-days > summary { cursor: pointer; font-weight: 600; color: var(--accent); padding: 6px 0; }

/* 解釈（本の考え方の紹介）：計算と見た目で分ける */
.kh-interp-box { margin: 16px 0 0; padding: 12px 14px; border: 1px dashed var(--grid); border-radius: var(--r); background: var(--page); min-width: 0; }
.kh-interp-box .kh-h3 { margin-top: 10px; }
.kh-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); }
.kh-interp-sec .kh-interp-tag { margin-top: 0; }
.kh-books { display: grid; gap: 8px; }
.kh-book { min-width: 0; padding: 8px 10px; background: var(--surface); border: 1px solid var(--grid); border-radius: var(--r); }
.kh-book > b { display: block; font-size: 12.5px; color: var(--ink-2); margin-bottom: 2px; }
.kh-book .kh-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; }
.kh-book .kh-v.kyo { background: var(--page); color: var(--ink-2); }
.kh-book p { margin: 2px 0 0; font-size: 14px; line-height: 1.75; overflow-wrap: anywhere; }

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