:root {
  --wall: #fdeef2; /* さくら色の壁 */
  --floor: #cfe9dd; /* ミントの床 */
  --paper: #fffdfd;
  --ink: #55304f; /* ぶどう色の文字 */
  --ink-soft: #7a5674;
  --rose: #b83a6b; /* ボタンとリンク */
  --rose-deep: #962b55;
  --line: #efcfda;
  --birth: #ffdf94;
  --childhood: #a9dcc3;
  --youth: #b2d8f0;
  --turning: #f5a9c1;
  --late: #cfbfec;
  --measure: 40rem;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  background: var(--wall);
  color: var(--ink);
  font: 500 1rem/1.85 "Zen Maru Gothic", "Hiragino Maru Gothic ProN", "Hiragino Sans", sans-serif;
  line-break: strict;
  overflow-wrap: anywhere;
}

h1, h2, h3, p, ol, ul, dl, dd { margin: 0; }
h1, h2, h3 { font-weight: 700; line-height: 1.45; word-break: auto-phrase; text-wrap: balance; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.375rem; }
h3 { font-size: 1.125rem; }
ol[class] { padding: 0; list-style: none; }
a { color: var(--rose); text-underline-offset: 0.2em; }
:focus-visible { outline: 3px solid var(--rose); outline-offset: 3px; border-radius: 4px; }
[tabindex="-1"]:focus { outline: none; }

main { flex: 1; display: flex; flex-direction: column; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.wrap { width: min(100% - 2.5rem, var(--measure)); margin-inline: auto; }

/* ヘッダー・フッター */
.site-header { background: var(--paper); }
.site-header-inner {
  width: min(100% - 2.5rem, 60rem);
  margin-inline: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0 0.75rem;
}
.site-header a { display: flex; align-items: center; min-height: 3rem; white-space: nowrap; color: var(--ink); text-decoration: none; }
.site-name { gap: 0.5rem; font-weight: 700; }
.site-name img { width: 1.5rem; height: 1.5rem; }
.site-nav { display: flex; gap: 1rem; font-size: 0.875rem; }
.site-nav a[aria-current] { box-shadow: inset 0 -3px var(--rose); }

.site-footer { padding: 2rem 0 2.5rem; background: var(--ink); color: #fff; font-size: 0.875rem; }
.footer-name { margin-bottom: 0.25rem; font-size: 1rem; font-weight: 700; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 0 1.5rem; margin-top: 0.75rem; }
.site-footer a { display: inline-flex; align-items: center; min-height: 2.75rem; color: #fff; }
.site-footer :focus-visible { outline-color: var(--birth); }

/* ボタン */
.button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 3.5rem;
  padding: 0.5rem 2rem;
  border: 0;
  border-radius: 999px;
  background: var(--rose);
  box-shadow: 0 5px 0 var(--rose-deep);
  color: #fff;
  font: inherit;
  font-size: 1.125rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
}
.button:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--rose-deep); }
.button:disabled { opacity: 0.65; cursor: default; }
.button:focus-visible { border-radius: 999px; }
.button-quiet { background: var(--paper); box-shadow: inset 0 0 0 2px var(--rose); color: var(--rose); }
.button-quiet:active { transform: none; box-shadow: inset 0 0 0 2px var(--rose); background: var(--wall); }

/* ガチャの置かれた部屋（壁と床） */
.room { flex: 1 0 auto; background: linear-gradient(var(--wall) calc(100% - 9rem), var(--floor) 0); text-align: center; }
.room-copy { padding-top: 1.5rem; }
.room-copy p { margin-top: 0.5rem; }
.machine { display: block; width: min(66vw, 17rem); height: auto; margin: 1rem auto 0; }
#knob, #capsules { transform-box: fill-box; transform-origin: center; }
.is-empty #prize { visibility: hidden; }
.room-action { padding: 1rem 0 1.75rem; }
.room-action .button { width: min(100%, 20rem); }
.status { margin-top: 0.75rem; font-weight: 700; }
.status:empty { display: none; }

@media (min-width: 48rem) {
  .home-room .room-inner {
    width: min(100% - 2.5rem, 56rem);
    margin-inline: auto;
    display: grid;
    grid-template-columns: 1fr 20rem;
    grid-template-rows: 1fr auto auto 1fr;
    column-gap: 4rem;
    text-align: left;
  }
  .home-room .room-copy { grid-row: 2; width: auto; margin: 0; }
  .home-room .room-copy h1 { font-size: 2.5rem; }
  .home-room .room-action { grid-row: 3; width: auto; margin: 0; }
  .home-room .machine { grid-area: 1 / 2 / -1; width: 100%; margin: 2rem 0; }
}

