:root {
  --paper: #fffdf8;
  --ink: #25211d;
  --muted: #746b60;
  --line: #ded5c8;
  --accent: #2f6f68;
  --accent-soft: #e8f2ef;
  --thread: #f6f1e7;
  --company: #edf3f8;
  --research: #f1f2f5;
  --staff: #f3efe8;
  --sealed: #fff0f0;
  --redpen: #fff7f7;
  --note: #fffaf0;
  color-scheme: light;
}

body[data-theme="dark"] {
  --paper: #24211d;
  --ink: #eee7dc;
  --muted: #b9afa2;
  --line: #4c453b;
  --accent: #6bb5a8;
  --accent-soft: #1f302d;
  --thread: #252927;
  --company: #202b33;
  --research: #252833;
  --staff: #2b2721;
  --sealed: #342222;
  --redpen: #332020;
  --note: #312b1d;
  background: #171512;
  color-scheme: dark;
}

body[data-theme="paper"] {
  --paper: #fffdf8;
  --ink: #25211d;
  --muted: #746b60;
  --line: #ded5c8;
  --thread: #f6f1e7;
  background: #f4efe5;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  overflow-x: hidden;
  background: #f4efe5;
  color: var(--ink);
  font-family: "Yu Gothic", "Hiragino Sans", "Meiryo", sans-serif;
  line-height: 1.95;
}

a {
  color: #255f79;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

body[data-theme="dark"] a {
  color: #8bc9db;
}

.site-header {
  display: flex;
  gap: 0.8rem;
  align-items: center;
  min-height: 3.25rem;
  padding: 0.7rem clamp(1rem, 4vw, 2rem);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.94);
  position: sticky;
  top: 0;
  z-index: 10;
}

body[data-theme="dark"] .site-header {
  background: rgba(26, 24, 21, 0.94);
}

.home-link {
  font-weight: 700;
  white-space: nowrap;
}

.site-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.9rem;
  color: var(--muted);
  min-width: 0;
  overflow: hidden;
}

.site-breadcrumb a {
  color: inherit;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.site-breadcrumb a:hover {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

.site-breadcrumb span[aria-hidden] {
  flex-shrink: 0;
  opacity: 0.45;
  font-size: 0.8rem;
}

.site-breadcrumb > *:last-child {
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.top-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-left: auto;
  font-size: 0.92rem;
}

.top-nav a {
  text-decoration: none;
}

.mode-switcher {
  display: inline-flex;
  gap: 0.25rem;
  padding: 0.2rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.55);
}

body[data-theme="dark"] .mode-switcher {
  background: rgba(255, 255, 255, 0.06);
}

.mode-switcher button {
  min-height: 1.9rem;
  padding: 0.15rem 0.55rem;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 700;
}

.mode-switcher button[aria-pressed="true"] {
  background: var(--accent);
  color: #fff;
}

.page-shell {
  display: grid;
  grid-template-columns: minmax(0, 48rem) minmax(14rem, 19rem);
  gap: 2rem;
  align-items: start;
  width: min(100%, 74rem);
  margin: 0 auto;
  padding: 2rem clamp(1rem, 4vw, 2rem) 4rem;
}

.home .page-shell,
.series-index .page-shell,
.aux-page .page-shell {
  display: block;
  max-width: 62rem;
}

.special-index .page-shell {
  display: block;
  max-width: 74rem;
}

.products-page .page-shell,
.sealed-page .page-shell {
  max-width: 74rem;
}

.chapter {
  min-width: 0;
}

.chapter-page .page-shell {
  grid-template-columns: minmax(0, 42rem) minmax(13rem, 17rem);
  max-width: 66rem;
}

.chapter-page .chapter {
  font-size: 1.02rem;
}

.view-mode-banner {
  display: none;
}

.chapter-page[data-content-view="bbs"] .page-shell {
  display: block;
  max-width: 54rem;
}

.chapter-page[data-content-view="bbs"] .toc {
  display: none;
}

.chapter-page[data-content-view="bbs"] .chapter > :not(.view-mode-banner):not(.thread):not(.chapter-nav) {
  display: none;
}

.chapter-page[data-content-view="bbs"] .chapter > .chapter-nav {
  display: none;
}

.chapter-page[data-content-view="bbs"] .bbs-view-banner {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 0.8rem;
  align-items: center;
  margin: 0 0 1rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid #a9c4ce;
  border-radius: 8px;
  background: #eef7f8;
  color: var(--ink);
}

.chapter-page[data-content-view="bbs"] .bbs-view-banner strong {
  color: #2f6f68;
}

.chapter-page[data-content-view="bbs"] .bbs-view-banner span {
  flex: 1 1 16rem;
  color: var(--muted);
}

.chapter-page[data-content-view="bbs"] .bbs-view-banner a {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  padding: 0.1rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  font-weight: 800;
  text-decoration: none;
}

h1,
h2,
h3 {
  line-height: 1.45;
  letter-spacing: 0;
}

h1 {
  margin: 0 0 1.4rem;
  font-size: 1.85rem;
}

h2 {
  margin: 2rem 0 1rem;
  font-size: 1.28rem;
}

h3 {
  margin: 1.5rem 0 0.75rem;
  font-size: 1.08rem;
}

p {
  margin: 1.05rem 0;
}

.chapter > p {
  text-indent: 1em;
}

.chapter > p.dialogue,
.chapter > p.mono-line,
.chapter > p.lead,
.chapter > p.ledger-line,
.chapter > p.redpen-line,
.chapter > p.note-line,
.chapter > p.stamp-line,
.thread p,
.res p {
  text-indent: 0;
}

.lead {
  color: var(--muted);
  font-size: 1.02rem;
  overflow-wrap: anywhere;
}

hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 2rem 0;
}

.thread-separator {
  margin: 0.9rem 0;
  border-top-style: dashed;
  opacity: 0.7;
}

ul {
  padding-left: 1.4rem;
}

blockquote {
  margin: 1rem 0;
  padding: 0.6rem 0.9rem;
  border-left: 4px solid var(--accent);
  background: rgba(255, 255, 255, 0.55);
  color: #4f4942;
}

blockquote.redpen-quote {
  position: relative;
  padding: 0.85rem 1rem 0.85rem 2.6rem;
  border: 1px solid #e1a4a4;
  border-left: 5px solid #b92828;
  border-radius: 8px;
  background: #fff3f3;
  color: #8d2020;
  font-weight: 700;
}

blockquote.redpen-quote::before {
  content: "赤";
  position: absolute;
  left: 0.75rem;
  top: 0.8rem;
  display: grid;
  place-items: center;
  width: 1.35rem;
  height: 1.35rem;
  border: 2px solid #b92828;
  border-radius: 50%;
  color: #b92828;
  font-size: 0.78rem;
  line-height: 1;
}

.dialogue {
  margin-left: 0.5rem;
}

.mono-line,
code,
pre {
  font-family: "Consolas", "Yu Gothic", monospace;
}

.ledger-line {
  padding: 0.45rem 0.65rem;
  border-left: 4px solid #ad3830;
  background: #fff4f1;
}

.redpen-line {
  position: relative;
  padding: 0.75rem 0.9rem 0.75rem 2.65rem;
  border: 1px solid #e2a2a2;
  border-left: 5px solid #b92828;
  border-radius: 8px;
  background: #fff7f7;
  color: #a52828;
  font-weight: 700;
}

.redpen-line::before {
  content: "赤";
  position: absolute;
  left: 0.75rem;
  top: 0.8rem;
  display: grid;
  place-items: center;
  width: 1.35rem;
  height: 1.35rem;
  border: 2px solid #b92828;
  border-radius: 50%;
  color: #b92828;
  font-size: 0.78rem;
  line-height: 1;
}

.note-line {
  position: relative;
  padding: 0.7rem 0.9rem 0.7rem 3.1rem;
  border: 1px solid #dfca8b;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(190, 83, 83, 0.22) 2.25rem, transparent 2.25rem),
    linear-gradient(#fffaf0 0 2rem, #eadbb7 2.05rem);
  background-size: 100% 2.1rem;
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.72);
}

.note-line::before {
  content: "NOTE";
  position: absolute;
  left: 0.55rem;
  top: 0.75rem;
  color: #9a7424;
  font-size: 0.72rem;
  font-weight: 700;
  writing-mode: vertical-rl;
  letter-spacing: 0;
}

.mark-danger,
.mark-sealed,
.mark-redpen,
.mark-staff {
  padding: 0.02em 0.18em;
  border-radius: 4px;
  font-weight: 700;
}

.mark-danger {
  color: #9f231f;
  background: #ffe8e4;
}

.mark-sealed {
  color: #6f2720;
  background: #f6d9d4;
  border: 1px solid rgba(159, 35, 31, 0.22);
}

.mark-redpen {
  color: #b92828;
  background: linear-gradient(transparent 58%, rgba(185, 40, 40, 0.2) 58%);
}

.mark-staff {
  color: #235f52;
  background: #e5f2ee;
}

.shake-text {
  display: inline-block;
  animation: micro-shake 0.28s infinite;
  transform-origin: 50% 70%;
}

@keyframes micro-shake {
  0%,
  100% {
    transform: translate(0, 0) rotate(0deg);
  }

  33% {
    transform: translate(0.04em, -0.02em) rotate(0.35deg);
  }

  66% {
    transform: translate(-0.035em, 0.02em) rotate(-0.3deg);
  }
}

pre {
  overflow-x: auto;
  padding: 1rem;
  border: 1px solid var(--line);
  background: #fbf8f1;
}

.series-grid {
  display: grid;
  gap: 1rem;
}

.portal-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin: 1.4rem 0 1.8rem;
}

.portal-links a {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 2.4rem;
  padding: 0.3rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  text-decoration: none;
  font-weight: 700;
  white-space: normal;
}

.series-card {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--line);
  border-left: 6px solid var(--accent);
  border-radius: 8px;
  background: var(--paper);
}

.series-card h2 {
  margin: 0 0 0.2rem;
}

.series-card p {
  margin: 0.25rem 0;
}

.series-card .count {
  color: var(--muted);
  font-size: 0.92rem;
}

.series-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-content: center;
  justify-content: flex-end;
  min-width: 8rem;
}

.series-actions a,
.chapter-nav a,
.aux-links a {
  display: inline-flex;
  align-items: center;
  min-height: 2.25rem;
  padding: 0.25rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  text-decoration: none;
}

.chapter-list {
  display: grid;
  gap: 0.45rem;
  padding-left: 0;
  list-style: none;
}

.chapter-list a {
  display: grid;
  grid-template-columns: 2.2rem minmax(0, 1fr);
  gap: 0.7rem;
  align-items: baseline;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
}

.chapter-list li {
  display: grid;
  gap: 0.25rem;
}

.chapter-list span {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.aux-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 1.2rem 0 1.6rem;
}

.thread {
  margin: 1.6rem 0;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--thread);
}

.section-block {
  margin: 1.8rem 0;
}

.section-block h2 {
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--line);
}

.thread::before {
  display: inline-flex;
  align-items: center;
  min-height: 1.55rem;
  padding: 0.05rem 0.55rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.thread h2 {
  margin-top: 0;
}

.thread.company {
  background: var(--company);
  border-color: #aec9dc;
}

.thread.company::before {
  content: "企業BBS";
  color: #255f79;
}

.thread.research {
  background: var(--research);
  border-color: #bfc5d2;
}

.thread.research::before {
  content: "研究所BBS";
  color: #535f80;
}

.thread.staff {
  background: var(--staff);
  border-color: #d5c7b3;
}

.thread.staff::before {
  content: "職員・業務連絡";
  color: #775a34;
}

.thread.sealed {
  background: var(--sealed);
  border-color: #d8b2ad;
}

.thread.sealed::before {
  content: "封印台帳";
  color: #9f231f;
}

.thread.redpen {
  background: var(--redpen);
  border-color: #dfaaa5;
}

.thread.redpen::before {
  content: "赤ペン添削";
  color: #b92828;
}

.thread.note {
  background: var(--note);
  border-color: #ddc892;
}

.thread.note::before {
  content: "ノート";
  color: #80621c;
}

.thread.tresen::before {
  content: "トレセンBBS";
  color: #2f6f68;
}

.thread-chunk {
  margin: 0.9rem 0;
}

.thread-chunk > summary {
  cursor: pointer;
  list-style: none;
  padding: 0.45rem 0.75rem;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--muted);
  font-weight: 700;
}

.thread-chunk > summary::-webkit-details-marker {
  display: none;
}

.thread-chunk > summary::before {
  content: "＋";
  display: inline-block;
  width: 1.25rem;
  color: var(--accent);
  font-weight: 700;
}

.thread-chunk[open] > summary::before {
  content: "−";
}

.res {
  margin: 0.75rem 0;
  padding: 0.75rem 0.85rem;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.res-head {
  color: #51615f;
  font-size: 0.92rem;
  font-weight: 700;
}

.thread.company .res-head {
  color: #255f79;
}

.thread.research .res-head {
  color: #535f80;
}

.thread.staff .res-head {
  color: #775a34;
}

.thread.sealed .res-head,
.thread.redpen .res-head {
  color: #9f231f;
}

.res p {
  margin: 0.35rem 0 0;
}

.chapter-nav {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 2.5rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--line);
}

.record-panel {
  position: relative;
  margin: 0 0 1.4rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-left: 6px solid var(--accent);
  border-radius: 8px;
  background: var(--accent-soft);
}

.record-stamp {
  margin-top: 0.75rem;
}

.record-title {
  margin-bottom: 0.4rem;
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--muted);
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 1.55rem;
  padding: 0.1rem 0.55rem;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  font-size: 0.82rem;
  font-weight: 700;
}

.danger-meter {
  display: grid;
  grid-template-columns: max-content max-content minmax(7rem, 12rem);
  gap: 0.45rem 0.6rem;
  align-items: center;
  margin-top: 0.65rem;
}

.danger-label {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.danger-stars {
  color: #b73930;
  font-family: "Yu Gothic", "Hiragino Sans", "Meiryo", sans-serif;
  font-size: 0.92rem;
  letter-spacing: 0;
  white-space: nowrap;
}

.danger-track {
  height: 0.6rem;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(0, 0, 0, 0.12);
}

.danger-fill {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #3d806f, #d5a037, #b73930);
}

.stamp {
  display: inline-flex;
  align-items: center;
  min-height: 1.9rem;
  padding: 0.1rem 0.55rem;
  border: 2px solid #b92828;
  border-radius: 4px;
  color: #b92828;
  background: rgba(255, 247, 247, 0.58);
  font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
  font-size: 0.88rem;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1.2;
  transform: rotate(-4deg);
}

.stamp-line {
  display: inline-flex;
  align-items: center;
  min-height: 2.2rem;
  padding: 0.25rem 0.7rem;
  border: 1px dashed #b92828;
  border-radius: 8px;
  color: #b92828;
  background: #fff7f7;
  font-weight: 700;
}

.record-list {
  display: grid;
  gap: 0.8rem;
  padding-left: 0;
  list-style: none;
}

.bbs-terminal,
.catalog-console,
.sealed-console {
  margin: 1.5rem 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  overflow: hidden;
}

.bbs-terminal {
  background:
    linear-gradient(180deg, rgba(29, 39, 45, 0.96), rgba(35, 45, 48, 0.94)),
    #1d272d;
  color: #eef7f2;
}

.terminal-top {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 2.3rem;
  padding: 0.35rem 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  color: #adc8bf;
  font-size: 0.82rem;
}

.terminal-top span {
  width: 0.62rem;
  height: 0.62rem;
  border-radius: 999px;
  background: #d6736f;
}

.terminal-top span:nth-child(2) {
  background: #d9b85f;
}

.terminal-top span:nth-child(3) {
  background: #72b982;
  margin-right: 0.35rem;
}

.board-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: rgba(255, 255, 255, 0.12);
}

