/* 患者様アプリ専用: 白とナチュラルグリーンを基調にしたフラットテーマ。 */
body.patient-app {
  --bg: #FFFFFF;
  --bg-soft: #F7FAF7;
  --bg-secondary: #F7FAF7;
  --surface: #FFFFFF;
  --surface-soft: #F2F7F2;
  --panel: #FFFFFF;
  --panel-strong: #FFFFFF;
  --green: #6B9B72;
  --green-dark: #4F7957;
  --green-deep: #365B3E;
  --green-soft: #E6F0E7;
  --green-pale: #F3F8F3;
  --text: #202820;
  --text-secondary: #667066;
  --text-light: #8A938A;
  --muted: #667066;
  --line: #DDE5DD;
  --line-strong: #CBD7CB;
  --accent: #6B9B72;
  --accent-deep: #4F7957;
  --accent-soft: #E6F0E7;
  --success: #4F7957;
  --danger: #E5484D;
  --shadow: none;
  --radius-xl: 0px;
  --radius-lg: 0px;
  --radius-md: 0px;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
}

body.patient-app .bg-orb { display: none; }
body.patient-app a { color: var(--green-dark); }
body.patient-app .app-shell {
  width: min(100%, 760px);
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) 20px calc(104px + env(safe-area-inset-bottom));
}
body.patient-app .topbar {
  align-items: center;
  margin: 0 0 20px;
  padding: 0 0 12px;
  border-bottom: 1px solid var(--line);
}
body.patient-app .topbar h1,
body.patient-app .hero-card h2,
body.patient-app .panel h2,
body.patient-app .panel h3,
body.patient-app .panel h4 {
  font-family: var(--font-sans);
  letter-spacing: 0;
}
body.patient-app .topbar h1 { font-size: clamp(1.7rem, 7vw, 2rem); font-weight: 700; }
body.patient-app .eyebrow { margin-bottom: 4px; color: var(--green-dark); font-size: .76rem; letter-spacing: .06em; }
body.patient-app .topbar > div > .eyebrow,
body.patient-app #weightProgressSection .card-head .eyebrow,
body.patient-app .body-profile-field > .eyebrow,
body.patient-app #screen-confession .card-head .eyebrow { text-align: center; }
body.patient-app .page-stack { gap: 24px; }
body.patient-app .panel,
body.patient-app .hero-card,
body.patient-app .modal-card {
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
  backdrop-filter: none;
}
body.patient-app .panel { padding: 22px 0; border-top: 1px solid var(--line); }
body.patient-app .auth-card { max-width: 460px; padding: 24px 0; border-bottom: 1px solid var(--line); }
body.patient-app .welcome-panel {
  display: grid;
  width: min(100%, 620px);
  grid-template-columns: minmax(0, 1fr) 148px;
  align-items: start;
  gap: 10px;
  margin-inline: auto;
  padding-right: 10px;
  padding-left: 10px;
  padding-top: 0;
  border-top: 0;
  border-bottom: 1px solid var(--line);
}
body.patient-app .welcome-top { display: contents; }
body.patient-app .welcome-copy { padding-top: 16px; }
body.patient-app .welcome-copy .eyebrow {
  margin: 0 0 10px;
  font-size: .72rem;
  letter-spacing: .05em;
}
body.patient-app .welcome-profile-actions { display: flex; flex-direction: column; align-items: center; }
body.patient-app .welcome-copy h2 { width: 100%; margin: 0 0 20px; font-size: 1.5rem; font-weight: 650; text-align: center; }
body.patient-app .welcome-copy #openProfileButton,
body.patient-app .welcome-copy #openCurrentBodyImageButton { width: 100%; max-width: 180px; margin: 0; white-space: nowrap; }
body.patient-app .welcome-copy #openCurrentBodyImageButton { margin-top: 10px; }
body.patient-app .home-coach {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 14px;
  min-width: 0;
}
body.patient-app .home-coach-bubble {
  position: relative;
  width: 144px;
  margin: 0;
  padding: 8px 9px;
  border: 1px solid var(--green-soft);
  border-radius: 6px;
  background: #FFFFFF;
  color: var(--green-deep);
  font-size: .72rem;
  font-weight: 600;
  line-height: 1.45;
  text-align: center;
}
body.patient-app .home-coach-bubble > span { display: block; }
body.patient-app .home-coach-bubble::after {
  position: absolute;
  right: 22px;
  bottom: -6px;
  width: 10px;
  height: 10px;
  border-right: 1px solid var(--green-soft);
  border-bottom: 1px solid var(--green-soft);
  background: #FFFFFF;
  content: "";
  transform: rotate(45deg);
}
body.patient-app .home-coach-bubble strong { margin-left: 3px; font-size: .92rem; font-weight: 800; }
body.patient-app .home-coach img {
  display: block;
  width: min(100%, 142px);
  height: auto;
  margin-inline: auto;
  mix-blend-mode: multiply;
}
body.patient-app .home-headline {
  display: grid;
  gap: 14px;
  margin: 0 0 28px;
  padding: 0 0 24px;
  border-bottom: 1px solid var(--line);
}
body.patient-app .home-headline-video {
  display: block;
  width: 100%;
  aspect-ratio: 12 / 5;
  border-radius: 0;
  box-shadow: none;
}
body.patient-app .home-headline-video {
  height: auto;
  object-fit: cover;
  object-position: center center;
}
body.patient-app .home-headline-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
body.patient-app .home-headline .home-headline-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  width: 100%;
  min-width: 0;
  min-height: 78px;
  margin: 0;
  padding-right: 8px;
  padding-left: 8px;
}
body.patient-app .quick-action-title { font-size: 1rem; line-height: 1.2; }
body.patient-app .quick-action-subtitle {
  color: var(--text-secondary);
  font-size: .69rem;
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: 0;
  white-space: nowrap;
}
body.patient-app .primary-button .quick-action-subtitle { color: rgba(255, 255, 255, .82); }
body.patient-app .quick-action-subtitle-handwriting {
  font-family: "Yomogi", "Hiragino Maru Gothic ProN", "Yu Gothic", cursive;
}
body.patient-app .handwriting-text {
  font-family: "Yomogi", "Hiragino Maru Gothic ProN", "Yu Gothic", cursive;
  font-weight: 400;
}
body.patient-app #screen-confession .handwriting-text { font-weight: 700; }
body.patient-app #screen-exercise > .panel:nth-child(2) .eyebrow { text-align: center; }
body.patient-app #openProfileButton { white-space: nowrap; }
body.patient-app .body-profile-home {
  grid-column: 1 / -1;
  width: min(48%, 300px);
  flex-basis: auto;
  gap: 8px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}
