/* =====================================================
   Fuu — AI風水診断
   White / Ivory / Beige / Cream / 淡いPink / 淡いGreen / Gold
   ===================================================== */

:root {
  --bg: #FDFBF6;
  --card: #FFFFFF;
  --ink: #4A423C;
  --ink-soft: #8C8178;
  --pink: #F5D7DC;
  --pink-deep: #E8AEB9;
  --green: #D9E6D4;
  --green-deep: #9DBB94;
  --gold: #C9A96A;
  --gold-soft: #EBDCC0;
  --cream: #F7F1E6;
  --radius: 24px;
  --shadow: 0 8px 28px rgba(120, 100, 80, .10);
  --shadow-soft: 0 4px 14px rgba(120, 100, 80, .07);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html { scroll-behavior: smooth; }
html, body { overflow-x: clip; max-width: 100%; width: 100%; }
* { box-sizing: border-box; }

/* フォーム系要素は親幅を超えて広がらない(iOS Safariのnative select/date描画対策含む) */
input, select, textarea, button { max-width: 100%; font-size: inherit; }

body {
  font-family: "Zen Maru Gothic", "Quicksand", "Hiragino Maru Gothic ProN", sans-serif;
  background:
    radial-gradient(900px 500px at 90% -10%, rgba(245,215,220,.45), transparent 60%),
    radial-gradient(800px 500px at -10% 20%, rgba(217,230,212,.4), transparent 60%),
    var(--bg);
  color: var(--ink);
  min-height: 100dvh;
  letter-spacing: .02em;
}

/* ---------- レイアウト ---------- */
#app {
  max-width: 480px;
  margin: 0 auto;
  padding: calc(72px + env(safe-area-inset-top)) 16px calc(28px + env(safe-area-inset-bottom));
}

.screen { display: none; animation: fadein .35s ease; }
.screen.active { display: block; }