.board-card {
  padding: 1rem;
  background: rgba(255, 255, 255, 0.055);
}

.board-card h2,
.board-card p {
  margin: 0;
}

.board-card p {
  margin-top: 0.35rem;
  color: #c7d6d0;
  text-indent: 0;
}

.board-card .read-state-badge {
  margin-top: 0.5rem;
}

.board-card-head {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  align-items: baseline;
}

.board-card-head span {
  padding: 0.05rem 0.48rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  color: #fff8db;
  font-size: 0.82rem;
  font-weight: 800;
}

.compact-record-links {
  display: grid;
  gap: 0.35rem;
  margin: 0.8rem 0 0;
  padding: 0;
  list-style: none;
}

.compact-record-links li {
  display: grid;
  gap: 0.05rem;
  padding: 0.45rem 0.55rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.14);
}

.compact-record-links a {
  color: #d8f2e9;
  font-weight: 700;
  text-decoration: none;
}

.compact-record-links span {
  color: #aabbb6;
  font-size: 0.82rem;
}

.catalog-console,
.sealed-console {
  padding: 1rem;
  background:
    linear-gradient(90deg, rgba(47, 111, 104, 0.07), transparent 45%),
    var(--paper);
}

.catalog-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.catalog-stats span,
.vault-warning {
  padding: 0.7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.55);
}

.catalog-stats strong {
  display: block;
  color: var(--accent);
  font-size: 1.25rem;
  line-height: 1.1;
}

.filter-panel {
  display: grid;
  gap: 0.85rem;
}

.filter-label {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.filter-button-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.filter-button-group button {
  min-height: 2.2rem;
  padding: 0.18rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
}

.filter-button-group button[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.filter-empty {
  margin: 0.8rem 0 0;
  color: var(--muted);
  text-indent: 0;
}

.vault-warning {
  display: grid;
  gap: 0.2rem;
  margin-bottom: 1rem;
  border-color: #d8b2ad;
  background: rgba(255, 240, 240, 0.72);
}

.vault-warning strong {
  color: #9f231f;
}

.products-page .chapter > p {
  text-indent: 0;
}

.product-group {
  margin: 1rem 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.42);
}

.product-group > summary {
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  min-height: 2.6rem;
  align-items: center;
  padding: 0.45rem 0.85rem;
  border-radius: 8px;
  color: var(--ink);
  font-weight: 800;
}

.product-group > summary::-webkit-details-marker {
  display: none;
}

.product-group > summary::before {
  content: "＋";
  color: var(--accent);
}

.product-group[open] > summary::before {
  content: "−";
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr));
  gap: 0.9rem;
  padding: 0 0.85rem 0.85rem;
}

.product-card {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  min-width: 0;
  padding: 0.95rem;
  border: 1px solid var(--line);
  border-left: 6px solid #ad3830;
  border-radius: 8px;
  background: var(--paper);
}

.product-card h3 {
  margin: 0;
}

.product-card p {
  margin: 0;
  text-indent: 0;
}

.ledger-product-card[data-status="safe"] {
  border-left-color: #6b9b68;
  background:
    linear-gradient(90deg, rgba(107, 155, 104, 0.08), transparent 32%),
    var(--paper);
}

.ledger-product-card[data-status="review"],
.ledger-product-card[data-status="active"] {
  border-left-color: #a36a20;
}

.product-card .danger-meter,
.ledger-card .danger-meter {
  grid-template-columns: max-content minmax(0, 1fr);
}

.product-card .danger-track,
.ledger-card .danger-track {
  grid-column: 1 / -1;
}

.product-card .danger-stars,
.ledger-card .danger-stars {
  min-width: 0;
  overflow-wrap: anywhere;
}

.product-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}

.product-code,
.product-category,
.product-status {
  display: inline-flex;
  align-items: center;
  min-height: 1.7rem;
  padding: 0.08rem 0.55rem;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 800;
}

.product-code {
  border: 1px solid rgba(0, 0, 0, 0.16);
  background: rgba(255, 255, 255, 0.72);
  color: #4f4942;
  font-family: "Consolas", "Yu Gothic", monospace;
}

.product-category {
  border: 1px solid rgba(47, 111, 104, 0.24);
  background: var(--accent-soft);
  color: var(--accent);
}

.product-status {
  color: #fff;
}

.product-status.sealed {
  background: #9f231f;
}

.product-status.safe {
  background: #2f6f68;
}

.product-status.review {
  background: #a36a20;
}

.product-status.active {
  background: #69588f;
}

.product-meta {
  display: grid;
  gap: 0.65rem;
  margin: 0;
}

.product-meta div {
  display: grid;
  gap: 0.2rem;
}

.product-meta dt {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.product-meta dd {
  margin: 0;
}

.goodwill-meter {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 0.5rem;
  align-items: center;
}

.goodwill-label {
  color: #3d7654;
  font-size: 0.86rem;
  font-weight: 900;
}

.goodwill-track {
  display: block;
  min-width: 6rem;
  height: 0.55rem;
  overflow: hidden;
  border: 1px solid rgba(61, 118, 84, 0.24);
  border-radius: 999px;
  background: #eef6e9;
}

.goodwill-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #8fcf90, #e6c76b);
}

.ledger-comments {
  border-top: 1px dashed var(--line);
  padding-top: 0.55rem;
}

.ledger-comments > summary {
  cursor: pointer;
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 900;
}

.ledger-comments dl {
  display: grid;
  gap: 0.5rem;
  margin: 0.65rem 0 0;
}

.ledger-comments div {
  display: grid;
  gap: 0.15rem;
  padding: 0.55rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.5);
}

.ledger-comments dt {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 900;
}

.ledger-comments dd {
  margin: 0;
}

.related-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.related-links a {
  display: inline-flex;
  align-items: center;
  min-height: 1.8rem;
  padding: 0.08rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
}

.muted {
  color: var(--muted);
}

.record-list > li,
.ledger-card,
.timeline-block {
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.record-list a,
.ledger-card h2 a {
  font-weight: 700;
}

.series-name {
  display: block;
  color: var(--muted);
  font-size: 0.9rem;
}

.ledger-grid {
  display: grid;
  gap: 1rem;
}

.ledger-card {
  position: relative;
  overflow: hidden;
  border-left: 6px solid #ad3830;
  background:
    linear-gradient(90deg, rgba(173, 56, 48, 0.08), transparent 34%),
    var(--paper);
}

.ledger-card::after {
  content: "SEALED";
  position: absolute;
  right: -1.4rem;
  bottom: 0.35rem;
  color: rgba(173, 56, 48, 0.09);
  font-size: 3.2rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  transform: rotate(-8deg);
  pointer-events: none;
}

.ledger-header {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
  margin-bottom: 0.75rem;
}

.ledger-id,
.ledger-status {
  display: inline-flex;
  align-items: center;
  min-height: 1.75rem;
  padding: 0.08rem 0.55rem;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 800;
}

.ledger-id {
  border: 1px solid rgba(0, 0, 0, 0.16);
  background: rgba(255, 255, 255, 0.72);
  color: #4f4942;
  font-family: "Consolas", "Yu Gothic", monospace;
}

.ledger-status {
  color: #fff;
}

.ledger-status.sealed {
  background: #9f231f;
}

.ledger-status.checked {
  background: #2f6f68;
}

.ledger-card h2,
.timeline-block h2 {
  margin-top: 0;
}

.ledger-evidence {
  position: relative;
  z-index: 1;
  margin-top: 0.9rem;
}

.ledger-evidence > summary {
  cursor: pointer;
  display: inline-flex;
  min-height: 2rem;
  align-items: center;
  padding: 0.15rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-weight: 700;
}

.evidence-list {
  margin-bottom: 0;
}

.ledger-notice {
  display: grid;
  gap: 0.25rem;
  margin: 1rem 0 1.2rem;
  padding: 0.85rem 1rem;
  border: 1px solid #d6c59f;
  border-left: 6px solid #b48a35;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(221, 190, 107, 0.18), transparent 40%),
    var(--paper);
}

.ledger-notice p,
.ledger-summary-block p,
.ledger-followup p,
.drawer-note {
  margin: 0;
  text-indent: 0;
}

.catalog-index-section,
.ledger-case-section {
  margin: 1.4rem 0;
}

.ledger-section-heading {
  max-width: 58rem;
  margin: 0 0 0.8rem;
}

.ledger-section-heading h2 {
  margin: 0.15rem 0 0.35rem;
}

.ledger-section-heading p:last-child {
  margin-bottom: 0;
}

.ledger-case-grid {
  display: grid;
  gap: 1.2rem;
  margin: 1.2rem 0;
}

.sealed-source-list {
  display: grid;
  gap: 0.75rem;
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
}

.sealed-source-item {
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-left: 4px solid #9d6a3a;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.42);
}

.sealed-source-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
  margin-bottom: 0.35rem;
}

.sealed-source-item h3 {
  margin: 0 0 0.25rem;
  font-size: 1rem;
}

.seal-console {
  background:
    linear-gradient(90deg, rgba(116, 82, 52, 0.08), transparent 42%),
    var(--paper);
}

.seal-ledger-board {
  display: grid;
  gap: 1.25rem;
  margin: 1.4rem 0;
}

.seal-storage-section {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.42);
}

.seal-storage-head {
  display: grid;
  gap: 0.25rem;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, rgba(80, 62, 45, 0.08), transparent);
}

.seal-storage-head span {
  display: inline-flex;
  width: max-content;
  min-height: 1.75rem;
  align-items: center;
  padding: 0.08rem 0.55rem;
  border: 1px solid currentColor;
  border-radius: 6px;
  color: #8f332c;
  font-size: 0.8rem;
  font-weight: 900;
}

.seal-storage-head h2,
.seal-storage-head p {
  margin: 0;
  text-indent: 0;
}

.seal-card-grid {
  display: grid;
  gap: 0.95rem;
  padding: 1rem;
}

.seal-card {
  display: grid;
  gap: 0.85rem;
  min-width: 0;
  padding: 1rem;
  border: 1px solid var(--line);
  border-left: 7px solid #8f332c;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(143, 51, 44, 0.08), transparent 38%),
    var(--paper);
}

.seal-card-head,
.seal-tag-row,
.seal-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}

.seal-id,
.seal-storage-badge,
.seal-state,
.seal-mini-tag {
  display: inline-flex;
  width: max-content;
  min-height: 1.8rem;
  align-items: center;
  padding: 0.08rem 0.55rem;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 900;
  line-height: 1.2;
}

.seal-id {
  border: 1px solid rgba(0, 0, 0, 0.16);
  background: rgba(255, 255, 255, 0.68);
  color: #4f4942;
  font-family: "Consolas", "Yu Gothic", monospace;
}

.seal-storage-badge {
  border: 2px solid #a33a31;
  color: #8f332c;
  background: #fff3ed;
}

.seal-state {
  border: 2px solid currentColor;
  color: #8f332c;
  background: #fff7f0;
}

.seal-title-row {
  display: grid;
  gap: 0.25rem;
}

.seal-title-row h3,
.seal-title-row p,
.seal-reason p,
.seal-note p {
  margin: 0;
  text-indent: 0;
}

.seal-title-row h3 {
  font-size: 1.2rem;
}

.seal-meta,
.seal-notes dl {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr));
  gap: 0.55rem;
  margin: 0;
}

.seal-meta div,
.seal-reason,
.seal-note,
.seal-notes div {
  min-width: 0;
  padding: 0.68rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.5);
}

.seal-meta dt,
.seal-reason h4,
.seal-note h4,
.seal-notes h4,
.seal-notes dt,
.seal-related-links h4 {
  margin: 0 0 0.35rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
}

.seal-meta dd,
.seal-notes dd {
  margin: 0;
}

.seal-notes ul {
  margin: 0;
  padding-left: 1.2rem;
}

.seal-mini-tag {
  border: 1px solid rgba(92, 74, 55, 0.2);
  background: rgba(255, 255, 255, 0.62);
  color: #6d5739;
}

.seal-related-links {
  display: grid;
  gap: 0.35rem;
}

.seal-links a {
  display: inline-flex;
  min-height: 1.95rem;
  align-items: center;
  padding: 0.1rem 0.62rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  font-size: 0.84rem;
  font-weight: 800;
  text-decoration: none;
}

