/* 結果カード（/r/:id）と、その下の入口 */

/* ================= 結果カード ================= */

.r-screen {
  gap: 18px;
}

.r-top {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding-top: 4px;
}

.r-ticket {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
}

.r-ticket-label {
  font-size: 0.75rem;
  letter-spacing: 0.5em;
  color: var(--cream-3);
  margin-bottom: 8px;
}

.r-ticket-no {
  font-size: 4.5rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1;
}

.r-ticket-prefix {
  font-size: 1.125rem;
  margin-right: 0.3em;
  vertical-align: 0.3em;
  color: var(--cream-3);
}

.r-notice {
  margin: 0;
  padding: 8px 18px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-size: 0.875rem;
  letter-spacing: 0.14em;
  text-align: center;
}

.r-notice.is-warn {
  border-color: var(--bengara);
  border-radius: 6px;
  background: var(--bengara-soft);
  line-height: 1.8;
}

/* 紙: 少し明るい青緑の札。四隅に二重罫 */
.r-sheet {
  position: relative;
  padding: 34px 22px 26px;
  background:
    var(--grain),
    linear-gradient(180deg, rgba(0, 98, 107, 0.55), rgba(2, 65, 72, 0.55));
  background-blend-mode: soft-light, normal;
  border: 1px solid var(--line);
  box-shadow:
    inset 0 0 0 6px rgba(1, 42, 47, 0.35),
    inset 0 0 0 7px var(--line),
    0 20px 50px rgba(0, 0, 0, 0.35);
}

.r-title {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.r-for {
  margin: 0;
  font-size: 0.9375rem;
  color: var(--cream-2);
  letter-spacing: 0.16em;
}

.r-for-name {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--cream);
}

.r-name-wrap {
  position: relative;
  display: flex;
  flex-direction: row-reverse;
  justify-content: center;
  gap: 8px;
  margin: 22px 0 14px;
  min-height: 9em;
}

.r-name {
  margin: 0;
  writing-mode: vertical-rl;
  font-size: clamp(2.25rem, 11vw, 2.75rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: 0.16em;
  max-height: 7.2em; /* 長い名前は 2 行（2 列）に折り返す */
  animation: rise 1s var(--ease) 0.2s both;
}

.r-reading {
  margin: 0.3em 0 0;
  writing-mode: vertical-rl;
  font-size: 0.75rem;
  letter-spacing: 0.32em;
  color: var(--cream-3);
}

/* 運の等級: 弁柄の判子 */
.r-luck {
  position: absolute;
  top: -6px;
  left: calc(50% + 58px);
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  margin: 0;
  border: 2px solid var(--bengara);
  border-radius: 6px;
  color: var(--bengara);
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: 0;
  writing-mode: vertical-rl;
  transform: rotate(8deg);
  background: rgba(180, 88, 61, 0.08);
  animation: stamp 0.5s cubic-bezier(0.3, 1.6, 0.5, 1) 0.9s both;
}

.r-luck span {
  line-height: 1.05;
}

.r-luck.luck-daikichi {
  background: var(--bengara);
  color: var(--cream);
}

@keyframes stamp {
  from {
    opacity: 0;
    transform: rotate(8deg) scale(1.8);
  }
  to {
    opacity: 1;
    transform: rotate(8deg) scale(1);
  }
}

.r-tagline {
  margin: 0;
  font-size: 1rem;
  letter-spacing: 0.18em;
}

.r-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
}

.chip.temp-hot {
  color: var(--hot);
  border-color: rgba(208, 138, 82, 0.5);
}

.chip.temp-cold {
  color: var(--cold);
  border-color: rgba(140, 195, 196, 0.5);
}

/* ---------- 今日のあなた（占い文が主役） ---------- */

.r-fortune {
  position: relative;
  margin: 30px -6px 0;
  padding: 26px 18px 24px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: radial-gradient(120% 80% at 50% 0%, rgba(243, 238, 226, 0.07), transparent 70%);
}

.r-fortune-h {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.32em;
  text-align: center;
}

.r-fortune-kicker {
  font-size: 0.625rem;
  font-weight: 500;
  color: var(--cream-4);
  letter-spacing: 0.4em;
}

