:root {
  --bg: #faf8f5;
  --fg: #26231f;
  --muted: #7a7268;
  --line: #ddd6cc;
  --accent: #b5532f;
  --tile: #ebe6df;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--fg);
  background: var(--bg);
}

* { box-sizing: border-box; }
body { margin: 0; }
body.noscroll { overflow: hidden; }
button, input { font: inherit; }

.top { padding: 14px 16px 6px; }
.brand { color: var(--fg); text-decoration: none; font-weight: 600; letter-spacing: 0.02em; }

main { padding: 0 16px 48px; }
.status { color: var(--muted); }
.notice { background: #fbe9e1; border-left: 3px solid var(--accent); padding: 8px 12px; }

.card { max-width: 560px; margin: 40px auto; line-height: 1.5; }
.card h1 { font-size: 1.5rem; margin-bottom: 0.5rem; }
.phrase {
  display: block; margin: 20px 0; padding: 16px; font-size: 1.6rem; text-align: center;
  background: #fff; border: 1px solid var(--line); border-radius: 8px; letter-spacing: 0.03em;
}

.filters {
  display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: end;
  padding: 8px 0 16px; border-bottom: 1px solid var(--line); margin-bottom: 8px;
}
.filters fieldset { border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.filters legend { float: left; margin-right: 6px; color: var(--muted); font-size: 0.85rem; }
.filters label { display: flex; flex-direction: column; font-size: 0.85rem; color: var(--muted); gap: 2px; }
.filters input[type="date"] { padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--fg); }
.chip, .btn {
  border: 1px solid var(--line); background: #fff; color: var(--fg); border-radius: 999px;
  padding: 4px 12px; cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--fg); border-color: var(--fg); color: #fff; }
.btn { border-radius: 6px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn.link { border: 0; background: none; color: var(--accent); padding: 4px 0; }

.divider {
  display: flex; align-items: center; gap: 12px; margin: 20px 0 10px;
  font-size: 0.85rem; font-weight: 500; color: var(--muted);
}
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.month:first-child .divider { margin-top: 8px; }

.row { display: flex; gap: 4px; margin-bottom: 4px; }
.tile {
  position: relative; display: block; min-width: 0; padding: 0; border: 0;
  background: var(--tile); cursor: zoom-in; overflow: hidden;
}
.tile img { display: block; width: 100%; height: 100%; object-fit: cover; }
.tile.failed { background: repeating-linear-gradient(45deg, var(--tile), var(--tile) 6px, #e2dcd3 6px, #e2dcd3 12px); }
.tile:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
.play {
  position: absolute; right: 6px; bottom: 6px; width: 22px; height: 22px; border-radius: 50%;
  background: rgba(0, 0, 0, 0.55); display: grid; place-items: center;
}
.play::after {
  content: ""; margin-left: 2px; border-style: solid; border-width: 5px 0 5px 8px;
  border-color: transparent transparent transparent #fff;
}
.spacer { width: 100%; }
.empty { text-align: center; color: var(--muted); padding: 60px 0; }

.viewer {
  position: fixed; inset: 0; z-index: 10; background: rgba(18, 16, 14, 0.96); color: #f3efe9;
  display: grid; grid-template-rows: 1fr auto;
}
.stage { position: relative; display: grid; place-items: center; min-height: 0; padding: 12px; }
.stage img, .stage video { max-width: 100%; max-height: 100%; object-fit: contain; }
.stage .progress { display: grid; gap: 8px; justify-items: center; color: #cfc7bc; }
.stage progress { width: 220px; }
.bar {
  display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; justify-content: space-between;
  padding: 10px 16px; border-top: 1px solid #3a3530;
}
.meta { display: grid; gap: 2px; font-size: 0.9rem; }
.meta .name { color: #a59c90; word-break: break-all; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.viewer .btn { background: #2e2a26; border-color: #4a443d; color: #f3efe9; }
.viewer .btn.primary { background: var(--accent); border-color: var(--accent); }

@media (max-width: 600px) {
  main { padding: 0 6px 32px; }
  .filters { padding: 6px 4px 12px; }
}
