/* 色は v2 と同じ (元サイト genkeep-stretch.jp の配色) */
:root {
  --yellow: #ffe74d;
  --yellow-deep: #f3d823;
  --cream: #fffbe3;
  --orange: #e2470f;
  --orange-dark: #bd3a0a;
  --ink: #2b2727;
  --ink-soft: #5c5454;
  --line: #e7e1cf;
  --white: #fff;
  --green: #2e8b6e; /* 自宅のプランのスタンプ */
  --safe-b: env(safe-area-inset-bottom, 0px);
  --tab-h: 64px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; background: var(--ink); }

/* ページ自体はスクロールさせず、.scroller の中でスクロールする。
   LINE のブラウザは、ページを一番上から下に引っぱるとブラウザごと下に動いて閉じようとする (ガタガタして見える)。
   ページの外側を動かないようにして、引っぱりの動きを .scroller の中で止める */
html, body { height: 100%; overflow: hidden; overscroll-behavior: none; }
/* ピンチとダブルタップでの拡大をさせない。スクロール (上下左右の移動) だけ許す */
/* 親だけに指定しても効かないブラウザがあるので、すべての要素に指定する */
*, *::before, *::after { touch-action: pan-x pan-y; }
.scroller {
  position: fixed; inset: 0;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  /* 中身の端でバウンドしたときに後ろの黒が見えないよう、真ん中の列 (.page の幅) にはクリーム色を敷いておく */
  background: linear-gradient(90deg, var(--ink) calc(50% - 230px), var(--cream) calc(50% - 230px), var(--cream) calc(50% + 230px), var(--ink) calc(50% + 230px));
}

body {
  margin: 0;
  background: var(--ink); /* スマホ幅の枠 (.page) の外側。v2 と同じ黒 */
  color: var(--ink);
  font-family: "Noto Sans JP", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  font-weight: 500;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p, ul, ol { margin: 0; padding: 0; }
ul, ol { list-style: none; }
img, video { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }
button:focus-visible, [role="tab"]:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }

.page { max-width: 460px; margin: 0 auto; padding-bottom: calc(var(--tab-h) + var(--safe-b) + 16px); background: var(--cream); min-height: calc(100% + 1px); }
/* ↑ 中身が短い画面 (自宅のプラン一覧など) でも .scroller が必ずスクロールできるよう、1px だけ高くする。
   スクロールできない枠は引っぱりを受け止めず、LINE のブラウザごと動いてしまうため */

/* ---------- ヘッダー ---------- */
.top { padding: 24px 16px 20px; background: var(--yellow); text-align: center; }
.top h1 { font-size: 26px; font-weight: 900; letter-spacing: .04em; }
.top-lead { margin-top: 8px; font-size: 13px; color: var(--ink); }

