/* v4: 壊れたエッジキャッシュを避けるためファイル名を変えている
   （原因は 404.html が無くて存在しないパスが 200+HTML で返っていたこと。build.py で対処済み） */
:root{
  --bg:#f7f4ee; --panel:#fffdf9; --line:#ded5c4; --text:#2b2622; --sub:#7d7266;
  --accent:#9b2f2f; --accent-soft:#f0dcdc; --shadow:0 1px 3px rgba(0,0,0,.07),0 8px 24px rgba(0,0,0,.05);
  --moku:#3f7d4e; --ka:#b8412f; --do:#a07a2c; --kin:#6b7480; --sui:#2f5f96;
}
@media (prefers-color-scheme:dark){
  :root{
    --bg:#17151a; --panel:#211e25; --line:#3a3542; --text:#ece7f0; --sub:#9c93a8;
    --accent:#e0736b; --accent-soft:#3a2426; --shadow:0 1px 3px rgba(0,0,0,.4),0 8px 24px rgba(0,0,0,.3);
    --moku:#6fbf82; --ka:#e8806c; --do:#d3ab5a; --kin:#a9b4c2; --sui:#6fa8e0;
  }
}
:root[data-theme="light"]{
  --bg:#f7f4ee; --panel:#fffdf9; --line:#ded5c4; --text:#2b2622; --sub:#7d7266;
  --accent:#9b2f2f; --accent-soft:#f0dcdc; --shadow:0 1px 3px rgba(0,0,0,.07),0 8px 24px rgba(0,0,0,.05);
  --moku:#3f7d4e; --ka:#b8412f; --do:#a07a2c; --kin:#6b7480; --sui:#2f5f96;
}
:root[data-theme="dark"]{
  --bg:#17151a; --panel:#211e25; --line:#3a3542; --text:#ece7f0; --sub:#9c93a8;
  --accent:#e0736b; --accent-soft:#3a2426; --shadow:0 1px 3px rgba(0,0,0,.4),0 8px 24px rgba(0,0,0,.3);
  --moku:#6fbf82; --ka:#e8806c; --do:#d3ab5a; --kin:#a9b4c2; --sui:#6fa8e0;
}
*{box-sizing:border-box}
body{
  margin:0; background:var(--bg); color:var(--text); line-height:1.7;
  font-family:"Hiragino Sans","Hiragino Kaku Gothic ProN","Yu Gothic",system-ui,sans-serif;
  -webkit-text-size-adjust:100%;
}
.wrap{max-width:1000px;margin:0 auto;padding:24px 16px 72px}
header{display:flex;align-items:baseline;gap:12px;flex-wrap:wrap;margin-bottom:4px}
h1{font-size:1.5rem;margin:0;letter-spacing:.06em;font-weight:600}
h1 .mark{color:var(--accent)}
.tagline{color:var(--sub);font-size:.85rem}
.head-actions{margin-left:auto;display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.head-actions .who{
  font-size:.78rem;color:var(--sub);max-width:12em;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
}
.theme-toggle{
  appearance:none;background:none;border:1px solid var(--line);
  border-radius:8px;color:var(--sub);font:inherit;font-size:.78rem;padding:4px 10px;cursor:pointer;
}
.theme-toggle:hover{color:var(--text);border-color:var(--sub)}
.tabs{display:flex;gap:4px;margin:20px 0 0;border-bottom:1px solid var(--line)}
.tabs button{
  appearance:none;background:none;border:0;border-bottom:2px solid transparent;
  padding:10px 16px;font:inherit;font-size:.95rem;color:var(--sub);cursor:pointer;
}
.tabs button[aria-selected="true"]{color:var(--accent);border-bottom-color:var(--accent);font-weight:600}
.panel{
  background:var(--panel);border:1px solid var(--line);border-radius:12px;
  padding:20px;margin-top:20px;box-shadow:var(--shadow);
}
.panel h2{font-size:1.05rem;margin:0 0 14px;letter-spacing:.04em;font-weight:600}
.panel h3{font-size:.9rem;margin:20px 0 8px;color:var(--sub);letter-spacing:.06em;font-weight:600}
label{font-size:.85rem;color:var(--sub);display:block;margin-bottom:4px}
/* 文字を打つ入力欄はまとめて同じ見た目にする。
   type を1つずつ並べていた頃は password と email が漏れていて、その欄だけ素のままだった。 */
input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]):not([type=color]),
select,textarea{
  font:inherit;padding:8px 10px;border:1px solid var(--line);border-radius:8px;
  background:var(--bg);color:var(--text);width:100%;max-width:100%;
}
textarea{display:block;width:100%;max-width:100%;box-sizing:border-box;resize:vertical;line-height:1.6;min-height:72px}
textarea:focus,input:focus,select:focus{outline:2px solid var(--accent);outline-offset:1px}
.row{display:flex;gap:12px;flex-wrap:wrap;align-items:flex-end}
.row>div{flex:1 1 150px;min-width:0}
/* 上の余白。`.row.mt` だけに書いていたので `.chips.mt` などに効かず、
   タロットの「引き方」と「おまかせ／自分で選ぶ」が重なって見えていた。
   どの要素に付けても効くようにする。 */
.mt{margin-top:18px}
.row.mt{margin-top:18px}
/* 幅の指定は `.row>` から書く。`.col-auto` だけだと `.row>div` に詳細度で負けて効かない
   （ボタンが等分に広がって左右に離れてしまう）。 */
.row>.col-lg{flex:1 1 200px}
.row>.col-xl{flex:1 1 240px}
.row>.col-auto{flex:0 0 auto}
button.go{
  appearance:none;font:inherit;font-weight:600;cursor:pointer;
  background:var(--accent);color:#fff;border:0;border-radius:8px;padding:10px 22px;
}
button.go:hover{filter:brightness(1.08)}
button.ghost{
  appearance:none;font:inherit;cursor:pointer;background:none;color:var(--accent);
  border:1px solid var(--line);border-radius:8px;padding:9px 16px;
}
.chips{display:flex;flex-wrap:wrap;gap:6px;margin:6px 0}
/* .chips が後ろにあって .mt に勝ってしまうので、両方付いたときの指定を別に書く */
.chips.mt{margin-top:18px}
.chips label{
  display:inline-flex;align-items:center;gap:5px;margin:0;
  border:1px solid var(--line);border-radius:999px;padding:5px 12px;
  font-size:.85rem;color:var(--text);cursor:pointer;background:var(--bg);
}
.chips input{margin:0;accent-color:var(--accent)}
.chips label:has(input:checked){background:var(--accent-soft);border-color:var(--accent);font-weight:600}
details.opt{margin-top:12px;font-size:.85rem}
details.opt summary{cursor:pointer;color:var(--accent);margin-bottom:8px}
details.opt select{max-width:520px}
.note{font-size:.8rem;color:var(--sub);margin:6px 0 0}
.note.center{text-align:center}
.err{color:var(--accent);font-size:.88rem;margin-top:10px}

/* 人体図 */
.jintai{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;max-width:420px;margin:0 auto}
.cell{
  border:1px solid var(--line);border-radius:10px;padding:12px 6px;text-align:center;
  background:var(--bg);min-height:88px;display:flex;flex-direction:column;justify-content:center;gap:2px;
}
.cell.blank{border:0;background:none}
/* 従星のマス。主星と見分けがつくよう色を落として枠を破線にする */
.cell.ju{border-style:dashed;background:transparent}
.cell.ju .star{font-size:1rem;color:var(--sub)}
.cell .pos{font-size:.68rem;color:var(--sub);letter-spacing:.04em}
.cell .star{font-size:1.12rem;font-weight:600;letter-spacing:.02em}
.cell .src{font-size:.66rem;color:var(--sub)}
.g-木{color:var(--moku)}
.g-火{color:var(--ka)}
.g-土{color:var(--do)}
.g-金{color:var(--kin)}
.g-水{color:var(--sui)}
.jusei-list{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:8px;margin-top:14px}
.jusei-item{border:1px solid var(--line);border-radius:10px;padding:10px 12px;background:var(--bg)}
.jusei-item .lab{font-size:.72rem;color:var(--sub)}
.jusei-item .nm{font-size:1.02rem;font-weight:600}
.bar{height:5px;border-radius:3px;background:var(--line);margin-top:6px;overflow:hidden}
.bar>i{display:block;height:100%;background:var(--accent)}
/* 従星のエネルギーは 1〜12 の離散値なので、インライン style を使わずクラスで表す */
.bar>i.lv1{width:8.3%}
.bar>i.lv2{width:16.7%}
.bar>i.lv3{width:25%}
.bar>i.lv4{width:33.3%}
.bar>i.lv5{width:41.7%}
.bar>i.lv6{width:50%}
.bar>i.lv7{width:58.3%}
.bar>i.lv8{width:66.7%}
.bar>i.lv9{width:75%}
.bar>i.lv10{width:83.3%}
.bar>i.lv11{width:91.7%}
.bar>i.lv12{width:100%}

