:root{
  --bg:#F4F6FA; --surface:#FFFFFF; --surface2:#F1F3F8; --line:#E5E9F2;
  --ink:#3D4356; --muted:#9AA3B5;
  --coral:#F0876C; --coral-soft:#FCEDE8; --coral-deep:#E06D50;
  --accent-rgb:240,135,108;   /* テーマ切替用（rgba指定で使用） */
  --danger:#E05C5C;
  --sun:#E05C5C; --sat:#5C8DE0;
  --shadow:0 10px 30px rgba(61,67,86,.08);
  --shadow-sm:0 3px 12px rgba(61,67,86,.07);
  --round:"Zen Maru Gothic",-apple-system,BlinkMacSystemFont,"Hiragino Maru Gothic ProN","Hiragino Sans",sans-serif;
  --mono:ui-monospace,"SF Mono","Menlo",monospace;
}
*{box-sizing:border-box;margin:0;padding:0}
[hidden]{display:none!important}
html,body{height:100%; touch-action:manipulation}
body{
  background:var(--bg); color:var(--ink);
  font-family:var(--round);
  font-size:15px; -webkit-font-smoothing:antialiased;
  padding:env(safe-area-inset-top) 0 0 0;
  overflow:hidden;
}
button{font-family:var(--round)}

/* ===== アプリヘッダー ===== */
header{
  display:flex; align-items:center; gap:10px;
  padding:14px 18px 10px;
}
header h1{font-size:19px; font-weight:700; letter-spacing:.02em; flex:1}
/* ヘッダーの丸アイコンボタン（サブスク・サウナ・検索・設定で共通） */
#btnSubs,#btnSauna,#btnSearch,#btnTags{
  border:none; background:var(--surface); box-shadow:var(--shadow-sm);
  border-radius:999px; width:34px; height:34px; padding:0; flex:none;
  color:var(--ink); cursor:pointer;
  display:flex; align-items:center; justify-content:center;
}
#btnSubs svg,#btnSauna svg,#btnSearch svg,#btnTags svg{width:17px; height:17px}
#btnSubs:active,#btnSauna:active,#btnSearch:active,#btnTags:active{transform:scale(.94)}