/* 物語：5つのカプセルを糸でつなぐ */
.section { padding: 2.5rem 0 3rem; }
.sheet { background: var(--paper); }
.story { margin-top: 1.75rem; }
.chapter { position: relative; padding: 0 0 2rem 3.25rem; }
.chapter::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.1rem;
  z-index: 1;
  width: 2.25rem;
  height: 2.25rem;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: linear-gradient(var(--capsule) 47%, var(--ink) 0 53%, #fff 0);
  transform: rotate(-18deg);
}
.chapter:not(:last-child)::after {
  content: "";
  position: absolute;
  left: calc(1.125rem - 1px);
  top: 1rem;
  bottom: -1rem;
  border-left: 2px dashed var(--ink-soft);
}
.chapter-birth { --capsule: var(--birth); }
.chapter-childhood { --capsule: var(--childhood); }
.chapter-youth { --capsule: var(--youth); }
.chapter-turning { --capsule: var(--turning); }
.chapter-later { --capsule: var(--late); }
.chapter-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.25rem 0.75rem; }
.is-rarest .chapter-body { margin: -0.75rem 0 0 -0.5rem; padding: 0.75rem 1rem 1rem; border-radius: 1rem; background: #fff3d4; }
.rarest-badge { padding: 0.125rem 0.75rem; border-radius: 999px; background: var(--ink); color: #fff; font-size: 0.8125rem; font-weight: 700; }
.rarest-badge small { margin-left: 0.5rem; font-size: 0.75rem; font-weight: 500; }
.chapter-text { margin-top: 0.25rem; }

.rarity { padding: 1.75rem 1.25rem; border-radius: 1.5rem; background: var(--birth); text-align: center; }
.rarity-value { display: block; font-size: clamp(1.75rem, 9vw, 2.75rem); font-weight: 700; line-height: 1.4; }
.rarity-note { margin-top: 0.5rem; font-size: 0.8125rem; line-height: 1.7; }

.luck { margin-top: 2rem; padding-left: 1.25rem; border-left: 6px solid var(--floor); }
.luck p { margin-top: 0.5rem; }
.result-actions { display: grid; gap: 1rem; margin-top: 2rem; }
.share-text { width: 100%; height: 15rem; padding: 0.75rem; border: 2px solid var(--line); border-radius: 0.75rem; color: inherit; font: inherit; }
.fine-print { margin-top: 1.5rem; color: var(--ink-soft); font-size: 0.875rem; }
.fine-print:first-child { margin: 0 0 1rem; }

/* トップの一覧 */
.menu { margin: 1rem 0 0; padding: 0; list-style: none; }
.menu li { position: relative; padding: 1rem 0 1rem 3.25rem; }
.menu li + li { border-top: 2px dotted var(--line); }
.menu li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 1.25rem;
  width: 2.25rem;
  height: 2.25rem;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: linear-gradient(var(--capsule) 47%, var(--ink) 0 53%, #fff 0);
  transform: rotate(-18deg);
}
.menu a { color: var(--ink); font-size: 1.125rem; font-weight: 700; }
.menu a::after { content: ""; position: absolute; inset: 0; } /* 行全体を押せるようにする */
.menu p { color: var(--ink-soft); font-size: 0.875rem; line-height: 1.7; }
.menu-today { --capsule: var(--birth); }
.menu-birthday { --capsule: var(--youth); }
.menu-compatibility { --capsule: var(--childhood); }
.menu-tarot { --capsule: var(--late); }
.menu-yumemi { --capsule: var(--birth); }
.menu-year2027 { --capsule: var(--youth); }
.menu-gacha { --capsule: var(--turning); }

/* 誕生日占い・星座相性 */
.lead { margin-top: 0.75rem; }
.grid-title { margin-top: 2rem; }
.date-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(5.25rem, 1fr)); gap: 0.5rem; margin: 1rem 0 0; padding: 0; list-style: none; }
.date-grid a {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 3rem;
  border-radius: 0.75rem;
  background: var(--wall);
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
}
.date-grid a:hover { background: var(--birth); }
.month-grid { grid-template-columns: repeat(3, 1fr); }
.month-grid a { min-height: 4rem; font-size: 1.25rem; }
.word-grid { display: flex; flex-wrap: wrap; }
.word-grid a { padding-inline: 1.125rem; }
.date-grid [aria-current] { background: var(--birth); }
.keywords { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.75rem 0 0; padding: 0; list-style: none; }
.keywords li { padding: 0.125rem 0.875rem; border-radius: 999px; background: #fff3d4; font-weight: 700; }
.meanings { width: 100%; margin-top: 2rem; border-collapse: collapse; }
.meanings caption { margin-bottom: 0.5rem; font-size: 1.25rem; font-weight: 700; text-align: left; }
.meanings th, .meanings td { padding: 0.625rem 0.5rem; border-bottom: 2px dotted var(--line); text-align: left; }
.meanings thead th { color: var(--ink-soft); font-size: 0.875rem; }
.meanings th:first-child { width: 6rem; white-space: nowrap; }
.year-theme { margin-top: 1.25rem; padding: 1rem 1.25rem; border-radius: 1.5rem; background: #fff3d4; font-size: 1.25rem; font-weight: 700; text-align: center; }
.theme-list { margin: 0.5rem 0 0; padding: 0; list-style: none; }
.theme-list li { position: relative; display: flex; align-items: baseline; gap: 1rem; padding: 0.75rem 0; border-bottom: 2px dotted var(--line); }
.theme-list a { flex: none; width: 4rem; color: var(--ink); font-weight: 700; }
.theme-list a::after { content: ""; position: absolute; inset: 0; } /* 行全体を押せるようにする */
.birthday-text { margin-top: 1.25rem; font-size: 1.0625rem; line-height: 2; }
.birthday-lucky { margin-top: 2rem; padding: 1.25rem; border-radius: 1.5rem; background: #fff3d4; }
.birthday-lucky dl div { display: flex; justify-content: space-between; gap: 1rem; margin-top: 0.75rem; }
.birthday-lucky dt { flex: none; color: var(--ink-soft); font-size: 0.875rem; }
.birthday-lucky dd { font-weight: 700; text-align: right; }
.score { display: flex; justify-content: space-between; align-items: center; margin-top: 1.25rem; padding: 0.75rem 1.25rem; border-radius: 1.5rem; background: #fff3d4; }
.score strong { font-size: 2.25rem; line-height: 1.4; }
.score small { font-size: 1rem; }
.pager { display: flex; justify-content: space-between; gap: 0.5rem; margin-top: 2rem; }
.pager a { display: inline-flex; align-items: center; min-height: 2.75rem; font-size: 0.875rem; font-weight: 700; }

/* 今日の運勢 */
.date { color: var(--ink-soft); }
.ranking { margin-top: 1.25rem; }
.rank { display: grid; grid-template-columns: 3rem 1fr; gap: 1rem; padding: 1.25rem 0; border-top: 2px dotted var(--line); }
.rank-number {
  display: flex;
  justify-content: center;
  align-items: baseline;
  height: 3rem;
  border-radius: 50%;
  background: var(--wall);
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 3rem;
}
.rank-number small { font-size: 0.6875rem; }
.rank:nth-child(1) .rank-number { background: var(--birth); }
.rank:nth-child(2) .rank-number { background: var(--youth); }
.rank:nth-child(3) .rank-number { background: var(--turning); }
.rank-name { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 0.75rem; }
.rank-head { display: flex; justify-content: space-between; align-items: baseline; gap: 0.75rem; }
.rank-score { flex: none; font-weight: 700; }
.rank-period { color: var(--ink-soft); font-size: 0.8125rem; font-weight: 500; }
.rank-aspects { display: grid; grid-template-columns: auto 1fr; gap: 0.25rem 0.75rem; margin-top: 0.5rem; font-size: 0.9375rem; line-height: 1.7; }
.rank-aspects dt { color: var(--rose); font-weight: 700; }
.rank-lucky { margin-top: 0.5rem; color: var(--ink-soft); font-size: 0.875rem; white-space: pre-line; }
.notice { padding: 1rem 0; }
.more { margin-top: 0.5rem; }
.more a { display: inline-flex; align-items: center; min-height: 2.75rem; font-weight: 700; }

/* 文章ページ */
.prose h2 { margin-top: 2.25rem; }
.prose h3 { margin-top: 1.5rem; font-size: 1.0625rem; line-height: 1.6; }
.prose p, .prose ul, .prose dl { margin-top: 0.75rem; }
.prose ul { padding-left: 1.25rem; }
.prose dt { margin-top: 1rem; font-weight: 700; }