@keyframes fadein {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

/* ---------- ヘッダー / ナビ ---------- */
.glass {
  background: rgba(253, 251, 246, .8);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.topbar {
  position: fixed; inset: 0 0 auto 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  min-height: 56px; padding: calc(10px + env(safe-area-inset-top)) 12px 10px;
  border-bottom: 1px solid rgba(201,169,106,.18);
}
.topbar .brand { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

.brand {
  font-family: "Quicksand", sans-serif;
  font-weight: 700; font-size: 1.15rem; letter-spacing: .08em;
  display: flex; align-items: center; gap: 6px;
  flex: 1; min-width: 0;
  border: 0; background: none; padding: 0; color: inherit; cursor: pointer; text-align: left;
}
.brand-sub { font-size: .64rem; font-weight: 500; color: var(--ink-soft); letter-spacing: .08em; margin-top: 6px; overflow: hidden; text-overflow: ellipsis; }

/* ---------- ヘッダー右側(言語切替・メニュー) ---------- */
.topbar-actions { display: flex; align-items: center; gap: 6px; flex: none; }

.lang-switch { display: flex; gap: 4px; }
.lang-btn {
  border: 1.5px solid rgba(201,169,106,.3); background: #fff;
  border-radius: 999px; padding: 7px 10px; font-family: inherit;
  font-size: .68rem; font-weight: 700; color: var(--ink-soft); cursor: pointer;
  transition: .15s; min-height: 32px;
}
.lang-btn.active { background: var(--gold-soft); border-color: var(--gold); color: var(--ink); }

.menu-wrap { position: relative; }
.menu-btn {
  width: 36px; height: 36px; border-radius: 50%;
  border: 1.5px solid rgba(201,169,106,.3); background: #fff;
  font-family: inherit; font-size: 1.1rem; font-weight: 700; line-height: 1;
  color: var(--ink-soft); cursor: pointer; transition: .15s;
  display: flex; align-items: center; justify-content: center;
}
.menu-btn[aria-expanded="true"] { background: var(--gold-soft); border-color: var(--gold); color: var(--ink); }

.menu-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 30;
  min-width: 152px; background: #fff; border-radius: 18px;
  border: 1px solid rgba(201,169,106,.18); box-shadow: var(--shadow);
  padding: 6px; display: flex; flex-direction: column; gap: 2px;
}
.menu-dropdown[hidden] { display: none; }

.nav-btn {
  border: 0; background: none; font-family: inherit; cursor: pointer; transition: .2s;
}
.nav-btn.active { color: var(--ink); background: var(--cream); }

.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  font-size: .85rem; font-weight: 600; color: var(--ink);
  padding: 12px 12px; border-radius: 12px; min-height: 44px;
}
.menu-item span:first-child { font-size: 1.05rem; }
.menu-item:active, .menu-item.active { background: var(--cream); }

/* ---------- 共通パーツ ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  padding: 22px;
  border: 1px solid rgba(201,169,106,.12);
}

.section-title { font-size: .95rem; margin: 28px 0 12px; font-weight: 700; }

.faq-list { display: flex; flex-direction: column; gap: 10px; }
.faq-item { padding: 16px 18px; cursor: pointer; }
.faq-item summary { font-size: .84rem; font-weight: 700; color: var(--ink); list-style: none; position: relative; padding-right: 24px; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; position: absolute; right: 0; top: -2px; color: var(--gold); font-weight: 700; font-size: 1.1rem; }
.faq-item[open] summary::after { content: "\2212"; }
.faq-item p { font-size: .78rem; color: var(--ink-soft); line-height: 1.85; margin-top: 10px; }
.page-title { font-size: 1.2rem; margin: 6px 0 18px; font-weight: 700; }

.cta {
  width: 100%;
  border: 0; cursor: pointer;
  margin-top: 20px;
  padding: 18px;
  border-radius: 999px;
  font-family: inherit; font-weight: 700; font-size: 1.05rem;
  color: #fff;
  background: linear-gradient(120deg, var(--pink-deep), var(--gold));
  box-shadow: 0 10px 24px rgba(232,174,185,.4);
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  transition: transform .15s ease, box-shadow .2s;
}
.cta:active { transform: scale(.97); }
.cta:disabled { opacity: .45; box-shadow: none; }
.cta-sub { font-size: .7rem; font-weight: 500; opacity: .9; }

.chip-btn {
  border: 1.5px solid var(--gold-soft);
  background: #fff; color: var(--ink);
  font-family: inherit; font-weight: 600; font-size: .9rem;
  border-radius: 999px; padding: 13px 18px; cursor: pointer;
  transition: .2s;
}
.chip-btn:active { transform: scale(.97); background: var(--cream); }
.chip-btn.wide { width: 100%; margin-top: 12px; }
.chip-btn.ghost { border-style: dashed; color: var(--ink-soft); }

.footnote { font-size: .68rem; color: var(--ink-soft); line-height: 1.7; margin-top: 18px; }

/* ---------- ホーム: 今日の運気 ---------- */
.hero { margin-top: 6px; }
.hero-date { font-size: .72rem; color: var(--ink-soft); letter-spacing: .1em; }
.hero-title { font-size: 1.05rem; margin: 2px 0 14px; }

.fortune-row { display: flex; align-items: center; gap: 20px; }

.score-ring {
  --p: 0;
  width: 108px; height: 108px; flex: none;
  border-radius: 50%;
  background: conic-gradient(var(--gold) calc(var(--p) * 1%), var(--cream) 0);
  display: grid; place-items: center;
  transition: background 1s ease;
}
.score-ring-inner {
  width: 86px; height: 86px; border-radius: 50%;
  background: #fff; display: grid; place-items: center;
  box-shadow: inset 0 2px 8px rgba(120,100,80,.08);
}
.score-num { font-family: "Quicksand", sans-serif; font-size: 1.9rem; font-weight: 700; line-height: 1; }
.score-unit { font-size: .65rem; color: var(--ink-soft); }

.fortune-luckies { display: flex; flex-direction: column; gap: 8px; flex: 1; }
.lucky {
  display: flex; justify-content: space-between; align-items: center;
  font-size: .85rem; font-weight: 600;
  background: var(--cream); border-radius: 12px; padding: 7px 12px;
}
.lucky-label { font-size: .68rem; color: var(--gold); font-weight: 700; letter-spacing: .08em; }

.fortune-message {
  margin-top: 16px; font-size: .85rem; line-height: 1.8;
  background: linear-gradient(120deg, rgba(245,215,220,.35), rgba(217,230,212,.35));
  border-radius: 16px; padding: 12px 14px;
}

/* ---------- ホーム: 無料ミニ診断(仕様書 docs/free-mini-spec.md) ---------- */
.mini-card { margin-top: 16px; }
.mini-eyebrow { font-size: .78rem; color: var(--gold); font-weight: 700; letter-spacing: .04em; }
.mini-title { font-size: 1.02rem; margin: 6px 0 14px; }
#mini-birthdate { margin-bottom: 4px; }
.mini-error { font-size: .74rem; color: #b8465a; margin: 6px 2px 0; }

.mini-gender-toggle {
  display: block; margin: 12px 0 0; padding: 0; border: 0; background: none;
  font-family: inherit; font-size: .76rem; font-weight: 600; color: var(--ink-soft);
  text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}
/* hidden属性([hidden]{display:none})が優先されるよう、非表示解除時のみ
   JSでflexを明示する(.seg2のようにdisplay:flexを常時指定すると、hidden属性を
   上書きしてトグルできなくなる)。 */
.mini-seg2 { display: flex; gap: 10px; min-width: 0; margin-top: 10px; }
.mini-seg2[hidden] { display: none; }
.mini-seg-btn {
  flex: 1; min-width: 0; border: 1.5px solid rgba(201,169,106,.25); background: #fff;
  border-radius: 14px; padding: 14px; font-family: inherit; font-weight: 700;
  font-size: .9rem; color: var(--ink); cursor: pointer; transition: .15s;
}
.mini-seg-btn.selected { background: var(--pink); border-color: var(--pink-deep); color: #7a4650; }

/* 本CTA(.cta)と視覚的に区別するセカンダリボタン(白背景+ボーダー)。
   有料CTAとの優先順位を視覚階層で明確にし、無料機能が本CTAを喰わないようにする。 */
.cta-secondary {
  width: 100%; border: 1.5px solid var(--gold); background: #fff; color: var(--ink);
  cursor: pointer; margin-top: 16px; padding: 15px; border-radius: 999px;
  font-family: inherit; font-weight: 700; font-size: .95rem;
  transition: transform .15s ease, background .2s;
}
.cta-secondary:active { transform: scale(.97); background: var(--cream); }
.cta-secondary:disabled { opacity: .55; }

.mini-result-title { font-size: .92rem; font-weight: 700; margin-bottom: 14px; }
.mini-result-grid { display: flex; gap: 10px; }
.mini-result-col {
  flex: 1; min-width: 0; text-align: center; background: var(--cream);
  border-radius: 14px; padding: 12px 8px;
}
.mini-result-col .t { font-size: .68rem; color: var(--gold); font-weight: 700; letter-spacing: .04em; }
.mini-result-col .v { font-size: 1rem; font-weight: 700; margin-top: 4px; overflow-wrap: anywhere; }
.mini-message {
  margin-top: 14px; font-size: .85rem; line-height: 1.8; text-align: center;
  background: linear-gradient(120deg, rgba(245,215,220,.35), rgba(217,230,212,.35));
  border-radius: 16px; padding: 12px 14px;
}
.mini-teaser {
  margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--gold-soft);
  font-size: .74rem; color: var(--ink-soft); line-height: 1.8; text-align: center;
}

/* ---------- ホーム: 人気改善例 / ランキング ---------- */
.hscroll {
  display: flex; gap: 12px; overflow-x: auto; padding: 4px 2px 10px;
  scrollbar-width: none;
}
.hscroll::-webkit-scrollbar { display: none; }

.pop-card {
  flex: none; width: 168px;
  background: #fff; border-radius: 20px; padding: 16px;
  box-shadow: var(--shadow-soft); border: 1px solid rgba(201,169,106,.12);
}
.pop-emoji { font-size: 1.7rem; }
.pop-title { font-size: .82rem; font-weight: 700; margin: 8px 0 4px; }
.pop-effect { font-size: .68rem; color: var(--green-deep); font-weight: 700; }
.pop-users { font-size: .64rem; color: var(--ink-soft); margin-top: 6px; }

.ranking { padding: 8px 18px; }
.rank-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 0; font-size: .85rem; font-weight: 600;
  border-bottom: 1px dashed rgba(201,169,106,.25);
}
.rank-row:last-child { border-bottom: 0; }
.rank-no {
  width: 26px; height: 26px; flex: none; border-radius: 50%;
  display: grid; place-items: center;
  font-family: "Quicksand"; font-weight: 700; font-size: .8rem;
  background: var(--cream); color: var(--gold);
}
.rank-row:nth-child(1) .rank-no { background: var(--gold); color: #fff; }
.rank-row:nth-child(2) .rank-no { background: var(--pink); color: #fff; }
.rank-row:nth-child(3) .rank-no { background: var(--green); color: #6d8f63; }
.rank-pt { margin-left: auto; font-size: .68rem; color: var(--ink-soft); }

/* ---------- 診断フロー ---------- */
.flow-progress {
  height: 6px; border-radius: 3px; background: var(--cream);
  margin: 4px 0 24px; overflow: hidden;
}
.flow-progress-bar {
  height: 100%; width: 20%;
  background: linear-gradient(90deg, var(--pink-deep), var(--gold));
  border-radius: 3px; transition: width .4s ease;
}

.flow-step { display: none; }
.flow-step.active { display: block; animation: fadein .3s ease; }

.flow-title { font-size: 1.15rem; margin-bottom: 6px; }
.flow-sub { font-size: .8rem; color: var(--ink-soft); margin-bottom: 18px; }

.room-grid { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 12px; }
.room-btn {
  border: 1.5px solid rgba(201,169,106,.2); background: #fff;
  border-radius: 20px; padding: 18px 10px; cursor: pointer;
  font-family: inherit; font-weight: 700; font-size: .88rem; color: var(--ink);
  display: flex; flex-direction: column; gap: 6px; align-items: center;
  transition: .15s;
}
.room-btn span { font-size: 1.6rem; }
.room-btn:active { transform: scale(.96); background: var(--cream); }

.photo-drop {
  display: block; border-radius: var(--radius); overflow: hidden;
  border: 2px dashed rgba(201,169,106,.4); background: #fff;
  min-height: 260px; cursor: pointer; position: relative;
}
.photo-drop-empty {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  color: var(--ink-soft); font-size: .85rem; font-weight: 600;
}
.photo-icon { font-size: 2.4rem; }
.photo-preview { width: 100%; height: 300px; object-fit: cover; display: block; }
.tips { font-size: .72rem; color: var(--ink-soft); margin-top: 10px; }

.dir-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 10px; margin-top: 16px; }
.dir-btn {
  border: 1.5px solid rgba(201,169,106,.2); background: #fff;
  border-radius: 16px; padding: 14px 4px; cursor: pointer;
  font-family: inherit; font-weight: 700; font-size: .85rem; color: var(--ink);
  transition: .15s;
}
.dir-btn.selected, .dir-btn:active { background: var(--pink); border-color: var(--pink-deep); }
.compass-status { font-size: .75rem; color: var(--green-deep); font-weight: 700; min-height: 1.2em; margin-top: 8px; }
.compass-precision-note { font-size: .68rem; color: var(--ink-soft); margin-top: 6px; line-height: 1.6; }

/* ---------- 間取り: コンパス誘導取得 ---------- */
.rc-panel { text-align: center; margin-top: 4px; }
.rc-guide { font-size: .82rem; font-weight: 700; color: var(--ink); margin-top: 6px; }
.rc-guide:first-child { margin-top: 0; }
.rc-panel .cta { max-width: 360px; margin-left: auto; margin-right: auto; }
.rc-aim-hint { font-size: .72rem; color: var(--ink-soft); line-height: 1.6; }
.rc-room-emoji { font-size: 2.6rem; margin-top: 14px; }
.rc-room-name { font-size: 1.05rem; font-weight: 700; margin-top: 4px; }
.rc-heading {
  font-family: "Quicksand"; font-size: 1.4rem; font-weight: 700; color: var(--gold);
  margin-top: 8px; min-height: 1.6em;
}
.rc-confirm { font-size: .95rem; font-weight: 700; color: var(--green-deep); margin-top: 14px; }
.rc-capture-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 14px; }
.rc-capture-actions .chip-btn { margin-top: 0; flex: none; }
.rc-hint { font-size: .68rem; color: var(--ink-soft); margin-top: 14px; line-height: 1.6; }
.rc-summary-title { font-size: .78rem; font-weight: 700; color: var(--ink-soft); margin-bottom: 10px; }
.rc-summary .item-chips { justify-content: center; }
#manual-room-panel { margin-top: 20px; }

/* ---------- 決済 ---------- */
.pay-card { margin-top: 6px; }
.pay-product { display: flex; gap: 12px; align-items: center; margin-bottom: 18px; }
.pay-emoji { font-size: 2rem; }
.pay-name { font-weight: 700; font-size: .95rem; }
.pay-desc { font-size: .7rem; color: var(--ink-soft); margin-top: 2px; }
.pay-price { margin-left: auto; font-family: "Quicksand"; font-weight: 700; font-size: 1.3rem; }

.pay-btn {
  width: 100%; border: 0; cursor: pointer; font-family: inherit;
  border-radius: 14px; padding: 15px; font-size: .95rem; font-weight: 700;
  margin-top: 10px; transition: .15s;
}
.pay-btn:active { transform: scale(.98); }
.pay-btn.apple { background: #111; color: #fff; }
.pay-btn.google { background: #fff; color: #3c4043; border: 1.5px solid #dadce0; }
.pay-btn.cardpay { background: var(--cream); color: var(--ink); }
.pay-note { font-size: .66rem; color: var(--ink-soft); margin-top: 14px; line-height: 1.7; text-align: center; }

/* ---------- 解析中 ---------- */
.analyzing { text-align: center; padding-top: 40px; }
.analyzing-orb {
  width: 120px; height: 120px; margin: 0 auto 24px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff, var(--pink) 60%, var(--gold-soft));
  display: grid; place-items: center; font-size: 3rem;
  animation: float 2.4s ease-in-out infinite;
  box-shadow: 0 16px 40px rgba(232,174,185,.45);
}
@keyframes float {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-12px) scale(1.04); }
}
.analyzing-bar {
  height: 8px; background: var(--cream); border-radius: 4px;
  margin: 28px auto 0; max-width: 260px; overflow: hidden;
}
#analyzing-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--pink-deep), var(--gold));
  border-radius: 4px; transition: width .5s ease;
}