table{width:100%;border-collapse:collapse;font-size:.86rem}
th,td{text-align:left;padding:8px 10px;border-bottom:1px solid var(--line);white-space:nowrap}
th{color:var(--sub);font-weight:600;font-size:.78rem;letter-spacing:.04em}
td.strong{font-weight:600}
tbody tr:hover{background:var(--bg)}
.scroll{overflow-x:auto;-webkit-overflow-scrolling:touch}
.kv{display:grid;grid-template-columns:auto 1fr;gap:4px 14px;font-size:.9rem;margin:0}
.kv dt{color:var(--sub);font-size:.82rem}
.kv dd{margin:0}
.badge{display:inline-block;border:1px solid var(--line);border-radius:6px;padding:1px 8px;font-size:.78rem;background:var(--bg)}
.warn{
  background:var(--accent-soft);border:1px solid var(--accent);border-radius:8px;
  padding:10px 12px;font-size:.84rem;margin-top:12px;
}
footer{margin-top:32px;font-size:.78rem;color:var(--sub)}
footer h4{font-size:.82rem;margin:16px 0 4px;color:var(--text)}
footer ul{margin:4px 0;padding-left:1.2em}
@media (max-width:560px){
  th,td{padding:7px 8px}
  .wrap{padding:16px 12px 56px}
  /* 狭い画面では入力欄とボタンを1列に積む。
     ボタンのラベルが長いと横に溢れるので幅を親に合わせる。
     こちらも `.row>` から書く（上の指定と詳細度をそろえないと積まれない）。 */
  .row>div,.row>.col-lg,.row>.col-xl,.row>.col-auto{flex:1 1 100%}
  button.go,button.ghost{width:100%}
}

/* ===== 陰占（左）と陽占（右）の並び ===== */
.charts{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:20px;align-items:start;margin-top:8px}
.chart-col{min-width:0}
@media (max-width:720px){.charts{grid-template-columns:1fr}}

/* 陰占は縦組みの表。列が柱（時・日・月・年）、行が天干・地支・蔵干3段 */
table.inzan td{text-align:center;font-size:1.05rem}
table.inzan thead th{text-align:center}
table.inzan tbody th{text-align:right;color:var(--sub);font-size:.75rem;font-weight:600;white-space:nowrap}
table.inzan td.used{background:var(--accent-soft);font-weight:700;color:var(--accent)}

/* ===== バッジ列 ===== */
.badges{display:flex;flex-wrap:wrap;gap:6px;margin-bottom:14px}
.badge.b-main{border-color:var(--accent);color:var(--accent);font-weight:600}
.badge.b-moon{border-color:var(--sui);color:var(--sui)}
.badge.b-ijou{border-color:var(--do);color:var(--do);font-weight:600}

/* ===== 天中殺の行を目立たせる ===== */
tbody tr.tcs-row{background:var(--accent-soft)}
tbody tr.tcs-row td{font-weight:600}
/* 一覧のうち「いま指定している期間」の行を分かるようにする */
tbody tr.now-row td:first-child{position:relative;font-weight:700}
tbody tr.now-row td:first-child::before{
  content:'';position:absolute;left:0;top:3px;bottom:3px;width:3px;background:var(--accent);border-radius:2px;
}

/* ===== 検索結果の行はクリックで命式へ ===== */
tbody tr.clickable{cursor:pointer}
tbody tr.clickable:hover,tbody tr.clickable:focus-visible{background:var(--accent-soft);outline:none}
td.daycell{font-weight:600;white-space:nowrap}

/* 見つかった日付を上に並べるチップ */
.dates{display:flex;flex-wrap:wrap;gap:6px;margin:0 0 10px}
.daychip{
  appearance:none;font:inherit;font-size:.85rem;cursor:pointer;
  background:var(--bg);color:var(--accent);border:1px solid var(--line);
  border-radius:8px;padding:4px 10px;
}
.daychip:hover{background:var(--accent-soft);border-color:var(--accent)}

/* ===== 用語の説明タブ ===== */
#pane-guide h3{color:var(--accent);font-size:1rem;margin-top:24px;letter-spacing:.04em}
#pane-guide p{font-size:.9rem;margin:4px 0}
#pane-guide .lead{font-size:.95rem;margin-bottom:4px}
#pane-guide .sub{font-size:.84rem;color:var(--sub)}
ul.terms{font-size:.88rem;margin:6px 0 0;padding-left:1.2em}
ul.terms li{margin-bottom:3px}
ul.terms b{color:var(--text)}

/* ===== 八門法（五行を十字に置く）===== */
.hachimon{display:grid;grid-template-columns:repeat(3,1fr);gap:6px;max-width:280px;margin:0 auto}
.hm-cell{
  border:1px solid var(--line);border-radius:10px;padding:10px 4px;text-align:center;
  background:var(--bg);display:flex;flex-direction:column;gap:2px;min-height:64px;justify-content:center;
}
.hm-cell.blank{border:0;background:none}
.hm-g{font-size:.75rem;color:var(--sub)}
.hm-v{font-size:1.1rem;font-weight:600}
.hm-cell.g-木 .hm-v{color:var(--moku)}
.hm-cell.g-火 .hm-v{color:var(--ka)}
.hm-cell.g-土 .hm-v{color:var(--do)}
.hm-cell.g-金 .hm-v{color:var(--kin)}
.hm-cell.g-水 .hm-v{color:var(--sui)}

/* ===== カレンダー ===== */
.calendar{display:grid;grid-template-columns:repeat(7,1fr);gap:4px}
.cal-head{
  text-align:center;font-size:.75rem;color:var(--sub);font-weight:600;
  padding:4px 0;border-bottom:1px solid var(--line);
}
.cal-cell{
  border:1px solid var(--line);border-radius:8px;padding:5px 3px;min-height:58px;
  display:flex;flex-direction:column;align-items:center;gap:1px;cursor:pointer;background:var(--bg);
}
.cal-cell.empty{border:0;background:none;cursor:default;min-height:0}
.cal-cell:hover,.cal-cell:focus-visible{border-color:var(--accent);outline:none}
.cal-cell.hit{background:var(--accent-soft);border-color:var(--accent)}
.cal-cell.ijou{border-style:dashed}
.cal-d{font-size:.85rem;font-weight:600}
.cal-k{font-size:.68rem;color:var(--sub)}
.cal-m{font-size:.75rem;color:var(--accent);letter-spacing:.05em}

/* 吉日・凶日・祝日。マスが狭いので、名前は小さい札にして縦に積む */
.cal-tags{display:flex;flex-direction:column;align-items:center;gap:1px;margin-top:1px;width:100%}
.cal-tag{
  font-size:.56rem;line-height:1.5;font-weight:700;letter-spacing:0;
  max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
}
.cal-tag-tensha{color:var(--ka)}
.cal-tag-kichi{color:var(--do)}
.cal-tag-kyou{color:var(--sub);font-weight:400}
.cal-tag-holiday{color:var(--ka);font-weight:400}
.cal-cell.kichi{background:color-mix(in srgb,var(--do) 9%,var(--bg))}
.cal-cell.tensha{border-color:var(--ka);box-shadow:inset 0 0 0 1px var(--ka)}
.cal-cell.holiday .cal-d{color:var(--ka)}
.cal-cell.kyou .cal-d{text-decoration:underline dotted}
/* 条件に合う日の色を、吉日の色より優先する */
.cal-cell.hit{background:var(--accent-soft)}

@media (max-width:560px){
  .cal-cell{min-height:48px;padding:3px 1px}
  .cal-k{font-size:.6rem}
  .cal-d{font-size:.78rem}
  .cal-tag{font-size:.5rem}
}

/* ===== 相性の入力行 ===== */
.ai-row{margin-bottom:8px}

/* ===== AI解説の表示 ===== */
.ai-out{
  margin-top:14px;padding:16px 18px;border:1px solid var(--line);border-radius:12px;
  background:var(--bg);font-size:.92rem;line-height:1.9;
}
.ai-out p{margin:0 0 10px}
.ai-out .ai-h{margin:18px 0 6px;color:var(--accent);font-size:1rem;letter-spacing:.03em}
.ai-out h5.ai-h{font-size:.92rem;color:var(--text)}
.ai-out :first-child{margin-top:0}

/* ===== 相性の総当たり表 ===== */
#aiMatrix td{text-align:center;font-weight:600;cursor:help}
#aiMatrix th{text-align:center;white-space:nowrap}
#aiMatrix td.mx-self{color:var(--sub);font-weight:400}
#aiMatrix td.mx-同{color:var(--do)}
#aiMatrix td.mx-育{color:var(--moku)}
#aiMatrix td.mx-受{color:var(--sui)}
#aiMatrix td.mx-推{color:var(--ka)}
#aiMatrix td.mx-被{color:var(--kin)}

/* 相性の「読み方」行 */
tr.reading-row td{background:var(--bg);padding-top:0}
ul.reading{margin:0;padding-left:1.2em;font-size:.84rem;color:var(--sub);white-space:normal}
ul.reading li{margin:2px 0}
#aiTable td{white-space:normal}

/* ===== カード（メンバー一覧・相性）=====
   横に長い表をやめて、幅に応じて折り返すカードにする。横スクロールを出さないため。 */
