/* おしぴよ（アプリ）。推しカラーは --oshi 系の変数で、js/ui/theme.js が差し替える（下の値は、推しが未登録のときの初期値）。 */
:root {
  --ink: #26314d;
  --ink-soft: #55606e;
  --paper: #f6f4ef;
  --card: #ffffff;
  --line: #d7dae0;
  --oshi: #e8478b;
  --oshi-wash: #f4dce1;
  --oshi-soft: #fdedf3;
  --oshi-marker: #f2c0d1;
  --oshi-line: #f1b2c9;
  --oshi-fill: #cc3e7a;
  --oshi-on: #ffffff;
  --oshi-text: #b0366a;
  --piyo: #f5c542;        /* ロゴ・マスコット・空状態・お祝い専用。ボタンには使わない */
  --round: "Hiragino Maru Gothic ProN","ヒラギノ丸ゴ ProN W4","Yu Gothic UI","Hiragino Kaku Gothic ProN","Noto Sans JP",sans-serif;
  --tab-h: 60px;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: "Hiragino Kaku Gothic ProN","Hiragino Sans","Noto Sans JP",sans-serif; color: var(--ink); background: var(--paper); line-height: 1.7; font-size: 16px; }
main { max-width: 640px; margin: 0 auto; padding: 20px 16px calc(var(--tab-h) + 40px + env(safe-area-inset-bottom)); }
h1 { font-family: var(--round); font-size: 22px; margin: 0 0 4px; }
.lead { margin: 0 0 16px; color: var(--ink-soft); }
.screen { display: none; }
.screen.is-active { display: block; }
:focus-visible { outline: 3px solid var(--oshi-text); outline-offset: 2px; }

/* 下部タブ：選ばれているタブだけ、推しカラー。アイコンと文字を並べる */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: grid; grid-template-columns: repeat(5, 1fr); background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tab { min-height: var(--tab-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; border: 0; background: none; color: var(--ink-soft); font: inherit; font-size: 12px; cursor: pointer; position: relative; }
.tab svg { display: block; }
.tab.is-active { color: var(--oshi-text); font-weight: 700; }
.tab.is-active::before { content: ""; position: absolute; top: 0; left: 28%; right: 28%; height: 3px; border-radius: 0 0 3px 3px; background: var(--oshi-fill); }

/* ボタン：主ボタンは推しカラーのピル型で、1画面に1つ。色は文字とのコントラスト 4.5:1 以上に自動調整される */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 52px; padding: 0 28px; border-radius: 999px; border: 2px solid transparent; font: inherit; font-weight: 700; cursor: pointer; }
.btn-primary { background: var(--oshi-fill); color: var(--oshi-on); }
.btn-primary:disabled { background: var(--line); color: var(--ink-soft); cursor: default; }
.btn-quiet { background: transparent; color: var(--oshi-text); }

/* シート（下から出る） */
.sheet { margin: auto auto 0; width: 100%; max-width: 560px; max-height: 92dvh; padding: 0; border: 0; border-radius: 22px 22px 0 0; background: var(--card); color: var(--ink); overflow-y: auto; transform: translateY(100%); transition: transform .2s ease-out; }
.sheet.is-open { transform: translateY(0); }
.sheet:focus { outline: none; }
.sheet::backdrop { background: rgba(38, 49, 77, 0); transition: background .2s; }
.sheet.is-open::backdrop { background: rgba(38, 49, 77, .45); }
.sheet-body { padding: 8px 20px calc(20px + env(safe-area-inset-bottom)); }
.sheet-grip { width: 40px; height: 5px; border-radius: 3px; background: var(--oshi-line); margin: 4px auto 12px; }
.sheet-title { font-family: var(--round); font-size: 18px; margin: 0 0 10px; text-align: center; }
.sheet-text { margin: 0 0 16px; text-wrap: pretty; }
.sheet-actions { display: grid; gap: 8px; margin-top: 14px; }

/* 金額テンキー：目立たせるのは、金額と、その下の蛍光ペンの線だけ */
.keypad-display { display: flex; justify-content: center; align-items: baseline; gap: 6px; padding: 6px 0 2px; font-family: var(--round); }
.keypad-yen { font-size: 24px; color: var(--ink-soft); }
.keypad-number { font-size: 52px; font-weight: 700; line-height: 1.15; letter-spacing: .02em; background: linear-gradient(transparent 62%, var(--oshi-marker) 62%, var(--oshi-marker) 92%, transparent 92%); padding: 0 8px; }
.keypad-display.is-empty .keypad-number { color: #9aa3b0; }
.keypad-note { text-align: center; color: var(--ink-soft); font-size: 14px; margin: 6px 0 12px; }
.keypad-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.key { min-height: 58px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); color: var(--ink); font-family: var(--round); font-size: 24px; cursor: pointer; }
.key:active { background: var(--oshi-soft); }
.key-back { background: var(--paper); font-size: 22px; }

