
/* === b9064: Ensure AI Analysis header sticks when embedded as a tab (no iframe) === */
#pane-analysis{
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
#pane-analysis header{
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--bar);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 4px 10px rgba(0,0,0,.25);
}

:root{ --topbar-h:104px; --upgradebar-h:0px; --trialbar-h:0px; }
:root{ --bg:#0a0a0a; --fg:#f2f2f2; --muted:#9ea0a4; --bar:#111; --border:#252525; --acc:#00ff00; color-scheme:dark; }
*{ box-sizing:border-box; } body{ margin:0; background:var(--bg); color:var(--fg); font-family: system-ui, -apple-system, Segoe UI, Roboto, 'Noto Sans JP', sans-serif; }
.topbar{ height:auto; z-index:1000;  flex-direction:column; align-items:stretch;  position:fixed; top:0; left:0; right:0; z-index:10; display:flex; align-items:center; gap:12px; background:var(--bar); border-bottom:1px solid var(--border); padding:8px 12px;  }
.brand{ font-size:24px;  font-weight:800; color:var(--fg); display:flex; align-items:center; gap:0; }
.tabs{ display:flex; flex:0 0 auto; justify-content:center; gap:24px; }
.tab{ word-spacing:0.25em; letter-spacing:0.02em;  appearance:none; border:1px solid var(--border); background:transparent; color:var(--fg); padding:10px 16px; border-radius:12px; cursor:pointer; }
.tab.active{ outline:2px solid var(--acc); }
.tab[disabled]{ opacity:.5; cursor:not-allowed; }
.btn.ghost{ appearance:none; border:1px solid var(--border); background:transparent; color:var(--fg); padding:8px 12px; border-radius:12px; cursor:pointer; }
.grow{ flex:1 1 auto; }

.viewport{ height: calc(100vh - var(--topbar-h) - var(--upgradebar-h) - var(--trialbar-h)); margin-top: var(--topbar-h); }
.pane{ display:none; height:100%; }
.pane.active{ display:block; }
.frame{ width:100%; height:100%; border:0; background:#0b0b0b; }
.placeholder{ padding:18px; color:var(--muted); }

.logo-aifit{ font-size:24px;  color:#fff !important; font-weight:800; }
.logo-log{ font-size:24px;  color:var(--acc) !important; font-weight:800; margin-left:2px; }

#signout{ /* removed auto margin to keep next to bell */ }

.toprow{ display:flex; align-items:center; gap: 6px; }

.subbar{ display:flex; justify-content:center; gap:24px; padding-top:6px; border-top:1px solid var(--border); }

/* enforce left logo / right signout on top row */
.toprow{ justify-content:flex-start; width:100%; }

#build-badge{position:fixed;right:6px;bottom:6px;opacity:.35;font-size:11px;padding:2px 6px;border:1px solid var(--border);border-radius:8px;background:#0f0f0f;color:#9ea0a4;z-index:9999;}

/* --- Match Body Logs button size for Workout Logs graph/toggle buttons --- */
#btnOpenGraph, #btnWlToggle{
  font-size:14px !important;
  padding:10px 14px !important;
  border-radius:14px !important;
  min-width: initial !important;
}

/* --- Enforce Body Logs button size exactly (including line-height & weight) --- */
#btnOpenGraph, #btnWlToggle{
  font-size:14px !important;
  
  
  padding:10px 14px !important;
  border-radius:14px !important;
  min-width: initial !important;
  height:auto !important;
}

/* --- Match Body Logs button size exactly (use UA-normal line-height) --- */
#btnOpenGraph, #btnWlToggle{
  font-size:14px !important;
  line-height: normal !important;
  padding:10px 14px !important;
  border-radius:14px !important;
  min-width: initial !important;
  height:auto !important;
}

/* Force register button to Body Logs accent */
#btnRegister.btn-accent, #btnRegister.btn-accent.btn{
  background: var(--accent, #00FF00) !important;
  color: var(--accent-ink, #001b00) !important;
  border-color: #026902 !important;
}

/* Align labels to Body Logs look */
.card .row > label,
.card label{
  color: var(--muted, #9ea0a4) !important;
  font-size:18px !important;
}

/* Match Clear buttons to Register button sizing */
#btnClear{
  padding:14px 12px !important;
  font-size:18px !important;
  border-radius:16px !important;
}

/* Ensure graph/toggle button text weight matches Body Logs */
#btnOpenGraph, #btnWlToggle{
  font-weight:400 !important;
}


