:root {
  --ebi: #FF6B47;
  --ebi-deep: #E8532F;
  --ebi-heading: #C63A18;
  --banana: #FFC93C;
  --banana-deep: #F5A623;
  --cream: #FFF6E3;
  --ink: #3E2E20;
  --ink-soft: #7C6A52;
  --white: #FFFDF8;
  --sky: #3EC6C0;
  --border: rgba(62,46,32,0.15);
  --border-subtle: rgba(62,46,32,0.08);
  --bg-card: var(--white);
  --text-primary: var(--ink);
  --text-secondary: var(--ink-soft);
  --text-muted: var(--ink-soft);
  --text-accent: var(--ebi);
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 999px;
  --transition-fast: 0.2s ease;
  /* 五行の意味色（データ可視化専用・ここ以外で使わない） */
  --el-wood: #6FA96C;
  --el-fire: #E8532F;
  --el-earth: #D9A441;
  --el-metal: #B8AD9E;
  --el-water: #5D9EC9;

  --font-display: 'Zen Maru Gothic', 'Hiragino Maru Gothic ProN', 'Yu Gothic Medium', sans-serif;
  --font-body: 'Noto Sans JP', 'Hiragino Kaku Gothic ProN', 'Yu Gothic Medium', 'Meiryo', sans-serif;
}

.wrap { max-width: 720px; margin: 0 auto; padding: 0 20px; }
.container { max-width: 900px; margin: 0 auto; padding: 0 24px; }
.wrap .container { padding-left: 0; padding-right: 0; }

@media (max-width: 560px) {
  .wrap { padding: 0 12px; }
  .container { padding: 0 12px; }
}


* { margin: 0; padding: 0; box-sizing: border-box; }
.hidden { display: none !important; }

body {
  font-family: var(--font-body);
  background: var(--cream);
  color: var(--ink);
  line-height: 1.9;
  font-weight: 400; /* 本文は400/500/700のみ */
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, .logo, .act-no, .bubble, .t-label, .t-name, .t-catch, .page-title, .d-head {
  font-family: var(--font-display);
}

img { max-width: 100%; display: block; }
header {
  background: var(--white);
  border-bottom: 2px solid var(--ink);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.header-left { display: flex; align-items: center; gap: 14px; }
.header-nav { display: flex; gap: 1rem; font-size: 0.85rem; font-weight: 700; align-items: center; }
.header-nav a { color: var(--ink); text-decoration: none; padding: 4px 8px; border-radius: 4px; transition: background 0.2s; }
.header-nav a:hover { background: var(--cream); }
@media (max-width: 699px) {
  .header-nav { display: none; /* スマホでは非表示など */ }
}
.logo { font-weight: 900; font-size: 1.05rem; text-decoration: none; color: var(--ink); }
.logo span { color: var(--ebi-deep); }
.crumb { font-size: 0.78rem; color: var(--ink-soft); font-weight: 700; }
.crumb a { color: var(--ink-soft); text-decoration: none; }
.crumb a:hover { text-decoration: underline; }

/* Hero Bubble */
.hero-banaebi { text-align: center; margin: 1.5rem 0 2.5rem; }
.hero-banaebi img { height: 200px; width: auto; display: block; margin: 0 auto 12px; }
.hero-bubble {
  position: relative;
  background: var(--white);
  border: 2px solid var(--ink);
  border-radius: var(--radius-lg);
  padding: 1rem 1.5rem;
  max-width: 640px;
  margin: 0 auto;
  font-weight: 700;
  color: var(--ink);
  display: inline-block;
  text-align: left;
  box-shadow: 0 4px 0 var(--border-subtle);
}
.hero-bubble::before,
.hero-bubble::after {
  content: ""; position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%);
  border: solid transparent; pointer-events: none;
}
.hero-bubble::before { border-bottom-color: var(--ink); border-width: 12px; }
.hero-bubble::after { border-bottom-color: var(--white); border-width: 9px; bottom: calc(100% - 3px); }

.profile-bar {
  margin: 26px auto 0; max-width: 720px;
  background: var(--white); border: 2px solid var(--ink); border-radius: 18px;
  padding: 14px 20px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  font-size: 0.9rem; font-weight: 700;
  width: calc(100% - 24px);
}
.profile-bar .edit {
  margin-left: auto; font-size: 0.8rem; font-weight: 700;
  color: var(--ebi-deep); text-decoration: none;
  border: 2px solid var(--ebi-deep); border-radius: 999px; padding: 4px 14px;
}

.page-title { text-align: center; margin: 44px 0 8px; font-weight: 900; font-size: clamp(1.4rem, 4vw, 1.9rem); }
.page-sub { text-align: center; font-size: 0.85rem; color: var(--ink-soft); font-weight: 700; }
.mt-md { margin-top: 1rem; }
.mt-xl { margin-top: 2rem; }
.text-center { text-align: center; }
.text-muted { color: var(--ink-soft); font-size: 0.8rem; }
.text-alert { color: var(--ebi-deep); font-weight: 700; }

/* ───────── フォーム ───────── */
.form-card {
  background: var(--white);
  border: 2px solid var(--ink);
  border-radius: 24px;
  padding: clamp(20px, 4vw, 36px);
  box-shadow: 0 5px 0 rgba(62,46,32,0.18);
}
.f-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 16px; }
.f-row.full { grid-template-columns: 1fr; }
@media(max-width: 560px) { .f-row { grid-template-columns: 1fr; } }