.seal-storage-section.chair-safe {
  border-color: #d4b15f;
  background: linear-gradient(180deg, #fff9e6, #fffdf8);
}

.seal-storage-section.chair-safe .seal-storage-head {
  background: linear-gradient(90deg, rgba(191, 144, 44, 0.22), transparent);
}

.seal-storage-section.chair-safe .seal-card {
  border-left-color: #b02722;
  background:
    linear-gradient(90deg, rgba(176, 39, 34, 0.1), transparent 34%),
    linear-gradient(180deg, #fffaf0, #fffdf8);
}

.seal-storage-section.airtight {
  border-color: #b8b8b8;
  background: linear-gradient(180deg, #f6f7f7, #fff);
}

.seal-storage-section.airtight .seal-card {
  border-left-color: #5f666c;
  background:
    linear-gradient(90deg, rgba(95, 102, 108, 0.13), transparent 36%),
    #fbfcfc;
}

.seal-storage-section.clinic {
  border-color: #a8d1c8;
  background: linear-gradient(180deg, #effaf7, #fbfffd);
}

.seal-storage-section.clinic .seal-card {
  border-left-color: #5b9d90;
  background:
    linear-gradient(90deg, rgba(91, 157, 144, 0.12), transparent 36%),
    #f8fffc;
}

.seal-storage-section.redpen-hold {
  border-color: #e4b3aa;
  background: linear-gradient(180deg, #fff8f6, #fffdf8);
}

.seal-storage-section.redpen-hold .seal-card {
  border-left-color: #b92828;
}

.seal-storage-section.tazuna-pending {
  border-color: #cfc6b0;
  background: linear-gradient(180deg, #faf8f1, #fffdf8);
}

.seal-storage-section.diary-watch {
  border-color: #e2ce99;
  background: linear-gradient(180deg, #fff7dc, #fffdf3);
}

.seal-storage-section.diary-watch .seal-card {
  border-left-color: #b9933d;
  background:
    linear-gradient(90deg, rgba(185, 147, 61, 0.12), transparent 36%),
    #fffaf0;
}

.seal-storage-section.lab-submitted {
  border-color: #cfd5da;
  background: linear-gradient(180deg, #fbfcfd, #f7f8f9);
}

.seal-storage-section.locating {
  border-color: #e0c45c;
  background: linear-gradient(180deg, #fff8d7, #fffdf3);
}

.seal-state.clinic,
.seal-state.diary,
.seal-state.lab {
  color: #2f6f68;
  background: #edf8f0;
}

.seal-state.pending,
.seal-state.locating {
  color: #8d691e;
  background: #fff7d9;
}

.seal-state.redpen {
  color: #9f231f;
  background: #fff0f0;
}

.ledger-case-card {
  position: relative;
  display: grid;
  gap: 0.9rem;
  min-width: 0;
  overflow: hidden;
  padding: 1rem;
  border: 1px solid var(--line);
  border-left: 6px solid #a36a20;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(163, 106, 32, 0.08), transparent 36%),
    var(--paper);
}

.ledger-case-card::after {
  content: "LEDGER";
  position: absolute;
  right: -1.3rem;
  bottom: 0.2rem;
  color: rgba(122, 96, 53, 0.08);
  font-size: 3.15rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  pointer-events: none;
  transform: rotate(-7deg);
}

.ledger-case-card[data-status="sealed"] {
  border-left-color: #8f332c;
  background:
    linear-gradient(90deg, rgba(143, 51, 44, 0.09), transparent 36%),
    var(--paper);
}

.ledger-case-card[data-status="safe"] {
  border-left-color: #5f8c67;
  background:
    linear-gradient(90deg, rgba(95, 140, 103, 0.1), transparent 36%),
    var(--paper);
}

.ledger-case-card[data-status="watch"] {
  border-left-color: #5f91b5;
}

.ledger-case-card[data-status="safe"]::after {
  content: "CARE";
  color: rgba(95, 140, 103, 0.1);
}

.ledger-case-head {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
  justify-content: space-between;
}

.ledger-status.review {
  background: #a36a20;
}

.ledger-status.safe {
  background: #2f6f68;
}

.ledger-status.watch {
  background: #3f6f8f;
}

.ledger-case-card h2 {
  position: relative;
  z-index: 1;
  margin: 0;
  font-size: 1.25rem;
}

.ledger-case-meta {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
  gap: 0.55rem;
  margin: 0;
}

.ledger-case-meta div,
.ledger-summary-block,
.ledger-response,
.ledger-followup,
.ledger-comment-log div {
  min-width: 0;
  padding: 0.7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.5);
}

.ledger-case-meta dt,
.ledger-summary-block h3,
.ledger-point-grid h3,
.ledger-response h3,
.ledger-followup h3,
.ledger-comment-log h3,
.ledger-related-records h3 {
  margin: 0 0 0.35rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
}

.ledger-case-meta dd,
.ledger-comment-log dd {
  margin: 0;
}

.ledger-case-meta .danger-meter,
.ledger-case-meta .goodwill-meter {
  margin-top: 0;
}

.ledger-tag-row {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.ledger-mini-tag {
  display: inline-flex;
  align-items: center;
  min-height: 1.6rem;
  padding: 0.08rem 0.5rem;
  border: 1px solid rgba(47, 111, 104, 0.18);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 800;
}

.ledger-summary-block,
.ledger-response,
.ledger-followup,
.ledger-comment-log,
.ledger-related-records,
.ledger-point-grid {
  position: relative;
  z-index: 1;
}

.ledger-point-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
}

.ledger-good,
.ledger-danger {
  min-width: 0;
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.42);
}

.ledger-good {
  border-color: #bfd3b5;
  background: #f5fbef;
}

.ledger-danger {
  border-color: #e2b8a4;
  background: #fff7f0;
}

.ledger-good-list,
.ledger-danger-list,
.ledger-response-list {
  margin: 0;
}

.ledger-good-list li::marker,
.ledger-response-list li::marker {
  color: #3f7b54;
}

.ledger-danger-list li::marker {
  color: #a33a31;
}

.ledger-followup.progress {
  border-color: #b9d1d9;
  background: #eef8fb;
}

.ledger-followup.gratitude {
  border-color: #d9c279;
  background: #fff8df;
}

.ledger-comment-log {
  display: grid;
  gap: 0.55rem;
}

.ledger-comment-log dl {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr));
  gap: 0.55rem;
  margin: 0;
}

.ledger-comment-log dt {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 900;
}

.ledger-related-records {
  display: grid;
  gap: 0.45rem;
}

.ledger-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.ledger-links a {
  display: inline-flex;
  align-items: center;
  min-height: 1.95rem;
  padding: 0.1rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.74);
  font-size: 0.84rem;
  font-weight: 800;
  text-decoration: none;
}

.sealed-source-drawer {
  margin-top: 1.6rem;
}

.drawer-note {
  padding: 0 1rem 0.8rem;
  color: var(--muted);
}

.has-note .chapter {
  padding: 1.1rem;
  border: 1px solid #ddc892;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(190, 83, 83, 0.16) 2.45rem, transparent 2.45rem),
    linear-gradient(var(--note) 0 2.8rem, rgba(212, 180, 95, 0.36) 2.86rem);
  background-size: 100% 2.95rem;
}

.has-redpen .record-panel {
  border-left-color: #b92828;
  background: #fff2f2;
}

.has-sealed .record-panel {
  border-left-color: #ad3830;
}

.timeline-block {
  margin: 1rem 0;
}

.characters-page .chapter {
  display: grid;
  gap: 1rem;
}

.characters-page .chapter > h1,
.characters-page .chapter > p.lead,
.characters-page .chapter > p,
.characters-page .chapter > hr {
  margin-left: 0;
}

.characters-page .chapter > hr {
  display: none;
}

.characters-page .section-block {
  position: relative;
  margin: 0.4rem 0;
  padding: 1rem 1.1rem;
  border: 1px solid var(--line);
  border-left: 6px solid var(--accent);
  border-radius: 8px;
  background: var(--paper);
}

.characters-page .section-block:nth-of-type(3n + 1) {
  border-left-color: #2f6f68;
}

.characters-page .section-block:nth-of-type(3n + 2) {
  border-left-color: #815a25;
}

.characters-page .section-block:nth-of-type(3n) {
  border-left-color: #69588f;
}

.characters-page .section-block h2 {
  margin-top: 0;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--line);
}

.characters-page .section-block ul {
  display: grid;
  gap: 0.25rem;
  padding-left: 1.2rem;
}

.timeline-block ol {
  display: grid;
  gap: 0.45rem;
  padding-left: 1.4rem;
}

.toc {
  position: sticky;
  top: 4.5rem;
  max-height: calc(100vh - 6rem);
  overflow: auto;
  padding-left: 1rem;
  border-left: 1px solid var(--line);
  color: var(--muted);
}

.toc h2 {
  margin-top: 0;
  font-size: 1rem;
}

.toc ol {
  padding-left: 1.3rem;
  margin: 0;
}

.toc li {
  margin: 0.4rem 0;
}

.toc li[aria-current="page"] a {
  color: var(--ink);
  font-weight: 700;
}

.spica {
  --accent: #2f6f68;
  --accent-soft: #e8f2ef;
}

.mental {
  --accent: #815a25;
  --accent-soft: #f5ead8;
}

.gaiden {
  --accent: #69588f;
  --accent-soft: #eeeaf5;
}

@media (max-width: 900px) {
  .page-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .chapter-page .page-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .toc {
    position: static;
    max-height: none;
    border-left: 0;
    border-top: 1px solid var(--line);
    padding: 1rem 0 0;
  }
}

@media (max-width: 700px) {
  .chapter-page .toc {
    display: none;
  }
}

@media (max-width: 640px) {
  body {
    line-height: 1.85;
  }

  .site-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.2rem;
  }

  .site-breadcrumb {
    max-width: 100%;
  }

  .top-nav {
    margin-left: 0;
  }

  .mode-switcher {
    width: 100%;
    justify-content: flex-start;
  }

  .page-shell {
    padding-top: 1.3rem;
  }

  h1 {
    font-size: 1.45rem;
  }

  .series-card,
  .chapter-nav {
    flex-direction: column;
  }

  .series-actions {
    justify-content: flex-start;
  }

  .danger-meter {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .shake-text {
    animation: none;
  }
}

.menu-toggle,
.menu-close,
.read-reset {
  font: inherit;
}

.menu-toggle {
  display: inline-grid;
  gap: 0.18rem;
  place-content: center;
  width: 2.35rem;
  height: 2.35rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  cursor: pointer;
}

.menu-toggle span {
  display: block;
  width: 1.1rem;
  height: 2px;
  border-radius: 999px;
  background: var(--ink);
}

.menu-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(28, 22, 16, 0.24);
}

.side-menu {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 31;
  width: min(84vw, 20rem);
  padding: 1rem;
  border-right: 1px solid var(--line);
  background: var(--paper);
  box-shadow: 1rem 0 2rem rgba(0, 0, 0, 0.18);
}

.side-menu-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.menu-close,
.read-reset {
  min-height: 2.25rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}

body[data-theme="dark"] .menu-close,
body[data-theme="dark"] .read-reset,
body[data-theme="dark"] .side-menu-links a,
body[data-theme="dark"] .portal-links a,
body[data-theme="dark"] .series-actions a,
body[data-theme="dark"] .chapter-nav a,
body[data-theme="dark"] .aux-links a {
  background: rgba(255, 255, 255, 0.06);
}

.side-menu-links {
  display: grid;
  gap: 0.45rem;
}

.side-menu-links a {
  display: flex;
  align-items: center;
  min-height: 2.55rem;
  padding: 0.25rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  text-decoration: none;
  font-weight: 700;
}

.read-reset {
  width: 100%;
  margin-top: 1rem;
  padding: 0.25rem 0.7rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.portal-home {
  background:
    linear-gradient(180deg, rgba(255, 248, 232, 0.82), rgba(244, 239, 229, 0.98)),
    #f4efe5;
}

.portal-home .page-shell {
  width: min(100%, 90rem);
  max-width: none;
}

.portal-intro {
  width: min(100%, 48rem);
  margin: 0 auto 1.2rem;
  text-align: center;
}

.portal-kicker {
  margin: 0 0 0.35rem;
  color: #8a5a2b;
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-indent: 0;
}

.portal-scene {
  position: relative;
  overflow: hidden;
  min-height: 34rem;
  padding: 2rem clamp(0.5rem, 2vw, 1.25rem) 1.4rem;
  border: 1px solid #d8c9b5;
  border-radius: 8px;
  background:
    radial-gradient(circle at 18% 12%, rgba(255, 235, 184, 0.42), transparent 32rem),
    linear-gradient(180deg, #f2e2c8 0%, #ddc39f 48%, #a9794d 48%, #91643d 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28);
}

.window-light {
  position: absolute;
  top: 1rem;
  left: clamp(1rem, 6vw, 4rem);
  width: min(26rem, 48vw);
  height: 11rem;
  border: 0.45rem solid rgba(103, 81, 55, 0.42);
  border-radius: 8px;
  background:
    linear-gradient(115deg, rgba(255, 246, 211, 0.92), rgba(255, 197, 112, 0.22)),
    linear-gradient(90deg, rgba(255, 255, 255, 0.22) 49%, rgba(106, 78, 47, 0.35) 50%, rgba(255, 255, 255, 0.18) 51%);
}

.curtain {
  position: absolute;
  top: -0.75rem;
  width: 26%;
  height: 12.5rem;
  background: linear-gradient(90deg, rgba(129, 67, 58, 0.86), rgba(157, 86, 70, 0.72));
  transform-origin: top center;
  animation: curtain-sway 9s ease-in-out infinite;
}

.curtain-left {
  left: -0.8rem;
  border-radius: 8px 0 12px 8px;
}

.curtain-right {
  right: -0.8rem;
  border-radius: 0 8px 8px 12px;
  animation-delay: -2.5s;
}

.portal-room {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr 1.18fr 1fr;
  gap: clamp(1rem, 2vw, 2rem);
  align-items: end;
  min-height: 29rem;
  padding: 9rem clamp(0.7rem, 3vw, 2rem) 2rem;
  scrollbar-color: rgba(90, 59, 32, 0.58) rgba(255, 255, 255, 0.22);
  scrollbar-width: thin;
}

.portal-room::-webkit-scrollbar {
  height: 0.35rem;
}

.portal-room::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.22);
}

.portal-room::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(90, 59, 32, 0.58);
}

.portal-room::before {
  content: "";
  position: absolute;
  left: 2%;
  right: 2%;
  bottom: 1.1rem;
  height: 14rem;
  border: 1px solid rgba(87, 56, 31, 0.32);
  border-radius: 12px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.08), transparent 18%, rgba(80, 44, 22, 0.07) 62%),
    #9e7048;
  box-shadow: 0 1.2rem 2.4rem rgba(58, 35, 18, 0.24);
}

.room-zone {
  position: relative;
  display: grid;
  gap: 1rem;
  align-items: end;
  min-height: 16rem;
  scroll-snap-align: center;
}

