/* ミニマルToDo — スタイル */
:root {
  --bg: #f2f2ef;
  --card: #ffffff;
  --fg: #1b1b1d;
  --sub: #a3a3a6;
  --sub2: #c6c6c8;
  --hairline: #e7e7e4;
  --pill: #4a4a4c;
  --toolbar: #3d3d3f;
  --toolbar-hi: #59595c;
  --red: #e5484d;
  --blue: #2f6bff;
  --sheet-r: 22px;
  --ease-sheet: cubic-bezier(0.32, 0.72, 0, 1);
}

.theme-dark {
  --bg: #161618;
  --card: #232326;
  --fg: #ececee;
  --sub: #86868a;
  --sub2: #5a5a5e;
  --hairline: #313134;
  --pill: #4a4a4c;
  --toolbar: #2c2c2e;
  --toolbar-hi: #4c4c50;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  /* ページ全体は動かさない（スクロールは中の各画面で）。iPhone でキーボードが出たときのずれを防ぐ */
  position: fixed;
  inset: 0;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;
  background: var(--bg);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
  touch-action: manipulation;
}
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input, textarea { font: inherit; color: var(--fg); }
.hidden { display: none !important; }

#app {
  max-width: 560px;
  margin: 0 auto;
  height: 100dvh;
  position: relative;
  overflow: hidden;
}

.view {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: calc(10px + env(safe-area-inset-top)) 0 0;
  animation: view-in 0.18s ease;
}
@keyframes view-in { from { opacity: 0.4; } to { opacity: 1; } }

/* ---------- ヘッダー ---------- */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 20px 6px;
  min-height: 56px;
  flex-shrink: 0;
}

.page-title {
  font-size: 27px;
  font-weight: 800;
  letter-spacing: 0.2px;
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: 60%;
  overflow: hidden;
  white-space: nowrap;
  text-align: left;
}
.page-title .chev { font-size: 15px; font-weight: 600; color: var(--fg); transform: translateY(2px); }
.page-title.static { cursor: default; }
.page-title:active:not(.static) { opacity: 0.55; }

.header-pill {
  background: var(--pill);
  border-radius: 999px;
  display: flex;
  align-items: center;
  padding: 4px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.12);
}
.header-pill.light { background: var(--card); box-shadow: 0 1px 6px rgba(0,0,0,0.07); }
.pill-icon {
  width: 42px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 999px;
}
.pill-icon svg { width: 19px; height: 19px; stroke: #fff; }
.pill-icon.dark svg { stroke: var(--fg); }
.pill-icon:active { opacity: 0.6; }
.plain-icon { width: 40px; height: 40px; display: grid; place-items: center; }
.plain-icon svg { width: 20px; height: 20px; stroke: var(--fg); }

/* ---------- 検索バー ---------- */
.search-bar { display: flex; gap: 10px; padding: 2px 20px 10px; align-items: center; }
.search-bar input {
  flex: 1;
  background: var(--card);
  border: none;
  border-radius: 12px;
  padding: 10px 14px;
  outline: none;
}
.search-bar button { color: var(--sub); font-size: 14px; }

/* ---------- タスクリスト ---------- */
.task-scroll { flex: 1; overflow-y: auto; padding: 4px 0 150px; position: relative; }

.ml-task-list { list-style: none; }

.ml-task {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 13px 20px;
  position: relative;
  background: var(--bg);
  transition: transform 0.25s var(--ease-sheet), opacity 0.3s;
  will-change: transform;
}
.ml-task.dragging { opacity: 0.35; }
.ml-task.drag-ghost {
  position: fixed;
  z-index: 60;
  pointer-events: none;
  box-shadow: 0 8px 28px rgba(0,0,0,0.18);
  background: var(--card);
  border-radius: 12px;
  opacity: 0.95;
  width: auto;
}
.ml-task.removing { transform: translateX(-110%); opacity: 0; }
.ml-task.swipe-done-flash { animation: doneflash 0.35s ease; }
@keyframes doneflash { 30% { transform: translateX(46px); } 100% { transform: translateX(0); } }

.ml-check {
  width: 21px;
  height: 21px;
  border: 1.6px solid var(--sub2);
  border-radius: 5px;
  flex-shrink: 0;
  margin-top: 2px;
  display: grid;
  place-items: center;
  color: transparent;
  font-size: 13px;
  font-weight: 700;
  transition: border-color 0.18s, color 0.18s, transform 0.18s;
}
.round-check .ml-check { border-radius: 50%; }
.ml-task:active .ml-check { transform: scale(0.9); }
.ml-task.done .ml-check { background: var(--sub2); border-color: var(--sub2); color: #fff; }
.pstar { margin-right: 5px; font-size: 14px; }
.ml-check.colorful { border-color: var(--tc, var(--sub2)); }

.ml-task-body { flex: 1; min-width: 0; }
.ml-task-title {
  font-size: 18px;
  font-weight: var(--task-fw, 400);
  line-height: 1.4;
  word-break: break-word;
  position: relative;
  display: inline-block;
  transition: color 0.25s;
}
/* 完了時の取り消し線をアニメーションで伸ばす */
.ml-task-title::after {
  content: "";
  position: absolute;
  left: 0;
  top: 54%;
  height: 1.5px;
  width: 0;
  background: var(--sub);
  transition: width 0.3s ease;
}
.ml-task.done .ml-task-title { color: var(--sub); }
.ml-task.done .ml-task-title::after { width: 100%; }

.ml-task-meta { font-size: 12.5px; color: var(--sub); margin-top: 3px; display: flex; gap: 8px; flex-wrap: wrap; }
.ml-task-meta .today { color: var(--red); }
.ml-task-meta .overdue { color: var(--red); }

.empty-hint {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--sub2);
  font-size: 15px;
  pointer-events: none;
}

.drop-zone {
  margin: 4px 16px;
  padding: 14px;
  text-align: center;
  color: var(--sub);
  font-size: 13px;
  border-top: 1.5px solid var(--fg);
}
.drop-zone.bottom { border-top: none; border-bottom: 1.5px solid var(--fg); }

/* プルダウン追加のヒント */
.pull-hint {
  text-align: center;
  color: var(--sub2);
  font-size: 13px;
  height: 0;
  overflow: hidden;
}

/* ---------- FAB ---------- */
.fab {
  position: absolute;
  right: 22px;
  bottom: calc(112px + env(safe-area-inset-bottom));
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #111;
  color: #fff;
  font-size: 30px;
  font-weight: 200;
  line-height: 1;
  box-shadow: 0 6px 18px rgba(0,0,0,0.25);
  transition: transform 0.15s ease;
  z-index: 10;
}
.fab:active { transform: scale(0.88); }
.theme-dark .fab { background: #fff; color: #111; }

/* ---------- ツールバー ---------- */
.toolbar {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: calc(16px + env(safe-area-inset-bottom));
  background: var(--toolbar);
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.28);
  z-index: 10;
}
.tb-btn {
  flex: 1 1 0;
  min-width: 0;
  max-width: 58px;
  height: 48px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  position: relative;
  transition: background 0.25s ease;
}
.tb-btn svg { width: 21px; height: 21px; stroke: #fff; opacity: 0.95; }
.tb-btn.active { background: var(--toolbar-hi); }
.tb-btn .dot {
  position: absolute;
  top: 8px;
  right: 11px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--red);
}

/* ---------- 集中タイマー ---------- */
.seg-wrap { display: flex; justify-content: center; margin-top: -4px; }
.seg {
  background: rgba(0,0,0,0.055);
  border-radius: 999px;
  padding: 3px;
  display: flex;
}
.theme-dark .seg { background: rgba(255,255,255,0.08); }
.seg button {
  font-size: 12.5px;
  padding: 6px 16px;
  border-radius: 999px;
  color: var(--sub);
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}
.seg button.on { background: var(--card); color: var(--fg); font-weight: 600; box-shadow: 0 1px 4px rgba(0,0,0,0.12); }

.tag-chip-wrap { display: flex; justify-content: center; margin-top: 22px; }
.tag-chip {
  font-size: 12.5px;
  color: var(--sub);
  background: rgba(0,0,0,0.05);
  border-radius: 999px;
  padding: 6px 14px;
  max-width: 70%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.theme-dark .tag-chip { background: rgba(255,255,255,0.08); }

.ring-wrap {
  position: relative;
  width: min(62vw, 270px);
  margin: 4vh auto 0;
}
.ring-wrap svg { width: 100%; display: block; transform: rotate(0deg); }
.ring-track { fill: none; stroke: var(--hairline); stroke-width: 2; }
.theme-dark .ring-track { stroke: #333; }
.ring-prog {
  fill: none;
  stroke: var(--fg);
  stroke-width: 2;
  stroke-linecap: round;
  transform: rotate(-90deg);
  transform-origin: center;
  transition: stroke-dashoffset 1s linear;
}
.ring-dot { fill: var(--fg); transition: transform 1s linear; transform-origin: center; }
.ring-time {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: clamp(44px, 14vw, 60px);
  font-weight: 300;
  letter-spacing: 1px;
  font-variant-numeric: tabular-nums;
}

.focus-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 26px;
  margin-top: 4vh;
}
.round-btn {
  border-radius: 50%;
  background: var(--card);
  display: grid;
  place-items: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  transition: transform 0.15s ease;
}
.round-btn:active { transform: scale(0.88); }
.round-btn.small { width: 46px; height: 46px; }
.round-btn.small svg { width: 18px; height: 18px; stroke: var(--fg); }
.round-btn.big { width: 62px; height: 62px; background: var(--fg); }
.round-btn.big svg { width: 22px; height: 22px; stroke: var(--bg); fill: var(--bg); }

/* ---------- カレンダー ---------- */
.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  padding: 0 14px;
  margin-top: 4px;
}
.cal-weekdays span { text-align: center; font-size: 11.5px; color: var(--sub); padding: 6px 0; }

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  padding: 0 14px;
  row-gap: 6px;
}
.cal-day {
  aspect-ratio: 1 / 0.92;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  border-radius: 14px;
  position: relative;
  transition: background 0.15s;
}
.cal-day.other { color: var(--sub2); }
.cal-day.selected { outline: 1.6px solid var(--fg); }
.cal-day.today { background: var(--fg); color: var(--bg); }
.cal-day .mark {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--sub);
  position: absolute;
  bottom: 7px;
}
.cal-day.today .mark { background: var(--bg); }