/* ---------- 結果 ---------- */
.result-hero { text-align: center; padding: 28px 22px; }
.result-rank {
  font-family: "Quicksand"; font-size: .8rem; font-weight: 700; letter-spacing: .2em;
  color: var(--gold);
}
.result-big {
  font-family: "Quicksand"; font-size: 4rem; font-weight: 700; line-height: 1.1;
}
.result-big small { font-size: 1.2rem; color: var(--ink-soft); }
.result-room { font-size: .78rem; color: var(--ink-soft); margin-top: 4px; }
.result-summary { font-size: .88rem; line-height: 1.9; margin-top: 14px; text-align: left; }

.result-photo { width: 100%; border-radius: 20px; margin-top: 16px; display: block; }

.cat-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; }
.cat-label { width: 96px; flex: none; font-size: .8rem; font-weight: 700; }
.cat-bar { flex: 1; height: 10px; background: var(--cream); border-radius: 5px; overflow: hidden; }
.cat-fill {
  height: 100%; border-radius: 5px; width: 0;
  background: linear-gradient(90deg, var(--green-deep), var(--gold));
  transition: width .9s cubic-bezier(.2,.7,.3,1);
}
.cat-score { width: 34px; text-align: right; font-family: "Quicksand"; font-weight: 700; font-size: .9rem; }