.portal-object {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 0.25rem;
  align-content: end;
  min-height: 8rem;
  padding: 1rem;
  border: 1px solid rgba(75, 50, 28, 0.28);
  border-radius: 8px;
  color: #2b2119;
  text-decoration: none;
  box-shadow: 0 0.55rem 1.15rem rgba(55, 32, 17, 0.17);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.portal-object:hover,
.portal-object:focus-visible {
  transform: translateY(-0.18rem);
  box-shadow: 0 0.85rem 1.5rem rgba(55, 32, 17, 0.22);
}

.portal-object strong,
.portal-object span,
.portal-object small {
  position: relative;
  z-index: 2;
}

.object-label {
  color: #755230;
  font-size: 0.82rem;
  font-weight: 700;
}

.laptop {
  min-height: 9.2rem;
  background:
    linear-gradient(180deg, #27323a 0 62%, #bdc4c5 63% 100%);
  color: #edf8f7;
}

.laptop::before {
  content: "";
  position: absolute;
  inset: 0.8rem 0.9rem 3.3rem;
  border-radius: 6px;
  background:
    linear-gradient(135deg, rgba(86, 204, 191, 0.34), rgba(23, 31, 36, 0.3)),
    #1d272d;
}

.pc-light {
  position: absolute;
  right: 1rem;
  bottom: 1.35rem;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 999px;
  background: #74ddc4;
  box-shadow: 0 0 0.75rem #74ddc4;
  animation: soft-blink 4.8s ease-in-out infinite;
}

.notebook {
  min-height: 14.5rem;
  padding: 1.4rem;
  border-color: #cbb785;
  background:
    repeating-linear-gradient(180deg, transparent 0 1.95rem, rgba(134, 106, 55, 0.16) 1.98rem 2rem),
    linear-gradient(90deg, rgba(178, 87, 61, 0.15) 0 0.22rem, transparent 0.23rem),
    #fff9e9;
}

.notebook::before {
  content: "";
  position: absolute;
  inset: 0.8rem auto 0.8rem 50%;
  width: 1px;
  background: rgba(126, 92, 46, 0.25);
}

.paper-edge {
  position: absolute;
  right: 0.9rem;
  top: 0.8rem;
  width: 2.1rem;
  height: 1.4rem;
  border-left: 1px solid #d5c99d;
  border-bottom: 1px solid #d5c99d;
  background: rgba(255, 255, 255, 0.62);
  transform: skew(-11deg);
  animation: page-edge 7s ease-in-out infinite;
}

.note-sticky,
.pc-read-note,
.product-read-label,
.portal-addendum {
  opacity: 0;
  transition: opacity 180ms ease;
}

.note-sticky {
  justify-self: start;
  margin-top: 0.4rem;
  padding: 0.2rem 0.45rem;
  border: 1px solid #d9c058;
  border-radius: 4px;
  background: #fff08b;
  color: #5f4d12;
  font-size: 0.82rem;
  transform: rotate(-2deg);
}

.redpen-object {
  justify-self: end;
  min-height: 3.2rem;
  width: min(100%, 15rem);
  background: #fff5f4;
  color: #842221;
}

.pen-line {
  position: absolute;
  left: 1rem;
  right: 1rem;
  bottom: 0.8rem;
  height: 3px;
  border-radius: 999px;
  background: #c52e2e;
}

.bottle-set {
  min-height: 10rem;
  background:
    radial-gradient(circle at 25% 30%, rgba(119, 207, 180, 0.4), transparent 1.9rem),
    radial-gradient(circle at 58% 36%, rgba(236, 196, 116, 0.36), transparent 2.1rem),
    linear-gradient(180deg, #f7fbf2, #dcebd5);
}

.bubble {
  position: absolute;
  width: 0.5rem;
  height: 0.5rem;
  border: 1px solid rgba(47, 111, 104, 0.42);
  border-radius: 999px;
  animation: bubble-rise 5.8s ease-in-out infinite;
}

.b1 {
  left: 24%;
  top: 45%;
}

.b2 {
  left: 57%;
  top: 52%;
  animation-delay: -2s;
}

.sealed-box {
  min-height: 6.5rem;
  background: linear-gradient(180deg, #7d4934, #583225);
  color: #fff7ee;
}

.lock {
  position: absolute;
  right: 1rem;
  top: 0.85rem;
  width: 1.1rem;
  height: 1rem;
  border: 2px solid #e0c276;
  border-radius: 4px;
  animation: lock-tick 8s ease-in-out infinite;
}

.binder {
  min-height: 5.6rem;
  background: linear-gradient(90deg, #d9e4cc 0 1rem, #f8faf0 1.05rem);
}

.bookmark {
  position: absolute;
  right: 1.2rem;
  top: 0;
  width: 0.8rem;
  height: 2.8rem;
  background: #92b57c;
}

.life-object {
  position: relative;
  z-index: 1;
}

.mug {
  width: 3.4rem;
  height: 2.5rem;
  margin-left: 1.2rem;
  border-radius: 0 0 12px 12px;
  background: #f6e0c8;
  box-shadow: inset 0 -0.3rem 0 rgba(83, 45, 28, 0.12);
}

.mug::after {
  content: "";
  position: absolute;
  right: -0.8rem;
  top: 0.45rem;
  width: 1rem;
  height: 1.1rem;
  border: 0.22rem solid #f6e0c8;
  border-left: 0;
  border-radius: 0 999px 999px 0;
}

.clock {
  justify-self: start;
  padding: 0.2rem 0.55rem;
  border: 1px solid rgba(75, 50, 28, 0.24);
  border-radius: 999px;
  background: rgba(255, 250, 238, 0.82);
  color: #5c4630;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.memo-paper {
  justify-self: start;
  max-width: 14rem;
  padding: 0.75rem;
  border: 1px solid #d5c99d;
  border-radius: 6px;
  background: #fff9dd;
  color: #6a5425;
  font-size: 0.9rem;
  transform: rotate(1.5deg);
  animation: paper-rest 7.5s ease-in-out infinite;
}

.portal-hint {
  position: relative;
  z-index: 1;
  margin: 0.6rem 0 0;
  color: rgba(54, 35, 19, 0.82);
  text-align: center;
  text-indent: 0;
  font-size: 0.94rem;
  font-weight: 700;
}

.portal-addendum {
  position: relative;
  z-index: 1;
  margin: 0.55rem auto 0;
  width: fit-content;
  max-width: 100%;
  padding: 0.35rem 0.7rem;
  border: 1px solid #d7c17f;
  border-radius: 6px;
  background: rgba(255, 248, 208, 0.9);
  color: #6b541d;
  text-indent: 0;
}

.portal-room.is-read-story .note-sticky,
.portal-room.is-read-bbs .pc-read-note,
.portal-room.is-read-products .product-read-label,
.portal-room.has-many-records + .portal-hint + .portal-addendum {
  opacity: 1;
}

.portal-room.is-read-bbs .pc-light {
  background: #b7dccf;
  box-shadow: 0 0 0.25rem #b7dccf;
  animation: none;
}

.portal-room.is-read-products .product-read-label {
  color: #3d714f;
  font-weight: 700;
}

.portal-room.is-read-redpen .redpen-object::after {
  content: "添削済";
  position: absolute;
  right: 0.8rem;
  top: 0.55rem;
  color: #b92828;
  font-size: 0.82rem;
  font-weight: 700;
  transform: rotate(-8deg);
}

.portal-room.is-read-sealed .sealed-box::after {
  content: "確認済";
  position: absolute;
  right: 0.8rem;
  bottom: 0.7rem;
  padding: 0.08rem 0.45rem;
  border: 1px solid rgba(255, 235, 170, 0.8);
  border-radius: 999px;
  color: #ffe9a8;
  font-size: 0.78rem;
}

.portal-room.is-read-gratitude .bookmark {
  background: #e5b970;
}

.portal-quick {
  margin-top: 1.6rem;
}

.second-top {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(14rem, 0.9fr);
  gap: 1rem;
  align-items: stretch;
  margin: 1.4rem 0;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.second-top h2,
.second-top p {
  margin: 0;
  text-indent: 0;
}

.second-top h2 {
  font-size: 1.28rem;
}

.second-top p + h2,
.second-top h2 + p {
  margin-top: 0.45rem;
}

.second-top-copy,
.redpen-sheet,
.care-binder {
  min-width: 0;
}

.kicker {
  margin: 0 0 0.45rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.top-link-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
  align-content: start;
}

.top-link-grid.compact {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 9.5rem), 1fr));
}

.top-link-grid a,
.primary-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
  min-height: 2.55rem;
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
  color: var(--ink);
  font-weight: 800;
  line-height: 1.35;
  text-decoration: none;
}

.top-link-grid a span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.top-link-grid a:hover,
.top-link-grid a:focus-visible,
.primary-link:hover,
.primary-link:focus-visible {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.read-state-badge {
  display: inline-flex;
  align-items: center;
  width: max-content;
  min-height: 1.75rem;
  padding: 0.1rem 0.55rem;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.18);
  color: #ffe6a7;
  font-size: 0.82rem;
  font-weight: 900;
}

.read-state-read {
  display: none;
}

.has-read-bbs .bbs-top .read-state-unread,
.has-read-bbs .bbs-terminal .read-state-unread {
  display: none;
}

.has-read-bbs .bbs-top .read-state-read,
.has-read-bbs .bbs-terminal .read-state-read {
  display: inline;
}

.story-notebook {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin: 1.5rem 0;
  border: 1px solid #d8c99e;
  border-radius: 8px;
  background: #d8c99e;
  overflow: hidden;
}

.open-notebook {
  position: relative;
  box-shadow: 0 1rem 2rem rgba(98, 72, 35, 0.12);
}

.open-notebook::before {
  content: "";
  position: absolute;
  inset: 0 calc(50% - 1px);
  width: 2px;
  background: linear-gradient(180deg, transparent, rgba(111, 83, 48, 0.38), transparent);
  pointer-events: none;
}

.notebook-page {
  padding: 1rem;
  background:
    repeating-linear-gradient(180deg, transparent 0 1.8rem, rgba(134, 106, 55, 0.12) 1.82rem 1.86rem),
    #fff9e9;
}

.notebook-left {
  background:
    linear-gradient(90deg, rgba(190, 83, 83, 0.12) 2.2rem, transparent 2.2rem),
    repeating-linear-gradient(180deg, transparent 0 1.8rem, rgba(134, 106, 55, 0.12) 1.82rem 1.86rem),
    #fff9e9;
}

.notebook-right {
  background:
    repeating-linear-gradient(180deg, transparent 0 1.8rem, rgba(47, 111, 104, 0.1) 1.82rem 1.86rem),
    #fffaf0;
}

.notebook-page h2 {
  margin-top: 0;
}

.bbs-top {
  border-color: #a9c4ce;
  background:
    linear-gradient(120deg, #eef7f8, #fffdf8 58%),
    var(--paper);
}

.laptop-shell {
  min-width: 0;
  padding: 0.8rem;
  border: 1px solid #31464e;
  border-radius: 8px;
  background: #152026;
  color: #dbeeea;
  box-shadow: inset 0 -0.25rem rgba(0, 0, 0, 0.16);
}

.laptop-shell p {
  margin-top: 0.7rem;
  color: #c7d6d0;
}

.laptop-bar {
  display: flex;
  gap: 0.35rem;
  align-items: center;
  margin: -0.2rem -0.2rem 0.7rem;
  padding: 0.35rem 0.45rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.laptop-bar span {
  width: 0.62rem;
  height: 0.62rem;
  border-radius: 50%;
}

.laptop-bar span:nth-child(1) {
  background: #d9665b;
}

.laptop-bar span:nth-child(2) {
  background: #e5b970;
}

.laptop-bar span:nth-child(3) {
  background: #72b982;
  margin-right: 0.35rem;
}

.notification-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
}

.notification-grid > span {
  padding: 0.5rem 0.6rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: #dbeeea;
  font-size: 0.9rem;
  font-weight: 800;
}

.notification-grid strong {
  color: #ffe6a7;
}

.record-drawer {
  margin: 1.2rem 0 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.42);
}

.record-drawer > summary {
  cursor: pointer;
  min-height: 2.75rem;
  padding: 0.55rem 0.85rem;
  color: var(--ink);
  font-weight: 900;
}

.record-drawer .record-list {
  margin: 0;
  padding: 0 1rem 1rem 2.2rem;
}

.ledger-top {
  grid-template-columns: minmax(10rem, 0.55fr) minmax(0, 1fr);
  border-color: #cfc1a6;
  background:
    linear-gradient(120deg, #fff7e8, #f4fbf3 70%),
    var(--paper);
}

.ledger-top .top-link-grid {
  grid-column: 1 / -1;
}

.ledger-prop {
  position: relative;
  min-height: 9rem;
}

.ledger-folder,
.ledger-vial,
.ledger-tag {
  position: absolute;
  display: block;
}

.ledger-folder {
  left: 0.4rem;
  right: 1.5rem;
  bottom: 1.1rem;
  height: 6.2rem;
  border: 1px solid #bda46f;
  border-radius: 8px;
  background:
    linear-gradient(180deg, #f3d98f 0 1.2rem, #e9c56d 1.25rem),
    #e9c56d;
  box-shadow: 0 0.6rem 1rem rgba(96, 70, 25, 0.14);
}

.ledger-folder::before {
  content: "";
  position: absolute;
  left: 0.8rem;
  top: -0.8rem;
  width: 5.8rem;
  height: 1.2rem;
  border: 1px solid #bda46f;
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  background: #f3d98f;
}

.ledger-vial {
  right: 0.5rem;
  bottom: 1.9rem;
  width: 2.1rem;
  height: 5.2rem;
  border: 2px solid #7aa79c;
  border-radius: 0.5rem 0.5rem 0.8rem 0.8rem;
  background:
    linear-gradient(180deg, transparent 0 42%, rgba(116, 185, 164, 0.72) 43%),
    rgba(255, 255, 255, 0.48);
  transform: rotate(7deg);
}

.ledger-tag {
  left: 2.4rem;
  bottom: 2.1rem;
  padding: 0.15rem 0.55rem;
  border: 2px solid #2f6f68;
  border-radius: 6px;
  color: #2f6f68;
  font-weight: 900;
  transform: rotate(-8deg);
}

.stamp-shelf {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0;
}

.status-stamp {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  padding: 0.1rem 0.65rem;
  border: 2px solid currentColor;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.58);
  font-size: 0.86rem;
  font-weight: 900;
  transform: rotate(-1.5deg);
}

.status-stamp.danger {
  color: #a33a31;
}

.status-stamp.gentle {
  color: #2f6f68;
  background: #f0f8ec;
}

.redpen-top {
  border-color: #dfa4a4;
  background:
    linear-gradient(90deg, #fff7f7, #fffdf8);
}

.redpen-sheet {
  position: relative;
  padding: 1rem 1rem 1rem 2.6rem;
  border: 1px solid #e0b2b2;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(185, 40, 40, 0.14) 2rem, transparent 2rem),
    repeating-linear-gradient(180deg, transparent 0 1.75rem, rgba(185, 40, 40, 0.1) 1.78rem 1.82rem),
    #fffdf8;
}

.redpen-sheet::before {
  content: "済";
  position: absolute;
  right: 1rem;
  top: 0.8rem;
  padding: 0.15rem 0.45rem;
  border: 2px solid #b92828;
  border-radius: 6px;
  color: #b92828;
  font-weight: 900;
  transform: rotate(7deg);
}

.redpen-judgement-shelf {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0 1.3rem;
}

.redpen-judgement {
  display: inline-flex;
  align-items: center;
  width: max-content;
  min-height: 1.9rem;
  padding: 0.1rem 0.62rem;
  border: 2px solid currentColor;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.62);
  color: #8f3a33;
  font-size: 0.84rem;
  font-weight: 900;
  line-height: 1.2;
}

.redpen-judgement.confirmed {
  color: #3f7b54;
  background: #eef8ed;
}

.redpen-judgement.recheck {
  color: #8d691e;
  background: #fff7d9;
}

.redpen-judgement.rejected {
  color: #a33a31;
  background: #fff0f0;
}

.redpen-judgement.watch {
  color: #3f6f8f;
  background: #eef7ff;
}

.redpen-judgement.hold {
  color: #6d5b83;
  background: #f2edf7;
}

.redpen-judgement.diary {
  color: #7a6437;
  background: #fff8df;
}

.redpen-judgement.tazuna {
  color: #9f231f;
  background: #fffafa;
  box-shadow: inset 0 0 0 1px rgba(159, 35, 31, 0.22);
}

.redpen-judgement.chair {
  color: #9f231f;
  background: #fff6cf;
  border-color: #c8a039;
  box-shadow: inset 0 0 0 1px rgba(159, 35, 31, 0.2);
}

.redpen-record-grid {
  display: grid;
  gap: 1rem;
  margin: 1.2rem 0 1.6rem;
}

.redpen-record-card {
  display: grid;
  gap: 0.85rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-left: 6px solid #b92828;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(185, 40, 40, 0.08), transparent 34%),
    var(--paper);
}

.redpen-record-card[data-status="confirmed"] {
  border-left-color: #6b9b68;
}

.redpen-record-card[data-status="recheck"] {
  border-left-color: #c8a039;
}

.redpen-record-card[data-status="watch"],
.redpen-record-card[data-status="diary"] {
  border-left-color: #5f91b5;
}

.redpen-card-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  justify-content: space-between;
}

.redpen-id {
  display: inline-flex;
  align-items: center;
  min-height: 1.9rem;
  padding: 0.1rem 0.6rem;
  border: 1px solid rgba(0, 0, 0, 0.16);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.7);
  color: #4f4942;
  font-family: "Consolas", "Yu Gothic", monospace;
  font-size: 0.86rem;
  font-weight: 900;
}

.redpen-record-card h2 {
  margin: 0;
  font-size: 1.18rem;
}

.redpen-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr));
  gap: 0.55rem;
  margin: 0;
}

