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

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

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

/* ---- 結果 ---- */
html[data-ui="v2"] .ky-out .res-hero .big b { font-size: clamp(30px, 8.6vw, 42px); overflow-wrap: normal; }
.ky-two { display: inline-block; font-size: clamp(22px, 6.4vw, 30px); line-height: 1.35; }
.ky-or { font-size: 0.6em; font-weight: 400; margin: 0 0.4em; color: var(--ink-2); }
html[data-ui="v2"] .ky-out .res-mini .v { overflow-wrap: normal; word-break: keep-all; }
html[data-ui="v2"] .ky-out .res-mini .v small { white-space: nowrap; }
html[data-ui="v2"] .ky-out .res-mini .s { overflow-wrap: anywhere; }
html[data-ui="v2"] .ky-out .res-mini > div { min-width: 0; }
@media (max-width: 400px) { html[data-ui="v2"] .ky-out .res-mini .v { font-size: 15px; } }
.ky-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); }
/* 読み込み直後（計算の前）は欄の高さを確保する。計算が最初に外す（値は見込み。描画確認で直す） */
#resultPanel.ky-pending { min-height: 560px; }
#banOut.ky-pending-ban { min-height: 520px; }
#result { min-height: 230px; }
#resultPanel [hidden] { display: none !important; }
.ky-h3 { margin: 18px 0 6px; font-size: 15px; }
.ky-note { margin-top: 12px; }
.ky-fl { display: block; margin: 0 0 6px; overflow-wrap: anywhere; }
html[data-ui="v2"] table.data.ky-st { width: 100%; }
html[data-ui="v2"] table.data.ky-st td { white-space: nowrap; vertical-align: middle; }
html[data-ui="v2"] table.data.ky-st tr.hit td { background: var(--accent-soft); font-weight: 600; }

/* ---- 年盤（3×3、南が上）と月の九星 ---- */
.ky-ctl { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end; }
.ky-ctl .field { margin-bottom: 0; flex: 0 1 auto; min-width: 0; max-width: 100%; }
html[data-ui="v2"] .ky-ctl select { width: auto; min-width: 8em; max-width: 100%; }
.ky-ban-wrap { display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 760px) { .ky-ban-wrap { grid-template-columns: minmax(0, 1fr); } }
.ky-ban { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; max-width: 300px; min-width: 0; }
.ky-ban-s, .ky-ban-n { grid-column: 1 / -1; text-align: center; font-size: 12px; color: var(--muted); }
.ky-cell { border: 1px solid var(--grid); border-radius: var(--r); background: var(--surface); padding: 8px 4px; text-align: center; min-width: 0; }
.ky-cell b { display: block; font-size: 18px; line-height: 1.3; }
.ky-cell .ky-d { display: block; font-size: 11.5px; color: var(--muted); }
.ky-cell.ky-c { background: var(--accent-soft); border-color: var(--accent); }
.ky-cell.ky-c b { color: var(--accent); }
.ky-ban-m { min-width: 0; }
.ky-cell.ky-me { background: var(--accent); border-color: var(--accent); }
.ky-cell.ky-me b, .ky-cell.ky-me .ky-d { color: var(--surface); }
.ky-ban-fig { margin: 14px 0 0; min-width: 0; }
.ky-ban-fig figcaption { font-size: 14px; font-weight: 700; margin-bottom: 8px; text-align: center; overflow-wrap: anywhere; }
.ky-ban-fig .ky-ban { margin: 0 auto; }

/* ---- 本命星の早見表（長いので枠の中でスクロール） ---- */
.ky-hy-box { max-height: 560px; overflow: auto; }
html[data-ui="v2"] table.data.ky-hyt { width: 100%; }
html[data-ui="v2"] table.data.ky-hyt td { white-space: nowrap; vertical-align: middle; }
html[data-ui="v2"] table.data.ky-hyt td.ky-y { white-space: normal; min-width: 6.5em; }
html[data-ui="v2"] table.data.ky-hyt tr.hit td { background: var(--accent-soft); font-weight: 600; }
@media (max-width: 400px) {
  html[data-ui="v2"] table.data.ky-hyt th, html[data-ui="v2"] table.data.ky-hyt td,
  html[data-ui="v2"] table.data.ky-st th, html[data-ui="v2"] table.data.ky-st td { padding-left: 6px; padding-right: 6px; }
}

