/* =========================================================================
   あなたという一杯 — design tokens & base
   喫茶/文学・紙と珈琲。生成り紙 × コーヒーブラウン × 弁柄(くすんだ赤)。
   claude.ai/design ハンドオフ (styles.css + cards.jsx inline) の vanilla 移植。
   ========================================================================= */

:root {
  /* paper / 生成り */
  --paper:      oklch(0.963 0.010 78);
  --paper-2:    oklch(0.936 0.013 74);
  --paper-3:    oklch(0.905 0.015 72);
  --paper-edge: oklch(0.865 0.016 70);

  /* ink / コーヒーブラウン */
  --ink:        oklch(0.300 0.028 54);
  --ink-soft:   oklch(0.430 0.026 56);
  /* faint/ghost darkened to meet WCAG AA (4.5:1) for small text on paper,
     while staying muted — important for the PR / アソシエイト disclosure legibility. */
  --ink-faint:  oklch(0.470 0.024 58);
  --ink-ghost:  oklch(0.500 0.020 60);

  /* espresso / 深い焦茶 (dark cards) */
  --espresso:   oklch(0.205 0.020 50);
  --espresso-2: oklch(0.262 0.024 48);
  --espresso-3: oklch(0.330 0.028 46);
  --cream:      oklch(0.930 0.018 82);
  --cream-soft: oklch(0.820 0.020 80);

  /* accent — 弁柄 (dusty red) */
  --accent:      oklch(0.520 0.125 32);
  --accent-deep: oklch(0.430 0.115 31);
  --accent-soft: oklch(0.610 0.100 34);

  /* alt accent — 真鍮ゴールド */
  --brass:      oklch(0.660 0.078 76);

  /* the active accent */
  --hl:         var(--accent);

  /* type */
  --serif: "Shippori Mincho", "Hiragino Mincho ProN", serif;
  --sans:  "Zen Kaku Gothic New", "Hiragino Kaku Gothic ProN", system-ui, sans-serif;
  --latin: "EB Garamond", "Shippori Mincho", serif;

  --shadow-soft: 0 1px 2px oklch(0.30 0.02 55 / 0.05), 0 12px 34px oklch(0.30 0.03 50 / 0.10);
  --shadow-lift: 0 2px 6px oklch(0.25 0.02 55 / 0.10), 0 26px 60px oklch(0.25 0.03 50 / 0.18);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* paper grain overlay (SVG element, fixed full-screen) */
.grain {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.42;
  mix-blend-mode: multiply;
}
.grain rect { opacity: 0.05; }

h1, h2, h3, h4 { font-family: var(--serif); font-weight: 500; margin: 0; }
p { margin: 0; }
button { font-family: inherit; cursor: pointer; }

::selection { background: color-mix(in oklch, var(--hl) 28%, transparent); }

/* ---- app shell (mobile-first, centered on desktop) -------------------- */
.app {
  position: relative;
  min-height: 100dvh;
  max-width: 452px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background: var(--paper);
}
@media (min-width: 520px) {
  body { background: var(--paper-2); }
  .app {
    min-height: auto;
    margin: 22px auto;
    border-radius: 22px;
    box-shadow: var(--shadow-lift);
    border: 1px solid var(--paper-edge);
    overflow: hidden;
  }
}

.scroll { flex: 1; }

/* PR常設バー */
.pr-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 18px;
  background: var(--paper-2);
  border-bottom: 1px solid var(--paper-edge);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
}
.pr-tag {
  flex: 0 0 auto;
  font-size: 9.5px;
  letter-spacing: 0.16em;
  color: var(--ink-ghost);
  border: 1px solid var(--paper-edge);
  border-radius: 3px;
  padding: 2px 6px;
}

.site-foot {
  padding: 22px 26px 30px;
  border-top: 1px solid var(--paper-edge);
  background: var(--paper-2);
}
.site-foot p {
  font-size: 10.5px;
  line-height: 1.85;
  color: var(--ink-ghost);
  text-align: center;
}
.site-foot .foot-guide-link { margin-bottom: 14px; }
.site-foot .foot-guide-link a {
  font-family: var(--serif); font-size: 12.5px; letter-spacing: 0.04em;
  color: var(--ink-faint); text-decoration: none;
  border-bottom: 1px solid var(--paper-edge); padding-bottom: 2px;
}
.site-foot .foot-guide-link a:hover { color: var(--hl); border-color: var(--hl); }

.screen { position: relative; }
.hidden { display: none !important; }