.redpen-meta div {
  padding: 0.55rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.48);
}

.redpen-meta dt,
.redpen-field h3,
.redpen-point-grid h3 {
  margin: 0 0 0.35rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
}

.redpen-meta dd {
  margin: 0;
}

.redpen-field {
  min-width: 0;
}

.redpen-field p,
.redpen-point-grid p {
  margin: 0;
  text-indent: 0;
}

.redpen-field blockquote {
  margin: 0;
}

.redpen-comment-field {
  padding: 0.8rem 0.9rem;
  border: 1px solid #e0b2b2;
  border-left: 5px solid #b92828;
  border-radius: 8px;
  background: #fff7f7;
}

.redpen-comment-field strong {
  color: #9f231f;
}

.redpen-point-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
}

.redpen-point-grid section {
  min-width: 0;
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.42);
}

.redpen-good-list,
.redpen-danger-list {
  margin: 0;
}

.redpen-good-list li::marker {
  color: #3f7b54;
}

.redpen-danger-list li::marker {
  color: #a33a31;
}

.redpen-source-links {
  display: grid;
  gap: 0.35rem;
  padding-top: 0.15rem;
}

.redpen-source-links h3 {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.redpen-source-links div {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.redpen-source-links a {
  display: inline-flex;
  align-items: center;
  min-height: 1.8rem;
  padding: 0.18rem 0.55rem;
  border: 1px solid rgba(159, 35, 31, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.52);
  color: #8d2020;
  font-size: 0.82rem;
  font-weight: 800;
  text-decoration: none;
}

.redpen-comment-list-section {
  margin: 1.6rem 0;
}

.redpen-comment-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
}

.redpen-short-comment {
  padding: 0.9rem;
  border: 1px solid #e0b2b2;
  border-radius: 8px;
  background: linear-gradient(90deg, #fff7f7, #fffdf8);
}

.redpen-short-comment h3,
.redpen-short-comment p {
  margin: 0;
  text-indent: 0;
}

.redpen-short-comment p {
  margin-top: 0.35rem;
  color: #8d2020;
  font-weight: 800;
}

.vault-top {
  border-color: #d6aaa5;
  background:
    linear-gradient(120deg, #fff0f0, #fffdf8 66%),
    var(--paper);
}

.vault-box {
  position: relative;
  min-height: 9rem;
}

.vault-door {
  position: absolute;
  inset: 0.5rem 0.8rem 0.8rem;
  border: 2px solid #6b5753;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.22), transparent 38%),
    #7a6a66;
  box-shadow: inset 0 0 0 0.45rem rgba(41, 32, 30, 0.22);
}

.vault-door::before {
  content: "";
  position: absolute;
  inset: 1.4rem;
  border: 2px solid rgba(47, 38, 36, 0.38);
  border-radius: 50%;
}

.vault-lock {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 2.1rem;
  height: 2.1rem;
  border: 2px solid #2f2725;
  border-radius: 50%;
  background: #d8c48d;
  transform: translate(-50%, -50%);
  animation: lock-tick 5s ease-in-out infinite;
}

.gratitude-top {
  border-color: #c7d8b8;
  background:
    linear-gradient(120deg, #f5fbef, #eef7fb 72%),
    var(--paper);
}

.care-binder {
  padding: 1rem 1rem 1rem 1.35rem;
  border: 1px solid #c7d8b8;
  border-left: 0.85rem solid #8cae79;
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.66), rgba(255, 255, 255, 0.22)),
    #f9fff4;
}

.top-link-grid.warm a {
  border-color: #cadabf;
  background: #fbfff5;
}

.redpen-board,
.settings-panel {
  margin: 1.4rem 0;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.redpen-board {
  border-color: #e2a3a3;
  background: linear-gradient(90deg, #fff7f7, #fffdf8);
}

.gratitude-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin: 1.4rem 0;
}

.gratitude-card {
  padding: 1rem;
  border: 1px solid #d5d7bd;
  border-radius: 8px;
  background: linear-gradient(180deg, #fcfff4, #f4f8e7);
}

.gratitude-card h2 {
  margin-top: 0;
}

.product-card[data-status="safe"],
.gratitude-card[data-status="improved"],
.gratitude-card[data-status="checked"] {
  border-color: #bfd3b5;
}

.gratitude-status-shelf {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0 1.2rem;
}

.gratitude-status {
  display: inline-flex;
  align-items: center;
  min-height: 1.9rem;
  padding: 0.1rem 0.62rem;
  border: 2px solid currentColor;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.64);
  font-size: 0.84rem;
  font-weight: 900;
  line-height: 1.2;
}

.gratitude-status.gratitude,
.gratitude-status.safe {
  color: #2f6f68;
  background: #edf8f0;
}

.gratitude-status.stable,
.gratitude-status.clinic {
  color: #3f6f8f;
  background: #eef7ff;
}

.gratitude-status.improved,
.gratitude-status.limited {
  color: #8d691e;
  background: #fff7d9;
}

.gratitude-status.watch,
.gratitude-status.review,
.gratitude-status.unused {
  color: #6d5b83;
  background: #f4eff8;
}

.gratitude-console {
  margin: 1.3rem 0;
  padding: 1rem;
  border: 1px solid #d6d2b7;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(125, 166, 133, 0.12), transparent 44%),
    linear-gradient(180deg, #fffdf5, #f8fbf0);
}

.gratitude-filter-note {
  margin: 0 0 0.85rem;
  color: var(--muted);
  text-indent: 0;
}

.gratitude-record-grid {
  display: grid;
  gap: 1rem;
  margin: 1.4rem 0 1.6rem;
}

.gratitude-record-card {
  display: grid;
  gap: 0.85rem;
  padding: 1rem;
  border: 1px solid #d8d3ba;
  border-left: 6px solid #8cae79;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(140, 174, 121, 0.1), transparent 36%),
    linear-gradient(180deg, #fffdf7, #fbfff7);
}

.gratitude-record-card[data-tone="safe"] {
  border-left-color: #6aa48f;
}

.gratitude-record-card[data-tone="review"] {
  border-left-color: #d0ad4d;
}

.gratitude-card-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  justify-content: space-between;
}

.gratitude-record-id,
.gratitude-record-state {
  display: inline-flex;
  align-items: center;
  width: max-content;
  min-height: 1.9rem;
  padding: 0.1rem 0.6rem;
  border-radius: 6px;
  font-size: 0.86rem;
  font-weight: 900;
  line-height: 1.2;
}

.gratitude-record-id {
  border: 1px solid rgba(0, 0, 0, 0.14);
  background: rgba(255, 255, 255, 0.72);
  color: #4f4942;
  font-family: "Consolas", "Yu Gothic", monospace;
}

.gratitude-record-state {
  border: 2px solid #7aa79c;
  background: #edf8f0;
  color: #2f6f68;
}

.gratitude-record-card h2 {
  margin: 0;
  font-size: 1.2rem;
}

.gratitude-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr));
  gap: 0.55rem;
  margin: 0;
}

.gratitude-meta div {
  padding: 0.55rem;
  border: 1px solid rgba(115, 105, 75, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.52);
}

.gratitude-meta dt,
.gratitude-section h3 {
  margin: 0 0 0.35rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
}

.gratitude-meta dd,
.gratitude-section p {
  margin: 0;
  text-indent: 0;
}

.gratitude-section {
  min-width: 0;
}

.gratitude-check-list,
.gratitude-caution-list,
.gratitude-progress-list {
  margin: 0.1rem 0 0;
  padding-left: 1.25rem;
}

.gratitude-check-list li,
.gratitude-caution-list li,
.gratitude-progress-list li {
  margin: 0.22rem 0;
}

.gratitude-check-list li::marker {
  color: #3f7b54;
}

.gratitude-progress-list li::marker {
  color: #3f6f8f;
  font-weight: 900;
}

.gratitude-caution-list li::marker {
  color: #a57a1f;
}

.gratitude-comment-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr));
  gap: 0.6rem;
}

.gratitude-comment {
  margin: 0;
  padding: 0.72rem;
  border: 1px solid #ded1a2;
  border-radius: 8px;
  background: #fffdf0;
}

.gratitude-managers .gratitude-comment {
  border-color: #bfdaea;
  background: #f2f9fc;
}

.gratitude-comment blockquote {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
}

.gratitude-comment figcaption {
  margin-top: 0.45rem;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 900;
}

.record-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.record-links a,
.record-links span {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  padding: 0.15rem 0.65rem;
  border: 1px solid #c8d8c4;
  border-radius: 6px;
  background: #f7fbf4;
  font-weight: 800;
  text-decoration: none;
}

.record-links span {
  color: var(--muted);
}

.gratitude-related-drawer {
  border-color: #d6d2b7;
  background: rgba(255, 253, 245, 0.7);
}

/* Dark theme contrast fixes for paper-like components. */
body[data-theme="dark"].spica,
body[data-theme="dark"] .spica {
  --accent-soft: #1f302d;
}

body[data-theme="dark"].mental,
body[data-theme="dark"] .mental {
  --accent-soft: #34291e;
}

body[data-theme="dark"].gaiden,
body[data-theme="dark"] .gaiden {
  --accent-soft: #2c2837;
}

body[data-theme="dark"] blockquote {
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
}

body[data-theme="dark"] blockquote.redpen-quote,
body[data-theme="dark"] .redpen-line {
  border-color: #884441;
  border-left-color: #ff8f84;
  background: #3a2322;
  color: #ffb5ad;
}

body[data-theme="dark"] blockquote.redpen-quote::before,
body[data-theme="dark"] .redpen-line::before {
  border-color: #ff8f84;
  color: #ff8f84;
}

body[data-theme="dark"] .ledger-line {
  background: #33241f;
  color: #f0d8d0;
}

body[data-theme="dark"] .note-line {
  border-color: #746339;
  background:
    linear-gradient(90deg, rgba(190, 83, 83, 0.26) 2.25rem, transparent 2.25rem),
    linear-gradient(#332c1d 0 2rem, #5f512d 2.05rem);
  color: #efe3c1;
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.08);
}

body[data-theme="dark"] .note-line::before {
  color: #dfbf68;
}

body[data-theme="dark"] .mark-danger {
  color: #ffb1a7;
  background: #46241f;
}

body[data-theme="dark"] .mark-sealed {
  color: #ffc4bb;
  background: #4a2824;
  border-color: rgba(255, 143, 132, 0.28);
}

body[data-theme="dark"] .mark-redpen {
  color: #ff9d94;
  background: linear-gradient(transparent 58%, rgba(255, 143, 132, 0.22) 58%);
}

body[data-theme="dark"] .mark-staff {
  color: #9bd8c9;
  background: #1f342f;
}

body[data-theme="dark"] pre,
body[data-theme="dark"] .thread::before,
body[data-theme="dark"] .thread-chunk > summary,
body[data-theme="dark"] .res,
body[data-theme="dark"] .badge,
body[data-theme="dark"] .ledger-notice,
body[data-theme="dark"] .catalog-stats span,
body[data-theme="dark"] .vault-warning,
body[data-theme="dark"] .filter-button-group button,
body[data-theme="dark"] .product-group,
body[data-theme="dark"] .product-code,
body[data-theme="dark"] .sealed-source-item,
body[data-theme="dark"] .seal-storage-section,
body[data-theme="dark"] .seal-storage-head,
body[data-theme="dark"] .seal-card,
body[data-theme="dark"] .seal-id,
body[data-theme="dark"] .seal-meta div,
body[data-theme="dark"] .seal-reason,
body[data-theme="dark"] .seal-note,
body[data-theme="dark"] .seal-notes div,
body[data-theme="dark"] .seal-links a,
body[data-theme="dark"] .related-links a,
body[data-theme="dark"] .ledger-case-card,
body[data-theme="dark"] .ledger-case-meta div,
body[data-theme="dark"] .ledger-summary-block,
body[data-theme="dark"] .ledger-response,
body[data-theme="dark"] .ledger-comment-log div,
body[data-theme="dark"] .ledger-links a,
body[data-theme="dark"] .ledger-comments div,
body[data-theme="dark"] .ledger-id,
body[data-theme="dark"] .ledger-evidence > summary,
body[data-theme="dark"] .menu-close,
body[data-theme="dark"] .read-reset,
body[data-theme="dark"] .side-menu-links a,
body[data-theme="dark"] .portal-links a,
body[data-theme="dark"] .series-actions a,
body[data-theme="dark"] .chapter-nav a,
body[data-theme="dark"] .aux-links a {
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
}

body[data-theme="dark"] .thread::before,
body[data-theme="dark"] .thread-chunk > summary,
body[data-theme="dark"] .res,
body[data-theme="dark"] .badge,
body[data-theme="dark"] .ledger-notice,
body[data-theme="dark"] .catalog-stats span,
body[data-theme="dark"] .vault-warning,
body[data-theme="dark"] .filter-button-group button,
body[data-theme="dark"] .product-group,
body[data-theme="dark"] .product-code,
body[data-theme="dark"] .sealed-source-item,
body[data-theme="dark"] .seal-storage-section,
body[data-theme="dark"] .seal-storage-head,
body[data-theme="dark"] .seal-card,
body[data-theme="dark"] .seal-id,
body[data-theme="dark"] .seal-meta div,
body[data-theme="dark"] .seal-reason,
body[data-theme="dark"] .seal-note,
body[data-theme="dark"] .seal-notes div,
body[data-theme="dark"] .seal-links a,
body[data-theme="dark"] .related-links a,
body[data-theme="dark"] .ledger-case-card,
body[data-theme="dark"] .ledger-case-meta div,
body[data-theme="dark"] .ledger-summary-block,
body[data-theme="dark"] .ledger-response,
body[data-theme="dark"] .ledger-comment-log div,
body[data-theme="dark"] .ledger-links a,
body[data-theme="dark"] .ledger-comments div,
body[data-theme="dark"] .ledger-id,
body[data-theme="dark"] .ledger-evidence > summary {
  border-color: rgba(255, 255, 255, 0.12);
}

body[data-theme="dark"] .goodwill-label,
body[data-theme="dark"] .ledger-mini-tag,
body[data-theme="dark"] .seal-mini-tag,
body[data-theme="dark"] .ledger-comments > summary {
  color: #9bd8a2;
}

body[data-theme="dark"] .goodwill-track {
  border-color: rgba(155, 216, 162, 0.22);
  background: rgba(255, 255, 255, 0.08);
}

