/* まいにちイエティ の見た目。いつも暗い色(夜の雪山)。字は端末の字だけ(外のフォントを読まない)。
   もとは Yeti Tower の public/life/grass.html と cute-theme.css */
:root {
  color-scheme: dark;
  --ct-bg: #1e1e21;
  --ct-panel: #26262a;
  --ct-hover: #303035;
  --ct-border: #3a3a40;
  --ct-border-soft: #2c2c31;
  --ct-fg: #ffffff;
  --ct-muted: #b8b8c4;
  --ct-dim: #9a9aa8;
  --ct-dimmer: #8a8a95;
  --ct-pink: #ffb3d9;
  --ct-yellow: #ffd98a;
  --ct-red: #ffa8a8;
  --ct-green: #9ef0bc;
  --ct-chip-green-bg: #1f4330;
  --ct-shadow-panel: 0 20px 48px rgba(0,0,0,0.35);
  --font: system-ui, -apple-system, 'Hiragino Sans', 'Noto Sans JP', 'Noto Sans CJK JP', sans-serif;
  --font-round: 'Hiragino Maru Gothic ProN', 'M PLUS Rounded 1c', var(--font);
  --band-h: 0px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--ct-bg); color: var(--ct-fg); font-family: var(--font); -webkit-text-size-adjust: 100%; }
body { min-height: 100vh; }
button { font-family: inherit; }
[hidden] { display: none !important; }

main { max-width: 1120px; margin: 0 auto; padding: 16px 16px calc(32px + var(--band-h)); display: flex; flex-direction: column; gap: 24px; min-width: 0; }
main > * { min-width: 0; max-width: 100%; }
.ct-empty { padding: 24px 16px; text-align: center; color: var(--ct-dim); font-size: 14px; }

.gr-head { display: flex; align-items: center; gap: 10px; margin: 0; }
.gr-head h1 { display: flex; align-items: center; gap: 10px; margin: 0; font-family: var(--font-round); font-size: 24px; font-weight: 800; letter-spacing: -0.01em; }
.gr-head img { width: 34px; height: auto; image-rendering: pixelated; }
@media (min-width: 721px) { main { padding-top: 24px; } .gr-head h1 { font-size: 28px; } }

