:root {
  --paper: #fff6f8;
  --ink: #3b3340;
  --muted: #74697a;
  --pink: #f27a9b;
  --pink-deep: #c73a66;
  --line: #f3dfe6;
  --bg: #ffdde0;
  --accent: #c2475a;
  font-family: 'Zen Maru Gothic', -apple-system, 'Hiragino Maru Gothic ProN', 'Hiragino Sans', sans-serif;
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
  line-break: strict;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); line-height: 1.75; }
a { color: var(--pink-deep); }
img { max-width: 100%; }
.nowrap { display: inline-block; }

.site-header { background: #fff; border-bottom: 1px solid var(--line); }
.site-header .inner { max-width: 520px; margin: 0 auto; padding: 8px 16px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; }
.logo { display: inline-flex; align-items: baseline; gap: 6px; text-decoration: none; color: var(--ink); font-weight: 700; font-size: 1.15rem; }
.logo img { align-self: center; }
.logo small { font-family: 'Gowun Dodum', sans-serif; font-size: 0.75rem; color: var(--pink-deep); }
.nav { display: flex; gap: 4px; }
.nav a { padding: 2px 10px; border-radius: 999px; text-decoration: none; font-size: 0.8rem; color: var(--muted); }
.nav a[aria-current='page'] { color: #fff; background: var(--pink-deep); }

main { max-width: 520px; margin: 0 auto; padding: 20px 16px 48px; }
.hero { text-align: center; margin: 4px 0 20px; }
.hero h1 { font-size: 1.55rem; line-height: 1.45; margin: 0 0 8px; }
.hero p { margin: 0; color: var(--muted); font-size: 0.92rem; }
.bubble {
  display: inline-block; margin-bottom: 10px; padding: 4px 14px; border-radius: 999px 999px 999px 4px;
  background: #fff; border: 1px solid var(--line); font-size: 0.85rem; color: var(--pink-deep);
}

.panel { background: #fff; border-radius: 24px; padding: 20px; box-shadow: 0 6px 24px rgba(199, 58, 102, 0.07); margin-bottom: 16px; }
.panel h2 { font-size: 1.05rem; margin: 0 0 12px; }
.panel > p:last-child { margin-bottom: 0; }

form { display: grid; gap: 16px; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend, label { font-size: 0.9rem; font-weight: 700; }
legend { padding: 0; margin-bottom: 6px; }
label { display: grid; gap: 6px; }
.hint { font-weight: 400; color: var(--muted); font-size: 0.8rem; }
.date-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.date-fields select:first-of-type { grid-column: 1 / -1; }
.time-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
select, .text-input {
  font: inherit; font-size: 16px; width: 100%; min-height: 48px; padding: 8px 32px 8px 14px; appearance: none;
  border: 1.5px solid var(--line); border-radius: 14px; color: var(--ink);
  background: #fffafc url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23c73a66' stroke-width='2'/%3E%3C/svg%3E") no-repeat right 14px center;
}
select:focus, .text-input:focus { outline: none; border-color: var(--pink); }
.text-input { padding-right: 14px; background: #fffafc; }
/* 文字数 (--n) が多いほど小さくして、パネル幅に収める. */
.pyramid { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.35em; justify-items: center; font-variant-numeric: tabular-nums; font-size: min(1rem, calc((100vw - 100px) / var(--n, 5) / 2.4)); }
.pyramid li { display: flex; gap: 0.2em; }
.pyramid span { width: 2.1em; text-align: center; border-radius: 10px; padding: 4px 0; background: #fbeef2; }
.pyramid .syllables span { font-family: 'Gowun Dodum', sans-serif; background: none; font-weight: 700; color: var(--accent); }
.pyramid .syllables span.partner { color: var(--ink); }
.pyramid li:last-child span { background: var(--accent); color: #fff; font-weight: 700; }
.links a:last-child:nth-child(odd) { grid-column: 1 / -1; }
details { border: 1.5px dashed var(--line); border-radius: 14px; padding: 10px 14px; }
details summary { cursor: pointer; font-size: 0.9rem; color: var(--muted); list-style: none; }
details summary::-webkit-details-marker { display: none; }
details summary::after { content: '＋'; float: right; color: var(--pink-deep); }
details[open] summary::after { content: '－'; }
details[open] { display: grid; gap: 14px; padding-bottom: 14px; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; background: #fbeef2; border-radius: 999px; padding: 4px; }
.segmented label { display: block; text-align: center; padding: 8px 0; border-radius: 999px; cursor: pointer; font-weight: 500; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label:has(input:checked) { background: #fff; color: var(--pink-deep); font-weight: 700; box-shadow: 0 2px 8px rgba(199, 58, 102, 0.12); }

.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 52px; padding: 0 20px; border: 0; border-radius: 999px; cursor: pointer;
  font: inherit; font-weight: 700; font-size: 1rem; text-decoration: none; text-align: center;
  color: #fff; background: linear-gradient(135deg, #d1436f, var(--pink-deep));
  box-shadow: 0 6px 16px rgba(199, 58, 102, 0.22);
}
.button.sub { color: var(--pink-deep); background: #fff; border: 1.5px solid var(--pink); box-shadow: none; }
.button.line { background: #06c755; box-shadow: none; }
.button.x { background: #111; box-shadow: none; }
.text-button { background: none; border: 0; padding: 8px; font: inherit; font-size: 0.85rem; color: var(--muted); text-decoration: underline; cursor: pointer; }
.actions { display: grid; gap: 10px; margin: 16px 0; }
.share { grid-template-columns: 1fr 1fr; }
.share [data-share='image'] { grid-column: 1 / -1; }
.error { color: var(--pink-deep); font-size: 0.9rem; margin: 0; }
.center { text-align: center; }

.result { background: var(--bg); border-radius: 28px; padding: 24px 20px; text-align: center; margin-bottom: 4px; }
.result .kicker { color: var(--accent); font-size: 0.9rem; margin: 0; }
.kanji {
  width: 120px; height: 120px; margin: 12px auto 4px; border-radius: 50%; background: #fff;
  display: grid; place-items: center; font-size: 4rem; font-weight: 700; color: var(--accent); line-height: 1;
}
.kanji.small { width: 72px; height: 72px; font-size: 2.4rem; margin: 0 auto 6px; }
.kanji.hangul { width: auto; min-width: 72px; padding: 0 14px; border-radius: 36px; font-family: 'Gowun Dodum', sans-serif; font-size: 1.5rem; }
.reading { margin: 0 0 6px; font-size: 0.8rem; color: var(--accent); }
.result h2 { font-size: 1.45rem; margin: 0 0 8px; line-height: 1.4; }
.tags { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; padding: 0; margin: 0 0 12px; list-style: none; }
.tags li { background: rgba(255, 255, 255, 0.75); color: var(--accent); border-radius: 999px; padding: 2px 12px; font-size: 0.85rem; white-space: nowrap; }
.result .summary { text-align: left; margin: 0; }
.result .summary + .summary { margin-top: 10px; }
.result .note { text-align: left; }
.stars { margin: 4px 0 12px; color: var(--accent); font-weight: 700; letter-spacing: 0.05em; }
.rank { font-size: 1rem; font-weight: 700; color: var(--accent); margin: 8px 0 0; }
.rank b { font-size: 3rem; line-height: 1.1; }
.score { font-size: 3rem; font-weight: 700; color: var(--accent); line-height: 1.1; margin: 8px 0 0; }
.score small, .rank small { font-size: 1rem; }
.duo { display: flex; justify-content: center; align-items: center; gap: 12px; margin: 8px 0; }
.duo .heart { color: var(--accent); font-size: 1.5rem; }
.duo p { margin: 0; font-size: 0.75rem; color: var(--muted); }
.duo b { display: block; font-size: 0.85rem; color: var(--ink); white-space: nowrap; }

.topics { display: grid; gap: 10px; padding: 0; margin: 0; list-style: none; }
.topics li { background: #fffafc; border-radius: 16px; padding: 12px 14px; }
.topics b { display: block; font-size: 0.85rem; color: var(--pink-deep); }

.chat { display: grid; gap: 10px; }
.chat p {
  position: relative; margin: 0 0 0 44px; padding: 10px 14px; background: #fff0f4; border-radius: 4px 18px 18px 18px; font-size: 0.95rem;
}
.chat p:first-child::before {
  content: 'オ'; position: absolute; left: -44px; top: 0; width: 34px; height: 34px; border-radius: 50%;
  background: var(--pink-deep); color: #fff; font-weight: 700; display: grid; place-items: center; font-size: 0.85rem;
}
.moods { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.moods button {
  font: inherit; font-size: 0.9rem; padding: 6px 14px; border-radius: 999px; cursor: pointer;
  border: 1.5px solid var(--line); background: #fff; color: var(--ink);
}
.moods button[aria-pressed='true'] { background: var(--pink-deep); border-color: var(--pink-deep); color: #fff; }

.balance { display: grid; gap: 6px; margin: 0; }
.balance div { display: grid; grid-template-columns: 2em 1fr 1.5em; align-items: center; gap: 8px; font-size: 0.85rem; }
.balance .bar { height: 12px; border-radius: 999px; background: #f6eef2; overflow: hidden; }
.balance .bar span { display: block; height: 100%; border-radius: inherit; }

.pillars { width: 100%; border-collapse: separate; border-spacing: 6px; text-align: center; }
.pillars th { font-size: 0.75rem; font-weight: 500; color: var(--muted); }
.pillars td { background: #fffafc; border-radius: 12px; padding: 6px 0; font-size: 1.3rem; font-weight: 700; line-height: 1.3; }
.pillars td.me { background: var(--bg); color: var(--accent); }
.note { font-size: 0.8rem; color: var(--muted); margin: 8px 0 0; }

.ranking { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.ranking li { display: grid; grid-template-columns: 2.6em 2em 1fr auto; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 14px; background: #fffafc; font-size: 0.9rem; }
.ranking .no { font-weight: 700; color: var(--pink-deep); }
.ranking .k { font-weight: 700; font-size: 1.2rem; text-align: center; }
.ranking .t { line-height: 1.4; }
.ranking a.t { color: var(--pink-deep); text-decoration: none; font-weight: 700; }
.ranking .t small { display: block; color: var(--muted); font-size: 0.75rem; }
.ranking li.me { outline: 2px solid var(--pink-deep); background: #fff; }

.links { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.links a, .type-chip { display: block; background: #fff; border-radius: 18px; padding: 14px; text-decoration: none; color: var(--ink); border: 1px solid var(--line); }
.links b { display: block; color: var(--pink-deep); }
.links span { font-size: 0.8rem; color: var(--muted); }
.type-chip { border: 0; line-height: 1.5; }
.type-chip i { display: block; font-style: normal; font-weight: 700; font-size: 1.8rem; line-height: 1.2; }
.type-chip small { display: block; font-size: 0.7rem; }
.type-chip b { font-size: 0.85rem; white-space: nowrap; letter-spacing: -0.02em; }

.prose h1 { font-size: 1.4rem; margin-top: 0; }
.prose h2 { font-size: 1.05rem; margin-top: 28px; }
.prose dt { font-weight: 700; font-size: 0.9rem; }
.prose dd { margin: 0 0 12px; }
main.prose { margin: 20px auto 48px; width: calc(100% - 32px); max-width: 488px; }

.site-footer { border-top: 1px solid var(--line); text-align: center; padding: 24px 16px 40px; font-size: 0.8rem; color: var(--muted); }
.site-footer nav { display: flex; justify-content: center; flex-wrap: wrap; gap: 4px 16px; margin-bottom: 8px; }
.site-footer a { color: var(--muted); }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 0.9rem; transition: 0.25s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
[hidden] { display: none !important; }
