:root {
  color-scheme: light;
  --paper: #f7f4ed;
  --surface: #fffdf8;
  --ink: #262c2a;
  --muted: #5e6965;
  --line: #ddd8cb;
  --accent: #14634e;
  --soft: #e6ede5;
  --rail: #202b29;
  --rail-light: #d2ded8;
  font: 16px/1.8 "Hiragino Sans", "Yu Gothic", "Noto Sans JP", system-ui, sans-serif;
  scroll-padding-top: 1.25rem;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); }
a { color: var(--accent); text-underline-offset: .18em; }
a:not([href]) { color: inherit; text-decoration: none; }
button {
  appearance: none;
  cursor: pointer;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: .4rem;
  padding: .45rem .75rem;
  color: var(--accent);
  font: inherit;
  font-size: .82rem;
}
button:hover { background: var(--soft); }
:focus-visible { outline: 2px solid #cc8f42; outline-offset: 3px; }

.layout { display: grid; grid-template-columns: minmax(13rem, 17rem) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  align-self: start;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  padding: 2rem 1rem 1.25rem;
  background: var(--rail);
  color: #f6f6ee;
  scrollbar-color: #65756e var(--rail);
}
.name { padding: 0 .65rem; margin: 0 0 1.6rem; font-size: 1rem; font-weight: 700; }
.boards { display: grid; gap: .35rem; }
.sidebar a {
  display: block;
  padding: .25rem .65rem;
  border-radius: .35rem;
  color: var(--rail-light);
  font-size: .82rem;
  text-decoration: none;
  overflow-wrap: anywhere;
}
.sidebar a:hover, .sidebar a[aria-current] { background: #354743; color: #fff; }
.outline { margin-top: 1.35rem; border-top: 1px solid #45544e; padding-top: .8rem; }
.outline:empty { display: none; }
.outline ul { list-style: none; padding: 0; margin: .4rem 0; }
.outline summary { cursor: pointer; padding: .25rem .65rem; font-size: .82rem; }
.outline .depth-3 { padding-left: .7rem; }
.outline .depth-4, .outline .depth-5, .outline .depth-6 { padding-left: 1.4rem; }

main { width: min(100%, 73rem); margin: 0 auto; min-width: 0; padding: clamp(1.25rem, 4vw, 4rem); }
.board-header { border-bottom: 1px solid var(--line); padding-bottom: 1.2rem; margin-bottom: 1.7rem; }
h1 {
  margin: 0 0 .65rem;
  font: 700 clamp(1.8rem, 4vw, 3.1rem)/1.35 "Hiragino Mincho ProN", "Yu Mincho", serif;
  overflow-wrap: anywhere;
}
.board-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; }
.gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr)); gap: 1rem; margin-bottom: 2rem; }
figure { margin: 0; min-width: 0; }
.gallery a, .prose .inline-image {
  display: inline-block;
  max-width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: .5rem;
  overflow: hidden;
  cursor: zoom-in;
}
.gallery a { display: block; }
.gallery img, .prose img { max-width: 100%; height: auto; display: block; }
.gallery img { width: 100%; }
figcaption { padding-top: .4rem; font-size: .82rem; color: var(--muted); }
.prose { overflow-wrap: anywhere; }
.prose > p, .prose > ul, .prose > ol, .prose > blockquote { max-width: 52rem; }
.prose h2, .prose h3, .prose h4 { line-height: 1.5; }
.prose h2 { margin: 2rem 0 .5rem; padding-bottom: .35rem; border-bottom: 1px solid var(--line); font-size: 1.4rem; }
.prose h3 { margin: 1.4rem 0 .4rem; font-size: 1.05rem; }
.prose :target { background: var(--soft); }
.prose blockquote { margin: 1rem 0; padding: .05rem 1rem; border-left: .2rem solid #a2b8a9; color: var(--muted); }
.prose pre, .table-wrap { overflow: auto; }
.prose pre { background: var(--surface); padding: .8rem; }
.prose table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.prose th, .prose td { padding: .65rem .7rem; border: 1px solid var(--line); text-align: left; vertical-align: top; }
.prose th { background: #eeeae1; }
.prose th:first-child, .prose td[data-review-label] { white-space: nowrap; }
.link-copy { margin: 0 .25rem; padding: .05rem .35rem; vertical-align: middle; font-size: .72rem; }
dialog { border: 1px solid var(--line); border-radius: .65rem; background: var(--surface); color: var(--ink); }
dialog::backdrop { background: #17211de0; }
.image-dialog { max-width: min(94vw, 110rem); max-height: 94vh; padding: .7rem; }
.image-bar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: .6rem; }
.image-dialog img { display: block; max-width: 100%; max-height: 80vh; object-fit: contain; }
.copy-dialog { width: min(90vw, 34rem); }
.copy-dialog p { margin-top: 0; }
.copy-dialog textarea { width: 100%; min-height: 5rem; font: inherit; }
.notice { position: fixed; right: 1rem; bottom: 1rem; background: var(--rail); color: white; border-radius: .4rem; padding: .5rem .8rem; }

@media (max-width: 760px) {
  .layout { display: block; }
  .sidebar { position: static; height: auto; padding: .75rem 1rem; }
  .name { margin-bottom: .4rem; }
  .outline { margin-top: .5rem; padding-top: .3rem; }
  .outline ul { max-height: 9rem; overflow: auto; }
  .prose th, .prose td { min-width: 9rem; }
  .prose th:first-child, .prose td:first-child { min-width: 0; }
}
