/* ============================================================================
   Yoripro(よりプロ) — app.css
   デザイン方針:
     ・アイコンのティール系配色に合わせる（実測色 #04C4D8 / #73E5D6 / #D2F0C7 / 文字#1E626D）
     ・高齢者基準: 本文17px（最小16px）／タップ領域 最小48px
     ・CUD配慮: 状態を色だけで示さない（必ずアイコン＋文字を併記）
     ・コントラスト比は実測済み。白文字を載せる面は 4.5:1 以上を確保する。
       #0B7C7A=5.03:1 / #0A6E6C=6.07:1 / #A85F00=4.88:1 / #17494E on 白=10.00:1
       ※ #12B5B0・#73E5D6 は 装飾専用（文字を載せない）
   ========================================================================== */

:root{
  /* ── ブランド（文字を載せてよい濃さ）── */
  --yp-primary:       #0B7C7A;   /* 主要ボタン・白文字 5.03:1 */
  --yp-primary-dk:    #0A6E6C;   /* グラデ濃端・白文字 6.07:1 */
  --yp-primary-press: #085957;   /* 押下時 */

  /* ── ブランド（装飾専用・文字を載せない）── */
  --yp-teal:          #12B5B0;
  --yp-teal-lite:     #73E5D6;
  --yp-lime:          #D2F0C7;

  /* ── 面 ── */
  --yp-bg:            #F2FBFA;
  --yp-surface:       #FFFFFF;
  --yp-surface-sub:   #E9F6F4;
  --yp-mint:          #EAFBF6;   /* AIバブル背景 */

  /* ── 文字 ── */
  --yp-ink:           #17494E;   /* 見出し・本文 10.00:1 */
  --yp-ink-sub:       #4F6669;   /* 副次テキスト 6.11:1 */

  /* ── 罫線 ── */
  --yp-border:        #CBE0DD;   /* 装飾罫線 */
  --yp-border-ui:     #748F8C;   /* 入力欄など UI部品の境界 3.47:1 */

  /* ── 状態色 ── */
  --yp-danger:        #C4362F;   /* 5.36:1 */
  --yp-success:       #1A6E46;   /* 6.24:1 */
  --yp-warn-bg:       #FFF6E6;

  /* ── 代理モード（本人モードと絶対に取り違えないための別系統色）── */
  --yp-proxy:         #A85F00;   /* 白文字 4.88:1 */
  --yp-proxy-dk:      #9C5800;   /* 5.51:1 */
  --yp-proxy-bg:      #FFF6E8;

  /* ── 寸法 ── */
  --yp-tap:           48px;      /* タップ領域の最小値 */
  --yp-radius:        16px;

  /* ── 文字の大きさ（設定 > 🔠 文字の大きさ）────────────────────────────
     このCSSの font-size は全て calc(Npx * var(--yp-fs)) で書いてある。
     ここの倍率が変わるだけでチャット・ボタン・メニュー等が一斉に追従する。
     倍率は <html data-fs="..."> で切り替える（js/fontsize.js）。
     ★タップ領域(--yp-tap)・余白・角丸には倍率をかけない。48pxは元から十分で、
       余白まで拡大すると430px幅のレイアウトが破綻するため（文字だけを大きくする）。 */
  --yp-fs: 1;
}
html[data-fs="large"]  { --yp-fs: 1.15; }   /* 大きめ：本文17px → 約20px */
html[data-fs="xlarge"] { --yp-fs: 1.32; }   /* 特大　：本文17px → 約22px */

*{ box-sizing:border-box; margin:0; padding:0; -webkit-tap-highlight-color:transparent; }

html,body{ overflow:hidden; height:100%; width:100%; }
body{
  font-family:'Hiragino Sans','Noto Sans JP',sans-serif;
  background:var(--yp-bg);
  color:var(--yp-ink);
  font-size:calc(17px * var(--yp-fs));
  line-height:1.8;
  overscroll-behavior:none;
}

/* ── アプリ外枠（WaLifeと同じ 430px 中央寄せ）── */
.app{
  position:fixed; top:0; left:50%; transform:translateX(-50%);
  width:430px; max-width:100vw; height:100dvh;
  overflow:hidden; background:var(--yp-bg);
  padding-top:env(safe-area-inset-top,0px);
  -webkit-tap-highlight-color:rgba(0,0,0,0.1);
  touch-action:manipulation;
}

/* ── 画面 ── */
.screen{
  display:none !important; position:absolute; top:0; left:0;
  flex-direction:column; width:100%; height:100%;
  overflow-y:auto; overflow-x:hidden; -webkit-overflow-scrolling:touch;
  overscroll-behavior:none;
}
.screen.active{ display:flex !important; z-index:1; }
/* チャット画面だけは内部でスクロールを持つため、画面自体はスクロールさせない */
#screen-chat{ overflow:hidden; }

/* 押下フィードバック */
button:active,.menu-item:active,.card:active{ opacity:.75; transform:scale(.98); transition:opacity .1s,transform .1s; }

/* フォーカスリング（キーボード操作の可視化）*/
:focus-visible{ outline:3px solid var(--yp-primary); outline-offset:2px; }

/* ==========================================================================
   ローディング
   ========================================================================== */
.loading-wrap{
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  height:100%; gap:18px;
}
.loading-logo{ width:96px; height:96px; border-radius:24px; }
.loading-text{ font-size:calc(17px * var(--yp-fs)); color:var(--yp-ink-sub); }

/* ==========================================================================
   認証
   ========================================================================== */