/* 保存できない端末・先の版の知らせ(画面の上)。360px 幅で 1 行に収まる大きさ */
.gr-nosave { margin: 0; padding: 10px 12px; border-radius: 10px; background: #43222a; color: var(--ct-red); font-size: 13px; font-weight: 600; line-height: 1.6; }
/* 「💾 バックアップしておこう」(画面の上。書き出す・とじる)。360px 幅で 1 行 */
.gr-nudge { display: flex; align-items: center; gap: 4px; padding: 4px 2px 4px 10px; border-radius: 10px; background: #1f3243; color: #bfe3ff; font-size: 13px; font-weight: 600; }
.gr-nudge[hidden] { display: none; }
.gr-nudge-t { flex: 1 1 auto; min-width: 0; }
.gr-nudge-go { flex: 0 0 auto; min-height: 40px; padding: 0 12px; border-radius: 999px; border: 0; background: var(--ct-pink); color: #1e1e21; font-size: 14px; font-weight: 800; cursor: pointer; }
.gr-nudge-x { flex: 0 0 auto; width: 40px; height: 40px; border-radius: 999px; border: 0; background: transparent; color: inherit; font-size: 18px; cursor: pointer; }
@media (hover: hover) { .gr-nudge-x:hover { background: rgba(255, 255, 255, 0.08); } }

/* イエティ君の段: 雪山の景色(SVG)+ レベル・経験値 */
.gr-hero { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); border-radius: 14px; overflow: hidden; background: var(--ct-panel); }
.gr-scene { display: block; width: 100%; height: auto; aspect-ratio: 240 / 100; background: #141b2e; }
.gr-stats { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px 16px; min-width: 0; }
.gr-lvline { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.gr-lv { font-family: var(--font-round); font-size: 15px; font-weight: 800; color: var(--ct-muted); }
.gr-lv b { display: inline-block; margin-left: 4px; font-size: 30px; line-height: 1; color: var(--ct-fg); font-variant-numeric: tabular-nums; }
.gr-title { font-size: 15px; font-weight: 600; color: var(--ct-fg); }
.gr-bar { height: 10px; border-radius: 999px; background: #18181c; overflow: hidden; box-shadow: inset 0 0 0 1px var(--ct-border-soft); }
.gr-bar > span { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, #4ee16a, #9ef0bc); transition: width 0.45s ease-out; }
.gr-xp { font-size: 13px; color: var(--ct-dim); font-variant-numeric: tabular-nums; }
.gr-xp b { color: var(--ct-fg); font-weight: 600; }
.gr-facts { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 14px; color: var(--ct-muted); }
.gr-facts b { color: var(--ct-fg); font-variant-numeric: tabular-nums; }
.gr-facts .warn { color: var(--ct-yellow); }
@media (min-width: 900px) {
  .gr-hero { grid-template-columns: minmax(0, 560px) minmax(0, 1fr); }
  .gr-stats { justify-content: center; padding: 20px 28px; gap: 10px; }
}

/* 今週の 7 日(月〜日)。日曜に育ちきる */
.gr-weekline { display: flex; align-items: center; gap: 6px 12px; flex-wrap: wrap; font-size: 13.5px; color: var(--ct-muted); }
.gr-wdays { display: flex; gap: 4px; flex: 0 0 auto; }
.gr-wd {
  display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 7px;
  background: #18181c; box-shadow: inset 0 0 0 1px var(--ct-border-soft); color: var(--ct-dim); font-size: 12px; font-weight: 700;
}
.gr-wd.is-done { background: var(--ct-chip-green-bg); color: #9ef0bc; }
.gr-wd.is-future { opacity: 0.45; }
.gr-wd.is-today { box-shadow: inset 0 0 0 2px var(--ct-pink); }
.gr-wd.is-final { background: #3a3220; color: #ffd34d; }
.gr-weektext { min-width: 0; line-height: 1.6; }
.gr-weektext b { color: var(--ct-fg); }

/* その日の分(マスより大きいボタンで付け外し) */
.gr-day { display: flex; flex-direction: column; gap: 12px; }
.gr-day-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.gr-nav { flex: 0 0 auto; min-width: 44px; min-height: 40px; border-radius: 999px; border: 1px solid var(--ct-border); background: transparent; color: var(--ct-fg); font-size: 18px; line-height: 1; cursor: pointer; }
.gr-nav:disabled { opacity: 0.35; cursor: default; }
@media (hover: hover) { .gr-nav:not(:disabled):hover { background: var(--ct-hover); } }
.gr-day-title { min-width: 0; font-size: 16px; font-weight: 700; color: var(--ct-fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gr-today { margin-left: 6px; font-size: 12px; font-weight: 600; color: var(--ct-pink); }
.gr-day-score { margin-left: auto; flex: 0 0 auto; font-size: 16px; font-weight: 700; color: var(--ct-fg); font-variant-numeric: tabular-nums; }
.gr-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.gr-pill {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--ct-border); background: transparent; color: var(--ct-muted); font-size: 14px; font-weight: 600; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.gr-pill[aria-pressed="true"] { background: var(--ct-chip-green-bg); border-color: #4ee16a; color: #9ef0bc; }
@media (hover: hover) { .gr-pill:hover { border-color: var(--ct-muted); } }

.gr-h { display: flex; align-items: baseline; gap: 4px 10px; flex-wrap: wrap; margin: 0 0 10px; font-size: 16px; font-weight: 700; color: var(--ct-fg); }
.gr-sub { font-size: 12.5px; font-weight: 400; color: var(--ct-dim); }

/* 📖 図鑑: 見つけた姿だけを見つけた順に(番号も見つけた順)。まだの姿はカードも影も出さない・全部で何種類かも出さない */
.gr-dex { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 10px; }
.gr-dcard { position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 0; padding: 10px 10px 12px; border-radius: 12px; background: var(--ct-panel); text-align: center; }
.gr-dcard[data-kind="gold"] { background: linear-gradient(180deg, #3a3220, var(--ct-panel) 72%); }
.gr-dcard[data-kind="myth"] { background: linear-gradient(180deg, #2d2550, #1c3a44 55%, var(--ct-panel)); box-shadow: inset 0 0 0 1px #b48cff; }
.gr-dcard.is-now { box-shadow: inset 0 0 0 2px var(--ct-pink); }
.gr-dno { align-self: flex-start; font-size: 11.5px; font-weight: 700; color: var(--ct-dim); font-variant-numeric: tabular-nums; }
.gr-dnew { position: absolute; top: 8px; right: 8px; padding: 1px 7px; border-radius: 999px; background: var(--ct-pink); color: #1e1e21; font-size: 11px; font-weight: 800; letter-spacing: 0.04em; }
.gr-thumb { display: block; width: 72px; height: 66px; flex: 0 0 auto; }
.gr-dname { max-width: 100%; font-size: 13px; font-weight: 700; color: var(--ct-fg); line-height: 1.4; word-break: keep-all; overflow-wrap: anywhere; }
.gr-dcount { font-size: 12px; font-weight: 700; color: #9ef0bc; font-variant-numeric: tabular-nums; }
.gr-dfirst { font-size: 11.5px; color: var(--ct-dim); font-variant-numeric: tabular-nums; }
.gr-ddesc { align-self: stretch; margin-top: 4px; font-size: 12px; line-height: 1.6; color: var(--ct-muted); text-align: left; }
.gr-dcond { align-self: stretch; font-size: 11px; line-height: 1.5; color: var(--ct-dim); text-align: left; }
.gr-dempty { grid-column: 1 / -1; }
/* 見つけたばかり(NEW)の姿は影で置いておき、見えたら色が付いて出てくる(JS の IntersectionObserver が is-hidden → is-reveal) */
.gr-dcard.is-hidden .gr-thumb { filter: brightness(0); opacity: 0.55; }
.gr-dcard.is-hidden > :not(.gr-thumb):not(.gr-dno) { opacity: 0; }
@keyframes gr-reveal { 0% { filter: brightness(0); opacity: 0.55; transform: scale(0.92); } 45% { filter: brightness(0); opacity: 1; transform: scale(1.06); } 100% { filter: brightness(1); opacity: 1; transform: scale(1); } }
.gr-dcard.is-reveal .gr-thumb { animation: gr-reveal 1.3s ease-out both; }
.gr-dcard.is-reveal > :not(.gr-thumb):not(.gr-dno) { animation: gr-fade 0.5s ease-out 0.9s both; }
.gr-weeks { display: flex; flex-direction: column; margin-top: 14px; }
.gr-wk { border-bottom: 1px solid var(--ct-border-soft); }
.gr-wk:last-child { border-bottom: 0; }
.gr-wk > summary { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; align-items: center; gap: 12px; min-height: 52px; padding: 6px 2px; list-style: none; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.gr-wk > summary::-webkit-details-marker { display: none; }
.gr-wk .gr-thumb { width: 48px; height: 44px; }
.gr-wk-main { display: flex; flex-direction: column; min-width: 0; }
.gr-wk-date { font-size: 12px; color: var(--ct-dim); font-variant-numeric: tabular-nums; }
.gr-wk-name { font-size: 15px; font-weight: 600; color: var(--ct-fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gr-wk-n { font-size: 13px; color: var(--ct-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.gr-wk-body { padding: 0 2px 12px 62px; font-size: 13px; line-height: 1.7; color: var(--ct-muted); }
.gr-wk-body b { color: var(--ct-fg); }
.gr-wk-now .gr-wk-date { color: var(--ct-pink); }
@media (hover: hover) { .gr-wk > summary:hover { background: var(--ct-hover); } }
.gr-more { align-self: flex-start; margin-top: 10px; min-height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--ct-border); background: transparent; color: var(--ct-fg); font-size: 14px; cursor: pointer; }

/* ── 👣 足あと(1 年ぶんのマス。右端が今日。スマホは 18px のマスで直近 2 週間ほど、左へ送ると前の日)── */
.habits-matrix-wrap {
  margin: 0; padding: 10px 0;
  border-radius: 10px; border: 1px solid var(--ct-border);
  background: rgba(0,0,0,0.2);
  overflow-x: auto; overflow-y: hidden;
  position: relative;
  scrollbar-width: thin;
  scrollbar-color: rgba(217, 122, 166, 0.4) transparent;
  width: 100%; max-width: 100%; min-width: 0;
}
.habits-matrix-wrap::-webkit-scrollbar { height: 6px; }
.habits-matrix-wrap::-webkit-scrollbar-track { background: transparent; }
.habits-matrix-wrap::-webkit-scrollbar-thumb { background: rgba(217, 122, 166, 0.4); border-radius: 3px; }
.habits-matrix-wrap .hm-inner { display: flex; flex-direction: column; gap: 3px; width: max-content; min-width: 100%; }
.habits-matrix-wrap .hm-row { display: flex; align-items: center; height: 18px; }
.habits-matrix-wrap .hm-row.hm-month-row { height: 14px; margin-bottom: 4px; color: var(--ct-dim); font-size: 11px; font-weight: 600; }
.habits-matrix-wrap .hm-row.hm-month-row .hm-cells { position: relative; height: 14px; gap: 0; }
.habits-matrix-wrap .hm-month { position: absolute; top: 0; white-space: nowrap; overflow: clip; }
/* 札の右の 8px: 帯の終わりで押し出される時に、次の月の札とくっつかない。今月(最後の帯)は今日のマスの上に右端をそろえるので付けない */
.habits-matrix-wrap .hm-month-name { position: sticky; left: 8px; display: block; width: max-content; padding-right: 8px; }
.habits-matrix-wrap .hm-month:last-child .hm-month-name { padding-right: 0; }
/* 押し出され始めた札(JS の IntersectionObserver が付ける)。左端に欠片を残さない */
.habits-matrix-wrap .hm-month-name { transition: opacity 0.12s; }
.habits-matrix-wrap .hm-month-name.is-out { opacity: 0; }
.habits-matrix-wrap .hm-label { position: sticky; right: 0; width: 200px; min-width: 200px; max-width: 200px; padding-left: 0; padding-right: 12px; background: var(--ct-panel); z-index: 2; color: var(--ct-fg); font-size: 15px; line-height: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 0 0 200px; text-align: left; display: flex; align-items: center; gap: 6px; }
.habits-matrix-wrap .hm-cells { display: flex; gap: 3px; align-items: center; padding-right: 8px; }
.habits-matrix-wrap .hm-row:not(.hm-month-row):nth-of-type(even) { background: rgba(255,255,255,0.025); }
@media (hover: hover) {
  .habits-matrix-wrap .hm-row:not(.hm-month-row):hover { background: rgba(78, 225, 106, 0.08) !important; }
  .habits-matrix-wrap .hm-row:not(.hm-month-row):hover .hm-label { color: #4ee16a; }
}
.sp-cell { width: 11px; height: 11px; border-radius: 2px; background: #161b22; transition: transform 0.1s; flex-shrink: 0; cursor: pointer; }
.sp-cell[data-checked="1"] { background: #4ee16a; box-shadow: 0 0 5px rgba(78, 225, 106, 0.6), 0 0 2px rgba(78, 225, 106, 0.8); }
/* 週の習慣: やった日は薄い緑の印・目標に届いた週は濃く */
.hm-row[data-weekly="1"] .sp-cell[data-checked="1"] { background: #2f8a47; box-shadow: none; }
.hm-row[data-weekly="1"] .sp-cell[data-goal="1"] { background: #173d24; }
.hm-row[data-weekly="1"] .sp-cell[data-goal="1"][data-checked="1"] { background: #4ee16a; box-shadow: 0 0 5px rgba(78, 225, 106, 0.6), 0 0 2px rgba(78, 225, 106, 0.8); }
.hm-goal, .gr-pill-week { flex: 0 0 auto; font-size: 11px; font-weight: 700; color: var(--ct-dim); font-variant-numeric: tabular-nums; }
.gr-pill[aria-pressed="true"] .gr-pill-week { color: #9ef0bc; }
/* 今日(右端)のマスは押す所なので、まだの時も縁を付けて見せる */
.sp-cell[data-today="1"]:not([data-checked="1"]) { box-shadow: inset 0 0 0 1px var(--ct-dim); }
/* 上の「その日」で選んでいる日の列 */
.sp-cell[data-sel="1"] { outline: 1px solid var(--ct-pink); outline-offset: 1px; }
@media (hover: hover) { .sp-cell:hover { transform: scale(1.3); outline: 1px solid var(--ct-fg); outline-offset: 1px; } }

/* 🏅 バッジ(習慣ごとに 7・30・100 日。週の習慣は 4・12・52 週) */
.gr-badges { display: flex; flex-direction: column; }
.gr-brow { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 4px 14px; padding: 10px 2px; border-bottom: 1px solid var(--ct-border-soft); }
.gr-brow:last-child { border-bottom: 0; }
.gr-bname { min-width: 0; font-size: 15px; color: var(--ct-fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gr-bstreak { font-size: 13.5px; color: var(--ct-muted); font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.gr-bstreak b { color: var(--ct-fg); }
.gr-bstreak.warn { color: var(--ct-yellow); }
.gr-medals { display: flex; gap: 6px; }
.gr-medal {
  display: inline-flex; align-items: center; justify-content: center; min-width: 34px; height: 24px; padding: 0 6px; border-radius: 999px;
  border: 1px dashed var(--ct-border); color: var(--ct-dimmer); font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.gr-medal.is-on { border-style: solid; color: #1e1e21; }
.gr-medal.t0.is-on { background: #e0a36b; border-color: #e0a36b; }
.gr-medal.t1.is-on { background: #cfd8e6; border-color: #cfd8e6; }
.gr-medal.t2.is-on { background: #ffd34d; border-color: #ffd34d; }
.gr-bleft { grid-column: 1 / -1; font-size: 12.5px; color: var(--ct-dim); }
@media (max-width: 600px) {
  .gr-brow { grid-template-columns: minmax(0, 1fr) auto; }
  .gr-medals { grid-column: 2; }
  .gr-bstreak { grid-column: 1; grid-row: 2; text-align: left; }
  .gr-bleft { grid-column: 2; grid-row: 2; text-align: right; }
}
.gr-note { margin: 0; font-size: 12.5px; line-height: 1.7; color: var(--ct-dim); }

/* ⚙️ 習慣の画面(<dialog>)。スマホは 画面いっぱい・広い画面は 真ん中に。押す所は 40px 以上 */
.gr-gear { margin-left: auto; flex: 0 0 auto; width: 44px; height: 44px; border-radius: 999px; border: 1px solid var(--ct-border); background: transparent; color: var(--ct-fg); font-size: 20px; line-height: 1; cursor: pointer; }
@media (hover: hover) { .gr-gear:hover { background: var(--ct-hover); } }
.gr-noh { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 100%; }
.gr-noh .gr-more { align-self: center; }
body:has(.hs[open]) { overflow: hidden; }
.hs {
  width: 100%; max-width: 100%; height: 100%; max-height: 100%; margin: 0; padding: 0; border: 0;
  background: var(--ct-bg); color: var(--ct-fg); overflow-y: auto; overscroll-behavior: contain;
}
.hs::backdrop { background: rgba(0, 0, 0, 0.6); }
@media (min-width: 640px) {
  .hs { width: 600px; height: auto; max-height: calc(100% - 48px); margin: 24px auto; border: 1px solid var(--ct-border); border-radius: 16px; box-shadow: var(--ct-shadow-panel); }
}
.hs-body { display: flex; flex-direction: column; gap: 12px; padding: 0 16px calc(20px + env(safe-area-inset-bottom)); }
.hs-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 8px; padding: 12px 0 8px; background: var(--ct-bg); }
.hs-title { flex: 1 1 auto; min-width: 0; margin: 0; font-family: var(--font-round); font-size: 19px; font-weight: 800; }
.hs-sub { margin: 0; font-size: 13px; line-height: 1.6; color: var(--ct-dim); }
.hs-h { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 8px; margin: 8px 0 0; font-size: 15px; font-weight: 700; }
.hs-list { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }
.hs-row { display: grid; grid-template-columns: minmax(0, 1fr) 40px 40px; align-items: center; gap: 6px; padding: 6px; border-radius: 12px; background: var(--ct-panel); }
.hs-row.is-open { box-shadow: inset 0 0 0 1px var(--ct-border); }
.hs-name {
  display: grid; grid-template-columns: 30px minmax(0, 1fr); column-gap: 10px; align-items: center; min-width: 0; min-height: 44px; padding: 2px 6px;
  border: 0; border-radius: 8px; background: transparent; color: var(--ct-fg); text-align: left; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.hs-name .hs-icon { grid-row: 1 / 3; }
@media (hover: hover) { .hs-name:hover, .hs-btn:not(:disabled):hover, .hs-btn2:not(:disabled):hover, .hs-item:hover, .hs-chip:not(:disabled):hover, .hs-add:hover { background: var(--ct-hover); } }
.hs-label { min-width: 0; font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hs-meta { min-width: 0; font-size: 12px; color: var(--ct-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hs-icon { display: block; width: 30px; height: 30px; color: var(--ct-dimmer); }
.hs-btn { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--ct-border); background: transparent; color: var(--ct-fg); font-size: 16px; cursor: pointer; }
.hs-btn:disabled { opacity: 0.25; cursor: default; }
.hs-btn2 { flex: 0 0 auto; min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--ct-border); background: transparent; color: var(--ct-fg); font-size: 14px; font-weight: 600; white-space: nowrap; cursor: pointer; }
.hs-btn2 small { font-size: 11.5px; font-weight: 400; color: var(--ct-dim); }
.hs-edit { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 12px; padding: 10px 4px 4px; border-top: 1px solid var(--ct-border-soft); }
.hs-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; font-size: 12.5px; color: var(--ct-dim); }
.hs-input { width: 100%; min-width: 0; min-height: 44px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--ct-border); background: #18181c; color: var(--ct-fg); font-family: inherit; font-size: 16px; }
.hs-input:focus { outline: 2px solid var(--ct-pink); outline-offset: 0; border-color: transparent; }
.hs-off { align-self: flex-start; color: var(--ct-yellow); }
.hs-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); gap: 6px; }
.hs-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-width: 0; min-height: 60px; padding: 6px 2px 5px;
  border-radius: 10px; border: 1px solid var(--ct-border); background: transparent; color: var(--ct-muted); font-size: 11px; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.hs-item > span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hs-item[aria-pressed="true"] { background: var(--ct-chip-green-bg); border-color: #4ee16a; color: #9ef0bc; }
.hs-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.hs-chip {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%; min-height: 40px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--ct-border); background: transparent; color: var(--ct-muted); font-size: 14px; font-weight: 600; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.hs-chip small { font-size: 11px; font-weight: 400; color: var(--ct-dim); white-space: nowrap; }
.hs-chip[aria-pressed="true"] { background: var(--ct-chip-green-bg); border-color: #4ee16a; color: #9ef0bc; }
.hs-chip[aria-pressed="true"]::before { content: '✓'; }
.hs-chip:disabled { opacity: 0.45; cursor: default; }
.hs-add { min-height: 48px; border-radius: 12px; border: 1px dashed var(--ct-border); background: transparent; color: var(--ct-fg); font-size: 15px; font-weight: 700; cursor: pointer; }
.hs-offrow { grid-template-columns: 30px minmax(0, 1fr) auto auto; padding: 6px 6px 6px 12px; }
.hs-offrow > .hs-icon { opacity: 0.6; }
.hs-offname { display: flex; flex-direction: column; min-width: 0; }
.hs-offname .hs-label { color: var(--ct-muted); }
.hs-del { color: var(--ct-red); }
.hs-ask { grid-column: 2 / -1; display: flex; flex-direction: column; gap: 8px; padding: 4px 0; font-size: 13px; line-height: 1.6; color: var(--ct-red); }
.hs-askbtns { display: flex; gap: 8px; }
.hs-danger { background: #43222a; border-color: var(--ct-red); color: var(--ct-red); }
/* 💾 バックアップ(習慣の画面の下)。読み込みの確かめは 枠の中に(消える物は 赤) */
.hs-backup { display: flex; flex-direction: column; gap: 8px; }
.hs-bkbtns { display: flex; flex-wrap: wrap; gap: 8px; }
.hs-bkbtns .hs-btn2:disabled { opacity: 0.4; cursor: default; }
.hs-bkline { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; }
/* はじめての人へ(データの置き場所・ホーム画面に追加・バックアップ) */
.hs-hello { padding: 8px 10px; border-radius: 10px; background: var(--ct-panel); }
.hs-bkask { padding: 10px 12px; border-radius: 12px; background: var(--ct-panel); color: var(--ct-fg); }
.hs-bkask b { color: var(--ct-red); }
.hs-bkask > span:not(.hs-askbtns) { color: var(--ct-muted); }
p.hs-bkask { margin: 0; color: var(--ct-red); }
.hs-own { display: flex; flex-direction: column; gap: 10px; }
.hs-ownline { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.hs-foot { position: sticky; bottom: 0; padding: 14px 0 calc(4px + env(safe-area-inset-bottom)); background: linear-gradient(rgba(30, 30, 33, 0), var(--ct-bg) 35%); }
.hs-go { width: 100%; min-height: 48px; border-radius: 999px; border: 0; background: var(--ct-pink); color: #1e1e21; font-size: 16px; font-weight: 800; cursor: pointer; }
.hs-go:disabled { opacity: 0.4; cursor: default; }

/* 知らせ(レベルが上がった・バッジ・全部付いた) */
.gr-toast {
  position: fixed; left: 16px; right: 16px; bottom: calc(18px + var(--band-h) + env(safe-area-inset-bottom)); z-index: 60; margin: 0 auto;
  width: fit-content; max-width: 420px; padding: 10px 16px; border-radius: 12px; background: #2f2f36; color: var(--ct-fg);
  border: 1px solid var(--ct-border); box-shadow: var(--ct-shadow-panel); font-size: 14px; font-weight: 600; line-height: 1.6;
  white-space: pre-line; text-align: center; pointer-events: none; opacity: 0; transition: opacity 0.2s;
}
.gr-toast.is-on { opacity: 1; }
/* 習慣の画面の知らせは 上(見出しの下)に出す。下は 外した習慣・足す の所で、押した所に重なる */
.hs .gr-toast { top: 60px; bottom: auto; }
@media (min-width: 640px) { .hs .gr-toast { top: 84px; } }

/* 🆕 新しい版の帯(下)。押すまで切り替えない */
.gr-update {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 70; display: flex; align-items: center; justify-content: center; gap: 12px;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: #2e2340; border-top: 1px solid #b48cff;
  color: var(--ct-fg); font-size: 14px; font-weight: 600;
}
.gr-update button { min-height: 40px; padding: 0 16px; border-radius: 999px; border: 0; background: var(--ct-pink); color: #1e1e21; font-size: 14px; font-weight: 800; cursor: pointer; }
body.has-band { --band-h: 61px; }

/* ── 演出(短く・軽く。CSS の animation だけ。動きを減らす設定の端末は止める)── */
.gr-yeti-body { transform-box: fill-box; transform-origin: 50% 100%; }
@keyframes gr-pop { 0% { transform: scale(1); } 40% { transform: scale(1.3); } 100% { transform: scale(1); } }
@keyframes gr-hop { 0%, 100% { transform: translateY(0); } 35% { transform: translateY(-3px); } 70% { transform: translateY(0); } 85% { transform: translateY(-1px); } }
@keyframes gr-jump { 0% { transform: translateY(0) scale(1, 1); } 15% { transform: translateY(0) scale(1.12, 0.86); } 45% { transform: translateY(-12px) scale(0.94, 1.08); } 75% { transform: translateY(0) scale(1.08, 0.92); } 100% { transform: translateY(0) scale(1, 1); } }
@keyframes gr-float { from { opacity: 1; transform: translate(-50%, 0); } to { opacity: 0; transform: translate(-50%, -30px); } }
@keyframes gr-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes gr-fall { from { transform: translate(0, 0); opacity: 1; } to { transform: translate(var(--dx), 230px); opacity: 0.2; } }
.is-pop { animation: gr-pop 0.3s ease-out; }
.gr-yeti-body.is-hop { animation: gr-hop 0.45s ease-out; }
.gr-yeti-body.is-jump { animation: gr-jump 0.7s ease-out; }
.gr-new { animation: gr-fade 1.2s ease-out; }
.gr-float { position: fixed; z-index: 55; pointer-events: none; transform: translate(-50%, 0); white-space: nowrap; font-size: 13px; font-weight: 800; color: #9ef0bc; text-shadow: 0 1px 2px rgba(0,0,0,0.6); animation: gr-float 0.75s ease-out forwards; }
.gr-flake { position: absolute; top: -6px; z-index: 3; width: 4px; height: 4px; border-radius: 1px; background: #fff; pointer-events: none; animation: gr-fall var(--t) linear forwards; }
@media (prefers-reduced-motion: reduce) {
  .is-pop, .gr-yeti-body.is-hop, .gr-yeti-body.is-jump, .gr-new { animation: none !important; }
  .gr-dcard.is-reveal .gr-thumb, .gr-dcard.is-reveal > * { animation: none !important; }
  .gr-dcard.is-hidden .gr-thumb, .gr-dcard.is-hidden > * { filter: none !important; opacity: 1 !important; }
  .gr-float, .gr-flake { display: none !important; }
  .gr-bar > span, .gr-toast, .sp-cell, .habits-matrix-wrap .hm-month-name { transition: none !important; }
}

@media (max-width: 720px) {
  /* スマホは大きいマス。名前の欄は細くして(長い名前は端で薄く消す)マスに幅を回す。JS の CELL_W / GAP と同じ数にする */
  .habits-matrix-wrap .hm-label { width: 104px; min-width: 104px; max-width: 104px; flex: 0 0 104px; font-size: 13px; line-height: 22px; padding-left: 8px; padding-right: 6px; }
  .habits-matrix-wrap .hm-row { height: 22px; }
  .habits-matrix-wrap .hm-row.hm-month-row { height: 16px; }
  .habits-matrix-wrap .hm-inner { gap: 4px; }
  .sp-cell { width: 18px; height: 18px; border-radius: 4px; }
  .habits-matrix-wrap .hm-name { flex: 1 1 0; min-width: 0; overflow: hidden; }
  .habits-matrix-wrap .hm-name.is-cut {
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 16px), transparent);
            mask-image: linear-gradient(to right, #000 calc(100% - 16px), transparent); }
  .habits-matrix-wrap { scrollbar-width: none; }
  .habits-matrix-wrap::-webkit-scrollbar { display: none; width: 0; height: 0; }
}