.r-signs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 8px;
  margin: 14px 0 0;
}

.r-sign-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  color: var(--cream-2);
  white-space: nowrap;
}

.r-sign-chip.is-luck {
  border-color: rgba(180, 88, 61, 0.6);
  color: #e3a48c;
}

.r-mini-fuda {
  display: inline-grid;
  place-items: center;
  width: 14px;
  height: 20px;
  border: 1px solid var(--cream-3);
  border-radius: 2px;
  font-size: 0.625rem;
  font-weight: 700;
  line-height: 1;
}

.r-fortune-body {
  margin-top: 18px;
}

.r-fortune-text {
  margin: 0;
  font-size: 1.0625rem;
  line-height: 2.2;
  letter-spacing: 0.05em;
  text-align: left;
  line-break: strict;
}

.r-fortune-text + .r-fortune-text {
  margin-top: 1.1em;
}

/* 出だしの一文字を少し大きく（手紙の書き出しのように） */
.r-fortune-text:first-child::first-letter {
  font-size: 1.6em;
  font-weight: 700;
  line-height: 1;
}

/* 画面に入ったら段落がゆっくり浮かぶ。動きを減らす設定では tokens.css の指定で即表示になる */
.r-fortune-body .r-fortune-text {
  opacity: 0;
  transform: translateY(6px);
  filter: blur(2px);
}

.r-fortune-body.is-shown .r-fortune-text {
  animation: ink-in 1.6s var(--ease) var(--delay, 0ms) both;
}

@keyframes ink-in {
  from {
    opacity: 0;
    transform: translateY(6px);
    filter: blur(2px);
  }
  to {
    opacity: 1;
    transform: none;
    filter: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .r-fortune-body .r-fortune-text {
    opacity: 1;
    transform: none;
    filter: none;
  }
}

/* ---------- 込めたこと・味わい ---------- */

.r-prose p {
  margin: 0;
  font-size: 0.9375rem;
  line-height: 2.05;
  letter-spacing: 0.04em;
  color: var(--cream-2);
  text-align: justify;
}

.r-prose p + p {
  margin-top: 0.9em;
}

.r-taste {
  margin: 30px 0 0;
  text-align: center;
}

.r-taste-label {
  margin: 0 0 8px;
  font-size: 0.75rem;
  letter-spacing: 0.4em;
  color: var(--cream-3);
}

.r-taste-quote {
  position: relative;
  margin: 0;
  padding: 14px 24px;
}

.r-taste-quote::before,
.r-taste-quote::after {
  position: absolute;
  font-size: 2.25rem;
  line-height: 1;
  color: var(--cream-4);
}

.r-taste-quote::before {
  content: "「";
  top: 0;
  left: -2px;
}

.r-taste-quote::after {
  content: "」";
  bottom: 0;
  right: -2px;
}

.r-taste-quote p {
  margin: 0;
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 2;
  letter-spacing: 0.08em;
  text-align: left;
}

.r-lucky {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  margin: 30px 0 0;
  padding: 12px;
  border: 1px dashed var(--line-strong);
  text-align: center;
}

.r-lucky-label {
  font-size: 0.6875rem;
  letter-spacing: 0.4em;
  color: var(--cream-3);
}

.r-lucky-text {
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: 0.12em;
}

.r-section {
  margin-top: 34px;
}

.r-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 0 0 14px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line-strong);
}

.r-heading-ja {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.24em;
}

.r-heading-en {
  font-size: 0.625rem;
  color: var(--cream-4);
}

/* ---------- 配合: 比率の帯 + 茶葉カード ---------- */

/* 役割ごとの濃淡（主役ほど濃い生成り） */
.role-0 { --role: rgba(243, 238, 226, 0.92); --role-ink: var(--ink); }
.role-1 { --role: rgba(243, 238, 226, 0.6); --role-ink: var(--ink); }
.role-2 { --role: rgba(162, 184, 112, 0.75); --role-ink: var(--ink); }
.role-3 { --role: rgba(243, 238, 226, 0.28); --role-ink: var(--cream); }

.r-ratio {
  display: flex;
  height: 26px;
  gap: 2px;
  margin: 0 0 14px;
  border-radius: 2px;
  overflow: hidden;
}