.cards{display:grid;grid-template-columns:repeat(auto-fill,minmax(260px,1fr));gap:12px;margin-top:6px}
.card{
  border:1px solid var(--line);border-radius:12px;padding:13px 14px;background:var(--bg);
  display:flex;flex-direction:column;gap:8px;
}
.card.clickable{cursor:pointer}
.card.clickable:hover,.card.clickable:focus-visible{border-color:var(--accent);outline:none}
.card-head{display:flex;align-items:baseline;gap:8px;flex-wrap:wrap}
.card-name{font-weight:600;font-size:.98rem}
.card-sub{font-size:.76rem;color:var(--sub)}
.card-badge{
  margin-left:auto;font-size:.78rem;font-weight:600;
  border:1px solid var(--line);border-radius:999px;padding:2px 10px;
}
.card-center{display:flex;align-items:baseline;gap:8px;flex-wrap:wrap}
.card-center>span:first-child{font-size:1.05rem;font-weight:600}
.card-role{font-size:.78rem;color:var(--sub);flex:1 1 100%}
.card-dl{display:grid;grid-template-columns:auto 1fr;gap:2px 10px;margin:0;font-size:.82rem}
.card-dl dt{color:var(--sub);white-space:nowrap}
.card-dl dd{margin:0;word-break:break-word}
.card ul.reading{margin:2px 0 0;padding-left:1.1em;font-size:.79rem;color:var(--sub)}