body[data-theme="dark"] .danger-track {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.14);
}

body[data-theme="dark"] .stamp,
body[data-theme="dark"] .stamp-line {
  border-color: #ff8f84;
  background: rgba(74, 38, 34, 0.72);
  color: #ffb1a7;
}

body[data-theme="dark"] .thread.company::before,
body[data-theme="dark"] .thread.company .res-head {
  color: #9dd2e7;
}

body[data-theme="dark"] .thread.research::before,
body[data-theme="dark"] .thread.research .res-head {
  color: #bac4ee;
}

body[data-theme="dark"] .thread.staff::before,
body[data-theme="dark"] .thread.staff .res-head {
  color: #e0c08e;
}

body[data-theme="dark"] .thread.sealed::before,
body[data-theme="dark"] .thread.redpen::before,
body[data-theme="dark"] .thread.sealed .res-head,
body[data-theme="dark"] .thread.redpen .res-head {
  color: #ffaaa0;
}

body[data-theme="dark"] .thread.note::before {
  color: #e2c36d;
}

body[data-theme="dark"] .vault-warning {
  background: rgba(74, 38, 34, 0.45);
}

body[data-theme="dark"] .vault-warning strong {
  color: #ffaaa0;
}

body[data-theme="dark"] .ledger-good {
  border-color: #46553a;
  background: #243021;
}

body[data-theme="dark"] .ledger-danger {
  border-color: #5c3c32;
  background: #33241f;
}

body[data-theme="dark"] .ledger-followup.progress {
  border-color: #3b5561;
  background: #1f3036;
}

body[data-theme="dark"] .ledger-followup.gratitude {
  border-color: #746339;
  background: #332c1d;
}

body[data-theme="dark"] .ledger-mini-tag {
  border-color: rgba(155, 216, 162, 0.22);
  background: rgba(155, 216, 162, 0.08);
}

body[data-theme="dark"] .seal-storage-badge,
body[data-theme="dark"] .seal-state,
body[data-theme="dark"] .seal-mini-tag {
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
}

body[data-theme="dark"] .seal-storage-section.chair-safe,
body[data-theme="dark"] .seal-storage-section.diary-watch,
body[data-theme="dark"] .seal-storage-section.locating {
  background: #2b2618;
}

body[data-theme="dark"] .seal-storage-section.airtight,
body[data-theme="dark"] .seal-storage-section.lab-submitted {
  background: #222629;
}

body[data-theme="dark"] .seal-storage-section.clinic {
  background: #1f342f;
}

body[data-theme="dark"] .seal-storage-section.redpen-hold {
  background: #302423;
}

body[data-theme="dark"] .seal-storage-section.tazuna-pending {
  background: #2a261f;
}

body[data-theme="dark"] .seal-storage-section.chair-safe .seal-storage-head,
body[data-theme="dark"] .seal-storage-section.diary-watch .seal-storage-head,
body[data-theme="dark"] .seal-storage-section.locating .seal-storage-head {
  background: linear-gradient(90deg, rgba(224, 192, 142, 0.12), transparent 62%);
}

body[data-theme="dark"] .seal-storage-section.airtight .seal-storage-head,
body[data-theme="dark"] .seal-storage-section.lab-submitted .seal-storage-head {
  background: linear-gradient(90deg, rgba(157, 210, 231, 0.1), transparent 62%);
}

body[data-theme="dark"] .seal-storage-section.clinic .seal-storage-head {
  background: linear-gradient(90deg, rgba(155, 216, 201, 0.12), transparent 62%);
}

body[data-theme="dark"] .seal-storage-section.redpen-hold .seal-storage-head {
  background: linear-gradient(90deg, rgba(255, 181, 173, 0.12), transparent 62%);
}

body[data-theme="dark"] .seal-storage-section.tazuna-pending .seal-storage-head {
  background: linear-gradient(90deg, rgba(224, 192, 142, 0.1), transparent 62%);
}

body[data-theme="dark"] .seal-storage-head span {
  border-color: rgba(224, 192, 142, 0.34);
  background: rgba(224, 192, 142, 0.08);
  color: #e0c08e;
}

body[data-theme="dark"] .seal-storage-section.chair-safe .seal-card,
body[data-theme="dark"] .seal-storage-section.diary-watch .seal-card,
body[data-theme="dark"] .seal-storage-section.locating .seal-card {
  background:
    linear-gradient(90deg, rgba(224, 192, 142, 0.12), transparent 36%),
    #251f17;
}

body[data-theme="dark"] .seal-storage-section.airtight .seal-card,
body[data-theme="dark"] .seal-storage-section.lab-submitted .seal-card {
  background:
    linear-gradient(90deg, rgba(157, 210, 231, 0.1), transparent 36%),
    #1d2529;
}

body[data-theme="dark"] .seal-storage-section.clinic .seal-card {
  background:
    linear-gradient(90deg, rgba(155, 216, 201, 0.11), transparent 36%),
    #1d2d28;
}

body[data-theme="dark"] .seal-storage-section.redpen-hold .seal-card {
  background:
    linear-gradient(90deg, rgba(255, 181, 173, 0.1), transparent 36%),
    #2c2020;
}

body[data-theme="dark"] .seal-storage-section.tazuna-pending .seal-card {
  background:
    linear-gradient(90deg, rgba(224, 192, 142, 0.08), transparent 36%),
    #27231c;
}

body[data-theme="dark"] .seal-state.clinic,
body[data-theme="dark"] .seal-state.diary,
body[data-theme="dark"] .seal-state.lab {
  color: #9bd8c9;
  background: #1f342f;
}

body[data-theme="dark"] .seal-state.pending,
body[data-theme="dark"] .seal-state.locating {
  color: #e0c08e;
  background: #332c1d;
}

body[data-theme="dark"] .seal-state.redpen,
body[data-theme="dark"] .seal-state.sealed,
body[data-theme="dark"] .seal-state.airtight {
  color: #ffb5ad;
  background: #3a2322;
}

body[data-theme="dark"] .product-category {
  border-color: rgba(107, 181, 168, 0.32);
}

body[data-theme="dark"].has-note .chapter,
body[data-theme="dark"] .has-note .chapter {
  border-color: #746339;
}

body[data-theme="dark"].has-redpen .record-panel,
body[data-theme="dark"] .has-redpen .record-panel {
  background: #3a2322;
}

body[data-theme="dark"] .notebook,
body[data-theme="dark"] .notebook-page {
  border-color: #746339;
  background:
    repeating-linear-gradient(180deg, transparent 0 1.95rem, rgba(223, 191, 104, 0.18) 1.98rem 2rem),
    linear-gradient(90deg, rgba(190, 83, 83, 0.18) 0 0.22rem, transparent 0.23rem),
    #332c1d;
  color: #efe3c1;
}

body[data-theme="dark"] .story-notebook {
  border-color: #746339;
  background: #746339;
}

body[data-theme="dark"] .paper-edge,
body[data-theme="dark"] .note-sticky,
body[data-theme="dark"] .clock,
body[data-theme="dark"] .memo-paper,
body[data-theme="dark"] .portal-addendum {
  border-color: #746339;
  background: rgba(67, 55, 30, 0.9);
  color: #efe3c1;
}

body[data-theme="dark"] .portal-hint {
  color: #dbc28d;
}