.cal-day .mark.ev { background: var(--fg); }
.cal-day .marks { position: absolute; bottom: 7px; display: flex; gap: 3px; }
.cal-day .marks .mark { position: static; }

.cal-sep { border-top: 1px solid var(--hairline); margin: 10px 20px 4px; }
.cal-day-list { overflow-y: auto; flex: 1; padding-bottom: 150px; }
.cal-tasks { padding-bottom: 0; }
.cal-empty { text-align: center; color: var(--sub2); font-size: 14px; margin-top: 40px; }
.cal-empty-sm { color: var(--sub2); font-size: 13.5px; padding: 6px 22px 10px; }
.cal-sec-title { font-size: 12px; font-weight: 700; color: var(--sub); padding: 10px 22px 4px; letter-spacing: 0.04em; }

/* Google カレンダーの予定（タスクとは別の見た目: 左に細い線） */
.cal-events { list-style: none; padding: 0 14px; }
.cal-event {
  display: flex; gap: 12px; align-items: flex-start; width: 100%; text-align: left;
  padding: 10px 12px; margin: 4px 0; border-radius: 14px; background: var(--card);
}
.cal-event .bar { width: 3px; align-self: stretch; border-radius: 2px; background: var(--fg); }
.cal-event .when { font-size: 12.5px; color: var(--sub); min-width: 44px; padding-top: 1px; }
.cal-event .ttl { font-size: 15px; line-height: 1.35; }
.cal-event .sub { font-size: 12px; color: var(--sub); margin-top: 2px; }

.cal-connect { margin: 8px 14px 4px; padding: 14px; border-radius: 16px; background: var(--card); font-size: 13.5px; color: var(--sub); }
.cal-connect .black-pill { margin-top: 10px; }

/* 予定の編集シート */
.ev-row { display: flex; gap: 8px; align-items: center; margin: 8px 0; }
.ev-row label { flex: 0 0 64px; font-size: 13.5px; color: var(--sub); }
.ev-row input[type="date"], .ev-row input[type="time"] { flex: 1; }
.ev-del { width: 100%; margin-top: 10px; padding: 12px; border-radius: 14px; color: var(--red); background: var(--bg); }

.login-error { color: var(--red); font-size: 14px; margin-top: 14px; line-height: 1.5; }

/* ---------- 履歴 ---------- */
.history-body { flex: 1; overflow-y: auto; padding: 4px 20px 150px; }
.h-date { color: var(--sub); font-size: 14px; margin: 14px 0 4px; }
.h-item { padding: 8px 0; }
.h-item .h-title { font-size: 19px; }
.h-item .h-sub { font-size: 12.5px; color: var(--sub); margin-top: 3px; }
.h-empty { color: var(--sub2); text-align: center; margin-top: 60px; font-size: 14px; }

