/* ==================================================================
   Brand tokens（共通トークン）— ヘッダー/ドロワー/ステータスの単一ソース
   ================================================================== */
:root{
  --header-bg: #BDB4B2; /* ヘッダー/ドロワー/ステータス共通の背景色（必要に応じて調整） */
  --header-on: #fff;    /* 前景（文字）色 */

  /* mint button */
  --mint-500: #49d8b7;
  --mint-600: #2cc6a6;
  --mint-700: #1da391;
  --mint-ring: rgba(73, 216, 183, 0.35);
}

/* どの要素でも同色にできる汎用ユーティリティ */
.bg-brand-header { background-color: var(--header-bg) !important; }
.text-brand-on   { color: var(--header-on) !important; }

/* ==================================================================
   Drawer / Overlay — 固定＆全高
   ================================================================== */
#site-drawer{
  position: fixed !important;
  top: 0 !important; bottom: 0 !important; left: 0 !important;
  height: 100svh !important;
  /* ← 幅を「コンテンツ基準 + 上限つき」に */
  inline-size: max-content;                          /* 中身に合わせる */
  max-inline-size: clamp(260px, 72vw, 360px);        /* 端末に応じて自然な上限 */
  /* 余白：safe-area も考慮 */
  padding: calc(env(safe-area-inset-top, 0px) + 16px) 20px
           calc(env(safe-area-inset-bottom, 0px) + 20px);
  /* 見た目/使い勝手 */
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  border-right: 1px solid rgba(255,255,255,.15);
  background: var(--header-bg) !important;
  color: #fff !important;
  /* アニメーション */
  transform: translateX(-100%);
  transition: transform .2s ease-out;
  z-index: 60 !important;
}
.menu-open #site-drawer{ transform: translateX(0) !important; }

/* オーバーレイ */
.menu-overlay{
  position: fixed !important; inset: 0 !important;
  background: rgba(0,0,0,.5);
  opacity: 0; pointer-events: none;
  transition: opacity .2s ease-out;
  z-index: 55 !important;
}
.menu-open .menu-overlay,
.menu-overlay.is-open{
  opacity: 1 !important;
  pointer-events: auto !important;
}

/* 念のため：main の謎の上マージン消し */
main { margin-top: 0 !important; padding-top: 0 !important; }
main > :first-child { margin-top: 0 !important; }

/* ========= オプション（中身のリンクが横幅を広げ過ぎないように） ======== */
#site-drawer nav a{ display: inline-flex; inline-size: max-content; }
#site-drawer nav{ display: grid; gap: 20px; }

/* ==================================================================
   Logged-out legal footer (ultra thin)
   ================================================================== */
.footer-legal-thin{
  padding-block: .375rem;                               /* 6px */
  min-height: 32px;
  padding-bottom: calc(.375rem + env(safe-area-inset-bottom, 0px));
}
@media (min-width: 640px){
  .footer-legal-thin{ padding-block: .5rem; min-height: 36px; }
}

/* 横並び：左にコピーライト、右端に法務リンク（折り返し禁止） */
.footer-legal-thin .legal-wrap{
  display: flex !important;
  align-items: center;
  flex-wrap: nowrap;
  width: 100%;
  gap: .75rem;
}

/* 左側：©表記（縮まない） */
.footer-legal-thin .copyright{
  flex: 0 0 auto;
  font-size: .8rem;
  line-height: 1;
  opacity: .95;
  white-space: nowrap;
}

/* 右側：法務リンク群（右端へ／インライン／自然な間隔） */
.footer-legal-thin .legal-links{
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 1.125rem;              /* 18px */
  flex: 0 1 auto;
  font-size: .85rem;
  line-height: 1;
  white-space: nowrap;
}
.footer-legal-thin .legal-links a{
  text-decoration: none;
  opacity: .95;
  transition: opacity .15s ease;
  white-space: nowrap;
}
.footer-legal-thin .legal-links a:hover{
  opacity: 1;
  text-decoration: underline;
}

/* 幅が狭い端末では少しだけ詰める */
@media (max-width: 639px){
  .footer-legal-thin .legal-links{ gap: .8rem; font-size: .8rem; }
}
@media (min-width: 640px){
  .footer-legal-thin .legal-links{ gap: 1.375rem; }      /* 22px */
}

/* 追加の強制（親が footer のときも確実に効かせたい場合） */
footer .footer-legal-thin .legal-wrap{ justify-content: space-between !important; }

/* ==================================================================
   Header / Footer フォールバック一式（本番で Tailwind が効かなくても崩さない）
   ================================================================== */
