:root {
  --bg: #f4f3f0; --card: #ffffff; --text: #1b1c1f; --muted: #6b6d74; --line: #e4e2dc;
  --accent: #e8542a; --accent2: #2f6fd6; --accentSoft: #fdeee8; --ok: #2f9e6a; --warnBg: #fff6dc; --warnText: #6b5000;
  --chip: #f0eee9; --accent3: #e3a21a; --line2: #b9b6ae;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111215; --card: #1b1d22; --text: #ececee; --muted: #9a9ca4; --line: #2c2f36;
    --accent: #ff6b3d; --accent2: #6ea0ff; --accentSoft: #3a2219; --ok: #4cc58b; --warnBg: #3a3215; --warnText: #f1d98a;
    --chip: #262930; --accent3: #f2bd4b; --line2: #5a5e68;
  }
}
:root[data-theme="dark"] {
  --bg: #111215; --card: #1b1d22; --text: #ececee; --muted: #9a9ca4; --line: #2c2f36;
  --accent: #ff6b3d; --accent2: #6ea0ff; --accentSoft: #3a2219; --ok: #4cc58b; --warnBg: #3a3215; --warnText: #f1d98a;
  --chip: #262930; --accent3: #f2bd4b; --line2: #5a5e68;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.6 system-ui, -apple-system, "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", sans-serif;
  padding-bottom: calc(150px + env(safe-area-inset-bottom));
}
button, input, select { font: inherit; color: inherit; }
h1, h2 { margin: 0; }
h2 { font-size: 16px; margin-bottom: 10px; }