.f-field label { font-weight: 700; font-size: 0.85rem; display: block; margin-bottom: 6px; }
.required { font-size: 0.7rem; color: var(--ebi-deep); margin-left: 4px; }
.f-field input, .f-field select {
  width: 100%; padding: 12px 14px;
  border: 2px solid var(--ink); border-radius: 12px;
  font-family: inherit; font-size: 1rem; font-weight: 500; color: var(--ink);
  background: var(--cream);
}
.gender-group { display: flex; gap: 8px; }
.gender-btn {
  flex: 1; padding: 10px; border: 2px solid var(--ink); border-radius: 12px;
  background: var(--cream); font-weight: 700; color: var(--ink); cursor: pointer;
}
.gender-btn.active { background: var(--ebi-deep); color: var(--white); border-color: var(--ebi-deep); }

.toggle-group {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; background: var(--cream); border: 2px solid var(--ink); border-radius: 12px;
  cursor: pointer;
}
.toggle-label-text { font-weight: 700; font-size: 0.9rem; }
.toggle-label-sub { font-size: 0.75rem; color: var(--ink-soft); }
.toggle-switch { position: relative; width: 44px; height: 26px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0; background: var(--ink-soft); border-radius: 999px; transition: 0.2s;
}
.toggle-slider::before {
  content: ""; position: absolute; height: 18px; width: 18px; left: 4px; top: 4px;
  background: var(--white); border-radius: 50%; transition: 0.2s;
}
  .toggle-switch input:checked + .toggle-slider { background: var(--ebi-deep); }
  .toggle-switch input:checked + .toggle-slider::before { transform: translateX(18px); }
  .toggle-switch input:disabled + .toggle-slider { opacity: 0.5; cursor: not-allowed; }
  .toggle-group:has(.toggle-switch input:disabled) { cursor: not-allowed; opacity: 0.7; }

.btn-big {
  display: block; width: 100%;
  background: var(--ebi-deep); color: var(--white);
  font-family: var(--font-display); font-weight: 900; font-size: clamp(1.1rem, 2vw, 1.3rem);
  border: 2px solid var(--ink); border-radius: 999px;
  padding: 16px; margin-top: 22px; cursor: pointer;
  box-shadow: 0 4px 0 var(--ink);
  transition: transform 0.1s, box-shadow 0.1s;
}
.btn-big:hover { transform: translateY(2px); box-shadow: 0 2px 0 var(--ink); }
.btn-text { background: transparent; border: none; color: var(--ink-soft); font-weight: 700; text-decoration: underline; cursor: pointer; font-size: 0.85rem; }