.cat-detail { font-size: .78rem; color: var(--ink-soft); line-height: 1.7; padding: 2px 0 10px 0; border-bottom: 1px dashed rgba(201,169,106,.2); margin-bottom: 8px; }

.item-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.item-chip {
  font-size: .74rem; font-weight: 600;
  background: var(--cream); border-radius: 999px; padding: 7px 12px;
}
.item-chip small { color: var(--gold); font-family: "Quicksand"; }

.imp-card {
  background: #fff; border-radius: 20px; padding: 18px;
  box-shadow: var(--shadow-soft); border: 1px solid rgba(201,169,106,.12);
  margin-bottom: 12px;
}
.imp-head { display: flex; align-items: center; gap: 10px; }
.imp-pri {
  flex: none; width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--pink); color: #fff; font-family: "Quicksand"; font-weight: 700;
}
.imp-title { font-size: .92rem; font-weight: 700; }
.imp-quick {
  margin-left: auto; flex: none; font-size: .62rem; font-weight: 700;
  background: var(--green); color: #5d7f53; border-radius: 999px; padding: 4px 10px;
}
.imp-reason { font-size: .78rem; color: var(--ink-soft); line-height: 1.8; margin-top: 10px; }
.imp-meta { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.imp-tag { font-size: .66rem; font-weight: 700; background: var(--cream); border-radius: 999px; padding: 5px 10px; }
.imp-tag.effect { background: rgba(245,215,220,.6); color: #b26975; }

.ba-wrap { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 10px; margin-top: 4px; }
.ba-col { text-align: center; }
.ba-col img { width: 100%; border-radius: 16px; display: block; aspect-ratio: 4/5; object-fit: cover; }
.ba-label { font-size: .7rem; font-weight: 700; color: var(--ink-soft); margin-top: 6px; display: block; }
.ba-note { font-size: .64rem; color: var(--ink-soft); margin-top: 8px; line-height: 1.6; }

.lucky-row { display: flex; gap: 10px; margin-top: 4px; }
.lucky-box {
  flex: 1; text-align: center; background: var(--cream);
  border-radius: 16px; padding: 14px 8px;
}
.lucky-box .t { font-size: .64rem; color: var(--gold); font-weight: 700; letter-spacing: .08em; }
.lucky-box .v { font-size: .85rem; font-weight: 700; margin-top: 4px; }

.share-row { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 10px; margin-top: 4px; }
.share-btn {
  border: 1.5px solid var(--gold-soft); background: #fff; border-radius: 16px;
  font-family: inherit; font-weight: 700; font-size: .8rem; color: var(--ink);
  padding: 14px 8px; cursor: pointer; transition: .15s;
}
.share-btn:active { transform: scale(.97); background: var(--cream); }

.result-disclaimer {
  font-size: .66rem; color: var(--ink-soft); line-height: 1.8;
  background: var(--cream); border-radius: 14px; padding: 12px 14px; margin-top: 20px;
}

/* ---------- 履歴 ---------- */
.trend-card { margin-bottom: 16px; }
.trend-title { font-size: .8rem; font-weight: 700; margin-bottom: 8px; }
#trend-svg { width: 100%; height: 80px; }

.hist-card {
  display: flex; align-items: center; gap: 14px;
  background: #fff; border-radius: 20px; padding: 14px 16px;
  box-shadow: var(--shadow-soft); border: 1px solid rgba(201,169,106,.12);
  margin-bottom: 10px; cursor: pointer; width: 100%;
  font-family: inherit; color: var(--ink); text-align: left;
}
.hist-thumb { width: 54px; height: 54px; border-radius: 14px; object-fit: cover; flex: none; background: var(--cream); display: grid; place-items: center; font-size: 1.4rem; }
.hist-info { flex: 1; }
.hist-room { font-size: .85rem; font-weight: 700; }
.hist-date { font-size: .68rem; color: var(--ink-soft); margin-top: 2px; }
.hist-score { font-family: "Quicksand"; font-weight: 700; font-size: 1.3rem; color: var(--gold); }

.empty-state {
  text-align: center; color: var(--ink-soft); font-size: .82rem;
  padding: 40px 0; line-height: 2;
}
.empty-state span { font-size: 2rem; display: block; }

.history-preview .hist-card { margin-bottom: 8px; }

/* ---------- チャット ---------- */
.chat-quick { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 10px; scrollbar-width: none; }
.chat-quick::-webkit-scrollbar { display: none; }
.chat-quick button {
  flex: none; border: 1.5px solid var(--gold-soft); background: #fff;
  border-radius: 999px; padding: 8px 14px; font-family: inherit;
  font-size: .74rem; font-weight: 600; color: var(--ink); cursor: pointer;
}

.chat-log { display: flex; flex-direction: column; gap: 10px; padding: 6px 0 14px; min-height: 200px; }
.chat-msg {
  max-width: 85%; padding: 12px 15px; border-radius: 18px;
  font-size: .84rem; line-height: 1.8; white-space: pre-wrap;
}
.chat-msg.ai { background: #fff; box-shadow: var(--shadow-soft); border-bottom-left-radius: 6px; align-self: flex-start; }
.chat-msg.me { background: linear-gradient(120deg, var(--pink), var(--gold-soft)); border-bottom-right-radius: 6px; align-self: flex-end; }
.chat-msg.typing { color: var(--ink-soft); font-style: italic; }

.chat-form {
  position: sticky; bottom: calc(12px + env(safe-area-inset-bottom));
  display: flex; gap: 8px;
}
.chat-form input {
  flex: 1; border: 1.5px solid var(--gold-soft); border-radius: 999px;
  padding: 13px 18px; font-family: inherit; font-size: .9rem; outline: none;
  background: #fff; color: var(--ink);
}
.chat-form button {
  flex: none; width: 48px; height: 48px; border-radius: 50%; border: 0;
  background: linear-gradient(120deg, var(--pink-deep), var(--gold)); color: #fff;
  font-size: 1.2rem; font-weight: 700; cursor: pointer;
}

/* ---------- マイページ ---------- */
.stats-card { display: flex; justify-content: space-around; text-align: center; }
.stat-num { font-family: "Quicksand"; font-size: 1.6rem; font-weight: 700; display: block; }
.stat-label { font-size: .68rem; color: var(--ink-soft); }

.list-card { padding: 8px 10px; margin-top: 16px; }
.list-item {
  display: block; box-sizing: border-box;
  width: 100%; border: 0; background: none; font-family: inherit;
  text-align: left; font-size: .9rem; font-weight: 600; color: var(--ink);
  padding: 15px 10px; cursor: pointer; text-decoration: none;
  border-bottom: 1px dashed rgba(201,169,106,.2);
}
.list-item:last-child { border-bottom: 0; }
.list-item.danger { color: #c96a6a; }

/* ---------- モーダル ---------- */
.modal[hidden] { display: none; }
.modal {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(74,66,60,.35); backdrop-filter: blur(4px);
  display: grid; place-items: center; padding: 24px;
}
.modal-card {
  background: #fff; border-radius: var(--radius); padding: 32px 26px;
  max-width: 340px; width: 100%; text-align: center;
  box-shadow: var(--shadow);
  font-size: .9rem; font-weight: 600;
}
.pay-anim { font-size: 2.6rem; margin-bottom: 14px; animation: float 1.6s ease-in-out infinite; }
.modal-card.terms { text-align: left; max-height: 80dvh; overflow-y: auto; }
.modal-card.terms h3 { margin-bottom: 14px; }
.terms-body p { font-size: .78rem; line-height: 1.9; color: var(--ink-soft); margin-bottom: 10px; }

/* ---------- 印刷(PDFレポート) ----------
   結果画面全体ではなく、buildPrintReport() が生成する .print-report(1枚ダイジェスト:
   命式表・スコア・改善提案TOP4)のみを印刷する。通常表示では .print-report は非表示。 */
.print-report { display: none; }

@media print {
  .topbar, .lang-switch, .no-print { display: none !important; }
  body { background: #fff; }
  #app { padding: 0; max-width: none; }
  .screen { display: none; }
  #screen-result { display: block !important; }
  .print-report { display: block !important; }
  @page { size: A4; margin: 14mm; }

  .print-head { display: flex; justify-content: space-between; align-items: baseline;
    border-bottom: 2px solid #C9A96A; padding-bottom: 8px; margin-bottom: 14px; }
  .print-brand { font-weight: 700; font-size: 1.05rem; }
  .print-date { font-size: .78rem; color: #8C8178; }
  .print-score { display: flex; align-items: baseline; gap: 12px; margin-bottom: 8px; }
  .print-score-num { font-size: 2rem; font-weight: 700; }
  .print-score-num small { font-size: .9rem; font-weight: 500; color: #8C8178; }
  .print-score-rank { font-weight: 700; color: #C9A96A; }
  .print-score-head { font-size: .85rem; }
  .print-summary { font-size: .82rem; line-height: 1.7; margin-bottom: 14px; }
  .print-h2 { font-weight: 700; font-size: .88rem; margin: 14px 0 6px; border-left: 4px solid #C9A96A; padding-left: 8px; }
  .print-pillars { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 8px; break-inside: avoid; }
  .print-pillar-col { border: 1px solid #eee; border-radius: 8px; padding: 8px; text-align: center; }
  .pp-h { font-size: .68rem; color: #8C8178; }
  .pp-gz { font-size: 1.15rem; font-weight: 700; }
  .pp-sub { font-size: .68rem; color: #8C8178; }
  .print-detail { font-size: .78rem; margin-top: 6px; }
  .print-improvements { font-size: .8rem; line-height: 1.9; margin-left: 18px; break-inside: avoid; }
  .print-footer-note { font-size: .68rem; color: #8C8178; margin-top: 16px; border-top: 1px solid #eee; padding-top: 8px; }

  .card, .imp-card { box-shadow: none; border: 1px solid #eee; break-inside: avoid; }
}

/* =====================================================
   四柱推命×風水鑑定 — 追加コンポーネント
   ===================================================== */

/* ---------- 入力フォーム共通 ---------- */
.field-label { font-size: .82rem; font-weight: 700; margin: 20px 0 8px; overflow-wrap: anywhere; word-break: break-word; }
.field-label .opt { font-weight: 500; color: var(--ink-soft); font-size: .72rem; }

.text-input {
  width: 100%; max-width: 100%; min-width: 0; box-sizing: border-box;
  border: 1.5px solid rgba(201,169,106,.25); background: #fff;
  border-radius: 14px; padding: 13px 16px; font-family: inherit; font-size: .92rem;
  color: var(--ink); outline: none;
}
.text-input:focus { border-color: var(--gold); }

/* iOS Safari の date/time input は内部シャドウDOMの min-width が効いて
   width:100% を無視し親幅からはみ出す。appearance:none と内部要素の
   min-width:0 で必ず親幅に収める。 */
input[type="date"].text-input,
input[type="time"].text-input {
  -webkit-appearance: none; appearance: none;
}
.text-input::-webkit-date-and-time-value { text-align: left; margin: 0; min-width: 0; }
.text-input::-webkit-datetime-edit { padding: 0; }
.text-input::-webkit-datetime-edit-fields-wrapper { padding: 0; }

/* select は iOS Safari の native描画(appearance)が box-sizing を無視して
   親幅からはみ出すことがあるため appearance:none にして自前の矢印を描く */
select.text-input {
  -webkit-appearance: none; appearance: none;
  padding-right: 38px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--gold) 50%),
    linear-gradient(135deg, var(--gold) 50%, transparent 50%);
  background-position: calc(100% - 21px) center, calc(100% - 16px) center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.seg2 { display: flex; gap: 10px; min-width: 0; }
.seg-btn {
  flex: 1; min-width: 0; border: 1.5px solid rgba(201,169,106,.25); background: #fff;
  border-radius: 14px; padding: 14px; font-family: inherit; font-weight: 700;
  font-size: .9rem; color: var(--ink); cursor: pointer; transition: .15s;
}
.seg-btn.selected { background: var(--pink); border-color: var(--pink-deep); color: #7a4650; }

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-row button {
  border: 1.5px solid rgba(201,169,106,.25); background: #fff;
  border-radius: 999px; padding: 9px 16px; font-family: inherit; font-weight: 600;
  font-size: .8rem; color: var(--ink); cursor: pointer;
}
.chip-row button.selected { background: var(--gold-soft); border-color: var(--gold); }

.flow-nav { display: flex; gap: 10px; margin-top: 20px; align-items: center; }
.flow-nav .cta { margin-top: 0; flex: 1; }
.flow-nav .chip-btn { margin-top: 0; flex: none; }

/* ---------- 間取り: 方位マップ ---------- */
.room-chip-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.room-chip-row::-webkit-scrollbar { display: none; }
.room-chip {
  flex: none; display: flex; align-items: center; gap: 6px;
  border: 1.5px solid rgba(201,169,106,.25); background: #fff;
  border-radius: 999px; padding: 9px 14px; font-family: inherit; font-weight: 700;
  font-size: .8rem; color: var(--ink); cursor: pointer;
}
.room-chip span { font-size: 1rem; }
.room-chip.active { background: var(--pink); border-color: var(--pink-deep); }

.compass-map {
  display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 8px; margin-top: 18px;
  aspect-ratio: 1; max-width: 320px; margin-left: auto; margin-right: auto;
}
.compass-cell {
  border: 1.5px solid rgba(201,169,106,.2); background: #fff; border-radius: 16px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; cursor: pointer; transition: .15s; text-align: center; padding: 4px;
}
.compass-cell:active { background: var(--cream); }
.compass-cell.compass-center { cursor: default; background: var(--cream); color: var(--ink-soft); font-size: .7rem; }
.cc-label { font-size: .68rem; font-weight: 700; color: var(--ink-soft); }
.cc-icons { font-size: 1.1rem; min-height: 1.3rem; }

/* ---------- レーダーチャート ---------- */
.radar-card { display: flex; justify-content: center; padding: 12px; }
.radar-svg { width: 100%; max-width: 320px; height: auto; }

/* ---------- 五行バランス バー ---------- */
.elbar-wrap { display: flex; flex-direction: column; gap: 10px; }
.elbar-row { display: flex; align-items: center; gap: 10px; }
.elbar-label { width: 22px; flex: none; font-weight: 700; font-size: .95rem; text-align: center; }
.elbar-track { flex: 1; height: 12px; background: var(--cream); border-radius: 6px; overflow: hidden; }
.elbar-fill { height: 100%; border-radius: 6px; }
.elbar-pct { width: 40px; flex: none; text-align: right; font-family: "Quicksand"; font-weight: 700; font-size: .8rem; }
.elbar-status { width: 44px; flex: none; text-align: center; font-size: .64rem; font-weight: 700; border-radius: 999px; padding: 3px 0; }
.elbar-status-ok { background: var(--green); color: #5d7f53; }
.elbar-status-over { background: var(--pink); color: #a3505f; }
.elbar-status-under { background: var(--gold-soft); color: #8a6f2e; }

/* ---------- 命式表(四柱) ---------- */
.pillar-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 8px; }
.pillar-col { text-align: center; background: var(--cream); border-radius: 14px; padding: 10px 4px; }
.pillar-head { font-size: .68rem; color: var(--ink-soft); font-weight: 700; }
.pillar-gz { font-family: "Zen Maru Gothic"; font-size: 1.15rem; font-weight: 700; margin: 4px 0; }
.pillar-sub { font-size: .66rem; color: var(--gold); font-weight: 700; }
.pillar-sub2 { font-size: .8rem; font-weight: 700; }
.pillar-mini { font-size: .6rem; color: var(--ink-soft); margin-top: 2px; line-height: 1.5; }
.pillar-empty { font-size: .8rem; color: var(--ink-soft); padding: 14px 0; }

.dayun-scroll { display: flex; gap: 8px; overflow-x: auto; padding: 8px 2px; scrollbar-width: none; }
.dayun-scroll::-webkit-scrollbar { display: none; }
.dayun-chip { flex: none; background: var(--cream); border-radius: 12px; padding: 8px 12px; text-align: center; }
.dayun-age { font-size: .62rem; color: var(--ink-soft); font-weight: 700; }
.dayun-gz { font-size: .95rem; font-weight: 700; margin-top: 2px; }

/* ---------- 八宅・九星 方位グリッド ---------- */
.bazhai-grid, .kyusei-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 8px; margin-top: 10px; }
.bazhai-cell, .kyusei-cell { text-align: center; border-radius: 12px; padding: 10px 4px; }
.bazhai-cell.good, .kyusei-cell.good { background: var(--green); color: #4c6b43; }
.bazhai-cell.bad, .kyusei-cell.bad { background: var(--pink); color: #a3505f; }
.bz-dir { font-size: .64rem; font-weight: 700; opacity: .85; }
.bz-type { font-size: .8rem; font-weight: 700; margin-top: 2px; }

/* ---------- 玄空飛星 9宮 ---------- */
.xk-meta { font-size: .74rem; color: var(--ink-soft); margin-bottom: 8px; }
.xk-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 6px; }
.xk-cell {
  border-radius: 12px; padding: 8px 4px; text-align: center; background: var(--cream);
  border: 1.5px solid transparent;
}
.xk-cell.good { background: var(--green); }
.xk-cell.bad { background: var(--pink); }
.xk-cell.xk-facing, .xk-cell.xk-sitting { border-color: var(--gold); }
.xk-num { font-size: .68rem; font-weight: 700; line-height: 1.35; }
.xk-shan { color: #7a95ab; } .xk-xiang { color: #b26975; } .xk-yun { color: var(--ink-soft); }
.xk-dir { font-size: .6rem; color: var(--ink-soft); margin-top: 4px; }

/* ---------- 判断メモ・今後の運勢 ---------- */
.judgement-note { font-size: .78rem; line-height: 1.8; margin-top: 10px; text-align: left; }
.judgement-note.warn { color: #a3505f; }

.outlook-row { display: flex; flex-direction: column; gap: 10px; }
.outlook-card { padding: 16px 18px; }
.outlook-label { font-weight: 700; font-size: .9rem; }
.outlook-label small { font-weight: 500; color: var(--ink-soft); font-size: .72rem; }
.outlook-note { font-size: .8rem; color: var(--ink-soft); line-height: 1.8; margin-top: 6px; }

.empty-note { font-size: .78rem; color: var(--ink-soft); }

.approx-details { margin-top: 20px; font-size: .76rem; color: var(--ink-soft); }
.approx-details summary { cursor: pointer; font-weight: 700; padding: 6px 0; }
.approx-details ul { margin: 8px 0 0 18px; line-height: 1.9; }