/* ---- 本文 ---- */
.ky-formula { padding: 10px 12px; background: var(--page); border-radius: var(--r); }
html[data-ui="v2"] table.data.ky-mt td { white-space: nowrap; }
html[data-ui="v2"] table.data.ky-mt th { white-space: normal; word-break: keep-all; }
/* 解釈（計算ではない紹介）の札。結果のすぐ下の枠と本文の節で、計算と見た目を分ける */
.ky-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); }
/* 参考の日命星（本命星・月命星より控えめに） */
.ky-day { margin: 12px 0 0; font-size: 13.5px; line-height: 1.7; color: var(--ink-2); }
/* 区切り方ごとの比較表（選んでいる方式と違う所に印） */
html[data-ui="v2"] table.data.ky-cmp { width: 100%; }
html[data-ui="v2"] table.data.ky-cmp td { vertical-align: middle; }
html[data-ui="v2"] table.data.ky-cmp td:not(:first-child) { white-space: nowrap; }
html[data-ui="v2"] table.data.ky-cmp td:first-child { min-width: 9em; }
html[data-ui="v2"] table.data.ky-cmp tr.ky-sel-row td { background: var(--accent-soft); }
html[data-ui="v2"] table.data.ky-cmp td.ky-diff { font-weight: 700; color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
html[data-ui="v2"] table.data.ky-cmp tr.ky-ref td { color: var(--ink-2); }
.ky-cmp-note { margin: 6px 0 0; }
.ky-check { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; line-height: 1.6; cursor: pointer; min-width: 0; }
.ky-check input { margin-top: 5px; flex: none; }
/* 解釈（本の説明の紹介）：計算と見た目で分ける */
.ky-interp-box { margin: 16px 0 0; padding: 12px 14px; border: 1px dashed var(--grid); border-radius: var(--r); background: var(--page); min-width: 0; }
.ky-interp-box .ky-h3 { margin-top: 10px; }
.ky-in-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
@media (max-width: 560px) { .ky-in-grid { grid-template-columns: minmax(0, 1fr); } }
.ky-in { min-width: 0; padding: 8px 10px; background: var(--surface); border: 1px solid var(--grid); border-radius: var(--r); }
.ky-in b { display: block; font-size: 12.5px; color: var(--ink-2); margin-bottom: 2px; }
.ky-in p { margin: 0; font-size: 14px; line-height: 1.75; overflow-wrap: anywhere; }
.ky-in-note { margin: 4px 0 6px; }
.ky-tag-in { margin: 0 0 0 8px; vertical-align: middle; }
.ky-houi { margin: 4px 0 0; padding-left: 1.3em; font-size: 14px; }
.ky-interp-sec .ky-interp-tag { margin-top: 0; }
html[data-ui="v2"] table.data.ky-it { width: 100%; }
html[data-ui="v2"] table.data.ky-it th, html[data-ui="v2"] table.data.ky-it td { white-space: normal; vertical-align: top; font-size: 13.5px; line-height: 1.7; }
html[data-ui="v2"] table.data.ky-it td { min-width: 12em; }
/* 狭い画面では、性格・めぐりの表を1行ずつ縦に並べる（横スクロールを出さない） */
@media (max-width: 560px) {
  html[data-ui="v2"] table.data.ky-it thead { display: none; }
  html[data-ui="v2"] table.data.ky-it, html[data-ui="v2"] table.data.ky-it tbody, html[data-ui="v2"] table.data.ky-it tr,
  html[data-ui="v2"] table.data.ky-it th, html[data-ui="v2"] table.data.ky-it td { display: block; width: auto; min-width: 0; }
  html[data-ui="v2"] table.data.ky-it tr { border-top: 2px solid var(--grid); padding: 6px 0; }
  html[data-ui="v2"] table.data.ky-it tbody th { white-space: normal; border: 0; padding-bottom: 2px; }
  html[data-ui="v2"] table.data.ky-it td { border: 0; padding-top: 2px; }
  html[data-ui="v2"] table.data.ky-it td::before { content: attr(data-label); display: block; font-size: 12px; font-weight: 600; color: var(--ink-2); }
}
html[data-ui="v2"] table.data.ky-it tbody th { white-space: nowrap; }
html[data-ui="v2"] table.data.ky-tk td { white-space: nowrap; }
html[data-ui="v2"] table.data.ky-tk tr.ky-hl td { background: var(--accent-soft); font-weight: 600; }
.ky-ke { margin-left: 8px; font-size: 12px; font-weight: 400; color: var(--ink-2); }