/* ───────── ローディング ───────── */
.loading-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(255, 246, 227, 0.9); z-index: 1000;
  flex-direction: column; justify-content: center; align-items: center;
}
.loading-overlay.active { display: flex; }
.loading-overlay .banaebi { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.loading-overlay .face { width: 90px; height: 90px; border-radius: 50%; border: 3px solid var(--ink); overflow: hidden; background: var(--cream); box-shadow: 0 4px 0 rgba(62,46,32,0.15); }
.loading-overlay .bubble {
  background: var(--white); border: 2px solid var(--ink); border-radius: 16px;
  padding: 14px 20px; font-weight: 700; font-size: 1rem; position: relative;
}
.loading-overlay .bubble::before {
  content: ""; position: absolute; left: 50%; top: -8px; transform: translateX(-50%) rotate(45deg);
  width: 14px; height: 14px; background: var(--white);
  border-left: 2px solid var(--ink); border-top: 2px solid var(--ink);
}
.loading-overlay .banaebi .bubble::before { left: 50%; top: -8px; border-left: 2px solid var(--ink); border-top: 2px solid var(--ink); border-bottom: none; transform: translateX(-50%) rotate(45deg); }

/* ───────── 幕カード ───────── */
.acts { margin-top: 36px; display: grid; gap: 30px; }
.act {
  position: relative;
  background:
    radial-gradient(circle at 8% 4%, rgba(255,201,60,0.12) 0%, transparent 26%),
    repeating-linear-gradient(-45deg, rgba(62,46,32,0.018) 0 2px, transparent 2px 6px),
    var(--white);
  border: 2.5px solid var(--ink); border-radius: 22px;
  padding: 0 26px 26px;
  box-shadow: 0 5px 0 rgba(62,46,32,0.18);
  overflow: hidden;
}
.act-head {
  display: flex; align-items: center; gap: 14px;
  margin: 0 -26px 20px;
  padding: 14px 24px;
  background: var(--cream);
  border-bottom: 2px solid var(--ink);
}
.act-no {
  background: var(--ebi-deep); color: var(--white);
  font-size: 0.7rem; font-weight: 900; letter-spacing: 0.18em;
  padding: 4px 13px; border-radius: 999px; flex-shrink: 0;
}
.act-head h2 { font-weight: 900; font-size: 1.2rem; letter-spacing: 0.02em; }

.banaebi { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 18px; }
.banaebi .face {
  width: 68px; height: 68px; flex-shrink: 0;
  border-radius: 50%; border: 2.5px solid var(--ink);
  overflow: hidden; background: var(--cream);
  box-shadow: 0 3px 0 rgba(62,46,32,0.15);
}
.face img { width: 100%; height: 100%; object-fit: cover; object-position: center; }
.banaebi .bubble {
  position: relative; flex: 1;
  background: var(--cream); border: 2px solid var(--ink); border-radius: 16px;
  padding: 12px 16px; font-weight: 700; font-size: 0.95rem;
}
.banaebi .bubble::before {
  content: ""; position: absolute; left: -9px; top: 24px;
  width: 14px; height: 14px; background: var(--cream);
  border-left: 2px solid var(--ink); border-bottom: 2px solid var(--ink);
  transform: rotate(45deg); /* これは図形要素の回転なのでOK */
}
.act .body { font-size: 0.92rem; }
.act .highlight {
  margin-top: 16px;
  background: rgba(255,201,60,0.28);
  border-left: 4px solid var(--banana-deep);
  border-radius: 8px; padding: 10px 16px;
  font-weight: 700; font-size: 0.9rem;
}

/* 幕1: 五行バランス */
.gogyo { margin-top: 20px; display: grid; gap: 8px; }
.gogyo-row { display: grid; grid-template-columns: 2.4em 1fr 2em; align-items: center; gap: 10px; font-size: 0.85rem; font-weight: 700; }
.gogyo-bar { height: 14px; background: rgba(62,46,32,0.08); border-radius: 999px; overflow: hidden; }
.gogyo-bar i { display: block; height: 100%; border-radius: 999px; }
.g-wood i { background: var(--el-wood); }
.g-fire i { background: var(--el-fire); }
.g-earth i { background: var(--el-earth); }
.g-metal i { background: var(--el-metal); }
.g-water i { background: var(--el-water); }


/* 幕2: 内外ギャップ */
.gap-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; }
.gap-compare .g-col {
  border: 2px solid var(--ink); border-radius: 14px; padding: 14px 16px; background: var(--cream);
  font-size: 0.85rem;
}
.gap-compare .g-col b { display: block; font-size: 0.78rem; letter-spacing: 0.15em; color: var(--ebi-deep); margin-bottom: 4px; }

