/* 明るさの階段で階層を作り、色相は青1つだけ（量の濃淡にも同じ青を使う） */
:root {
  --bg: #ffffff;
  --surface: #f5f5f4;
  --line: #e4e4e2;
  --ink: #1a1a1a;
  --sub: #555555;
  --muted: #767676;
  --accent: #1c5cab;
  --heat-0: #eeeeec;
  --heat-1: #b7d3f6;
  --heat-2: #86b6ef;
  --heat-3: #5598e7;
  --heat-4: #2a78d6;
  --heat-5: #184f95;
  --font: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", "Meiryo", sans-serif;
  --num: ui-rounded, "SF Pro Rounded", "Hiragino Maru Gothic ProN", -apple-system, "Noto Sans JP", sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121212; --surface: #1c1c1c; --line: #2e2e2e;
    --ink: #ececec; --sub: #b4b4b4; --muted: #8e8e8e; --accent: #86b6ef;
    --heat-0: #232323; --heat-1: #0d366b; --heat-2: #184f95; --heat-3: #256abf; --heat-4: #3987e5; --heat-5: #86b6ef;
  }
}
:root[data-theme="dark"] {
  --bg: #121212; --surface: #1c1c1c; --line: #2e2e2e;
  --ink: #ececec; --sub: #b4b4b4; --muted: #8e8e8e; --accent: #86b6ef;
  --heat-0: #232323; --heat-1: #0d366b; --heat-2: #184f95; --heat-3: #256abf; --heat-4: #3987e5; --heat-5: #86b6ef;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font); font-size: 16px; line-height: 1.75;
  font-feature-settings: "palt" 0;
}
a { color: inherit; }
img, video { display: block; max-width: 100%; }
.num { font-family: var(--num); font-variant-numeric: tabular-nums; }

/* 頭 */
.top {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 16px;
  padding: 8px 16px; background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; font-size: 18px; text-decoration: none; letter-spacing: .02em; }
.tabs { display: flex; gap: 0; overflow-x: auto; scrollbar-width: none; }
.tabs a {
  display: flex; align-items: center; min-height: 44px; padding: 0 12px;
  text-decoration: none; color: var(--sub); white-space: nowrap; font-size: 15px;
  border-bottom: 2px solid transparent;
}
.tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--ink); font-weight: 600; }

main { outline: none; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 32px 16px 80px; }
h1 { font-size: 32px; line-height: 1.4; margin: 0 0 16px; letter-spacing: .01em; }
h2 { font-size: 20px; line-height: 1.5; margin: 48px 0 16px; }
h3 { font-size: 16px; margin: 0 0 8px; }
.warn { background: var(--surface); border: 1px solid var(--ink); border-radius: 8px; padding: 8px 16px; margin: 0 0 24px; font-size: 14px; }
.lead { font-size: 18px; color: var(--sub); max-width: 40em; margin: 0; }
.note { color: var(--muted); font-size: 13px; }

/* 数字の列 */
.numbers { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 8px; margin-top: 32px; }
.stat { background: var(--surface); border-radius: 12px; padding: 16px; }
.stat .value { font-family: var(--num); font-size: 32px; font-weight: 700; line-height: 1.2; }
.stat .label { font-size: 14px; font-weight: 600; margin-top: 4px; }
.stat .note { margin-top: 4px; line-height: 1.5; }

/* 濃淡のカレンダー */
.heat-wrap { overflow-x: auto; padding-bottom: 8px; }
.heat { display: grid; grid-auto-flow: column; grid-template-rows: 16px repeat(7, 14px); gap: 3px; width: max-content; }
.heat .m { font-size: 11px; color: var(--muted); line-height: 16px; white-space: nowrap; }
.heat button {
  width: 14px; height: 14px; padding: 0; border: 0; border-radius: 3px;
  background: var(--heat-0); cursor: pointer; position: relative;
}
.heat button::after { content: ""; position: absolute; inset: -2px; } /* 押せる範囲を少し広げる */
.heat button:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }
.heat .blank { width: 14px; height: 14px; }
.heat [data-l="1"] { background: var(--heat-1); }
.heat [data-l="2"] { background: var(--heat-2); }
.heat [data-l="3"] { background: var(--heat-3); }
.heat [data-l="4"] { background: var(--heat-4); }
.heat [data-l="5"] { background: var(--heat-5); }
.heat .today { box-shadow: 0 0 0 2px var(--bg), 0 0 0 3px var(--ink); }
.legend { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); margin-top: 8px; }
.legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.tip {
  position: fixed; z-index: 20; pointer-events: none; background: var(--ink); color: var(--bg);
  font-size: 13px; line-height: 1.5; padding: 8px 12px; border-radius: 8px; max-width: 260px;
}

/* 作品の札 */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 24px; }
.chip {
  min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--bg); color: var(--ink); font: inherit; font-size: 14px; cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 24px; }
.card {
  display: flex; flex-direction: column; text-align: left; font: inherit; color: inherit;
  background: none; border: 0; padding: 0; cursor: pointer;
}
.card .shot {
  aspect-ratio: 16 / 10; border-radius: 12px; overflow: hidden; background: var(--surface);
  border: 1px solid var(--line); transition: scale .15s cubic-bezier(.2,.8,.2,1);
}
.card .shot img, .card .shot video { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.card .shot.empty { display: grid; place-items: center; color: var(--muted); font-size: 14px; }
.card:hover .shot { scale: 1.015; }
.card:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; border-radius: 12px; }
.card .meta { display: flex; gap: 8px; align-items: center; margin-top: 16px; font-size: 13px; color: var(--muted); }
.card h3 { font-size: 18px; margin: 4px 0 0; }
.card p { margin: 4px 0 0; color: var(--sub); font-size: 14px; line-height: 1.6; }
.badge { font-size: 12px; font-weight: 600; padding: 0 8px; border-radius: 999px; border: 1px solid var(--line); line-height: 22px; }
.badge.live { color: var(--accent); border-color: currentColor; }
.badge.stop { color: var(--muted); }

