/* COMPASS 日記（v145〜）。名前はすべて dy- で始める（本体の .row-btn などとぶつけない）。
   色は本体の変数（--card / --text / --sun …）だけを使うので、暗い配色にもそのまま付いてくる */

#view.dy-view { max-width: 640px; margin: 0 auto; }
.dy-view .ic.sm { width: 15px; height: 15px; vertical-align: -3px; }
.dy-ic { display: inline-flex; }
.dy-ic .ic { width: 18px; height: 18px; }

/* 見出しの下の暦 */
.dy-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: -4px 2px 12px; }
.dy-chip { font-size: 11px; color: var(--text-dim); background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 3px 9px; }
.dy-chip.hol { color: var(--red, #d8402f); border-color: color-mix(in srgb, var(--red, #d8402f) 35%, var(--line)); }
.dy-chip.ann { color: var(--sun-2); border-color: color-mix(in srgb, var(--sun) 40%, var(--line)); background: var(--sun-soft); font-weight: 700; }
.dy-gear { margin-left: auto; }

/* 今日の問い */
.dy-q { font-size: 16px; font-weight: 700; line-height: 1.6; }
.dy-qfoot { display: flex; justify-content: flex-end; margin-top: 10px; }
.dy-mini.on { border-color: var(--sun); color: var(--sun-2); background: var(--sun-soft); }

/* 日記の本体 */
.dy-main h3 { display: flex; align-items: center; }
.dy-fav { margin-left: auto; background: none; border: 0; color: var(--line-2); cursor: pointer; padding: 2px; }
.dy-fav .ic { width: 22px; height: 22px; }
.dy-fav.on { color: var(--gold); }
.dy-fav.on .ic, .dy-star .ic { fill: currentColor; }
.dy-star { color: var(--gold); }
.dy-pick { display: flex; gap: 5px; margin-bottom: 8px; align-items: center; }
.dy-pick-l { font-size: 11px; color: var(--text-dim); width: 28px; flex: none; }
.dy-pk {
  flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0 4px;
  border: 1px solid var(--line); border-radius: 10px; color: var(--text-dim); background: var(--card); cursor: pointer; font: inherit;
}
.dy-pk .ic { width: 22px; height: 22px; }
.dy-pk span { font-size: 9px; white-space: nowrap; }
.dy-pk.on { color: var(--c); border-color: var(--c); background: color-mix(in srgb, var(--c) 13%, var(--card)); }
.dy-wxrow { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 2px 0 10px; min-height: 4px; }
.dy-wxline { font-size: 12px; color: var(--text); display: inline-flex; align-items: center; gap: 4px; }
.dy-mini {
  font: inherit; font-size: 12px; color: var(--text-dim); background: var(--card-2); border: 1px solid var(--line-2);
  border-radius: 999px; padding: 5px 11px; cursor: pointer; display: inline-flex; align-items: center; gap: 4px;
}
.dy-mini:disabled { opacity: .55; }
.dy-x { background: none; border: 0; color: var(--text-dim); font-size: 13px; padding: 0 2px 0 4px; cursor: pointer; line-height: 1; }
.dy-tools { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.dy-tools:empty { display: none; }

/* 写真 */
.dy-photos { display: flex; gap: 8px; margin-top: 10px; overflow-x: auto; padding-bottom: 2px; }
.dy-ph, .dy-ph-add, .dy-th, .dy-gt { background-color: var(--bg-2, #f3ecdf); background-size: cover; background-position: center; }
.dy-ph { flex: none; width: 78px; height: 78px; border-radius: 10px; border: 0; padding: 0; cursor: pointer; }
.dy-ph-add {
  flex: none; width: 78px; height: 78px; border-radius: 10px; border: 1.5px dashed var(--line-2); color: var(--text-dim);
  background: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 10px; cursor: pointer;
}
.dy-ph.miss, .dy-th.miss, .dy-gt.miss { background-image: repeating-linear-gradient(45deg, transparent 0 6px, color-mix(in srgb, var(--text) 6%, transparent) 6px 12px); }
.dy-upnote { font-size: 11px; color: var(--text-dim); margin-top: 6px; line-height: 1.6; }
.dy-viewer { text-align: center; }
.dy-viewer img { max-width: 100%; max-height: 70vh; border-radius: 10px; background: var(--bg-2); min-height: 120px; }

/* タグ */
.dy-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; align-items: center; }
.dy-tag { font-size: 12px; color: var(--sun-2); background: var(--sun-soft); border-radius: 999px; padding: 4px 6px 4px 10px; display: inline-flex; align-items: center; }

/* 切り替え */
.dy-seg { display: flex; background: var(--bg-2, #f3ecdf); border-radius: 12px; padding: 3px; margin: 4px 0 12px; }
.dy-seg button { flex: 1; padding: 8px 0; font: inherit; font-size: 12.5px; font-weight: 700; color: var(--text-dim); background: none; border: 0; border-radius: 9px; cursor: pointer; white-space: nowrap; }
.dy-seg button.on { background: var(--card); color: var(--text); box-shadow: var(--shadow); }

.dy-phead { display: flex; align-items: baseline; gap: 6px; font-size: 13px; font-weight: 700; margin-bottom: 6px; }
.dy-phead .en { color: var(--sun); font-size: 11px; letter-spacing: .08em; }
.dy-range { margin-left: auto; font-size: 11px; font-weight: 400; color: var(--text-dim); display: inline-flex; align-items: center; gap: 4px; }
.dy-shift { width: 30px; height: 28px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--text); cursor: pointer; font-size: 14px; }

/* 10年 */
.dy-row { border-bottom: 1px dashed var(--line); }
.dy-row:last-child { border-bottom: 0; }
.dy-rbtn { display: grid; grid-template-columns: 66px 1fr auto; gap: 8px; align-items: start; width: 100%; text-align: left; padding: 10px 2px; background: none; border: 0; font: inherit; color: var(--text); cursor: pointer; }
.dy-rbtn:disabled { cursor: default; }
.dy-ry { font-size: 14px; font-weight: 800; white-space: nowrap; }
.dy-ry small { display: block; font-size: 10px; font-weight: 400; color: var(--text-dim); margin-top: 1px; }
.dy-ry small.hol { color: var(--red, #d8402f); }
.dy-rmid { min-width: 0; }
.dy-rann { display: block; font-size: 11px; color: var(--sun-2); font-weight: 700; margin-bottom: 2px; }
.dy-rt { font-size: 13.5px; line-height: 1.65; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.dy-row.open .dy-rt { -webkit-line-clamp: unset; display: block; white-space: pre-wrap; }
.dy-licons { display: flex; gap: 2px; margin-bottom: 2px; align-items: center; }
.dy-grade { font-size: 12px; color: var(--sun-2); font-weight: 700; padding: 0 2px; }
.dy-th { width: 46px; height: 46px; border-radius: 8px; display: block; }
.dy-row.cur .dy-rbtn { background: var(--sun-soft); border-radius: 10px; padding-left: 8px; padding-right: 8px; }
.dy-row.cur .dy-rt { color: var(--sun-2); font-size: 12.5px; }
.dy-row.empty .dy-rt, .dy-row.none .dy-rt, .dy-row.fut .dy-ry, .dy-row.none .dy-ry { color: var(--text-dim); }
.dy-rmore { display: none; padding: 0 2px 12px 74px; }
.dy-row.open .dy-rmore { display: block; }
.dy-rmore .dy-photos { margin: 0 0 8px; }
.dy-link { font: inherit; font-size: 12px; color: var(--sun-2); font-weight: 700; background: none; border: 0; padding: 0; cursor: pointer; }

/* 一覧の1行（最近・さがす） */
.dy-lrow { display: grid; grid-template-columns: 52px 1fr auto; gap: 10px; align-items: start; padding: 10px 2px; border: 0; border-bottom: 1px dashed var(--line); width: 100%; text-align: left; background: none; font: inherit; color: var(--text); cursor: pointer; }
.dy-lrow:last-of-type { border-bottom: 0; }
.dy-ld { text-align: center; }
.dy-ld b { display: block; font-size: 20px; font-weight: 800; line-height: 1.1; }
.dy-ld small { display: block; font-size: 10px; color: var(--text-dim); }
.dy-lbody { min-width: 0; }
.dy-lt { font-size: 13.5px; line-height: 1.65; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.dy-ltags { display: block; font-size: 11px; color: var(--sun-2); margin-top: 2px; }
.dy-more { margin-top: 10px; width: 100%; }
.dy-hitn { font-size: 12px; color: var(--text-dim); margin: 8px 2px 2px; }

/* 月 */
.dy-calhead { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.dy-calhead b { font-size: 15px; }
.dy-cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.dy-wd { font-size: 10px; text-align: center; color: var(--text-dim); padding-bottom: 2px; }
.dy-wd.sun { color: var(--red, #d8402f); }
.dy-wd.sat { color: #4f7fb3; }
.dy-cd { aspect-ratio: 1 / 1.12; border-radius: 9px; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding-top: 4px; gap: 2px; font: inherit; font-size: 12px; position: relative; background: var(--card-2); border: 0; color: var(--text); cursor: pointer; }
.dy-cd.blank { background: none; cursor: default; }
.dy-cd.sun .dy-cn { color: var(--red, #d8402f); }
.dy-cd.sat .dy-cn { color: #4f7fb3; }
.dy-cd.today { outline: 2px solid var(--sun); outline-offset: -2px; }
.dy-cd.sel { background: var(--sun-soft); }
.dy-cd .ic { width: 18px; height: 18px; }
.dy-cdot { width: 7px; height: 7px; border-radius: 50%; background: var(--line-2); margin-top: 5px; }
.dy-pdot, .dy-adot { position: absolute; bottom: 4px; width: 5px; height: 5px; border-radius: 50%; }
.dy-pdot { right: 4px; background: var(--gold); }
.dy-adot { left: 4px; background: var(--sun); }
.dy-legend { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; font-size: 10px; color: var(--text-dim); align-items: center; }
.dy-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 3px; vertical-align: -1px; }
.dy-legend i.p { background: var(--gold); width: 6px; height: 6px; }
.dy-legend i.a { background: var(--sun); width: 6px; height: 6px; }
.dy-mstat { margin-top: 10px; font-size: 12px; color: var(--text-dim); }

/* 写真の一覧 */
.dy-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
@media (min-width: 560px) { .dy-grid { grid-template-columns: repeat(4, 1fr); } }
.dy-gt { aspect-ratio: 1; border-radius: 8px; position: relative; overflow: hidden; border: 0; padding: 0; cursor: pointer; }
.dy-gt span { position: absolute; left: 0; right: 0; bottom: 0; font-size: 10px; color: #fff; padding: 10px 6px 4px; background: linear-gradient(transparent, rgba(0, 0, 0, .45)); text-align: left; }

/* さがす */
.dy-filters { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.dy-fchip { font: inherit; font-size: 12px; color: var(--text-dim); background: var(--card); border: 1px solid var(--line-2); border-radius: 999px; padding: 4px 10px; cursor: pointer; display: inline-flex; align-items: center; gap: 3px; }
.dy-fchip small { font-size: 10px; opacity: .7; margin-left: 2px; }
.dy-fchip.on { border-color: var(--sun); color: var(--sun-2); background: var(--sun-soft); }
.dy-fchip .ic.sm { width: 18px; height: 18px; vertical-align: 0; }

/* まとめ */
.dy-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.dy-stats div { background: var(--card-2); border-radius: 10px; padding: 10px 6px; text-align: center; }
.dy-stats b { display: block; font-size: 22px; font-weight: 800; line-height: 1.2; }
.dy-stats span { font-size: 10px; color: var(--text-dim); }
.dy-sub { font-size: 12px; font-weight: 700; color: var(--text-dim); margin: 16px 0 6px; }
.dy-moodbar { display: flex; height: 14px; border-radius: 7px; overflow: hidden; gap: 2px; }
.dy-bars { display: grid; grid-template-columns: repeat(12, 1fr); gap: 4px; height: 92px; align-items: end; }
.dy-bars div { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 2px; }
.dy-bars i { width: 100%; max-width: 18px; background: var(--sun); opacity: .8; border-radius: 4px 4px 0 0; min-height: 2px; }
.dy-bars b { font-size: 9px; font-weight: 400; color: var(--text-dim); min-height: 11px; }
.dy-bars span { font-size: 9px; color: var(--text-dim); }
.dy-annrow { display: flex; justify-content: space-between; align-items: center; font-size: 13px; padding: 7px 2px; border-bottom: 1px dashed var(--line); }
.dy-annrow:last-child { border-bottom: 0; }

/* 設定 */
.dy-set { display: flex; flex-direction: column; gap: 6px; }
.dy-set-h { font-size: 12px; font-weight: 700; color: var(--sun-2); margin-top: 12px; letter-spacing: .04em; }
.dy-set textarea { min-height: 96px; font-size: 16px; }
.dy-annadd { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.dy-annadd .ta.oneline { flex: 1; min-width: 120px; font-size: 16px; }


/* 印刷・PDF。印刷のあいだだけ、アプリを隠して日記だけを紙の形に並べる */
#dy-print { display: none; }
@media print {
  body.dy-printing > *:not(#dy-print) { display: none !important; }
  body.dy-printing { background: #fff !important; }
  body.dy-printing #dy-print { display: block; color: #222; font-family: -apple-system, "Hiragino Mincho ProN", "Yu Mincho", serif; }
  #dy-print h1 { font-size: 20pt; margin: 0 0 12pt; }
  #dy-print section { break-inside: avoid-page; padding: 10pt 0; border-bottom: .5pt solid #bbb; }
  #dy-print h2 { font-size: 12.5pt; margin: 0 0 3pt; }
  #dy-print h2 small { font-size: 9pt; color: #c33; margin-left: 6pt; }
  #dy-print .pm { font-size: 9pt; color: #666; margin-bottom: 4pt; }
  #dy-print .pt { font-size: 10.5pt; line-height: 1.8; }
  #dy-print .pp { display: flex; flex-wrap: wrap; gap: 6pt; margin-top: 6pt; }
  #dy-print .pp img { width: 31%; height: auto; border-radius: 3pt; }
}

/* v146 今日以外の日を見ているときの「今日の日記に戻る」（下のタブの上に浮かせる） */
.dy-backtoday { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(env(safe-area-inset-bottom, 0px) + 78px); z-index: 80; display: inline-flex; align-items: center; gap: 10px; max-width: calc(100vw - 32px); padding: 10px 16px; border: 0; border-radius: 999px; background: var(--text); color: #fff; font: inherit; font-size: 13px; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22); cursor: pointer; white-space: nowrap; }
.dy-backtoday b { color: #ffd2b8; font-weight: 700; }
.dy-backtoday:active { transform: translateX(-50%) scale(0.97); }
@media (min-width: 900px) { .dy-backtoday { bottom: 28px; } }