/* ---------- モーダルシート（設定・サブ画面共通の様式） ---------- */
.modal-view {
  position: fixed;
  left: 0;
  right: 0;
  top: var(--vvtop, 0px);
  height: var(--vvh, 100%);
  z-index: 33;
  background: rgba(60, 60, 62, 0.55);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  max-width: 560px;
  margin: 0 auto;
  padding: 0;
}
.page-sheet {
  background: var(--bg);
  border-radius: var(--sheet-r) var(--sheet-r) 0 0;
  height: calc(var(--vvh, 100dvh) - 58px - env(safe-area-inset-top));
  display: flex;
  flex-direction: column;
  animation: page-up 0.3s var(--ease-sheet);
  overflow: hidden;
}
.ps-head {
  display: flex;
  align-items: center;
  padding: 16px 18px 12px;
  flex-shrink: 0;
}
.ps-head h1 { flex: 1; text-align: center; font-size: 17.5px; font-weight: 800; }
.ps-x, .ps-sp { width: 44px; }
.ps-x { font-size: 20px; text-align: left; padding: 4px 0; }
.ps-x.circle, .ps-ok.circle {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--pill);
  color: #fff;
  font-size: 19px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 0;
}
.ps-body { flex: 1; overflow-y: auto; padding: 4px 16px 40px; }

/* スタジアム型の単独行 */
.pg-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border-radius: 999px;
  padding: 16px 22px;
  font-size: 15.5px;
  text-align: left;
  margin-bottom: 12px;
}
.pg-row .grow { flex: 1; }
.pg-row .val { color: var(--sub); font-size: 14px; }
.pg-hint {
  font-size: 12px;
  color: var(--sub);
  line-height: 1.7;
  padding: 0 22px 14px;
  margin-top: -4px;
}
/* まとまりのカード（区切り線なし・背の高い行） */
.pg-card {
  background: var(--card);
  border-radius: 24px;
  padding: 6px 0;
  margin-bottom: 14px;
}
.pg-card .pg-row { background: none; border-radius: 0; margin: 0; padding: 14px 22px; }
.pg-input {
  width: 100%;
  background: var(--card);
  border: none;
  border-radius: 999px;
  padding: 16px 22px;
  outline: none;
  font-size: 16px;
  margin-bottom: 16px;
}
.pg-danger { display: block; margin: 8px auto; color: var(--red); font-size: 15px; padding: 10px; }

/* ---------- 設定 ---------- */
.settings-body { flex: 1; overflow-y: auto; padding: 2px 16px 60px; }
.set-card {
  background: var(--card);
  border-radius: 22px;
  margin-bottom: 16px;
  overflow: hidden;
  padding: 5px 0;
}
.set-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14.5px 20px;
  font-size: 15.5px;
  text-align: left;
}
.set-row .ic { width: 21px; height: 21px; flex-shrink: 0; display: grid; place-items: center; }
.set-row .ic svg { width: 20px; height: 20px; stroke: var(--fg); }
.set-row .grow { flex: 1; }
.set-row .val { color: var(--sub); font-size: 14px; }
.set-row .chev-r { color: var(--sub2); font-size: 16px; }
.set-user { padding: 16px; }
.set-user .avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--fg);
  color: var(--bg);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 18px;
}
.set-user .name { font-weight: 700; font-size: 16px; }
.set-user .sub { color: var(--sub); font-size: 12.5px; margin-top: 2px; }

/* トグルスイッチ */
.tgl {
  width: 46px;
  height: 28px;
  border-radius: 999px;
  background: var(--sub2);
  position: relative;
  transition: background 0.2s;
  flex-shrink: 0;
}
.tgl::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
  transition: transform 0.2s var(--ease-sheet);
}
.tgl.on { background: var(--fg); }
.tgl.on::after { transform: translateX(18px); }

/* ---------- エディター ---------- */
.editor {
  position: fixed;
  left: 0;
  right: 0;
  top: var(--vvtop, 0px);
  height: var(--vvh, 100%);
  background: var(--bg);
  z-index: 40;
  display: flex;
  flex-direction: column;
  animation: ed-in 0.25s var(--ease-sheet);
  max-width: 560px;
  margin: 0 auto;
}
@keyframes ed-in { from { transform: translateY(30%); opacity: 0; } to { transform: none; opacity: 1; } }

.editor-body { flex: 1; overflow-y: auto; padding: calc(18px + env(safe-area-inset-top)) 22px 20px; }
.ed-title {
  width: 100%;
  border: none;
  background: none;
  outline: none;
  font-size: 21px;
  padding: 8px 0 14px;
}
.ed-title::placeholder { color: var(--sub2); }
.ed-line { border-top: 1px solid var(--hairline); }
.ed-row { display: flex; align-items: center; gap: 10px; padding: 13px 0; }
.ed-row input[type="text"] { flex: 1; border: none; background: none; outline: none; font-size: 15.5px; }
.ed-row input::placeholder, .ed-placeholder { color: var(--sub2); }
.ed-row input[type="date"], .ed-row input[type="time"] {
  border: none;
  background: rgba(0,0,0,0.05);
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 14px;
  outline: none;
}
.theme-dark .ed-row input[type="date"], .theme-dark .ed-row input[type="time"] { background: rgba(255,255,255,0.08); }
.ed-clear { color: var(--sub); padding: 4px 8px; }
.ed-ic { width: 18px; height: 18px; display: grid; place-items: center; flex-shrink: 0; }
.ed-ic svg { width: 16px; height: 16px; stroke: var(--sub); }
.ed-ic.box { width: 18px; height: 18px; border: 1.5px solid var(--sub2); border-radius: 4px; }
.ed-sub-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; }
.ed-sub-row .ml-check { margin-top: 0; }
.ed-sub-row input { flex: 1; border: none; background: none; outline: none; font-size: 15px; }
.ed-sub-row .ed-sub-del { color: var(--sub2); padding: 2px 6px; }
.ed-sub-row.done input { color: var(--sub); text-decoration: line-through; }

/* キーボードアクセサリー風ツールバー */
.editor-bar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 8px 12px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--hairline);
  background: var(--card);
}
.ed-tool {
  flex: 1;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: var(--fg);
  font-size: 16px;
}
.ed-tool svg { width: 20px; height: 20px; stroke: var(--fg); }
.ed-tool:active { background: var(--bg); }
.ed-tool.rec { background: rgba(229,72,77,0.1); }
.ed-tool.rec svg { stroke: var(--red); animation: mic-pulse 1s ease infinite; }
.ed-div { width: 1px; height: 20px; background: var(--hairline); flex-shrink: 0; }
.ed-save {
  background: var(--blue);
  color: #fff;
  width: 84px;
  height: 42px;
  border-radius: 10px;
  font-size: 19px;
  font-weight: 700;
  flex-shrink: 0;
  margin-left: 8px;
}

/* ---------- オーバーレイ共通 ---------- */
.dim {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.32);
  z-index: 30;
  opacity: 1;
  transition: opacity 0.25s;
}
.dim.clear { background: transparent; }