/* ---- reusable bits ---------------------------------------------------- */
.eyebrow {
  font-family: var(--sans);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.eyebrow.on-dark { color: var(--cream-soft); }

.hairline { height: 1px; background: var(--paper-edge); border: 0; }

/* ---- steam (湯気) ------------------------------------------------------ */
@keyframes steamRise {
  0%   { transform: translateY(6px) scaleX(1);    opacity: 0; }
  18%  { opacity: 0.55; }
  60%  { opacity: 0.3; }
  100% { transform: translateY(-30px) scaleX(1.5); opacity: 0; }
}
.steam { position: absolute; pointer-events: none; }
.steam i {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 7px;
  height: 38px;
  border-radius: 60%;
  background: linear-gradient(to top, currentColor, transparent);
  filter: blur(3px);
  opacity: 0.18;
}
.anim-ready .steam i {
  opacity: 0;
  animation: steamRise 5.5s ease-in-out infinite;
}
.steam i:nth-child(2) { left: 12px; animation-delay: 1.4s; height: 46px; }
.steam i:nth-child(3) { left: 24px; animation-delay: 2.8s; height: 34px; }

@media (prefers-reduced-motion: reduce) {
  .steam i { animation: none !important; opacity: 0.18; }
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; }
}

/* ---- placeholder (版画イラスト枠) ------------------------------------- */
.ph {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-ghost);
  background:
    repeating-linear-gradient(135deg,
      color-mix(in oklch, var(--ink) 6%, transparent) 0 1px,
      transparent 1px 9px),
    var(--paper-2);
  border: 1px solid var(--paper-edge);
  overflow: hidden;
}
.ph span {
  font-family: var(--latin);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  background: var(--paper);
  padding: 3px 9px;
  border-radius: 2px;
  color: var(--ink-faint);
}
.ph.on-dark {
  background:
    repeating-linear-gradient(135deg,
      color-mix(in oklch, var(--cream) 8%, transparent) 0 1px,
      transparent 1px 9px),
    var(--espresso-2);
  border-color: color-mix(in oklch, var(--cream) 12%, transparent);
  color: var(--cream-soft);
}
.ph.on-dark span { background: var(--espresso); color: var(--cream-soft); }

/* ---- entrance staging ------------------------------------------------- */
@keyframes fadeScreen { from { opacity: 0; } to { opacity: 1; } }
.anim-ready .screen-in { animation: fadeScreen 0.5s ease both; }

@keyframes riseIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.anim-ready .rise { animation: riseIn 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) both; }

/* ---- top screen ------------------------------------------------------- */
.top {
  min-height: calc(100dvh - 38px);
  display: flex;
  flex-direction: column;
  padding: 48px 38px 40px;
  background: var(--paper);
}
@media (min-width: 520px) { .top { min-height: 720px; } }
.top-eyebrow { text-align: center; }
.top-center {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  gap: 26px;
}
.top-steam {
  position: relative;
  height: 40px;
  width: 40px;
  color: var(--ink-faint);
  margin: 0 auto;
}
.top-title {
  font-size: 46px;
  line-height: 1.3;
  letter-spacing: 0.08em;
}
.top-rule { width: 28px; height: 1px; background: var(--hl); }
.top-lead {
  font-size: 14px;
  line-height: 2.1;
  color: var(--ink-soft);
  max-width: 300px;
  font-family: var(--serif);
  text-wrap: pretty;
}
.top-note {
  margin-top: 16px;
  text-align: center;
  font-size: 11px;
  color: var(--ink-ghost);
  letter-spacing: 0.08em;
}

.cta {
  width: 100%;
  padding: 16px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  border: none;
  font-family: var(--serif);
  font-size: 16px;
  letter-spacing: 0.2em;
  transition: transform 0.2s ease, background 0.2s ease;
}
.cta:hover { transform: translateY(-1px); background: var(--hl); }

/* ---- question screen -------------------------------------------------- */
.q {
  min-height: calc(100dvh - 38px);
  display: flex;
  flex-direction: column;
  padding: 30px 32px 34px;
  background: var(--paper);
}
@media (min-width: 520px) { .q { min-height: 720px; } }
.q-head { display: flex; align-items: center; gap: 14px; margin-bottom: 6px; }
.q-back {
  background: none; border: none; color: var(--ink-faint);
  font-size: 18px; padding: 0; line-height: 1;
}
.q-prog { flex: 1; display: flex; gap: 6px; align-items: center; }
.q-prog span {
  height: 3px; flex: 1; border-radius: 2px;
  background: var(--paper-3); transition: background 0.5s ease;
}
.q-prog span.on { background: var(--hl); }
.q-count {
  font-family: var(--latin); font-size: 12px; color: var(--ink-faint);
  letter-spacing: 0.1em; min-width: 34px; text-align: right;
}
.q-count .slash { opacity: 0.5; }