body[data-theme="dark"] .redpen-object,
body[data-theme="dark"] .redpen-board {
  border-color: #884441;
  background: linear-gradient(90deg, #3a2322, #2a211d);
  color: #ffb5ad;
}

body[data-theme="dark"] .bottle-set {
  background:
    radial-gradient(circle at 25% 30%, rgba(119, 207, 180, 0.24), transparent 1.9rem),
    radial-gradient(circle at 58% 36%, rgba(236, 196, 116, 0.2), transparent 2.1rem),
    linear-gradient(180deg, #21322d, #1e2a22);
}

body[data-theme="dark"] .binder {
  background: linear-gradient(90deg, #384634 0 1rem, #283326 1.05rem);
}

body[data-theme="dark"] .mug {
  background: #4a3125;
}

body[data-theme="dark"] .mug::after {
  border-color: #4a3125;
}

body[data-theme="dark"] .gratitude-card {
  border-color: #46553a;
  background: linear-gradient(180deg, #243021, #20281e);
}

body[data-theme="dark"] .gratitude-console,
body[data-theme="dark"] .gratitude-record-card,
body[data-theme="dark"] .gratitude-meta div,
body[data-theme="dark"] .gratitude-record-id,
body[data-theme="dark"] .gratitude-comment,
body[data-theme="dark"] .record-links a,
body[data-theme="dark"] .record-links span {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
}

body[data-theme="dark"] .gratitude-record-card {
  border-left-color: #789566;
  background:
    linear-gradient(90deg, rgba(120, 149, 102, 0.16), transparent 36%),
    #20281e;
}

body[data-theme="dark"] .gratitude-record-card[data-tone="safe"] {
  border-left-color: #78a897;
}

body[data-theme="dark"] .gratitude-record-card[data-tone="review"] {
  border-left-color: #d0ad4d;
}

body[data-theme="dark"] .gratitude-record-state,
body[data-theme="dark"] .gratitude-status.gratitude,
body[data-theme="dark"] .gratitude-status.safe {
  color: #9bd8c9;
  background: #1f342f;
}

body[data-theme="dark"] .gratitude-status.stable,
body[data-theme="dark"] .gratitude-status.clinic {
  color: #9dd2e7;
  background: #1f3036;
}

body[data-theme="dark"] .gratitude-status.improved,
body[data-theme="dark"] .gratitude-status.limited {
  color: #e0c08e;
  background: #332c1d;
}

body[data-theme="dark"] .gratitude-status.watch,
body[data-theme="dark"] .gratitude-status.review,
body[data-theme="dark"] .gratitude-status.unused {
  color: #c9b7e2;
  background: #302a39;
}

body[data-theme="dark"] .gratitude-managers .gratitude-comment {
  background: #1f3036;
}

body[data-theme="dark"] .second-top,
body[data-theme="dark"] .record-drawer,
body[data-theme="dark"] .top-link-grid a,
body[data-theme="dark"] .primary-link,
body[data-theme="dark"] .status-stamp {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
}

body[data-theme="dark"] .bbs-top,
body[data-theme="dark"] .ledger-top,
body[data-theme="dark"] .vault-top,
body[data-theme="dark"] .gratitude-top {
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.05), transparent 68%),
    #24211d;
}

body[data-theme="dark"] .laptop-shell {
  border-color: #4b6470;
  background: #121b20;
}

body[data-theme="dark"].chapter-page[data-content-view="bbs"] .bbs-view-banner {
  border-color: #4b6470;
  background: #1b292e;
}

body[data-theme="dark"].chapter-page[data-content-view="bbs"] .bbs-view-banner strong {
  color: #9dd2e7;
}

body[data-theme="dark"] .redpen-sheet {
  border-color: #884441;
  background:
    linear-gradient(90deg, rgba(255, 143, 132, 0.16) 2rem, transparent 2rem),
    repeating-linear-gradient(180deg, transparent 0 1.75rem, rgba(255, 143, 132, 0.12) 1.78rem 1.82rem),
    #2a211d;
}

body[data-theme="dark"] .redpen-record-card,
body[data-theme="dark"] .redpen-meta div,
body[data-theme="dark"] .redpen-point-grid section,
body[data-theme="dark"] .redpen-short-comment,
body[data-theme="dark"] .redpen-source-links a,
body[data-theme="dark"] .redpen-id {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
}

body[data-theme="dark"] .redpen-comment-field {
  border-color: #884441;
  border-left-color: #ff8f84;
  background: #3a2322;
}

body[data-theme="dark"] .redpen-short-comment p,
body[data-theme="dark"] .redpen-comment-field strong {
  color: #ffb5ad;
}

body[data-theme="dark"] .care-binder {
  border-color: #46553a;
  border-left-color: #789566;
  background: #20281e;
}

body[data-theme="dark"] .ledger-folder,
body[data-theme="dark"] .ledger-folder::before {
  border-color: #8d7743;
  background: #5d4b23;
}

body[data-theme="dark"] .vault-door {
  border-color: #8d7770;
  background: #4b4442;
}

@keyframes curtain-sway {
  0%,
  100% {
    transform: rotate(0deg);
  }

  50% {
    transform: rotate(1.2deg);
  }
}

@keyframes soft-blink {
  0%,
  72%,
  100% {
    opacity: 0.45;
  }

  82% {
    opacity: 1;
  }
}

@keyframes page-edge {
  0%,
  100% {
    transform: skew(-11deg) translateY(0);
  }

  50% {
    transform: skew(-11deg) translateY(0.12rem);
  }
}

@keyframes bubble-rise {
  0%,
  100% {
    transform: translateY(0);
    opacity: 0.25;
  }

  50% {
    transform: translateY(-0.7rem);
    opacity: 0.75;
  }
}

@keyframes lock-tick {
  0%,
  88%,
  100% {
    transform: rotate(0);
  }

  92% {
    transform: rotate(-4deg);
  }

  96% {
    transform: rotate(4deg);
  }
}

@keyframes paper-rest {
  0%,
  100% {
    transform: rotate(1.5deg);
  }

  50% {
    transform: rotate(0.7deg);
  }
}

@media (max-width: 900px) {
  .portal-scene {
    min-height: 32rem;
  }

  .portal-room {
    display: flex;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scrollbar-width: thin;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }

  .portal-room::before {
    left: 0.8rem;
    right: auto;
    width: calc(300% - 2rem);
  }

  .room-zone {
    flex: 0 0 min(78vw, 25rem);
  }

  .gratitude-grid {
    grid-template-columns: 1fr;
  }

  .gratitude-record-grid,
  .gratitude-meta,
  .gratitude-comment-grid {
    grid-template-columns: 1fr;
  }

  .second-top,
  .ledger-top {
    grid-template-columns: 1fr;
  }

  .redpen-meta,
  .redpen-point-grid,
  .redpen-comment-grid,
  .ledger-case-meta,
  .ledger-point-grid,
  .ledger-comment-log dl,
  .seal-meta,
  .seal-notes dl {
    grid-template-columns: 1fr;
  }

  .ledger-top .top-link-grid {
    grid-column: auto;
  }

  .board-grid,
  .catalog-stats {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .site-header {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    align-items: center;
    gap: 0.45rem 0.65rem;
  }

  .site-header > span {
    grid-column: 2;
    color: var(--muted);
    font-size: 0.86rem;
  }

  .top-nav {
    display: none;
  }

  .mode-switcher {
    grid-column: 1 / -1;
  }

  .portal-home .page-shell {
    width: 100vw;
    max-width: 100vw;
    padding-left: 0.7rem;
    padding-right: 0.7rem;
  }

  .portal-home .chapter,
  .portal-intro,
  .portal-quick {
    width: 100%;
    max-width: 100%;
  }

  .portal-intro {
    width: 100%;
    max-width: 100%;
    text-align: left;
  }

  .portal-intro .lead,
  .portal-intro h1,
  .portal-kicker {
    width: calc(100vw - 1.4rem);
    max-width: calc(100vw - 1.4rem);
  }

  .portal-intro .lead {
    word-break: break-all;
  }

  .portal-scene {
    margin-left: -0.15rem;
    margin-right: -0.15rem;
    padding-top: 1.2rem;
  }

  .window-light {
    width: 15rem;
    height: 8rem;
  }

  .portal-room {
    padding-top: 7rem;
  }

  .room-zone {
    flex-basis: min(82vw, 22rem);
  }

  .portal-quick .portal-links {
    display: grid;
    grid-template-columns: 1fr;
  }

  .portal-quick .portal-links a {
    justify-content: center;
    width: 100%;
  }

  .story-notebook {
    grid-template-columns: 1fr;
  }

  .open-notebook::before {
    display: none;
  }

  .top-link-grid,
  .top-link-grid.compact,
  .notification-grid {
    grid-template-columns: 1fr;
  }

  .second-top {
    padding: 0.8rem;
  }

  .ledger-prop,
  .vault-box {
    min-height: 7.5rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.portal-home {
  background: #15110d;
}

.portal-home .site-header {
  display: none;
}

body[data-theme="dark"].portal-home .site-header {
  background: rgba(26, 22, 18, 0.78);
}

.portal-home .page-shell {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
}

.portal-home .chapter {
  width: 100%;
}

.portal-hero {
  position: relative;
  min-height: 100svh;
  overflow: hidden;
  background: #15110d;
  isolation: isolate;
}

.portal-room-image {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  filter: saturate(1.04) contrast(1.02);
}

.portal-vignette {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(circle at 42% 62%, transparent 0 36%, rgba(17, 11, 7, 0.12) 58%, rgba(17, 11, 7, 0.55) 100%),
    linear-gradient(180deg, rgba(11, 8, 5, 0.18), transparent 26%, rgba(12, 8, 5, 0.35));
}

.portal-time-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  mix-blend-mode: multiply;
  transition: background 2s ease;
}

/* 朝（5〜10時）: 薄い水色、ひんやりした朝の光 */
[data-time="morning"] .portal-time-overlay {
  background: rgba(180, 210, 245, 0.32);
}

/* 昼（10〜15時）: ほぼ透明、自然光 */
[data-time="noon"] .portal-time-overlay {
  background: rgba(255, 252, 235, 0.08);
}

/* 夕（15〜19時）: 画像そのまま、オーバーレイなし */
[data-time="evening"] .portal-time-overlay {
  background: transparent;
}

/* 夜（19〜5時）: 暗い藍色 + 机中央だけ暖かいランプ光 */
[data-time="night"] .portal-time-overlay {
  mix-blend-mode: normal;
  background:
    radial-gradient(ellipse 55% 40% at 45% 72%, rgba(80, 45, 10, 0.18), transparent 70%),
    rgba(14, 12, 30, 0.52);
}

.portal-hotspots,
.portal-read-layer {
  position: absolute;
  inset: 0;
  z-index: 3;
}

.portal-hotspot {
  position: absolute;
  display: block;
  border-radius: 18px;
  outline: 0;
}

.portal-hotspot::before {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid rgba(255, 239, 180, 0);
  border-radius: inherit;
  background: radial-gradient(circle, rgba(255, 239, 180, 0.14), transparent 68%);
  opacity: 0;
  transform: scale(0.96);
  transition: opacity 180ms ease, transform 180ms ease, border-color 180ms ease;
}

.portal-hotspot span {
  position: absolute;
  left: 50%;
  bottom: 100%;
  transform: translate(-50%, -0.45rem);
  min-width: max-content;
  padding: 0.22rem 0.62rem;
  border: 1px solid rgba(255, 239, 196, 0.72);
  border-radius: 999px;
  background: rgba(32, 23, 16, 0.72);
  color: #fff6d6;
  opacity: 0;
  pointer-events: none;
  font-size: 0.86rem;
  font-weight: 800;
  letter-spacing: 0;
  box-shadow: 0 0.4rem 1.2rem rgba(0, 0, 0, 0.22);
  transition: opacity 180ms ease, transform 180ms ease;
}

.portal-hotspot:hover::before,
.portal-hotspot:focus-visible::before {
  border-color: rgba(255, 239, 180, 0.64);
  opacity: 1;
  transform: scale(1);
}

.portal-hotspot:hover span,
.portal-hotspot:focus-visible span {
  opacity: 1;
  transform: translate(-50%, -0.65rem);
}

.hotspot-bbs {
  left: 15%;
  top: 37%;
  width: 23%;
  height: 20%;
}

.hotspot-story {
  left: 25%;
  top: 60%;
  width: 30%;
  height: 29%;
}

.hotspot-redpen {
  left: 48%;
  top: 68%;
  width: 15%;
  height: 10%;
}

.hotspot-products {
  left: 62%;
  top: 60%;
  width: 16%;
  height: 15%;
}

.hotspot-sealed {
  left: 74%;
  top: 65%;
  width: 22%;
  height: 17%;
}

.hotspot-gratitude {
  left: 73%;
  top: 77%;
  width: 24%;
  height: 17%;
}


.portal-bottom-dock {
  position: absolute;
  left: 50%;
  bottom: clamp(1rem, 3vw, 2rem);
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  justify-content: center;
  max-width: min(92vw, 42rem);
  padding: 0.45rem;
  border: 1px solid rgba(255, 246, 220, 0.28);
  border-radius: 999px;
  background: rgba(24, 17, 12, 0.42);
  box-shadow: 0 0.7rem 2rem rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(14px);
  transform: translateX(-50%);
}

.portal-bottom-dock a {
  display: inline-flex;
  align-items: center;
  min-height: 2.25rem;
  padding: 0.15rem 0.8rem;
  border-radius: 999px;
  color: #fff6dd;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 800;
}

.portal-bottom-dock a:hover,
.portal-bottom-dock a:focus-visible {
  background: rgba(255, 245, 218, 0.16);
}

@media (max-width: 700px) {
  .portal-home .site-header {
    display: none;
  }

  .portal-hero {
    min-height: 100svh;
  }

  .portal-room-image {
    width: 178svh;
    max-width: none;
    object-fit: contain;
    object-position: 38% center;
    transform: translateX(-25%);
  }

  .portal-hotspots,
  .portal-read-layer {
    width: 178svh;
    max-width: none;
    transform: translateX(-25%);
  }

  .portal-vignette {
    background:
      linear-gradient(180deg, rgba(14, 10, 7, 0.28), transparent 24%, rgba(12, 8, 5, 0.54)),
      radial-gradient(circle at 48% 62%, transparent 0 42%, rgba(17, 11, 7, 0.45) 100%);
  }

  .portal-hotspot::before {
    opacity: 0.5;
    border-color: rgba(255, 239, 180, 0.22);
  }

  .portal-hotspot span {
    display: none;
  }

  .portal-bottom-dock {
    left: 0.7rem;
    right: 0.7rem;
    bottom: 0.75rem;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    max-width: none;
    border-radius: 16px;
    transform: none;
  }

  .portal-bottom-dock a {
    justify-content: center;
    min-width: 0;
    padding: 0.15rem 0.25rem;
    font-size: 0.78rem;
  }
}

.portal-home .site-header > span {
  display: none;
}

.portal-home .home-link {
  flex: 0 0 auto;
  white-space: nowrap;
}

@media (max-width: 700px) {
  .portal-home .site-header {
    display: none;
  }

  .portal-home .top-nav {
    display: none;
  }

  .portal-home .mode-switcher {
    flex: 0 0 auto;
    margin-left: auto;
  }

  .portal-home .mode-switcher button {
    min-height: 1.75rem;
    padding: 0.1rem 0.45rem;
    font-size: 0.78rem;
  }

  .portal-room-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 38% center;
    transform: none;
  }

  .portal-hotspots,
  .portal-read-layer {
    width: 100%;
    transform: none;
  }

  .portal-bottom-dock {
    left: 50%;
    right: auto;
    width: min(19rem, calc(100vw - 1.3rem));
    max-width: calc(100vw - 1.3rem);
    box-sizing: border-box;
    display: flex;
    flex-wrap: nowrap;
    gap: 0;
    overflow: hidden;
    padding: 0.38rem 0.22rem;
    transform: translateX(-50%);
  }

  .portal-bottom-dock a {
    flex: 1 1 0;
    justify-content: center;
    min-width: 0;
    padding-inline: 0.12rem;
    font-size: 0.72rem;
  }
}

.portal-scene-frame {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 0;
  width: max(100vw, 177.7svh);
  height: max(100svh, 56.28vw);
  overflow: visible;
  transform: translate(-50%, -50%);
  transform-origin: center center;
}

.portal-home,
.portal-home .page,
.portal-home .chapter,
.portal-home .portal-hero {
  width: 100vw;
  max-width: 100vw;
}

.portal-home .portal-bottom-dock {
  position: fixed;
  left: 50vw;
  z-index: 40;
}

.portal-scroll {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}

.portal-scroll-inner {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 100svh;
}

.portal-snap-rail {
  display: none;
}

.portal-home .portal-scene-frame .portal-room-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: fill;
  object-position: center center;
  transform: none;
}

.portal-prop-layer {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
}

.portal-prop {
  position: absolute;
  z-index: var(--prop-z, 5);
  display: block;
  width: var(--prop-w);
  cursor: pointer;
  pointer-events: auto;
  text-decoration: none;
  transform: rotate(var(--prop-r, 0deg));
  transform-origin: center bottom;
  outline: 0;
}

.portal-prop::before {
  content: "";
  position: absolute;
  left: 9%;
  right: 9%;
  bottom: 4%;
  z-index: -1;
  height: 18%;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(34, 18, 9, 0.34), transparent 68%);
  filter: blur(8px);
  opacity: 0.7;
  transform: scaleX(0.86);
  transition: opacity 180ms ease, transform 180ms ease;
}

.portal-prop::after {
  content: "";
  position: absolute;
  inset: -4%;
  border: 1px solid rgba(255, 234, 169, 0.1);
  border-radius: 24px;
  background: radial-gradient(circle at 52% 44%, rgba(255, 235, 167, 0.08), transparent 62%);
  opacity: 0.12;
  transition: opacity 180ms ease, transform 180ms ease, border-color 180ms ease;
}

.portal-prop img {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: auto;
  filter:
    drop-shadow(0 1.1rem 1.15rem rgba(38, 19, 8, 0.34))
    drop-shadow(0 0 0.18rem rgba(255, 232, 165, 0.22));
  transform: translateY(0) scale(1);
  transform-origin: center bottom;
  transition: filter 180ms ease, transform 180ms ease;
  user-select: none;
}

.portal-prop:hover,
.portal-prop:focus-visible {
  z-index: 20;
}

.portal-prop:hover::before,
.portal-prop:focus-visible::before {
  opacity: 0.95;
  transform: scaleX(0.98);
}

.portal-prop:hover::after,
.portal-prop:focus-visible::after {
  border-color: rgba(255, 239, 184, 0.62);
  opacity: 0.82;
  transform: scale(1.02);
}

.portal-prop:hover img,
.portal-prop:focus-visible img {
  filter:
    drop-shadow(0 1.35rem 1.3rem rgba(38, 19, 8, 0.42))
    drop-shadow(0 0 0.65rem rgba(255, 223, 135, 0.34))
    brightness(1.05);
  transform: translateY(-0.65rem) scale(1.025);
}

.prop-bbs:hover img,
.prop-bbs:focus-visible img {
  filter:
    drop-shadow(0 1.35rem 1.25rem rgba(24, 16, 9, 0.4))
    drop-shadow(0 0 0.9rem rgba(99, 221, 218, 0.45))
    brightness(1.08)
    saturate(1.08);
  transform: translateY(-0.75rem) scale(1.03);
}

.prop-story:hover img,
.prop-story:focus-visible img {
  filter:
    drop-shadow(0 1.3rem 1.25rem rgba(38, 19, 8, 0.4))
    drop-shadow(0 0 0.7rem rgba(255, 227, 151, 0.42))
    brightness(1.04);
  transform: translateY(-0.55rem) scale(1.018) rotate(-0.6deg);
}

.prop-redpen:hover img,
.prop-redpen:focus-visible img {
  filter:
    drop-shadow(0 1.2rem 1.1rem rgba(50, 12, 8, 0.4))
    drop-shadow(0 0 0.75rem rgba(235, 45, 42, 0.42))
    brightness(1.08)
    saturate(1.16);
  transform: translateY(-0.8rem) scale(1.03) rotate(-2deg);
}

.prop-products:hover img,
.prop-products:focus-visible img {
  animation: bottle-spark 760ms ease-in-out;
  filter:
    drop-shadow(0 1.25rem 1.15rem rgba(25, 16, 9, 0.42))
    drop-shadow(0 0 0.8rem rgba(128, 230, 178, 0.36))
    brightness(1.06)
    saturate(1.18);
  transform: translateY(-0.7rem) scale(1.026);
}

.prop-sealed:hover img,
.prop-sealed:focus-visible img {
  animation: sealed-warning 520ms ease-in-out infinite alternate;
  filter:
    drop-shadow(0 1.35rem 1.25rem rgba(41, 13, 7, 0.45))
    drop-shadow(0 0 0.85rem rgba(196, 42, 28, 0.34))
    brightness(1.04)
    saturate(1.08);
  transform: translateY(-0.55rem) scale(1.018);
}

.prop-gratitude:hover img,
.prop-gratitude:focus-visible img {
  filter:
    drop-shadow(0 1.25rem 1.1rem rgba(23, 17, 12, 0.42))
    drop-shadow(0 0 0.7rem rgba(202, 226, 143, 0.28))
    brightness(1.06);
  transform: translateY(-0.48rem) scale(1.018) rotate(0.7deg);
}

.portal-prop-label {
  position: absolute;
  left: 50%;
  bottom: 100%;
  z-index: 25;
  display: grid;
  gap: 0.08rem;
  min-width: max-content;
  padding: 0.42rem 0.72rem;
  border: 1px solid rgba(255, 239, 196, 0.72);
  border-radius: 10px;
  background: rgba(34, 23, 14, 0.76);
  box-shadow: 0 0.65rem 1.5rem rgba(0, 0, 0, 0.28);
  color: #fff6d6;
  opacity: 0;
  pointer-events: none;
  text-align: center;
  transform: translate(-50%, -0.28rem);
  transition: opacity 180ms ease, transform 180ms ease;
  backdrop-filter: blur(10px);
}

.portal-prop-label strong,
.portal-prop-label small {
  line-height: 1.25;
  letter-spacing: 0;
}

.portal-prop-label strong {
  font-size: 0.94rem;
}

.portal-prop-label small {
  color: rgba(255, 246, 214, 0.76);
  font-size: 0.76rem;
  font-weight: 700;
}

.portal-prop:hover .portal-prop-label,
.portal-prop:focus-visible .portal-prop-label {
  opacity: 1;
  transform: translate(-50%, -0.68rem);
}


.prop-bbs {
  left: 12%;
  top: 40%;
  --prop-w: 27%;
  --prop-r: -3deg;
  --prop-z: 4;
}

.prop-story {
  left: 26%;
  top: 57%;
  --prop-w: 33%;
  --prop-r: -1deg;
  --prop-z: 8;
}

.prop-redpen {
  left: 43%;
  top: 69%;
  --prop-w: 18%;
  --prop-r: -8deg;
  --prop-z: 12;
}

.prop-products {
  left: 56%;
  top: 57%;
  --prop-w: 26%;
  --prop-r: 1deg;
  --prop-z: 9;
}

.prop-sealed {
  left: 72%;
  top: 40%;
  --prop-w: 22%;
  --prop-r: -2deg;
  --prop-z: 6;
}

.prop-gratitude {
  left: 65%;
  top: 73%;
  --prop-w: 25%;
  --prop-r: 2deg;
  --prop-z: 7;
}

.prop-daily {
  left: 41.6%;
  top: 18.2%;
  --prop-w: 5.8%;
  --prop-r: -2.2deg;
  --prop-z: 15;
  transform-origin: center 8%;
}

.prop-daily::before {
  inset: 7% -2% 5% 8%;
  height: auto;
  border-radius: 16px;
  background: radial-gradient(ellipse, rgba(36, 18, 8, 0.36), transparent 70%);
  filter: blur(7px);
  opacity: 0.48;
  transform: translate(0.24rem, 0.28rem);
}

.prop-daily::after {
  inset: -10%;
  border-radius: 18px;
  background:
    radial-gradient(circle at 48% 34%, rgba(255, 238, 166, 0.22), transparent 58%),
    radial-gradient(circle at 50% 54%, rgba(255, 205, 103, 0.12), transparent 70%);
}

.prop-daily img {
  filter:
    drop-shadow(0.24rem 0.52rem 0.52rem rgba(31, 16, 8, 0.34))
    drop-shadow(0 0 0.16rem rgba(255, 232, 165, 0.22));
  transform-origin: center 8%;
}

.prop-daily:hover img,
.prop-daily:focus-visible img {
  filter:
    drop-shadow(0.3rem 0.62rem 0.62rem rgba(31, 16, 8, 0.4))
    drop-shadow(0 0 0.72rem rgba(255, 221, 132, 0.42))
    brightness(1.06);
  transform: translateY(-0.28rem) scale(1.035) rotate(0.45deg);
}

.prop-daily.is-hinting::after {
  animation: portal-daily-hint 1.8s ease-in-out 3;
  opacity: 0.92;
}

.daily-calendar-face {
  position: absolute;
  left: 24%;
  right: 21%;
  top: 36%;
  z-index: 2;
  display: grid;
  gap: 0.02rem;
  justify-items: center;
  color: #8b4c28;
  pointer-events: none;
  text-align: center;
  text-shadow: 0 1px 0 rgba(255, 244, 210, 0.78);
  transform: rotate(-0.8deg);
}

.daily-calendar-face strong,
.daily-calendar-face small {
  line-height: 1.1;
  letter-spacing: 0;
}

.daily-calendar-face strong {
  font-size: 0.72rem;
  font-weight: 900;
}

.daily-calendar-face small {
  font-size: 0.52rem;
  font-weight: 800;
}

.portal-light-dust {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.portal-light-dust span {
  position: absolute;
  width: 0.34rem;
  height: 0.34rem;
  border-radius: 999px;
  background: rgba(255, 235, 166, 0.74);
  box-shadow: 0 0 1rem rgba(255, 219, 135, 0.54);
  animation: portal-dust 8s ease-in-out infinite;
}

.portal-light-dust span:nth-child(1) {
  left: 24%;
  top: 31%;
}

.portal-light-dust span:nth-child(2) {
  left: 42%;
  top: 52%;
  animation-delay: -2s;
}

.portal-light-dust span:nth-child(3) {
  left: 72%;
  top: 36%;
  animation-delay: -4s;
}

.portal-light-dust span:nth-child(4) {
  left: 86%;
  top: 59%;
  animation-delay: -6s;
}

.portal-scene-frame .portal-vignette {
  z-index: 3;
}


/* ── 散らかし層（付箋・メモ） ── */

.portal-memo-layer {
  position: absolute;
  inset: 0;
  z-index: 20;
  pointer-events: none;
}

.portal-memo {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.38rem 0.6rem;
  font-size: clamp(0.5rem, 1.05vw, 0.78rem);
  line-height: 1.45;
  font-family: "Yu Gothic", "Hiragino Sans", "Meiryo", sans-serif;
  white-space: pre-line;
  text-align: center;
  border-radius: 2px;
  box-shadow: 1px 2px 6px rgba(0, 0, 0, 0.22), 0 0.5px 0 rgba(0, 0, 0, 0.08);
  opacity: 0.88;
  user-select: none;
}

.portal-memo-sticky {
  background: #fef9c3;
  color: #3a3018;
  min-width: 6.5em;
}

.portal-memo-slip {
  background: #fff8f8;
  color: #4a1a14;
  border-left: 2.5px solid #d44;
  border-radius: 1px;
  padding-left: 0.55rem;
  text-align: left;
  font-size: clamp(0.45rem, 0.9vw, 0.7rem);
}

.portal-memo-warning {
  background: #fff0ee;
  color: #8b1a12;
  border: 1px solid rgba(180, 40, 28, 0.35);
  font-size: clamp(0.45rem, 0.9vw, 0.7rem);
  letter-spacing: 0.04em;
}

/* 各メモの位置・回転 */
.memo-goal {
  left: 42%;
  top: 57%;
  transform: rotate(-2.5deg);
}

.memo-report {
  left: 18%;
  top: 56%;
  transform: rotate(1.8deg);
}

.memo-draft {
  left: 51%;
  top: 72%;
  transform: rotate(-4deg);
}

.memo-sample {
  left: 62%;
  top: 68%;
  transform: rotate(2deg);
}

.memo-sealed {
  left: 74%;
  top: 44%;
  transform: rotate(-1.5deg);
}

/* モバイルでは非表示（小道具と重なる） */
@media (max-width: 640px) {
  .portal-memo-layer {
    display: none;
  }
}

@keyframes portal-dust {
  0%,
  100% {
    opacity: 0.18;
    transform: translate3d(0, 0, 0);
  }

  50% {
    opacity: 0.82;
    transform: translate3d(0.35rem, -0.7rem, 0);
  }
}

@keyframes bottle-spark {
  0%,
  100% {
    transform: translateY(-0.7rem) scale(1.026);
  }

  45% {
    transform: translateY(-0.95rem) scale(1.04) rotate(0.6deg);
  }
}

@keyframes sealed-warning {
  0% {
    transform: translateY(-0.55rem) scale(1.018) rotate(-0.35deg);
  }

  100% {
    transform: translateY(-0.72rem) scale(1.026) rotate(0.35deg);
  }
}

@keyframes portal-daily-hint {
  0%,
  100% {
    opacity: 0.32;
    transform: scale(0.98);
  }

  48% {
    border-color: rgba(255, 244, 188, 0.78);
    opacity: 0.95;
    transform: scale(1.08);
  }
}

@media (max-width: 700px) {
  .portal-scroll {
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
    scroll-behavior: smooth;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    touch-action: pan-x;
    -webkit-overflow-scrolling: touch;
  }

  .portal-scroll.is-positioning {
    scroll-behavior: auto;
    scroll-snap-type: none;
  }

  .portal-scroll::-webkit-scrollbar {
    display: none;
  }

  .portal-scroll-inner {
    width: max(177.7svh, 300vw);
    height: 100svh;
  }

  .portal-scene-frame {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100svh;
    transform: none;
  }

  .portal-snap-rail {
    position: absolute;
    inset: 0;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
    height: 100%;
    opacity: 0;
    pointer-events: none;
  }

  .portal-snap-zone {
    display: block;
    min-width: 0;
    min-height: 100%;
    scroll-snap-stop: always;
  }

  .zone-left {
    scroll-snap-align: center;
  }

  .zone-center {
    scroll-snap-align: center;
  }

  .zone-right {
    scroll-snap-align: center;
  }

  .portal-prop::after {
    opacity: 0.2;
  }

  .portal-prop-label {
    display: none;
  }

  .prop-bbs {
    left: 5.5%;
    top: 39%;
    --prop-w: 30%;
  }

  .prop-story {
    left: 31%;
    top: 58%;
    --prop-w: 36%;
  }

  .prop-redpen {
    left: 47%;
    top: 71%;
    --prop-w: 17%;
  }

  .prop-products {
    left: 57%;
    top: 57%;
    --prop-w: 25%;
  }

  .prop-sealed {
    left: 74%;
    top: 40%;
    --prop-w: 22%;
  }

  .prop-gratitude {
    left: 68%;
    top: 73%;
    --prop-w: 26%;
  }

  .prop-daily {
    left: 41.2%;
    top: 18.3%;
    --prop-w: 7.6%;
  }
}

.daily-calendar-top {
  display: grid;
  grid-template-columns: minmax(10rem, 13rem) minmax(0, 1fr);
  gap: 1rem;
  align-items: stretch;
  margin: 1rem 0 1.35rem;
}

.daily-calendar-board {
  position: relative;
  display: grid;
  gap: 0.25rem;
  place-items: center;
  min-height: 11rem;
  padding: 2.2rem 1rem 1rem;
  border: 1px solid rgba(130, 84, 38, 0.32);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 248, 222, 0.84), rgba(255, 241, 203, 0.48)),
    #efd2a2;
  color: #7b4826;
  box-shadow:
    inset 0 0.35rem rgba(255, 255, 255, 0.32),
    0 0.8rem 1.5rem rgba(64, 34, 16, 0.12);
  text-align: center;
}

