  :root {
    --bg: #fff;
    --ink: #111;
    --muted: #6b7280;

    --line: #e5e7eb;          /* 互換用（既存で使用） */
    --card-border: #e8ebf0;   /* カード統一 */
    --card-bg: #fff;
    --soft-bg: #f8fafc;
	  
    --container-max: 1040px;
    --container-pad: 14px;

    --radius: 14px;
    --gap: 16px;
    --bar-h: 76px;
    --foot-h: 56px;

    --ok: #34d399;
    --warn: #fbbf24;
    --busy: #f87171;
    --pill: #eef2f7;
    --closed: #9ca3af;
    --reception: #3b82f6;
    --brand-blue-1: #38bdf8;
    --brand-blue-2: #1E6FD9;
    --header-h: calc(var(--bar-h) + env(safe-area-inset-top, 0px));
  }

  html, body { margin: 0; }

  html {scroll-behavior: smooth;}

  body {
    font-family: system-ui, -apple-system, sans-serif;
    font-weight: 500;
    letter-spacing: 0.01em;
    text-rendering: optimizeLegibility;

    color: var(--ink);
    background: var(--bg);
    -webkit-text-size-adjust: 100%;

    padding-top: var(--header-h);
    padding-bottom: var(--foot-h);

 /* ふわっと表示：preload の時だけ透明 */
  opacity: 1;
  transition: opacity 0.8s ease-out;
}

body.preload{ opacity: 0; }
body.loaded{ opacity: 1; }

a { color: inherit; text-decoration: none; }

/* ページ内リンクの位置補正：bar-h じゃなく header-h に統一 */
section[id] { scroll-margin-top: calc(var(--header-h) + 10px); }

/* =========================
   Header（2段対応 安定版）
========================= */

.site-header{
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;

  /* 高さ固定をやめる（重要） */
  height: auto;
  padding: 8px 0 6px;

  backdrop-filter: blur(8px);
  background: rgba(255,255,255,.88);
  border-bottom: 1px solid var(--line);

  overflow: visible;          /* 切れ防止 */
}

/* ヘッダー内レイアウト */
.site-header .inner{
  max-width: 1040px;
  margin: 0 auto;

  display: flex;
  align-items: flex-start;    /* 2段対応 */
  justify-content: space-between;

  gap: 14px;
  padding: 0 14px;
}

/* ロゴ */
.brand-mini{
  font-weight: 800;
  font-size: 18px;
  letter-spacing: 0.02em;
}

/* 右側まとめブロック */
.cta-wrap{
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  min-width: 0;
}

/* ボタン横並び */
.cta{
  display: flex;
  gap: 10px;
  align-items: center;
}

/* ボタン共通 */
.cta a,
.cta span{
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  height: 48px;
  padding: 6px 0;
  border-radius: 14px;

  font-weight: 800;
  font-size: 14px;
  line-height: 1.15;
  letter-spacing: 0.06em;
  text-align: center;

  white-space: normal;
  box-sizing: border-box;

  box-shadow: 0 6px 18px rgba(0,0,0,.1);
  outline: 2px solid rgba(255,255,255,.35);
  outline-offset: -2px;
}

/* フォーカス */
.cta a:focus-visible{
  outline: 3px solid rgba(17,17,17,.25);
  outline-offset: 2px;
}

/* 予約ボタン */
.cta .primary{
  background: linear-gradient(180deg,var(--brand-blue-1),var(--brand-blue-2));
  color: #fff;
  box-shadow: 0 12px 24px rgba(30,111,217,.35);
}