.q-body {
  flex: 1; display: flex; flex-direction: column;
  justify-content: center; gap: 30px;
}
.q-tag { color: var(--hl); }
.q-prompt {
  font-size: 25px; line-height: 1.7; letter-spacing: 0.03em;
  text-wrap: balance; margin-top: 16px;
}
.q-opts { display: flex; flex-direction: column; gap: 12px; }

.opt {
  display: flex;
  align-items: center;
  padding: 25px 22px;
  border-radius: 3px;
  border: 1px solid var(--paper-edge);
  background: var(--paper);
  transition: border-color 0.3s ease, background 0.3s ease, transform 0.3s ease, opacity 0.3s ease;
}
.opt:hover { border-color: var(--hl); background: color-mix(in oklch, var(--hl) 5%, var(--paper)); }
.opt.picked {
  border-color: var(--hl);
  background: color-mix(in oklch, var(--hl) 8%, var(--paper));
  transform: translateY(-1px);
}
.opt.dim { opacity: 0.4; }
.opt-key {
  font-family: var(--latin); font-size: 13px; color: var(--ink-ghost);
  letter-spacing: 0.1em; margin-right: 14px; font-style: italic;
}
.opt.picked .opt-key { color: var(--hl); }
.opt-label {
  font-family: var(--serif); font-size: 15.5px; line-height: 1.6;
  color: var(--ink); flex: 1; text-align: left;
}
.q-foot {
  text-align: center; font-size: 11px; color: var(--ink-ghost);
  letter-spacing: 0.1em;
}

/* ---- result share-core (①) ------------------------------------------- */
/* カード root は height:100%;flex:1 を持つので、親をフレックス＋最低高で定義する。
   こうしないとカードは内容高にしか伸びない（短いコピーを足すと崩れる）。 */
#share-card {
  min-height: 628px; display: flex; flex-direction: column;
  position: relative; z-index: 1;
  border-bottom: 1px solid color-mix(in oklch, var(--ink) 22%, transparent);
  box-shadow: 0 16px 30px -20px oklch(0.2 0.02 50 / 0.5);
}

/* カード内に焼き込む紙テクスチャ（全画面grainは固定オーバーレイで書き出しPNGに入らない）。
   絶対配置の子としてカード root に1枚敷き、コンテンツは z-index:1 で上に重ねる。 */
.card-grain {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='cg'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23cg)' opacity='0.09'/%3E%3C/svg%3E");
}

/* 焙煎シール（カップアイコンを置換する情報設計のマーク） */
.roast-seal {
  width: 66px; height: 66px; border-radius: 50%;
  border: 1px solid var(--line);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
}
.roast-seal .lbl {
  font-family: var(--latin); font-size: 8.5px; letter-spacing: 0.26em;
  text-transform: uppercase; color: var(--dim);
}
.roast-seal .dots { display: flex; gap: 4px; }
.roast-seal .dots i {
  width: 5px; height: 5px; border-radius: 50%;
  border: 1px solid var(--hl); box-sizing: border-box;
}
.roast-seal .dots i.on { background: var(--hl); }

/* カード下部のメタ行（通し番号・焙煎ラベル） */
.card-meta {
  display: flex; justify-content: space-between; align-items: baseline;
  font-family: var(--latin); font-size: 10.5px; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--dim);
}
.card-reading {
  font-family: var(--latin); font-size: 10.5px; letter-spacing: 0.34em;
  text-transform: uppercase; color: var(--dim);
}

/* ---- result lower segments (②③) -------------------------------------- */
.res-lower { background: var(--paper); }

.res-bridge { padding: 30px 30px 8px; }
.res-bridge-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 16px;
}
.res-pr {
  font-size: 9.5px; color: var(--ink-ghost); letter-spacing: 0.16em;
  border: 1px solid var(--paper-edge); border-radius: 3px; padding: 2px 6px;
}
.res-bean-lead {
  font-family: var(--serif); font-size: 17px; line-height: 1.7;
  color: var(--ink); margin-bottom: 18px;
}
.rec-rows { display: flex; flex-direction: column; gap: 10px; }
.rec-row {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 14px; background: var(--paper-2); border-radius: 6px;
  border: 1px solid var(--paper-edge);
}
.rec-head {
  font-family: var(--serif); font-size: 12px; color: var(--paper);
  background: var(--hl); border-radius: 4px; padding: 3px 8px;
  flex: 0 0 auto; letter-spacing: 0.08em;
}
.rec-body { font-size: 13.5px; color: var(--ink); font-family: var(--serif); line-height: 1.5; }
.rec-note { font-size: 11px; color: var(--ink-faint); margin-top: 3px; line-height: 1.6; }

.res-shop-note {
  font-family: var(--serif); font-size: 13px; line-height: 1.7;
  color: var(--ink-soft); margin-top: 16px;
}
.res-shops { display: flex; flex-direction: column; gap: 9px; margin-top: 10px; }