/* 詳細 */
dialog {
  width: min(960px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 0;
  border: 0; border-radius: 16px; background: var(--bg); color: var(--ink);
}
dialog::backdrop { background: rgb(0 0 0 / .55); }
.close {
  position: sticky; top: 8px; float: right; margin: 8px 8px 0 0; width: 44px; height: 44px; border-radius: 999px;
  border: 0; background: var(--surface); color: var(--ink); font-size: 24px; cursor: pointer; z-index: 2;
}
.viewer-body { padding: 24px; }
.viewer-body h2 { margin: 0 0 8px; font-size: 24px; }
.gallery { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory; margin: 24px -24px; padding: 0 24px 8px; }
.gallery figure { margin: 0; flex: 0 0 auto; scroll-snap-align: start; max-width: min(640px, 80vw); }
.gallery img, .gallery video { max-height: 60vh; width: auto; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); }
.gallery figcaption { font-size: 12px; color: var(--muted); margin-top: 4px; }
ul.points { padding-left: 1.2em; margin: 16px 0; }
ul.points li { margin: 4px 0; }
.private { background: var(--surface); border-radius: 8px; padding: 16px; margin-top: 16px; font-size: 14px; }
.private b { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.links a { display: inline-flex; align-items: center; min-height: 44px; margin-right: 16px; color: var(--accent); word-break: break-all; }

/* 毎日の記録 */
.daynav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.daynav button, .daynav input {
  min-height: 44px; min-width: 44px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--bg); color: var(--ink); font: inherit; cursor: pointer;
}
.daynav button:disabled { opacity: .4; cursor: default; }
.dayhead { margin: 24px 0 8px; }
.dayhead .date { font-family: var(--num); color: var(--muted); font-size: 14px; }
.stats { display: flex; gap: 24px; flex-wrap: wrap; font-size: 14px; color: var(--sub); margin: 8px 0 0; }
.stats b { font-family: var(--num); font-size: 20px; color: var(--ink); margin-right: 4px; }
.lanes { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; margin-top: 24px; }
.lane { border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.lane h3 { display: flex; justify-content: space-between; font-size: 15px; }
.lane h3 span { font-family: var(--num); color: var(--muted); font-weight: 400; }
.check { list-style: none; padding: 0; margin: 0; }
.check li { display: grid; grid-template-columns: 20px 1fr; gap: 8px; padding: 4px 0; line-height: 1.6; font-size: 15px; }
.check li::before {
  content: ""; width: 16px; height: 16px; margin-top: 4px; border-radius: 4px; background: var(--accent);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M0 4a4 4 0 014-4h8a4 4 0 014 4v8a4 4 0 01-4 4H4a4 4 0 01-4-4zM4 8.5l2.5 2.5L12 5.5 10.6 4.1 6.5 8.2 5.4 7.1z' fill-rule='evenodd'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M0 4a4 4 0 014-4h8a4 4 0 014 4v8a4 4 0 01-4 4H4a4 4 0 01-4-4zM4 8.5l2.5 2.5L12 5.5 10.6 4.1 6.5 8.2 5.4 7.1z' fill-rule='evenodd'/%3E%3C/svg%3E") center / contain no-repeat;
}
.side { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; margin-top: 16px; }
.box { background: var(--surface); border-radius: 12px; padding: 16px; }
.box ol, .box ul { margin: 0; padding-left: 1.2em; }
.box li { margin: 4px 0; }
.empty-day { color: var(--muted); padding: 32px 0; }
.month-list { margin-top: 48px; }
.month-list a {
  display: grid; grid-template-columns: 64px 1fr auto; gap: 8px; align-items: center; min-height: 44px;
  padding: 4px 0; border-bottom: 1px solid var(--line); text-decoration: none; font-size: 14px;
}
.month-list a[aria-current="true"] { font-weight: 700; }
.month-list .d { font-family: var(--num); color: var(--muted); }
.month-list .c { font-family: var(--num); color: var(--muted); }

/* 年表 */
.tl { border-left: 2px solid var(--line); margin-left: 8px; padding-left: 24px; }
.tl section { position: relative; padding-bottom: 32px; }
.tl section::before {
  content: ""; position: absolute; left: -31px; top: 8px; width: 12px; height: 12px; border-radius: 999px;
  background: var(--bg); border: 2px solid var(--ink);
}
.tl h3 { font-family: var(--num); font-size: 18px; display: flex; gap: 16px; align-items: baseline; }
.tl h3 small { font-size: 13px; color: var(--muted); font-weight: 400; }
.tl ul { margin: 0; padding-left: 1.2em; }
.bar { height: 8px; border-radius: 4px; background: var(--heat-3); margin: 4px 0 8px; }

@media (max-width: 600px) {
  h1 { font-size: 24px; }
  .lead { font-size: 16px; }
  .wrap { padding-top: 24px; }
  .grid, .lanes, .side { grid-template-columns: 1fr; }
  .viewer-body { padding: 16px; }
  .gallery { margin: 16px -16px; padding: 0 16px 8px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