/* 幕3: 大運タイムライン */
.timeline { margin-top: 20px; }
.timeline-track { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.tl-cell {
  background: rgba(62,46,32,0.07); border-radius: 8px;
  padding: 8px 4px; text-align: center; font-size: 0.72rem; font-weight: 700; color: var(--ink-soft);
}
.tl-cell.now {
  background: var(--banana); color: var(--ink);
  border: 2px solid var(--ink); position: relative;
}
.tl-cell.now::after {
  content: "いまココ"; position: absolute; top: -1.7em; left: 50%; transform: translateX(-50%);
  font-size: 0.68rem; color: var(--ebi-deep); white-space: nowrap; font-weight: 700;
}
.tl-cell small { display: block; font-size: 0.85em; font-weight: 700; }

/* 幕4: 今日からの3つ */
.todo3 { margin-top: 18px; display: grid; gap: 10px; }
.todo3 li {
  list-style: none; display: flex; gap: 12px; align-items: center;
  background: var(--cream); border: 2px solid var(--ink); border-radius: 14px;
  padding: 12px 16px; font-weight: 500; font-size: 0.9rem;
}
.todo3 .n {
  width: 28px; height: 28px; flex-shrink: 0; border-radius: 50%;
  background: var(--ebi-deep); color: var(--white);
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 0.85rem; font-family: var(--font-display);
}

/* ───────── 運勢の内訳（4分野） ───────── */
.domains { margin-top: 40px; }
.sec-h { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.sec-h::before, .sec-h::after { content: ""; flex: 1; height: 2px; background: var(--ink); opacity: 0.25; border-radius: 2px; }
.sec-h h2 { font-weight: 900; font-size: 1.2rem;  }
.domain-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.domain {
  background: var(--white); border: 2px solid var(--ink); border-radius: 18px;
  padding: 16px 18px; box-shadow: 0 3px 0 rgba(62,46,32,0.15);
}
.domain .d-head { display: flex; align-items: center; gap: 8px; font-weight: 900; font-size: 0.95rem; }
.domain .stars { margin-left: auto; color: #B36B00; letter-spacing: 2px; font-size: 0.9rem; }
.domain p { font-size: 0.82rem; margin-top: 6px; }

/* ───────── タイプカード ───────── */
.type-wrap { margin-top: 44px; display: flex; justify-content: center; }
.type-card {
  position: relative; width: 100%; max-width: 460px;
  background:
    radial-gradient(circle at 50% 0%, rgba(255,201,60,0.22) 0%, transparent 55%),
    repeating-linear-gradient(-45deg, rgba(255,253,248,0.035) 0 3px, transparent 3px 9px),
    var(--ink);
  color: var(--white);
  border: 3px solid var(--banana);
  border-radius: 26px;
  padding: 12px;
  box-shadow: 0 10px 0 rgba(62,46,32,0.35), 0 14px 40px rgba(62,46,32,0.25);
  /* テキスト要素でない（カード外枠自体はOKとするか、文字を含む要素の回転禁止のため 0にする） */
  transform: rotate(0deg); 
}
.type-inner {
  border: 1.5px solid rgba(255,201,60,0.55);
  border-radius: 18px; padding: 26px 22px 24px; text-align: center; position: relative;
}
.type-inner::before, .type-inner::after {
  content: "◆"; position: absolute; color: var(--banana); font-size: 0.7rem; opacity: 0.9;
}
.type-inner::before { left: 10px; top: 8px; }
.type-inner::after { right: 10px; bottom: 8px; }
.t-meta { display: flex; justify-content: center; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.t-meta span {
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.12em;
  border: 1.5px solid rgba(255,253,248,0.5); border-radius: 999px; padding: 3px 12px; color: var(--cream);
}
.t-meta .el { border-color: var(--el-fire); color: #FFB09C; }
.type-card .t-label { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.3em; color: var(--banana); }
.type-card .t-name {
  font-weight: 900; font-size: clamp(1.6rem, 5vw, 2.2rem); color: var(--banana);
  margin: 8px 0 4px;
}
.type-card .t-catch { font-size: 0.9rem; font-weight: 700; opacity: 0.92; }

/* ばなえびから一言 (intro) インセット */
.t-intro-box {
  background-color: var(--cream);
  color: var(--ink);
  border: 1.5px solid var(--banana);
  border-radius: 12px;
  margin: 16px auto 0;
  padding: 12px 14px;
  width: 100%;
  text-align: left;
  box-shadow: inset 0 2px 6px rgba(62,46,32,0.05);
}
.t-intro-head {
  font-size: 0.7rem;
  font-weight: 900;
  color: var(--ebi);
  letter-spacing: 0.05em;
  margin-bottom: 8px;
  text-align: center;
  display: block;
}
.t-intro-body {
  display: flex;
  align-items: center;
  gap: 12px;
}
.t-intro-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid var(--banana);
  background: var(--white);
  flex-shrink: 0;
  object-fit: cover;
}
.t-intro-body p {
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.5;
  margin: 0;
}

.type-card .face {
  width: 104px; height: 104px; margin: 18px auto 0;
  border-radius: 50%; border: 3px solid var(--banana);
  overflow: hidden; background: var(--cream);
  box-shadow: 0 0 0 5px rgba(255,201,60,0.25);
}
.t-aisho {
  margin-top: 18px; padding-top: 14px; border-top: 1.5px dashed rgba(255,253,248,0.35);
  font-size: 0.78rem; font-weight: 700;
}
.t-aisho b { color: var(--banana); }
.share-row { display: flex; gap: 10px; justify-content: center; margin-top: 18px; flex-wrap: wrap; }
.share-row a, .share-row button {
  background: var(--ebi); color: var(--white);
  font-family: var(--font-display);
  font-weight: 900; font-size: 0.88rem; text-decoration: none;
  padding: 12px 24px; border-radius: 999px; border: 2px solid rgba(0,0,0,0.15);
  cursor: pointer;
}
.share-row a.sub, .share-row button.sub { background: transparent; border: 2px solid var(--white); }

/* ───────── 詳しく見る ───────── */
details.expert {
  margin-top: 40px; background: var(--white); border: 2px solid var(--ink); border-radius: 18px; overflow: hidden;
}
details.expert summary {
  cursor: pointer; list-style: none; padding: 16px 22px; font-weight: 700;
  display: flex; justify-content: space-between; align-items: center;
}
details.expert summary::after { content: "＋"; font-weight: 900; color: var(--ebi-deep); font-family: var(--font-display); }
details.expert[open] summary::after { content: "−"; }
.expert-body { padding: 0 22px 22px; font-size: 0.85rem; overflow-x: auto; }
.meishiki-table { width: 100%; border-collapse: collapse; margin-top: 8px; min-width: 400px; }
.meishiki-table th, .meishiki-table td { border: 1.5px solid var(--ink); padding: 8px 6px; text-align: center; font-size: 0.85rem; }
.meishiki-table th { background: var(--cream); font-weight: 700; }
.meishiki-table .kanji { font-size: 1.25rem; font-weight: 900; font-family: var(--font-display); }

/* ───────── 次の一手 ───────── */
.next { margin-top: 48px; }
.next-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.next-grid a {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--white); border: 2px solid var(--ink); border-radius: 18px;
  padding: 24px 16px; text-decoration: none; color: var(--ink);
  font-weight: 700; font-size: 1rem; box-shadow: 0 3px 0 rgba(62,46,32,0.15);
  transition: transform 0.12s;
}
.next-grid a:hover { transform: translateY(-3px); }
.next-grid .icon { font-size: 1.5rem; order: 2; }
.next-grid a.hot { background: var(--ebi-deep); color: var(--white); border-color: var(--ink); }

.share-section {
  background: var(--cream);
  border: 2px solid var(--ink);
  border-radius: 12px;
  padding: 24px;
  text-align: center;
  margin: 32px 0;
}
.share-title {
  font-size: 1.2rem;
  font-weight: 900;
  color: var(--ink);
  margin-bottom: 16px;
}
.share-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}
.share-btn {
  white-space: nowrap;
  padding: 12px 24px;
  border-radius: 999px;
  font-weight: 900;
  font-family: var(--font-display);
  font-size: 0.9rem;
  border: 2px solid var(--ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.share-btn-x { background: #000; color: #fff; }
.share-btn-line { background: #06c755; color: #fff; }

/* ───────── 広告枠・フッター ───────── */
.ad {
  margin: 44px auto; max-width: 720px; height: 120px;
  border: 2px dashed var(--ink-soft); border-radius: 14px;
  display: none; align-items: center; justify-content: center;
  color: var(--ink-soft); font-size: 0.8rem; font-weight: 700;
}
.site-footer {
  margin-top: 24px; background: var(--white); border-top: 2px solid var(--ink);
  padding: 26px 20px 40px; text-align: center; font-size: 0.78rem; color: var(--ink-soft); font-weight: 700;
}
.site-footer a { color: var(--ebi-deep); font-weight: 700; text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.site-footer p { margin-top: 0.5rem; }
.site-footer .f-nav { margin-bottom: 0.2rem; }
.site-footer .f-legal { color: var(--text-muted); font-size: 0.75rem; margin-top: 1rem; }

@media(max-width: 560px) {
  .next-grid { grid-template-columns: 1fr; }
  .domain-grid, .gap-compare { grid-template-columns: 1fr; }
  .timeline-track { grid-template-columns: repeat(5, 1fr); }
}
/* 出生地サジェスト */
.suggest-list {
  position: absolute;
  z-index: 10;
  background: var(--white);
  border: 1px solid var(--border-subtle);
  max-height: 200px;
  overflow-y: auto;
  width: 100%;
  border-radius: var(--radius-sm);
  margin-top: 4px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  padding: 0;
  list-style: none;
  left: 0;
}

@media(max-width: 560px) {
  .act { padding: 0 16px 20px; }
  .act-head { margin: 0 -16px 16px; padding: 12px 16px; }
  .act-head h2 { font-size: 1.1rem; }
  .sec-h h2 { white-space: normal; word-break: keep-all; }
}

.pill {
  display: inline-block;
  background: var(--ebi);
  color: #FFF;
  padding: 0 0.5em 0.125em;
  border-radius: 10px;
}

.sub-hero { text-align: center; margin: 1.5rem 0 2.5rem; }
.sub-hero-char img { height: 200px; width: auto; display: block; margin: 0 auto 12px; }