/* ドロップダウン（リスト切替） */
.dropdown {
  position: fixed;
  z-index: 60;
  background: var(--card);
  border-radius: 14px;
  box-shadow: 0 10px 36px rgba(0,0,0,0.16);
  padding: 6px;
  min-width: 190px;
  animation: pop-in 0.18s var(--ease-sheet);
  transform-origin: top left;
}
@keyframes pop-in { from { transform: scale(0.7); opacity: 0; } to { transform: none; opacity: 1; } }
.dd-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  font-size: 15px;
  border-radius: 9px;
  text-align: left;
}
.dd-row:active { background: var(--bg); }
.dd-row .mark { width: 16px; text-align: center; font-size: 13px; }

/* コンテキストメニュー（⋯） */
.ctx-menu {
  position: fixed;
  z-index: 60;
  background: var(--card);
  border-radius: 14px;
  box-shadow: 0 10px 36px rgba(0,0,0,0.18);
  padding: 5px;
  min-width: 230px;
  animation: pop-in 0.18s var(--ease-sheet);
  transform-origin: top right;
}
.ctx-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  font-size: 14.5px;
  border-radius: 9px;
  text-align: left;
}
.ctx-row:active { background: var(--bg); }
.ctx-row .ic { width: 18px; height: 18px; display: grid; place-items: center; }
.ctx-row .ic svg { width: 16px; height: 16px; stroke: var(--fg); }
.ctx-row.danger, .ctx-row.danger .ic svg { color: var(--red); stroke: var(--red); }
.ctx-sep { border-top: 1px solid var(--hairline); margin: 4px 10px; }

/* ボトムシート */
.sheet {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: var(--kb, 0px); /* キーボードが出ていたら、その上に */
  width: 100%;
  max-width: 560px;
  background: var(--card);
  border-radius: var(--sheet-r) var(--sheet-r) 0 0;
  z-index: 36;
  padding: 14px 20px calc(24px + env(safe-area-inset-bottom));
  animation: sheet-up 0.3s var(--ease-sheet);
  max-height: calc(var(--vvh, 100dvh) * 0.88);
  overflow-y: auto;
}
@keyframes sheet-up { from { transform: translate(-50%, 100%); } to { transform: translate(-50%, 0); } }
/* 設定・ページ（横方向は中央寄せの変形をしていないので、縦だけ動かす） */
@keyframes page-up { from { transform: translateY(100%); } to { transform: none; } }
/* 中央寄せに transform を使っているもの（確認・トースト）は、その寄せを保ったまま出す */
@keyframes alert-in { from { transform: translate(-50%, -50%) scale(0.7); opacity: 0; } to { transform: translate(-50%, -50%); opacity: 1; } }
@keyframes toast-in { from { transform: translateX(-50%) scale(0.7); opacity: 0; } to { transform: translateX(-50%); opacity: 1; } }
.sheet .grab { width: 44px; height: 4px; background: var(--sub2); border-radius: 4px; margin: 0 auto 12px; }
.sheet h2 { font-size: 17px; font-weight: 700; text-align: center; margin-bottom: 14px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.sheet-head h2 { margin: 0; flex: 1; }
.sheet-head .x, .sheet-head .ok { width: 38px; height: 38px; border-radius: 50%; background: var(--bg); display: grid; place-items: center; font-size: 16px; }

.sheet .field-input {
  width: 100%;
  background: var(--bg);
  border: none;
  border-radius: 10px;
  padding: 12px 14px;
  outline: none;
  margin-bottom: 14px;
}
.sheet-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 2px;
  font-size: 15px;
}
.sheet-row .lbl { flex: 1; text-align: left; }
.sheet-row .val { color: var(--sub); font-size: 13.5px; }
.sheet-row + .sheet-row { border-top: 1px solid var(--hairline); }
.sheet .danger-btn { display: block; margin: 18px auto 0; color: var(--red); font-size: 15px; }

/* 共有シート */
.invite-code {
  font-size: 34px;
  font-weight: 800;
  letter-spacing: 7px;
  text-align: center;
  background: var(--bg);
  border-radius: 14px;
  padding: 18px;
  margin: 8px 0 14px;
  user-select: all;
}
.sheet .hint { font-size: 12.5px; color: var(--sub); line-height: 1.7; text-align: center; }
.black-pill {
  display: block;
  width: 100%;
  background: var(--fg);
  color: var(--bg);
  border-radius: 999px;
  padding: 15px;
  font-size: 15.5px;
  font-weight: 700;
  text-align: center;
  margin-top: 10px;
  transition: transform 0.12s;
}
.black-pill:active { transform: scale(0.97); }
.ghost-pill {
  display: block;
  width: 100%;
  border-radius: 999px;
  padding: 13px;
  font-size: 14.5px;
  color: var(--sub);
  text-align: center;
}

/* 音楽グリッド */
.music-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px 8px; padding: 6px 0; }
.music-cell { display: flex; flex-direction: column; align-items: center; gap: 7px; font-size: 11.5px; color: var(--sub); }
.music-cell .mc-ic {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--bg);
  display: grid;
  place-items: center;
  font-size: 21px;
  transition: transform 0.12s;
  border: 2px solid transparent;
}
.music-cell.on .mc-ic { background: var(--fg); border-color: var(--fg); }
.music-cell.on .mc-ic span { filter: grayscale(1) brightness(3); }
.music-cell:active .mc-ic { transform: scale(0.9); }