/* 保存した人だけは1行に収める。相性ページのカードとは別扱い */
.cards.people{display:flex;flex-wrap:wrap;gap:6px}
.card.person{
  flex:0 1 auto;flex-direction:row;align-items:center;gap:8px;
  padding:5px 6px 5px 11px;border-radius:999px;max-width:100%;
}
.card.person .card-name{font-size:.9rem;white-space:nowrap}
.card.person .card-sub{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.card.person .card-rel{
  font-size:.72rem;color:var(--sub);white-space:nowrap;
  border:1px solid var(--line);border-radius:999px;padding:0 7px;
}
/* 記録の一覧。カードの中に「いつ」と「共有あり」を小さく出す */
.card.hist{position:relative;gap:5px;padding-right:34px}
.card.hist .card-sub{
  display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;
  line-height:1.6;
}
.card-when{font-size:.7rem;color:var(--sub)}
.card.hist .card-rel{
  font-size:.66rem;color:var(--accent);align-self:flex-start;
  border:1px solid var(--accent);border-radius:999px;padding:0 7px;
}
.card.hist .card-del{position:absolute;top:9px;right:8px}

/* 削除は小さな×に。押しやすさは確保する */
.card-del{
  appearance:none;font:inherit;font-size:.9rem;line-height:1;cursor:pointer;
  background:none;border:0;color:var(--sub);border-radius:50%;
  width:22px;height:22px;flex:0 0 auto;display:grid;place-items:center;
}
.card-del:hover,.card-del:focus-visible{background:var(--accent-soft);color:var(--accent);outline:none}
@media (max-width:560px){
  .cards.people{gap:5px}
  .card.person{flex:1 1 100%}
}

/* 数理法は干10列＋合計で幅を食う。陰占・陽占と同じく半分の幅に置いているので、
   枠から数pxはみ出して横スクロールが出ていた。文字とパディングを詰めて収める。 */
#mSuuri{font-size:.79rem}
#mSuuri th,#mSuuri td{padding:6px 3px;text-align:center}
#mSuuri th:first-child,#mSuuri td:first-child{text-align:left}

/* 総当たり表は狭い画面でも収まるよう詰める */
#aiMatrix{font-size:.82rem}
#aiMatrix th,#aiMatrix td{padding:5px 4px}
@media (max-width:560px){
  #aiMatrix{font-size:.74rem}
  #aiMatrix th,#aiMatrix td{padding:4px 2px}
}


/* ===== 狭い画面では表をカードとして積む（横スクロールを出さない）=====
   各セルには JS が data-label で見出しを入れてある。 */

/* カレンダーの月移動は常に横並び */
.cal-nav{display:flex;align-items:center;gap:8px}
.cal-nav input{flex:1 1 auto;min-width:0}
.cal-nav button.nav{flex:0 0 auto;padding:9px 16px;font-size:1rem;line-height:1}

/* 狭い画面の詰め直し */
@media (max-width:560px){
  /* タブは折り返さず1行に収める */
  .tabs{gap:0;flex-wrap:nowrap;overflow-x:auto;-webkit-overflow-scrolling:touch}
  .tabs::-webkit-scrollbar{display:none}
  .tabs button{padding:9px 8px;font-size:.79rem;white-space:nowrap;flex:0 0 auto}
  /* 全幅ボタンの例外（月移動） */
  .cal-nav button.nav{width:auto}
  /* 見出しと余白を少し詰める */
  h1{font-size:1.25rem}
  .tagline{font-size:.78rem}
  .panel{padding:14px 13px}
  .panel h2{font-size:1rem}
  .panel h3{margin:16px 0 6px}
  .cards{grid-template-columns:1fr;gap:10px}
  .badges .badge{font-size:.74rem;padding:1px 7px}
  .jintai{gap:5px}
  .cell{min-height:74px;padding:8px 3px}
  .cell .star{font-size:1rem}
  .cell .src{font-size:.6rem}
  .cell .pos{font-size:.62rem}
  .hachimon{max-width:230px}
}

/* かなり狭い画面ではタブのラベルを短くして1行に収める */
@media (max-width:480px){
  .tabs{overflow-x:visible}
  .tabs button{font-size:0;padding:9px 4px;flex:1 1 auto}
  .tabs button::after{content:attr(data-short);font-size:.84rem}
}

/* ===== 狭い画面でも表のまま読めるように詰める =====
   カードに積み替えると視線の流れが崩れて読みにくかったので、
   文字と余白を詰めて表の形を保つ方針にしている。 */
@media (max-width:640px){
  .scroll{overflow-x:auto}
  table{font-size:.76rem}
  th,td{padding:5px 4px}
  /* 長くなりがちな列は折り返す */
  #sTable td:nth-child(5),#sTable td:nth-child(6),
  #mUn td,#mDaiun td{white-space:normal}
  /* 狭い画面では優先度の低い列を隠す */
  .hide-sm{display:none}
}
@media (max-width:420px){
  table{font-size:.71rem}
  th,td{padding:4px 3px}
}

/* 陰占は列幅をそろえて中央に置く */
table.inzan{table-layout:fixed;width:100%}
table.inzan th:first-child{width:3.6em}
table.inzan thead th{text-align:center;font-size:.74rem}
table.inzan td,table.inzan tbody th{padding:6px 2px}
table.inzan td{font-size:1.02rem}
@media (max-width:640px){
  table.inzan{font-size:.9rem}
  table.inzan th:first-child{width:3.2em}
  table.inzan td{font-size:.98rem}
}

tbody tr.dim-row td{color:var(--sub)}

/* 行動領域（陰占チャート） */
.koudou{display:flex;justify-content:center;color:var(--accent)}
.koudou-svg{width:100%;max-width:330px;height:auto}

button.ghost.small{padding:3px 10px;font-size:.78rem;align-self:flex-start}
#authPanel .cards{margin-top:10px}

/* 六親法の家系図。横スクロールが出ないよう折り返しで組む */
.kakeizu{margin:6px 0 14px}
.kakeizu .gen{
  display:flex;align-items:center;gap:10px;flex-wrap:wrap;
  padding:9px 0;border-bottom:1px dashed var(--line);
}
.kakeizu .gen:last-child{border-bottom:0}
.kakeizu .gen-label{
  flex:0 0 4.6em;font-size:.74rem;color:var(--sub);letter-spacing:.04em;
}
.kakeizu .cells{display:flex;gap:8px;flex-wrap:wrap;flex:1 1 auto;min-width:0}
.kakeizu .kcell{
  display:flex;flex-direction:column;align-items:center;justify-content:center;
  min-width:60px;padding:6px 8px;border:1px solid var(--line);border-radius:9px;
  background:var(--panel);line-height:1.35;
}
.kakeizu .kcell b{font-size:1.16rem;font-weight:600}
.kakeizu .kcell span{font-size:.7rem;color:var(--sub);white-space:nowrap}
.kakeizu .kcell.self{border-color:var(--accent);background:var(--accent-soft)}
.kakeizu .kcell.self b{color:var(--accent)}
.kakeizu .kcell.none{border-style:dashed;opacity:.55}
.kakeizu .kcell.none b{font-size:.86rem;font-weight:400;color:var(--sub)}
@media (max-width:520px){
  .kakeizu .gen{gap:6px}
  .kakeizu .gen-label{flex-basis:100%}
  .kakeizu .kcell{min-width:52px;padding:5px 6px}
}


/* ログインのダイアログ */
.dlg{
  border:1px solid var(--line);border-radius:12px;background:var(--panel);color:var(--text);
  padding:0;max-width:min(440px,calc(100vw - 32px));width:100%;box-shadow:var(--shadow);
}
.dlg::backdrop{background:rgba(0,0,0,.45)}
.dlg-inner{padding:20px}
.dlg-inner h2{font-size:1.05rem;margin:0 0 10px;letter-spacing:.04em;font-weight:600}
.dlg-inner .mt{margin-top:12px}

/* 運を左右に並べて見る。狭い画面では上下に積む */
.runs{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:18px;align-items:start;margin-top:8px}
.run-col{min-width:0}
.run-col>select{margin-bottom:8px}
/* 列が多いので、半分の幅に収まるよう詰める */
.run-table{font-size:.79rem}
.run-table th,.run-table td{padding:6px 5px}
.run-table td:last-child{white-space:normal;color:var(--sub);font-size:.74rem;line-height:1.45}
@media (max-width:760px){
  .runs{grid-template-columns:minmax(0,1fr);gap:22px}
  .run-table{font-size:.84rem}
}

/* 前後送りのボタン列 */
.run-nav{display:flex;align-items:center;gap:6px;flex-wrap:wrap;margin:8px 0 6px}
.run-nav .run-range{font-size:.82rem;font-weight:600;min-width:7em}
.run-nav .run-count{width:auto;flex:0 0 auto;padding:3px 8px;font-size:.78rem}
.run-nav button[disabled]{opacity:.35;cursor:default}

/* ===== 広い画面では本文の右にカレンダーを出しっぱなしにする =====
   狭い画面ではこれまでどおりタブで切り替える。JS が calBlock を行き来させる。 */
.layout{display:block}
.layout-side{display:none}
@media (min-width:1180px){
  .wrap{max-width:1340px}
  .layout{display:grid;grid-template-columns:minmax(0,1fr) 296px;gap:24px;align-items:start}
  .layout-side{display:block;position:sticky;top:16px}
}
/* 右に出したときは全体を小ぶりにする */
.layout-side .panel{padding:14px;margin-top:0}
.layout-side .panel + .panel{margin-top:14px}
.layout-side h2{font-size:.95rem;margin-bottom:10px}
.layout-side h3{margin:12px 0 6px}
.layout-side .note{font-size:.72rem}
.layout-side .chips label{padding:3px 9px;font-size:.76rem}
.layout-side .cal-nav{gap:5px}
.layout-side .cal-nav button.nav{padding:4px 9px;font-size:.85rem}
.layout-side .cal-nav input{padding:5px 7px;font-size:.82rem}
.layout-side .calendar{gap:2px}
.layout-side .cal-cell{min-height:34px;padding:2px 0;border-radius:6px}
.layout-side .cal-head{font-size:.62rem}
.layout-side .cal-d{font-size:.72rem}
.layout-side .cal-k{font-size:.54rem}
.layout-side .cal-m{font-size:.6rem;letter-spacing:0}
/* 右の小カレンダーは幅が無いので、吉日の名前は出さず色と枠だけで示す */
.layout-side .cal-tags{display:none}


/* ===== 相性カードの中に入れる小さい図 ===== */
.mini-h{font-size:.7rem;color:var(--sub);letter-spacing:.06em;margin:10px 0 4px;font-weight:600}
.card .mini-h:first-of-type{margin-top:6px}

table.mini-inzan{width:100%;table-layout:fixed;font-size:.78rem}
table.mini-inzan th,table.mini-inzan td{padding:3px 2px;text-align:center;border-bottom:1px solid var(--line)}
table.mini-inzan th:first-child{width:2.8em;text-align:left;color:var(--sub);font-size:.68rem}
table.mini-inzan thead th{font-size:.66rem;color:var(--sub)}

.mini-jintai{display:grid;grid-template-columns:repeat(3,1fr);gap:3px}
.mini-cell{
  border:1px solid var(--line);border-radius:6px;background:var(--panel);
  padding:5px 1px;text-align:center;font-size:.76rem;font-weight:600;
}
.mini-cell.ju{border-style:dashed;font-weight:400}
.mini-cell.ju span{color:var(--sub)}

.mini-bars{display:flex;flex-direction:column;gap:3px}
.mini-bar{display:flex;align-items:center;gap:6px;font-size:.72rem}
.mini-bar-k{width:1.2em;font-weight:600}
.mini-bar-t{flex:1 1 auto;height:5px;border-radius:3px;background:var(--line);overflow:hidden}
.mini-bar-t>i{display:block;height:100%;background:currentColor;opacity:.7}
.mini-bar-v{width:2.6em;text-align:right;color:var(--sub);font-variant-numeric:tabular-nums}
.mini-bar-t>i.w0{width:0%}
.mini-bar-t>i.w5{width:5%}
.mini-bar-t>i.w10{width:10%}
.mini-bar-t>i.w15{width:15%}
.mini-bar-t>i.w20{width:20%}
.mini-bar-t>i.w25{width:25%}
.mini-bar-t>i.w30{width:30%}
.mini-bar-t>i.w35{width:35%}
.mini-bar-t>i.w40{width:40%}
.mini-bar-t>i.w45{width:45%}
.mini-bar-t>i.w50{width:50%}
.mini-bar-t>i.w55{width:55%}
.mini-bar-t>i.w60{width:60%}
.mini-bar-t>i.w65{width:65%}
.mini-bar-t>i.w70{width:70%}
.mini-bar-t>i.w75{width:75%}
.mini-bar-t>i.w80{width:80%}
.mini-bar-t>i.w85{width:85%}
.mini-bar-t>i.w90{width:90%}
.mini-bar-t>i.w95{width:95%}
.mini-bar-t>i.w100{width:100%}

.mini-koudou{display:flex;justify-content:center;color:var(--accent);margin-top:2px}

/* 相手の行。消すボタンぶんの余白をとる */
.ai-row{align-items:flex-end}
.ai-row .ai-clear{align-self:flex-end;margin-bottom:1px}
@media (max-width:560px){
  .ai-row{padding-bottom:6px;border-bottom:1px dashed var(--line)}
}

/* 相性の入力を「自分」と「相手」で囲って分ける */
fieldset.ai-block{
  border:1px solid var(--line);border-radius:10px;padding:12px 14px 14px;margin:14px 0 0;
}
fieldset.ai-block>legend{
  font-size:.85rem;font-weight:600;color:var(--accent);padding:0 6px;letter-spacing:.04em;
}
fieldset.ai-block .note{margin-top:0}
/* チップに「何が起きるか」を書いておく。押し間違いを防ぐため */
.chip-act{
  font-size:.66rem;color:var(--accent);border:1px solid var(--line);
  border-radius:999px;padding:1px 7px;white-space:nowrap;
}
.card.person.self .chip-act{border-color:var(--accent)}

/* メンバーのカードは、左右で見比べられるよう各段の高さをそろえる。
   カードの中身は必ず13ブロックなので、subgrid で親の行に合わせる。 */
.cards.members{grid-auto-rows:auto}
@supports (grid-template-rows: subgrid){
  .cards.members{grid-template-rows:repeat(13,auto)}
  .cards.members>.card{grid-row:span 13;display:grid;grid-template-rows:subgrid;align-content:start}
}

/* 間柄の切替。読むところのすぐ上に置く */
.mode-bar{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin:2px 0 4px}
.mode-bar .mode-lab{font-size:.78rem;color:var(--sub);white-space:nowrap}

/* ===== 狭い画面：右上に居座る3本線と、そこから開くメニュー ===== */
.tab-menu-btn{display:none}
.tab-menu-back{display:none}
@media (max-width:700px){
  /* 画面の右上に貼り付いて、スクロールしても付いてくる */
  .tab-menu-btn{
    display:grid;place-items:center;position:fixed;top:10px;right:10px;z-index:60;
    width:44px;height:44px;padding:0;cursor:pointer;appearance:none;
    background:var(--panel);border:1px solid var(--line);border-radius:11px;box-shadow:var(--shadow);
  }
  /* 3本線。開いているときは×に変わる */
  .tab-menu-icon,.tab-menu-icon::before,.tab-menu-icon::after{
    display:block;width:19px;height:2px;border-radius:2px;background:var(--text);
    transition:transform .18s ease, opacity .18s ease;
  }
  .tab-menu-icon{position:relative}
  .tab-menu-icon::before,.tab-menu-icon::after{content:'';position:absolute;left:0}
  .tab-menu-icon::before{top:-6px}
  .tab-menu-icon::after{top:6px}
  .tab-menu-btn.is-open .tab-menu-icon{background:transparent}
  .tab-menu-btn.is-open .tab-menu-icon::before{transform:translateY(6px) rotate(45deg)}
  .tab-menu-btn.is-open .tab-menu-icon::after{transform:translateY(-6px) rotate(-45deg)}

  /* 後ろを覆う幕。ここを押すと閉じる */
  .tab-menu-back{display:block;position:fixed;inset:0;z-index:55;background:rgba(0,0,0,.35)}
  .tab-menu-back[hidden]{display:none}
  body.menu-open{overflow:hidden}

  .tabs{
    display:none;flex-direction:column;gap:0;margin:0;border-bottom:0;
    position:fixed;top:62px;right:10px;z-index:58;
    width:min(240px,calc(100vw - 20px));
    border:1px solid var(--line);border-radius:12px;overflow:hidden;
    background:var(--panel);box-shadow:var(--shadow);
  }
  .tabs.open{display:flex}
  .tabs button{
    text-align:left;padding:13px 16px;border-bottom:1px solid var(--line);
    border-left:3px solid transparent;font-size:.95rem;
  }
  .tabs button:last-child{border-bottom:0}
  .tabs button[aria-selected="true"]{
    border-bottom-color:var(--line);border-left-color:var(--accent);
    background:var(--bg);font-weight:600;
  }
  .tabs button:last-child[aria-selected="true"]{border-bottom-color:transparent}
  /* 480px用の「ラベルを短くする」指定を打ち消す。縦のメニューでは全文を出す */
  .tabs button{font-size:.95rem}
  .tabs button::after{content:none}

  /* 見出しの右上がボタンの下に潜らないように空ける */
  header{padding-right:52px}
}

/* 右の小カレンダーの前後送り */
.cal-nav.mini{justify-content:space-between;margin-bottom:8px}
.cal-nav.mini>span{font-size:.9rem;font-weight:600}

/* 相性カードの「さらに詳しく読む」 */
.pair-detail{margin-top:10px;border-top:1px solid var(--line);padding-top:8px}
.pair-detail>summary{
  cursor:pointer;list-style:none;font-size:.82rem;font-weight:600;color:var(--accent);
  display:flex;align-items:center;gap:6px;
}
.pair-detail>summary::-webkit-details-marker{display:none}
.pair-detail>summary::after{content:'▾';font-size:.8em;font-weight:400}
.pair-detail[open]>summary::after{content:'▴'}
.pair-detail-h{
  margin:12px 0 3px;font-size:.78rem;color:var(--sub);letter-spacing:.05em;font-weight:600;
}
.pair-detail p{margin:0;font-size:.84rem;line-height:1.85}

/* 出力の上下に置く操作バー */
.out-bar{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin:12px 0 6px}
.out-bar-end{margin:6px 0 0;justify-content:flex-end}
.out-bar-lab{font-size:.78rem;color:var(--sub);margin-right:auto}
.out-bar input[type=text]{flex:1 1 220px;min-width:0;font-size:.82rem}
/* 共有ページを作れなかったときの一言。枠は同じで色だけ変える */
.note.err-note{color:var(--accent)}
.share-out{
  margin-top:12px;padding:12px 14px;border:1px solid var(--line);border-radius:10px;background:var(--bg);
}
.share-out .note{margin-top:0}
button.ghost.small.done{border-color:var(--accent);color:var(--accent);font-weight:600}

/* コピー用の隠し枠。画面に見えず、スクロールも動かさない */
.copy-hidden{position:fixed;top:0;left:0;width:1px;height:1px;opacity:0;border:0;padding:0}

/* ===== AI解説の区切りを分かりやすくする ===== */
.ai-out h4.ai-h{
  margin:26px 0 8px;padding:6px 0 6px 12px;
  border-left:4px solid var(--accent);
  font-size:1.02rem;color:var(--text);font-weight:700;letter-spacing:.02em;
  background:linear-gradient(to right,var(--accent-soft),transparent 70%);
  border-radius:0 6px 6px 0;
}
.ai-out h5.ai-h{
  margin:20px 0 4px;font-size:.92rem;color:var(--accent);font-weight:700;
  padding-bottom:3px;border-bottom:1px dashed var(--line);
}
.ai-out h4.ai-h:first-child,.ai-out h5.ai-h:first-child{margin-top:0}
.ai-out hr.ai-rule{
  border:0;border-top:1px solid var(--line);margin:22px 0;
}

/* ===== 鑑定レポート ===== */
.report{
  margin-top:14px;padding:20px 22px;border:1px solid var(--line);border-radius:12px;
  background:var(--bg);line-height:1.9;
}
.report .report-title{
  margin:0 0 18px;padding-bottom:10px;border-bottom:2px solid var(--accent);
  font-size:1.15rem;font-weight:700;letter-spacing:.02em;
}
.report .report-sec{
  margin:30px 0 8px;padding:7px 0 7px 13px;
  border-left:4px solid var(--accent);border-radius:0 6px 6px 0;
  background:linear-gradient(to right,var(--accent-soft),transparent 70%);
  font-size:1.02rem;font-weight:700;
}
.report .report-block:first-of-type>.report-sec{margin-top:0}
/* 章は details/summary で畳める。JavaScript を切っていても開閉できる */
.report .report-block{margin:0}
.report summary.report-sec{
  cursor:pointer;list-style:none;display:flex;align-items:center;gap:8px;
  user-select:none;
}
.report summary.report-sec::-webkit-details-marker{display:none}
.report summary.report-sec::before{
  content:'';flex:0 0 auto;width:0;height:0;
  border-left:6px solid currentColor;border-top:4px solid transparent;border-bottom:4px solid transparent;
  transition:transform .15s ease;
}
.report details[open]>summary.report-sec::before{transform:rotate(90deg)}
.report summary.report-sec:hover{background:linear-gradient(to right,var(--accent-soft),transparent 85%)}
.report summary.report-sec:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.report .report-count{
  margin-left:auto;flex:0 0 auto;
  font-size:.7rem;font-weight:400;color:var(--sub);letter-spacing:0;
}
.report .report-memo-mark{
  flex:0 0 auto;padding:1px 7px;border:1px dashed var(--accent);border-radius:99px;
  font-size:.66rem;font-weight:400;color:var(--accent);letter-spacing:0;
}
.report .report-lead{font-size:.82rem;color:var(--sub);margin:8px 0 12px}
.report .report-item{
  margin:0 0 12px;padding:10px 13px;border:1px solid var(--line);border-radius:9px;background:var(--panel);
}
.report .report-h{font-size:.88rem;font-weight:700;color:var(--accent);margin-bottom:3px}
.report .report-item p{margin:0;font-size:.88rem}
/* 教育の干支・教育の星のバッジ。口伝が出どころなので、他と色を分けておく */
.badge.b-kyouiku{border-style:dashed;color:var(--moku);border-color:var(--moku)}
/* 適性は星の意味を掛け合わせた見立てなので、これも枠を破線にしておく */
.badge.b-tekisei{border-style:dashed;color:var(--sui);border-color:var(--sui)}

/* --- 日付に付ける札（祝日・吉日・凶日） --- */
.tag{
  display:inline-block;margin-left:5px;padding:0 6px;border-radius:99px;
  font-size:.66rem;font-weight:700;line-height:1.7;white-space:nowrap;vertical-align:middle;
  border:1px solid currentColor;
}
.tag-holiday{color:var(--ka)}
.tag-kichi{color:var(--do)}
.tag-kyou{color:var(--sub)}

/* --- 定位置 ---
   そのマスに本来いるべき五行の星が入っている状態。控えめに印を付ける。 */
.jintai .cell.teiichi{border-color:var(--accent);box-shadow:inset 0 0 0 1px var(--accent)}
.teiichi-mark{
  display:inline-block;margin-top:3px;padding:1px 7px;border-radius:99px;
  border:1px solid var(--accent);color:var(--accent);
  font-size:.62rem;font-weight:700;letter-spacing:.04em;line-height:1.6;
}
@media print{ .jintai .cell.teiichi{box-shadow:none;border-color:#7a2323} }

/* --- 質問と答え --- */
.note-dirty{color:var(--accent);font-weight:700}
.qa{margin-top:14px}
.qa-item{
  margin:0 0 18px;padding:14px 16px;
  border:1px solid var(--line);border-radius:12px;background:var(--bg);
}
.qa-q{
  margin:0 0 10px;padding:0 0 10px 12px;
  border-left:4px solid var(--accent);border-bottom:1px solid var(--line);
  font-weight:700;font-size:.95rem;white-space:pre-wrap;
}
.qa-a{font-size:.92rem;line-height:1.95}
.qa-a>p{margin:0 0 10px}
.qa-a>h4,.qa-a>h5{margin:16px 0 6px}
.qa-a>*:first-child{margin-top:0}
.qa-err{color:var(--accent)}

/* --- 図表の下に差し込むレポートの章 ---
   レポート欄と同じ見た目にそろえたいので、.report と同じ指定を当てる。 */
.rep-slot{margin:10px 0 4px}
.rep-slot .report-block{margin:0 0 6px}
.rep-slot summary.report-sec{
  cursor:pointer;list-style:none;display:flex;align-items:center;gap:8px;user-select:none;
  margin:0;padding:7px 0 7px 13px;
  border-left:4px solid var(--accent);border-radius:0 6px 6px 0;
  background:linear-gradient(to right,var(--accent-soft),transparent 70%);
  font-size:.95rem;font-weight:700;
}
.rep-slot summary.report-sec::-webkit-details-marker{display:none}
.rep-slot summary.report-sec::before{
  content:'';flex:0 0 auto;width:0;height:0;
  border-left:6px solid currentColor;border-top:4px solid transparent;border-bottom:4px solid transparent;
  transition:transform .15s ease;
}
.rep-slot details[open]>summary.report-sec::before{transform:rotate(90deg)}
.rep-slot summary.report-sec:hover{background:linear-gradient(to right,var(--accent-soft),transparent 85%)}
.rep-slot summary.report-sec:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.rep-slot .report-count{
  margin-left:auto;flex:0 0 auto;font-size:.7rem;font-weight:400;color:var(--sub);letter-spacing:0;
}
.rep-slot .report-memo-mark{
  flex:0 0 auto;padding:1px 7px;border:1px dashed var(--accent);border-radius:99px;
  font-size:.66rem;font-weight:400;color:var(--accent);letter-spacing:0;
}
.rep-slot .report-lead{font-size:.82rem;color:var(--sub);margin:8px 0 10px}
.rep-slot .report-item{
  margin:0 0 10px;padding:10px 13px;border:1px solid var(--line);border-radius:9px;background:var(--panel);
}
.rep-slot .report-h{font-size:.88rem;font-weight:700;color:var(--accent);margin-bottom:3px}
.rep-slot .report-item p{margin:0;font-size:.88rem;line-height:1.9}

/* --- 鑑定メモ（手で書き足すぶん） ---
   計算で出る本文と見分けがつくよう、枠線を破線にして色も変えてある。 */
.note-box textarea{
  width:100%;display:block;margin:0;padding:9px 11px;
  border:1px dashed var(--accent);border-radius:8px;background:var(--accent-soft);
  color:var(--text);font-family:inherit;font-size:.88rem;line-height:1.8;resize:vertical;
}
.note-box textarea:focus{outline:2px solid var(--accent);outline-offset:1px;background:var(--panel)}
.note-box textarea::placeholder{color:var(--sub);opacity:.85}
/* 印刷用の写し。画面では使わない */
.note-print{display:none}

.note-lab{
  font-size:.76rem;font-weight:700;color:var(--accent);
  letter-spacing:.04em;margin-bottom:5px;
}
.note-head{margin:0 0 22px}
.note-sec{margin:-4px 0 14px}
.note-toggle{
  border:0;background:none;padding:2px 0;cursor:pointer;
  color:var(--sub);font-family:inherit;font-size:.76rem;
}
.note-toggle:hover{color:var(--accent);text-decoration:underline}
.note-sec .note-box{margin-top:5px}

.note-tail{margin-top:28px;padding-top:16px;border-top:1px dashed var(--line)}
.note-block{margin:0 0 12px}
.note-block-head{display:flex;gap:6px;align-items:center;margin-bottom:5px;flex-wrap:wrap}
.note-block-title{
  flex:1 1 200px;min-width:0;padding:6px 10px;
  border:1px solid var(--line);border-radius:7px;background:var(--panel);
  color:var(--text);font-family:inherit;font-size:.88rem;font-weight:700;
}
.note-block-title:focus{outline:2px solid var(--accent);outline-offset:1px}
.ghost.small.danger{color:var(--accent);border-color:var(--accent)}
.note-state{margin:8px 0 0;font-size:.76rem;min-height:1.2em}
.note-state.ok{color:var(--moku)}
.note-state.bad{color:var(--accent)}

@media print{
  :root{--bg:#fff;--panel:#fff;--line:#c9c2b4;--text:#1a1a1a;--sub:#555;--accent:#7a2323}
  body{background:#fff;color:#000}
  .tabs,.tab-menu-btn,.layout-side,header .head-actions,.panel:not(#mResult),
  #mBadges,.charts,.runs,#mUn,#mSuuri,#mRokushin,#mKakeizu,#mKoudou,
  #aiExplainWrap,.out-bar,h3,#mWarn,footer{display:none !important}
  .qa,.qa-item{display:block !important;break-inside:avoid;page-break-inside:avoid}
  /* 図表は隠すが、その下に差し込んだレポートの章は紙に残す */
  .rep-slot{display:block !important;margin:0}
  .rep-slot summary.report-sec::before,.rep-slot .report-count{display:none}
  .rep-slot summary.report-sec{cursor:auto}
  .rep-slot .report-item{break-inside:avoid;page-break-inside:avoid;border-color:#ccc}
  #mResult{border:0;box-shadow:none;padding:0;margin:0}
  .report{border:0;padding:0;margin:0}
  .report .report-sec{break-after:avoid;page-break-after:avoid}
  .report summary.report-sec::before,.report .report-count{display:none}
  .report summary.report-sec{cursor:auto}
  .report .report-block{break-inside:auto}
  .report .report-item{break-inside:avoid;page-break-inside:avoid;border-color:#ccc}
  .wrap{max-width:none;padding:0}
  /* メモは紙にも残す。入力欄そのものは出さず、写しの div を文章として出す。
     textarea をそのまま印刷すると rows のぶんで切れてしまうため。 */
  .note-toggle,.note-state,.note-block-head .ghost,
  .note-box textarea{display:none !important}
  .note-print{
    display:block;border-left:3px solid #7a2323;padding:2px 0 2px 10px;
    font-size:.88rem;line-height:1.8;white-space:pre-wrap;
    break-inside:avoid;page-break-inside:avoid;
  }
  .note-print[hidden]{display:none !important}
  .note-block-title{border:0;padding:0;background:#fff;font-size:.95rem;font-weight:700}
  .note-block-title:placeholder-shown{display:none}
  .note-tail{border-top:1px solid #c9c2b4}
  .note-head,.note-sec,.note-block{break-inside:avoid;page-break-inside:avoid}
}
.card-link{text-decoration:none;color:var(--accent);border-color:var(--accent)}
.card-link:hover{background:var(--accent-soft)}

/* ===== タロット ===== */
.tarot-cards{display:grid;gap:12px;margin-top:6px}
@media (min-width:760px){ .tarot-cards{grid-template-columns:repeat(2,1fr)} }
.tcard{
  border:1px solid var(--line);border-radius:12px;padding:13px 15px;background:var(--panel);
  border-left:4px solid var(--accent);
}
.tcard.rev{border-left-style:dashed;border-left-color:var(--sub)}
.tcard-pos{font-size:.72rem;color:var(--sub);letter-spacing:.06em;font-weight:600;margin-bottom:4px}
.tcard-head{display:flex;align-items:baseline;gap:8px;flex-wrap:wrap}
.tcard-name{font-size:1.02rem;font-weight:700}
.tcard-dir{
  font-size:.66rem;font-weight:700;padding:1px 8px;border-radius:99px;
  border:1px solid currentColor;color:var(--accent);
}
.tcard.rev .tcard-dir{color:var(--sub)}
.tcard-meta{font-size:.74rem;color:var(--sub);margin:4px 0 7px}
.tcard-text{margin:0;font-size:.9rem;line-height:1.85}
@media print{ .tcard{break-inside:avoid;page-break-inside:avoid} }

/* ===== 九星気学の方位盤 ===== */
.ban{display:grid;grid-template-columns:repeat(3,1fr);gap:4px;max-width:340px;margin:6px auto}
.ban-cell{
  border:1px solid var(--line);border-radius:9px;padding:8px 4px;text-align:center;background:var(--panel);
  display:flex;flex-direction:column;gap:2px;min-height:64px;justify-content:center;
}
.ban-cell.center{border-color:var(--accent);background:var(--accent-soft)}
.ban-cell.kyou{border-style:dashed;border-color:var(--ka)}
.ban-hou{font-size:.66rem;color:var(--sub);letter-spacing:.05em}
.ban-star{font-size:.9rem;font-weight:700}
.ban-kyou{font-size:.6rem;color:var(--ka);font-weight:700;line-height:1.4}
.kstar{
  border:1px solid var(--line);border-left:4px solid var(--accent);border-radius:10px;
  padding:11px 14px;margin:0 0 10px;background:var(--panel);
}
.kstar-h{font-size:.72rem;color:var(--sub);letter-spacing:.05em;margin-bottom:3px}
.kstar-n{font-size:1.05rem;font-weight:700}
.kstar-t{margin:5px 0 0;font-size:.9rem;line-height:1.85}
/* 星の合言葉。名前のすぐ下に一言で置く */
.kstar-key{font-size:.78rem;color:var(--accent);letter-spacing:.05em;margin-top:2px}
/* 強み・気をつけること・向く仕事・開運。見出しを左に立てて並べる */
.kstar-row{display:flex;gap:9px;margin-top:7px;align-items:baseline}
/* 見出しの幅はそろえる。ばらばらだと本文の左端が揃わず読みにくい */
.kstar-lab{
  flex:0 0 8.4em;width:8.4em;font-size:.7rem;color:var(--sub);
  border:1px solid var(--line);border-radius:5px;padding:1px 6px;text-align:center;
}
.kstar-val{flex:1 1 auto;font-size:.86rem;line-height:1.8;min-width:0}
@media (max-width:600px){
  .kstar-row{display:block}
  .kstar-lab{display:inline-block;width:auto;margin-bottom:3px}
}
.badge.b-rank{margin-left:8px;vertical-align:middle}
@media print{ .ban-cell{break-inside:avoid} }

/* カレンダーの今日。色の付いた枠で分かるようにする */
.cal-cell.today{
  border-color:var(--moku);box-shadow:inset 0 0 0 2px var(--moku);
}
.cal-cell.today .cal-d{color:var(--moku);font-weight:700}
.cal-cell.today.hit{background:var(--accent-soft)}
@media print{ .cal-cell.today{box-shadow:none;border-color:#3f7d4e} }

/* ===== 姓名判断の五格の図 ===== */
.seimei-chart{margin:8px 0 4px;overflow-x:auto}
.seimei-svg{display:block;width:100%;max-width:500px;height:auto;margin:0 auto;color:var(--text)}
.sv-ch{font-size:28px;font-weight:700;fill:var(--text)}
.sv-ch.sv-rei{font-size:14px;fill:var(--sub)}
.sv-num{font-size:14px;fill:var(--sub)}
.sv-line{stroke:var(--line);stroke-width:1.4}
.sv-lab{font-size:12.5px;fill:var(--sub)}
.sv-box{fill:var(--panel);stroke:var(--line);stroke-width:1.4}
.sv-box.bad{stroke:var(--ka)}
/* 天格は単独では重く見ないので、枠も文字も控えめにする */
.sv-box.light{stroke-dasharray:4 3;stroke-opacity:.6}
.sv-kind.sv-light{opacity:.5}
.sv-box.great{stroke:var(--moku)}
.sv-n{font-size:21px;font-weight:700;fill:var(--text)}
.sv-kind{font-size:13px;font-weight:700}
.sv-kind.k-大吉{fill:var(--moku)}
.sv-kind.k-吉{fill:var(--moku)}
.sv-kind.k-半吉{fill:var(--do)}
.sv-kind.k-凶{fill:var(--ka)}

/* 五格それぞれの説明。表だと横に溢れるのでカードにする */
.kaku-list{display:grid;gap:9px}
@media (min-width:760px){ .kaku-list{grid-template-columns:repeat(2,1fr)} }
.kaku-card{
  border:1px solid var(--line);border-radius:10px;padding:11px 13px;background:var(--panel);
  border-left:3px solid var(--line);
}
.kaku-card.main{border-left-color:var(--accent)}
.kaku-h{display:flex;align-items:baseline;gap:9px;flex-wrap:wrap}
.kaku-name{font-size:.98rem;font-weight:700}
.kaku-n{font-size:1.1rem;font-weight:700;color:var(--accent)}
.kaku-kind{font-size:.68rem;font-weight:700;padding:1px 8px;border-radius:99px;border:1px solid currentColor}
.kaku-kind.k-大吉,.kaku-kind.k-吉{color:var(--moku)}
.kaku-kind.k-半吉{color:var(--do)}
.kaku-kind.k-凶{color:var(--ka)}
/* 天格の吉凶は参考なので薄く出す */
.kaku-kind.light{opacity:.5;border-style:dashed}
.kaku-role{font-size:.72rem;color:var(--sub);margin:5px 0 0}
.kaku-text{margin:6px 0 0;font-size:.87rem;line-height:1.8}

/* ===== タロットをめくる演出 =====
   引いた順に1枚ずつ、裏から表へめくれて出てくる。
   動きを減らす設定にしている人には出さない（下の prefers-reduced-motion）。 */
@keyframes tcard-deal{
  0%{ opacity:0; transform:translateY(14px) rotateY(-92deg) scale(.94) }
  55%{ opacity:1 }
  100%{ opacity:1; transform:none }
}
.tcard.deal{
  animation:tcard-deal .58s cubic-bezier(.22,.9,.3,1) both;
  transform-origin:left center;
  backface-visibility:hidden;
}
.tcard.d0{animation-delay:0s}      .tcard.d1{animation-delay:.11s}
.tcard.d2{animation-delay:.22s}    .tcard.d3{animation-delay:.33s}
.tcard.d4{animation-delay:.44s}    .tcard.d5{animation-delay:.55s}
.tcard.d6{animation-delay:.66s}    .tcard.d7{animation-delay:.77s}
.tcard.d8{animation-delay:.88s}    .tcard.d9{animation-delay:.99s}
.tcard.d10{animation-delay:1.1s}   .tcard.d11{animation-delay:1.21s}
/* 逆位置は少し傾いてから戻る。引いた瞬間に正逆が分かる */
@keyframes tcard-deal-rev{
  0%{ opacity:0; transform:translateY(14px) rotateY(92deg) scale(.94) }
  55%{ opacity:1 }
  100%{ opacity:1; transform:none }
}
.tcard.deal.rev{animation-name:tcard-deal-rev;transform-origin:right center}
/* 引いている間の合図 */
.tarot-cards.dealing{position:relative}
@media (prefers-reduced-motion:reduce){
  .tcard.deal{animation:none}
}
@media print{ .tcard.deal{animation:none} }

/* タロットの絵 */
.tcard-img{margin:8px 0 10px;text-align:center;line-height:0}
.tcard-img img{
  width:100%;max-width:260px;height:auto;border-radius:8px;
  border:1px solid var(--line);background:var(--bg);
}
/* 逆位置は絵も逆さまにする */
.tcard-img.flip img{transform:rotate(180deg)}
@media (min-width:760px){ .tcard-img img{max-width:220px} }
@media print{ .tcard-img img{max-width:150px} }

/* ===== 自分でカードを選ぶ ===== */
.tarot-deck{
  display:grid;grid-template-columns:repeat(auto-fill,minmax(78px,1fr));
  gap:8px;margin-top:10px;
}
@media (min-width:760px){ .tarot-deck{grid-template-columns:repeat(auto-fill,minmax(92px,1fr))} }

.tback{
  position:relative;padding:0;border:0;background:none;cursor:pointer;line-height:0;
  border-radius:7px;overflow:hidden;
  transition:transform .16s ease, box-shadow .16s ease;
  transform-style:preserve-3d;
}
.tback img{width:100%;height:auto;display:block;border-radius:7px;border:1px solid var(--line)}
.tback:hover:not(.taken),.tback:focus-visible:not(.taken){
  transform:translateY(-7px);
  box-shadow:0 6px 18px rgba(0,0,0,.28);
  outline:none;
}
.tback:hover:not(.taken) img,.tback:focus-visible:not(.taken) img{border-color:var(--accent)}
.tback.taken{cursor:default}
.tback.rev img{transform:rotate(180deg)}
.tback-lab{
  position:absolute;left:0;right:0;bottom:0;padding:3px 4px;
  background:var(--accent);color:#fff;font-size:.58rem;line-height:1.4;
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
}

/* 混ぜている演出。並んだ札が順にゆらいで、そのあと落ち着く */
@keyframes tback-shuffle{
  0%{ transform:translateY(0) rotate(0) }
  20%{ transform:translateY(-16px) rotate(-6deg) }
  45%{ transform:translateY(6px) rotate(5deg) }
  70%{ transform:translateY(-6px) rotate(-2deg) }
  100%{ transform:translateY(0) rotate(0) }
}
.tarot-deck.shuffling .tback{
  animation:tback-shuffle 1.4s cubic-bezier(.36,.7,.3,1) both;
}
.tarot-deck.shuffling .tback.s0{animation-delay:0s}    .tarot-deck.shuffling .tback.s1{animation-delay:.04s}
.tarot-deck.shuffling .tback.s2{animation-delay:.08s}  .tarot-deck.shuffling .tback.s3{animation-delay:.12s}
.tarot-deck.shuffling .tback.s4{animation-delay:.16s}  .tarot-deck.shuffling .tback.s5{animation-delay:.2s}
.tarot-deck.shuffling .tback.s6{animation-delay:.24s}  .tarot-deck.shuffling .tback.s7{animation-delay:.28s}
.tarot-deck.shuffling .tback.s8{animation-delay:.32s}  .tarot-deck.shuffling .tback.s9{animation-delay:.36s}
.tarot-deck.shuffling .tback.s10{animation-delay:.4s}  .tarot-deck.shuffling .tback.s11{animation-delay:.44s}

/* 選んだ瞬間。ふわっと光ってから裏返る */
@keyframes tback-flip{
  0%{ transform:rotateY(0) scale(1) }
  35%{ transform:rotateY(90deg) scale(1.1) }
  36%{ transform:rotateY(-90deg) scale(1.1) }
  100%{ transform:rotateY(0) scale(1) }
}
@keyframes tback-glow{
  0%{ box-shadow:0 0 0 0 var(--accent) }
  40%{ box-shadow:0 0 26px 8px var(--accent) }
  100%{ box-shadow:0 0 0 0 rgba(0,0,0,0) }
}
.tback.flip{ animation:tback-flip .52s ease both, tback-glow .9s ease both }

@media (prefers-reduced-motion:reduce){
  .tarot-deck.shuffling .tback{animation:none}
  .tback.flip{animation:none}
  .tback:hover:not(.taken){transform:none}
}
@media print{ #tPickPanel{display:none !important} }

/* ===== 引き方どおりの置き場所（配置図） =====
   引き方ごとに決まった形で札を並べる。形そのものが読み方の一部なので、
   一覧の前にこの形を見せる。札を押すと下の説明へ飛ぶ。 */
.tarot-board{
  display:grid;gap:10px;justify-content:center;justify-items:center;
  margin:14px auto 8px;
}
.tb-cols-1{grid-template-columns:repeat(1,minmax(0,96px))}
.tb-cols-2{grid-template-columns:repeat(2,minmax(0,96px))}
.tb-cols-3{grid-template-columns:repeat(3,minmax(0,96px))}
.tb-cols-4{grid-template-columns:repeat(4,minmax(0,96px))}
.tb-c1{grid-column:1} .tb-c2{grid-column:2} .tb-c3{grid-column:3} .tb-c4{grid-column:4}
.tb-r1{grid-row:1} .tb-r2{grid-row:2} .tb-r3{grid-row:3} .tb-r4{grid-row:4}
.tb-span2{grid-column:1 / span 2}
.tb-cell{
  position:relative;display:block;width:100%;max-width:96px;
  text-decoration:none;color:inherit;line-height:0;
}
.tb-cell img{width:100%;height:auto;display:block;border-radius:6px;border:1px solid var(--line)}
.tb-cell:hover img,.tb-cell:focus-visible img{border-color:var(--accent)}
.tb-cell.rev img{transform:rotate(180deg)}
/* 通し番号。札の左上に小さく乗せる */
.tb-no{
  position:absolute;top:-6px;left:-6px;z-index:2;
  min-width:18px;height:18px;padding:0 4px;border-radius:9px;
  background:var(--accent);color:var(--bg);
  font-size:.62rem;line-height:18px;text-align:center;font-weight:700;
}
/* 置き場所の名前。札の下に出す */
.tb-pos{
  display:block;margin-top:4px;font-size:.6rem;line-height:1.35;
  color:var(--sub);text-align:center;word-break:break-all;
}
/* 重ねる札（ケルト十字の②障害）。①の上に横向きで乗せる。
   実際の並べ方どおり真上に重ねるが、少し小さくして下の①が見えるようにする */
.tb-cross{
  align-self:center;justify-self:center;z-index:3;
  transform:rotate(90deg) scale(.84);
}
.tb-cross img{box-shadow:0 3px 12px rgba(0,0,0,.45)}
.tb-cross .tb-no{transform:rotate(-90deg);top:auto;bottom:-6px;left:-6px}
@media (max-width:600px){
  .tb-cols-3{grid-template-columns:repeat(3,minmax(0,74px))}
  .tb-cols-4{grid-template-columns:repeat(4,minmax(0,68px))}
  .tb-cell{max-width:74px}
  .tb-pos{font-size:.54rem}
}
@media (prefers-reduced-motion:reduce){ .tb-cell{transition:none} }

/* ===== 引くときの演出（ぐるぐる回して、最後にポンと止める） =====
   6枚の裏面を輪に並べ、輪ごと回す。回りながらだんだん速くなり、
   最後に中心へ集まって、ふくらんでから消える。押してから結果が出るまでの「間」を作るため。 */
.tshuffle-panel{text-align:center}
.tshuffle{padding:6px 0 2px}
.tsh-ring{
  position:relative;width:210px;height:210px;margin:0 auto;
  animation:tsh-spin 1.05s linear infinite;
}
.tsh-c{
  position:absolute;left:50%;top:50%;width:60px;height:90px;margin:-45px 0 0 -30px;
  animation:tsh-orbit 1.6s ease-in-out infinite alternate;
}
.tsh-c img{width:100%;height:100%;display:block;border-radius:6px;border:1px solid var(--line);box-shadow:0 3px 10px rgba(0,0,0,.28)}
/* 6枚を60度ずつずらして輪にする。--r は使わず、値をそのまま書く（変数だと古い端末で崩れる） */
.tsh-c.c0{transform:rotate(0deg)   translateY(-66px) rotate(0deg)}
.tsh-c.c1{transform:rotate(60deg)  translateY(-66px) rotate(-60deg)}
.tsh-c.c2{transform:rotate(120deg) translateY(-66px) rotate(-120deg)}
.tsh-c.c3{transform:rotate(180deg) translateY(-66px) rotate(-180deg)}
.tsh-c.c4{transform:rotate(240deg) translateY(-66px) rotate(-240deg)}
.tsh-c.c5{transform:rotate(300deg) translateY(-66px) rotate(-300deg)}
.tsh-c.c0,.tsh-c.c3{animation-delay:0s}
.tsh-c.c1,.tsh-c.c4{animation-delay:.18s}
.tsh-c.c2,.tsh-c.c5{animation-delay:.36s}
@keyframes tsh-spin{ to{ transform:rotate(360deg) } }
/* ゆらぎ。輪の回転とは別に、札そのものが少し伸び縮みする */
@keyframes tsh-orbit{ to{ opacity:.72 } }

/* 最後の「ポン」。輪の回転を止めて、中心へ吸い込んでからふくらませる */
.tshuffle.pop .tsh-ring{ animation:tsh-stop .62s cubic-bezier(.2,.9,.3,1.5) both }
.tshuffle.pop .tsh-c{ animation:tsh-gather .62s cubic-bezier(.5,-.2,.3,1) both }
@keyframes tsh-stop{
  0%{ transform:rotate(0deg) scale(1) }
  55%{ transform:rotate(26deg) scale(.55) }
  75%{ transform:rotate(26deg) scale(1.22) }
  100%{ transform:rotate(26deg) scale(1); opacity:0 }
}
@keyframes tsh-gather{ 60%{ opacity:1 } 100%{ opacity:.15 } }
.tsh-msg{margin:14px 0 0;font-size:.86rem;color:var(--sub);letter-spacing:.08em}

@media (prefers-reduced-motion:reduce){
  .tsh-ring,.tsh-c,.tshuffle.pop .tsh-ring,.tshuffle.pop .tsh-c{animation:none}
}
@media print{ #tShufflePanel{display:none !important} }

/* ===== 陰占から見る五行 ===== */
.gogyo-box{margin-top:10px}
/* 日干の五行。この節でいちばん先に目に入ってほしいので、大きく出す */
.gogyo-hero{
  border:2px solid currentColor;border-radius:14px;
  padding:14px 16px;margin:10px 0 14px;text-align:center;
}
.gh-lab{font-size:.7rem;letter-spacing:.1em;opacity:.75}
.gh-main{
  display:flex;align-items:center;justify-content:center;gap:14px;
  margin:6px 0 4px;flex-wrap:wrap;
}
.gh-kanbox,.gh-gbox{display:flex;flex-direction:column;align-items:center;line-height:1.05}
.gh-kan{font-size:3.1rem;font-weight:700}
.gh-yomi{font-size:.66rem;opacity:.75;margin-top:4px;letter-spacing:.04em}
.gh-arrow{font-size:1.5rem;opacity:.55}
.gh-g{font-size:3.6rem;font-weight:700}
.gh-gsub{font-size:.66rem;opacity:.75;margin-top:4px;letter-spacing:.04em}
.gh-note{font-size:.82rem;line-height:1.7;opacity:.9;margin-top:4px}
@media (max-width:420px){
  .gh-kan{font-size:2.5rem}
  .gh-g{font-size:2.9rem}
}
@media print{ .gogyo-hero{break-inside:avoid} }
.gogyo-chips{display:flex;flex-wrap:wrap;gap:5px;margin-bottom:8px}
.gogyo-chip{
  display:inline-flex;flex-direction:column;align-items:center;gap:0;
  border:1px solid currentColor;border-radius:8px;padding:3px 8px;min-width:44px;
}
.gc-src{font-size:.56rem;opacity:.7;line-height:1.3}
.gc-ch{font-size:.95rem;font-weight:700;line-height:1.3}
.gc-g{font-size:.56rem;opacity:.8;line-height:1.3}
.gogyo-tally{display:flex;flex-wrap:wrap;gap:6px;margin:8px 0}
.gt{
  display:inline-flex;align-items:baseline;gap:4px;
  border:1px solid currentColor;border-radius:999px;padding:2px 11px;
}
.gt.zero{opacity:.35;border-style:dashed}
.gt-g{font-size:.78rem;font-weight:700}
.gt-n{font-size:.95rem;font-weight:700}

/* ===== 方位ごとの見立て ===== */
.khou{
  border:1px solid var(--line);border-left:3px solid var(--line);border-radius:10px;
  padding:11px 13px;margin:10px 0;
}
.khou.good{border-left-color:var(--moku)}
.khou.bad{border-left-color:var(--ka);border-left-style:dashed}
.khou-h{display:flex;align-items:baseline;gap:8px;flex-wrap:wrap}
.khou-name{font-size:1.05rem;font-weight:700}
.khou-deg{font-size:.68rem;color:var(--sub)}
.khou-tag{
  font-size:.68rem;border:1px solid currentColor;border-radius:999px;padding:1px 8px;white-space:nowrap;
}
.k-best{color:var(--moku);font-weight:700}
.k-good{color:var(--moku)}
.k-none{color:var(--sub)}
.k-big{color:var(--ka);font-weight:700}
.k-mid{color:var(--ka)}
.k-small{color:var(--sub)}
.khou-imi{font-size:.76rem;color:var(--accent);letter-spacing:.05em;margin-top:3px}
.khou-t{margin:6px 0 0;font-size:.9rem;line-height:1.85}
.khou-row{display:flex;gap:9px;margin-top:7px;align-items:baseline}
.khou-lab{
  flex:0 0 8.4em;width:8.4em;font-size:.7rem;color:var(--sub);
  border:1px solid var(--line);border-radius:5px;padding:1px 6px;text-align:center;
}
.khou-val{flex:1 1 auto;font-size:.86rem;line-height:1.8;min-width:0}
@media (max-width:600px){
  .khou-row{display:block}
  .khou-lab{display:inline-block;width:auto;margin-bottom:3px}
}
/* 方位の使い方のまとめ */
.khou-list{margin:8px 0;padding-left:1.2em;font-size:.87rem;line-height:1.9}
.khou-list li{margin-bottom:4px}
@media print{ .khou{break-inside:avoid;page-break-inside:avoid} }