.daily-calendar-board::before {
  content: "";
  position: absolute;
  left: 0.85rem;
  right: 0.85rem;
  top: 0.7rem;
  height: 1.15rem;
  border-radius: 6px;
  background: #a9683f;
  box-shadow: inset 0 -0.2rem rgba(86, 43, 24, 0.18);
}

.daily-ring {
  position: absolute;
  top: 1.02rem;
  z-index: 1;
  width: 1rem;
  height: 1rem;
  border: 0.22rem solid #b8322b;
  border-radius: 999px;
  box-shadow: 0 0.12rem 0.2rem rgba(53, 26, 13, 0.2);
}

.daily-ring.left {
  left: 34%;
}

.daily-ring.right {
  right: 34%;
}

.daily-calendar-board strong {
  font-size: 1.8rem;
  line-height: 1.05;
  letter-spacing: 0;
}

.daily-calendar-board small {
  color: rgba(94, 61, 33, 0.72);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0;
}

.daily-record-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  align-items: start;
}

.daily-record-slot {
  display: grid;
  gap: 0.55rem;
  min-width: 0;
}

.daily-record-slot h2 {
  margin: 0;
  font-size: 1.18rem;
}

.daily-card-stack {
  min-width: 0;
}

.daily-record-card {
  display: grid;
  gap: 0.62rem;
  align-content: start;
  min-height: 17rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.5), transparent 44%),
    var(--paper);
  box-shadow: 0 0.55rem 1.25rem rgba(75, 52, 28, 0.08);
}

.daily-record-card[hidden] {
  display: none;
}

.daily-record-card h3 {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.45;
}

.daily-record-card .danger-meter {
  margin-top: 0.1rem;
}

.daily-record-card a {
  justify-self: start;
  align-self: end;
  margin-top: auto;
  padding: 0.42rem 0.72rem;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 900;
  text-decoration: none;
}

.daily-record-card a:hover,
.daily-record-card a:focus-visible {
  filter: brightness(1.05);
}

@media (max-width: 900px) {
  .daily-calendar-top,
  .daily-record-grid {
    grid-template-columns: 1fr;
  }

  .daily-calendar-board {
    min-height: 8.5rem;
  }

  .daily-record-card {
    min-height: 0;
  }
}

.incident-page .chapter > p,
.incident-file-card p {
  text-indent: 0;
}

.incident-top {
  align-items: stretch;
}

.case-folder {
  position: relative;
  min-height: 12rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.16)),
    #e7d3a6;
  box-shadow: inset 0 0.35rem rgba(255, 255, 255, 0.34);
}

.case-folder-tab {
  position: absolute;
  left: 1rem;
  top: -0.75rem;
  min-width: 5rem;
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  background: #d8bd7b;
  color: #5a4012;
  font-size: 0.78rem;
  font-weight: 900;
}

.case-folder-line {
  position: absolute;
  left: 1.1rem;
  right: 1.1rem;
  top: 4.5rem;
  height: 0.18rem;
  border-radius: 999px;
  background: rgba(116, 84, 29, 0.24);
  box-shadow: 0 2rem rgba(116, 84, 29, 0.16), 0 4rem rgba(116, 84, 29, 0.12);
}

.case-folder-stamp {
  position: absolute;
  right: 1.2rem;
  bottom: 1.1rem;
  padding: 0.18rem 0.75rem;
  border: 2px solid #b92828;
  border-radius: 4px;
  color: #b92828;
  background: rgba(255, 247, 247, 0.52);
  font-weight: 900;
  transform: rotate(-6deg);
}

.incident-console {
  margin-top: 1.5rem;
}

.incident-file-grid {
  display: grid;
  gap: 1rem;
  margin-top: 1.2rem;
}

.incident-file-card {
  display: grid;
  gap: 0.8rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-left: 6px solid var(--accent);
  border-radius: 8px;
  background: var(--paper);
}

.incident-file-card[data-status="sealed"] {
  border-left-color: #ad3830;
}

.incident-file-card[data-status="safe"] {
  border-left-color: #6b9b68;
}

.incident-file-card[data-status="review"] {
  border-left-color: #a36a20;
}

.incident-file-head {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  justify-content: space-between;
}

.incident-file-head > div {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.incident-file-head .danger-meter {
  min-width: min(100%, 13rem);
  margin-top: 0;
}

.incident-file-card h2 {
  margin: 0;
}

.incident-good-point {
  margin: 0;
  padding: 0.7rem 0.85rem;
  border: 1px solid rgba(47, 111, 104, 0.18);
  border-radius: 8px;
  background: var(--accent-soft);
}

.incident-route {
  display: grid;
  gap: 0.65rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.incident-step {
  display: grid;
  grid-template-columns: 3.1rem minmax(0, 1fr);
  gap: 0.75rem;
  align-items: start;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.5);
}

.incident-step-no {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.86rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.incident-phase {
  display: block;
  margin-bottom: 0.15rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
}

.incident-step a {
  font-weight: 900;
}

.incident-step p {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.incident-step-bbs .incident-step-no {
  background: #2f6f68;
}

.incident-step-staff .incident-step-no {
  background: #775a34;
}

.incident-step-redpen .incident-step-no,
.incident-step-sealed .incident-step-no {
  background: #b92828;
}

.incident-step-ledger .incident-step-no {
  background: #7a5e2c;
}

.incident-step-gratitude .incident-step-no {
  background: #6b9b68;
}

@media (max-width: 700px) {
  .incident-file-head {
    display: grid;
  }

  .incident-step {
    grid-template-columns: 2.6rem minmax(0, 1fr);
    gap: 0.55rem;
    padding: 0.65rem;
  }

  .incident-step-no {
    width: 2rem;
    height: 2rem;
    font-size: 0.78rem;
  }
}