/* unify help '?' style */
.btn.ghost.q{ background:#0f0f0f; color:var(--fg); border:1px solid var(--border); }


/* b9018: Make tabs match Body Logs active style & prevent blue selection */
.tab{ background:#0a0a0a; border:1px solid var(--border); user-select:none; text-decoration:none; color:inherit; }
.tab:focus{ outline:none; box-shadow:0 0 0 2px rgba(0,255,0,.25); }
.tab.active{ background:#0f0f0f; border-color:var(--acc); box-shadow:0 0 0 2px rgba(0,255,0,.35); color:#fff; outline:none; }
.tab *{ user-select:none; }


/* --- AI Analysis trial dot --- */
.tab{ position: relative; }
.tab-dot{
  position: absolute;
  top: 6px;
  right: 10px;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--acc);
  box-shadow: 0 0 0 2px rgba(0,255,0,.15);
  display: none;
}


/* === b9031 mobile iframe tweak === */
@media (max-width: 480px){
  .viewport, .pane, .frame{ width: 100%; max-width: 100%; overflow-x: hidden; }
  .tabs{ gap: 6px; }
}


/* ===== Patch 2025-11-03: header badge removal & right align ===== */
#build-badge, .build-badge, .badge-build { display: none !important; }
/* Top row layout: push controls to the right */
.topbar .toprow { display:flex; align-items:center; justify-content: flex-start; }
/* If an old spacer .grow exists, it isn't needed for right align */
.topbar .toprow .grow{ display:block; flex:1 1 auto; }

.plan-tier-badge{
  display:inline-flex;
  align-items:center;
  gap:6px;
  margin-left:10px;
  padding:5px 12px;
  border-radius:999px;
  font-size:13px;
  font-weight:900;
  letter-spacing:0.4px;
  background:linear-gradient(135deg, #2f220d 0%, #5b4518 35%, #c49b3f 62%, #7d5f22 100%) !important;
  color:#f7e9c3;
  border:1px solid rgba(215,176,86,.9);
  box-shadow:0 0 0 1px rgba(215,176,86,.45), 0 8px 20px rgba(0,0,0,.5), 0 0 10px rgba(215,176,86,.45);
  text-shadow:0 1px 0 rgba(0,0,0,.2);
  text-transform:capitalize;
}


/* ===== header bell button (通知・リマインダー) ===== */
.iconbtn.bell{display:inline-flex;align-items:center;justify-content:center;gap:6px;
  width:auto;min-width:44px;min-height:36px;padding:6px 10px;border-radius:999px;
  background:transparent;border:1px solid var(--border);color:var(--fg);cursor:pointer}
.iconbtn.bell:hover{background:rgba(255,255,255,.06)}
.iconbtn.bell .ico{display:block}
/* keep header layout */
.topbar .toprow{display:flex;align-items:center;gap:  6px}

/* r19g modal */
.modal.hidden{ display:none; }
.modal{ position: fixed; inset:0; z-index: 4000; display:block; }
.modal-backdrop{ position:absolute; inset:0; background: rgba(0,0,0,.6); }
.modal-sheet{ position: absolute; inset:auto 0 0 0; margin:auto; width: min(880px, 96vw); max-height: 80vh; background:#0b0b0b; border:1px solid var(--border); border-radius:16px; box-shadow: 0 10px 40px rgba(0,0,0,.7); overflow:hidden; }
@media (min-width: 700px){ .modal-sheet{ inset:0; } }
.modal-bar{ display:flex; align-items:center; justify-content:space-between; gap:12px; padding:12px 16px; background: var(--bar); border-bottom:1px solid var(--border); }
.modal-title{ font-weight:700; color:#00FF00; font-size:16px; }
.modal-body{ width:100%; height: clamp(42vh, 60vh, 70vh); border:0; background:#0b0b0b; }
.iconbtn.close{ font-size:18px; line-height:1; padding:6px 10px; background:transparent; border:1px solid var(--border); border-radius:10px; color:#fff; cursor:pointer; margin-left:auto; }
.iconbtn.close:hover{ border-color: #00FF00; }


/* === rmr: Reminder content inside notif modal (scoped) === */
.modal-body{ overflow:auto; } /* allow content to scroll if needed */
#rmr-root{ padding:16px; background:#0b0b0b; height:clamp(42vh,60vh,70vh); }
#rmr-content{ max-width:720px; margin:0 auto; }
#rmr-content label{ color:#fff; font-size:14px; }
#rmr-content input[type="checkbox"]{ width:18px; height:18px; accent-color:#666; cursor:pointer; }
.rmr-row{ display:flex; align-items:center; gap:10px; margin:12px 0; }
.rmr-section-title{ color:#999; font-size:12px; margin:14px 0 8px; }
#rmr-days{ display:flex; flex-direction:column; gap:10px; }
.rmr-day{ display:flex; align-items:center; justify-content:space-between; }
.rmr-left{ display:flex; align-items:center; gap:8px; }
.rmr-time{ background:#111; border:1px solid #333; border-radius:6px; color:#fff; padding:6px 10px; width:110px; }
.rmr-time:disabled{ opacity:.4; cursor:not-allowed; }
.rmr-actions{ display:flex; justify-content:flex-end; padding-top:16px; }
#rmr-save.button{ border-radius:8px; } /* a bit rounder per app style */

#rmr-toast{ position:fixed; left:50%; bottom:40px; transform:translateX(-50%) translateY(100px);
  background:#333; color:#fff; padding:14px 24px; border-radius:8px; box-shadow:0 6px 24px rgba(0,0,0,.5); transition:transform .25s ease; z-index:5000; }
#rmr-toast.show{ transform:translateX(-50%) translateY(0); }


#rmr-save{ background:#00FF00; color:#000; padding:10px 24px; border:none; border-radius:8px; font-weight:600; cursor:pointer; }
#rmr-save:hover{ opacity:.9; }

/* === Settings modal (language & units) === */
.iconbtn.settings{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:6px;
  width:auto;
  min-width:36px;
  min-height:36px;
  padding:6px 10px;
  border-radius:999px;
  background:transparent;
  border:1px solid var(--border);
  color:var(--fg);
  cursor:pointer;
}
.iconbtn.settings:hover{ background:rgba(255,255,255,.06); }
.iconbtn.settings .ico{ display:block; }

#settings-modal .modal-sheet{
  inset:auto;
  top:50%;
  left:50%;
  transform:translate(-50%,-50%);
  width:min(420px, 90vw);
  max-height:80vh;
}
#settings-modal .modal-body{
  padding:16px;
  height:auto;
  max-height:calc(80vh - 48px);
}
.settings-section{
  margin-bottom:16px;
}
.settings-label{
  color:#ccc;
  font-size:14px;
  margin-bottom:6px;
}
.settings-options label{
  display:block;
  margin-bottom:4px;
  font-size:14px;
}
.settings-actions{
  display:flex;
  justify-content:flex-end;
  margin-top:16px;
}
#settings-save{
  background:#00FF00;
  color:#000;
  padding:8px 22px;
  border:none;
  border-radius:8px;
  font-weight:600;
  cursor:pointer;
}
#settings-save:hover{ opacity:.9; }
.settings-toast{
  margin-top:8px;
  font-size:12px;
  color:#0f0;
}


/* --- Upgrade button (FREE only) --- */
#btn-upgrade.btn.upgrade{
  appearance:none;
  border:1px solid var(--acc);
  background:rgba(255,255,255,0.06);
  color:var(--fg);
  padding:8px 12px;
  border-radius:12px;
  cursor:pointer;
  font-weight:800;
  margin-left:10px;
}
#btn-upgrade.btn.upgrade:hover{ background:rgba(255,255,255,0.10); }




/* --- Global fixed Trial CTA bar (FREE + trial available only) --- */
.global-trial-sticky{
  position: fixed;
  left: 0;
  right: 0;
  bottom: var(--upgradebar-h);
  z-index: 3600;
  background: rgba(17,17,17,0.92);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  padding: 10px 12px;
}
.global-trial-inner{
  width: min(980px, 100%);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
}
.global-trial-text{
  flex: 1 1 auto;
  font-size: 14px;
  color: var(--fg);
  line-height: 1.3;
}
.global-trial-btn{
  appearance: none;
  border: 1px solid #026902;
  background: var(--acc);
  color: #001b00;
  padding: 10px 14px;
  border-radius: 14px;
  font-weight: 900;
  cursor: pointer;
}
.global-trial-btn:hover{ opacity: .9; }
.global-trial-close{
  appearance: none;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--fg);
  width: 34px;
  height: 34px;
  border-radius: 12px;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.global-trial-close:hover{ border-color: var(--acc); }

/* --- Global fixed Upgrade CTA bar (FREE only) --- */
.global-upgrade-sticky{
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3500;
  background: rgba(17,17,17,0.92);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  padding: 10px 12px;
}
.global-upgrade-inner{
  width: min(980px, 100%);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
}
.global-upgrade-text{
  flex: 1 1 auto;
  font-size: 14px;
  color: var(--fg);
  line-height: 1.3;
}
.global-upgrade-btn{
  appearance: none;
  border: 1px solid #026902;
  background: var(--acc);
  color: #001b00;
  padding: 10px 14px;
  border-radius: 14px;
  font-weight: 900;
  cursor: pointer;
}
.global-upgrade-btn:hover{ opacity: .9; }

/* --- Keep Trial / Upgrade CTA buttons the same size (prevent wrap in narrow layouts) --- */
.global-trial-btn,
.global-upgrade-btn{
  flex: 0 0 auto;        /* don't shrink in flex row */
  flex-shrink: 0;
  white-space: nowrap;   /* keep "Try now" on one line */
  width: 96px;           /* same width for both */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.global-upgrade-close{
  appearance: none;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--fg);
  width: 34px;
  height: 34px;
  border-radius: 12px;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.global-upgrade-close:hover{ border-color: var(--acc); }