header.bg-brand-header,
footer.bg-brand-header{
  background-color: var(--header-bg) !important;
  color: #fff !important;
}
header.bg-brand-header a,
header.bg-brand-header nav,
header.bg-brand-header .btn,
header.bg-brand-header .flex{
  color: #fff !important;
}
footer.bg-brand-header .footer-legal-thin .legal-links a{
  color: #fff !important;
}

/* ==================================================================
   Header: レイアウトの保険（常に横並び・右寄せ）
   ================================================================== */
header.bg-brand-header > div{
  display: flex !important;
  align-items: center !important;
  gap: .75rem;
  height: 64px;
  min-height: 64px;
  padding-inline: 16px;
}
@media (min-width: 768px){
  header.bg-brand-header > div{ padding-inline: 32px; }
}
header.bg-brand-header nav{
  margin-left: auto !important;
  display: flex !important;
  align-items: center !important;
  gap: 1.25rem;
}
header.bg-brand-header a{ text-decoration: none; }
header.bg-brand-header a:hover{ text-decoration: underline; }
header.bg-brand-header .btn,
header.bg-brand-header .flex{ align-items: center; }
header.bg-brand-header > div{ padding-block: .375rem; }
@media (min-width: 640px){
  header.bg-brand-header > div{ padding-block: .5rem; }
}
@media (min-width: 768px){
  header.bg-brand-header > div{ padding-block: .5rem; }
}

/* ==================================================================
   Logged-out header (landing only): compact + bold logo
   ================================================================== */
body.landing-root header.bg-brand-header > div{
  height: 56px;
  min-height: 56px;
  padding-block: .25rem !important;
}
body.landing-root header.bg-brand-header a span{
  font-weight: 800;
  font-size: clamp(1.25rem, 2.2vw, 1.75rem);
  letter-spacing: .02em;
  color: #fff !important;
}
body.landing-root header.bg-brand-header nav{
  margin-left: auto !important;
  display: flex !important;
  align-items: center !important;
  gap: 1.25rem;
}
body.landing-root header.bg-brand-header nav a{
  color: #fff !important;
  text-decoration: none;
  opacity: .95;
  transition: opacity .15s ease, text-decoration-color .15s ease;
}
body.landing-root header.bg-brand-header nav a:hover{
  opacity: 1;
  text-decoration: underline;
}

/* ==================================================================
   Bottom App Nav / App Footer（ログイン後）
   ================================================================== */