/* ===== カード ===== */
.card{
  position:relative;
  margin:0 12px; padding:10px 10px 12px;
  background:var(--surface); border-radius:22px; box-shadow:var(--shadow);
  height:calc(100dvh - 66px - 84px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  display:flex; flex-direction:column;
}
#calBar{display:flex; align-items:center; gap:6px; padding:2px 2px 10px}
#calBar .nav{
  width:36px; height:36px; border:none; border-radius:50%;
  background:var(--surface2); color:var(--ink);
  font-size:16px; line-height:1; cursor:pointer; flex:none;
}
#calBar .nav:active{opacity:.7}
#calTitle{
  flex:1; text-align:center; font-size:16px; font-weight:700;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
  letter-spacing:.02em; position:relative;
}
#titleJump{
  position:absolute; inset:0; width:100%; height:100%;
  opacity:0; border:none; padding:0; margin:0; background:transparent;
  font-size:16px; /* iOSのフォーカスズーム防止 */
}
#dayStrip{display:flex; gap:3px; padding:0 0 10px}
.ds-item{
  flex:1; display:flex; align-items:center; justify-content:center; gap:3px;
  padding:9px 0; border:none; border-radius:12px; background:transparent;
  cursor:pointer; line-height:1.2; white-space:nowrap;
}
.ds-item b{font-size:14px; font-weight:700; color:var(--ink)}
.ds-item .ds-wd{font-size:10px; color:var(--muted); font-weight:500}
.ds-item.sun b,.ds-item.sun .ds-wd{color:var(--sun)}
.ds-item.sat b,.ds-item.sat .ds-wd{color:var(--sat)}
.ds-item.today b{color:var(--coral-deep)}
.ds-item.hol b{color:var(--coral-deep)}
.ds-item.sel{background:var(--coral); box-shadow:0 4px 12px rgba(var(--accent-rgb),.35)}
.ds-item.sel b,.ds-item.sel .ds-wd{color:#fff}
.ds-item:active{transform:scale(.95)}
#cal{flex:1; min-height:0; transition:opacity .15s ease}
#cal.view-out{opacity:0}

/* 画面外の予定を知らせるヒント */
.offhint{
  position:absolute; left:50%; transform:translateX(-50%); z-index:8;
  background:rgba(61,67,86,.88); color:#fff; border:none; cursor:pointer;
  font-size:10.5px; font-weight:700; font-family:var(--round);
  padding:5px 13px; border-radius:999px; box-shadow:var(--shadow-sm);
}
.offhint:active{transform:translateX(-50%) scale(.95)}

/* タグフィルター（月ビュー） */
#tagFilter{
  display:flex; gap:6px; overflow-x:auto; padding:0 2px 10px;
  -webkit-overflow-scrolling:touch; scrollbar-width:none;
}
#tagFilter::-webkit-scrollbar{display:none}
.tf-chip{
  flex:none; display:inline-flex; align-items:center; gap:6px;
  padding:6px 13px; border:none; border-radius:999px;
  background:var(--surface2); font-size:12px; font-weight:500; color:var(--ink);
  cursor:pointer; transition:opacity .15s;
}
.tf-chip .dot{width:8px; height:8px; border-radius:50%; flex:none}
.tf-chip.off{opacity:.4}
.tf-chip.off .dot{background:#B9C0CF!important}
.tf-chip:active{transform:scale(.95)}

/* タップした日付セルのフラッシュ */
@keyframes tapflash{0%{background:var(--coral-soft)}100%{background:transparent}}
.tap-flash{animation:tapflash .4s ease-out}

/* ===== FullCalendar ===== */
.fc{
  --fc-page-bg-color:var(--surface);
  --fc-border-color:transparent;
  --fc-neutral-bg-color:var(--surface2);
  --fc-today-bg-color:var(--coral-soft);
  --fc-list-event-hover-bg-color:var(--surface2);
  font-size:13px;
}
.fc .fc-scrollgrid{border:none}
.fc .fc-scrollgrid td,.fc .fc-scrollgrid th{border:none}
/* 月ビュー: 週ごとに淡い横線で区切る(縦線はなし・1週目の上にも表示) */
.fc .fc-daygrid-body td.fc-daygrid-day{border-top:1px solid #F0F2F7}
/* 曜日ヘッダー行の下(=1週目の上)にも同じ線 */
.fc .fc-dayGridMonth-view .fc-col-header{border-bottom:1px solid #F0F2F7}
.fc .fc-col-header-cell-cushion{
  color:var(--muted); text-decoration:none; font-size:11.5px; font-weight:500;
  padding:6px 0; white-space:nowrap;
}
/* 曜日ヘッダー: 日曜=赤 / 土曜=青 */
.fc .fc-col-header-cell.fc-day-sun .fc-col-header-cell-cushion{color:var(--sun)}
.fc .fc-col-header-cell.fc-day-sat .fc-col-header-cell-cushion{color:var(--sat)}
/* 月ビュー */
.fc .fc-daygrid-day-frame{min-height:44px; padding:0}
.fc .fc-daygrid-day-number{
  color:var(--ink); text-decoration:none; font-size:11px;
  width:17px; height:17px; display:flex; align-items:center; justify-content:center;
  margin:1px auto 0; border-radius:50%;
}
/* 前月・翌月の予定は薄く */
.fc .fc-day-other .fc-event{opacity:.4}
.fc .fc-day-other .fc-daygrid-day-number{color:#C6CCDA}
/* 日付数字: 日曜=赤 / 土曜=青（当月のみ・祝日と今日が優先） */
.fc .fc-daygrid-day.fc-day-sun:not(.fc-day-other) .fc-daygrid-day-number{color:var(--sun)}
.fc .fc-daygrid-day.fc-day-sat:not(.fc-day-other) .fc-daygrid-day-number{color:var(--sat)}
.fc .fc-day-today{background:transparent!important}
.fc .fc-daygrid-day.is-holiday:not(.fc-day-today) .fc-daygrid-day-number{color:var(--coral-deep); font-weight:700}
/* 記念日: その日をやわらかく装飾する */
.fc .fc-daygrid-day.is-anniv{
  background:
    radial-gradient(120% 85% at 50% 0%, rgba(var(--accent-rgb),.18) 0%, rgba(var(--accent-rgb),.06) 55%, transparent 88%);
  box-shadow:inset 0 0 0 1px rgba(var(--accent-rgb),.22);
}
/* 前月・翌月のセルでは控えめに */
.fc .fc-daygrid-day.is-anniv.fc-day-other{opacity:.55}
/* 今日: 土日・祝日でも珊瑚丸+白文字（:not で週末ルールと詳細度を揃え、後勝ちにする） */
.fc .fc-daygrid-day.fc-day-today:not(.fc-day-other) .fc-daygrid-day-number{
  background:var(--coral); color:#fff; font-weight:700;
}
.fc .fc-daygrid-day-events{margin-top:2px}
.fc-event{border-radius:5px; border:none; cursor:pointer}
.fc .fc-daygrid-event{margin:0 0 1px}
.fc .fc-daygrid-day-frame{padding:0}
.ev-chip{
  display:block; overflow:hidden;
  padding:0.5px 2px; font-size:var(--ev-fs-month,9.5px); font-weight:600; letter-spacing:-.04em;
  line-height:1.25; color:var(--ink);
  white-space:nowrap;
  -webkit-mask-image:linear-gradient(90deg,#000 calc(100% - 10px),transparent);
  mask-image:linear-gradient(90deg,#000 calc(100% - 10px),transparent);
}
.ev-chip.hol{color:var(--coral-deep); background:transparent; font-weight:700}
.fc .fc-daygrid-more-link{color:var(--coral-deep); font-size:10px}
.fc .fc-h-event .fc-event-title{
  font-size:var(--ev-fs-month,9.5px); letter-spacing:-.04em; font-weight:600; color:var(--ink);
  white-space:nowrap; overflow:hidden;
}
/* 横型イベント(月ビューの帯・全日欄)のタイトルを枠幅でフェードアウト */
.fc .fc-h-event .fc-event-title-container{
  overflow:hidden; min-width:0;
  -webkit-mask-image:linear-gradient(90deg,#000 calc(100% - 8px),transparent);
  mask-image:linear-gradient(90deg,#000 calc(100% - 8px),transparent);
}
/* 祝日イベント(白背景+珊瑚の枠・タップ不可) */
.fc-event.holiday-ev{box-shadow:none!important; cursor:default}

/* 週・日ビュー */
.fc td.fc-timegrid-slot{border-top:1px solid var(--line)}
.fc-timeGridWeek-view td.fc-timegrid-slot{height:calc(var(--hour-h-week,68px) / 2)}
.fc-timeGridDay-view td.fc-timegrid-slot{height:calc(var(--hour-h-day,68px) / 2)}
.fc td.fc-timegrid-slot-minor{border-top-style:dashed; border-top-color:#EEF1F7}
.fc .fc-timegrid-slot-label-cushion{
  font-family:var(--mono); font-variant-numeric:tabular-nums;
  font-size:10.5px; color:var(--muted);
}
/* 時刻ラベルを目盛り線の上側に配置し、先頭の時刻が上端で切れないように */
.fc .fc-timegrid-slot-label{vertical-align:top}
.fc .fc-timegrid-slot-label-frame{transform:translateY(-0.6em)}
.fc .fc-timegrid-axis-frame{justify-content:flex-start}
.fc .fc-timegrid-axis-cushion{font-size:10.5px; color:var(--muted); white-space:nowrap}
.fc .fc-timegrid-now-indicator-line{border-color:var(--coral); border-width:1.5px}
.fc .fc-timegrid-now-indicator-arrow{border-color:var(--coral); border-top-color:transparent; border-bottom-color:transparent}
/* 現在時刻ラベル */
.fc .fc-timegrid-body{position:relative}
#nowLabel{
  position:absolute; z-index:7; pointer-events:none;
  display:flex; align-items:center; justify-content:center;
  background:var(--coral); color:#fff; font-size:9px; font-weight:700;
  font-family:var(--mono); font-variant-numeric:tabular-nums;
  padding:1px 0; border-radius:999px; transform:translateY(-50%);
  box-shadow:0 2px 6px rgba(var(--accent-rgb),.4); white-space:nowrap;
}
.fc .fc-timegrid-event{
  border-radius:4px; box-shadow:var(--shadow-sm);
  border:none; border-left:2.5px solid #C9D2E6; padding:1px 2px;
}
/* 同時刻の予定が横並びになった時の隙間 */
.fc .fc-timegrid-event-harness{margin-right:2px}
.fc .fc-timegrid-event-harness:last-child{margin-right:0}
.fc .fc-timegrid-event .fc-event-time{
  font-family:var(--mono); font-variant-numeric:tabular-nums;
  font-size:9.5px; opacity:.75; letter-spacing:-.03em;
}
/* 週ビューは列が狭いため時刻を省略してタイトルを優先 */
.fc-timeGridWeek-view .fc-timegrid-event .fc-event-time{display:none}
.fc .fc-timegrid-event .fc-event-title{font-size:var(--ev-fs-week,10.5px); font-weight:600; letter-spacing:-.04em; line-height:1.25}
.fc-timeGridDay-view .fc-timegrid-event .fc-event-title{font-size:var(--ev-fs-day,11.5px)}
.fc-timeGridDay-view .fc-h-event .fc-event-title{font-size:var(--ev-fs-day,11.5px)}
.fc-timeGridWeek-view .fc-h-event .fc-event-title{font-size:var(--ev-fs-week,10.5px)}
/* 日ビュー: 短い予定(1行)は時刻幅を固定してタイトル先頭を縦に揃える */
.fc-timeGridDay-view .fc-timegrid-event.fc-event-condensed .fc-event-time{
  flex:none; width:3.4em; margin-right:4px;
  overflow:visible; white-space:nowrap;
}
.fc-timeGridDay-view .fc-timegrid-event.fc-event-condensed .fc-event-title-container{flex:1 1 auto; min-width:0}
.fc .fc-timegrid-col.fc-day-today{background:transparent!important}
.fc .fc-timegrid .fc-daygrid-day-top{display:none}
.fc .fc-timegrid .fc-daygrid-day-frame{min-height:0}
/* ドラッグ中の表示 */
.fc .fc-event-dragging,.fc .fc-event-resizing{opacity:.75; box-shadow:0 8px 20px rgba(61,67,86,.25)}

/* 週ビューの日付ヘッダー */
.dh1{
  display:inline-flex; align-items:center; justify-content:center; gap:3px;
  padding:3px 6px; border-radius:999px; line-height:1.2; white-space:nowrap;
}
.dh1 b{font-size:13px; font-weight:700; color:var(--ink)}
.dh1 span{font-size:10px; color:var(--muted); font-weight:500}
.fc .fc-day-sun .dh1 b,.fc .fc-day-sun .dh1 span{color:var(--sun)}
.fc .fc-day-sat .dh1 b,.fc .fc-day-sat .dh1 span{color:var(--sat)}
.fc .fc-col-header-cell .dh1.hol b{color:var(--coral-deep)}
.fc .fc-col-header-cell.fc-day-today .dh1{background:var(--coral)}
.fc .fc-col-header-cell.fc-day-today .dh1 b,.fc .fc-col-header-cell.fc-day-today .dh1 span{color:#fff}

/* ===== TODOリスト ===== */
#todoAddRow{display:flex; gap:8px; padding:2px 2px 12px}
#todoAddRow input{flex:1}
#todoAddRow button{
  flex:none; padding:0 18px; border:none; border-radius:14px;
  background:var(--coral); color:#fff; font-size:14px; font-weight:700; cursor:pointer;
}
#todoAddRow #todoDetailBtn{
  background:var(--surface2); color:var(--ink); padding:0 14px; font-weight:500;
}
#todoList{flex:1; min-height:0; overflow-y:auto; -webkit-overflow-scrolling:touch}
.td-row{
  display:flex; align-items:center; gap:10px;
  padding:11px 6px; border-bottom:1px solid var(--line);
}
.td-check{
  width:24px; height:24px; flex:none; border-radius:50%;
  border:2px solid #C9D2E6; background:transparent; cursor:pointer;
  display:flex; align-items:center; justify-content:center;
  color:transparent; font-size:13px; transition:background .15s, border-color .15s;
}
.td-row.done .td-check{background:var(--coral); border-color:var(--coral); color:#fff}
.td-body{flex:1; min-width:0; cursor:pointer; display:flex; flex-direction:column; gap:2px}
.td-title{font-size:14.5px; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
.td-meta{display:flex; align-items:center; gap:8px; font-size:11px; color:var(--muted)}
.td-meta .td-tag{display:inline-flex; align-items:center; gap:4px}
.td-meta .td-tag i{width:7px; height:7px; border-radius:50%; display:inline-block}
.td-row.done .td-title{color:var(--muted); text-decoration:line-through}
.td-del{
  width:30px; height:30px; flex:none; border:none; border-radius:50%;
  background:transparent; color:var(--muted); font-size:16px; cursor:pointer;
}
#todoEmpty{padding:32px 0; text-align:center; color:var(--muted); font-size:13.5px}

/* ===== 記念日 ===== */
#annivAddRow{display:flex; gap:8px; padding:2px 2px 12px; align-items:center}
#annivAddRow #annivInput{flex:1; min-width:0}
#annivAddRow #annivDate{width:132px; flex:none}
#annivAddRow button{
  flex:none; border:none; border-radius:12px; background:var(--coral); color:#fff;
  font-family:var(--round); font-size:13px; font-weight:700; padding:12px 14px; cursor:pointer;
}
#annivList{flex:1; min-height:0; overflow-y:auto; -webkit-overflow-scrolling:touch}
.anv-row{
  display:flex; align-items:center; gap:10px;
  padding:11px 10px; border-radius:14px; cursor:pointer;
}
.anv-row:active{background:var(--surface2)}
.anv-row + .anv-row{border-top:1px solid #F0F2F7}
.anv-main{flex:1; min-width:0}
.anv-title{font-size:14.5px; font-weight:700; overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
.anv-sub{font-size:11px; color:var(--muted); margin-top:2px}
.anv-days{
  flex:none; text-align:right; font-variant-numeric:tabular-nums;
}
.anv-days b{font-size:19px; font-weight:700; color:var(--coral-deep); letter-spacing:-.02em}
.anv-days span{font-size:10.5px; color:var(--muted); display:block; margin-top:1px}
.anv-next{
  flex:none; min-width:74px; text-align:center;
  background:var(--coral-soft); border-radius:10px; padding:6px 7px;
}
.anv-next b{display:block; font-size:12.5px; font-weight:700; color:var(--coral-deep)}
.anv-next span{font-size:9.5px; color:var(--muted)}
.anv-next.today{background:var(--coral); }
.anv-next.today b,.anv-next.today span{color:#fff}
#annivEmpty{padding:40px 0; text-align:center; color:var(--muted); font-size:13.5px; line-height:2}
.danger-link{
  display:block; width:100%; margin-top:6px; padding:12px;
  border:none; background:transparent; color:var(--danger);
  font-family:var(--round); font-size:13px; font-weight:700; cursor:pointer;
}
#aInfo{font-size:12px; color:var(--muted); line-height:1.9; padding:2px 2px 6px}
#btnSkip{
  display:block; width:100%; margin-top:18px; padding:12px;
  border:1.5px solid var(--line); border-radius:14px; background:var(--surface);
  color:var(--ink); font-family:var(--round); font-size:13px; font-weight:700; cursor:pointer;
}
#btnSkip.on{background:var(--surface2); color:var(--muted)}
#themePicker{display:flex; flex-wrap:wrap; gap:8px; padding:2px 0 4px}
.theme-chip{
  display:flex; align-items:center; gap:7px;
  border:1.5px solid var(--line); border-radius:999px;
  background:var(--surface); color:var(--ink);
  font-family:var(--round); font-size:12.5px; font-weight:600;
  padding:8px 14px 8px 10px; cursor:pointer;
}
.theme-chip .theme-dot{
  width:14px; height:14px; border-radius:50%; background:var(--chip);
  box-shadow:inset 0 0 0 1px rgba(0,0,0,.06);
}
.theme-chip.on{border-color:var(--chip); background:var(--surface2); font-weight:700}
#openSubs,#openSauna{
  width:100%; border:1.5px solid var(--line); border-radius:14px;
  background:var(--surface); color:var(--ink); font-family:var(--round);
  font-size:14px; font-weight:700; padding:13px; cursor:pointer;
}
#runShortcut{
  width:100%; border:none; border-radius:14px; margin-top:4px;
  background:var(--coral); color:#fff; font-family:var(--round);
  font-size:14px; font-weight:700; padding:14px; cursor:pointer;
}
#runShortcut:active{transform:scale(.98)}
#shortcutNote{font-size:11px; color:var(--muted); line-height:1.7; padding:8px 2px 0}
/* ===== サブスク ===== */
#subsTotal{
  background:var(--coral-soft); border-radius:14px; padding:12px 14px; margin-bottom:12px;
  font-size:12px; color:var(--muted); line-height:1.8;
}
#subsTotal b{font-size:19px; color:var(--coral-deep); font-variant-numeric:tabular-nums}
#subsList{max-height:46vh; overflow-y:auto; -webkit-overflow-scrolling:touch}
.sub-row{
  display:flex; align-items:center; gap:10px;
  padding:11px 8px; border-radius:12px; cursor:pointer;
}
.sub-row:active{background:var(--surface2)}
.sub-row + .sub-row{border-top:1px solid #F0F2F7}
.sub-row.ended{opacity:.45}
.sub-main{flex:1; min-width:0}
.sub-name{font-size:14.5px; font-weight:700; overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
.sub-sub{font-size:11px; color:var(--muted); margin-top:2px}
.sub-next{
  flex:none; min-width:56px; text-align:center;
  background:var(--surface2); border-radius:10px; padding:5px 6px;
}
.sub-next b{display:block; font-size:12px; font-weight:700; color:var(--ink);
  font-variant-numeric:tabular-nums; line-height:1.3}
.sub-next span{font-size:9.5px; color:var(--muted)}
.sub-next.today{background:var(--coral-soft)}
.sub-next.today b{color:var(--coral-deep)}
.sub-amount{flex:none; text-align:right; font-variant-numeric:tabular-nums; min-width:62px}
.sub-amount b{font-size:15px; font-weight:700}
.sub-amount span{display:block; font-size:10px; color:var(--muted); margin-top:1px}
#subAdd{
  width:100%; border:1.5px dashed var(--line); border-radius:14px;
  background:transparent; color:var(--muted); font-family:var(--round);
  font-size:13px; font-weight:700; padding:13px; cursor:pointer; margin-top:10px;
}
.sub-note{font-size:11px; color:var(--muted); line-height:1.6; margin-top:5px}
#subsEmpty{padding:34px 0; text-align:center; color:var(--muted); font-size:13.5px; line-height:2}
/* ===== サウナ記録 ===== */
#saunaStats{
  display:flex; gap:8px; margin-bottom:12px;
}
.sn-stat{
  flex:1; background:var(--surface2); border-radius:14px; padding:10px 8px; text-align:center;
}
.sn-stat b{display:block; font-size:19px; font-weight:700; color:var(--coral-deep);
  font-variant-numeric:tabular-nums; line-height:1.3}
.sn-stat span{font-size:10.5px; color:var(--muted)}
#saunaTimeline{max-height:46vh; overflow-y:auto; -webkit-overflow-scrolling:touch; padding-left:4px}
.sn-item{
  position:relative; padding:0 0 16px 22px; cursor:pointer;
}
/* 縦の線と丸で時系列を表す */
.sn-item::before{
  content:""; position:absolute; left:4px; top:16px; bottom:0; width:2px;
  background:var(--line);
}
.sn-item:last-child::before{display:none}
.sn-item::after{
  content:""; position:absolute; left:0; top:5px;
  width:10px; height:10px; border-radius:50%;
  background:var(--coral); box-shadow:0 0 0 2.5px var(--coral-soft);
}
.sn-item:active .sn-card{background:var(--surface2)}
.sn-date{font-size:10.5px; color:var(--muted); font-weight:700; margin-bottom:3px}
.sn-card{border-radius:12px; padding:2px 4px}
.sn-place{font-size:14.5px; font-weight:700}
.sn-meta{font-size:11.5px; color:var(--muted); margin-top:2px}
.sn-note{font-size:11.5px; color:var(--ink); margin-top:3px; opacity:.8; line-height:1.6}
.sn-month{
  font-size:11px; font-weight:700; color:var(--muted);
  margin:4px 0 8px -22px; padding-left:22px;
}
.place-row{display:flex; gap:8px; align-items:center}
.place-row select{flex:1; min-width:0}
#snPlaceAdd{
  flex:none; width:46px; height:46px; border:none; border-radius:12px;
  background:var(--surface2); color:var(--muted); font-size:20px; cursor:pointer;
}
/* 施設別サマリー */
#saunaPlaces{max-height:46vh; overflow-y:auto; -webkit-overflow-scrolling:touch}
.pl-row{
  display:flex; align-items:center; gap:10px;
  padding:11px 8px; border-radius:12px; cursor:pointer;
}
.pl-row:active{background:var(--surface2)}
.pl-row + .pl-row{border-top:1px solid #F0F2F7}
.pl-main{flex:1; min-width:0}
.pl-name{font-size:14.5px; font-weight:700; overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
.pl-sub{font-size:11px; color:var(--muted); margin-top:2px}
.pl-count{
  flex:none; text-align:center; min-width:52px;
  background:var(--coral-soft); border-radius:10px; padding:6px 8px;
}
.pl-count b{display:block; font-size:17px; font-weight:700; color:var(--coral-deep);
  font-variant-numeric:tabular-nums; line-height:1.2}
.pl-count span{font-size:9.5px; color:var(--muted)}
#placesEmpty{padding:34px 0; text-align:center; color:var(--muted); font-size:13.5px; line-height:2}
#saunaAdd{
  width:100%; border:1.5px dashed var(--line); border-radius:14px;
  background:transparent; color:var(--muted); font-family:var(--round);
  font-size:13px; font-weight:700; padding:13px; cursor:pointer; margin-top:10px;
}
#saunaEmpty{padding:34px 0; text-align:center; color:var(--muted); font-size:13.5px; line-height:2}
/* 予定内アイコン: 文字サイズ(em)に連動させる */
.ev-icon-row{
  display:flex; align-items:center; gap:.35em; min-width:0;
}
.ev-icon{
  width:1.15em; height:1.15em; flex:none;
}
.ev-icon-label{
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap; min-width:0;
}

/* スキップした繰り返しの回 */
.fc .ev-cancelled{opacity:.75}
.fc .ev-cancelled .fc-event-title,
.fc .ev-cancelled .fc-event-time{text-decoration:line-through}
.fc .ev-cancelled .ev-chip{text-decoration:line-through}

/* 週・日ビューの終日欄: サブスク／サウナ */
.fc .sub-ev{border-left:2.5px solid #E0AE45 !important}
.fc .sauna-ev{border-left:2.5px solid #C9713F !important}
.fc .sub-ev .fc-event-title,.fc .sauna-ev .fc-event-title{font-weight:600}

/* 月ビュー: 日付数字を挟んで左右にバッジを置く（コイン=左 / 温泉=右） */
.day-badges{
  position:absolute; top:3px; z-index:3;
  display:flex; align-items:center; gap:2px;
}
.day-badges.left{left:4px}
.day-badges.right{right:4px}
/* 前月・翌月のセルではバッジも薄くする */
.fc .fc-day-other .day-badges{opacity:.4}
.sauna-mark{
  flex:none; width:13px; height:13px; border-radius:3.5px; padding:0;
  background:#E38B5A; border:1.2px solid #C9713F; color:#fff;
  font-family:var(--round); font-size:7.5px; font-weight:700; line-height:1;
  display:flex; align-items:center; justify-content:center;
  cursor:pointer; box-shadow:0 1px 3px rgba(150,80,30,.25);
}
.sauna-mark:active{transform:scale(.9)}
/* 月ビューの支払日コイン */
.pay-coin{
  flex:none; width:13px; height:13px; border-radius:50%;
  background:#F5C765; border:1.2px solid #E0AE45; color:#8A6A18;
  font-size:7.5px; font-weight:700; line-height:1;
  display:flex; align-items:center; justify-content:center;
  cursor:pointer; box-shadow:0 1px 3px rgba(120,90,20,.25);
}
.pay-coin:active{transform:scale(.9)}
#aMilestones{display:flex; flex-direction:column; gap:2px}
.ms-row{
  display:flex; align-items:center; justify-content:space-between;
  padding:9px 4px; cursor:pointer; font-size:13.5px;
}
.ms-row + .ms-row{border-top:1px solid #F0F2F7}
.ms-box{
  width:22px; height:22px; flex:none; border-radius:7px;
  border:2px solid #C9D2E6; display:flex; align-items:center; justify-content:center;
  font-size:13px; color:transparent; transition:background .15s, border-color .15s;
}
.ms-row.on .ms-box{background:var(--coral); border-color:var(--coral); color:#fff}
#repeatNote{
  font-size:11px; color:var(--muted); line-height:1.7;
  background:var(--surface2); border-radius:10px; padding:8px 10px; margin-bottom:12px;
}

/* ===== 検索 ===== */
#searchResults{max-height:52vh; overflow-y:auto; margin-top:4px}
.sr-group{font-size:11px; color:var(--muted); font-weight:700; margin:12px 2px 6px}
.sr-item{
  display:flex; align-items:center; gap:9px; padding:10px 8px;
  border-radius:12px; cursor:pointer;
}
.sr-item:active{background:var(--surface2)}
.sr-item .sr-ico{
  width:26px; height:26px; flex:none; border-radius:8px;
  display:flex; align-items:center; justify-content:center; font-size:13px;
  background:var(--surface2);
}
.sr-item .sr-main{flex:1; min-width:0}
.sr-item .sr-title{font-size:14px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
.sr-item .sr-sub{font-size:11px; color:var(--muted); margin-top:1px}
#searchEmpty{padding:24px 0; text-align:center; color:var(--muted); font-size:13px}

/* ===== 下部バー (すりガラス・カード幅) ===== */
#bottomBar{
  position:fixed; left:12px; right:12px;
  bottom:calc(14px + env(safe-area-inset-bottom));
  display:flex; align-items:center; justify-content:space-between;
  padding:6px 8px; border-radius:999px; z-index:6;
  background:rgba(255,255,255,.62);
  -webkit-backdrop-filter:blur(22px) saturate(180%);
  backdrop-filter:blur(22px) saturate(180%);
  box-shadow:0 8px 32px rgba(61,67,86,.16), inset 0 1px 0 rgba(255,255,255,.9);
  border:1px solid rgba(255,255,255,.7);
}
#bottomBar button{
  border:none; background:transparent; border-radius:999px; cursor:pointer;
  color:var(--ink); font-family:var(--round); padding:0;
  position:relative; z-index:1;
  transition:color .18s, opacity .18s;
}
/* 選択中を示すスライドするハイライト(モード用・ビュー用の2つ) */
.bar-pill{
  position:absolute; top:50%; left:0; width:0;
  transform:translateY(-50%);
  height:48px; border-radius:999px;
  background:rgba(var(--accent-rgb),.15); z-index:0;
  transition:left .32s cubic-bezier(.34,1.3,.5,1),
             width .32s cubic-bezier(.34,1.3,.5,1),
             height .25s ease, opacity .2s ease;
  pointer-events:none;
}
#pillView{height:40px}
.bar-pill.hide{opacity:0}
#bottomBar button:active{transform:scale(.94)}
#bottomBar .mseg{
  width:50px; height:48px;
  display:flex; flex-direction:column; align-items:center; justify-content:center; gap:2px;
  font-size:9px; font-weight:600;
}
#bottomBar .mseg svg{width:21px; height:21px; stroke-width:1.9}
/* モード切替は固定幅、モード固有ボタンは残りを占めて左詰め。
   これで中身が入れ替わっても 予定/TODO/記念日 と ＋ の位置が動かない */
.bar-group{display:flex; align-items:center; flex:none}
#barSlots{flex:1 1 auto; justify-content:flex-start; overflow:hidden}
#bottomBar .vseg{
  width:38px; height:40px; font-size:12.5px; font-weight:700; flex:none;
}
#btnLists,#btnLogs{width:44px; font-size:11px}
#btnBarToday{font-size:11px}
#bottomBar button.on{color:var(--coral)}
#bottomBar .vseg.dim{opacity:.3; pointer-events:none}
.bar-divider{
  width:1px; height:26px; flex:none;
  background:rgba(61,67,86,.14);
}
#barAdd{
  width:42px; height:42px; flex:none; border-radius:50%;
  background:var(--coral); color:#fff;
  font-size:23px; line-height:1; font-weight:300;
  box-shadow:0 4px 14px rgba(var(--accent-rgb),.4);
}

/* ===== ボトムシート ===== */
#overlay{
  position:fixed; inset:0; background:rgba(61,67,86,.28);
  opacity:0; pointer-events:none; transition:opacity .2s; z-index:9;
  backdrop-filter:blur(2px); -webkit-backdrop-filter:blur(2px);
}
#sheet{
  position:fixed; left:0; right:0; bottom:0; z-index:10;
  background:var(--surface); border-radius:26px 26px 0 0;
  padding:12px 20px calc(26px + env(safe-area-inset-bottom));
  transform:translateY(105%); transition:transform .3s cubic-bezier(.32,.72,.28,1);
  max-height:88vh; overflow-y:auto;
  box-shadow:0 -12px 40px rgba(61,67,86,.14);
}
body.sheet-open #overlay{opacity:1; pointer-events:auto}
body.sheet-open #sheet{transform:translateY(0)}
#sheet .grip{width:40px; height:5px; border-radius:3px; background:var(--line); margin:0 auto 16px}
#sheet h2{font-size:17px; font-weight:700; margin-bottom:18px}

.field{margin-bottom:15px}
.field label{display:block; font-size:12px; color:var(--muted); margin-bottom:7px; font-weight:500}
input[type=text],input[type=datetime-local],input[type=date],input[type=password],select{
  width:100%; padding:12px 14px; border-radius:14px;
  background:var(--surface2); border:1.5px solid transparent; color:var(--ink);
  font-size:16px; font-family:var(--round); appearance:none;
  color-scheme:light;
  transition:border-color .15s, background .15s;
}
/* iOSで未入力のdate inputが縮まないよう高さを固定 */
input[type=date]{height:48px; min-height:48px}
select{height:48px}
input:focus,select:focus{outline:none; border-color:var(--coral); background:#fff}
input::placeholder{color:#B9C0CF}
.row{display:flex; gap:10px}
.row .field{flex:1}
.dt-row{display:flex; gap:8px}
.dt-row input[type=date]{flex:1.3}
.dt-row select{flex:1}

.switch-row{
  display:flex; align-items:center; justify-content:space-between;
  padding:13px 14px; border-radius:14px; background:var(--surface2);
  margin-bottom:15px;
}
.switch-row span{font-size:14px; font-weight:500}
.switch-row .sub{display:block; font-size:11px; color:var(--muted); margin-top:3px; font-weight:400}
.toggle{position:relative; width:50px; height:30px; flex:none}
.toggle input{position:absolute; opacity:0; width:100%; height:100%; cursor:pointer; z-index:1}
.toggle .knob{position:absolute; inset:0; border-radius:15px; background:#D8DDE8; transition:background .18s}
.toggle .knob::after{
  content:""; position:absolute; top:3px; left:3px; width:24px; height:24px;
  border-radius:50%; background:#fff; transition:transform .18s;
  box-shadow:0 2px 5px rgba(61,67,86,.2);
}
.toggle input:checked + .knob{background:var(--coral)}
.toggle input:checked + .knob::after{transform:translateX(20px)}
.toggle input:disabled + .knob{opacity:.4}

.vib{display:inline-flex; align-items:center; gap:2px; margin-right:8px; vertical-align:-2px}
.vib i{display:block; width:2.5px; border-radius:2px; background:var(--coral)}
.vib i:nth-child(1){height:7px}.vib i:nth-child(2){height:12px}.vib i:nth-child(3){height:7px}

.btns{display:flex; gap:10px; margin-top:22px; flex-wrap:wrap}
.btns > button{min-width:84px}
button.primary,button.ghost,button.danger{
  flex:1; padding:14px; border-radius:16px; font-size:15px; font-weight:700;
  border:none; cursor:pointer;
  transition:transform .12s, opacity .12s;
}
button.primary{background:var(--coral); color:#fff; box-shadow:0 6px 16px rgba(var(--accent-rgb),.35)}
button.ghost{background:var(--surface2); color:var(--ink)}
button.danger{background:transparent; color:var(--danger); border:1.5px solid #F4CACA}
button.primary:active,button.ghost:active,button.danger:active{transform:scale(.97); opacity:.85}

/* 設定タブ */
.tabs{display:flex; gap:6px; background:var(--surface2); border-radius:999px; padding:4px; margin-bottom:18px}
.tabs button{
  flex:1; padding:9px; border:none; border-radius:999px; background:transparent;
  font-size:13.5px; font-weight:500; color:var(--muted); cursor:pointer;
}
.tabs button.on{background:#fff; color:var(--ink); font-weight:700; box-shadow:var(--shadow-sm)}
.set-group{font-size:12px; color:var(--muted); font-weight:500; margin:4px 0 8px}

/* タグ管理 */
.tag-row{
  display:flex; align-items:center; gap:10px;
  padding:10px 12px; border-radius:14px; background:var(--surface2);
  margin-bottom:10px;
}
.tag-row input[type=color]{
  width:36px; height:36px; border:none; border-radius:10px; padding:0;
  background:transparent; cursor:pointer; flex:none;
}
.tag-row input[type=color]::-webkit-color-swatch-wrapper{padding:2px}
.tag-row input[type=color]::-webkit-color-swatch{border:none; border-radius:8px}
.tag-row input[type=text]{flex:1; padding:9px 10px; font-size:15px; background:#fff; min-width:0}
/* 長押しドラッグで並び替え中の行 */
.dragging{
  position:relative; z-index:5; background:#fff;
  box-shadow:var(--shadow); border-radius:14px; opacity:.97;
  touch-action:none;
}
/* 並び替え対象の行は長押し時の文字選択・コールアウトを抑止 */
.tag-row,.anv-row,.todo-row{
  -webkit-user-select:none; user-select:none; -webkit-touch-callout:none;
}
.tag-bell{
  width:38px; height:40px; flex:none; border:none; border-radius:10px;
  background:var(--surface2); font-size:14px; cursor:pointer;
  filter:grayscale(1); opacity:.45;
}
.tag-rest{
  width:38px; height:40px; flex:none; border:none; border-radius:10px;
  background:var(--surface2); color:var(--muted);
  font-family:var(--round); font-size:12px; font-weight:700; cursor:pointer;
  opacity:.5;
}
.tag-rest.on{opacity:1; background:var(--coral-soft); color:var(--coral-deep)}
.tag-bell.on{filter:none; opacity:1; background:var(--coral-soft)}
.tag-row .tag-del{
  width:32px; height:32px; flex:none; border:none; border-radius:50%;
  background:transparent; color:var(--danger); font-size:17px; cursor:pointer;
}
#tagAdd{
  width:100%; padding:12px; border:1.5px dashed #D2D9E6; border-radius:14px;
  background:transparent; color:var(--muted); font-size:14px; font-weight:500; cursor:pointer;
  margin-bottom:4px;
}

#toast{
  position:fixed; left:50%; bottom:calc(96px + env(safe-area-inset-bottom));
  transform:translateX(-50%) translateY(10px);
  background:var(--ink); color:#fff; z-index:20;
  padding:11px 20px; border-radius:999px; font-size:13.5px; font-weight:500;
  opacity:0; pointer-events:none; transition:.25s; white-space:nowrap;
  box-shadow:var(--shadow);
}
#toast.show{opacity:1; transform:translateX(-50%) translateY(0)}

/* ===== チェックリスト ===== */
#listsList,#itemsList{max-height:46vh; overflow-y:auto; -webkit-overflow-scrolling:touch}
.lt-row{
  display:flex; align-items:center; gap:10px;
  padding:13px 4px; cursor:pointer;
}
.lt-row + .lt-row{border-top:1px solid #F0F2F7}
.lt-row:active{background:var(--surface2)}
.lt-body{flex:1; display:flex; align-items:baseline; gap:10px; min-width:0}
.lt-name{font-size:14.5px; font-weight:700; overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
.lt-count{
  font-size:11px; color:var(--muted); font-family:var(--mono);
  font-variant-numeric:tabular-nums; flex:none;
}
.lt-del{
  border:none; background:transparent; color:var(--muted);
  font-size:19px; line-height:1; padding:4px 6px; cursor:pointer; flex:none;
}
.empty-note{padding:22px 4px; text-align:center; color:var(--muted); font-size:12.5px}

/* ===== その日の記録 ===== */
#lgMood{display:flex; gap:6px}
.mood{
  flex:1; padding:9px 2px; border:none; border-radius:12px;
  background:var(--surface2); color:var(--muted);
  font-size:10.5px; font-weight:700; cursor:pointer;
  transition:background .16s, color .16s;
}
.mood.on{background:rgba(var(--accent-rgb),.16); color:var(--coral-deep)}
.mood:active{transform:scale(.94)}
#logHistory{margin-top:18px; max-height:34vh; overflow-y:auto; -webkit-overflow-scrolling:touch}
.lg-head{font-size:11px; font-weight:700; color:var(--muted); letter-spacing:.06em; padding:0 4px 6px}
.lg-row{
  display:flex; align-items:baseline; gap:9px;
  padding:10px 4px; cursor:pointer; font-size:12.5px;
}
.lg-row + .lg-row{border-top:1px solid #F0F2F7}
.lg-row:active{background:var(--surface2)}
.lg-date{
  font-family:var(--mono); font-variant-numeric:tabular-nums;
  color:var(--muted); flex:none; width:44px;
}
.lg-mood{color:var(--coral-deep); font-weight:700; flex:none; width:44px; font-size:11px}
.lg-text{flex:1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap}

/* ===== 読み込み中 ===== */
/* 起動時、まだ何も描けるものが無いときに全面へ出す */
#loading{
  position:fixed; inset:0; z-index:11;
  display:flex; flex-direction:column; align-items:center; justify-content:center; gap:16px;
  background:var(--bg);
  transition:opacity .3s ease;
}
#loading.fade{opacity:0; pointer-events:none}
#loading .spinner{
  width:34px; height:34px; border-radius:50%;
  border:3px solid rgba(var(--accent-rgb),.18);
  border-top-color:rgb(var(--accent-rgb));
  animation:spin .8s linear infinite;
}
#loading p{
  font-size:12.5px; font-weight:700; color:var(--muted); letter-spacing:.08em;
}
@keyframes spin{to{transform:rotate(1turn)}}

/* キャッシュを出したあと、裏で更新している間だけ上端に細く出す */
#refreshBar{
  position:fixed; top:env(safe-area-inset-top); left:0; right:0;
  height:2px; z-index:12; overflow:hidden;
  background:rgba(var(--accent-rgb),.16);
}
#refreshBar::after{
  content:""; position:absolute; top:0; bottom:0; width:40%;
  background:rgb(var(--accent-rgb));
  animation:refreshSlide 1.1s ease-in-out infinite;
}
@keyframes refreshSlide{
  0%{left:-40%}
  100%{left:100%}
}

@media (prefers-reduced-motion:reduce){
  #sheet,#overlay,#toast,#fab,#cal,.toggle .knob,.toggle .knob::after{transition:none}
  #loading .spinner{animation-duration:2.4s}
  #refreshBar::after{animation-duration:3s}
}