.r-ratio-seg {
  display: grid;
  place-items: center;
  min-width: 6px;
  flex-basis: 0;
  background: var(--role);
  color: var(--role-ink);
  font-family: var(--font-roman);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.r-tea-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.r-tea-card {
  padding: 12px 14px 14px;
  border: 1px solid var(--line);
  background: rgba(1, 42, 47, 0.28);
}

.r-tea-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.r-swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: var(--role);
}

.r-role-badge {
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  color: var(--cream-2);
}

.r-tea-amount {
  margin-left: auto;
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
}

.r-tea-amount b {
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}

.r-tea-amount small {
  font-family: var(--font-roman);
  font-size: 0.6875rem;
  color: var(--cream-3);
}

.r-tea-card p {
  margin: 0;
}

.r-tea {
  margin-top: 4px !important;
  font-size: 1.0625rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.5;
}

.r-producer {
  font-size: 0.75rem;
  color: var(--cream-3);
}

.r-reason {
  margin-top: 8px !important;
  font-size: 0.9375rem;
  line-height: 1.85;
}

.r-reason-label {
  display: inline-block;
  margin-right: 8px;
  padding: 0 6px;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  font-size: 0.6875rem;
  letter-spacing: 0.16em;
  color: var(--cream-2);
  vertical-align: 0.15em;
}

.r-story {
  margin-top: 8px !important;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
  font-size: 0.8125rem;
  line-height: 1.9;
  color: var(--cream-3);
  text-align: justify;
}

.r-method {
  margin: 0 0 8px;
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: 0.1em;
}

.r-serve {
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--cream-2);
}

.r-steps {
  margin: 0;
  padding: 0;
  list-style: none;
}

.r-step {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px;
  padding: 8px 0;
  font-size: 0.9375rem;
  line-height: 1.85;
}

.r-step-no {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  margin-top: 2px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  font-size: 0.75rem;
  letter-spacing: 0;
}

.unit {
  font-weight: 700;
  color: var(--cream);
  white-space: nowrap;
}

.r-step-text {
  color: var(--cream-2);
}

.r-serve-note {
  margin: 6px 0 0 38px;
  font-size: 0.8125rem;
  color: var(--cream-3);
}

.r-vessel {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: 0.14em;
}

.r-vessel-reason {
  margin: 4px 0 0;
  font-size: 0.875rem;
  color: var(--cream-2);
}

.r-sign {
  margin: 34px 0 0;
  text-align: center;
  font-size: 0.625rem;
  color: var(--cream-4);
  letter-spacing: 0.4em;
}

.r-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 10px 0 20px;
}

.r-bottom .btn-bowl {
  width: min(100%, 280px);
}

/* ================= 待ち・履歴への入口 ================= */

.fortune-ticket {
  position: relative;
  margin: 22px 0 0;
  font-size: 0.8125rem;
  letter-spacing: 0.2em;
  color: var(--cream-2);
  line-height: 2;
}

.fortune-ticket strong {
  font-size: 1.75rem;
  font-weight: 600;
  margin-left: 0.2em;
  color: var(--cream);
  vertical-align: -0.1em;
}

.slow-ticket {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 8px 0 0;
  font-size: 0.75rem;
  letter-spacing: 0.4em;
  color: var(--cream-3);
}

.slow-ticket strong {
  font-size: 3rem;
  line-height: 1.1;
  color: var(--cream);
  letter-spacing: 0;
}

.intro-history {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-top: 10px;
  padding: 0 12px;
  color: var(--cream-2);
  font-size: 0.875rem;
  letter-spacing: 0.2em;
  text-decoration: none;
  border-bottom: 1px solid var(--line);
}

/* 感想を送る: 未送信のあいだは画面下に貼り付く。スクロールし終えるとカードのすぐ下に収まる */
.r-feedback {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 12px 12px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: linear-gradient(180deg, rgba(2, 65, 72, 0.96), rgba(1, 42, 47, 0.97));
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
  z-index: 5;
}

.r-feedback.is-sticky {
  position: sticky;
  bottom: max(12px, env(safe-area-inset-bottom));
}

.r-feedback-text {
  flex: 1;
  min-width: 0;
}