.top {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px);
  max-width: 560px; margin: 0 auto;
}
.top h1 { font-size: 18px; letter-spacing: .04em; }
main { max-width: 560px; margin: 0 auto; padding: 0 16px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin-bottom: 12px; }
.card.empty { text-align: center; padding: 28px 16px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.note { background: var(--warnBg); color: var(--warnText); border-radius: 10px; padding: 10px 12px; font-size: 14px; margin: 10px 0 0; }
.err { color: var(--accent); font-weight: 600; }

/* ボタン */
button { cursor: pointer; border: 0; background: none; }
.primary {
  display: block; width: 100%; background: var(--accent); color: #fff; font-weight: 700;
  border-radius: 12px; padding: 14px; font-size: 16px; margin-top: 12px;
}
.primary:active { transform: scale(.99); }
.primary.sm, .ghost.sm { width: auto; display: inline-block; padding: 8px 14px; font-size: 14px; margin: 0; }
.ghost { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; background: var(--card); font-weight: 600; }
.card .ghost:not(.sm) { width: 100%; margin-top: 12px; }
.top .ghost.on { border-color: var(--accent); color: var(--accent); }
.link { color: var(--accent2); padding: 4px 0; font-size: 14px; }
.danger { color: var(--accent); border: 1px solid var(--accent); border-radius: 10px; padding: 10px 14px; font-weight: 600; }
.icon { width: 44px; height: 44px; font-size: 26px; border-radius: 10px; }
.icon:disabled { opacity: .25; }
.tag { display: inline-block; background: var(--accent); color: #fff; font-size: 12px; font-weight: 700; border-radius: 6px; padding: 1px 7px; margin-right: 8px; vertical-align: 1px; }
.tag.soft { background: var(--chip); color: var(--muted); font-weight: 600; margin: 0 0 0 6px; }

/* 記録 */
.daterow { display: flex; align-items: center; justify-content: space-between; margin: -6px -6px 8px; }
.daterow b { font-size: 17px; }
.daterow small { margin-left: 8px; font-size: 12px; color: var(--accent); font-weight: 700; }
.dayhead { display: flex; justify-content: space-between; align-items: baseline; font-weight: 700; margin-bottom: 6px; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 10px; scrollbar-width: none; }
.chip { flex: none; background: var(--chip); border-radius: 999px; padding: 7px 12px; font-size: 13px; font-weight: 600; }
.chip.on { background: var(--accent); color: #fff; }
.chip.done:not(.on)::before { content: "✓ "; color: var(--ok); }
.exrow { display: flex; gap: 8px; }
.card .exrow .ghost { width: auto; margin: 0; flex: none; }
.exrow select, select, input[type="number"], input[type="time"], input[type="date"], input[type="url"], input:not([type]) {
  flex: 1; min-width: 0; width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 16px;
}
.sug { background: var(--accentSoft); border-radius: 12px; padding: 10px 12px; margin-top: 12px; }
.sugtop { font-weight: 700; }
.sug small { display: block; color: var(--muted); margin-top: 2px; }
.prev { margin: 10px 0 0; font-size: 14px; color: var(--muted); }
.steppers { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.stepper .lbl { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.stepper.dim .lbl { font-size: 11px; }
.ctrl { display: flex; align-items: center; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.ctrl button { width: 42px; height: 52px; font-size: 22px; font-weight: 700; flex: none; }
.ctrl button:active { background: var(--chip); }
.ctrl input { border: 0 !important; background: none !important; text-align: center; font-size: 22px !important; font-weight: 700; padding: 0 !important; width: 100%; }
.srows { margin-top: 14px; }
.srow { display: grid; grid-template-columns: 20px 1fr 1fr 28px; gap: 6px; align-items: center; margin-bottom: 6px; }
.srow.hd { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.srow i { font-style: normal; font-weight: 800; color: var(--muted); text-align: center; font-size: 14px; }
.ctrl.sm button { width: 30px; height: 44px; font-size: 18px; }
.ctrl.sm input { font-size: 18px !important; min-width: 0; }
.ctrl.dim { opacity: .6; }
.rmrow { width: 28px; height: 28px; border-radius: 99px; color: var(--muted); font-size: 16px; }
.rmrow:disabled { opacity: .25; }
.addrow { margin: 2px 0 10px; }
.mini.go { margin-left: auto; color: var(--accent); font-weight: 700; }
.ctrl .u { font-size: 12px; color: var(--muted); margin-left: -4px; }
input::-webkit-outer-spin-button, input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number] { -moz-appearance: textfield; }
.restrow { display: flex; align-items: center; gap: 6px; margin-top: 12px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.restrow span { margin-right: auto; }
.mini { background: var(--chip); border-radius: 8px; padding: 5px 9px; font-size: 13px; font-weight: 600; }
.mini.on { background: var(--text); color: var(--card); }
.grp { padding: 8px 0; border-top: 1px solid var(--line); }
.grp:first-of-type { border-top: 0; }
.grpname { font-weight: 700; margin-bottom: 6px; }
.sets { display: flex; flex-wrap: wrap; gap: 6px; }
.set { background: var(--chip); border-radius: 8px; padding: 6px 10px; font-size: 14px; font-variant-numeric: tabular-nums; }
.set i { font-style: normal; color: var(--muted); font-size: 12px; margin-right: 6px; }

/* タイマー */
.timer {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(70px + env(safe-area-inset-bottom)); z-index: 9;
  width: min(528px, calc(100% - 32px)); display: flex; align-items: center; gap: 10px;
  background: var(--text); color: var(--card); border-radius: 14px; padding: 10px 12px; box-shadow: 0 6px 24px rgba(0,0,0,.25);
}
[hidden] { display: none !important; }
.timer b { font-size: 26px; font-variant-numeric: tabular-nums; margin-right: auto; }
.timer button { background: color-mix(in srgb, var(--card) 18%, transparent); color: inherit; border-radius: 9px; padding: 8px 12px; font-weight: 700; font-size: 14px; }
.timer.done { background: var(--ok); color: #fff; }
.timer.done span { margin-right: auto; font-weight: 700; }

/* メニュー */
.goalline { font-weight: 700; font-size: 16px; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; margin: 12px 0 8px; }
.facts div { background: var(--bg); border-radius: 10px; padding: 8px 10px; }
.facts dt { font-size: 12px; color: var(--muted); }
.facts dd { margin: 0; font-weight: 700; }
.facts em { font-style: normal; font-size: 11px; background: var(--warnBg); color: var(--warnText); border-radius: 5px; padding: 1px 5px; margin-left: 6px; }
.day.next { border-color: var(--accent); }
.dayttl { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.dayttl h2 { margin: 0; flex: 1; font-size: 15px; }
.dayttl .tag { margin: 0; }
.dno { font-size: 12px; font-weight: 800; color: var(--accent); }
.items { list-style: none; margin: 0; padding: 0; }
.items li { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-top: 1px solid var(--line); font-size: 14px; }
.items li:first-child { border-top: 0; }
.items .nm { text-align: left; padding: 0; font-weight: 600; text-decoration: underline dotted var(--muted); text-underline-offset: 4px; }
.items .nm small { font-size: 11px; font-weight: 600; color: var(--accent2); margin-left: 6px; text-decoration: none; display: inline-block; }
.items .sp { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.items .sp b { color: var(--text); }

/* 食事 */
.kcal { font-size: 14px; color: var(--muted); }
.kcal b { font-size: 34px; color: var(--text); margin-right: 4px; font-variant-numeric: tabular-nums; }
.macros { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0; }
.macros div { background: var(--bg); border-radius: 10px; padding: 8px 10px; }
.macros span { display: block; font-size: 12px; color: var(--muted); }
.macros b { font-size: 20px; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline > li { display: grid; grid-template-columns: 48px 1fr; gap: 10px; padding: 12px 0; border-top: 1px solid var(--line); }
.timeline > li:first-child { border-top: 0; padding-top: 0; }
.timeline time { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--muted); }
.tl-train div b { color: var(--accent2); }
.tl-shake div { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.mealhd { display: flex; align-items: center; flex-wrap: wrap; }
.foods { margin: 6px 0; padding-left: 18px; }
.foods li { margin: 2px 0; }
.mealsum { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; margin-bottom: 8px; }
.pfc { font-variant-numeric: tabular-nums; font-size: 13px; }
.pfc b { font-size: 11px; color: var(--muted); margin: 0 2px 0 6px; }
.pfc b:first-child { margin-left: 0; }
.tips { margin: 0; padding-left: 18px; }
.tips li { margin: 6px 0; }

.mealbtns { display: flex; gap: 6px; }

/* 食べたもの */
.bar { margin-top: 8px; }
.barhd { display: flex; align-items: baseline; gap: 4px; font-size: 12px; }
.barhd span:first-child { color: var(--muted); margin-right: auto; }
.barhd b { font-size: 16px; font-variant-numeric: tabular-nums; }
.kcalbar .barhd b { font-size: 24px; }
.kcalbar .track { height: 10px; }
.track { height: 8px; background: var(--chip); border-radius: 99px; overflow: hidden; margin-top: 3px; }
.track i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.track i.over { background: var(--accent2); }
.bars3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.bars3 .barhd { flex-wrap: wrap; }
.bars3 .barhd span:first-child { width: 100%; }
.left { margin: 10px 0 4px; font-size: 14px; }
.eatgrp { margin-top: 8px; }
.eathd { font-size: 12px; font-weight: 700; color: var(--muted); }
.eatrow { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.eatrow .en { flex: 1; min-width: 0; }
.eatrow .ev { color: var(--muted); font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.x { width: 32px; height: 32px; border-radius: 8px; color: var(--muted); font-size: 18px; flex: none; }
.seg.meals { display: flex; width: 100%; margin: 10px 0; }
.seg.meals button { flex: 1; padding: 7px 0; border-radius: 8px; font-weight: 600; font-size: 14px; }
.seg.meals button.on { background: var(--accent); color: #fff; }
.foodlist { max-height: 46vh; overflow-y: auto; margin-top: 8px; border-top: 1px solid var(--line); }
.fooditem { display: flex; width: 100%; justify-content: space-between; align-items: baseline; gap: 8px; padding: 10px 2px; border-bottom: 1px solid var(--line); text-align: left; font-size: 15px; }
.fooditem small { font-size: 11px; color: var(--accent2); margin-left: 6px; font-weight: 700; }
.fooditem .muted { white-space: nowrap; }
.fooditem small.gray { color: var(--muted); font-weight: 600; }
.searchrow, .coderow { display: flex; gap: 8px; align-items: center; }
.searchrow .ghost.sm, .coderow .ghost.sm { flex: none; padding: 10px 12px; }
.scanbox { position: relative; margin: 10px 0 6px; border-radius: 12px; overflow: hidden; background: #000; aspect-ratio: 4 / 3; }
.scanbox video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scanbox i { position: absolute; left: 12%; right: 12%; top: 35%; bottom: 35%; border: 2px solid var(--accent); border-radius: 8px; box-shadow: 0 0 0 999px rgba(0,0,0,.35); }
.credit { font-size: 11px; color: var(--muted); margin: 12px 0 0; line-height: 1.5; }
.amt { margin-top: 4px; }
.amtrow { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.amtrow input { font-size: 22px !important; font-weight: 700; max-width: 140px; }
.amtrow span { color: var(--text); font-size: 15px; }
.prevbox { background: var(--bg); border-radius: 10px; padding: 10px 12px; font-size: 14px; font-variant-numeric: tabular-nums; }
.dlgform > label { display: block; font-size: 13px; color: var(--muted); margin-top: 10px; position: relative; }
.dlgform > label > input { margin-top: 4px; color: var(--text); }

/* 伸び */
.pbs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0; }
.pbs div { background: var(--bg); border-radius: 10px; padding: 8px 10px; }
.pbs span { display: block; font-size: 12px; color: var(--muted); }
.pbs b { font-size: 18px; }
.chart { width: 100%; height: auto; display: block; margin-top: 4px; }
.chart .grid { stroke: var(--line); }
.chart .ax { fill: var(--muted); font-size: 10px; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin-top: 4px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.wrow { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.wrow input { flex: 1; }
.wrow .u { color: var(--muted); font-size: 13px; }
.wlist { list-style: none; margin: 8px 0 0; padding: 0; }
.wlist li { display: flex; gap: 12px; align-items: center; padding: 6px 0; border-top: 1px solid var(--line); font-size: 14px; }
.wlist li b { margin-left: auto; }
.histhd { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 4px; margin-bottom: 4px; }
.histhd h2 { margin: 0; }

/* フォーム */
.form fieldset { border: 0; padding: 0; margin: 18px 0 0; }
.form legend { font-weight: 800; font-size: 14px; color: var(--accent); margin-bottom: 8px; padding: 0; }
.form label { display: block; font-size: 13px; color: var(--muted); margin-top: 10px; position: relative; }
.form label > input, .form label > select { margin-top: 4px; color: var(--text); }
.form label > .u { position: absolute; right: 12px; bottom: 12px; font-size: 13px; }
.grid2, .grid3 { display: grid; gap: 10px; }
.grid2 { grid-template-columns: 1fr 1fr; }
.grid3 { grid-template-columns: 1fr 1fr 1fr; }
.grid2 label, .grid3 label { margin-top: 0; }
.grid2 + label, .grid3 + label, label + .grid2 { margin-top: 10px; }
fieldset > .grid3, fieldset > .grid2 { margin-top: 10px; }
.seg { display: inline-flex; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.seg label { margin: 0; color: var(--text); }
.seg input { position: absolute; opacity: 0; }
.seg span { display: block; padding: 6px 18px; border-radius: 8px; font-size: 14px; font-weight: 600; }
.seg input:checked + span { background: var(--accent); color: #fff; }
.seg input:focus-visible + span { outline: 2px solid var(--accent2); }
.mealrow { display: grid; grid-template-columns: 64px 1fr 1fr; gap: 8px; align-items: center; margin-top: 8px; }
.chk { display: flex !important; align-items: center; gap: 6px; color: var(--text) !important; font-size: 15px !important; margin-top: 10px; }
.mealrow .chk { margin: 0; }
.chk input { width: 20px; height: 20px; accent-color: var(--accent); margin: 0; }

/* ダイアログ */
dialog { border: 0; border-radius: 16px; padding: 0; width: min(420px, calc(100% - 32px)); background: var(--card); color: var(--text); }
dialog::backdrop { background: rgba(0,0,0,.45); }
.dlgform { padding: 18px; }
.dlgform h2 { margin: 0; }
.dlgform .grid2 { margin-top: 12px; }
.dlgform label { display: block; font-size: 13px; color: var(--muted); position: relative; }
.dlgform label input { margin-top: 4px; color: var(--text); }
.dlgform label .u { position: absolute; right: 12px; bottom: 12px; }
.dlgbtns { display: flex; gap: 8px; margin-top: 16px; }
.dlgbtns .primary { margin: 0; flex: 1; }
.dlgbtns .danger { margin-right: auto; }

/* 種目の説明 */
.info .target { margin: 10px 0 6px; }
.info .target .tag { margin: 0 8px 0 0; }
.how { margin: 0; padding-left: 20px; }
.how li { margin: 4px 0; }
.vbtn { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 12px; padding: 11px; border-radius: 12px; background: #e62117; color: #fff; font-weight: 700; text-decoration: none; }
.vbtn svg { width: 18px; height: 18px; fill: currentColor; }
.alts { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.alts h3 { font-size: 14px; margin: 0 0 8px; }
.altbtns { display: flex; flex-wrap: wrap; gap: 6px; }
.altbtns .ghost.sm { margin: 0; }

/* ログイン */
.gbtn { display: block; text-align: center; margin: 12px 0 8px; padding: 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--text); font-weight: 700; text-decoration: none; }
.acctbtns { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }

/* PCだけのくわしい表示 */
.chart .target { stroke: var(--text); stroke-dasharray: 4 4; opacity: .55; }
.pchd { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.pchd h2 { margin: 0; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.tbl th, .tbl td { padding: 7px 8px; border-bottom: 1px solid var(--line); text-align: right; }
.tbl th:first-child { text-align: left; font-weight: 600; }
.tbl thead th { font-size: 12px; color: var(--muted); font-weight: 600; }
.tbl tr.sum th, .tbl tr.sum td { font-weight: 800; border-top: 2px solid var(--line); }
.tbl tr.goal th, .tbl tr.goal td { color: var(--muted); }
.ratio { display: flex; height: 26px; border-radius: 8px; overflow: hidden; margin: 4px 0 10px; background: var(--chip); }
.ratio i { display: flex; align-items: center; justify-content: center; color: #fff; font-style: normal; font-size: 12px; font-weight: 700; }
.minis { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.mini-chart { background: var(--bg); border-radius: 12px; padding: 10px 12px; }
.mchd { display: flex; justify-content: space-between; font-size: 14px; }
.mchd .up { color: var(--ok); font-weight: 700; }
.mchd .down { color: var(--accent); font-weight: 700; }
.heat { display: grid; grid-template-rows: repeat(7, 16px); grid-auto-flow: column; grid-auto-columns: 16px; gap: 4px; margin: 8px 0; overflow-x: auto; }
.heat .wd { font-size: 10px; color: var(--muted); line-height: 16px; }
.heat i, .sw { display: block; width: 16px; height: 16px; border-radius: 4px; }
.sw { display: inline-block; vertical-align: -3px; margin-right: 4px; }
.l0 { background: var(--chip); }
.l1 { background: color-mix(in srgb, var(--accent) 35%, var(--chip)); }
.l2 { background: color-mix(in srgb, var(--accent) 65%, var(--chip)); }
.l3 { background: var(--accent); }
.heat i.future { opacity: .3; }

@media (min-width: 960px) {
  body { padding-bottom: 40px; }
  .top { max-width: 1180px; padding: 16px 24px 8px; position: static; }
  main { max-width: 1180px; padding: 0 24px; column-count: 2; column-gap: 16px; }
  main .card { break-inside: avoid; }
  main .card.wide { column-span: all; }
  main[data-view="profile"], main[data-view="record"] { column-count: 1; max-width: 720px; }
  main > p { column-span: all; }
  .timer { left: auto; right: 24px; transform: none; bottom: 24px; width: 380px; }
  body:has(main) { display: flex; flex-direction: column; }
  header.top { order: 0; } nav { order: 1; } main { order: 2; }
}

/* 下のメニュー */
nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 8; display: flex; justify-content: center;
  background: var(--card); border-top: 1px solid var(--line); padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
}
nav button { flex: 1; max-width: 112px; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 6px 0; font-size: 11px; font-weight: 600; color: var(--muted); border-radius: 10px; }
nav svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
nav button.on { color: var(--accent); }

/* PCでは下のメニューを上に（下のメニューの指定より後に置く） */
@media (min-width: 960px) {
  nav {
    position: sticky; top: 0; bottom: auto; left: auto; right: auto; width: 100%; justify-content: center; gap: 4px;
    padding: 6px 24px; margin-bottom: 16px; border-top: 0; border-bottom: 1px solid var(--line);
    background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px);
  }
  nav button { flex: none; max-width: none; flex-direction: row; gap: 6px; font-size: 14px; padding: 8px 16px; }
  nav button.on { background: var(--accentSoft); }
  nav svg { width: 18px; height: 18px; }
  .top, main { width: 100%; }
  .sp-only { display: none; }
}

/* PCのカレンダーと、選んだ日のくわしい記録 */
.calnav { display: flex; align-items: center; gap: 4px; }
.calnav h2 { margin: 0; min-width: 9em; text-align: center; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin: 8px 0; }
.cal-wd { font-size: 12px; color: var(--muted); text-align: center; }
.cal-day {
  min-height: 92px; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; text-align: left;
  padding: 6px 8px; border-radius: 10px; background: var(--bg); border: 2px solid transparent; font-size: 12px; position: relative;
}
.cal-day:hover:not(:disabled) { border-color: var(--line2); }
.cal-day:disabled { opacity: .35; cursor: default; }
.cal-day .cd { font-size: 13px; font-weight: 700; color: var(--muted); }
.cal-day.today .cd { color: var(--accent); }
.cal-day.sel { border-color: var(--accent); background: var(--card); }
.cal-day b { font-size: 15px; font-variant-numeric: tabular-nums; }
.cal-day b small { font-size: 10px; font-weight: 600; color: var(--muted); margin-left: 2px; }
.cal-day b.ctr { font-size: 13px; color: var(--accent); }
.cal-day .cp, .cal-day .cm { color: var(--muted); font-size: 11px; line-height: 1.4; }
.cal-day .cbar { position: absolute; left: 8px; right: 8px; bottom: 6px; height: 4px; border-radius: 9px; background: var(--chip); overflow: hidden; }
.cal-day .cbar i { display: block; height: 100%; background: currentColor; }
.cal-day.under .cbar { color: var(--accent3); }
.cal-day.ok .cbar { color: var(--ok); }
.cal-day.over .cbar { color: var(--accent2); }
.cal-day.trained { background: color-mix(in srgb, var(--accent) 9%, var(--bg)); }
.sw.under { background: var(--accent3); } .sw.ok { background: var(--ok); } .sw.over { background: var(--accent2); }
.dd-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.dd-cols h3 { font-size: 14px; margin: 6px 0; color: var(--accent); }
.tbl td.setsl, .tbl td.fname { text-align: left; }
.tbl th[rowspan] { vertical-align: top; color: var(--muted); }
.pr { display: inline-block; margin-left: 6px; font-size: 10px; font-weight: 800; color: #fff; background: var(--ok); border-radius: 5px; padding: 1px 5px; vertical-align: 1px; }
.tbl tr.clickable { cursor: pointer; }
.tbl tr.clickable:hover { background: var(--bg); }
.heat i[data-act] { cursor: pointer; }
.dd-cols .tbl thead th:nth-child(2) { text-align: left; }
.cal-day { padding-bottom: 16px; }

/* メニューの切り替えと、自分のメニューの編集 */
.tabs { display: flex; background: var(--chip); border-radius: 12px; padding: 4px; margin-bottom: 12px; column-span: all; }
.tabs button { flex: 1; padding: 9px 0; border-radius: 9px; font-weight: 700; font-size: 14px; color: var(--muted); }
.tabs button.on { background: var(--card); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.dayttl .link { margin-left: auto; }
.link.copy { display: block; margin: 10px auto 0; }
main > .primary { column-span: all; }
.editor .edlist { margin-top: 12px; }
.edrow { background: var(--bg); border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; }
.edtop { display: flex; align-items: center; gap: 8px; }
.edno { font-weight: 800; color: var(--accent); width: 18px; }
.edtop select { background: var(--card); }
.ednums { display: grid; grid-template-columns: 0.8fr 1.6fr 1fr; gap: 8px; margin-top: 8px; }
.ednums label { margin: 0 !important; font-size: 11px !important; }
.eplan { margin: 8px 0 0 !important; font-size: 11px !important; }
.eplan input { background: var(--card) !important; padding: 8px !important; width: 7em; }
.ednums input, .ednums select { background: var(--card) !important; padding: 8px !important; }
.rng { display: flex; align-items: center; gap: 4px; margin-top: 4px; color: var(--muted); }
.rng input { margin: 0 !important; }
.edbtns { display: flex; gap: 6px; margin-top: 8px; }
.edbtns .mini:disabled { opacity: .35; }
.danger-t { color: var(--accent); margin-left: auto; }
.rng input { color: var(--text) !important; }

/* 評価 */
.bodyrow { display: grid; grid-template-columns: minmax(110px, 40%) 1fr; gap: 12px; align-items: center; }
.bodyfig .chara-svg, .frbody .chara-svg { width: 100%; height: auto; display: block; border-radius: 12px; }
.parts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.parts li { display: grid; grid-template-columns: 3.2em 1fr 2.6em; gap: 6px; align-items: center; font-size: 13px; }
.parts b { text-align: right; font-variant-numeric: tabular-nums; }
.pbar { height: 8px; background: var(--chip); border-radius: 4px; overflow: hidden; }
.pbar i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.mkline { display: flex; gap: 10px; align-items: flex-start; margin: 12px 0 6px; background: var(--chip); border-radius: 12px; padding: 10px; }
.mkline .mkic { width: 36px; height: 36px; border-radius: 10px; flex: none; }
.mkline p { margin: 0 0 4px; font-size: 14px; }
.frbody { float: right; width: 64px; margin: 0 0 6px 10px; }
.beat { animation: beat 1s ease-in-out infinite; }
@keyframes beat { 50% { transform: scale(1.15); } }
@media (prefers-reduced-motion: reduce) { .beat { animation: none; } }
.fhrow { display: grid; grid-template-columns: 1.3fr 1fr 1fr 1fr; gap: 6px; margin: 8px 0 4px; }
.fh { background: var(--chip); border-radius: 10px; padding: 6px 8px; display: flex; flex-direction: column; }
.fh span { font-size: 12px; color: var(--muted); }
.fh b { font-size: 16px; }
.fh small { font-size: 11px; color: var(--muted); }
.fh.ok b { color: var(--ok); }
.fh.over b { color: #e8542a; }
.fh.under b { color: var(--accent3); }
.fhlist { list-style: none; margin: 4px 0 8px; padding: 0; }
.fhlist li { display: flex; justify-content: space-between; gap: 8px; padding: 3px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.review-top { display: flex; gap: 16px; align-items: center; }
.chara .charahd { display: flex; align-items: center; gap: 12px; }
.chara .charaic { width: 64px; height: 64px; border-radius: 16px; flex: none; }
.chara .charanm { flex: 1; display: flex; flex-direction: column; }
.chara .charanm b { font-size: 18px; }
.chara .charanm small { color: var(--muted); font-size: 12px; }
.chara .grade { width: 56px; height: 56px; font-size: 30px; border-radius: 16px; }
.bubble { position: relative; margin-top: 14px; background: var(--chip); border-radius: 14px; padding: 12px 14px; }
.bubble::before { content: ''; position: absolute; top: -8px; left: 26px; border: 8px solid transparent; border-top: 0; border-bottom-color: var(--chip); }
.bubble b { display: block; margin-bottom: 4px; }
.bubble p { margin: 0 0 4px; }
.review-top h2 { margin-bottom: 4px; }
.review-top p { margin: 0 0 4px; }
.burn { margin: 2px 0 8px; font-size: 14px; }
.burn b { color: var(--accent); }

/* 料理の写真 */
.mitems { display: flex; flex-direction: column; gap: 8px; max-height: 50vh; overflow-y: auto; margin: 8px 0; }
.mitem { background: var(--bg); border-radius: 12px; padding: 8px 10px; display: grid; grid-template-columns: 1fr auto; gap: 4px 8px; align-items: center; }
.mitem .chk span { display: flex; flex-direction: column; }
.mitem small { font-size: 12px; color: var(--muted); font-weight: 400; }
.mitem .mq { display: flex; align-items: center; gap: 4px; font-weight: 700; }
.mitem .mq input { width: 64px; text-align: center; }
.mitem .prevbox { grid-column: 1 / -1; margin: 0; }
.searchrow .filebtn { flex: none; padding: 10px 12px; cursor: pointer; }

/* マシンを調べる */
.findrow { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.findrow .ghost.sm { flex: 1; text-align: center; white-space: nowrap; }
.aibox { background: var(--accentSoft); border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; }
.aibox small { color: var(--muted); margin-left: 4px; }
.aibox p { margin: 4px 0 0; }
.aiothers { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 10px 0 4px; }
.ztabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.zlist { max-height: 55vh; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.zitem { text-align: left; background: var(--bg); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.zitem span { font-size: 13px; color: var(--muted); }
.link.back { margin-bottom: 6px; }

/* 下に引っぱって更新 */
body { overscroll-behavior-y: contain; }
.ptr { position: fixed; top: 0; left: 50%; z-index: 50; width: 36px; height: 36px; border-radius: 99px; background: var(--card); box-shadow: 0 2px 10px rgba(0,0,0,.18); display: grid; place-items: center; transform: translate(-50%, -48px); transition: transform .2s; pointer-events: none; color: var(--muted); font-weight: 800; }
.ptr span { transition: transform .2s; }
.ptr.ready span { transform: rotate(180deg); color: var(--accent); }
.ptr.busy span { animation: ptrspin .8s linear infinite; }
@keyframes ptrspin { to { transform: rotate(360deg); } }

/* トモダチ */
.av { flex: none; width: 44px; height: 44px; border-radius: 99px; display: grid; place-items: center; overflow: hidden; background: var(--chip); font-weight: 800; color: var(--muted); }
.av img { width: 100%; height: 100%; object-fit: cover; }
.av.emo { font-size: 26px; }
.av.lg { width: 64px; height: 64px; font-size: 36px; }
.av.xs { width: 24px; height: 24px; font-size: 14px; display: inline-grid; vertical-align: middle; margin-right: 6px; }
.iconpick { margin: 4px 0 12px; }
.iconpick .lbl { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.iconrow { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; }
.iconbtns { display: flex; align-items: center; gap: 10px; }
.filebtn { cursor: pointer; }
.emojis { display: grid; grid-template-columns: repeat(auto-fill, minmax(36px, 1fr)); gap: 4px; }
.emojis .emo { min-width: 0; width: auto; height: 38px; margin: 0; border-radius: 10px; font-size: 20px; background: var(--bg); border: 2px solid transparent; padding: 0; }
.emojis .emo.on { border-color: var(--accent); background: var(--accentSoft); }
.invhd { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.invhd h2 { margin: 0; }
.frbtn { position: relative; }
.frbtn[data-badge]:not([data-badge=""])::after { content: attr(data-badge); position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 99px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 800; line-height: 18px; text-align: center; }
.frhd { display: flex; align-items: center; gap: 12px; }
.frname { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.frname b { font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fgrade { display: inline-grid; vertical-align: 2px; margin-left: 8px; width: 22px; height: 22px; border-radius: 6px; place-items: center; font-size: 13px; font-weight: 900; color: #fff; background: #8a8c93; }
.fgrade.gS { background: linear-gradient(135deg, #e8542a, #e3a21a); }
.fgrade.gA { background: var(--ok); }
.fgrade.gB { background: var(--accent2); }
.fgrade.gC { background: var(--accent3); }
.fgrade.none { background: var(--chip); color: var(--muted); }
.strip { display: grid; grid-template-columns: repeat(14, 1fr); gap: 3px; margin: 4px 0 8px; }
.strip i { height: 14px; border-radius: 4px; background: var(--chip); }
.strip i.on { background: var(--ok); }
.prs { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.pr { font-size: 13px; background: var(--warnBg); color: var(--warnText); border-radius: 8px; padding: 2px 8px; font-weight: 600; }
.unfr { margin-top: 6px; font-size: 12px; color: var(--muted); }
.cheers ul { margin: 6px 0 10px; padding-left: 18px; }
.sechd { margin: 20px 4px 8px; font-size: 14px; color: var(--muted); }
.linkbox { width: 100%; font-size: 14px; }
.btnlink { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.dlgbtns .gbtn { margin: 0; flex: 1; }
.grade { flex: none; width: 76px; height: 76px; border-radius: 20px; display: grid; place-items: center; font-size: 42px; font-weight: 900; color: #fff; background: var(--muted); }
.grade.gS { background: linear-gradient(135deg, #e8542a, #e3a21a); }
.grade.gA { background: var(--ok); }
.grade.gB { background: var(--accent2); }
.grade.gC { background: var(--accent3); }
.grade.gD { background: #8a8c93; }
.rvhd { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.rvhd h2 { margin: 0; }
.rvmeter { display: flex; align-items: center; gap: 10px; margin: 10px 0 6px; }
.meter { flex: 1; height: 10px; border-radius: 99px; background: var(--chip); overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: 99px; }
.meter i.good { background: var(--ok); } .meter i.mid { background: var(--accent3); } .meter i.bad { background: var(--accent); }
.pct { font-variant-numeric: tabular-nums; min-width: 3.2em; text-align: right; }
.rvblock { border-radius: 10px; padding: 8px 12px; margin-top: 8px; }
.rvblock h3 { font-size: 13px; margin: 0 0 2px; }
.rvblock ul { margin: 0; padding-left: 18px; font-size: 14px; }
.rvblock li { margin: 4px 0; }
.rvblock.good { background: color-mix(in srgb, var(--ok) 12%, var(--card)); }
.rvblock.good h3 { color: var(--ok); }
.rvblock.bad { background: color-mix(in srgb, var(--accent) 10%, var(--card)); }
.rvblock.bad h3 { color: var(--accent); }
main[data-view="review"] .chara { column-span: all; }

/* ヘッダーのボタン・アプリとして開いたとき */
.topbtns { display: flex; gap: 6px; }
.ghost.install { border-color: var(--accent); color: var(--accent); }
@media (display-mode: standalone) {
  .top { padding-top: calc(12px + env(safe-area-inset-top)); }
}

/* 音楽アプリ */
.musicrow { display: flex; align-items: center; gap: 10px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.music { display: inline-flex !important; align-items: center; gap: 6px; }
.music svg, .tmusic svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.timer .tmusic { display: inline-flex; align-items: center; gap: 4px; max-width: 120px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.musiclist { display: grid; gap: 8px; margin-top: 10px; }
.musiclist .ghost { width: 100%; margin: 0; text-align: left; }
.musiclist .ghost.on { border-color: var(--accent); color: var(--accent); }
.fof { list-style: none; margin: 6px 0 0; padding: 0; }
.fof li { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line, #eee); }
.fof li:first-child { border-top: 0; }
.fof li > div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.fof li > div .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zitem.off { opacity: .55; }
.zitem small { margin-left: 6px; font-size: 11px; font-weight: 400; color: var(--muted); }
.gear fieldset { margin: 10px 0; }
.gear .chk { display: flex; padding: 4px 0; }

.wordrow { display: flex; gap: 8px; }
.wordrow input { flex: 1; min-width: 0; }
.fword { margin: 8px 0 4px; padding: 8px 12px; background: var(--bg, #f4f4f4); border-radius: 12px; font-size: 15px; overflow-wrap: anywhere; }
.hitoko .wordrow { align-items: center; margin-bottom: 8px; }
.hitoko p { margin: 0; }
.hico { font-size: 18px; width: 24px; text-align: center; }
.songnow .sname { flex: 1; min-width: 0; font-weight: 700; overflow-wrap: anywhere; }
.fsong a { font-weight: 700; margin-left: 4px; }
.lblbtn { display: block; text-align: center; margin: 4px 0; }
.fbcard .ghost { width: 100%; }
#fbF textarea { width: 100%; font: inherit; padding: 10px; border-radius: 10px; border: 1px solid var(--line, #ddd); box-sizing: border-box; }
.fmeals { margin: 6px 0; font-size: 14px; }
.fmeals summary { cursor: pointer; }
.fmeals ul { list-style: none; padding: 0; margin: 4px 0 0; }
.fmeals li { padding: 3px 0; overflow-wrap: anywhere; }
.fmeal { display: inline-block; min-width: 2.5em; font-weight: 700; }
.mshare { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; color: var(--muted); }
.mshare .link { margin-left: auto; }
.timer { flex-wrap: wrap; }
.timer .ttip { flex-basis: 100%; text-align: left; font-weight: 600; font-size: 13px; display: flex; justify-content: space-between; gap: 8px; }
.ztop { margin: 4px 0 8px; }
#kQ { width: 100%; margin-bottom: 4px; }
.kdetail p { line-height: 1.75; }
.kdetail .ksum { font-weight: 700; background: var(--bg); border-radius: 10px; padding: 10px 12px; }
.stepbars { display: grid; grid-template-columns: repeat(14, 1fr); gap: 3px; height: 90px; margin: 10px 0 4px; align-items: end; }
.stepbars div { height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; }
.stepbars i { display: block; width: 100%; background: var(--accent); border-radius: 4px 4px 0 0; }
.stepbars small { font-size: 10px; color: var(--muted); margin-top: 2px; }
.steps > .ghost { width: 100%; margin-top: 10px; }
.stepauto .howto { padding-left: 20px; line-height: 1.7; font-size: 14px; }
.stepauto .howto li { margin-bottom: 4px; }
#stepURL { width: 100%; font-size: 12px; }
.stepauto .howto.big li { margin-bottom: 12px; font-size: 15px; }
.stepauto .howto .primary { margin-top: 8px; }
.stepauto details input { width: 100%; font-size: 12px; margin: 6px 0; }
.qsteps .wrow { align-items: center; }
.qsteps .wrow span { white-space: nowrap; font-weight: 700; font-size: 14px; }
.qsteps .wrow input { flex: 1; min-width: 0; }
.qsteps p { margin: 6px 0 0; }
.steps details { margin-top: 8px; }
.steps details .wrow { margin-top: 6px; }
