: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;
}

* { 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, .page-title {
  font-family: var(--font-display);
}

img { max-width: 100%; display: block; }
.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; }
  .profile-bar { width: calc(100% - 24px); }
}

/* ユーティリティ */
.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; }
.fw-bold { font-weight: 700; }

/* ───────── chrome コンポーネント ───────── */
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: 640px) {
  .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-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); }
.hero-bubble h2 { font-size: clamp(1.1rem, 3.5vw, 1.4rem); margin: 0; text-align: center; border: none; }

.page-title { text-align: center; margin: 44px 0 8px; font-weight: 900; font-size: clamp(1.4rem, 4vw, 1.9rem); }
.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; }
.page-sub { text-align: center; font-size: 0.85rem; color: var(--ink-soft); font-weight: 700; }

.breadcrumb { font-size: 0.8rem; margin-top: 16px; color: var(--ink-soft); }
.breadcrumb a { color: inherit; }

.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; color: var(--ink); font-family: var(--font-display); white-space: nowrap; }

.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); }

@media(max-width: 560px) {
  .next-grid { grid-template-columns: 1fr; }
}

.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; }
.site-footer .f-meta { font-size: .75rem; margin-top: .6rem; }
.site-footer .f-char { margin: 16px auto 0; width: 60px; height: auto; }

/* ───────── 共有フォーム基盤 ───────── */
.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-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; margin-bottom: 16px; }
.f-row.full { grid-template-columns: 1fr; }
@media(max-width: 560px) {
  .f-row, .f-row-3 { 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);
}
.f-field input[type="number"] {
  padding-left: 8px;
  padding-right: 4px;
}
.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; }

.profile-bar {
  margin: 26px auto 0; max-width: 680px; width: calc(100% - 40px);
  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;
}
.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;
}

.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;
}

/* ───────── ローディング ───────── */
.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 .face img { width: 100%; height: 100%; object-fit: cover; }
.loading-overlay .bubble {
  background: var(--white) !important; 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) !important;
  border-left: 2px solid var(--ink) !important; border-top: 2px solid var(--ink) !important;
  border-bottom: none !important; border-right: none !important;
}
.loading-overlay .banaebi .bubble::before { left: 50%; top: -8px; border-left: 2px solid var(--ink) !important; border-top: 2px solid var(--ink) !important; border-bottom: none !important; border-right: none !important; transform: translateX(-50%) rotate(45deg); }

/* Dark Footer Variant */
.site-footer.dark {
  background: var(--ink);
  color: var(--cream);
  border-top: none;
}
.site-footer.dark a {
  color: var(--cream);
}
.site-footer.dark a:hover {
  text-decoration: underline;
}