.r-feedback-title {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 700;
  line-height: 1.5;
  letter-spacing: 0.06em;
}

.r-feedback-sub {
  margin: 2px 0 0;
  font-size: 0.75rem;
  color: var(--cream-3);
}

.r-feedback-btn {
  flex: none;
  min-height: 48px;
  padding: 0 1.2em;
  white-space: nowrap;
}

.r-feedback.is-done {
  justify-content: space-between;
  box-shadow: none;
  background: var(--wash);
  border-color: var(--line);
}

.r-feedback.is-done .r-feedback-title {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--cream-2);
}

.r-feedback-redo {
  flex: none;
  font-size: 0.8125rem;
  color: var(--cream-2);
}

.r-history {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.r-history-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--cream);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-decoration: none;
  border-bottom: 1px solid var(--line-strong);
}

.r-bookmark {
  margin: 0;
  font-size: 0.75rem;
  color: var(--cream-3);
  letter-spacing: 0.08em;
  text-align: center;
}

/* ---------- 文章待ち（recipe_ready）: 静かなプレースホルダと差し込み ---------- */

.r-writing {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 18px 0 6px;
  text-align: center;
}

.r-writing.is-small {
  align-items: flex-start;
  padding: 2px 0;
  text-align: left;
}

/* 筆が紙の上を走るように、細い線が描かれては消える */
.r-brush {
  width: 150px;
  height: 22px;
  fill: none;
  stroke: var(--cream-2);
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-dasharray: 200;
  stroke-dashoffset: 200;
  animation: brush 3.4s ease-in-out infinite;
}

@keyframes brush {
  0% { stroke-dashoffset: 200; opacity: 0; }
  12% { opacity: 0.9; }
  60% { stroke-dashoffset: 0; opacity: 0.9; }
  100% { stroke-dashoffset: 0; opacity: 0; }
}

.r-writing-text {
  margin: 0;
  font-size: 0.875rem;
  letter-spacing: 0.16em;
  color: var(--cream-3);
  animation: breathe 2.8s ease-in-out infinite;
}

.r-writing.is-small .r-writing-text {
  font-size: 0.8125rem;
  letter-spacing: 0.1em;
}

@keyframes breathe {
  50% { opacity: 0.45; }
}

.r-writing-late {
  display: none;
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.9;
  letter-spacing: 0.06em;
  color: var(--cream-2);
}

/* 文章待ちが上限を超えたら: 動きを止め、「あとから履歴で」の案内に */
.is-text-late .r-brush,
.is-text-late .r-writing-text,
.is-text-late .r-ink-lines,
.is-text-late .r-tagline.is-pending {
  display: none;
}

.is-text-late .r-writing-late {
  display: block;
}

.is-text-late .r-writing.is-small::after {
  content: "あとから届きます";
  font-size: 0.75rem;
  color: var(--cream-3);
}

/* 茶葉カード・tagline の位置の、墨がにじむ細い線 */
.r-ink-lines {
  display: inline-flex;
  flex-direction: column;
  gap: 9px;
  width: calc(100% - 64px);
  vertical-align: middle;
}

.r-ink-line {
  display: block;
  width: var(--w, 80%);
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(90deg, rgba(243, 238, 226, 0.08), rgba(243, 238, 226, 0.2), rgba(243, 238, 226, 0.08));
  background-size: 200% 100%;
  animation: ink-shimmer 2.4s ease-in-out infinite;
}

.r-tagline.is-pending {
  display: flex;
  justify-content: center;
  min-height: 1.8em;
  align-items: center;
}

.r-tagline.is-pending .r-ink-line {
  width: 60%;
}

@keyframes ink-shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

/* 文章が届いたところは、ふわりと現れる */
.r-slot.is-filled,
.r-tea-card.is-filled {
  animation: slot-in 1.2s var(--ease) both;
}

@keyframes slot-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .r-brush { stroke-dashoffset: 0; opacity: 0.7; animation: none; }
  .r-writing-text,
  .r-ink-line { animation: none; }
}

.h-writing {
  font-size: 0.6875rem;
  letter-spacing: 0.12em;
  color: var(--cream-3);
  white-space: nowrap;
}