.footer-app__nav{
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: max-content;
  justify-content: center;
  align-items: center;
  gap: clamp(1.5rem, 5vw, 3.25rem);
  margin-inline: auto;
  max-width: min(820px, 92vw);
}
.footer-app__link{
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  inline-size: max-content;
  gap: .3rem;
  text-decoration: none;
  color: inherit;
}
.footer-app__link svg{
  width: 32px; height: 32px; display: block;
  color:#111;
  transition: transform .15s ease, color .15s ease, filter .15s ease;
}
@media (min-width:640px){
  .footer-app__link svg{ width:34px; height:34px; }
}
.footer-app__link span{
  font-size:.8rem; line-height:1; color:#fff; letter-spacing:.02em;
}
.footer-app__link:hover svg{ transform: translateY(-1px); color:#000; }
.footer-app__link.is-active svg{ color:#fff; filter: drop-shadow(0 2px 8px rgba(0,0,0,.25)); }
.footer-app__link.is-active span{ color:#fff; font-weight:700; }
.footer-app{
  padding-block: .5rem;
  padding-bottom: calc(.5rem + env(safe-area-inset-bottom, 0px));
  min-height: 52px;
}
.pb-safe{ padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 0px); }
.footer-app__link:focus-visible{
  outline: 2px solid rgba(255,255,255,.9);
  outline-offset: 3px;
  border-radius: 12px;
}
@media (max-width: 360px){
  .footer-app__nav{ gap: 1.25rem; }
}

/* ==================================================================
   記録詳細ページ 共通スタイル
   ================================================================== */
:root{
  --vh-header: 64px;
  --vh-tabbar: 6rem;
  --record-gap: 1.25rem;
}
.record-page{
  min-height: calc(100dvh - var(--vh-header) - var(--vh-tabbar));
  display: grid;
  grid-template-rows: auto 1fr auto;
  row-gap: 1.25rem;
  padding: 0 1rem;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
@supports not (height: 100dvh){
  .record-page{ min-height: calc(100vh - var(--vh-header) - var(--vh-tabbar)); }
}
.record-header{
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  margin-top: 1rem;
}
.record-title{
  margin: 0;
  text-align: center;
  font-weight: 700;
  font-size: clamp(1.125rem, 1vw + 1rem, 1.5rem);
  line-height: 1.2;
}
.record-toolbar{ display: inline-flex; gap: .5rem; }
.icon-btn{
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.875rem; height: 1.875rem;
  border-radius: .5rem;
  background: #f3f4f6; color: #374151;
  text-decoration: none;
  transition: background .15s ease, transform .05s ease;
}
.icon-btn:hover{ background:#e5e7eb; }
.icon-btn:active{ transform: translateY(1px); }
.icon-btn.icon-btn--danger{ background:#fee2e2; }
.icon-btn.icon-btn--danger:hover{ background:#fecaca; }

:root{ --record-gap: 1.25rem; }
.record-center{ display: grid; place-content: center; min-height: 0; }
.record-body{ transform: translateY(-1rem); will-change: transform; margin-bottom: .25rem; }
@media (min-width: 640px){ .record-body{ transform: translateY(-1rem); } }
.record-box{ display:block; width: -moz-fit-content; width: fit-content; margin-inline: auto; text-align: left; }
.record-body > .record-line + .record-line{ margin-top: var(--record-gap); }
.record-line{ display:flex; align-items: baseline; gap: .75rem; }
.record-label{ color:#64748b; flex:0 0 auto; }
.record-value{ color:#111827; }
.record-comment{
  display:inline-block; border:1px solid #e5e7eb; background:#f9fafb;
  padding:.5rem .75rem; border-radius:.5rem; color:#111827;
  white-space: pre-wrap; word-break: break-word;
}
.record-share{ margin-top:2rem; display:flex; justify-content:center; }
a.btn-x{
  display:inline-flex; align-items:center; gap:.5rem;
  padding:.625rem 1.25rem; border-radius:9999px; background:#000; color:#fff;
  font-weight:500; box-shadow:0 1px 3px rgb(0 0 0 / .15);
  text-decoration:none; transition: background .2s ease, opacity .2s ease;
}
a.btn-x:hover{ background:#222; opacity:.95; }
a.btn-x svg{ width:18px; height:18px; }

/* ==================================================================
   Buttons（レガシー共通ユーティリティ）
   ================================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .75rem 1.25rem; border-radius: .5rem;
  font-weight: 600; line-height: 1.25; text-decoration: none; cursor: pointer;
  border: 1px solid transparent; color: #fff;
  background-color: #334155; /* slate-700 */
  transition: background-color .2s ease, box-shadow .2s ease, transform .02s ease;
}
.btn:hover { background-color: #1f2937; } /* slate-800 */
.btn:active { transform: translateY(1px); }
.btn:focus-visible {
  outline: 2px solid transparent;
  box-shadow: 0 0 0 3px rgba(59,130,246,.45);
}

/* size */
.btn-lg { padding: .875rem 1.5rem; font-size: 1rem; }

/* full-width on mobile, auto on ≥640px */
.btn-wrap { width: 100%; }
@media (min-width: 640px) { .btn-wrap { width: auto; } }

/* variants */
.btn-primary {
  background-color: #2563eb; border-color: #2563eb; /* blue-600 */
}
.btn-primary:hover { background-color: #1d4ed8; }  /* blue-700 */

.btn-danger {
  background-color: #dc2626; border-color: #dc2626; /* red-600 */
}
.btn-danger:hover { background-color: #b91c1c; }   /* red-700 */

/* mint（「ファスティング開始」ボタン用） */
.btn-mint{
  background-color: var(--mint-500);
  color: #fff;
  border-radius: 0.75rem;        /* rounded-xl 風 */
  padding: 0.75rem 1.5rem;       /* btn-lg 相当 */
  font-weight: 700;
  box-shadow: 0 6px 14px rgba(0,0,0,0.08);
  transition: background-color .15s ease, transform .06s ease, box-shadow .15s ease;
}
.btn-mint:hover{ background-color: var(--mint-600); box-shadow: 0 8px 18px rgba(0,0,0,0.12); }
.btn-mint:active{ background-color: var(--mint-700); transform: translateY(1px); }
.btn-mint:disabled{ opacity: .6; cursor: not-allowed; }
.btn-mint:focus-visible{ outline: 3px solid var(--mint-ring); outline-offset: 2px; }

/* disabled */
.btn[disabled], .btn:disabled { opacity: .6; cursor: not-allowed; }