/* タスク詳細カード */
.detail-card {
  position: fixed;
  top: calc(52px + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 20px);
  max-width: 540px;
  background: var(--card);
  border-radius: 18px;
  box-shadow: 0 14px 44px rgba(0,0,0,0.16);
  z-index: 36;
  padding: 6px 0 0;
  animation: card-in 0.22s var(--ease-sheet);
}
@keyframes card-in { from { transform: translate(-50%, -14px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
.dc-title { font-size: 17px; padding: 12px 18px 10px; border-bottom: 1px solid var(--hairline); }
.dc-title.done { color: var(--sub); text-decoration: line-through; }
.dc-row { display: flex; align-items: center; gap: 10px; padding: 11px 18px; font-size: 14.5px; border-bottom: 1px solid var(--hairline); color: var(--fg); }
.dc-row .ed-ic svg { stroke: var(--sub); }
.dc-row.muted { color: var(--sub2); }
.dc-sub { color: var(--sub); font-size: 12px; }
.dc-actions { display: flex; }
.dc-act {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 0 13px;
  font-size: 10px;
  color: var(--sub);
  position: relative;
}
.dc-act svg { width: 19px; height: 19px; stroke: var(--fg); }
.dc-act + .dc-act::before {
  content: "";
  position: absolute;
  left: 0;
  top: 12px;
  bottom: 12px;
  border-left: 1px solid var(--hairline);
}
.dc-act:active { opacity: 0.5; }
.dc-act .fdot { position: absolute; top: 9px; right: 24%; width: 6px; height: 6px; border-radius: 50%; background: var(--red); }

/* アラート（確認ダイアログ） */
.ml-alert {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: calc(100% - 70px);
  max-width: 330px;
  background: var(--card);
  border-radius: 18px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.22);
  z-index: 95;
  padding: 22px 20px 16px;
  text-align: center;
  animation: alert-in 0.2s var(--ease-sheet);
}
.ml-alert .msg { font-size: 14.5px; line-height: 1.65; margin-bottom: 16px; text-align: left; }
.ml-alert .a-btn {
  display: block;
  width: 100%;
  padding: 12px;
  border-radius: 12px;
  font-size: 14.5px;
  margin-top: 8px;
  background: var(--bg);
}
.ml-alert .a-btn.warn { color: var(--red); background: rgba(229,72,77,0.08); }
.ml-alert .a-row { display: flex; gap: 10px; }
.ml-alert .a-row .a-btn { flex: 1; }
.ml-alert .a-btn.primary { background: var(--fg); color: var(--bg); font-weight: 700; }

/* トースト */
.toast {
  position: fixed;
  bottom: calc(120px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  background: rgba(20,20,22,0.92);
  color: #fff;
  font-size: 13px;
  padding: 10px 20px;
  border-radius: 20px;
  z-index: 100;
  width: max-content;
  max-width: calc(100% - 32px); /* 長い文は折り返して、画面からはみ出さない */
  text-align: center;
  line-height: 1.5;
  animation: toast-in 0.2s ease;
}

/* ---------- オンボーディング ---------- */
.onboarding {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 80;
  display: flex;
  flex-direction: column;
  max-width: 560px;
  margin: 0 auto;
}
.ob-slide {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px 34px;
  text-align: center;
  animation: view-in 0.3s ease;
}
.ob-art { width: 64%; max-width: 250px; margin-bottom: 34px; }
.ob-slide h1 { font-size: 24px; font-weight: 800; margin-bottom: 10px; }
.ob-slide .ob-sub { color: var(--sub); font-size: 14px; line-height: 1.8; }
.ob-slide input {
  width: 100%;
  background: var(--card);
  border: none;
  border-radius: 14px;
  padding: 15px 16px;
  outline: none;
  text-align: center;
  font-size: 16px;
  margin-top: 26px;
}
.ob-choices { display: flex; flex-direction: column; gap: 11px; width: 100%; margin-top: 8px; }
.ob-choice {
  border: 1.4px solid var(--hairline);
  background: var(--card);
  border-radius: 999px;
  padding: 13px 18px;
  font-size: 14px;
  transition: border-color 0.15s, transform 0.1s;
}
.ob-choice.on { border-color: var(--fg); border-width: 2px; font-weight: 600; }
.ob-choice:active { transform: scale(0.97); }
.ob-footer { padding: 0 30px calc(30px + env(safe-area-inset-bottom)); }
.ob-next {
  display: block;
  width: 100%;
  background: #111;
  color: #fff;
  border-radius: 999px;
  padding: 16px;
  font-size: 15.5px;
  font-weight: 700;
  transition: transform 0.12s;
}
.ob-next:active { transform: scale(0.97); }
.ob-checks { text-align: left; margin-top: 20px; font-size: 13.5px; line-height: 2.1; color: var(--fg); }
.ob-checks .ck { color: #2fa36b; margin-right: 8px; }

/* ---------- チュートリアル ---------- */
.tutorial {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: 100%;
  max-width: 560px;
  height: 62dvh;
  background: var(--card);
  border-radius: var(--sheet-r) var(--sheet-r) 0 0;
  z-index: 32;
  display: flex;
  flex-direction: column;
  animation: sheet-up 0.35s var(--ease-sheet);
  box-shadow: 0 -8px 40px rgba(0,0,0,0.1);
}
.tut-top { display: flex; justify-content: center; position: relative; padding: 10px 16px 0; }
.tut-top .grab { width: 44px; height: 4px; background: var(--sub2); border-radius: 4px; }
.tut-hide { position: absolute; right: 18px; top: 12px; color: var(--sub); font-size: 13px; }
.tut-body { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px; overflow: hidden; }
.tut-caption { font-size: 15.5px; font-weight: 600; }
.tut-dots { display: flex; gap: 8px; justify-content: center; padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
.tut-dots span { width: 7px; height: 7px; border-radius: 50%; background: var(--sub2); transition: background 0.2s, transform 0.2s; }
.tut-dots span.on { background: var(--sub); transform: scale(1.15); }

/* チュートリアル用ミニ端末 */
.phone {
  width: 46vw;
  max-width: 210px;
  aspect-ratio: 0.49;
  background: #101012;
  border-radius: 30px;
  padding: 8px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
}
.phone .scr {
  background: #fffdf8;
  border-radius: 23px;
  height: 100%;
  overflow: hidden;
  position: relative;
  padding: 26px 12px 0;
}
.phone .notch {
  position: absolute;
  top: 7px;
  left: 50%;
  transform: translateX(-50%);
  width: 34%;
  height: 12px;
  background: #101012;
  border-radius: 8px;
}
.phone .p-row { font-size: 9.5px; color: #222; padding: 5px 2px; position: relative; }
.phone .p-row .p-sub { font-size: 7px; color: #a3a3a6; margin-top: 1px; }
.phone .p-row.p-done { color: #a3a3a6; text-decoration: line-through; }
.phone .finger {
  position: absolute;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(120,120,125,0.4);
  z-index: 3;
}

/* チュートリアルアニメーション */
.tut-anim-reorder .p-row.target { animation: t-reorder 2.4s ease infinite; background: #fffdf8; position: relative; z-index: 2; }
@keyframes t-reorder { 0%,15% { transform: none; } 40%,70% { transform: translateY(-26px); box-shadow: 0 4px 12px rgba(0,0,0,0.15); } 95%,100% { transform: none; } }
.tut-anim-reorder .finger { animation: t-reorder-f 2.4s ease infinite; left: 40%; top: 34%; }
@keyframes t-reorder-f { 0%,15% { transform: none; opacity: 0; } 20% { opacity: 1; } 40%,70% { transform: translateY(-26px); opacity: 1; } 85%,100% { opacity: 0; } }

.tut-anim-right .p-row.target { animation: t-right 2.2s ease infinite; }
@keyframes t-right { 0%,20% { transform: none; } 45%,60% { transform: translateX(38px); } 85%,100% { transform: none; } }
.tut-anim-right .finger { left: 30%; top: 27%; animation: t-right-f 2.2s ease infinite; }
@keyframes t-right-f { 0%,20% { transform: none; opacity: 0; } 25% { opacity: 1; } 45%,60% { transform: translateX(38px); opacity: 1; } 70%,100% { opacity: 0; } }

.tut-anim-left .p-row.target { animation: t-left 2.2s ease infinite; }
@keyframes t-left { 0%,20% { transform: none; opacity: 1; } 50% { transform: translateX(-70px); opacity: 1; } 60%,75% { transform: translateX(-110%); opacity: 0; } 76% { transform: none; opacity: 0; } 95%,100% { opacity: 1; } }
.tut-anim-left .finger { left: 55%; top: 27%; animation: t-left-f 2.2s ease infinite; }
@keyframes t-left-f { 0%,20% { transform: none; opacity: 0; } 25% { opacity: 1; } 50% { transform: translateX(-60px); opacity: 1; } 60%,100% { opacity: 0; } }

.tut-anim-pull .p-list { animation: t-pull 2.4s ease infinite; }
@keyframes t-pull { 0%,15% { transform: none; } 45%,65% { transform: translateY(30px); } 90%,100% { transform: none; } }
.tut-anim-pull .finger { left: 45%; top: 30%; animation: t-pull-f 2.4s ease infinite; }
@keyframes t-pull-f { 0%,15% { transform: none; opacity: 0; } 20% { opacity: 1; } 45%,65% { transform: translateY(30px); opacity: 1; } 80%,100% { opacity: 0; } }

.tut-anim-up .p-list { animation: t-up 2.4s ease infinite; }
@keyframes t-up { 0%,15% { transform: none; } 45%,65% { transform: translateY(-30px); } 90%,100% { transform: none; } }
.tut-anim-up .finger { left: 45%; top: 55%; animation: t-up-f 2.4s ease infinite; }
@keyframes t-up-f { 0%,15% { transform: none; opacity: 0; } 20% { opacity: 1; } 45%,65% { transform: translateY(-30px); opacity: 1; } 80%,100% { opacity: 0; } }

.tut-anim-edge .p-list { animation: t-edge 2.6s ease infinite; }
@keyframes t-edge { 0%,15% { transform: none; opacity: 1; } 40%,55% { transform: translateX(-55%); opacity: 0.2; } 56% { transform: translateX(55%); opacity: 0; } 75%,100% { transform: none; opacity: 1; } }
.tut-anim-edge .finger { left: 3%; top: 40%; animation: t-edge-f 2.6s ease infinite; }
@keyframes t-edge-f { 0%,15% { transform: none; opacity: 0; } 20% { opacity: 1; } 40%,55% { transform: translateX(-40px); opacity: 1; } 65%,100% { opacity: 0; } }

.tut-anim-hold .finger { left: 42%; top: 55%; animation: t-hold-f 2.2s ease infinite; }
@keyframes t-hold-f { 0%,10% { transform: scale(1); opacity: 0; } 15% { opacity: 1; } 30%,60% { transform: scale(0.82); opacity: 1; } 75%,100% { opacity: 0; } }
.tut-anim-hold .p-menu {
  position: absolute;
  bottom: 18%;
  left: 12%;
  right: 12%;
  background: #fff;
  border-radius: 9px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.18);
  font-size: 7.5px;
  color: #333;
  padding: 4px 0;
  animation: t-menu 2.2s ease infinite;
}
.tut-anim-hold .p-menu div { padding: 3px 9px; }
@keyframes t-menu { 0%,32% { opacity: 0; transform: scale(0.8); } 45%,75% { opacity: 1; transform: none; } 90%,100% { opacity: 0; } }

/* ---------- 課金画面（デモ） ---------- */
.paywall {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 70;
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  animation: ed-in 0.3s var(--ease-sheet);
}
.pw-x {
  position: absolute;
  top: calc(14px + env(safe-area-inset-top));
  left: 16px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--card);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  font-size: 16px;
  z-index: 2;
}
.pw-scroll { flex: 1; overflow-y: auto; padding: calc(24px + env(safe-area-inset-top)) 22px 20px; text-align: center; }
.pw-art { width: 55%; max-width: 210px; margin: 10px auto 6px; display: block; }
.pw-title { font-size: 23px; font-weight: 800; }
.pw-sub { color: var(--sub); font-size: 13px; margin: 8px 0 18px; }
.pw-plans { display: flex; gap: 10px; margin-bottom: 20px; }
.pw-plan {
  flex: 1;
  background: var(--card);
  border: 1.6px solid var(--hairline);
  border-radius: 14px;
  padding: 14px 6px 12px;
  position: relative;
  transition: border-color 0.15s, transform 0.1s;
}
.pw-plan.on { border-color: var(--fg); border-width: 2px; }
.pw-plan:active { transform: scale(0.97); }
.pw-badge {
  position: absolute;
  top: -9px;
  left: 50%;
  transform: translateX(-50%);
  background: #ffd76e;
  color: #6b4d00;
  font-size: 10px;
  font-weight: 800;
  border-radius: 999px;
  padding: 2px 10px;
}
.pw-plan-name { font-size: 12px; color: var(--sub); }
.pw-price { font-size: 20px; font-weight: 800; margin: 5px 0 3px; }
.pw-per { font-size: 10px; color: var(--sub); }
.pw-feats {
  background: var(--card);
  border-radius: 14px;
  padding: 14px 16px;
  text-align: left;
  margin-bottom: 14px;
}
.pw-feats-title { font-size: 13px; font-weight: 800; text-align: center; margin-bottom: 10px; }
.pw-feat { display: flex; align-items: center; gap: 11px; font-size: 13.5px; padding: 6px 0; }
.pw-feat .ic { width: 17px; height: 17px; display: grid; place-items: center; }
.pw-feat .ic svg { width: 16px; height: 16px; stroke: var(--fg); }
.pw-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--card);
  border-radius: 12px;
  padding: 13px 16px;
  font-size: 14px;
  margin-bottom: 8px;
}
.pw-note { font-size: 11px; color: var(--sub2); margin-top: 8px; }
.pw-footer { padding: 10px 22px calc(20px + env(safe-area-inset-bottom)); }
.pw-cta {
  display: block;
  width: 100%;
  background: #ffcf4d;
  color: #402f00;
  border-radius: 999px;
  padding: 16px;
  font-size: 16px;
  font-weight: 800;
  box-shadow: 0 4px 14px rgba(255,207,77,0.5);
  transition: transform 0.12s;
}
.pw-cta:active { transform: scale(0.97); }

/* ---------- ロック画面 ---------- */
.lockscreen {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 90;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
}
.lock-ic { font-size: 44px; }
.lock-msg { color: var(--sub); font-size: 14px; }

/* ---------- エディター追加分 ---------- */
@keyframes mic-pulse { 50% { opacity: 0.4; } }
.ed-repeat-btn { color: var(--sub); font-size: 15px; padding: 2px 0; }

/* ---------- 操作設定モーダル ---------- */
.op-modes { display: flex; gap: 14px; margin-bottom: 14px; }
.op-mode {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  padding: 14px 8px 10px;
  border-radius: 14px;
  border: 1.5px solid var(--hairline);
}
.op-mode.on { border-color: var(--fg); }
.op-mini {
  width: 64px;
  height: 82px;
  background: var(--bg);
  border-radius: 10px;
  padding: 10px 9px;
  position: relative;
}
.op-line { height: 5px; background: var(--sub2); border-radius: 3px; margin-bottom: 8px; opacity: 0.6; }
.op-hand { position: absolute; bottom: 6px; right: 8px; font-size: 15px; }
.op-radio { font-size: 13px; }
.op-style { display: flex; gap: 6px; }
.op-style button {
  width: 36px;
  height: 32px;
  border-radius: 8px;
  border: 1.5px solid var(--hairline);
  font-size: 15px;
  color: var(--sub);
}
.op-style button.on { border-color: var(--fg); color: var(--fg); font-weight: 700; }

/* テーマ設定行のプレビュードット */
.theme-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f2f2ef 50%, #1b1b1d 50%);
  border: 1px solid var(--hairline);
}

/* ---------- ブランドタグ ---------- */
.brand-tag {
  position: absolute;
  top: calc(4px + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  color: var(--sub);
  z-index: 6;
  pointer-events: none;
}

/* ---------- オファーピル（デモ） ---------- */
.offer-pill {
  position: absolute;
  bottom: calc(92px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  font-size: 12px;
  padding: 7px 16px;
  color: var(--fg);
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
  z-index: 9;
  white-space: nowrap;
}
.offer-pill:active { transform: translateX(-50%) scale(0.96); }

/* ---------- 複数選択 ---------- */
.sel-circle {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.6px solid var(--sub2);
  display: grid;
  place-items: center;
  font-size: 12px;
  color: #fff;
  flex-shrink: 0;
  margin-top: 2px;
}
.sel-circle.on { background: var(--fg); border-color: var(--fg); }
.select-bar {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: calc(16px + env(safe-area-inset-bottom));
  background: var(--toolbar);
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  color: #fff;
  font-size: 14px;
  z-index: 11;
  box-shadow: 0 8px 24px rgba(0,0,0,0.28);
}
.select-bar span { flex: 1; font-size: 13px; }
.select-bar button { color: #fff; font-weight: 700; padding: 6px 12px; border-radius: 999px; }
.select-bar button:active { background: var(--toolbar-hi); }
.select-bar .danger { color: #ff8a8e; }

/* ---------- 移動先チップ ---------- */
.drop-move {
  position: fixed;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--card);
  border-radius: 14px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.16);
  padding: 12px 10px;
  font-size: 10.5px;
  color: var(--sub);
  text-align: center;
  line-height: 1.5;
  z-index: 62;
}
.drop-move.hot { background: var(--fg); color: var(--bg); transform: translateY(-50%) scale(1.08); }

/* ---------- リストビュー ---------- */
.lists-view {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 28;
  max-width: 560px;
  margin: 0 auto;
  overflow-y: auto;
  animation: lv-in 0.22s var(--ease-sheet);
  padding: calc(10px + env(safe-area-inset-top)) 16px 40px;
}
@keyframes lv-in { from { transform: scale(1.06); opacity: 0; } to { transform: none; opacity: 1; } }
.lv-head { display: flex; justify-content: space-between; margin-bottom: 14px; }
.lv-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--card);
  display: grid;
  place-items: center;
  box-shadow: 0 1px 6px rgba(0,0,0,0.07);
}
.lv-icon svg { width: 19px; height: 19px; stroke: var(--fg); }
.lv-pill {
  background: var(--card);
  border-radius: 999px;
  display: flex;
  align-items: center;
  padding: 3px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.07);
}
.lv-pill button { width: 46px; height: 38px; display: grid; place-items: center; border-radius: 999px; }
.lv-pill svg { width: 19px; height: 19px; stroke: var(--fg); }
.lv-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.lv-card {
  background: var(--card);
  border-radius: 18px;
  min-height: 96px;
  padding: 14px;
  position: relative;
  text-align: left;
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.12s;
}
.lv-card:active { transform: scale(0.96); }
.lv-count { font-size: 13px; color: var(--sub); }
.lv-name { font-size: 15px; font-weight: 600; }
.lv-more {
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 32px;
  height: 32px;
  border: 1px solid var(--hairline);
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--sub);
  font-size: 15px;
  line-height: 1;
}
.lv-dot { position: absolute; top: 12px; right: 14px; width: 8px; height: 8px; border-radius: 50%; background: var(--red); }
.lv-fab { position: fixed; right: 22px; bottom: calc(30px + env(safe-area-inset-bottom)); }

/* ヘルプの?マーク */
.q {
  display: inline-grid;
  place-items: center;
  width: 15px;
  height: 15px;
  border: 1.2px solid var(--sub2);
  border-radius: 50%;
  font-size: 10px;
  color: var(--sub);
  vertical-align: 1px;
  margin-left: 2px;
}

/* ---------- ジェスチャーモード（クロームレス） ---------- */
.chromeless #view-tasks .page-header { display: none; }
.chromeless #view-tasks .task-scroll { padding-top: calc(14px + env(safe-area-inset-top)); }
.chromeless #fab { display: none !important; }

/* ---------- フォーカス完了カード ---------- */
.focus-done {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 12;
  background: rgba(0,0,0,0.06);
}
.fd-card {
  background: var(--card);
  border-radius: 18px;
  box-shadow: 0 14px 44px rgba(0,0,0,0.18);
  padding: 18px 22px;
  text-align: center;
  animation: pop-in 0.2s var(--ease-sheet);
  min-width: 240px;
}
.fd-trash { display: grid; place-items: center; margin-bottom: 8px; }
.fd-trash svg { width: 20px; height: 20px; stroke: var(--sub); }
.fd-msg { font-size: 14px; margin-bottom: 14px; }
.fd-btns { display: flex; gap: 10px; }
.fd-btns button { flex: 1; padding: 10px; border-radius: 999px; font-size: 13.5px; font-weight: 700; }
.fd-give { background: var(--bg); color: var(--sub); }
.fd-ok { background: var(--fg); color: var(--bg); }

/* ---------- 統計グラフ ---------- */
.st-chart { display: flex; align-items: flex-end; gap: 6px; height: 90px; }
.st-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; height: 100%; justify-content: flex-end; }
.st-bar { width: 60%; border-radius: 6px; background: var(--fg); }
.st-col span { font-size: 9.5px; color: var(--sub); }

/* ---------- フォントウェイト ---------- */
.fw-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.fw-btn {
  padding: 9px 14px;
  border-radius: 10px;
  border: 1.4px solid var(--hairline);
  font-size: 13.5px;
}
.fw-btn.on { border-color: var(--fg); }

/* ---------- 年月ピッカー ---------- */
.ym-year { display: flex; align-items: center; justify-content: center; gap: 22px; font-size: 16px; font-weight: 700; margin-bottom: 14px; }
.ym-year button { font-size: 20px; padding: 4px 12px; color: var(--sub); }
.ym-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.ym-cell { padding: 12px 0; border-radius: 12px; background: var(--bg); font-size: 14px; }
.ym-cell.on { background: var(--fg); color: var(--bg); font-weight: 700; }

/* ---------- テーマカスタマイザー ---------- */
.cs-label { font-size: 13px; font-weight: 700; margin: 18px 0 10px; }
.dot-row { display: flex; gap: 10px; flex-wrap: wrap; }
.c-dot {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  position: relative;
  border: 2.5px solid transparent;
  background-clip: padding-box;
}
.c-dot.on { box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--fg); }
.c-dot.ring { border: 1px solid var(--hairline); }
.c-def { color: var(--bg); font-size: 14px; font-weight: 700; }
.c-lock { position: absolute; right: -4px; bottom: -4px; font-size: 11px; }