/* ---------- プランの選択 ---------- */
/* 1つの白い枠の中に、区切り線で並べる */
.plan-cards {
  margin-top: 20px;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--white);
  overflow: hidden;
}
.plan-cards li + li { border-top: 1px solid var(--line); }
.plan-card {
  display: grid; grid-template-columns: 1fr 16px; gap: 12px; align-items: center;
  width: 100%; padding: 18px 16px;
  border: 0; background: none;
  text-align: left; cursor: pointer;
}
.plan-card:active { background: #fdf8e6; }
.plan-card-body { display: flex; flex-direction: column; gap: 2px; }
.plan-card-name { font-size: 18px; font-weight: 900; line-height: 1.35; }
.plan-card-target { font-size: 13px; color: var(--ink-soft); }
.plan-card-arrow {
  width: 9px; height: 9px; margin-left: 2px;
  border-top: 2px solid #b8ae90; border-right: 2px solid #b8ae90;
  transform: rotate(45deg);
}

/* 中身の画面と進行中の画面のヘッダー */
.top-sub { position: relative; padding-top: 20px; }
.top-sub h1 { font-size: 24px; }
.top-label span { display: inline-block; margin-bottom: 4px; padding: 2px 10px; border-radius: 999px; background: var(--white); color: var(--orange); font-size: 11px; font-weight: 900; }
.top .plan-title { justify-content: center; margin-bottom: 4px; }
/* 進行中のプラン: 名前の下に説明、その下に時間と種目数の小さな札 */
.plan-desc { max-width: 22em; margin: 6px auto 0; line-height: 1.6; word-break: keep-all; overflow-wrap: anywhere; }
.plan-meta { display: inline-block; margin-top: 8px; padding: 2px 10px; border-radius: 999px; background: rgba(255, 255, 255, .7); font-size: 12px; font-weight: 700; }
.back-button {
  position: absolute; top: 12px; left: 8px;
  display: inline-flex; align-items: center; gap: 2px;
  padding: 6px 8px;
  border: 0; background: none;
  font-size: 13px; font-weight: 700; cursor: pointer;
}
.top-sub:has(.back-button) { padding-top: 44px; }

/* 中身の画面 */
.level-note { margin-top: 14px; font-size: 13px; color: var(--ink-soft); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin: 20px 0 8px; }
.section-title { font-size: 16px; font-weight: 900; }
.section-meta { font-size: 13px; font-weight: 700; color: var(--ink-soft); }

/* 進行中の一覧は、1種目ずつ分かれたカード */
.steps.steps-cards { gap: 8px; }
.steps-cards .step { padding: 12px; border-radius: 12px; box-shadow: 0 1px 2px rgba(43, 39, 39, .04); }
.steps-cards .step-photo img { width: 56px; height: 56px; }
.steps-cards .stamp { width: 52px; height: 52px; }
/* 右端がスタンプなので、「使い方」のボタンは回数のタグの下に置く */
.steps-cards .step { grid-template-columns: 56px 1fr 52px; align-items: center; }
.steps-cards .how-button { margin-top: 6px; padding: 3px 9px 3px 8px; font-size: 11px; }
.steps-cards .step.is-done .step-name { color: var(--ink-soft); }

/* 回数・時間のタグ */
.step-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 4px; }
.tag-time { padding: 1px 8px; border-radius: 6px; background: #f3efe3; color: var(--ink-soft); font-size: 12px; font-weight: 700; line-height: 1.6; }

.progress-num { font-size: 16px; color: var(--orange); }
.progress-thin { height: 6px; margin: 0; }
/* 進捗の帯: スクロールしても上に残る。白い帯にして、下に薄い影をつけて浮かせる */
.progress-sticky {
  position: sticky; top: 0; z-index: 5;
  margin: 0 -16px 12px; padding: 10px 16px 12px;
  background: var(--white);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 4px 10px -6px rgba(43, 39, 39, .18);
}
.progress-sticky .section-head { margin: 0 0 6px; }
/* 進捗のゲージ: スタンプを押すと光りながら伸び、伸び切ったらカウントの分子が増えて弾む */
.progress-sticky .progress-thin { height: 10px; background: #efe8d6; overflow: visible; }
.progress-sticky .progress-bar span {
  position: relative; overflow: hidden;
  background: linear-gradient(90deg, var(--orange), #ff8a3d);
  transition: width .6s cubic-bezier(.25, .8, .25, 1);
}
/* 伸びている間: ゲージがふわっと光り、白い光が先端へ走る */
.progress-sticky .progress-bar span::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: -50%; width: 50%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .9), transparent);
  opacity: 0;
}
.progress-sticky .progress-bar.is-growing span { animation: gauge-glow .9s ease-out; }
.progress-sticky .progress-bar.is-growing span::after { animation: gauge-shine .7s ease-out; }
@keyframes gauge-glow {
  0% { box-shadow: 0 0 0 0 rgba(255, 138, 61, 0); }
  40% { box-shadow: 0 0 10px 3px rgba(255, 138, 61, .75); filter: brightness(1.15); }
  100% { box-shadow: 0 0 0 0 rgba(255, 138, 61, 0); }
}
@keyframes gauge-shine { 0% { left: -50%; opacity: 1; } 100% { left: 100%; opacity: 1; } }
/* 分子だけが弾む */
.progress-n { display: inline-block; }
.progress-n.is-pop { animation: progress-pop .4s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes progress-pop { 0% { transform: scale(1); } 45% { transform: scale(1.45); } 100% { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) {
  .progress-sticky .progress-bar span { transition: width .2s; }
  .progress-sticky .progress-bar.is-growing span, .progress-sticky .progress-bar.is-growing span::after, .progress-n.is-pop { animation: none; }
}
.start-button {
  width: 100%; padding: 16px; border: 0; border-radius: 8px;
  background: var(--orange); color: var(--white);
  font-size: 18px; font-weight: 900; cursor: pointer;
}
.start-button:active { background: var(--orange-dark); }

/* ---------- トレーニングの会話 (場所 → 時間 → メニュー) ---------- */
.chat { display: flex; flex-direction: column; gap: 12px; padding-top: 18px; }
.msg { display: flex; align-items: flex-end; gap: 8px; }
/* トレーナーのアイコンは吹き出しの上にそろえる (吹き出しが2行以上になっても、アイコンは1行目の横) */
.msg-coach { align-items: flex-start; }
.msg-avatar {
  flex: 0 0 36px; display: grid; place-items: center;
  width: 36px; height: 36px; border-radius: 50%; overflow: hidden;
  background: var(--yellow); border: 1px solid var(--line);
}
.msg-avatar img { display: block; width: 100%; height: 100%; object-fit: cover; }
.msg-coach .msg-bubble {
  max-width: 82%; padding: 10px 14px;
  border-radius: 4px 18px 18px 18px; background: var(--white); border: 1px solid var(--line);
  font-size: 15px; font-weight: 700; line-height: 1.6;
}
.msg-user { flex-direction: column; align-items: flex-end; gap: 2px; }
.msg-user .msg-bubble {
  max-width: 82%; padding: 10px 14px; border: 0;
  border-radius: 18px 18px 4px 18px; background: var(--orange); color: var(--white);
  font-size: 15px; font-weight: 700; line-height: 1.6; text-align: left; cursor: pointer;
}
.msg-user .msg-bubble:active { background: var(--orange-dark); }
.msg-edit { font-size: 11px; color: var(--ink-soft); }
/* 続けて話す吹き出しは、アイコンを出さずに詰めて並べる */
.msg.is-cont { margin-top: -6px; }
.msg.is-cont .msg-avatar { visibility: hidden; }

/* トレーナーの吹き出しの下に並べる選択肢 (アイコンの幅だけ右に寄せる) */
.chat-choices { display: grid; gap: 10px; margin-left: 44px; }
.chat-places, .chat-intents { grid-template-columns: 1fr 1fr; }
.chat-times { grid-template-columns: repeat(3, 1fr); }
.chat-kinds { grid-template-columns: 1fr 1fr; }
.chat-kinds .chat-choice { padding: 14px 8px; }
.chat-kinds .chat-choice-label { font-size: 16px; }
.chat-choice {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 16px 8px; border: 2px solid var(--line); border-radius: 16px;
  background: var(--white); cursor: pointer;
  box-shadow: 0 3px 0 var(--line);
  transition: transform .1s;
}
.chat-choice:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--line); border-color: var(--orange); }
.chat-choice-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: var(--yellow); color: var(--ink); }
.chat-choice-label { font-size: 17px; font-weight: 900; }
.chat-choice-label b { font-size: 28px; font-weight: 900; margin-right: 1px; }
.chat-choice-sub { font-size: 12px; font-weight: 700; color: var(--ink-soft); }
.chat-plans { margin: 0 0 0 44px; }
/* 決めたプランの確認と「始める」ボタン */
.chat-confirm { margin-left: 44px; }
/* 今日のメニューのノート。上にリングの穴、32px ごとの罫線 */
.note {
  --rule: 32px;
  position: relative;
  padding: 20px 14px 6px;
  border: 1px solid var(--line); border-radius: 6px 6px 12px 12px;
  background:
    repeating-linear-gradient(transparent 0, transparent calc(var(--rule) - 1px), #e9e1cc calc(var(--rule) - 1px), #e9e1cc var(--rule)) 0 20px / 100% calc(100% - 26px) no-repeat,
    #fffdf6;
}
/* リングの穴: 上の端に横一列 */
.note::before {
  content: ""; position: absolute; top: 5px; left: 12px; right: 12px; height: 12px;
  background: radial-gradient(circle, #efe8d6 4.2px, #cdbf9c 4.5px, #cdbf9c 5.4px, transparent 5.7px) 0 0 / 22px 12px;
  background-repeat: space no-repeat;
}
.note-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; height: var(--rule); line-height: var(--rule); }
.note-title { font-size: 15px; font-weight: 900; }
.note-date { font-size: 12px; font-weight: 700; color: var(--orange); }
/* プラン名は、見出しの下の行に大きめに書く */
.note-plan { height: calc(var(--rule) * 1); line-height: var(--rule); font-size: 18px; font-weight: 900; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-head .note-title { font-size: 12px; color: var(--ink-soft); }
.note-list li { display: flex; align-items: center; gap: 8px; height: var(--rule); font-size: 13px; }
.note-check { flex: none; width: 13px; height: 13px; border: 1.5px solid #c9bea0; border-radius: 3px; background: var(--white); }
.note-name { flex: 1; min-width: 0; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-dose { flex: none; color: var(--ink-soft); font-size: 12px; }
/* 最後の選択肢: 左に「選び直す」、右に「始める！」(オレンジ) */
.chat-final { grid-template-columns: 1fr 2fr; margin-top: 2px; }
.chat-final .chat-choice { justify-content: center; padding: 12px 8px; }
.chat-final .chat-choice-label { font-size: 15px; }
.chat-final .is-primary { padding: 12px 8px; border-color: var(--orange); background: var(--orange); color: var(--white); box-shadow: 0 3px 0 var(--orange-dark); }
.chat-final .is-primary .chat-choice-label { font-size: 18px; }
.chat-final .is-primary .chat-choice-sub { color: rgba(255, 255, 255, .85); }
.chat-final .is-primary:active { box-shadow: 0 1px 0 var(--orange-dark); border-color: var(--orange-dark); }
p.msg-bubble { cursor: default; }
.chat-confirm.is-new { animation: chat-in .35s ease-out .25s both; }
@media (prefers-reduced-motion: reduce) { .chat-confirm.is-new { animation: none; } }

/* ---------- スタートの演出 ---------- */
/* 会話は上にふわっと消える */
#t-select.is-leaving { animation: chat-leave .5s ease-in forwards; }
@keyframes chat-leave { to { opacity: 0; transform: translateY(-28px); } }
/* 画面の真ん中に START! のスタンプ */
.start-burst {
  position: fixed; inset: 0; z-index: 30;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  pointer-events: none;
  animation: burst-fade .45s ease-in 1.25s forwards;
}
.start-burst-badge {
  position: relative; display: grid; place-items: center;
  width: 168px; height: 168px; border-radius: 50%;
  background: var(--orange); color: var(--white);
  box-shadow: 0 0 0 8px rgba(255, 255, 255, .9), 0 0 0 12px var(--orange);
  animation: burst-in .55s cubic-bezier(.2, 1.7, .4, 1) .15s both;
}
/* 広がる波紋 */
.start-burst-badge::before, .start-burst-badge::after {
  content: ""; position: absolute; inset: -12px; border-radius: 50%;
  border: 3px solid var(--orange); opacity: 0;
  animation: burst-ring .9s ease-out .35s;
}
.start-burst-badge::after { animation-delay: .55s; border-color: var(--yellow-deep); }
.start-burst-text { font-size: 38px; font-weight: 900; letter-spacing: .04em; transform: rotate(-8deg); }
.start-burst-sub {
  padding: 6px 14px; border-radius: 999px; background: var(--ink); color: var(--white);
  font-size: 14px; font-weight: 900;
  animation: chat-in .35s ease-out .45s both;
}
/* 紙吹雪: 真ん中から放射状に飛ぶ */
.start-confetti {
  position: absolute; top: 50%; left: 50%; width: 9px; height: 14px; margin: -7px 0 0 -4px; border-radius: 2px;
  background: var(--yellow); opacity: 0;
  animation: confetti .8s ease-out .35s forwards;
}
.start-confetti:nth-child(3n) { background: var(--orange); }
.start-confetti:nth-child(3n + 1) { background: var(--green); width: 8px; height: 8px; border-radius: 50%; }
@keyframes burst-in { from { transform: scale(0) rotate(-30deg); } to { transform: none; } }
@keyframes burst-ring { from { opacity: .8; transform: scale(1); } to { opacity: 0; transform: scale(1.7); } }
@keyframes confetti {
  0% { opacity: 1; transform: rotate(var(--a)) translateY(0) rotate(0); }
  100% { opacity: 0; transform: rotate(var(--a)) translateY(calc(var(--d) * -1 - 60px)) rotate(200deg); }
}
@keyframes burst-fade { to { opacity: 0; transform: scale(1.08); } }
/* 進行中のプランの画面は、ヘッダーが降りてきて、種目のカードが順に浮かび上がる */
#t-active.is-entering .top { animation: enter-drop .5s ease-out both; }
#t-active.is-entering .section-head, #t-active.is-entering .progress-bar { animation: chat-in .4s ease-out .2s both; }
#t-active.is-entering .step { animation: chat-in .45s ease-out both; animation-delay: calc(.3s + var(--i, 0) * .08s); }
@keyframes enter-drop { from { opacity: 0; transform: translateY(-30px); } to { opacity: 1; transform: none; } }

/* トレーナーが入力中: 点が3つ順に跳ねる */
.msg-typing .msg-bubble { display: inline-flex; gap: 5px; align-items: center; padding: 14px 16px; }
.typing-dot { width: 7px; height: 7px; border-radius: 50%; background: #c9bea0; animation: typing 1s infinite ease-in-out; }
.typing-dot:nth-child(2) { animation-delay: .15s; }
.typing-dot:nth-child(3) { animation-delay: .3s; }
@keyframes typing { 0%, 60%, 100% { transform: none; opacity: .5; } 30% { transform: translateY(-4px); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .typing-dot { animation: none; } }
/* 新しく出た吹き出しと選択肢は、下からふわっと出す */
.msg.is-new, .chat-choices.is-new, .chat-plans.is-new { animation: chat-in .35s ease-out both; }
.chat-choices.is-new, .chat-plans.is-new { animation-delay: .25s; }
@keyframes chat-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .msg.is-new, .chat-choices.is-new, .chat-plans.is-new { animation: none; } }
/* 会話のメニュー一覧は、左に部位の図のサムネイルを置く */
.plan-card-thumb { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 12px; background: var(--cream); }
.plan-card-thumb svg { width: 40px; height: 52px; }

.view-body { padding: 0 16px 8px; }

/* ---------- 概要と進み具合 ---------- */
.summary { padding: 20px 0 16px; }
.plan-title { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 22px; font-weight: 900; line-height: 1.3; }
.lead { font-size: 14px; }
.lead-sub { margin-top: 4px; font-size: 13px; color: var(--ink-soft); }
.meta { display: flex; gap: 8px; margin-top: 10px; }
.meta span { padding: 2px 10px; border-radius: 4px; background: var(--white); border: 1px solid var(--line); font-size: 13px; font-weight: 700; }
.progress { margin-top: 16px; }
.progress-bar { height: 10px; margin-top: 4px; border-radius: 999px; background: var(--line); overflow: hidden; }
.progress-bar span { display: block; height: 100%; width: 0; background: var(--orange); border-radius: inherit; transition: width .3s ease; }

/* ---------- メニュー ---------- */
.steps { display: grid; gap: 10px; counter-reset: step; }
.step {
  display: grid;
  grid-template-columns: 72px 1fr 60px;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--white);
}
.step.is-preview { grid-template-columns: 72px 1fr; }
.step-photo img { width: 72px; height: 72px; object-fit: contain; border-radius: 6px; background: var(--white); border: 1px solid var(--line); }
.step-body { min-width: 0; }
.step-name { font-size: 15px; font-weight: 700; line-height: 1.35; }
.how-button {
  display: inline-flex; align-items: center; gap: 4px;
  margin-top: 6px; padding: 4px 10px 4px 8px;
  border: 1px solid var(--ink-soft); border-radius: 999px;
  background: var(--white);
  font-size: 12px; font-weight: 700; line-height: 1.4;
  cursor: pointer;
}
.how-button::before { content: ""; border-left: 7px solid currentColor; border-top: 4.5px solid transparent; border-bottom: 4.5px solid transparent; }
.how-button:active { background: #fdf8e6; }

/* スタンプ。押すとその場でスタンプが押される (もう一度押すと取り消し) */
.stamp {
  display: grid; place-items: center;
  width: 60px; height: 60px; padding: 0;
  border: 2px dashed #cfc6aa;
  border-radius: 50%;
  background: #fffdf3;
  color: #b8ae90;
  font-size: 11px; font-weight: 700;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.stamp:active { transform: scale(.94); }
.step.is-done { border-color: #f1c3b0; background: #fff6f1; }
.step.is-done .stamp {
  border: 3px double var(--orange);
  color: var(--orange);
  font-size: 15px; font-weight: 900;
  transform: rotate(-12deg);
}
.step.is-new .stamp { animation: stamp .35s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes stamp {
  0% { transform: scale(2) rotate(-30deg); opacity: 0; }
  100% { transform: scale(1) rotate(-12deg); opacity: 1; }
}

/* ---------- 達成 ---------- */
/* 達成のお祝いのモーダル (画面の真ん中)。白いカードに、朱色のはんこのような「達成」を押す */
.done-sheet {
  width: calc(100% - 48px); max-width: 340px; margin: auto;
  padding: 0; border: 0; border-radius: 24px;
  background: transparent; overflow: visible;
}
.done-sheet::backdrop { background: rgba(43, 39, 39, .65); }
.done-sheet[open] .done-card { animation: done-in .4s cubic-bezier(.2, 1.3, .4, 1); }
@keyframes done-in { from { opacity: 0; transform: scale(.9) translateY(16px); } to { opacity: 1; transform: none; } }
.done-card {
  position: relative; padding: 36px 24px 24px; border-radius: 24px;
  background: var(--white); color: var(--ink); text-align: center;
}
.done-card:focus { outline: none; }
.done-close {
  position: absolute; top: 10px; right: 10px;
  display: grid; place-items: center; width: 36px; height: 36px;
  border: 0; border-radius: 50%; background: transparent; color: var(--ink-soft); cursor: pointer;
}
.done-close:active { background: #f3efe3; }
/* モーダルを開いたときは、閉じるボタンではなく中身にフォーカスを当てる (閉じるボタンの周りに丸い枠が出ないように)。キーボードで閉じるボタンを選んだときだけ、薄い輪で示す */
.sheet-body:focus, .sheet-close:focus, .done-close:focus { outline: none; }
/* 白い丸の背景は、動画の上に重なる使い方のモーダルだけに残す */
#plan-sheet .sheet-close, #day-sheet .sheet-close { background: transparent; }
.sheet-close:focus-visible, .done-close:focus-visible { box-shadow: 0 0 0 3px rgba(226, 71, 15, .35); }
.done-stamp {
  display: grid; place-items: center;
  width: 108px; height: 108px; margin: 0 auto 16px;
  border: 5px double var(--orange); border-radius: 50%;
  color: var(--orange); font-size: 30px; font-weight: 900; letter-spacing: .04em;
  transform: rotate(-12deg);
}
.done-sheet[open] .done-stamp { animation: done-stamp .5s cubic-bezier(.2, 1.7, .4, 1) .15s both; }
@keyframes done-stamp { from { opacity: 0; transform: scale(2) rotate(-30deg); } to { opacity: 1; transform: rotate(-12deg); } }
.done-title { font-size: 20px; font-weight: 900; line-height: 1.4; word-break: keep-all; overflow-wrap: anywhere; }
.done-text { margin-top: 6px; font-size: 14px; color: var(--ink-soft); line-height: 1.6; }
.done-button {
  width: 100%; margin-top: 20px; padding: 13px; border: 0; border-radius: 999px;
  background: var(--orange); color: var(--white); font-size: 15px; font-weight: 900; cursor: pointer;
}
.done-button:active { background: var(--orange-dark); }
.done-card .start-confetti { z-index: 2; }
@media (prefers-reduced-motion: reduce) { .done-sheet[open] .done-card, .done-sheet[open] .done-stamp { animation: none; } .done-card .start-confetti { display: none; } }

/* ---------- スタンプカード ---------- */
.card, .record, .log { margin-top: 16px; }
.card h2, .record h2, .log h2 {
  display: inline-block;
  padding: 0 10px;
  background: var(--yellow);
  font-size: 18px; font-weight: 900;
}
.card { padding: 18px 16px; border-radius: 10px; background: var(--white); border: 1px solid var(--line); }
/* トレーニングの記録: 表示している月の回数と合計時間 */
.record { padding: 18px 16px; border-radius: 10px; background: var(--white); border: 1px solid var(--line); }
.record-month { margin-top: 8px; font-size: 13px; font-weight: 700; color: var(--ink-soft); }
.record-stats { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-top: 8px; }
.record-stat { padding: 12px 6px; border-radius: 10px; background: var(--cream); text-align: center; }
.record-label { font-size: 12px; font-weight: 700; color: var(--ink-soft); }
.record-value { margin-top: 2px; font-size: 14px; font-weight: 700; }
.record-value { white-space: nowrap; }
.record-value strong { font-size: 24px; font-weight: 900; color: var(--orange); margin: 0 1px; }
.record-places { margin-top: 10px; font-size: 13px; color: var(--ink-soft); text-align: center; }

/* カレンダー */
.cal-nav { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; }
.cal-title { font-size: 17px; font-weight: 900; }
.cal-move { display: grid; place-items: center; width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 50%; background: var(--white); cursor: pointer; }
.cal-move:disabled { opacity: .3; cursor: default; }
.cal-week, .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-week { margin-top: 12px; padding-bottom: 6px; border-bottom: 1px solid var(--line); font-size: 11px; font-weight: 700; color: var(--ink-soft); text-align: center; }
.cal-week li:first-child { color: #c4553a; }
.cal-week li:last-child { color: #3a6fc4; }
.cal-grid { gap: 2px; margin-top: 4px; }
.cal-day { position: relative; display: grid; place-items: center; width: 100%; aspect-ratio: 1; border-radius: 8px; }
.cal-day.is-today { background: #fff6cc; }
.cal-date { position: absolute; top: 3px; left: 5px; font-size: 10px; font-weight: 700; color: #a99f84; }
.cal-day.is-today .cal-date { color: var(--ink); }
.cal-stamp {
  display: grid; place-items: center;
  width: 78%; aspect-ratio: 1; margin-top: 6px;
  border: 2.5px double var(--orange); border-radius: 50%;
  color: var(--orange); font-size: 10px; font-weight: 900; line-height: 1.1; text-align: center;
  transform: rotate(-12deg);
}
.cal-stamp.is-home { border-color: var(--green); color: var(--green); }
/* 達成して「スタンプカードを見る」で開いたとき: 今日のマスにスタンプを押す */
.cal-stamp.is-waiting { opacity: 0; }
.cal-stamp.is-pressing { animation: cal-press .55s cubic-bezier(.2, 1.6, .4, 1) both; }
@keyframes cal-press {
  0% { opacity: 0; transform: scale(2.6) rotate(-35deg); }
  60% { opacity: 1; transform: scale(.9) rotate(-10deg); }
  100% { opacity: 1; transform: rotate(-12deg); }
}
/* 押した瞬間に、マスから波紋が広がる */
.cal-day.is-pressing::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 70%; aspect-ratio: 1; margin: -35% 0 0 -35%;
  border: 2px solid var(--orange); border-radius: 50%; pointer-events: none;
  animation: cal-ripple .7s ease-out .3s both;
}
@keyframes cal-ripple { from { opacity: .9; transform: scale(.8); } to { opacity: 0; transform: scale(2); } }
@media (prefers-reduced-motion: reduce) { .cal-stamp.is-waiting { opacity: 1; } .cal-stamp.is-pressing, .cal-day.is-pressing::after { animation: none; } }
.cal-more { position: absolute; right: 1px; bottom: 1px; padding: 0 4px; border-radius: 999px; background: var(--ink); color: var(--white); font-size: 9px; font-weight: 700; line-height: 1.5; }
.cal-day.has-stamp { width: 100%; padding: 0; border: 0; background: none; font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.cal-day.has-stamp:active { background: #fdf3e0; }
.cal-day.is-selected { background: #fff6f1; box-shadow: inset 0 0 0 2px var(--orange); }
.cal-day.is-today.is-selected { background: #fff6cc; }

/* 押した日にやったこと */
/* 日を押したときのモーダル: 中身の量に合わせた高さ。多いときはモーダルの中でスクロールする */
.sheet.day-sheet { height: fit-content; }
.sheet.day-sheet:focus { outline: none; }
.day-sheet .sheet-body { height: auto; max-height: 70vh; max-height: 70dvh; }
.day-sheet-content { padding: 26px 16px calc(24px + var(--safe-b)); }
.day-sheet-title { padding-right: 44px; font-size: 18px; font-weight: 900; }
.cal-detail-list { display: grid; gap: 8px; margin-top: 14px; }
.cal-detail-list li { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; background: var(--cream); }
.cal-detail-mark {
  display: grid; place-items: center; flex: 0 0 auto;
  width: 38px; height: 38px;
  border: 2.5px double var(--orange); border-radius: 50%;
  background: var(--white); color: var(--orange);
  font-size: 10px; font-weight: 900; line-height: 1.1; text-align: center;
  transform: rotate(-12deg);
}
.cal-detail-mark.is-home { border-color: var(--green); color: var(--green); }
.cal-detail-text { display: flex; flex-direction: column; }
.cal-detail-name { font-size: 14px; font-weight: 700; }
.cal-detail-sub { font-size: 12px; color: var(--ink-soft); }
.cal-legend { display: flex; justify-content: flex-end; gap: 12px; margin-top: 10px; font-size: 11px; font-weight: 700; color: var(--ink-soft); }
.cal-legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 4px; border: 2px solid var(--orange); border-radius: 50%; vertical-align: -1px; }
.cal-legend .cal-legend-home::before { border-color: var(--green); }
.link-button { margin-top: 8px; padding: 4px 0; border: 0; background: none; font-size: 12px; color: var(--ink-soft); text-decoration: underline; cursor: pointer; }

/* ---------- マシンの使い方 ---------- */
.log { padding: 18px 16px; border-radius: 10px; background: var(--white); border: 1px solid var(--line); }
.log-list { margin-top: 10px; }
.log-list li { display: flex; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 14px; }
.log-list li:first-child { border-top: 0; }
.log-date { flex: 0 0 3.2em; font-weight: 900; color: var(--orange); }
.log-name { font-weight: 700; }
.log-empty { margin-top: 10px; font-size: 13px; color: var(--ink-soft); }

/* ---------- トレーニングの画面 ---------- */
/* キャンセル */
.cancel { margin-top: 28px; text-align: center; }
.cancel-button { padding: 10px 20px; border: 1px solid #cfc6aa; border-radius: 999px; background: var(--white); color: var(--ink-soft); font-size: 14px; font-weight: 700; cursor: pointer; }
.cancel-confirm { padding: 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--white); font-size: 14px; }
.cancel-actions { display: flex; gap: 8px; margin-top: 12px; }
.cancel-actions button { flex: 1; padding: 12px 8px; border-radius: 8px; font-size: 14px; font-weight: 700; cursor: pointer; }
.cancel-no { border: 1px solid var(--line); background: var(--white); }
.cancel-yes { border: 0; background: var(--ink); color: var(--white); }
.caution { margin-top: 24px; font-size: 12px; color: var(--ink-soft); text-align: center; }

/* ---------- マシン紹介の画面 ---------- */
.guide-list { display: grid; gap: 10px; margin-top: 16px; }
.guide-item {
  display: grid; grid-template-columns: 96px 1fr; gap: 12px; align-items: center;
  width: 100%; padding: 10px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--white); text-align: left; cursor: pointer;
}
.guide-item:active { background: #fdf8e6; }
.guide-item img { width: 96px; height: 96px; object-fit: contain; border-radius: 6px; background: var(--white); border: 1px solid var(--line); }
.guide-text { display: flex; flex-direction: column; gap: 2px; }
.guide-area { font-size: 11px; font-weight: 700; color: var(--orange); }
.guide-name { font-size: 16px; font-weight: 900; line-height: 1.3; }
.guide-catch { font-size: 12px; line-height: 1.5; }

/* ---------- 下のタブ ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(3, 1fr); align-items: end;
  max-width: 460px; height: calc(var(--tab-h) + var(--safe-b));
  margin: 0 auto; padding-bottom: var(--safe-b);
  background: var(--white);
  border-top: 1px solid var(--line);
  box-shadow: 0 -2px 12px rgba(0, 0, 0, .06);
}
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 2px;
  height: var(--tab-h); padding: 0 0 8px;
  border: 0; background: none;
  color: #9a9080; font-size: 11px; font-weight: 700;
  cursor: pointer;
  /* 押したときのグレーの反応 (スマホのタップの色) を出さない */
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none; user-select: none;
}
/* 選んでいるタブは、アイコンと文字をオレンジにする */
.tab[aria-current="page"] { color: var(--orange); }
/* 選んでいるタブのアイコンは塗りつぶす。記録は丸を塗り、チェックを白に。マシン紹介は4つの四角を塗る */
.tab[aria-current="page"][data-view="stamp"] circle { fill: currentColor; }
.tab[aria-current="page"][data-view="stamp"] path { stroke: var(--white); }
.tab[aria-current="page"][data-view="machines"] rect { fill: currentColor; }
.tab-main-icon {
  display: grid; place-items: center;
  width: 56px; height: 56px; margin-top: -22px;
  border: 4px solid var(--white); border-radius: 50%;
  background: var(--ink-soft); color: var(--white);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .15);
}
.tab-main[aria-current="page"] .tab-main-icon { background: var(--orange); }
.tab:focus-visible { outline: 3px solid var(--ink); outline-offset: -3px; }

/* ---------- マシンの詳細 (下から出るシート) ---------- */
/* 高さは中身の長さによらず画面の高さに対して決める。中身が短いときは下が余白になる */
.sheet {
  width: 100%; max-width: 460px;
  height: 88vh; height: 88dvh; max-height: 88vh; max-height: 88dvh;
  margin: auto auto 0;
  padding: 0; border: 0;
  border-radius: 16px 16px 0 0;
  background: var(--white); color: var(--ink);
  overflow: hidden;
}
.sheet::backdrop { background: rgba(0, 0, 0, .55); }
.sheet[open] { animation: sheet-in .25s ease-out; }
@keyframes sheet-in { from { transform: translateY(40px); opacity: 0; } }
.sheet-body { display: flex; flex-direction: column; height: 100%; overflow-y: auto; overscroll-behavior: contain; }
/* 下にスワイプして閉じられることを示すつまみ */
.sheet-handle { position: absolute; top: 6px; left: 50%; z-index: 3; width: 40px; height: 5px; margin-left: -20px; border-radius: 999px; background: rgba(43, 39, 39, .25); pointer-events: none; }
#sheet .sheet-handle { background: rgba(255, 255, 255, .7); }
.sheet-close {
  position: absolute; top: 10px; right: 10px; z-index: 2;
  display: grid; place-items: center;
  width: 40px; height: 40px; border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, .92); cursor: pointer;
}
/* プランの中身のモーダル。中身の量に合わせた高さにし、始めるボタンは下に固定する */
.plan-sheet { height: fit-content; background: var(--cream); }
.plan-sheet .sheet-body { height: auto; max-height: 88vh; max-height: 88dvh; }
/* 上の部分は、会話のプランのカードと同じ見た目 (白い背景・図・左の線の色) */
.plan-sheet-head { padding: 26px 56px 16px 18px; background: var(--white); border-bottom: 1px solid var(--line); box-shadow: inset 4px 0 0 var(--orange); }
.plan-sheet-head.is-none { box-shadow: inset 4px 0 0 #4aa37f; }
.plan-sheet-head.is-core { box-shadow: inset 4px 0 0 #e8a317; }
.plan-sheet-top { display: flex; gap: 12px; align-items: center; }
.plan-sheet-thumb { width: 48px; height: 58px; }
.plan-sheet-thumb svg { width: 34px; height: 46px; }
.plan-sheet-thumb[hidden] { display: none; }
.plan-sheet-names { min-width: 0; }
.plan-sheet-title { font-size: 19px; font-weight: 900; line-height: 1.35; word-break: keep-all; overflow-wrap: anywhere; }
.plan-sheet-target { margin-top: 2px; font-size: 12px; color: var(--ink-soft); }
.plan-sheet-lead { margin-top: 10px; font-size: 13px; color: var(--ink); line-height: 1.6; }
.plan-sheet-content { padding: 16px 16px 4px; }
.plan-sheet-section { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.plan-sheet-section .section-title { margin-bottom: 0; }
.plan-sheet-sum { font-size: 13px; font-weight: 700; color: var(--ink-soft); white-space: nowrap; }
.plan-sheet-foot {
  position: sticky; bottom: 0; margin-top: auto;
  padding: 12px 16px calc(12px + var(--safe-b));
  background: linear-gradient(rgba(255, 251, 227, 0), var(--cream) 30%);
}
.sheet-video { position: relative; background: #000; }
.sheet-video video { cursor: pointer; }
/* 止まっているときだけ出す再生のマーク */
.sheet-play {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  display: grid; place-items: center;
  width: 60px; height: 60px; padding: 0 0 0 4px; border: 0; border-radius: 50%;
  background: rgba(0, 0, 0, .55); color: var(--white); cursor: pointer;
}
.sheet-play[hidden] { display: none; }
/* 動画はどれも 640x360。サムネイルの写真は縦長なので、枠に合わせて切り抜く */
.sheet-video video { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: #000; }
.sheet-content { flex: 1 0 auto; padding: 16px 16px calc(24px + var(--safe-b)); }
.sheet-head { display: flex; gap: 12px; align-items: center; }
.sheet-thumb { flex: none; width: 64px; height: 64px; object-fit: contain; border-radius: 8px; background: var(--white); border: 1px solid var(--line); }
.sheet-head-text { flex: 1; min-width: 0; }
.sheet-area { font-size: 12px; font-weight: 700; color: var(--orange); }
.sheet-title { font-size: 22px; font-weight: 900; line-height: 1.3; white-space: nowrap; overflow: hidden; }
.sheet-catch { margin-top: 6px; font-size: 14px; }
.sheet-content > p { font-size: 14px; }
.sheet-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.sheet-tags li { padding: 2px 10px; border-radius: 999px; background: var(--cream); border: 1px solid var(--line); font-size: 12px; font-weight: 700; }
.sheet-tags:empty { display: none; }

.sheet-section { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.sheet-eyebrow { font-size: 11px; font-weight: 900; letter-spacing: .12em; color: var(--orange); }
.sheet-section h3 { margin: 2px 0 12px; font-size: 18px; font-weight: 900; }

.sheet-merits { display: grid; gap: 8px; }
.sheet-merits li { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: 8px; background: var(--cream); }
.merit-num { flex: 0 0 auto; font-size: 20px; font-weight: 900; line-height: 1; color: var(--orange); }
.merit-title { font-size: 15px; font-weight: 700; line-height: 1.45; }
.merit-text { margin-top: 2px; font-size: 13px; color: var(--ink-soft); }

.sheet-point { display: grid; grid-template-columns: 38% 1fr; gap: 14px; align-items: start; }
.sheet-point p { font-size: 14px; line-height: 1.75; }
.sheet-figure { margin: 0; padding: 8px; border-radius: 8px; background: #fffdf3; border: 1px solid var(--line); text-align: center; }
.sheet-figure[hidden] { display: none; }
.sheet-video[hidden], .sheet-section[hidden], .sheet-caution[hidden] { display: none; }
/* 動画がないときは、閉じるボタンの下に余白を取る */
.sheet-video[hidden] + .sheet-content { padding-top: 60px; }

/* やり方の手順 */
.sheet-how { counter-reset: how; display: grid; gap: 10px; }
.sheet-how li { position: relative; padding-left: 34px; font-size: 14px; line-height: 1.65; counter-increment: how; }
.sheet-how li::before {
  content: counter(how);
  position: absolute; left: 0; top: 0;
  display: grid; place-items: center;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--yellow); font-size: 13px; font-weight: 900;
}
.sheet-caution { margin-top: 20px; padding: 12px 14px; border-radius: 8px; background: #f3efe3; color: var(--ink-soft); font-size: 12px; line-height: 1.6; }
.sheet-figure img { width: 100%; height: auto; max-height: 220px; object-fit: contain; margin: 0 auto; }
.sheet-figure figcaption { margin-top: 4px; font-size: 11px; font-weight: 700; color: var(--ink-soft); }
.sheet-figure[hidden] + p { grid-column: 1 / -1; }

.sheet-photos { display: flex; gap: 8px; margin: 12px -16px 0; padding: 0 16px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.sheet-photos[hidden] { display: none; }
.sheet-photos::-webkit-scrollbar { display: none; }
.sheet-photos img { flex: 0 0 62%; aspect-ratio: 335 / 431; object-fit: cover; border-radius: 8px; scroll-snap-align: start; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------- 横向きにしたとき ---------- */
/* スマホを横に向けたら (横長で高さが低いとき)、縦向きに戻すよう案内を出す。パソコンやタブレットの横長の画面では出さない */
.rotate-notice { display: none; }
@media (orientation: landscape) and (max-height: 500px) {
  .rotate-notice {
    position: fixed; inset: 0; z-index: 100;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
    background: var(--yellow); color: var(--ink);
    font-size: 16px; font-weight: 900; text-align: center;
  }
}

/* ---------- 4D マシンのメニュー (まっすぐ・膝伸ばし…) やウォームアップの中身 ---------- */

/* ---------- 今日のメニュー (現場のトレーニングメニューのシートと同じ形) ---------- */
.note.menu-sheet { padding: 20px 12px 12px; background: #fffdf6; }
.ms-head { text-align: center; }
.ms-sub { display: flex; justify-content: center; gap: 12px; margin-top: 6px; line-height: 1.4; font-size: 12px; font-weight: 700; color: var(--orange); }
.ms-plan { margin-top: 0; line-height: 1.4; font-size: 15px; font-weight: 900; word-break: keep-all; overflow-wrap: anywhere; }
.ms-sec { margin-top: 14px; padding-bottom: 4px; border-bottom: 2px solid var(--ink); font-size: 13px; font-weight: 900; }
.ms-table { width: 100%; margin-top: 4px; border-collapse: collapse; font-size: 12px; }
.ms-table th { padding: 4px 4px; background: #f3efe3; color: var(--ink-soft); font-size: 11px; font-weight: 700; text-align: left; white-space: nowrap; }
.ms-table td { padding: 5px 4px; border-bottom: 1px solid #ece4cf; vertical-align: top; }
.ms-table td:nth-child(n+3), .ms-table th:nth-child(n+3) { text-align: center; white-space: nowrap; }
.ms-machine { font-weight: 900; }

/* ---------- 会話のプラン (パッケージ) のカード ---------- */
/* 縦幅を抑える: 図・名前・向いている人を詰めて並べ、右端に矢印。種類 (ストレッチ / 体幹 / 筋力) は左の線の色で分ける */
.pack-list { display: grid; gap: 8px; margin-left: 44px; }
.pack-card {
  position: relative; display: block; width: 100%; padding: 10px 30px 10px 10px; text-align: left; cursor: pointer;
  border: 1px solid var(--line); border-left: 4px solid var(--orange); border-radius: 12px; background: var(--white);
}
.pack-card.is-none { border-left-color: #4aa37f; }
.pack-card.is-core { border-left-color: #e8a317; }
.pack-card:active { background: #fdf8e6; }
.pack-top { display: flex; gap: 10px; align-items: center; }
.pack-thumb { flex: none; display: grid; place-items: center; width: 40px; height: 48px; border-radius: 8px; background: var(--cream); }
.pack-thumb svg { width: 28px; height: 38px; }
.pack-head { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
.pack-name { font-size: 15px; font-weight: 900; line-height: 1.35; word-break: keep-all; overflow-wrap: anywhere; }
.pack-target { font-size: 11px; color: var(--ink-soft); line-height: 1.5; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pack-arrow { position: absolute; right: 12px; top: 50%; width: 8px; height: 8px; margin-top: -4px; border-top: 2px solid #b8ae90; border-right: 2px solid #b8ae90; transform: rotate(45deg); }

/* サムネイルを押すと使い方が開く */
.is-tappable { cursor: pointer; -webkit-tap-highlight-color: transparent; }
.is-tappable:active { opacity: .75; }

/* ---------- プランの中身の一覧 (1種目1行のセル) ---------- */
.rows { display: grid; gap: 8px; }
.row-cell {
  display: grid; grid-template-columns: 56px 1fr auto; gap: 12px; align-items: center;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--white);
  cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.row-cell:active { background: #fdf8e6; }
.row-photo img { display: block; width: 56px; height: 56px; object-fit: contain; border-radius: 8px; background: var(--white); border: 1px solid var(--line); }
.row-body { min-width: 0; }
.row-name { margin-top: 0; font-size: 14px; font-weight: 900; line-height: 1.35; }
.row-how { margin-top: 0; }
.row-dose { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; text-align: right; }
.row-dose span { white-space: nowrap; }
.row-dose .tag-time { padding: 0 6px; font-size: 11px; }
.row-cell { column-gap: 10px; }

/* 同じマシンで複数のトレーニング (4D の複数メニュー、鍛錬の2方向) を1行ずつ */
.menu-list { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.menu-list li { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 3px 0; border-top: 1px dashed var(--line); font-size: 12px; line-height: 1.5; }
.menu-list li:first-child { border-top: 0; }
.menu-list-name { font-weight: 700; color: var(--orange-dark); min-width: 0; }
.menu-list-dose { flex: none; font-weight: 900; white-space: nowrap; }
.row-menus { margin-top: 6px; padding: 4px 10px; border-radius: 8px; background: #fbf8ee; }
.step-menus { margin-top: 4px; padding: 2px 8px; border-radius: 8px; background: #fbf8ee; }

/* 使い方 / やり方 / 説明のボタンはサムネイルの下 */
.row-cell { align-items: start; }
.row-photo, .step-photo { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.row-photo .how-button, .step-photo .how-button { position: static; margin: 0; padding: 2px 7px; font-size: 11px; white-space: nowrap; }
.row-cell { grid-template-columns: 64px 1fr auto; }
.row-photo img { margin: 0 auto; }
.step-photo { align-self: start; }

/* 進行中のプランの一覧: 時間は枠の右上、その下にスタンプ */
.step, .steps-cards .step { align-items: stretch; }
.step-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.step-side .tag-time { padding: 0 6px; font-size: 11px; white-space: nowrap; }
.step-side .stamp { margin: auto 0; align-self: center; }

/* 施設紹介のタブ (4Dストレッチ / 鍛錬マシン / その他) */
.guide-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin-top: 16px; padding: 4px; border-radius: 12px; background: #f3efe3; }
.guide-tab { display: flex; align-items: center; justify-content: center; gap: 4px; padding: 8px 4px; border: 0; border-radius: 9px; background: transparent; color: var(--ink-soft); font-size: 13px; font-weight: 700; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.guide-tab[aria-selected="true"] { background: var(--white); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.guide-tab-count { font-size: 11px; color: var(--ink-soft); }
.guide-catch.is-pending, .guide-pending { color: #a89f86; }
.guide-pending { font-size: 11px; font-weight: 700; }

/* 設備でできるトレーニング。1つのトレーニングに1つの動画 (押すと上の動画が切り替わる) */
.sheet-can { margin-top: 10px; }
.sheet-can-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0; padding: 0; list-style: none; }
.can-group { margin: 24px 0 12px; font-size: 18px; font-weight: 900; }
.can-group:first-child { margin-top: 0; }
.can-tile { display: flex; flex-direction: column; gap: 4px; width: 100%; padding: 0; border: 0; background: none; text-align: left; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.can-tile:disabled { cursor: default; }
.can-pic { position: relative; display: block; aspect-ratio: 4 / 3; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--white); }
.can-pic img { width: 100%; height: 100%; object-fit: contain; }
.can-tile.is-pending .can-pic img { opacity: .35; }
.can-badge { position: absolute; inset: 0; display: grid; place-items: center; font-size: 10px; font-weight: 700; color: #8c846c; }
/* 動画があるものは再生のマーク */
.can-tile:not(.is-pending) .can-badge::before { content: ""; width: 26px; height: 26px; border-radius: 50%; background: rgba(0,0,0,.55) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 6.5v11l9-5.5z' fill='white'/%3E%3C/svg%3E") center / 16px no-repeat; }
.can-tile.is-current .can-pic::after { content: "再生中"; position: absolute; left: 4px; top: 4px; padding: 0 6px; border-radius: 999px; background: rgba(0,0,0,.6); color: #fff; font-size: 10px; font-weight: 700; line-height: 1.7; }
/* プランから開いたとき、そのプランでやるトレーニング */
.can-name { font-size: 12px; font-weight: 700; line-height: 1.35; }
.can-tile.is-pending .can-name { color: var(--ink-soft); }
.can-empty { font-size: 13px; color: #a89f86; }
.sheet-video-label { position: absolute; left: 10px; bottom: 10px; padding: 2px 10px; border-radius: 999px; background: rgba(0,0,0,.6); color: #fff; font-size: 12px; font-weight: 700; pointer-events: none; }

/* 施設紹介の一覧のタグ (詳細と同じもの) */
.guide-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.guide-tag { padding: 0 8px; border-radius: 999px; background: var(--cream); border: 1px solid var(--line); font-size: 10px; font-weight: 700; line-height: 1.7; }
.can-tile.is-pending .can-badge { inset: auto; left: 50%; top: 50%; transform: translate(-50%, -50%); padding: 1px 8px; border-radius: 999px; background: rgba(255,255,255,.92); border: 1px solid var(--line); white-space: nowrap; }

/* 施設紹介のモーダルの中身のタブ (概要 / トレーニング)。スクロールしてもタブは上に残る */
.sheet-tabs { position: sticky; top: 0; z-index: 2; display: grid; grid-template-columns: repeat(2, 1fr); margin: 12px -16px 0; padding: 0 8px; background: var(--white); border-bottom: 1px solid var(--line); }
.sheet-tabs button { padding: 12px 2px 10px; border: 0; border-bottom: 3px solid transparent; background: none; color: var(--ink-soft); font-size: 13px; font-weight: 700; cursor: pointer; -webkit-tap-highlight-color: transparent; white-space: nowrap; }
.sheet-tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--orange); }
.sheet[data-tab="overview"] [data-panel]:not([data-panel="overview"]),
.sheet[data-tab="training"] [data-panel]:not([data-panel="training"]) { display: none; }
/* 概要は、元のレイアウトと同じく MERIT / POINT の見出しと区切り線で分ける。
   トレーニングのタブは、見出しがタブと重なるので出さない */
.sheet.is-tabbed #sheet-can-section { margin-top: 16px; padding-top: 0; border-top: 0; }
.sheet.is-tabbed #sheet-can-section > .sheet-eyebrow, .sheet.is-tabbed #sheet-can-section > h3 { display: none; }
.sheet.is-tabbed .sheet-catch { margin-top: 16px; }
.sheet.is-tabbed .sheet-content { min-height: 60vh; }
.merit-pending { font-size: 13px; color: #a89f86; }
/* 動画がないときは、閉じるボタンが名前の横に来るので、その分をあける */
.sheet-video[hidden] + .sheet-content .sheet-head { padding-right: 40px; }
.sheet-tabs[hidden] { display: none; }
.can-tile.is-current .can-pic { border: 2px solid var(--orange); }

/* プラン紹介 */
.plan-tabs { grid-template-columns: repeat(2, 1fr); }
.plan-group-head { display: flex; align-items: baseline; gap: 8px; margin: 22px 0 10px; }
.plan-group-title { font-size: 18px; font-weight: 900; }
.plan-group-sub { font-size: 12px; color: var(--ink-soft); }
.plan-list { margin-left: 0; }
.plan-groups > .plan-list:first-child { margin-top: 16px; }
#training-title { -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; }
.plan-time-tabs { grid-template-columns: repeat(3, 1fr); margin: 0 0 12px; }
.plan-time-tabs[hidden] { display: none; }

/* 開いた人を確かめるまで画面を覆う (auth.js)。確かめている間はクリーム色だけ。使えないとき (会員でない・LINE の外・読み込めない) はカードで案内する */
.gate { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 24px; overflow: hidden;
  background: radial-gradient(circle at 50% -10%, var(--yellow) 0 34%, transparent 34.2%), var(--cream); }
.gate[hidden] { display: none; }
.gate:not(.is-message) { background: var(--cream); }
.gate:not(.is-message) .gate-card { display: none; }
.gate-card { position: relative; width: 100%; max-width: 340px; padding: 52px 24px 26px; border: 2px solid var(--ink); border-radius: 24px; background: var(--white);
  box-shadow: 0 6px 0 var(--ink); text-align: center; animation: gate-in .35s cubic-bezier(.2, 1.4, .4, 1) both; }
@keyframes gate-in { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }
.gate-badge { position: absolute; top: -38px; left: 50%; display: grid; place-items: center; width: 76px; height: 76px; margin-left: -38px;
  border: 2px solid var(--ink); border-radius: 50%; background: var(--yellow); color: var(--ink); }
.gate-icon { width: 40px; height: 40px; }
.gate:not([data-kind="member"]) .gate-icon--member, .gate[data-kind="member"] .gate-icon--info { display: none; }
.gate-label { display: inline-block; padding: 2px 12px; border-radius: 999px; background: var(--orange); color: var(--white); font-size: 12px; font-weight: 900; letter-spacing: .06em; }
.gate-label:empty { display: none; }
.gate-title { margin-top: 10px; font-size: 20px; font-weight: 900; line-height: 1.45; white-space: pre-line; word-break: keep-all; }
.gate-text { margin: 12px 0 0; padding-top: 12px; border-top: 2px dashed var(--line); font-size: 14px; font-weight: 700; line-height: 1.8; color: var(--ink-soft); white-space: pre-line; }
.gate-button { width: 100%; margin-top: 20px; padding: 13px; border: 0; border-radius: 999px; background: var(--orange); color: var(--white); font-size: 15px; font-weight: 900; cursor: pointer; }
.gate-button:active { background: var(--orange-dark); }
.gate-button[hidden] { display: none; }
@media (prefers-reduced-motion: reduce) { .gate-card { animation: none; } }
.chat-intents .chat-choice-label { white-space: pre-line; }
.chat-intents.is-odd > .chat-choice:first-child { grid-column: 1 / -1; }