body.patient-app .body-profile-home > span:first-child { padding: 0; color: var(--text); font-size: .9rem; }
body.patient-app .body-profile-home-comparison { padding: 0; gap: 5px; }
body.patient-app .body-profile-home-image img,
body.patient-app .body-profile-home-empty,
body.patient-app .body-profile-preview,
body.patient-app .body-profile-empty {
  border-color: var(--line);
  border-radius: 3px;
  background: var(--bg-soft);
}
body.patient-app .body-profile-home-empty { padding: 8px; font-size: .72rem; }
body.patient-app .body-profile-home-arrow { color: var(--text-light); font-weight: 400; }
body.patient-app .body-profile-field,
body.patient-app .notification-settings { margin-top: 22px; padding: 20px 0 0; border: 0; border-top: 1px solid var(--line); border-radius: 0; background: transparent; }
body.patient-app .body-profile-editors { gap: 20px; }
body.patient-app .body-profile-preview,
body.patient-app .body-profile-empty { min-height: 160px; }

body.patient-app .card-large { padding: 22px 0; }
body.patient-app .accent-card { background: transparent; }
body.patient-app .card-head { align-items: center; }
body.patient-app .card-head h3 { margin: 0; font-size: 1.18rem; }
/* ホームの情報ブロックは、同一の読み順と余白リズムで統一する。 */
body.patient-app .home-info-block {
  padding: 28px 0;
}
body.patient-app .home-info-block .card-head {
  display: block;
}
body.patient-app .home-info-block .eyebrow {
  margin: 0 0 6px;
  color: var(--green-dark);
  font-size: .95rem;
  font-weight: 700;
  letter-spacing: .03em;
}
body.patient-app .home-section-image,
body.patient-app .section-hero-image {
  display: block;
  width: 100%;
  aspect-ratio: 12 / 5;
  border-radius: 0;
  box-shadow: none;
  object-fit: cover;
  object-position: center;
}
body.patient-app .home-section-image { margin: 8px 0 20px; }
body.patient-app .section-hero-image { margin: 14px 0 22px; }
body.patient-app .home-info-heading {
  margin: 0;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: clamp(1.45rem, 6vw, 1.8rem);
  font-weight: 800;
  line-height: 1.35;
}
body.patient-app .home-info-block .home-info-article-title,
body.patient-app .home-info-block .home-info-status {
  margin: 18px 0 0;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.7;
}
body.patient-app .home-info-block .support-copy {
  margin: 12px 0 0;
  color: var(--text-secondary);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.7;
}
body.patient-app .home-info-block .meta-text {
  margin: 8px 0 0;
  color: var(--text-secondary);
}
body.patient-app .home-info-block .chip {
  margin-top: 10px;
}
body.patient-app .home-info-block .home-info-action {
  width: 100%;
  min-height: 52px;
  margin: 24px 0 0;
  padding: 12px 18px;
  border: 0;
  border-radius: 8px;
  background: var(--green-dark);
  color: #FFFFFF;
  font-size: 1rem;
  font-weight: 700;
}
/* NO.BSコーナーの記事は、この一覧内へ同じカード形式で追加できる。 */
body.patient-app .no-bs-corner-list { display: grid; gap: 16px; padding: 28px 0 4px; }
body.patient-app .no-bs-corner-card {
  padding: 24px 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, #FFFFFF, var(--green-pale));
}
body.patient-app .no-bs-corner-card h3 { margin: 0; color: var(--text); font-size: 1.38rem; font-weight: 700; }
body.patient-app .no-bs-corner-body { margin-top: 16px; }
body.patient-app .no-bs-corner-body p { margin: 0; color: var(--text-secondary); font-size: .96rem; line-height: 1.8; }
body.patient-app .no-bs-corner-body p + p { margin-top: 16px; }
body.patient-app .support-copy,
body.patient-app .meta-text,
body.patient-app .helper-text,
body.patient-app .empty-state,
body.patient-app .notice,
body.patient-app .flash { color: var(--text-secondary); }
body.patient-app .notice,
body.patient-app .flash { padding: 12px 14px; border: 1px solid var(--line); border-radius: 0; background: var(--bg-soft); }
body.patient-app .flash { color: var(--text); }