.auth-wrap{
  padding:calc(28px + env(safe-area-inset-top,0px)) 24px 32px;
  display:flex; flex-direction:column; align-items:center;
  min-height:100dvh; justify-content:center;
}
.auth-logo{ width:88px; height:88px; border-radius:22px; margin-bottom:14px; }
.auth-title{ font-size:calc(27px * var(--yp-fs)); font-weight:800; color:var(--yp-ink); margin-bottom:4px; }
.auth-sub{ font-size:calc(16px * var(--yp-fs)); color:var(--yp-ink-sub); text-align:center; line-height:1.8; margin-bottom:22px; }
.auth-tabs{ display:flex; background:var(--yp-surface-sub); border-radius:14px; padding:4px; margin-bottom:20px; width:100%; }
.auth-tab{
  flex:1; min-height:var(--yp-tap); border-radius:11px; border:none; background:transparent;
  font-size:calc(16px * var(--yp-fs)); font-weight:700; color:var(--yp-ink-sub); cursor:pointer; font-family:inherit;
}
.auth-tab.active{ background:var(--yp-surface); color:var(--yp-ink); box-shadow:0 1px 4px rgba(0,0,0,.12); }
.auth-label{ font-size:calc(16px * var(--yp-fs)); font-weight:700; color:var(--yp-ink); margin-bottom:6px; width:100%; }
.auth-input{
  width:100%; border:1.5px solid var(--yp-border-ui); border-radius:12px;
  padding:14px 16px; font-size:calc(18px * var(--yp-fs)); font-family:inherit; outline:none;
  background:var(--yp-surface); margin-bottom:10px; min-height:var(--yp-tap); color:var(--yp-ink);
}
.auth-input:focus{ border-color:var(--yp-primary); border-width:2px; }
.auth-btn{
  width:100%; min-height:56px; padding:16px; border-radius:14px; border:none;
  background:linear-gradient(135deg,var(--yp-primary-dk),var(--yp-primary));
  color:#fff; font-size:calc(18px * var(--yp-fs)); font-weight:800; font-family:inherit; cursor:pointer; margin-top:6px;
}
.auth-btn:disabled{ background:#9AB3B1; }
.auth-err{ font-size:calc(16px * var(--yp-fs)); color:var(--yp-danger); min-height:20px; text-align:center; margin:8px 0; font-weight:700; }
.auth-links{ margin-top:20px; font-size:calc(15px * var(--yp-fs)); color:var(--yp-ink-sub); text-align:center; line-height:2; }
.auth-links a{ color:var(--yp-primary); font-weight:700; }

/* ==========================================================================
   チャット画面（起点）
   ========================================================================== */
.chat-header{
  display:flex; align-items:center; gap:10px;
  padding:8px 12px; padding-top:max(8px,env(safe-area-inset-top,8px));
  background:var(--yp-surface); border-bottom:1px solid var(--yp-border);
  flex-shrink:0; z-index:10;
}
.chat-header-logo{ width:36px; height:36px; border-radius:10px; flex-shrink:0; }
.chat-header-title{ font-size:calc(19px * var(--yp-fs)); font-weight:800; color:var(--yp-ink); flex:1; line-height:1.3; }
.chat-header-title small{ display:block; font-size:calc(12px * var(--yp-fs)); font-weight:600; color:var(--yp-ink-sub); }
.icon-btn{
  min-width:var(--yp-tap); min-height:var(--yp-tap); border-radius:12px;
  border:1.5px solid var(--yp-border); background:var(--yp-surface);
  font-size:calc(22px * var(--yp-fs)); cursor:pointer; display:flex; align-items:center; justify-content:center;
  flex-shrink:0; color:var(--yp-ink); font-family:inherit;
}
.icon-btn.plain{ border-color:transparent; }

/* 代理モードバー（色だけに頼らず アイコン＋文字＋色 の3重表示）*/
.proxy-bar{
  display:none; align-items:center; gap:8px;
  background:var(--yp-proxy); color:#fff;
  padding:10px 12px; font-size:calc(16px * var(--yp-fs)); font-weight:800; flex-shrink:0;
}
.proxy-bar.show{ display:flex; }
.proxy-bar .proxy-ico{ font-size:calc(20px * var(--yp-fs)); flex-shrink:0; }
.proxy-bar .proxy-text{ flex:1; line-height:1.4; }
.proxy-bar button{
  min-height:36px; padding:6px 12px; border-radius:10px; border:1.5px solid #fff;
  background:transparent; color:#fff; font-size:calc(14px * var(--yp-fs)); font-weight:800; font-family:inherit; cursor:pointer;
}
/* 代理中はユーザーバブルもアンバー系にして本人モードと取り違えないようにする */
.app.is-proxy .bubble-user{ background:linear-gradient(135deg,var(--yp-proxy-dk),var(--yp-proxy)); }
.app.is-proxy .chat-send{ background:linear-gradient(135deg,var(--yp-proxy-dk),var(--yp-proxy)); }

.chat-area{
  flex:1; padding:14px 16px; display:flex; flex-direction:column; gap:12px;
  overflow-y:auto; -webkit-overflow-scrolling:touch; min-height:0;
}
.bubble-ai{
  align-self:flex-start; max-width:88%;
  background:var(--yp-mint); border:1px solid var(--yp-border);
  border-radius:4px 18px 18px 18px; padding:14px 16px;
  font-size:calc(17px * var(--yp-fs)); color:var(--yp-ink); line-height:1.9; white-space:pre-wrap;
}
.bubble-user{
  align-self:flex-end; max-width:88%;
  background:linear-gradient(135deg,var(--yp-primary-dk),var(--yp-primary));
  border-radius:18px 4px 18px 18px; padding:14px 16px;
  font-size:calc(17px * var(--yp-fs)); color:#fff; line-height:1.9; white-space:pre-wrap;
}
.bubble-typing{
  align-self:flex-start; background:var(--yp-mint); border:1px solid var(--yp-border);
  border-radius:4px 18px 18px 18px; padding:16px 22px;
  font-size:calc(22px * var(--yp-fs)); color:var(--yp-ink-sub); letter-spacing:4px;
}
.ai-name{ font-size:calc(13px * var(--yp-fs)); color:var(--yp-ink-sub); margin-bottom:5px; font-weight:700; }
.recorded-tag{
  align-self:flex-end; font-size:calc(14px * var(--yp-fs)); color:var(--yp-success);
  background:#E6F5EE; border:1px solid #B6DEC9; padding:6px 14px; border-radius:12px; font-weight:700;
}
.warn-tag{
  align-self:stretch; font-size:calc(15px * var(--yp-fs)); color:var(--yp-danger);
  background:#FDECEB; border:1px solid #F0BDBA; padding:10px 14px; border-radius:12px;
  font-weight:700; line-height:1.7;
}
.ai-source-note{
  align-self:flex-start; max-width:92%; font-size:calc(13px * var(--yp-fs)); color:var(--yp-ink-sub);
  background:var(--yp-surface); border:1px dashed var(--yp-border);
  border-radius:12px; padding:10px 12px; line-height:1.7;
}
.ai-source-note a{ color:var(--yp-primary); font-weight:700; }

/* 会話内アクションボタン（📝伝えるメモ / 📈グラフ など）*/
.chat-actions-inline{ align-self:flex-start; display:flex; gap:8px; flex-wrap:wrap; max-width:92%; }
.inline-action{
  min-height:var(--yp-tap); padding:10px 16px; border-radius:24px;
  border:2px solid var(--yp-primary); background:var(--yp-surface);
  font-size:calc(16px * var(--yp-fs)); font-weight:800; color:var(--yp-primary);
  cursor:pointer; font-family:inherit; display:inline-flex; align-items:center; gap:6px;
}
.inline-action:active{ background:var(--yp-surface-sub); }

/* 回答候補ボタン */
.choice-wrap{ align-self:flex-start; display:flex; flex-direction:column; gap:8px; max-width:92%; width:100%; }
.choice-btn{
  min-height:var(--yp-tap); padding:12px 16px; border-radius:14px;
  border:1.5px solid var(--yp-border-ui); background:var(--yp-surface);
  font-size:calc(17px * var(--yp-fs)); color:var(--yp-ink); cursor:pointer; font-family:inherit;
  text-align:left; line-height:1.6;
}
.choice-btn:active{ background:var(--yp-surface-sub); border-color:var(--yp-primary); }

/* クイックボタン行 */
.chat-quick{ padding:8px 16px 4px; display:flex; gap:8px; flex-wrap:wrap; flex-shrink:0; }
.quick-btn{
  min-height:44px; padding:9px 15px; border-radius:18px;
  border:1.5px solid var(--yp-primary); background:var(--yp-surface);
  font-size:calc(16px * var(--yp-fs)); color:var(--yp-primary); cursor:pointer; font-family:inherit; font-weight:700;
}

/* 入力行 */
.chat-input-row{
  display:flex; gap:8px; padding:8px 10px;
  padding-bottom:calc(8px + env(safe-area-inset-bottom,0px));
  background:var(--yp-surface); border-top:1px solid var(--yp-border);
  flex-shrink:0; align-items:center;
}
.chat-input{
  flex:1; border:1.5px solid var(--yp-border-ui); border-radius:24px;
  padding:13px 16px; font-size:calc(18px * var(--yp-fs)); font-family:inherit; outline:none;
  background:var(--yp-surface); color:var(--yp-ink); min-height:var(--yp-tap);
  resize:none; max-height:120px; line-height:1.5;
}
.chat-input:focus{ border-color:var(--yp-primary); border-width:2px; }
.chat-send{
  width:52px; height:52px; border-radius:50%; border:none;
  background:linear-gradient(135deg,var(--yp-primary-dk),var(--yp-primary));
  color:#fff; font-size:calc(22px * var(--yp-fs)); cursor:pointer; flex-shrink:0;
}
.chat-send:disabled{ background:#9AB3B1; }
.mic-main{
  width:56px; height:56px; border-radius:50%; border:none;
  background:linear-gradient(135deg,#1A6E46,#26925E); color:#fff;
  font-size:calc(26px * var(--yp-fs)); cursor:pointer; flex-shrink:0;
  display:flex; align-items:center; justify-content:center;
  box-shadow:0 4px 12px rgba(26,110,70,.35); transition:transform .12s ease;
}
.mic-main:active{ transform:scale(.93); }
.mic-main.mic-recording{
  background:linear-gradient(135deg,#A32621,var(--yp-danger));
  box-shadow:0 4px 12px rgba(196,54,47,.45); animation:micPulse 1.15s ease-in-out infinite;
}
@keyframes micPulse{
  0%{ box-shadow:0 0 0 0 rgba(196,54,47,.5),0 4px 12px rgba(196,54,47,.45); }
  70%{ box-shadow:0 0 0 16px rgba(196,54,47,0),0 4px 12px rgba(196,54,47,.45); }
  100%{ box-shadow:0 0 0 0 rgba(196,54,47,0),0 4px 12px rgba(196,54,47,.45); }
}
/* ── ヘルスケア連携カード（記録＞健康タブの先頭。ネイティブのみ） ───────── */
.health-card{
  margin:16px 16px 0; padding:16px; background:var(--yp-surface);
  border:1px solid var(--yp-border); border-radius:14px;
}
.health-card-title{ font-size:calc(17px * var(--yp-fs)); font-weight:800; color:var(--yp-ink); margin-bottom:12px; }
.health-row{ display:flex; flex-wrap:wrap; gap:10px; }
.health-item{
  flex:1 1 0; min-width:84px; text-align:center;
  background:var(--yp-surface-sub); border-radius:12px; padding:12px 6px;
}
.health-val{ font-size:calc(24px * var(--yp-fs)); font-weight:900; color:var(--yp-primary); line-height:1.1; letter-spacing:-.01em; }
.health-unit{ font-size:calc(14px * var(--yp-fs)); font-weight:800; margin-left:2px; }
.health-lbl{ margin-top:5px; font-size:calc(14px * var(--yp-fs)); font-weight:700; color:var(--yp-ink-sub); }
.health-refresh{ width:100%; margin-top:12px; }

/* ── 服薬リマインド（チャット上部に出るカード） ───────────────────────── */
.medrem{
  margin:0 12px 8px; padding:14px 16px; background:var(--yp-warn-bg);
  border:1px solid #E5C58A; border-left:5px solid var(--yp-proxy);
  border-radius:12px;
}
.medrem-head{ font-size:calc(17px * var(--yp-fs)); font-weight:800; color:var(--yp-ink); line-height:1.6; }
.medrem-names{ margin-top:4px; font-size:calc(15px * var(--yp-fs)); color:var(--yp-ink-sub); line-height:1.7; }
.medrem-actions{ display:flex; gap:10px; margin-top:12px; }
.medrem-actions .btn{ flex:1; min-height:48px; }

/* ── 設定：おくすりの予定 ─────────────────────────────────────────── */
.medplan-item{
  display:flex; align-items:center; gap:10px;
  padding:12px 0; border-bottom:1px solid var(--yp-border);
}
.medplan-item:last-child{ border-bottom:none; }
.medplan-item-main{ flex:1; min-width:0; }
.medplan-name{ font-size:calc(17px * var(--yp-fs)); font-weight:700; color:var(--yp-ink); }
.medplan-slots{ margin-top:3px; font-size:calc(15px * var(--yp-fs)); color:var(--yp-ink-sub); }
.medplan-none{ color:var(--yp-danger); }
.medplan-edit{ flex:none; min-height:44px; padding:0 16px; }
.mp-slot{ display:flex; align-items:center; gap:12px; margin-bottom:10px; }
.mp-check{
  display:flex; align-items:center; gap:8px; min-width:78px;
  font-size:calc(17px * var(--yp-fs)); font-weight:700; color:var(--yp-ink); cursor:pointer;
}
.mp-check input{ width:24px; height:24px; accent-color:var(--yp-primary); }
.mp-time{ flex:1; margin:0; }

.mic-hint{
  margin:0 12px 6px; padding:9px 14px; background:#FDECEB; border:1px solid #F0BDBA;
  border-radius:12px; font-size:calc(15px * var(--yp-fs)); font-weight:700; color:var(--yp-danger);
  text-align:center; display:none; align-items:center; justify-content:center; gap:6px;
}
.mic-hint.show{ display:flex; }
.mic-hint-dot{ width:9px; height:9px; border-radius:50%; background:var(--yp-danger); animation:micDot 1.15s ease-in-out infinite; }
@keyframes micDot{ 0%,100%{opacity:1;} 50%{opacity:.25;} }
@media (prefers-reduced-motion:reduce){
  .mic-main.mic-recording{ animation:none; }
  .mic-hint-dot{ animation:none; }
  .drawer,.drawer-panel{ transition:none !important; }
}

/* ==========================================================================
   ☰ ドロワー
   ========================================================================== */
.drawer{
  position:absolute; inset:0; z-index:60; display:none;
  background:rgba(23,73,78,.45);
}
.drawer.show{ display:block; }
.drawer-panel{
  position:absolute; top:0; right:0; width:84%; max-width:340px; height:100%;
  background:var(--yp-surface); box-shadow:-4px 0 24px rgba(0,0,0,.2);
  display:flex; flex-direction:column; overflow-y:auto;
  padding-top:env(safe-area-inset-top,0px);
  transform:translateX(100%); transition:transform .22s ease;
}
.drawer.show .drawer-panel{ transform:translateX(0); }
.drawer-head{
  display:flex; align-items:center; gap:10px; padding:14px 16px;
  border-bottom:1px solid var(--yp-border); flex-shrink:0;
}
.drawer-head-name{ flex:1; font-size:calc(17px * var(--yp-fs)); font-weight:800; color:var(--yp-ink); line-height:1.4; }
.drawer-head-name small{ display:block; font-size:calc(13px * var(--yp-fs)); font-weight:600; color:var(--yp-ink-sub); }
.menu-section{ padding:10px 0 4px; }
.menu-section-title{
  font-size:calc(13px * var(--yp-fs)); font-weight:800; color:var(--yp-ink-sub);
  padding:8px 18px 4px; letter-spacing:.04em;
}
.menu-item{
  display:flex; align-items:center; gap:14px; width:100%;
  min-height:56px; padding:12px 18px; border:none; background:transparent;
  font-size:calc(17px * var(--yp-fs)); font-weight:700; color:var(--yp-ink); font-family:inherit;
  cursor:pointer; text-align:left;
}
.menu-item:active{ background:var(--yp-surface-sub); }
.menu-item .menu-ico{ font-size:calc(22px * var(--yp-fs)); width:28px; text-align:center; flex-shrink:0; }
.menu-item.primary{ background:var(--yp-mint); }
.menu-item.danger{ color:var(--yp-danger); }
.menu-divider{ height:1px; background:var(--yp-border); margin:8px 0; }

/* ==========================================================================
   サブ画面 共通
   ========================================================================== */
.topbar{
  display:flex; align-items:center; padding:10px 12px; gap:10px; flex-shrink:0;
  background:var(--yp-surface); border-bottom:1px solid var(--yp-border);
  position:sticky; top:0; z-index:10;
  padding-top:max(10px,env(safe-area-inset-top,10px));
}
.topbar-title{ font-size:calc(19px * var(--yp-fs)); font-weight:800; color:var(--yp-ink); flex:1; }
.screen-body{ flex:1; overflow-y:auto; padding:16px 0 calc(32px + env(safe-area-inset-bottom,0px)); }

.card{
  margin:0 16px 14px; background:var(--yp-surface); border-radius:var(--yp-radius);
  padding:18px; border:1px solid var(--yp-border);
}
.card-title{ font-size:calc(17px * var(--yp-fs)); font-weight:800; color:var(--yp-ink); margin-bottom:12px; }
.empty-note{ padding:36px 24px; text-align:center; color:var(--yp-ink-sub); font-size:calc(17px * var(--yp-fs)); line-height:1.9; }

.btn{
  min-height:52px; padding:14px 18px; border-radius:14px; border:none;
  background:linear-gradient(135deg,var(--yp-primary-dk),var(--yp-primary));
  color:#fff; font-size:calc(17px * var(--yp-fs)); font-weight:800; font-family:inherit; cursor:pointer;
}
.btn.wide{ width:100%; }
.btn.sub{
  background:var(--yp-surface); color:var(--yp-primary);
  border:2px solid var(--yp-primary);
}
.btn.danger{ background:var(--yp-danger); }
.btn:disabled{ background:#9AB3B1; }

.field-label{ font-size:calc(16px * var(--yp-fs)); font-weight:700; color:var(--yp-ink); margin-bottom:6px; display:block; }
.field-input,.field-select,.field-textarea{
  width:100%; border:1.5px solid var(--yp-border-ui); border-radius:12px;
  padding:13px 15px; font-size:calc(17px * var(--yp-fs)); font-family:inherit; outline:none;
  background:var(--yp-surface); color:var(--yp-ink); min-height:var(--yp-tap); margin-bottom:14px;
}
.field-textarea{ min-height:96px; resize:vertical; line-height:1.7; }
.field-input:focus,.field-select:focus,.field-textarea:focus{ border-color:var(--yp-primary); border-width:2px; }
.field-hint{ font-size:calc(14px * var(--yp-fs)); color:var(--yp-ink-sub); margin:-8px 0 14px; line-height:1.6; }

/* タブ */
/* ★はみ出すくらいなら折り返す。横スクロールにすると、画面外に出たタブは
   高齢の利用者に見つけてもらえない（実測：標準サイズで「📷 写真」が8px切れた）。
   flex-wrap:wrap なので、文字を大きくすると2段になるだけで必ず全部見える。 */
.tabs{ display:flex; flex-wrap:wrap; gap:6px; padding:12px 16px 4px; flex-shrink:0; }
/* 「記録を見る」のタブは5つ並ぶ（体調/健康/症状/服薬/写真）。
   小さめでは1段に収まり、標準・大きめでは2段に折り返す。 */
#screen-records .tabs{ gap:6px; padding:12px 12px 4px; }
#screen-records .tab-btn{ padding:10px 12px; }
.tab-btn{
  min-height:var(--yp-tap); padding:10px 16px; border-radius:12px;
  border:1.5px solid var(--yp-border-ui); background:var(--yp-surface);
  font-size:calc(16px * var(--yp-fs)); font-weight:700; color:var(--yp-ink-sub); cursor:pointer; font-family:inherit;
  /* ★nowrap にしない。.tab-btn は設定の選択肢（「🔊 いつも読み上げる」等）にも
     使い回しており、nowrap だと長い文言が箱から飛び出す（実測：小さめでも169px>166px）。
     文字を大きくしたら折り返して背が伸びるほうが正しい。 */
  white-space:normal; overflow-wrap:anywhere;
}
/* 「記録を見る」のタブだけは1行に保つ（「💬 体調」が2行に割れると読みにくい）。
   タブ自体は .tabs の flex-wrap で段落ちするので、はみ出しは起きない。 */
.tabs .tab-btn{ white-space:nowrap; }
.tab-btn.active{ background:var(--yp-primary); color:#fff; border-color:var(--yp-primary); }

/* リスト項目 */
.list-item{
  margin:0 16px 10px; background:var(--yp-surface); border:1px solid var(--yp-border);
  border-radius:14px; padding:14px 16px;
}
/* ★折り返せるようにする。日付＋バッジ（🏥 診察で見せる 等）を横に並べると
   文字を大きくしたとき箱から出るので、入りきらなければ段落ちさせる。 */
.list-item-head{ display:flex; flex-wrap:wrap; align-items:center; gap:8px; margin-bottom:6px; }
.list-item-date{ font-size:calc(16px * var(--yp-fs)); font-weight:800; color:var(--yp-ink); }
.list-item-time{ font-size:calc(14px * var(--yp-fs)); color:var(--yp-ink-sub); }
.list-item-body{ font-size:calc(16px * var(--yp-fs)); color:var(--yp-ink); line-height:1.8; }

/* ==========================================================================
   NRS（症状の数値記録）パネル
   ========================================================================== */
.nrs-panel{
  align-self:flex-start; max-width:96%; width:100%;
  background:var(--yp-surface); border:2px solid var(--yp-primary);
  border-radius:var(--yp-radius); padding:16px; margin:4px 0 14px;
}
.nrs-q{ font-size:calc(18px * var(--yp-fs)); font-weight:800; color:var(--yp-ink); line-height:1.6; margin-bottom:14px; }
.nrs-grid{ display:grid; grid-template-columns:repeat(4,1fr); gap:8px; }
.nrs-btn{
  min-height:56px; border-radius:12px; border:1.5px solid var(--yp-border-ui);
  background:var(--yp-surface); font-size:calc(20px * var(--yp-fs)); font-weight:800; color:var(--yp-ink);
  cursor:pointer; font-family:inherit;
}
.nrs-btn:active{ background:var(--yp-primary); color:#fff; border-color:var(--yp-primary); }
.nrs-skip{
  grid-column:span 4; min-height:var(--yp-tap); margin-top:4px;
  border-radius:12px; border:1.5px solid var(--yp-border-ui); background:var(--yp-surface-sub);
  font-size:calc(16px * var(--yp-fs)); font-weight:700; color:var(--yp-ink-sub); cursor:pointer; font-family:inherit;
}
.nrs-anchor{ font-size:calc(14px * var(--yp-fs)); color:var(--yp-ink-sub); margin-top:10px; line-height:1.6; }
.nrs-done{
  align-self:flex-start; max-width:96%; background:var(--yp-mint);
  border:1px solid var(--yp-border); border-radius:14px; padding:14px 16px;
  font-size:calc(16px * var(--yp-fs)); color:var(--yp-ink); line-height:1.8;
}
.nrs-undo{
  min-height:44px; margin-top:8px; padding:8px 14px; border-radius:10px;
  border:1.5px solid var(--yp-border-ui); background:var(--yp-surface);
  font-size:calc(15px * var(--yp-fs)); font-weight:700; color:var(--yp-ink-sub); cursor:pointer; font-family:inherit;
}

/* グラフ */
.chart-wrap{ margin:0 16px 14px; background:var(--yp-surface); border:1px solid var(--yp-border); border-radius:var(--yp-radius); padding:14px; }
.chart-range{ display:flex; gap:8px; margin-bottom:12px; }
.chart-range button{
  flex:1; min-height:var(--yp-tap); border-radius:12px; font-family:inherit;
  font-size:calc(16px * var(--yp-fs)); font-weight:700; cursor:pointer;
}
.chart-legend{ display:flex; flex-wrap:wrap; gap:8px; margin-top:12px; }
.legend-item{
  display:inline-flex; align-items:center; gap:6px; min-height:44px; padding:6px 12px;
  border-radius:12px; border:1.5px solid var(--yp-border); background:var(--yp-surface);
  font-size:calc(15px * var(--yp-fs)); font-weight:700; color:var(--yp-ink); cursor:pointer; font-family:inherit;
}
.legend-item.off{ opacity:.4; text-decoration:line-through; }

/* ==========================================================================
   モーダル
   ========================================================================== */
.modal{
  position:absolute; inset:0; z-index:70; display:none;
  align-items:flex-end; justify-content:center; background:rgba(23,73,78,.45);
}
.modal.show{ display:flex; }
.modal-panel{
  width:100%; max-height:92%; background:var(--yp-bg);
  border-radius:22px 22px 0 0; display:flex; flex-direction:column; overflow:hidden;
}
.modal-head{
  display:flex; align-items:center; gap:10px; padding:16px;
  background:var(--yp-surface); border-bottom:1px solid var(--yp-border); flex-shrink:0;
}
.modal-title{ flex:1; font-size:calc(19px * var(--yp-fs)); font-weight:800; color:var(--yp-ink); }
.modal-body{ flex:1; overflow-y:auto; padding:16px; }
.modal-foot{
  padding:12px 16px calc(12px + env(safe-area-inset-bottom,0px));
  background:var(--yp-surface); border-top:1px solid var(--yp-border); flex-shrink:0;
  display:flex; gap:10px;
}

/* 伝えるメモ カード */
.cm-card{
  background:var(--yp-surface); border-radius:14px; padding:16px 18px; margin-bottom:12px;
  border:1px solid var(--yp-border); border-left:5px solid var(--yp-primary);
}
.cm-card-title{ font-size:calc(17px * var(--yp-fs)); font-weight:800; color:var(--yp-primary); margin-bottom:8px; }
.cm-card-body{ font-size:calc(17px * var(--yp-fs)); color:var(--yp-ink); line-height:1.9; white-space:pre-wrap; }
.cm-card-body ul{ padding-left:22px; }
.cm-card-body li{ margin-bottom:6px; }
.cm-disclaimer{
  font-size:calc(14px * var(--yp-fs)); color:var(--yp-ink-sub); background:var(--yp-warn-bg);
  border:1px solid #E8D6B4; border-radius:12px; padding:12px 14px; line-height:1.8; margin-top:8px;
}

/* ==========================================================================
   症状写真（📷 写真タブ／伝えるメモの「診察で見せる写真」）
   ※ .visit-photo-block は共有テキストから除去される目印（.nrs-memo-chart と同じ扱い）
   ========================================================================== */
.visit-photo-img{
  display:block; width:100%; max-height:280px; object-fit:contain;
  border-radius:12px; border:1px solid var(--yp-border); background:var(--yp-surface-sub);
}
/* 「診察で見せる」印は色だけで示さない（アイコン＋文字を必ず併記＝CUD配慮） */
.visit-badge{
  font-size:calc(13px * var(--yp-fs)); font-weight:800; color:#fff;
  background:var(--yp-primary); border-radius:8px; padding:3px 9px; white-space:nowrap;
}
.visit-photo-grid{ display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.visit-photo-item{ margin:0; }
.visit-photo-item .visit-photo-img{ max-height:190px; }
.visit-photo-cap{
  font-size:calc(13px * var(--yp-fs)); color:var(--yp-ink-sub);
  text-align:center; margin-top:4px; line-height:1.5;
}

/* ==========================================================================
   オーバーレイ / バナー
   ========================================================================== */
.overlay{
  position:absolute; inset:0; z-index:90; display:none;
  flex-direction:column; align-items:center; justify-content:center; gap:14px;
  background:rgba(242,251,250,.94);
}
.overlay.show{ display:flex; }
.overlay-icon{ font-size:calc(44px * var(--yp-fs)); }
.overlay-text{ font-size:calc(18px * var(--yp-fs)); font-weight:700; color:var(--yp-ink); text-align:center; padding:0 32px; line-height:1.8; }

.banner{
  position:absolute; left:50%; transform:translateX(-50%);
  top:calc(12px + env(safe-area-inset-top,0px)); z-index:100;
  max-width:92%; padding:14px 18px; border-radius:14px;
  font-size:calc(16px * var(--yp-fs)); font-weight:700; color:#fff; line-height:1.6;
  box-shadow:0 6px 20px rgba(0,0,0,.22); display:none;
}
.banner.show{ display:block; }

/* ==========================================================================
   カレンダー（予定）
   ========================================================================== */
.cal-head{ display:flex; align-items:center; justify-content:space-between; margin:0 16px 10px; }
.cal-month{ font-size:calc(19px * var(--yp-fs)); font-weight:800; color:var(--yp-ink); }
.cal-nav{ min-width:44px; min-height:44px; border-radius:12px; border:1.5px solid var(--yp-border); background:var(--yp-surface); font-size:calc(18px * var(--yp-fs)); cursor:pointer; color:var(--yp-ink); }
.cal-grid{ margin:0 16px 14px; display:grid; grid-template-columns:repeat(7,1fr); gap:3px; }
.cal-dow{ text-align:center; font-size:calc(13px * var(--yp-fs)); font-weight:700; color:var(--yp-ink-sub); padding:4px 0; }
.cal-cell{
  min-height:48px; border-radius:10px; border:1px solid var(--yp-border);
  background:var(--yp-surface); font-size:calc(15px * var(--yp-fs)); font-family:inherit; color:var(--yp-ink);
  cursor:pointer; display:flex; flex-direction:column; align-items:center; justify-content:flex-start;
  padding:4px 2px; gap:2px;
}
.cal-cell.blank{ border:none; background:transparent; cursor:default; }
.cal-cell.today{ border:2px solid var(--yp-primary); font-weight:800; }
.cal-cell.selected{ background:var(--yp-primary); color:#fff; border-color:var(--yp-primary); }
.cal-dots{ display:flex; gap:2px; flex-wrap:wrap; justify-content:center; }
.cal-dot{ width:6px; height:6px; border-radius:50%; }

/* ==========================================================================
   同意モーダル
   ========================================================================== */
.consent-body{ font-size:calc(16px * var(--yp-fs)); color:var(--yp-ink); line-height:1.9; }
.consent-body h3{ font-size:calc(17px * var(--yp-fs)); margin:14px 0 6px; color:var(--yp-ink); }
.consent-body ul{ padding-left:22px; margin:6px 0; }
.consent-body li{ margin-bottom:6px; }
/* AIに送る情報（2段階目の同意画面・設定・チャット欄の案内。20261009-B） */
.modal.over{ z-index:75; }   /* 基本の説明の全文を、2段階目の画面の上に重ねて開く */
.modal-foot.col{ flex-direction:column; }
#modal-consent .modal-foot .btn{ padding-left:8px; padding-right:8px; white-space:nowrap; }   /* 「同意して次へ」を2行に割らない（大きめの文字・幅360pxでも収まる） */
.consent-body p{ margin:8px 0; }
.consent-ol{ padding-left:22px; margin:6px 0; }
.consent-ol li{ margin-bottom:8px; }
.consent-box{ background:var(--yp-surface); border:1px solid var(--yp-border); border-radius:14px; padding:12px 14px; margin:10px 0; }
.consent-small{ font-size:calc(14px * var(--yp-fs)); color:var(--yp-ink-sub, #555); }
.consent-later-link{ width:100%; padding:10px; border:none; background:none; color:var(--yp-ink-sub, #666);
  font-size:calc(15px * var(--yp-fs)); font-family:inherit; text-decoration:underline; cursor:pointer; }
.chat-attach-hint{ padding:6px 16px; font-size:calc(13px * var(--yp-fs)); color:var(--yp-ink-sub, #555);
  background:var(--yp-surface); border-bottom:1px solid var(--yp-border); cursor:pointer; }

/* ==========================================================================
   ユーティリティ
   ========================================================================== */
.hidden{ display:none !important; }
.sr-only{
  position:absolute; width:1px; height:1px; padding:0; margin:-1px;
  overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0;
}
.row{ display:flex; gap:10px; align-items:center; }
.row.wrap{ flex-wrap:wrap; }
.grow{ flex:1; }
.mt8{ margin-top:8px; } .mt16{ margin-top:16px; }
.mb8{ margin-bottom:8px; } .mb16{ margin-bottom:16px; }
.text-sub{ color:var(--yp-ink-sub); font-size:calc(15px * var(--yp-fs)); line-height:1.8; }

/* チャットの 📷（写真を送る・読み取り）と、記録を見るの書類タブ（20261009-D） */
.chat-photo-btn{ flex-shrink:0; width:48px; height:48px; border-radius:50%; border:2px solid var(--yp-primary); background:var(--yp-surface);
  font-size:calc(20px * var(--yp-fs)); cursor:pointer; padding:0; }
.chat-pending-image{ display:flex; align-items:center; gap:10px; padding:8px 16px; background:var(--yp-surface); border-top:1px solid var(--yp-border); }
.chat-pending-image.hidden{ display:none !important; }
.chat-pending-image img{ width:48px; height:48px; border-radius:8px; object-fit:cover; flex-shrink:0; }
.chat-pending-image span{ flex:1; font-size:calc(14px * var(--yp-fs)); color:var(--yp-ink-sub); }
.chat-pending-image button{ border:none; background:none; font-size:calc(20px * var(--yp-fs)); cursor:pointer; color:var(--yp-ink-sub); padding:4px 8px; }
/* 名前の下に説明を置く（文字を大きくしても名前が1〜2文字ずつ折り返さないように） */
.chat-photo-opt{ display:grid; grid-template-columns:auto 1fr; column-gap:12px; row-gap:2px; align-items:center; width:100%; padding:14px 16px; margin-bottom:8px; border-radius:12px;
  border:1.5px solid var(--yp-border); background:var(--yp-surface); font-family:inherit; cursor:pointer; text-align:left; }
.chat-photo-opt .ico{ grid-row:1 / span 2; font-size:calc(22px * var(--yp-fs)); }
.chat-photo-opt .lbl{ font-weight:700; font-size:calc(17px * var(--yp-fs)); color:var(--yp-ink); }
.chat-photo-opt .sub{ font-size:calc(13px * var(--yp-fs)); color:var(--yp-ink-sub); }
.chat-photo-note{ font-size:calc(14px * var(--yp-fs)); }
/* 「何を撮りますか？」は、開いた直後に送信の1文と4つの選択が見えるよう、画面の高さいっぱいまで使い、余白を詰める（20261009-D）。
   文字の大きさ（--yp-fs）は変えない。 */
#chat-photo-chooser .modal-panel{ max-height:calc(100% - 8px); }
#chat-photo-chooser .modal-head{ padding:10px 16px; }
#chat-photo-chooser .modal-body{ padding:10px 12px; }
#chat-photo-chooser .modal-foot{ padding:8px 12px calc(8px + env(safe-area-inset-bottom,0px)); }
#chat-photo-chooser .chat-photo-note{ margin:0 0 8px; padding:8px 12px; line-height:1.55; }
#chat-photo-chooser .chat-photo-opt{ padding:8px 12px; margin-bottom:6px; row-gap:0; }
#chat-photo-chooser .chat-photo-opt .lbl,
#chat-photo-chooser .chat-photo-opt .sub{ line-height:1.35; }
.chat-photo-user{ align-self:flex-end; margin:4px 0; }
.chat-photo-user img{ max-width:180px; border-radius:12px; display:block; }
.doc-card .doc-thumb{ width:100%; max-height:200px; object-fit:contain; border-radius:10px; border:1px solid var(--yp-border); margin-bottom:8px; }
.doc-card .doc-text{ font-size:calc(15px * var(--yp-fs)); color:var(--yp-ink); line-height:1.7; max-height:12em; overflow-y:auto; overflow-wrap:anywhere; }

/* お知らせの枠（流れの中に置く。20261105-A） */
.yp-notice{ margin:8px 12px 4px; padding:10px 12px; background:#FFFDF6; border:1.5px solid #F2D9A6; border-radius:14px;
  color:#333; font-size:calc(14px * var(--yp-fs)); line-height:1.6; max-height:calc(100vh - 320px); overflow-y:auto; flex-shrink:0; }
.yp-notice p{ margin:6px 0 0; }
.yp-notice-title{ font-weight:800; font-size:calc(15px * var(--yp-fs)); color:#2D2D2D; }
.yp-notice-links{ display:flex; flex-wrap:wrap; gap:4px 14px; margin-top:6px; }
.yp-notice-links a{ display:inline-block; min-height:44px; line-height:44px; }
.yp-notice-btn{ display:block; width:100%; min-height:48px; margin-top:8px; border:none; border-radius:10px; background:#0B7C7A; color:#fff;
  font-size:calc(16px * var(--yp-fs)); font-weight:700; font-family:inherit; cursor:pointer; }
.yp-notice-close{ display:block; width:100%; min-height:44px; margin-top:8px; border:1.5px solid #E3C88E; border-radius:10px; background:#fff;
  font-size:calc(15px * var(--yp-fs)); font-weight:700; font-family:inherit; color:#6B5420; cursor:pointer; }
