:root {
  /* モノクロ（名前は以前のままですが、中身は白・灰・黒です） */
  --bg: #ffffff;
  --sky-pale: #f6f6f6;
  --sky: #e8e8e8;
  --sky-line: #cfcfcf;
  --blue: #222222;
  --blue-deep: #111111;
  --ink: #222222;
  --ink-soft: #6b6b6b;
  --gold: #555555;
  --gold-soft: #bdbdbd;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Shippori Mincho", "Yu Mincho", "YuMincho", "Hiragino Mincho ProN", serif;
  font-size: 17px;
  line-height: 2;
  letter-spacing: 0.04em;
}
main {
  max-width: 560px;
  margin: 0 auto;
  padding: 48px 20px calc(64px + env(safe-area-inset-bottom));
  min-height: 100vh;
}

/* 画面の切り替え */
.screen { display: none; }
.screen.active { display: block; animation: fade 1.2s ease both; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ボタン */
.btn {
  display: block;
  width: 100%;
  max-width: 340px;
  margin: 32px auto 0;
  padding: 16px 20px;
  min-height: 56px;
  border: 1px solid var(--blue);
  border-radius: 0;
  background: #fff;
  color: var(--blue-deep);
  font: inherit;
  font-size: 17px;
  letter-spacing: 0.12em;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background .3s, opacity .8s;
}
.btn[hidden] { display: none; }
.btn:hover { background: var(--sky-pale); }
.btn.primary { background: var(--blue); color: #fff; }
.btn.primary:hover { background: var(--blue-deep); }
.btn.small { min-height: 46px; padding: 10px 16px; font-size: 15px; max-width: 280px; margin-top: 20px; }
.btn.waiting { opacity: 0; pointer-events: none; }
.btn:focus-visible, textarea:focus-visible, .mark-link:focus-visible, .card:focus-visible {
  outline: 2px solid var(--blue); outline-offset: 3px;
}

/* 飾り（金は細い線だけ） */
.ornament {
  width: 64px; height: 1px; margin: 22px auto;
  background: var(--gold-soft);
  position: relative;
}
.ornament::after {
  content: ""; position: absolute; left: 50%; top: 50%;
  width: 5px; height: 5px; margin: -3px 0 0 -3px;
  border: 1px solid var(--gold); transform: rotate(45deg); background: #fff;
}

/* 表紙 */
.cover { text-align: center; padding-top: 7vh; }
.cover-mark { width: 120px; margin: 0 auto 28px; }
.cover-mark svg { width: 100%; display: block; }
.site-name { font-size: min(34px, 8.2vw); font-weight: 500; letter-spacing: 0.22em; margin: 0; padding-left: 0.22em; white-space: nowrap; }
.tagline { color: var(--ink-soft); font-size: 16px; line-height: 2.1; margin: 0 auto; max-width: 22em; white-space: pre-line; }

/* 見出し */
.heading {
  text-align: center; font-weight: 500; font-size: 22px; letter-spacing: 0.3em; margin: 8px 0 8px;
}
.heading::after {
  content: ""; display: block; width: 40px; height: 1px; background: var(--gold-soft); margin: 14px auto 0;
}
.lead { text-align: center; margin: 24px 0; }
.label { text-align: center; color: var(--ink-soft); font-size: 14px; letter-spacing: 0.2em; margin: 0 0 6px; }

/* 問い */
textarea {
  width: 100%;
  padding: 16px;
  border: 1px solid var(--sky-line);
  border-radius: 12px;
  background: var(--sky-pale);
  color: var(--ink);
  font: inherit; font-size: 17px; line-height: 1.8;
  resize: vertical;
}
/* 登録・ログイン */
.auth { text-align: center; padding-top: 3vh; }
.auth-tabs { display: flex; max-width: 340px; margin: 4px auto 22px; border-bottom: 1px solid var(--sky-line); }
.auth-tabs[hidden] { display: none; }
.auth-tabs button {
  flex: 1; border: 0; background: none; padding: 12px 4px; min-height: 48px;
  font: inherit; font-size: 16px; color: var(--ink-soft); cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.auth-tabs button.on { color: var(--blue-deep); border-bottom-color: var(--blue); }
.auth-form { max-width: 340px; margin: 0 auto; text-align: left; }
.auth-form[hidden] { display: none; }
.auth-form label { display: block; font-size: 14px; color: var(--ink-soft); margin: 0 0 14px; line-height: 1.7; }
.auth-form input {
  display: block; width: 100%; margin-top: 4px; padding: 12px 14px;
  border: 1px solid var(--sky-line); border-radius: 10px; background: var(--sky-pale);
  color: var(--ink); font-family: inherit; font-size: 17px; letter-spacing: 0.04em;
}
.auth-form input:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.auth-form .btn { margin-top: 18px; }
.auth-lead { font-size: 15px; line-height: 1.9; margin: 0 0 18px; text-align: justify; }
.auth-note { font-size: 13px; color: var(--ink-soft); text-align: center; margin: 18px 0 0; }
.auth-link { text-align: center; font-size: 14px; margin: 18px 0 0; }
.auth-link[hidden] { display: none; }
.auth-link a { color: var(--blue-deep); }
.ok { color: var(--blue-deep); font-size: 14px; line-height: 1.8; margin: 8px 0 0; }
.ok:empty { display: none; }
.btn:disabled { opacity: .5; cursor: default; }
.error { color: #8a3b3b; font-size: 14px; min-height: 1.5em; margin: 8px 0 0; text-align: center; }

/* 引く前の手順 */
.prep { text-align: center; padding-top: 8vh; }
.breath {
  width: 120px; height: 120px; margin: 0 auto 40px;
  border-radius: 50%;
  border: 1px solid var(--sky-line);
  background: var(--sky-pale);
  animation: breath 8s ease-in-out infinite;
}
@keyframes breath {
  0%, 100% { transform: scale(0.7); opacity: .6; }
  50% { transform: scale(1); opacity: 1; }
}
.prep-text { font-size: 19px; line-height: 2.2; margin: 0 auto; max-width: 18em; min-height: 6.6em; white-space: pre-line; }
.prep-text.fade { animation: fade 1.6s ease both; }
.prep-q { color: var(--blue-deep); margin: 12px auto 0; max-width: 20em; }
.prep-q:empty { display: none; }

/* 引く */
.draw-q { text-align: center; color: var(--ink-soft); font-size: 15px; margin: 0 0 4px; }
.hint { text-align: center; font-size: 15px; color: var(--blue-deep); min-height: 2em; margin: 0 0 20px; }
.cross {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-areas: ". top ." "left center right" ". bottom deck";
  gap: 10px 10px;
  max-width: 400px;
  margin: 0 auto;
}
.slot { text-align: center; }
.slot.center { grid-area: center; }
.slot.top { grid-area: top; }
.slot.bottom { grid-area: bottom; }
.slot.right { grid-area: right; }
.slot.left { grid-area: left; }
.card {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
  padding: 0;
  border: 1px solid var(--sky-line);
  border-radius: 10px;
  background: var(--sky-pale);
  cursor: pointer;
  overflow: hidden;
  font: inherit;
}
.card .back, .card .face {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  transition: opacity 1.6s ease;
}
.card .back svg { width: 70%; }
.card .face { opacity: 0; background: #fff; padding: 8%; }
.card .face svg { width: 100%; height: 100%; }
.card.open { border-color: var(--gold-soft); cursor: default; }
.card.open .back { opacity: 0; }
.card.open .face { opacity: 1; }
.card.next { animation: glow 3s ease-in-out infinite; }
@keyframes glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(0,0,0,0); }
  50% { box-shadow: 0 0 0 4px rgba(0,0,0,.14); }
}
.pos { font-size: 12px; line-height: 1.5; color: var(--ink-soft); margin: 6px 0 0; letter-spacing: 0.02em; }
.mname { font-size: 13px; line-height: 1.5; color: var(--ink); margin: 2px 0 0; min-height: 1.5em; opacity: 0; transition: opacity 1.6s; }
.slot.opened .mname { opacity: 1; }
.center-btn { min-height: 90px; }

/* まだ置かれていない場所（点線の枠だけ） */
.card.empty { background: transparent; border: 1px dashed var(--sky-line); cursor: default; }
.card.empty .back { opacity: 0; }
.card.flying { z-index: 5; }
.card.next.empty { border-color: var(--blue); }

/* 山 */
.deck-wrap { grid-area: deck; text-align: center; align-self: start; padding-top: 14%; transition: opacity 1s; }
.deck-wrap[hidden] { display: block; opacity: 0; pointer-events: none; }
.deck {
  position: relative; display: inline-block;
  width: 72%; aspect-ratio: 4 / 5;
  padding: 0; border: 0; background: none; cursor: pointer;
}
.deck span {
  position: absolute; inset: 0;
  border: 1px solid var(--sky-line); border-radius: 8px; background: var(--sky-pale);
}
.deck span:nth-child(1) { transform: translate(6px, 6px); }
.deck span:nth-child(2) { transform: translate(3px, 3px); }
.deck .top { display: flex; align-items: center; justify-content: center; animation: glow 3s ease-in-out infinite; }
.deck .top svg { width: 70%; }
.deck-cap { margin: 8px 0 0; font-size: 13px; color: var(--ink-soft); letter-spacing: 0.3em; line-height: 1.5; }

/* 読み解き */
.question-box {
  text-align: center;
  font-size: 18px;
  margin: 0 0 28px;
  padding: 18px 16px;
  border-top: 1px solid var(--sky-line);
  border-bottom: 1px solid var(--sky-line);
}
.mini-row { display: flex; justify-content: center; gap: 8px; margin-bottom: 28px; }
.mini {
  width: 56px; padding: 0; border: 1px solid var(--sky-line); border-radius: 8px;
  background: #fff; cursor: pointer; text-align: center; font: inherit;
}
.mini svg { width: 100%; display: block; }
.mini span { display: block; font-size: 11px; color: var(--ink-soft); line-height: 1.6; }
.r-item { margin: 0 0 6px; }
.r-head { margin: 22px 0 2px; font-size: 14px; color: var(--ink-soft); letter-spacing: 0.08em; line-height: 1.8; }
.r-no { color: var(--gold); margin-right: 4px; }
.mark-link {
  border: 0; background: none; padding: 4px 2px; margin-left: 6px;
  font: inherit; font-size: 15px; color: var(--blue-deep);
  border-bottom: 1px solid var(--sky-line);
  cursor: pointer;
}
.r-text { margin: 0; text-align: justify; }
.tap-note { font-size: 13px; color: var(--ink-soft); text-align: center; margin: 28px 0 0; }

/* 結び・案内 */
.closing { margin: 40px 0 0; padding: 0 4px; }
.closing p:last-child { margin: 0; text-align: justify; }
.invite {
  margin: 44px 0 0;
  padding: 28px 22px 30px;
  border: 1px solid var(--sky-line);
  border-radius: 14px;
  background: var(--sky-pale);
  text-align: center;
}
.invite h3 { margin: 0 0 12px; font-weight: 500; font-size: 18px; letter-spacing: 0.12em; }
.invite p { margin: 0; text-align: justify; font-size: 16px; }
.invite .btn { margin-top: 24px; }
/* 印の持ち帰り方・問いについて */
.sub-heading { text-align: center; font-weight: 500; font-size: 19px; letter-spacing: 0.2em; margin: 0 0 16px; }
.sub-heading::after { content: ""; display: block; width: 32px; height: 1px; background: var(--gold-soft); margin: 12px auto 0; }
.keep, .info { margin: 52px 0 0; }
.keep p, .info p { text-align: justify; margin: 0; }
.keep-marks { display: flex; justify-content: center; gap: 6px; margin: 22px 0 6px; }
.keep-mark {
  flex: 1; max-width: 96px; padding: 4px 2px 8px;
  border: 1px solid var(--sky-line); border-radius: 10px; background: #fff;
  font: inherit; text-align: center; cursor: pointer;
}
.keep-mark svg { width: 100%; display: block; }
.keep-mark.free { cursor: default; background: var(--sky-pale); border-style: dashed; display: flex; flex-direction: column; justify-content: flex-end; }
.km-q { display: flex; align-items: center; justify-content: center; flex: 1; font-size: 30px; color: var(--sky-line); }
.km-pos { display: block; font-size: 12px; color: var(--ink-soft); line-height: 1.6; }
.km-name { display: block; font-size: 11px; color: var(--ink); line-height: 1.5; letter-spacing: 0; }
.keep-steps { margin: 18px 0 0; padding-left: 1.6em; }
.keep-steps li { margin: 0 0 6px; text-align: justify; }
.keep-steps li::marker { color: var(--gold); }
.caution {
  margin: 18px 0 0 !important; padding: 12px 14px;
  border: 1px solid var(--sky-line); border-radius: 10px;
  font-size: 14px; line-height: 1.9; color: var(--ink-soft);
}
.disclaimer {
  margin: 48px 0 0; padding-top: 20px; border-top: 1px solid var(--sky);
  font-size: 13px; line-height: 1.9; color: var(--ink-soft); text-align: justify;
}
.period-note { font-size: 13px; line-height: 1.8; color: var(--blue-deep); margin: 18px auto 0; }
.period-note:empty { display: none; }
.cover-note { font-size: 12px; line-height: 1.9; color: var(--ink-soft); margin: 28px auto 0; max-width: 26em; text-align: justify; }

/* 詳しい説明 */
.modal { position: fixed; inset: 0; z-index: 10; display: flex; align-items: flex-end; justify-content: center; }
.modal[hidden] { display: none; }
.modal-bg { position: absolute; inset: 0; background: rgba(0,0,0,.35); animation: fade .5s both; }
.modal-box {
  position: relative;
  width: 100%; max-width: 520px; max-height: 92vh; overflow-y: auto;
  background: #fff;
  border-radius: 18px 18px 0 0;
  padding: 26px 22px calc(32px + env(safe-area-inset-bottom));
  text-align: center;
  animation: fade .6s both;
}
@media (min-width: 640px) {
  .modal { align-items: center; }
  .modal-box { border-radius: 18px; }
}
.modal-close {
  position: absolute; right: 12px; top: 12px;
  border: 0; background: none; padding: 10px 12px;
  font: inherit; font-size: 14px; color: var(--ink-soft); cursor: pointer;
}
.m-no { margin: 0; color: var(--gold); font-size: 14px; letter-spacing: 0.2em; }
.m-name { margin: 2px 0 0; font-weight: 500; font-size: 22px; letter-spacing: 0.2em; }
.m-word { margin: 0; color: var(--ink-soft); font-size: 14px; }
.m-sigil { width: 150px; margin: 14px auto 6px; }
.m-sigil svg, .m-disk svg { width: 100%; display: block; }
.m-meaning { margin: 8px auto 0; max-width: 22em; color: var(--blue-deep); font-weight: 500; }
.m-sections { text-align: left; margin: 22px 0 0; }
.m-sections dt {
  font-size: 14px; color: var(--ink-soft); letter-spacing: 0.12em; margin: 18px 0 2px;
  padding-left: 10px; border-left: 2px solid var(--gold-soft); line-height: 1.6;
}
.m-sections dd { margin: 0; text-align: justify; font-size: 16px; line-height: 1.95; }
.m-shape { text-align: left; font-size: 14px; color: var(--ink-soft); line-height: 1.9; margin: 24px 0 0; padding-top: 16px; border-top: 1px solid var(--sky); }
.r-key { margin: 0 0 4px; font-size: 13px; color: var(--ink-soft); line-height: 1.7; }
.m-disk { width: 100%; max-width: 340px; margin: 18px auto 0; animation: fade 1s both; }
.m-disk[hidden] { display: none; }

@media (max-width: 360px) {
  body { font-size: 16px; }
  .pos { font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