/* オンライン */
.cta .secondary{
  background: linear-gradient(180deg, #22c55e, #16a34a);
  color: #fff;
  box-shadow: 0 12px 24px rgba(22,163,74,.35);
}

/* 無効 */
.cta .disabled{
  opacity: .6;
  pointer-events: none;
  filter: none;        /* ←グレー化やめる */
  background: inherit; /* ←色を殺さない */
  box-shadow: none;
}

/* =========================
   Fever button (anchored to header right)
========================= */

/* ヘッダー右ブロックを基準に絶対配置 */
.site-header .cta-wrap{
  position: relative; /* ←これがアンカー */
}

/* 発熱ボタン：ヘッダー右端に揃う（画面幅でズレない） */
.fever-fixed{
  position: absolute;
  right: 0;                 /* ←オンラインボタン右端と一致 */
  top: calc(100% + 6px);    /* ←ヘッダーの下に少し出す（調整可） */
  z-index: 300;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  padding: 12px 22px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: .02em;

  background: #ea580c;
  color: #fff7ed;
  border: 1px solid #ea580c;
  box-shadow: 0 10px 22px rgba(234,88,12,.18);

  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}

.fever-fixed:active{ transform: translateY(1px); }

/* スマホ：少し小さく＆位置微調整 */
@media (max-width: 430px){
  .fever-fixed{
    top: calc(100% + 6px);
    padding: 10px 14px;
    font-size: 13px;
  }
}

  /* =========================
     Layout / Sections
  ========================= */
  .container {
    max-width: 1040px;
    margin: 0 auto;
    padding: 16px 16px 16px;
  }

  /* セクション共通（カード統一） */
  .notice,
  .status,
  .hours {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 16px;
  }

  /* お知らせだけコンパクト */
  .notice { padding: 8px 12px; }

  .notice h2 {
    margin: 0 0 4px;
    font-size: 15px;
    color: var(--muted);
    font-weight: 800;
    letter-spacing: 0.02em;

    display: flex;
    align-items: center;
    gap: 8px;
  }

  .notice h2::after {
    content: "NEW";
    font-size: 11px;
    font-weight: 800;
    padding: 3px 9px;
    border-radius: 999px;
    background: linear-gradient(135deg, #93c5fd, #60a5fa);
    color: #fff;
    letter-spacing: 0.08em;
    box-shadow: 0 4px 10px rgba(59, 130, 246, 0.25);
    animation: newFloat 2.4s ease-in-out infinite;
  }

  @keyframes newFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-2px); }
  }

  .items { padding-left: 0; list-style: none; margin: 0; }

  .news-item {
    display: flex;
    gap: 8px;
    margin-bottom: 6px;
    font-size: 14px;
    line-height: 1.7;
    font-weight: 500;
  }

  .news-date {
    flex-shrink: 0;
    width: 90px;
    font-size: 13px;
    color: var(--muted);
  }

  .news-text { flex: 1; }

  /* =========================
     Status
  ========================= */
  .status { margin-top: var(--gap); }

  .status h2 {
    margin: 0 0 10px;
    font-size: 15px;
    color: var(--muted);
    font-weight: 800;
    letter-spacing: 0.02em;
  }

  .status-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .pill {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 12px;
    border-radius: 12px;
    background: var(--pill);
    font-weight: 700;
    font-size: 13px;
    line-height: 1;
  }

  .pill .dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    flex-shrink: 0;
  }

  .ok .dot { background: var(--ok); }
  .warn .dot { background: var(--warn); }
  .busy .dot { background: var(--busy); }
  .closed .dot { background: var(--closed); }
  .reception .dot { background: var(--reception); }
  .exam .dot { background: var(--ok); }

  .wait-row {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 18px 12px;
  }

  /* ガタつき防止 */
  #status-wait-text,
  .update-time { visibility: hidden; }
  body.is-loaded #status-wait-text,
  body.is-loaded .update-time { visibility: visible; }

  #wait-display-area {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
  }

  #status-wait-text {
    font-size: 18px;
    font-weight: 800;
    letter-spacing: 0.01em;
  }

  .update-time {
    font-size: 11px;
    color: var(--muted);
    margin-top: 2px;
    font-weight: 500;
  }

  .legend-row {
    grid-column: 1 / -1;
    display: flex;
    justify-content: center;
    gap: 14px;
    margin-top: 4px;
  }

  .legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--muted);
    font-weight: 500;
  }

  .legend-item .dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
  }

  /* 混雑状況の午前・午後を1行固定 */
  .status-grid .pill span:last-child{
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* =========================
     Calendar (Fold) - Pixel safe
  ========================= */
  .calendar-wrap{ margin-top: 18px; }

  .calendar-details{
    border: 1px solid var(--card-border);
    border-radius: 14px;
    background: #fff;
    overflow: hidden;
  }

  .calendar-details summary{
    cursor: pointer;
    padding: 12px 14px;
    font-weight: 800;
    font-size: 14px;
    line-height: 1.35;
    letter-spacing: 0.02em;
    list-style: none;
    user-select: none;

    display:flex;
    align-items:center;
    justify-content:space-between;

    border-bottom: 1px solid var(--card-border);
    background: #f0f9ff;
  }

  .calendar-details summary::-webkit-details-marker{ display:none; }
  .calendar-details summary::after{ content:"▾"; font-size:14px; opacity:.65; }
  .calendar-details[open] summary::after{ content:"▴"; }

  .calendar{ padding: 10px 12px 12px; }

  .cal-head{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:10px;
    margin-bottom: 8px;
  }

  #cal-title{
    font-weight: 900;
    font-size: 15px;
    text-align:center;
    flex:1;
  }

  .cal-head button{
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: 1px solid #dfe3ea;
    background:#fff;
    font-weight:900;
    line-height:1;
  }
  .cal-head button:active{ transform: translateY(1px); }

  .cal-legend{
    display:flex;
    gap: 8px;
    flex-wrap:wrap;
    margin: 8px 0 10px;
    font-size: 12px;
  }

  .cal-legend .lg{
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid #dfe3ea;
    background:#fff;
    font-weight: 800;
    opacity: .95;
  }
  .cal-legend .lg.open  { background:#ffffff; }
  .cal-legend .lg.am    { background:#fffbeb; border-color:#f59e0b; color:#92400e; }
  .cal-legend .lg.closed{ background:#f8fafc; border-color:#cbd5e1; color:#334155; opacity:.9; }
  .cal-legend .lg.extra { background:#fff1f2; border-color:#ef4444; color:#991b1b; }

  .cal-grid{
    display:grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 6px;
  }

  .cal-week{
    text-align:center;
    font-size:12px;
    font-weight:900;
    opacity:.7;
    padding: 6px 0 2px;
    min-width: 0;
  }

  .cal-cell{
    border: 1px solid #eef1f5;
    border-radius: 14px;
    padding: 8px;
    min-height: 64px;
    background:#fff;

    display:flex;
    flex-direction:column;
    gap: 6px;

    box-sizing: border-box;
    min-width: 0;
    overflow: visible; /* 欠け対策 */
    -webkit-tap-highlight-color: transparent;
  }

  .cal-cell.blank{ visibility:hidden; }

  .cal-top{ display:flex; justify-content:flex-start; align-items:flex-start; min-width:0; }
  .cal-cell .d{
    font-weight:900;
    font-size:12px;
    line-height:1;
    opacity:.88;
  }

  .cal-cell.today{
    outline: 2px solid #38bdf8;
    outline-offset: 2px;
  }

  .cal-cell.sun .d,
  .cal-cell.holiday .d{ color:#ef4444; }

  .cal-cell .cal-badge{
    margin-top: auto;
    align-self: center;

    max-width: 100%;
    box-sizing: border-box;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    padding: 6px 10px;
    border-radius: 999px;
    font-weight: 900;
    font-size: 12px;
    line-height: 1;
    border: 2px solid #dfe3ea;
    background:#fff;

    white-space: nowrap;
  }

  .cal-cell.open{ background:#fff; }

  .cal-cell.closed{
    background:#f8fafc;
    border-color:#e8edf3;
  }
  .cal-cell.closed .cal-badge{
    border-color:#cbd5e1; color:#334155; background:#f8fafc;
  }

  .cal-cell.amonly{
    background:#fffbeb;
    border-color:#ffe8c8;
  }
  .cal-cell.amonly .cal-badge{
    border-color:#f59e0b; color:#92400e; background:#fffbeb;
  }

  .cal-cell.extra{
    background:#fff1f2;
    border-color:#ffd4d4;
    outline: 2px solid #ffb3b3;
    outline-offset: 0;
  }
  .cal-cell.extra .cal-badge{
    border-color:#ef4444; color:#991b1b; background:#fff1f2;
  }

  .cal-cell:active{ transform: translateY(1px); }

  .cal-note{
    margin-top: 10px;
    font-size: 12px;
    opacity: .85;
    line-height: 1.35;
    padding: 8px 10px;
    border-radius: 12px;
    background: #fafbfd;
    border: 1px solid #eef1f5;
    font-weight: 500;
  }

  @media (max-width: 430px){
    .cal-cell{ min-height: 62px; }
    .cal-cell .cal-badge{ padding: 5px 8px; font-size: 12px; }
  }
  @media (max-width: 360px){
    .cal-grid{ gap: 5px; }
    .cal-cell{ padding: 7px; min-height: 60px; gap: 5px; }
    .cal-cell .cal-badge{ padding: 5px 7px; font-size: 11px; }
  }

  /* =========================
     Hours
  ========================= */
  .hours { margin-top: var(--gap); }

  .hours table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
  }

  .hours th,
  .hours td {
    border-top: 1px solid var(--line);
    padding: 10px 4px;
    text-align: center;
  }

  .hours th { font-weight: 800; letter-spacing: .02em; }
  .hours td { font-size: 17px; font-weight: 500; }

/* ===== Reserve Box Balanced ===== */

.reserve-box{
  margin: 10px auto 0;
  max-width: 460px;          /* 少しだけ細く */
  padding: 12px 42px;        /* ←左右の余白を増やす */

  border: 1px solid #e8ebf0;
  border-radius: 14px;
  background: #f8fafc;
  color: #334155;

  font-size: 12.5px;
  line-height: 1.45;
}

.reserve-box .rb-head{
  font-weight: 800;
  font-size: 13px;
  margin-bottom: 8px;
}

.reserve-box .rb-row{
  display: grid;
  grid-template-columns: 58px 1fr;   /* ←少し狭くする */
  gap: 12px;                         /* ←左右間隔ゆるめる */
  padding: 4px 0;
  border-top: 1px dashed rgba(148,163,184,.25);
}

.reserve-box .rb-row:first-of-type{
  border-top: none;
}

.reserve-box .rb-label{
  font-weight: 700;
  color: #475569;
  white-space: nowrap;
}

.reserve-box .rb-val{
  text-align: right;
  font-weight: 800;
  white-space: nowrap;
}

.reserve-box .rb-note{
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid rgba(148,163,184,.2);
  font-size: 11.5px;
  color: #64748b;
}

  /* =========================
     Nav Buttons
  ========================= */
  .grid {
    display: grid;
    gap: var(--gap);
    grid-template-columns: repeat(2, 1fr);
    margin-top: var(--gap);
  }

  .btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    font-weight: 700;
  }

  .btn small {
    font-size: 10px;
    color: var(--muted);
    margin-top: 4px;
    font-weight: 500;
  }

  /* =========================
     Content Sections
  ========================= */
  section.content-section {
    margin-top: 48px;
    padding: 0 8px;
    line-height: 1.7;
  }

  section.content-section h2 {
    font-size: 18px;
    border-left: 4px solid #38bdf8;
    padding-left: 8px;
    margin-bottom: 12px;
    font-weight: 800;
    letter-spacing: .02em;
  }

  .mini-faq p {
    margin: 12px 0 0;
    font-size: 14px;
    color: #333;
  }

  .clinic-notice {
    font-size: 12px;
    color: #555;
    margin-top: 40px;
    border-top: 1px solid var(--line);
    padding-top: 16px;
  }

.copyright{
  text-align: center;
  font-size: 11px;
  color: #888;
  margin: 18px 0 8px;
  padding: 0;
}

  /* =========================
     Footer
  ========================= */
  .site-footer {
    position: fixed;
    inset: auto 0 0 0;
    height: var(--foot-h);
    box-shadow: 0 -6px 18px rgba(0,0,0,.08);
    background: rgba(255, 255, 255, 0.95);
    border-top: 1px solid var(--line);
    z-index: 100;
  }

  .site-footer .inner {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    height: 100%;
    max-width: 1040px;
    margin: 0 auto;
  }

  .site-footer a {
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    border-right: 1px solid var(--line);
    padding-bottom: 8px;
  }
  .site-footer a:first-child{
  font-weight: 900;
  color: #1E6FD9;
}

/* =========================
   Phone modal
========================= */
.phone-modal{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.42);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 18px;
}

.phone-box{
  width: min(420px, 100%);
  background: #fff;
  border-radius: 18px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 18px 45px rgba(0,0,0,.18);
  padding: 16px 16px 14px;
}

.phone-title{
  font-weight: 900;
  font-size: 16px;
  margin-bottom: 8px;
}

.phone-msg{
  font-size: 14px;
  line-height: 1.6;
  color: #334155;
}

.phone-actions{
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 14px;
}

.phone-btn{
  border: 1px solid #e5e7eb;
  background: #fff;
  border-radius: 12px;
  padding: 10px 12px;
  font-weight: 900;
  font-size: 14px;
}

.phone-btn.primary{
  border: none;
  color: #fff;
  background: linear-gradient(180deg, var(--brand-blue-1), var(--brand-blue-2));
}

.phone-btn.ghost{
  background: #f8fafc;
}
  /* =========================
     Responsive CTA sizing
  ========================= */
  @media (min-width: 601px) {
    .cta a, .cta span { width: 130px; height: 58px; padding: 8px 0; }
  }

  @media (max-width: 600px) {
    .site-header .inner { gap: 10px; }
    .brand-mini { font-size: 16px; white-space: nowrap; }

    .cta { gap: 8px; width: 52%; }
    .cta a, .cta span {
      flex: 1;
      width: auto;
      min-width: 0;
      height: 54px;
      padding: 6px 0;
      font-size: 14px;
    }
  }

  @media (max-width: 360px) {
    .cta { width: 58%; }
    .brand-mini { font-size: 15px; }
  }



/* =========================
   Sub Pages (fever / online)  ※これだけでOK
========================= */

/* h1の標準マージンがデカいのが空白の正体なので潰す */
.sub-page h1{
  margin: 0 0 12px;        /* 上は0 */
  padding-top: 10px;       /* 息継ぎ（0〜12で調整） */
  font-size: 28px;         /* 好みで22〜30 */
  font-weight: 900;
}

/* 見出し・本文の読みやすさ */
.sub-page h2{
  font-size: 16px;
  margin: 22px 0 10px;
  color: var(--muted);
  font-weight: 800;
  letter-spacing: .02em;
}

.sub-page p,
.sub-page ul,
.sub-page ol{
  font-size: 14px;
  line-height: 1.8;
}

.sub-page ul,
.sub-page ol{
  padding-left: 20px;
}

/* ページ内CTA */
.sub-page .cta-area{
  text-align: center;
  margin: 40px 0;
}

/* ===== sub page main CTA buttons (final) ===== */

/* CTA枠 */
.sub-page .cta-area{
  max-width: 520px;
  margin: 44px auto 0;
  padding: 0 16px;
}

/* ボタン共通 */
.sub-page .btn-primary,
.sub-page .btn-secondary{
  display: block;
  width: 100%;
  max-width: 420px;
  margin: 14px auto;          /* ←中央寄せ確定 */
  padding: 18px 16px;
  border-radius: 16px;
  text-align: center;
  text-decoration: none;
  font-weight: 900;
  font-size: 16px;
  letter-spacing: .02em;
  box-sizing: border-box;
  transition: transform .08s ease, box-shadow .2s ease;
}

/* 来院予約（青） */
.sub-page .btn-primary{
  background: linear-gradient(180deg,var(--brand-blue-1),var(--brand-blue-2));
  color: #fff;
  box-shadow: 0 12px 24px rgba(30,111,217,.35);
  border: none;
}

/* オンライン（緑） */
.sub-page .btn-secondary{
  background: linear-gradient(180deg,#22c55e,#16a34a);
  color: #fff;
  box-shadow: 0 12px 24px rgba(22,163,74,.35);
  border: none;
}

/* 押したとき */
.sub-page .btn-primary:active,
.sub-page .btn-secondary:active{
  transform: translateY(1px);
  box-shadow: 0 6px 12px rgba(0,0,0,.15);
}

/* 無効化 */
.sub-page .btn-secondary.disabled{
  opacity: .6;
  pointer-events: none;
}

/* ===== FIX: header collapse on mobile ===== */
@media (max-width: 600px){
  .site-header .cta{ width:auto; flex-wrap:nowrap; }
  .site-header .cta a,
  .site-header .cta span{
    width:108px; min-width:108px; height:52px; font-size:13px;
  }
  .site-header .cta-wrap{ flex:0 0 auto; }
}

/* =========================
   Footer height (mobile)
========================= */
@media (max-width: 600px){
  :root{
    --foot-h: 76px;
  }
}