body.patient-app input,
body.patient-app select,
body.patient-app textarea {
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 12px 14px;
  background: #FFFFFF;
  color: var(--text);
}
body.patient-app input:focus,
body.patient-app select:focus,
body.patient-app textarea:focus { border-color: var(--green); outline: none; box-shadow: 0 0 0 2px rgba(107, 155, 114, .14); }
body.patient-app label { color: var(--text); font-weight: 600; }
body.patient-app .primary-button,
body.patient-app .secondary-button,
body.patient-app .ghost-button,
body.patient-app .icon-button {
  min-height: 48px;
  padding: 10px 15px;
  border-radius: 8px;
  font-weight: 600;
  box-shadow: none;
}
/* 患者様画面の主操作・補助操作は、単独で見つけやすく押しやすい中央配置に統一する。 */
body.patient-app .primary-button,
body.patient-app .secondary-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(calc(100% - 8px), 360px);
  min-height: 48px;
  margin: 20px auto;
}
body.patient-app .primary-button { border: 0; background: var(--green-dark); color: #FFFFFF; }
body.patient-app .secondary-button { border: 1px solid var(--green); background: #FFFFFF; color: var(--green-dark); }
body.patient-app .ghost-button,
body.patient-app .icon-button { border: 1px solid var(--line-strong); background: #FFFFFF; color: var(--text-secondary); }
body.patient-app .primary-button-large { min-height: 48px; font-size: .95rem; }
body.patient-app .topbar {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
}
body.patient-app .profile-sign-out {
  display: flex;
  align-items: center;
  justify-content: center;
  width: auto;
  min-width: 88px;
  min-height: 44px;
  margin: 52px auto 40px;
  padding: 8px 12px;
  border: 0;
  background: transparent;
  color: var(--text-light);
  font-size: .84rem;
  font-weight: 400;
  text-decoration: underline;
  text-underline-offset: 3px;
}
body.patient-app .primary-button:hover,
body.patient-app .secondary-button:hover,
body.patient-app .ghost-button:hover,
body.patient-app .icon-button:hover,
body.patient-app .segment:hover,
body.patient-app .nav-pill:hover { transform: none; opacity: .88; }
body.patient-app .segmented { padding: 0; border-radius: 0; background: transparent; border-bottom: 1px solid var(--line); }
body.patient-app .segment { border-radius: 0; color: var(--text-secondary); font-weight: 600; }
body.patient-app .segment.is-active { border-bottom: 2px solid var(--green-dark); color: var(--green-dark); background: transparent; box-shadow: none; }
body.patient-app .chip { min-height: 24px; padding: 3px 8px; background: var(--green-dark); border-radius: 999px; font-size: .72rem; }
body.patient-app .chip-soft { background: var(--green-soft); color: var(--green-deep); }

body.patient-app .mobile-nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0;
  padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: #FFFFFF;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, .03);
  backdrop-filter: none;
}
body.patient-app .nav-pill {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 0;
  min-height: 64px;
  padding: 6px 1px 5px;
  border-radius: 6px 6px 0 0;
  color: var(--text-secondary);
  font-size: .66rem;
  font-weight: 600;
  line-height: 1.1;
  white-space: nowrap;
}
body.patient-app .nav-icon { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }
body.patient-app .nav-label { overflow: hidden; max-width: 100%; text-overflow: ellipsis; }
body.patient-app .nav-pill.is-active { color: var(--green-dark); background: var(--green-pale); box-shadow: inset 0 2px 0 var(--green-dark); }
body.patient-app .nav-item-notification { padding-right: 2px; }
body.patient-app .message-unread-badge { top: 4px; right: 3px; min-width: 18px; height: 18px; padding: 0 4px; background: var(--danger); font-size: .62rem; }

body.patient-app .weight-panel { border-bottom: 1px solid var(--line); }
body.patient-app #weightProgressSection > .card-head {
  justify-content: center;
}
body.patient-app #weightProgressSection > .card-head > div {
  width: 100%;
  text-align: center;
}
body.patient-app .weight-record-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
body.patient-app .weight-record-form .primary-button {
  grid-column: 1 / -1;
}
body.patient-app .weight-summary { gap: 0; margin: 18px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
body.patient-app .weight-summary div { padding: 12px 8px; border-radius: 0; background: transparent; }
body.patient-app .weight-summary div + div { border-left: 1px solid var(--line); }
body.patient-app .weight-summary span { color: var(--text-secondary); }
body.patient-app .period-switch { gap: 0; border-bottom: 1px solid var(--line); }
body.patient-app .period-switch button { border-radius: 0; background: transparent; color: var(--text-secondary); }
body.patient-app .period-switch button.is-active { background: transparent; color: var(--green-dark); box-shadow: inset 0 -2px 0 var(--green-dark); }
body.patient-app .weight-chart-wrap { height: 240px; }

body.patient-app .list-stack { gap: 0; }
body.patient-app .list-card,
body.patient-app .detail-card { padding: 18px 0; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; }
body.patient-app .list-card-actions { margin-top: 12px; }
body.patient-app .weight-reminders-list { margin: 0 0 4px; }
body.patient-app .weight-reminder-card { margin: 8px 0 18px; padding: 16px; border: 1px solid var(--line); border-left: 3px solid var(--green); background: var(--green-pale); }
body.patient-app .weight-reminder-actions { flex-direction: column; align-items: center; gap: 10px; }
body.patient-app .weight-reminder-actions .primary-button,
body.patient-app .weight-reminder-actions .secondary-button { width: min(100%, 320px); }
body.patient-app .video-frame { border-color: var(--line); border-radius: 3px; background: var(--bg-soft); }
body.patient-app .video-frame iframe { border-radius: 3px; }

body.patient-app .chat-panel { border-top: 0; }
body.patient-app .chat-messages { margin: 16px 0; padding: 0; }
body.patient-app .chat-compose { grid-template-columns: minmax(0, 1fr); }
body.patient-app .chat-bubble { border-color: var(--line); border-radius: 8px; background: var(--bg-soft); }
body.patient-app .chat-message.is-own .chat-bubble { border-radius: 8px; background: var(--green-soft); }
body.patient-app .chat-bubble a,
body.patient-app .article-body a,
body.patient-app [data-tip-preview] a { color: var(--green-dark); }
body.patient-app .meal-photo-progress,
body.patient-app .meal-photo-compose { padding: 16px 0; border: 0; border-top: 1px solid var(--line); border-radius: 0; background: transparent; }
body.patient-app .meal-photo-bar { background: var(--green-soft); }
body.patient-app .meal-photo-bar > span { background: var(--green); }
body.patient-app .meal-photo-preview img,
body.patient-app .chat-meal-image,
body.patient-app .chat-photo-button { border-radius: 4px; }
body.patient-app .photo-thumb,
body.patient-app .photo-thumb img { border-radius: 4px; }

body.patient-app .notification-settings .primary-button { margin-bottom: 0; }
body.patient-app .list-card-actions,
body.patient-app .action-row {
  justify-content: center;
}
body.patient-app .action-row {
  flex-direction: column;
  align-items: center;
}
body.patient-app .action-row .primary-button,
body.patient-app .action-row .secondary-button { margin: 0; }
/* 写真選択とモーダル・チャット内の補助操作は、コンパクトな例外として維持する。 */
body.patient-app #mealPhotoChooseButton {
  width: auto;
  min-width: 180px;
}
body.patient-app .notification-status { color: var(--green-deep); }
body.patient-app .modal { padding: 16px; }
body.patient-app .modal-card { width: min(100%, 680px); padding: 22px 18px; border: 1px solid var(--line); background: #FFFFFF; }
body.patient-app .modal::backdrop { background: rgba(32, 40, 32, .28); }

@media (max-width: 640px) {
  body.patient-app .app-shell { padding-right: 16px; padding-left: 16px; }
  body.patient-app .welcome-panel { grid-template-columns: minmax(0, 1fr) 152px; gap: 8px; }
  body.patient-app .home-coach { gap: 14px; }
  body.patient-app .home-coach-bubble { width: 140px; font-size: .68rem; }
  body.patient-app .home-coach img { width: 128px; }
  body.patient-app .home-headline { margin-bottom: 22px; }
  body.patient-app .body-profile-home { width: 100%; }
  body.patient-app .weight-record-form { grid-template-columns: 1fr 1fr; }
  body.patient-app .weight-record-form .primary-button { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  body.patient-app .home-headline-video { visibility: hidden; }
}

@media (max-width: 380px) {
  body.patient-app .app-shell { padding-right: 12px; padding-left: 12px; }
  body.patient-app .nav-pill { font-size: .6rem; }
  body.patient-app .nav-icon { width: 19px; height: 19px; }
  body.patient-app .message-unread-badge { right: 1px; }
  body.patient-app .weight-summary { grid-template-columns: 1fr; }
  body.patient-app .weight-summary div + div { border-top: 1px solid var(--line); border-left: 0; }
}

/* タブレット以上では、スマホの構成を保ったままホーム上部の余白と幅を整える。 */
@media (min-width: 641px) {
  body.patient-app .app-shell {
    width: min(100%, 860px);
  }

  body.patient-app .welcome-profile-actions {
    width: 100%;
  }

  body.patient-app .welcome-copy {
    padding-top: 0;
  }

  body.patient-app .welcome-copy #openProfileButton,
  body.patient-app .welcome-copy #openCurrentBodyImageButton {
    max-width: 200px;
  }

  body.patient-app .home-coach-bubble {
    width: 164px;
  }

  body.patient-app .home-coach img {
    width: min(100%, 160px);
  }

  body.patient-app .body-profile-home {
    justify-self: center;
    width: min(100%, 340px);
  }

  body.patient-app .mobile-nav {
    right: auto;
    left: 50%;
    width: min(calc(100% - 40px), 860px);
    transform: translateX(-50%);
  }
}

/* 641〜767px は既存の2カラム構成を維持する。 */
@media (min-width: 641px) and (max-width: 767px) {
  body.patient-app .welcome-panel {
    width: min(100%, 700px);
    grid-template-columns: minmax(0, 1fr) 180px;
    gap: 28px;
    row-gap: 16px;
    align-items: center;
    padding-bottom: 12px;
  }
}

@media (min-width: 1024px) {
  body.patient-app .app-shell {
    width: min(100%, 960px);
  }

  body.patient-app .mobile-nav {
    width: min(calc(100% - 40px), 960px);
  }
}

@media (min-width: 768px) {
  body.patient-app .welcome-panel {
    width: min(100%, 840px);
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
    align-items: start;
    padding-bottom: 12px;
  }

  body.patient-app .welcome-top {
    display: grid;
    width: min(100%, 720px);
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    margin-inline: auto;
  }

  body.patient-app .welcome-copy {
    padding-top: 0;
  }

  body.patient-app .home-coach {
    justify-self: stretch;
  }

  body.patient-app .body-profile-home {
    grid-column: auto;
    justify-self: center;
  }
}
