:root {
  --bg: #ffffff;
  --surface: rgba(255, 255, 255, 0.74);
  --surface-solid: #ffffff;
  --surface-2: rgba(158, 24, 57, 0.06);
  --border: rgba(60, 20, 35, 0.10);
  --border-strong: rgba(60, 20, 35, 0.16);
  --text: #24151b;
  --text-sub: #7a6169;
  --accent: #a4123a;
  --accent-2: #cf3f5f;
  --accent-ink: #8e0f32;
  --grad: linear-gradient(135deg, #6e1230 0%, #a4123a 52%, #d24660 100%);
  --grad-soft: linear-gradient(135deg, rgba(164,18,58,0.12), rgba(210,70,96,0.10));
  --shadow: 0 4px 20px rgba(90, 18, 42, 0.08);
  --shadow-lg: 0 18px 50px rgba(90, 18, 42, 0.16);
  --shadow-glow: 0 8px 30px rgba(164, 18, 58, 0.28);
  --radius: 20px;
  --radius-sm: 13px;
  --maxw: 900px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #150a0e;
    --surface: rgba(50, 28, 36, 0.60);
    --surface-solid: #251319;
    --surface-2: rgba(236, 100, 133, 0.10);
    --border: rgba(255, 255, 255, 0.09);
    --border-strong: rgba(255, 255, 255, 0.16);
    --text: #fbeef1;
    --text-sub: #c9a8b1;
    --accent: #ec6485;
    --accent-2: #f2879f;
    --accent-ink: #f490a5;
    --grad: linear-gradient(135deg, #a02347 0%, #cf3f63 55%, #ec6485 100%);
    --grad-soft: linear-gradient(135deg, rgba(236,100,133,0.16), rgba(242,135,159,0.12));
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 18px 50px rgba(0, 0, 0, 0.55);
    --shadow-glow: 0 8px 34px rgba(236, 100, 133, 0.34);
  }
}
:root[data-theme="dark"] { color-scheme: dark; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", "Segoe UI", Meiryo, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.8;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  position: relative;
  overflow-x: hidden;
}
/* 令和版：背景のグラデーションブロブ */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(60% 45% at 12% -5%, rgba(164,18,58,0.18), transparent 60%),
    radial-gradient(50% 40% at 100% 0%, rgba(210,70,96,0.14), transparent 55%),
    radial-gradient(55% 45% at 85% 100%, rgba(140,20,55,0.12), transparent 60%);
}

a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 22px; }

/* ---- header ---- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; color: var(--text); letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.brand .logo {
  width: 32px; height: 32px; border-radius: 10px;
  background: var(--grad); box-shadow: var(--shadow-glow);
  display: grid; place-items: center; color: #fff; font-size: 17px; font-weight: 900;
}
.nav-tools {
  font-size: 12.5px; color: var(--accent-ink); font-weight: 800; letter-spacing: .02em;
  padding: 5px 12px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border);
}

/* ---- hero ---- */
.hero { padding: 60px 0 14px; text-align: center; }
.hero h1 {
  font-size: 40px; line-height: 1.25; margin: 0 0 14px; letter-spacing: -.035em; font-weight: 900;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p { color: var(--text-sub); margin: 0 auto; max-width: 540px; font-size: 16px; }

/* ---- section ---- */
.section-title { font-size: 21px; margin: 40px 0 16px; font-weight: 800; letter-spacing: -.02em; display: flex; align-items: center; gap: 9px; }

/* ---- tool grid ---- */
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(248px, 1fr)); gap: 16px; }
.tool-card {
  position: relative; overflow: hidden;
  background: var(--surface);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow);
  transition: transform .18s cubic-bezier(.2,.7,.3,1), box-shadow .18s ease, border-color .18s ease;
  display: block;
}
.tool-card::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px;
  background: var(--grad); opacity: 0;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude; transition: opacity .18s ease; pointer-events: none;
}
.tool-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); text-decoration: none; }
.tool-card:hover::after { opacity: 1; }
.tool-card .ic {
  font-size: 24px; width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center;
  background: var(--grad-soft); border: 1px solid var(--border); margin-bottom: 12px;
}
.tool-card h3 { margin: 4px 0 5px; font-size: 17px; color: var(--text); font-weight: 800; letter-spacing: -.01em; }
.tool-card p { margin: 0; font-size: 13.5px; color: var(--text-sub); line-height: 1.65; }
.tool-card.soon { opacity: .5; pointer-events: none; }
.badge-soon { font-size: 10.5px; background: var(--surface-2); color: var(--text-sub); padding: 2px 9px; border-radius: 999px; margin-left: 7px; font-weight: 700; vertical-align: middle; }

/* ---- tool page ---- */
.breadcrumb { font-size: 13px; color: var(--text-sub); padding: 22px 0 0; }
.breadcrumb a { color: var(--text-sub); }
.tool-head { padding: 12px 0 20px; }
.tool-head h1 { font-size: 32px; margin: 8px 0 10px; letter-spacing: -.03em; font-weight: 900; }
.tool-head .lead { color: var(--text-sub); margin: 0; font-size: 15.5px; max-width: 640px; }