/* アプリアイコングリッド */
.appicon-grid { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.ai-cell { width: 48px; height: 48px; border-radius: 13px; padding: 0; transition: transform 0.12s; }
.ai-cell svg { width: 100%; height: 100%; border-radius: 13px; display: block; }
.ai-cell.on { box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--fg); }
.ai-cell:active { transform: scale(0.92); }

/* ---------- アクセントカラー適用 ---------- */
.accent-on .tgl.on { background: var(--accent); }
.accent-on .fab { background: var(--accent); color: #fff; }
.accent-on .ring-prog { stroke: var(--accent); }
.accent-on .ring-dot { fill: var(--accent); }
.accent-on .round-btn.big { background: var(--accent); }
.accent-on .round-btn.big svg { stroke: #fff; fill: #fff; }
.accent-on .ml-task.done .ml-check { background: var(--accent); border-color: var(--accent); }
.accent-on .ed-save { background: var(--accent); }
.accent-on .cal-day.today { background: var(--accent); color: #fff; }
.accent-on .offer-pill { color: var(--accent); }

/* ---------- フォントファミリー ---------- */
.font-round { font-family: "Hiragino Maru Gothic ProN", "HG丸ｺﾞｼｯｸM-PRO", "Yu Gothic", sans-serif; }
.font-serif { font-family: "Hiragino Mincho ProN", "Yu Mincho", serif; }

/* ---------- 区切り線 ---------- */
.dividers .ml-task + .ml-task { box-shadow: 0 -1px 0 var(--hairline); }

/* ---------- 展開表示（メモ・サブタスク） ---------- */
.ml-exp-note { font-size: 12.5px; color: var(--sub); margin-top: 4px; line-height: 1.5; }
.ml-sub-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 7px;
  font-size: 13.5px;
}
.ml-check.mini {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  font-size: 10px;
  margin-top: 0;
  border-width: 1.4px;
}
.round-check .ml-check.mini { border-radius: 50%; }
.ml-check.mini.sdone { background: var(--sub2); border-color: var(--sub2); color: #fff; }
.sdone-t { color: var(--sub); text-decoration: line-through; }

/* ---------- タイマーのリング内プリセット ---------- */
.ring-presets {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.ring-presets button {
  font-size: 22px;
  font-weight: 300;
  color: var(--sub);
  padding: 6px 26px;
  border-radius: 12px;
}
.ring-presets button:first-child { font-size: 15px; }
.ring-presets button:active { background: rgba(0,0,0,0.05); color: var(--fg); }

/* ---------- 数値ピッカー ---------- */
.np-list {
  max-height: 200px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  border-radius: 12px;
  background: var(--bg);
  padding: 6px 0;
}
.np-v {
  padding: 9px;
  font-size: 17px;
  color: var(--sub);
  font-variant-numeric: tabular-nums;
}
.np-v span { font-size: 12px; margin-left: 4px; }
.np-v.on { color: var(--fg); font-weight: 700; font-size: 19px; }

/* ---------- フォーカス設定のヒント ---------- */
.fs-hint {
  font-size: 11.5px;
  color: var(--sub);
  line-height: 1.6;
  padding: 4px 2px 10px;
  border-bottom: 1px solid var(--hairline);
  margin-bottom: 2px;
}

/* ---------- デスクトップ調整 ---------- */
@media (min-width: 600px) {
  body { background: #e4e4e0; }
  #app { box-shadow: 0 0 40px rgba(0,0,0,0.12); background: var(--bg); }
  .theme-dark body { background: #0a0a0b; }
}

/* ---------- カレンダーの使い分け ---------- */
.cal-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 7px; vertical-align: 0.5px; flex: none; }
.cal-ro { font-size: 11.5px; color: var(--sub); margin-left: 4px; }
.sheet .ev-cal { flex: 1; margin-bottom: 0; text-align: left; display: flex; align-items: center; }
.sheet .ev-cal:disabled { opacity: 0.6; }
.ed-repeat-btn .cal-dot { margin-right: 6px; }

/* 取り消しボタンつきのトースト */
.toast-act { color: #9cc0ff; font-weight: 700; margin-left: 14px; font-size: 13px; }

/* ---------- 家事（Todo タブの「家事」） ---------- */
.chore-sub { display: block; font-size: 12.5px; color: var(--sub); margin-top: 2px; }
.chore-row .val.late { color: var(--red); }
.sheet .ch-num { flex: 0 0 72px; margin-bottom: 0; }
.sheet .ch-unit { flex: 1; margin-bottom: 0; }
.ch-goto { font-size: 14px; color: var(--sub); }
.ev-row.ch label { flex-basis: 80px; }
.sheet #ch-next { flex: 1; margin-bottom: 0; }

/* ---------- 集中の画面: 上の切り替えと「今やること」 ---------- */
.seg-wrap.focus-top { position: relative; margin-top: 6px; padding: 0 20px; align-items: center; }
.focus-top .plain-icon { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); }
.focus-now { margin: 4vh 22px 0; min-height: 60px; display: flex; flex-direction: column; gap: 14px; }
.now-row { display: flex; align-items: flex-start; gap: 14px; transition: opacity 0.3s; }
.now-row.done { opacity: 0.35; }
.now-row.done .now-title { text-decoration: line-through; }
.now-check {
  flex: none;
  width: 30px;
  height: 30px;
  margin-top: 2px;
  border-radius: 9px;
  border: 2px solid var(--sub2);
  color: transparent;
  font-size: 16px;
  font-weight: 800;
  display: grid;
  place-items: center;
}
.now-check:active, .now-row.done .now-check { background: var(--fg); border-color: var(--fg); color: var(--bg); }
.now-title { font-size: 25px; font-weight: 700; line-height: 1.3; word-break: break-word; text-align: left; }
.now-sub { display: block; font-size: 13px; font-weight: 400; color: var(--sub); margin-top: 3px; }
.now-empty { text-align: center; color: var(--sub); font-size: 15px; padding-top: 14px; }
.now-break { font-size: 13px; color: var(--sub); }