/* A8 コーヒー定期便（主CTA） */
.res-sub {
  padding: 14px 14px 13px; margin-bottom: 4px;
  border: 1px solid color-mix(in oklch, var(--hl) 30%, var(--paper-edge));
  border-radius: 4px;
  background: color-mix(in oklch, var(--hl) 4%, var(--paper));
}
.res-sub-kind {
  font-size: 10.5px; letter-spacing: 0.1em; color: var(--ink-faint);
  margin-bottom: 10px;
}
.shop.sub-cta { background: var(--hl); }
.shop.sub-cta:hover { background: var(--accent-deep); }
.shop.sub-cta b { font-weight: 700; letter-spacing: 0.04em; }
.res-sub-why {
  font-family: var(--serif); font-size: 12px; line-height: 1.7;
  color: var(--ink-soft); margin-top: 10px;
}
.shop {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-radius: 2px;
  background: var(--ink); color: var(--paper);
  text-decoration: none; font-size: 13px; letter-spacing: 0.06em;
  font-family: var(--serif); transition: background 0.2s ease;
}
.shop .arr { opacity: 0.7; }
.shop:hover { background: var(--hl); }
.shop.ghost { background: transparent; color: var(--ink); border: 1px solid var(--paper-edge); }
.shop.ghost:hover { border-color: var(--hl); background: var(--paper-2); }

.res-disc { font-size: 9.5px; line-height: 1.7; color: var(--ink-ghost); margin-top: 12px; }
.res-guide-link { margin-top: 14px; text-align: center; }
.res-guide-link a { font-family: var(--serif); font-size: 12.5px; letter-spacing: 0.04em; color: var(--ink-faint); text-decoration: none; border-bottom: 1px solid var(--paper-edge); padding-bottom: 2px; }
.res-guide-link a:hover { color: var(--hl); border-color: var(--hl); }

.res-next { padding: 0 28px 34px; text-align: center; }
.res-next h3 { font-size: 19px; letter-spacing: 0.04em; margin-bottom: 8px; }
.res-next-lead {
  font-size: 12.5px; line-height: 1.8; color: var(--ink-soft);
  font-family: var(--serif); margin-bottom: 16px;
}
.res-subs { display: flex; gap: 8px; justify-content: center; }
.sub {
  flex: 1; padding: 13px; border-radius: 3px;
  font-family: var(--serif); font-size: 13px; letter-spacing: 0.06em;
  border: 1px solid var(--paper-edge); background: var(--paper); color: var(--ink);
  transition: border-color 0.2s ease, background 0.2s ease;
}
.sub:hover { border-color: var(--hl); }
.sub.line:hover { background: color-mix(in oklch, var(--hl) 7%, var(--paper)); }
.res-restart {
  margin-top: 26px; background: none; border: none; color: var(--ink-faint);
  font-size: 12px; letter-spacing: 0.1em; font-family: var(--serif);
  border-bottom: 1px solid var(--paper-edge); padding-bottom: 3px;
}

/* ---- shared-result landing (/t/<type>/) ------------------------------- */
.land { padding: 30px 24px 40px; }
.land-eyebrow { text-align: center; display: block; margin-bottom: 22px; }
.land-card {
  min-height: 600px; display: flex; flex-direction: column;
  position: relative; z-index: 1;
  border-radius: 6px; overflow: hidden;
  box-shadow: var(--shadow-lift);
}
.land-cta { text-align: center; padding: 36px 14px 8px; }
.land-q {
  font-family: var(--serif); font-size: 19px; letter-spacing: 0.04em;
  color: var(--ink); margin-bottom: 20px;
}
.land .cta { max-width: 360px; margin: 0 auto; display: block; }
.land-sub {
  font-size: 11px; color: var(--ink-ghost); letter-spacing: 0.08em; margin-top: 16px;
}

/* ---- toast ------------------------------------------------------------ */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(8px);
  background: var(--ink);
  color: var(--paper);
  font-size: 12px;
  letter-spacing: 0.08em;
  padding: 10px 18px;
  border-radius: 999px;
  z-index: 200;
  box-shadow: var(--shadow-soft);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---- share-card save chrome ------------------------------------------- */
.save-row { display: flex; gap: 8px; }
.save-btn {
  flex: 1; padding: 11px 14px; border-radius: 999px;
  background: var(--hl); color: var(--paper); border: none;
  font-size: 12.5px; letter-spacing: 0.12em; font-weight: 500;
}
.share-btn {
  width: 42px; padding: 0; border-radius: 999px; background: transparent;
  color: var(--card-fg, var(--ink)); border: 1px solid var(--card-line, var(--paper-edge));
  font-size: 14px; display: grid; place-items: center;
}