.panel {
  background: var(--surface);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; box-shadow: var(--shadow); margin: 6px 0 26px;
}

textarea.input {
  width: 100%; min-height: 200px; resize: vertical; padding: 15px 17px;
  border: 1.5px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface-solid);
  color: var(--text); font-size: 15px; line-height: 1.85; font-family: inherit;
  transition: border-color .15s ease, box-shadow .15s ease;
}
textarea.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(164,18,58,0.14); }

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 13px; margin: 18px 0 4px; }
.stat {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 16px 12px; text-align: center; transition: transform .15s ease;
}
.stat:hover { transform: translateY(-2px); }
.stat .num { font-size: 29px; font-weight: 900; font-variant-numeric: tabular-nums; letter-spacing: -.03em;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat .label { font-size: 12px; color: var(--text-sub); margin-top: 3px; font-weight: 600; }

.controls { display: flex; flex-wrap: wrap; gap: 11px; margin-top: 16px; align-items: center; }
.btn {
  border: 1.5px solid var(--border-strong); background: var(--surface-solid); color: var(--text);
  padding: 11px 20px; border-radius: 12px; font-size: 14.5px; font-weight: 800; cursor: pointer;
  font-family: inherit; transition: all .15s ease;
}
.btn:hover { border-color: var(--accent); color: var(--accent-ink); transform: translateY(-1px); }
.btn.primary { background: var(--grad); border-color: transparent; color: #fff; box-shadow: var(--shadow-glow); }
.btn.primary:hover { color: #fff; filter: brightness(1.06); transform: translateY(-2px); }
.copied { color: var(--accent-ink); font-size: 13px; font-weight: 800; opacity: 0; transition: opacity .2s; }
.copied.show { opacity: 1; }

.limit-hints { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 16px; }
.chip {
  font-size: 12.5px; background: var(--surface-2); border: 1px solid var(--border);
  padding: 6px 13px; border-radius: 999px; color: var(--text-sub); font-weight: 600;
}
.chip b { color: var(--text); font-variant-numeric: tabular-nums; }
.chip.over b { color: #ef4444; }
.chip.ok b { color: var(--accent-ink); }

/* ---- form elements ---- */
.field { margin: 15px 0; }
.field > label { display: block; font-size: 13px; font-weight: 800; color: var(--text-sub); margin-bottom: 7px; letter-spacing: .01em; }
input.fi, select.fi {
  width: 100%; padding: 13px 15px; border: 1.5px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface-solid); color: var(--text); font-size: 16px; font-family: inherit;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input.fi:focus, select.fi:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(164,18,58,0.14); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
input[type="range"].fi { padding: 0; accent-color: var(--accent); background: transparent; border: none; }
.result-big { font-size: 38px; font-weight: 900; text-align: center; margin: 10px 0 2px; font-variant-numeric: tabular-nums; letter-spacing: -.03em;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.result-sub { text-align: center; color: var(--text-sub); font-size: 14px; margin-top: 2px; }
.seg { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 15px; }
.seg button {
  flex: 1; min-width: 82px; padding: 11px; border: 1.5px solid var(--border-strong); background: var(--surface-solid);
  color: var(--text-sub); border-radius: 12px; font-weight: 800; font-size: 14px; cursor: pointer; font-family: inherit;
  transition: all .15s ease;
}
.seg button:hover { border-color: var(--accent); color: var(--accent-ink); }
.seg button.active { background: var(--grad); border-color: transparent; color: #fff; box-shadow: var(--shadow-glow); }
.pw-out {
  font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 19px; word-break: break-all;
  background: var(--surface-2); border: 1.5px solid var(--border-strong); border-radius: var(--radius-sm); padding: 16px; min-height: 28px; color: var(--text);
}
.checks { display: flex; flex-wrap: wrap; gap: 16px; margin: 15px 0; }
.checks label { display: flex; align-items: center; gap: 7px; font-size: 14.5px; font-weight: 700; cursor: pointer; }
.checks input { accent-color: var(--accent); width: 18px; height: 18px; }
.range-val { font-weight: 900; color: var(--accent-ink); font-variant-numeric: tabular-nums; }
.strength { height: 9px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin: 6px 0 2px; }
.strength > i { display: block; height: 100%; width: 0; border-radius: 999px; transition: width .25s ease, background .25s ease; }

/* ---- content ---- */
.content { margin: 10px 0 24px; }
.content h2 { font-size: 22px; margin: 34px 0 12px; font-weight: 800; letter-spacing: -.02em; }
.content h3 { font-size: 17px; margin: 22px 0 7px; font-weight: 800; }
.content p, .content li { color: var(--text); font-size: 15px; }
.content code { background: var(--surface-2); padding: 2px 7px; border-radius: 7px; font-size: 13.5px; }
.faq dt { font-weight: 800; margin: 18px 0 5px; }
.faq dd { margin: 0 0 5px; color: var(--text-sub); font-size: 14.5px; }

/* ---- related ---- */
.related { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }

/* ---- 占い結果リスト（テキスト結果向け） ---- */
.result-list { display: flex; flex-direction: column; gap: 10px; margin: 18px 0 4px; }
.result-item {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 14px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 13px; padding: 13px 16px;
}
.result-item .rl-label { font-size: 13.5px; color: var(--text-sub); font-weight: 700; flex-shrink: 0; padding-top: 2px; }
.result-item .rl-value {
  font-size: 16.5px; font-weight: 800; color: var(--accent-ink); text-align: right; line-height: 1.55; word-break: break-word;
}
.result-item.full { flex-direction: column; align-items: stretch; gap: 6px; }
.result-item.full .rl-value { text-align: left; font-size: 15.5px; }

/* 診断結果カード（SNSシェア映え） */
.result-card {
  text-align: center; padding: 36px 24px; border-radius: 22px;
  background: var(--grad); color: #fff; box-shadow: var(--shadow-glow); margin: 10px 0 16px;
}
.result-card .rc-emoji { font-size: 60px; line-height: 1; }
.result-card .rc-score { font-size: 40px; font-weight: 900; margin: 12px 0 2px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.result-card .rc-title { font-size: 27px; font-weight: 900; margin: 2px 0; letter-spacing: -.01em; }
.result-card .rc-copy { font-size: 15px; line-height: 1.7; margin-top: 12px; opacity: .96; }
.share-btn { display: block; width: 100%; text-align: center; box-sizing: border-box; }

/* トップの検索・カテゴリナビ（目次） */
.cat-nav { margin: 30px 0 8px; }
.search-wrap { position: relative; }
.search-wrap .search-ic { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); font-size: 18px; opacity: .45; pointer-events: none; }
.tool-search {
  width: 100%; padding: 16px 18px 16px 50px; border: 1px solid var(--border); border-radius: 16px;
  background: var(--surface-solid); color: var(--text); font-size: 16px; font-family: inherit; box-sizing: border-box;
  box-shadow: var(--shadow); transition: border-color .15s ease, box-shadow .15s ease;
}
.tool-search::placeholder { color: var(--text-sub); }
.tool-search:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(164,18,58,0.12), var(--shadow); }
.cat-chips { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.cat-chip {
  display: inline-flex; align-items: center; gap: 7px; font-size: 14px; font-weight: 800; white-space: nowrap;
  padding: 10px 17px; border-radius: 14px; background: var(--surface-solid); border: 1px solid var(--border);
  color: var(--text); box-shadow: var(--shadow); transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease, color .15s ease;
}
.cat-chip:hover { transform: translateY(-2px); border-color: var(--accent); color: var(--accent-ink); box-shadow: var(--shadow-lg); text-decoration: none; }
.cat-section { scroll-margin-top: 78px; }
.search-empty { text-align: center; color: var(--text-sub); padding: 30px 0; display: none; }

/* ---- 免責ノート ---- */
.note {
  font-size: 12.5px; color: var(--text-sub); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 14px; padding: 13px 16px; margin: 0 0 26px; line-height: 1.65;
}
.note b { color: var(--text); }

/* ---- カテゴリ見出し ---- */
.cat-head { display: flex; align-items: center; gap: 10px; margin: 44px 0 4px; }
.cat-head .cic { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; font-size: 19px; background: var(--grad-soft); border: 1px solid var(--border); }
.cat-head h2 { font-size: 22px; margin: 0; font-weight: 900; letter-spacing: -.02em; }
.cat-head p { margin: 0; font-size: 13px; color: var(--text-sub); }

/* ---- footer ---- */
.site-footer { border-top: 1px solid var(--border); margin-top: 50px; padding: 30px 0; color: var(--text-sub); font-size: 13px; }
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; }
.site-footer a { color: var(--text-sub); }

/* ---- rich input (単位埋め込み) ---- */
.input-group { position: relative; display: flex; align-items: center; }
.input-group .fi { font-size: 19px; font-weight: 700; }
.input-group.pre .fi { padding-left: 48px; }
.input-group.suf .fi { padding-right: 52px; }
.affix {
  position: absolute; color: var(--accent-ink); font-weight: 800; font-size: 17px; pointer-events: none;
  display: flex; align-items: center; gap: 4px;
}
.affix.l { left: 18px; }
.affix.r { right: 18px; }
.affix .u { font-size: 13px; color: var(--text-sub); font-weight: 700; }
/* ラベルをアイコン付きの見出し風に */
.field > label.rich {
  display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text);
  text-transform: none; letter-spacing: 0; margin-bottom: 9px;
}
.field > label.rich .lic {
  width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-size: 14px;
  background: var(--grad-soft); border: 1px solid var(--border);
}

@media (max-width: 560px) {
  .hero { padding: 40px 0 10px; }
  .hero h1 { font-size: 30px; }
  .tool-head h1 { font-size: 25px; }
  .result-big { font-size: 32px; }
  .stat .num { font-size: 25px; }
  .field-row { grid-template-columns: 1fr; }
}