/* 通知（保存・元に戻す）。タブの上に出す */
.toasts { position: fixed; left: 0; right: 0; bottom: calc(var(--tab-h) + 12px + env(safe-area-inset-bottom)); z-index: 20; display: flex; justify-content: center; padding: 0 16px; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 12px; max-width: 520px; width: 100%; padding: 4px 6px 4px 18px; border-radius: 999px; background: var(--ink); color: #fff; font-size: 15px; }
.toast-text { flex: 1; padding: 8px 0; }
.toast-action { min-height: 44px; padding: 0 16px; border: 0; border-radius: 999px; background: transparent; color: #fff; font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; }

.offline { text-align: center; padding-top: 30vh; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- ページ（タブの上に重ねる画面） ---------- */
.pages { position: relative; z-index: 12; }
.page { position: fixed; inset: 0; overflow-y: auto; background: var(--paper); outline: none; }
.page.is-under { overflow: hidden; }
.page-head { position: sticky; top: 0; z-index: 2; display: grid; grid-template-columns: 96px 1fr 96px; align-items: center; min-height: 52px; padding-top: env(safe-area-inset-top); background: var(--card); border-bottom: 1px solid var(--line); }
.page-back { min-height: 48px; padding: 0 12px; border: 0; background: none; color: var(--oshi-text); font: inherit; font-weight: 700; text-align: left; cursor: pointer; }
.page-title { margin: 0; font-size: 17px; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.page-body { max-width: 640px; margin: 0 auto; padding: 16px 16px calc(40px + env(safe-area-inset-bottom)); }

/* ---------- 共通の部品 ---------- */
.btn-block { width: 100%; }
.stack { display: grid; gap: 8px; margin-top: 16px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.inline-actions { margin: -4px 0 8px; }
.inline-form { display: flex; gap: 8px; align-items: center; }
.inline-form .input { flex: 1; }
.muted { color: var(--ink-soft); margin: 4px 0; }
.big-number { font-family: var(--round); font-size: 32px; font-weight: 700; margin: 0; }
.notice { margin: 0 0 12px; padding: 10px 14px; border-radius: 12px; background: var(--oshi-soft); border-left: 4px solid var(--oshi-fill); }
.plain-list { margin: 0 0 12px; padding-left: 1.4em; }
.plain-list li { margin: 4px 0; }
.hero-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.event-when { margin: 0 0 4px; }
.memo { white-space: pre-wrap; }
.block { margin: 20px 0; }
.block-title { font-family: var(--round); font-size: 17px; margin: 0 0 8px; }
.mini-title { font-size: 15px; margin: 10px 0 2px; }

.mark, .dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: var(--mark, #9aa3b0); flex: none; }
.list { display: grid; gap: 8px; }
.row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); color: var(--ink); font: inherit; text-align: left; text-decoration: none; cursor: pointer; }
.row-static { cursor: default; }
.row-main { display: grid; flex: 1; min-width: 0; }
.row-link { border: 0; background: none; padding: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; min-height: 44px; }
.row-title { font-weight: 700; overflow-wrap: anywhere; }
.row-sub { color: var(--ink-soft); font-size: 14px; }
.row.is-done .row-title { text-decoration: line-through; color: var(--ink-soft); }
.row.is-tentative { border-style: dashed; }
.timeline .row { border-left: 4px solid var(--oshi-line); }

/* 締切チップ：色だけでなく、必ず「あと◯日」の文字を添える。責める色（赤）は使わない */
.chip { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 13px; font-weight: 700; white-space: nowrap; }
.chip-normal { background: #eef0f3; color: #394152; }
.chip-caution { background: #fff1cc; color: #6b4a00; }
.chip-imminent { background: #ffe0d6; color: #8a2c0d; }
.chip-overdue { background: #e8e6f2; color: #3b3470; }
.chip-done { background: #e0f2e8; color: #1f5a3a; }

/* 入力 */
.form { display: grid; gap: 14px; }
.field-label { display: block; margin: 0 0 4px; font-weight: 700; font-size: 15px; }
.field-note { margin: 4px 0 0; color: var(--ink-soft); font-size: 13.5px; }
.field-error { margin: 4px 0 0; color: #8a2c0d; font-size: 14px; font-weight: 700; }
.input { width: 100%; min-height: 48px; padding: 8px 12px; border: 1px solid #aeb6c2; border-radius: 12px; background: var(--card); color: var(--ink); font: inherit; }
textarea.input { min-height: 90px; resize: vertical; }
.input-button { text-align: left; cursor: pointer; }
.input-button.is-placeholder { color: var(--ink-soft); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-btn { min-height: 44px; padding: 0 16px; border: 1px solid #aeb6c2; border-radius: 999px; background: var(--card); color: var(--ink); font: inherit; cursor: pointer; }
.chip-btn.is-on { background: var(--oshi-fill); color: var(--oshi-on); border-color: var(--oshi-fill); font-weight: 700; }

/* 空の状態 */
.empty { display: grid; justify-items: center; gap: 10px; padding: 28px 12px; text-align: center; }
.empty-text { margin: 0; max-width: 20em; }

/* 追加ボタン */
.fab { position: fixed; right: 16px; bottom: calc(var(--tab-h) + 16px + env(safe-area-inset-bottom)); z-index: 9; min-height: 52px; padding: 0 22px; border: 0; border-radius: 999px; background: var(--oshi-fill); color: var(--oshi-on); font: inherit; font-weight: 700; box-shadow: 0 4px 14px rgba(38, 49, 77, .28); cursor: pointer; }

/* ホーム：次の現場だけ、推しカラーの地にする */
.next-card { display: grid; gap: 4px; width: 100%; padding: 16px 18px; border: 0; border-radius: 20px; background: var(--oshi-wash); color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.next-label { font-size: 13.5px; color: var(--oshi-text); font-weight: 700; }
.next-title { font-family: var(--round); font-size: 22px; font-weight: 700; line-height: 1.35; }
.next-meta { color: var(--ink-soft); font-size: 14.5px; }

/* カレンダー */
.segment { display: flex; gap: 4px; padding: 4px; margin-bottom: 12px; border-radius: 999px; background: #e9e7e1; }
.seg { flex: 1; min-height: 44px; border: 0; border-radius: 999px; background: none; color: var(--ink-soft); font: inherit; cursor: pointer; }
.seg.is-on { background: var(--card); color: var(--ink); font-weight: 700; }
.month-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.week, .grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.week span { text-align: center; font-size: 13px; color: var(--ink-soft); padding: 4px 0; }
.grid { gap: 2px; }
.cell { min-height: 58px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 0; border: 1px solid transparent; border-radius: 10px; background: var(--card); color: var(--ink); font: inherit; cursor: pointer; }
.cell.is-out { background: transparent; color: #8a94a3; }
.cell.is-today { border: 2px solid var(--oshi-fill); }
.cell.is-selected { background: var(--oshi-soft); }
.cell-n { font-size: 14px; }
.marks { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px; min-height: 12px; }
.marks .dot { width: 8px; height: 8px; }
.more { font-size: 10px; color: var(--ink-soft); }
.sq { display: inline-block; width: 8px; height: 8px; border-radius: 2px; background: #8a94a3; }
.sq-caution { background: #c98a00; } .sq-imminent { background: #c4491f; } .sq-overdue { background: #5a4fb0; } .sq-done { background: #3d9a68; }
.ring { display: inline-block; width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--oshi-fill); }
.legend { margin: 10px 0 0; color: var(--ink-soft); font-size: 13px; }
.legend-dot { background: var(--oshi-fill); }

/* 締切・予定の詳細 */
.check { flex: none; width: 44px; height: 44px; border: 2px solid #8a94a3; border-radius: 50%; background: var(--card); color: #fff; font-size: 20px; cursor: pointer; }
.check.is-on { background: #3d9a68; border-color: #3d9a68; }
.check-list { list-style: none; margin: 0 0 8px; padding: 0; }
.check-list label { display: flex; align-items: center; gap: 8px; min-height: 44px; }
.check-list input, .row input[type=checkbox] { width: 22px; height: 22px; }
.fold { margin: 16px 0; }
.fold summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; color: var(--ink-soft); }
.tree { list-style: none; margin: 0 0 8px; padding: 0 0 0 12px; border-left: 3px solid var(--oshi-line); display: grid; gap: 8px; }
.tree-item { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; align-items: center; }
.tree-kind { font-weight: 700; grid-column: 1 / 3; }
.tree-item.is-off { opacity: .6; } .tree-item.is-done .tree-kind { text-decoration: line-through; }
.result-box { margin: 12px 0; padding: 12px 14px; border-radius: 14px; background: var(--oshi-soft); }
.sim { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; margin: 0; }
.sim dt { color: var(--ink-soft); } .sim dd { margin: 0; text-align: right; font-weight: 700; }
.sim-total { font-size: 18px; }

/* お金 */
.bar { width: 100%; height: 14px; accent-color: var(--oshi-fill); }
.goal { margin: 0 0 20px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.saved { text-align: center; padding: 12px 0; } .saved-check { font-family: var(--round); font-size: 22px; font-weight: 700; margin: 0 0 8px; }
.split { display: grid; gap: 10px; } .calc { margin-top: 28px; }

/* 美容 */
.plan { display: grid; gap: 8px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); }
.plan.is-quiet { opacity: .7; }
.plan-main { display: grid; gap: 2px; border: 0; background: none; padding: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; min-height: 44px; }
.plan-line { font-size: 14.5px; }
.plan-pin { display: inline-block; min-width: 5.5em; padding: 0 8px; border-radius: 6px; font-size: 12.5px; font-weight: 700; text-align: center; }
.plan-pin-reserve { background: var(--oshi-wash); color: var(--oshi-text); }
.plan-pin-do { background: var(--ink); color: #fff; }
.ad-note { display: inline-block; margin: 0 0 8px; padding: 4px 12px; border: 2px solid var(--ink); border-radius: 8px; font-weight: 700; }
.canvas-preview { width: 100%; height: auto; border: 1px solid var(--line); border-radius: 12px; }
.sheet-preview { padding: 12px 14px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); }

/* 初回案内 */
.onboard-hero { display: grid; justify-items: center; text-align: center; padding: 8px 0; }
.promise-list { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 8px; }
.promise-list li { padding: 12px 16px; border-radius: 14px; background: var(--oshi-wash); font-weight: 700; }
.onboard-done { display: grid; justify-items: center; gap: 12px; padding-top: 24px; text-align: center; }

.plan-note { margin-top: 4px; padding: 6px 10px; border-radius: 8px; background: var(--oshi-soft); font-size: 14px; }

/* 推し貯金：連動の提示、ルール、達成 */
.cand { flex-wrap: wrap; align-items: flex-start; }
.cand .btn-row { width: 100%; }
.rule-list { display: grid; gap: 4px; margin: 8px 0; }
.rule { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 14.5px; }
.rule .btn { min-height: 44px; padding: 0 12px; }
.achieved { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; font-weight: 700; }

.oshi-days { margin: 0 0 12px; display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.oshi-ms { padding: 0 10px; border-radius: 999px; background: var(--oshi-wash); color: var(--oshi-text); font-weight: 700; font-size: 14px; }

/* 写真・コレクション */
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 6px; }
.thumb { position: relative; display: inline-block; }
.thumb img { display: block; width: 72px; height: 72px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
.thumb-x { position: absolute; top: -8px; right: -8px; width: 44px; height: 44px; border: 0; background: none; color: #fff; font-size: 0; cursor: pointer; }
.thumb-x::before { content: "×"; position: absolute; top: 8px; right: 8px; width: 24px; height: 24px; border-radius: 50%; background: var(--ink); font-size: 16px; line-height: 24px; text-align: center; }
.collection { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.collection-tile { padding: 0; border: 0; border-radius: 12px; overflow: hidden; background: var(--line); aspect-ratio: 1; cursor: pointer; }
.collection-tile img { display: block; width: 100%; height: 100%; object-fit: cover; }
.viewer-img { display: block; width: 100%; max-height: 60dvh; object-fit: contain; border-radius: 12px; background: var(--paper); }

.color-free { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.input-color { width: 64px; min-height: 48px; padding: 4px; }
.filters { margin-bottom: 8px; }
.oshi-bar { display: grid; width: 100%; }
.banner { display: flex; align-items: center; gap: 10px; width: 100%; margin: 0 0 12px; padding: 12px 14px; border: 0; border-radius: 14px; background: var(--oshi-wash); color: var(--ink); font: inherit; text-align: left; cursor: pointer; min-height: 52px; }
.banner strong { color: var(--oshi-text); }

.map-box { width: 100%; height: 260px; margin: 12px 0; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); z-index: 0; }
.tree-group { margin-bottom: 12px; } .tree-name { margin: 0 0 4px; font-weight: 700; }
.tree-item.is-child { margin-left: 14px; }
.pr-box { margin-top: 12px; padding: 12px 14px; border: 1px dashed var(--line); border-radius: 14px; }

.push-diagram { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 8px 0 12px; }
.pd-box { display: inline-grid; padding: 8px 12px; border: 2px solid var(--ink); border-radius: 12px; font-weight: 700; background: var(--card); }
.pd-box small { font-weight: 400; color: var(--ink-soft); font-size: 12.5px; }
.pd-server { border-style: dashed; }
.pd-arrow { font-size: 13px; color: var(--ink-soft); }
