:root {
  --paper: #f2ede4;
  --paper-2: #e9e1d4;
  --card: #f8f4ed;
  --ink: #171512;
  --ink-soft: #3d3933;
  --muted: #7a7266;
  --line: rgba(23, 21, 18, 0.14);
  --line-strong: rgba(23, 21, 18, 0.3);
  --accent: #b23a2b;
  --accent-soft: #d56a4f;
  --contact-bg: #171512;
  --contact-ink: #f2ede4;
  --rail-w: 300px;
  --serif: "Songti SC", "STSong", "SimSun", "Noto Serif CJK SC", "Source Han Serif SC", serif;
  --sans: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", "Hiragino Sans GB", sans-serif;
  --mono: "Cascadia Mono", "Consolas", "SFMono-Regular", "Menlo", monospace;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --page-pad-x: clamp(24px, 5vw, 74px);
  --page-pad-y: clamp(34px, 5.4vh, 68px);
}

[data-theme="dark"] {
  --paper: #131210;
  --paper-2: #1d1a16;
  --card: #1a1815;
  --ink: #ece5d8;
  --ink-soft: #cbc2b3;
  --muted: #92897b;
  --line: rgba(236, 229, 216, 0.14);
  --line-strong: rgba(236, 229, 216, 0.32);
  --accent: #d45a43;
  --accent-soft: #e07c63;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-snap-type: y mandatory;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.75;
  overflow-x: hidden;
  transition: background-color 0.45s var(--ease), color 0.45s var(--ease);
}

body,
button,
input,
a {
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: var(--accent);
  color: #f8f3e8;
}

a {
  color: inherit;
}

img,
svg {
  display: block;
  max-width: 100%;
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

h1,
h2,
h3,
p,
dl,
dd,
figure,
ol {
  margin: 0;
}

ol {
  padding: 0;
}

code {
  font-family: var(--mono);
  font-size: 0.86em;
  background: var(--paper-2);
  border: 1px solid var(--line);
  padding: 0.08em 0.38em;
  border-radius: 3px;
}

[hidden] {
  display: none !important;
}

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

.empty-state {
  padding: 32px;
  border: 1px dashed var(--line-strong);
  font-family: var(--mono);
  font-size: 9px;
  line-height: 1.8;
  color: var(--muted);
}

.protected-media {
  position: relative;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.protected-media img {
  pointer-events: none;
  -webkit-user-drag: none;
  user-select: none;
}

html.modal-open,
body.modal-open {
  overflow: hidden;
}

.skip-link {
  position: fixed;
  top: -100px;
  left: 20px;
  z-index: 300;
  background: var(--accent);
  color: #fff;
  padding: 10px 16px;
  text-decoration: none;
  font-size: 13px;
}

.skip-link:focus {
  top: 12px;
}

.grain {
  position: fixed;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  opacity: 0.045;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 180px 180px;
}

[data-theme="dark"] .grain {
  opacity: 0.07;
}

/* ---------- boot ---------- */

.boot,
.boot-error {
  position: fixed;
  inset: 0;
  z-index: 250;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: var(--paper);
  transition: opacity 0.55s var(--ease), visibility 0.55s var(--ease);
}

.boot-mark {
  display: grid;
  place-items: center;
  width: 68px;
  height: 68px;
  border: 1px solid var(--accent);
  color: var(--accent);
  font-family: var(--serif);
  font-size: 24px;
  letter-spacing: 0.06em;
  transform: rotate(-3deg);
}

.boot p {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--muted);
}

body.is-ready .boot {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.boot-error {
  padding: 32px;
  text-align: center;
}

.boot-error h1 {
  font-family: var(--serif);
  font-size: clamp(32px, 5vw, 52px);
  font-weight: 500;
}

.boot-error p {
  max-width: 520px;
  color: var(--muted);
  font-size: 14px;
}

.boot-error button {
  margin-top: 8px;
  border: 1px solid var(--ink);
  background: transparent;
  padding: 10px 22px;
}

#app {
  opacity: 0;
  transition: opacity 0.6s var(--ease);
}

body.is-ready #app {
  opacity: 1;
}

/* ---------- rail ---------- */

.rail {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 30;
  width: var(--rail-w);
  display: flex;
  flex-direction: column;
  padding: 22px 14px 16px;
  background: color-mix(in srgb, var(--paper) 94%, var(--paper-2));
  border-right: 1px solid var(--line);
  overflow: hidden;
  transition: width 0.38s var(--ease), padding 0.38s var(--ease), box-shadow 0.38s var(--ease);
}

body.rail-collapsed {
  --rail-w: 88px;
}

.rail-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 0 8px;
  text-decoration: none;
  flex: none;
}

.rail-logo {
  width: 40px;
  height: 40px;
  flex: none;
  overflow: hidden;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--paper-2);
  transition: transform 0.35s var(--ease);
}

.rail-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 42%;
  display: block;
  filter: saturate(0.9) contrast(0.98);
}

.rail-brand:hover .rail-logo {
  transform: scale(1.04);
}

.rail-brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.25;
}

.rail-brand-text strong {
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.rail-main {
  flex: 1;
  min-height: 0;
  padding-top: 26px;
  overflow-y: auto;
  scrollbar-width: none;
}

.rail-main::-webkit-scrollbar {
  display: none;
}

.chapter-nav {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.chapter-link {
  position: relative;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 10px 10px;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  text-align: left;
  transition: background-color 0.28s var(--ease), color 0.28s var(--ease);
}

.chapter-link:hover {
  background: var(--paper-2);
}

.chapter-link.is-active {
  background: var(--ink);
  color: var(--paper);
}

.chapter-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
}

.chapter-icon svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.35;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chapter-link.is-active .chapter-icon {
  color: var(--accent-soft);
}

.chapter-link.is-active .chapter-icon svg {
  stroke-width: 1.5;
}

.chapter-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.3;
}

.chapter-num {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--accent);
}

.chapter-title {
  margin-top: 2px;
  font-family: var(--serif);
  font-size: 15px;
  letter-spacing: 0.04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chapter-sub {
  margin-top: 2px;
  font-family: var(--mono);
  font-size: 7.2px;
  letter-spacing: 0.12em;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chapter-link.is-active .chapter-num {
  color: var(--accent-soft);
  opacity: 1;
}

.chapter-link.is-active .chapter-sub {
  color: inherit;
  opacity: 0.55;
}

.rail-bgm {
  flex: none;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
  padding: 16px 10px;
  border-top: 1px solid var(--line);
}

.vinyl {
  position: relative;
  width: 62px;
  height: 62px;
  flex: none;
  padding: 0;
  border: 0;
  background: transparent;
  border-radius: 50%;
}

.vinyl-disc {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    repeating-radial-gradient(circle at center, #0e0c0a 0 2px, #28231d 2px 3px, #12100d 3px 5px);
  box-shadow: inset 0 0 0 1px rgba(242, 237, 228, 0.15), 0 5px 14px rgba(0, 0, 0, 0.22);
  animation: vinyl-spin 9s linear infinite;
  animation-play-state: paused;
}

.vinyl-disc::before {
  content: "";
  position: absolute;
  inset: 31%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 38% 32%, #d56a4f, #b23a2b 62%, #7d261c);
  box-shadow: inset 0 0 0 1px rgba(242, 237, 228, 0.35);
}

.vinyl-disc::after {
  content: "";
  position: absolute;
  inset: 45%;
  border-radius: 50%;
  background: var(--paper);
}

.vinyl-label {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  pointer-events: none;
}

.vinyl-label::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 9%;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--paper);
  opacity: 0.55;
  transform: translateX(-50%);
}

.vinyl-control {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  color: var(--ink);
}

.vinyl-control svg {
  width: 17px;
  height: 17px;
  padding: 4px;
  border-radius: 50%;
  background: var(--paper);
  fill: currentColor;
  box-sizing: content-box;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--ink) 12%, transparent);
}

.vinyl-pause {
  display: none;
}

.vinyl.is-playing .vinyl-disc {
  animation-play-state: running;
}

.vinyl.is-playing .vinyl-play {
  display: none;
}

.vinyl.is-playing .vinyl-pause {
  display: block;
}

@keyframes vinyl-spin {
  to { transform: rotate(360deg); }
}

.bgm-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.35;
}

.bgm-copy strong {
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 400;
  letter-spacing: 0.16em;
  color: var(--accent);
}

.bgm-copy span {
  font-family: var(--sans);
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rail-bgm audio {
  display: none;
}

.rail-foot {
  flex: none;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.rail-toggle {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  text-align: left;
  transition: color 0.25s var(--ease), border-color 0.25s var(--ease), background-color 0.25s var(--ease);
}

.rail-toggle:hover {
  border-color: var(--line-strong);
  color: var(--ink);
  background: var(--paper-2);
}

.rail-toggle-icon {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
}

.rail-toggle-icon svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.35s var(--ease);
}

body.rail-collapsed .rail-toggle-icon svg {
  transform: rotate(180deg);
}

.rail-toggle-text {
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.12em;
  white-space: nowrap;
}

/* collapsed rail */

body.rail-collapsed .rail {
  padding-left: 10px;
  padding-right: 10px;
}

body.rail-collapsed .rail-brand {
  justify-content: center;
  padding: 0;
}

body.rail-collapsed .rail-brand-text,
body.rail-collapsed .chapter-text,
body.rail-collapsed .bgm-copy,
body.rail-collapsed .rail-toggle-text {
  display: none;
}

body.rail-collapsed .rail-main {
  padding-top: 22px;
}

body.rail-collapsed .chapter-link {
  grid-template-columns: 1fr;
  justify-items: center;
  padding: 10px 0;
}

body.rail-collapsed .chapter-icon {
  width: 38px;
  height: 38px;
}

body.rail-collapsed .chapter-icon svg {
  width: 24px;
  height: 24px;
}

body.rail-collapsed .chapter-link.is-active .chapter-icon {
  color: var(--accent-soft);
}

body.rail-collapsed .rail-bgm {
  justify-content: center;
  margin-top: 12px;
  padding: 12px 0;
}

body.rail-collapsed .vinyl {
  width: 46px;
  height: 46px;
}

body.rail-collapsed .rail-toggle {
  grid-template-columns: 1fr;
  justify-items: center;
  padding: 9px 0;
}

.rail-backdrop {
  display: none;
}

/* ---------- stage and chapters ---------- */

.stage {
  margin-left: var(--rail-w);
  transition: margin-left 0.38s var(--ease);
}

.chapter {
  position: relative;
  height: 100svh;
  min-height: 100svh;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.chapter-inner {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: var(--page-pad-y) var(--page-pad-x) clamp(58px, 7vh, 82px);
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  overflow-y: auto;
  scrollbar-width: none;
}

.chapter-inner::-webkit-scrollbar {
  display: none;
}

.chapter-foot {
  position: absolute;
  left: var(--page-pad-x);
  right: var(--page-pad-x);
  bottom: 18px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.chapter-foot a {
  color: var(--ink-soft);
  text-decoration: none;
  transition: color 0.25s var(--ease);
}

.chapter-foot a:hover {
  color: var(--accent);
}

.chapter-head {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr);
  align-items: end;
  gap: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line-strong);
  margin-bottom: clamp(20px, 3.4vh, 34px);
  flex: none;
}

.chapter-title {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 14px;
  min-width: 0;
}

.chapter-translation {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.12em;
  color: var(--muted);
  white-space: nowrap;
}

.chapter-no {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--accent);
  padding-bottom: 8px;
}

.chapter-jp {
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.2em;
  color: var(--muted);
  margin-bottom: 4px;
}

.chapter-title h2 {
  font-family: var(--serif);
  font-size: clamp(36px, 4.8vw, 64px);
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: 0.04em;
}

.chapter-en {
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.18em;
  color: var(--muted);
  padding-bottom: 8px;
  white-space: nowrap;
}

.chapter-hint {
  margin-top: 13px;
  font-family: var(--mono);
  font-size: 8px;
  line-height: 1.7;
  letter-spacing: 0.05em;
  color: var(--muted);
}

/* ---------- cover ---------- */

.chapter-cover {
  background: var(--paper);
}

.cover-inner {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(260px, 0.8fr);
  align-items: center;
  align-content: center;
  gap: clamp(34px, 7vw, 104px);
  padding-top: clamp(64px, 9vh, 100px);
}

.cover-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, var(--line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--line) 1px, transparent 1px);
  background-size: 84px 84px;
  opacity: 0.34;
  -webkit-mask-image: radial-gradient(ellipse 88% 72% at 60% 46%, #000 10%, transparent 78%);
  mask-image: radial-gradient(ellipse 88% 72% at 60% 46%, #000 10%, transparent 78%);
  pointer-events: none;
}

.cover-copy {
  position: relative;
  z-index: 2;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.cover-art {
  width: 100%;
  max-width: 660px;
  height: auto;
  display: block;
  overflow: visible;
  margin-left: -4px;
  user-select: none;
}

.cover-art text {
  font-family: "Bodoni MT Black", "Bodoni MT", "Didot", "Times New Roman", serif;
  font-size: 238px;
  font-style: italic;
  font-weight: 900;
  letter-spacing: -4px;
}

.cover-art-offset {
  fill: var(--accent);
  opacity: 0.92;
}

.cover-art-main {
  fill: var(--ink);
  stroke: var(--paper);
  stroke-width: 2.2;
  paint-order: stroke fill;
  filter: url(#artRough);
}

.cover-art-cuts {
  fill: var(--paper);
  opacity: 0.9;
}

.cover-art-marks {
  opacity: 0.95;
}

.cover-sub-lines {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 12px;
  padding-left: 4px;
}

.cover-cn {
  font-family: var(--sans);
  font-size: clamp(16px, 1.35vw, 19px);
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--ink);
}

.cover-en {
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--muted);
  text-transform: uppercase;
}

.cover-jp {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.2em;
  color: var(--muted);
  text-transform: uppercase;
}

.eyebrow-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 13%, transparent);
  animation: breathe 3.4s ease-in-out infinite;
}

@keyframes breathe {
  0%, 100% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 13%, transparent); }
  50% { box-shadow: 0 0 0 8px color-mix(in srgb, var(--accent) 3%, transparent); }
}

.cover-name {
  margin-top: 22px;
  font-family: var(--serif);
  font-size: clamp(66px, 9.2vw, 132px);
  font-weight: 600;
  line-height: 0.98;
  letter-spacing: 0.02em;
}

.cover-latin {
  margin-top: 12px;
  font-family: var(--mono);
  font-size: clamp(9px, 1vw, 12px);
  letter-spacing: 0.38em;
  color: var(--muted);
}

.cover-subtitle {
  max-width: 14em;
  margin-top: clamp(26px, 4vh, 42px);
  font-family: var(--serif);
  font-size: clamp(23px, 2.4vw, 33px);
  line-height: 1.5;
  letter-spacing: 0.03em;
  text-wrap: balance;
}

.cover-lead {
  max-width: 34em;
  margin-top: 14px;
  font-size: 13px;
  color: var(--muted);
}

.cover-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  max-width: 430px;
  margin-top: clamp(26px, 3.6vh, 40px);
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.cover-photo {
  position: relative;
  z-index: 2;
  margin: 0;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  transform: rotate(1.2deg);
}

.photo-frame {
  position: relative;
  width: 100%;
  max-width: 100%;
  padding: 9px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: 0 26px 70px rgba(23, 21, 18, 0.14);
}

[data-theme="dark"] .photo-frame {
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.4);
}

.photo-frame img {
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  display: block;
  filter: saturate(0.86) contrast(0.97);
}

.photo-frame img.is-missing {
  background:
    radial-gradient(circle at 60% 30%, #e5c49b, transparent 55%),
    linear-gradient(145deg, #d8b28a, #6b4733);
}

.photo-seal {
  position: absolute;
  right: 18px;
  bottom: 28px;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 1.5px solid var(--accent);
  color: var(--accent);
  font-family: var(--serif);
  font-size: 20px;
  background: color-mix(in srgb, var(--card) 80%, transparent);
  transform: rotate(-7deg);
}

.cover-photo figcaption {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.cover-photo figcaption span:last-child {
  color: var(--accent);
}

.cover-vertical {
  position: absolute;
  right: calc(var(--page-pad-x) * 0.22);
  bottom: 17%;
  writing-mode: vertical-rl;
  font-family: var(--serif);
  font-size: 11px;
  letter-spacing: 0.38em;
  color: var(--muted);
  opacity: 0.65;
  z-index: 1;
}

.cover-foot {
  border-top: 0;
  justify-content: flex-end;
}

/* ---------- about ---------- */

.chapter-about {
  background: var(--paper);
}

.about-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
  gap: clamp(34px, 5vw, 68px);
  align-items: center;
  align-content: center;
  flex: 1;
  min-height: 0;
}

.about-copy {
  max-width: 47em;
  font-size: 15px;
  line-height: 1.9;
  color: var(--ink-soft);
}

.about-copy p {
  text-wrap: pretty;
}

.about-copy > * + * {
  margin-top: 1.1em;
}

.about-copy p.is-larger {
  margin-top: 0;
  font-family: var(--sans);
  font-size: clamp(22px, 1.8vw, 26px);
  font-weight: 600;
  line-height: 1.45;
  color: var(--ink);
  letter-spacing: 0.02em;
}

.about-copy p.is-common {
  font-size: 15px;
  line-height: 1.9;
}

.about-illustration {
  margin: 0;
  width: 100%;
  max-width: 420px;
  justify-self: end;
  align-self: center;
  padding: 8px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: 0 24px 64px rgba(23, 21, 18, 0.1);
  transform: rotate(-0.7deg);
}

[data-theme="dark"] .about-illustration {
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.38);
}

.about-illustration img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  filter: saturate(0.95) contrast(0.98);
}

.about-copy strong {
  font-weight: 600;
  color: var(--ink);
}

.about-copy a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.about-copy blockquote {
  border-left: 2px solid var(--accent);
  padding-left: 18px;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 17px;
}

.about-copy ul,
.about-copy ol {
  padding-left: 1.3em;
}

.about-copy li + li {
  margin-top: 0.4em;
}

.about-side {
  border-top: 1px solid var(--line-strong);
  padding-top: 14px;
}

.side-label {
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.2em;
  color: var(--muted);
}

.facts {
  margin-top: 14px;
}

.facts > div {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr);
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px dashed var(--line);
}

.facts dt {
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.06em;
  color: var(--muted);
  padding-top: 2px;
}

.facts dd {
  font-size: 11.5px;
  line-height: 1.55;
}

.signature {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 24px;
}

.signature-seal {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--accent);
  color: var(--accent);
  font-family: var(--serif);
  font-size: 18px;
  transform: rotate(-6deg);
  flex: none;
}

.signature p {
  font-family: var(--serif);
  font-size: 13px;
  line-height: 1.5;
}

.signature p span {
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.more-texts {
  margin-top: 26px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.more-text-list {
  display: grid;
  gap: 5px;
  margin-top: 10px;
}

.more-text {
  display: grid;
  gap: 2px;
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line);
  background: var(--card);
  text-align: left;
}

.more-text span {
  font-family: var(--serif);
  font-size: 14px;
}

.more-text small {
  font-family: var(--mono);
  font-size: 7.5px;
  color: var(--muted);
}

/* ---------- journey ---------- */

.chapter-journey {
  background: color-mix(in srgb, var(--paper) 88%, var(--paper-2));
}

.journey {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  justify-content: center;
  gap: clamp(18px, 3vh, 32px);
}

.journey-track-wrap {
  position: relative;
  flex: none;
  padding-top: 10px;
}

.journey-track {
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--count, 4), minmax(0, 1fr));
  gap: 8px;
}

.journey-track::before {
  content: "";
  position: absolute;
  left: 10%;
  right: 10%;
  top: 11px;
  height: 1px;
  background: var(--line-strong);
}

.journey-progress {
  position: absolute;
  left: 10%;
  top: 11px;
  height: 1px;
  width: calc(80% * var(--progress, 0));
  background: var(--accent);
  transition: width 0.55s var(--ease);
}

.journey-node {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  text-align: center;
}

.journey-node .node-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: var(--paper);
  transition: width 0.3s var(--ease), height 0.3s var(--ease), background-color 0.3s var(--ease), border-color 0.3s var(--ease), box-shadow 0.3s var(--ease);
}

.journey-node:hover .node-dot {
  border-color: var(--accent);
}

.journey-node.is-active .node-dot {
  width: 18px;
  height: 18px;
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 15%, transparent);
}

.journey-node .node-year {
  margin-top: 8px;
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.08em;
}

.journey-node .node-label {
  max-width: 100%;
  font-family: var(--serif);
  font-size: 12.5px;
  line-height: 1.35;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.node-label-short {
  display: none;
}

.journey-node.is-active .node-year,
.journey-node.is-active .node-label {
  color: var(--accent);
}

.journey-panel {
  position: relative;
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: clamp(22px, 4vw, 52px);
  align-items: center;
  flex: 0 0 auto;
  min-height: 220px;
  padding: clamp(18px, 2.6vh, 28px) clamp(20px, 3.2vw, 38px);
  background: var(--card);
  border: 1px solid var(--line);
  border-top: 2px solid var(--accent);
  overflow: hidden;
}

.journey-mark {
  position: absolute;
  right: clamp(18px, 4vw, 58px);
  top: 50%;
  z-index: 0;
  transform: translateY(-50%);
  font-family: var(--serif);
  font-size: clamp(120px, 14vw, 200px);
  line-height: 1;
  color: transparent;
  -webkit-text-stroke: 1px var(--line-strong);
  opacity: 0.52;
  pointer-events: none;
}

.journey-side,
.journey-content {
  position: relative;
  z-index: 1;
}

.journey-panel.is-switching .journey-content {
  animation: panel-in 0.45s var(--ease);
}

@keyframes panel-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.journey-side {
  min-width: 0;
}

.journey-period {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  color: var(--accent);
}

.journey-panel h3 {
  margin-top: 8px;
  font-family: var(--serif);
  font-size: clamp(22px, 2.5vw, 34px);
  font-weight: 500;
  line-height: 1.25;
}

.journey-org {
  margin-top: 6px;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.journey-content {
  min-width: 0;
}

.journey-desc {
  max-width: 58ch;
  font-size: 13px;
  line-height: 1.9;
  color: var(--ink-soft);
}

.journey-bullets {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 20px;
  margin-top: 14px;
  padding: 0;
  list-style: none;
  font-size: 11.5px;
  color: var(--ink-soft);
}

.journey-bullets li::before {
  content: "—";
  margin-right: 6px;
  color: var(--accent);
}

.journey-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 15px;
}

.tag {
  display: inline-flex;
  border: 1px solid var(--line);
  padding: 3px 8px;
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: 0.06em;
  color: var(--muted);
  white-space: nowrap;
}

/* ---------- selves ---------- */

.chapter-selves {
  background: var(--paper);
}

.selves-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  flex: 1;
  min-height: 0;
}

.self-card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 320px;
  padding: clamp(18px, 2.2vw, 26px);
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
}

.self-card[data-tone="red"] {
  border-color: var(--accent);
  background: var(--accent);
  color: #f8f3e8;
}

.self-card[data-tone="dark"] {
  border-color: #171512;
  background: #171512;
  color: #f2ede4;
}

.self-mark {
  position: absolute;
  right: 8px;
  top: -12px;
  font-family: var(--serif);
  font-size: clamp(100px, 12vw, 170px);
  line-height: 1;
  color: transparent;
  -webkit-text-stroke: 1px var(--line-strong);
  opacity: 0.65;
  pointer-events: none;
}

.self-card[data-tone="red"] .self-mark {
  -webkit-text-stroke-color: rgba(248, 243, 232, 0.4);
}

.self-card[data-tone="dark"] .self-mark {
  -webkit-text-stroke-color: rgba(242, 237, 228, 0.3);
}

.self-top {
  position: relative;
  z-index: 1;
}

.self-period {
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.12em;
  opacity: 0.65;
}

.self-title {
  margin-top: 10px;
  font-family: var(--serif);
  font-size: clamp(20px, 2vw, 25px);
  font-weight: 500;
  line-height: 1.3;
  text-wrap: balance;
}

.self-desc {
  position: relative;
  z-index: 1;
  max-width: 32em;
  margin-top: 18px;
  font-size: 12.5px;
  line-height: 1.9;
  opacity: 0.82;
}

.self-bottom {
  position: relative;
  z-index: 1;
  margin-top: 18px;
}

.self-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.self-tags span {
  border: 1px solid currentColor;
  padding: 3px 7px;
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.06em;
  opacity: 0.6;
  white-space: nowrap;
}

.self-quote {
  margin-top: 14px;
  font-family: var(--serif);
  font-size: 12px;
  line-height: 1.6;
  opacity: 0.6;
}

/* ---------- moments ---------- */

.chapter-moments {
  background: color-mix(in srgb, var(--paper) 86%, var(--paper-2));
}

.moments-grid {
  columns: 300px;
  column-gap: 12px;
  display: block;
  flex: none;
  min-height: 0;
  padding-bottom: 8px;
}

.moment {
  position: relative;
  display: block;
  width: 100%;
  margin: 0 0 12px;
  padding: 0;
  border: 0;
  overflow: hidden;
  break-inside: avoid;
  -webkit-column-break-inside: avoid;
  background: var(--paper-2);
  text-align: left;
}

.moment:last-child {
  margin-bottom: 0;
}

.moment img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
  transition: transform 0.9s var(--ease), filter 0.5s var(--ease);
}

.moment::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(10, 9, 8, 0.68), transparent 50%);
  opacity: 0;
  transition: opacity 0.4s var(--ease);
}

.moment:hover img {
  transform: scale(1.035);
}

.moment:hover::after,
.moment:focus-visible::after {
  opacity: 1;
}

.moment-caption {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 13px;
  z-index: 1;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  color: #f7f2e8;
  opacity: 0;
  transform: translateY(7px);
  transition: opacity 0.35s var(--ease), transform 0.35s var(--ease);
}

.moment:hover .moment-caption,
.moment:focus-visible .moment-caption {
  opacity: 1;
  transform: translateY(0);
}

.moment-caption strong {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 500;
}

.moment-caption span {
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: 0.06em;
  opacity: 0.7;
  white-space: nowrap;
}

.moment-index {
  position: absolute;
  top: 11px;
  left: 11px;
  z-index: 1;
  padding: 3px 6px;
  background: rgba(10, 9, 8, 0.36);
  color: #f7f2e8;
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: 0.08em;
  opacity: 0;
  transition: opacity 0.3s var(--ease);
}

.moment-story .moment-index {
  position: static;
  padding: 0;
  background: transparent;
  color: var(--accent-soft);
  opacity: 1;
  font-size: 8px;
  letter-spacing: 0.16em;
}

.moment:hover .moment-index {
  opacity: 1;
}

/* ---------- contact ---------- */

.chapter-contact {
  background: var(--contact-bg);
  color: var(--contact-ink);
}

.contact-inner {
  justify-content: space-between;
  padding-top: clamp(58px, 9vh, 100px);
  padding-bottom: clamp(48px, 7vh, 72px);
}

.contact-top {
  max-width: 900px;
}

.contact-top .eyebrow {
  color: rgba(242, 237, 228, 0.5);
}

.contact-top h2 {
  margin-top: 0;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 16px;
  font-family: var(--serif);
  font-size: clamp(66px, 10.5vw, 142px);
  font-weight: 500;
  line-height: 0.95;
  letter-spacing: 0.02em;
}

.contact-translation {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.14em;
  color: rgba(242, 237, 228, 0.46);
  white-space: nowrap;
}

.contact-lead {
  margin-top: 18px;
  font-family: var(--serif);
  font-size: clamp(16px, 1.6vw, 22px);
  line-height: 1.6;
  letter-spacing: 0.04em;
  color: rgba(242, 237, 228, 0.68);
}

.contact-note {
  margin-top: 4px;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.08em;
  color: rgba(242, 237, 228, 0.4);
}

.contact-grid {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 34px;
  margin-top: clamp(22px, 4vh, 40px);
}

.contact-mail {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(242, 237, 228, 0.35);
  font-family: var(--serif);
  font-size: clamp(24px, 3.7vw, 46px);
  line-height: 1.2;
  text-decoration: none;
  transition: color 0.25s var(--ease), border-color 0.25s var(--ease);
}

.contact-mail span {
  font-family: var(--mono);
  font-size: 0.6em;
  color: var(--accent-soft);
}

.contact-mail:hover {
  color: var(--accent-soft);
  border-color: var(--accent-soft);
}

.qr-grid {
  display: flex;
  gap: 10px;
  flex: none;
}

.qr-card {
  width: 126px;
  padding: 8px;
  background: #f2ede4;
  color: #171512;
  border: 1px solid rgba(242, 237, 228, 0.35);
}

.qr-card img,
.qr-placeholder {
  width: 100%;
  aspect-ratio: 1;
  display: block;
  background: #fff;
}

.qr-card img {
  object-fit: contain;
}

.qr-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  border: 1px dashed #b9aa96;
  background:
    repeating-linear-gradient(45deg, #f8f4ed 0 9px, #eee6d9 9px 10px);
  color: #6f685d;
}

.qr-placeholder span {
  font-family: var(--serif);
  font-size: 27px;
  line-height: 1;
  color: var(--accent);
}

.qr-placeholder small {
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.08em;
}

.qr-card strong {
  display: block;
  margin-top: 6px;
  font-family: var(--serif);
  font-size: 11px;
  font-weight: 500;
}

.qr-card small {
  display: block;
  margin-top: 1px;
  font-family: var(--mono);
  font-size: 6.5px;
  letter-spacing: 0.04em;
  color: #6f685d;
}

.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}

.contact-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid rgba(242, 237, 228, 0.22);
  padding: 6px 11px;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.08em;
  text-decoration: none;
  color: rgba(242, 237, 228, 0.72);
}

.contact-link:hover {
  border-color: var(--accent-soft);
  color: var(--accent-soft);
}

.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid rgba(242, 237, 228, 0.16);
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: 0.06em;
  color: rgba(242, 237, 228, 0.42);
}

.contact-foot {
  color: rgba(242, 237, 228, 0.4);
  border-top-color: rgba(242, 237, 228, 0.16);
}

.contact-foot a {
  color: rgba(242, 237, 228, 0.7);
}

.contact-foot a:hover {
  color: var(--accent-soft);
}

/* ---------- modals ---------- */

.modal {
  padding: 0;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 40px 120px rgba(0, 0, 0, 0.3);
}

.modal::backdrop {
  background: rgba(10, 9, 8, 0.66);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
}

.modal[open] {
  animation: modal-in 0.3s var(--ease);
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(10px) scale(0.995); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
}

.modal-head > div {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.modal-head span {
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: 0.16em;
  color: var(--accent);
}

.modal-head strong {
  font-family: var(--serif);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.modal-close,
.modal-actions a {
  border: 1px solid var(--line);
  background: transparent;
  padding: 5px 10px;
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: 0.06em;
  text-decoration: none;
  color: var(--ink-soft);
  white-space: nowrap;
}

.modal-close:hover,
.modal-actions a:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.modal-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.moment-modal {
  width: 100vw;
  height: 100vh;
  max-width: 100vw;
  max-height: 100vh;
  margin: 0;
  padding: 0;
  border: 0;
  background: #111;
  color: #f2ede4;
  box-shadow: none;
}

.moment-modal::backdrop {
  background: #0b0a09;
}

.moment-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(330px, 0.75fr);
  width: 100%;
  height: 100%;
}

.moment-figure {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 0;
  padding: 42px;
  background: #0b0a09;
}

.moment-figure img {
  max-width: 100%;
  max-height: calc(100vh - 150px);
  object-fit: contain;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.5);
}

.moment-figure figcaption {
  margin-top: 12px;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.08em;
  color: rgba(242, 237, 228, 0.45);
  text-align: center;
}

.moment-story {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(34px, 6vw, 90px);
  border-left: 1px solid rgba(242, 237, 228, 0.14);
}

.moment-index {
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.16em;
  color: var(--accent-soft);
}

.moment-story h3 {
  margin-top: 14px;
  font-family: var(--serif);
  font-size: clamp(30px, 3.4vw, 48px);
  font-weight: 500;
  line-height: 1.2;
}

.moment-date {
  margin-top: 7px;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.08em;
  color: rgba(242, 237, 228, 0.45);
}

.moment-text {
  max-width: 28em;
  margin-top: 26px;
  font-size: 14px;
  line-height: 2;
  color: rgba(242, 237, 228, 0.72);
}

.moment-text p + p {
  margin-top: 0.9em;
}

.moment-controls {
  display: flex;
  gap: 8px;
  margin-top: 40px;
}

.moment-controls button {
  border: 1px solid rgba(242, 237, 228, 0.22);
  background: transparent;
  padding: 7px 12px;
  font-family: var(--mono);
  font-size: 8px;
  color: rgba(242, 237, 228, 0.7);
}

.moment-controls button:hover {
  border-color: var(--accent-soft);
  color: var(--accent-soft);
}

.moment-close {
  position: absolute;
  top: 18px;
  right: 20px;
  z-index: 3;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(242, 237, 228, 0.25);
  background: transparent;
  color: #f2ede4;
  font-family: var(--mono);
  font-size: 18px;
}

.moment-close:hover {
  border-color: var(--accent-soft);
  color: var(--accent-soft);
}

.reader-modal {
  width: min(760px, 92vw);
  height: fit-content;
  max-height: 86vh;
}

.reader-body {
  max-height: calc(86vh - 62px);
  padding: clamp(24px, 4vw, 44px);
  overflow-y: auto;
  font-size: 14px;
  color: var(--ink-soft);
}

.reader-body > * + * {
  margin-top: 1.1em;
}

.reader-body h1,
.reader-body h2,
.reader-body h3 {
  font-family: var(--serif);
  font-weight: 500;
  color: var(--ink);
  line-height: 1.35;
}

.reader-body h1 { font-size: 30px; }
.reader-body h2 { font-size: 24px; }
.reader-body h3 { font-size: 19px; }

.reader-body blockquote {
  border-left: 2px solid var(--accent);
  padding-left: 16px;
  font-family: var(--serif);
  font-size: 17px;
}

.reader-body a {
  color: var(--accent);
}

/* ---------- toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 220;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 11px 9px 16px;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.05em;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.26);
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, 16px);
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease), visibility 0.3s var(--ease);
}

.toast.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}

.toast button {
  border: 1px solid color-mix(in srgb, var(--paper) 30%, transparent);
  background: transparent;
  color: inherit;
  padding: 3px 8px;
  font-family: var(--mono);
  font-size: 8px;
}

.toast #toast-refresh {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.toast #toast-close {
  border: 0;
  font-size: 13px;
  padding: 0 3px;
  opacity: 0.6;
}

.noscript {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: grid;
  place-items: center;
  background: var(--paper);
  font-family: var(--mono);
  font-size: 12px;
}

/* ---------- responsive ---------- */

@media (max-width: 1180px) {
  :root {
    --rail-w: 260px;
  }

  body.rail-collapsed {
    --rail-w: 82px;
  }

  .cover-inner {
    grid-template-columns: minmax(0, 1.15fr) minmax(240px, 0.85fr);
    gap: 38px;
  }

  .chapter-head {
    grid-template-columns: 52px minmax(0, 1fr) auto;
    gap: 16px;
  }

  .about-layout {
    gap: 38px;
  }
}

@media (max-width: 920px) {
  :root {
    --rail-w: 64px;
    --page-pad-x: 24px;
    --page-pad-y: 28px;
  }

  body.rail-collapsed {
    --rail-w: 64px;
  }

  .rail {
    width: 64px;
    padding: 14px 8px 12px;
  }

  body:not(.rail-collapsed) .rail {
    width: min(280px, 82vw);
    padding: 16px 14px;
    box-shadow: 26px 0 70px rgba(0, 0, 0, 0.24);
    z-index: 40;
  }

  body:not(.rail-collapsed) .rail-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 35;
    background: rgba(10, 9, 8, 0.45);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
  }

  body:not(.rail-collapsed) .rail-brand {
    justify-content: flex-start;
    padding: 0 8px;
  }

  body:not(.rail-collapsed) .rail-brand-text,
  body:not(.rail-collapsed) .chapter-text,
  body:not(.rail-collapsed) .bgm-copy {
    display: flex;
  }

  body:not(.rail-collapsed) .chapter-link {
    grid-template-columns: 34px minmax(0, 1fr);
    justify-items: stretch;
    padding: 10px;
  }

  body:not(.rail-collapsed) .chapter-icon {
    width: 30px;
    height: 30px;
  }

  body:not(.rail-collapsed) .chapter-icon svg {
    width: 22px;
    height: 22px;
  }

  body:not(.rail-collapsed) .rail-toggle {
    grid-template-columns: 24px minmax(0, 1fr);
    justify-items: stretch;
    padding: 9px 10px;
  }

  .stage {
    margin-left: 64px;
  }

  .chapter-inner {
    padding-left: 24px;
    padding-right: 24px;
    padding-bottom: 64px;
  }

  .chapter-foot {
    left: 24px;
    right: 24px;
    bottom: 14px;
    font-size: 7px;
  }

  .cover-inner {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    gap: 26px;
    padding-top: 54px;
    padding-bottom: 60px;
  }

  .cover-art {
    margin-left: -2px;
  }

  .cover-sub-lines {
    margin-top: 10px;
    gap: 2px;
  }

  .cover-cn {
    font-size: 15px;
  }

  .cover-en {
    font-size: 9px;
  }

  .cover-jp {
    font-size: 10px;
  }

  .cover-photo {
    width: min(60vw, 240px);
    align-self: flex-end;
    transform: rotate(1deg);
  }

  .chapter-head {
    grid-template-columns: 32px minmax(0, 1fr);
    gap: 10px;
    padding-bottom: 12px;
    margin-bottom: 18px;
  }

  .chapter-en {
    display: none;
  }

  .chapter-no {
    font-size: 9px;
    padding-bottom: 6px;
  }

  .chapter-jp {
    font-size: 7px;
  }

  .chapter-title h2 {
    font-size: clamp(32px, 9vw, 46px);
  }

  .chapter-translation {
    font-size: 8px;
    letter-spacing: 0.08em;
  }

  .contact-translation {
    font-size: 8px;
    letter-spacing: 0.08em;
  }

  .about-layout {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .about-copy {
    font-size: 12.5px;
    line-height: 1.8;
  }

  .about-copy p.is-larger {
    font-size: 22px;
  }

  .about-copy p.is-common {
    font-size: 12.5px;
  }

  .about-illustration {
    width: min(60vw, 240px);
    justify-self: end;
    margin-top: 2px;
  }

  .facts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 16px;
  }

  .facts > div {
    display: block;
    padding: 6px 0;
  }

  .facts dt {
    padding-top: 0;
  }

  .facts dd {
    font-size: 10.5px;
    margin-top: 1px;
  }

  .signature {
    display: none;
  }

  .journey-track::before,
  .journey-progress {
    top: 9px;
  }

  .journey-node .node-dot {
    width: 10px;
    height: 10px;
  }

  .journey-node.is-active .node-dot {
    width: 15px;
    height: 15px;
  }

  .journey-node .node-year {
    margin-top: 5px;
    font-size: 7px;
  }

  .journey-node .node-label {
    font-size: 10px;
    white-space: normal;
  }

  .node-label-full {
    display: none;
  }

  .node-label-short {
    display: inline;
  }

  .journey-panel {
    grid-template-columns: 1fr;
    gap: 8px;
    min-height: 0;
    padding: 14px 16px;
  }

  .journey-panel h3 {
    font-size: 23px;
  }

  .journey-mark {
    right: 6px;
    font-size: 104px;
    opacity: 0.34;
  }

  .journey-desc {
    font-size: 12px;
    line-height: 1.8;
  }

  .journey-bullets {
    display: none;
  }

  .selves-grid {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    overscroll-behavior-x: contain;
    -webkit-mask-image: linear-gradient(to right, #000 0, #000 94%, transparent 100%);
    mask-image: linear-gradient(to right, #000 0, #000 94%, transparent 100%);
    padding-bottom: 8px;
    scrollbar-width: none;
  }

  .selves-grid::-webkit-scrollbar {
    display: none;
  }

  .self-card {
    flex: 0 0 82%;
    min-height: 390px;
    scroll-snap-align: center;
    scroll-snap-stop: always;
  }

  .self-title {
    font-size: 24px;
  }

  .self-desc {
    font-size: 12px;
  }

  .moments-grid {
    column-gap: 10px;
  }

  .moment {
    margin-bottom: 10px;
  }

  .moment-caption,
  .moment-index {
    opacity: 1;
    transform: none;
  }

  .moment::after {
    opacity: 1;
  }

  .contact-inner {
    padding-top: 50px;
    padding-bottom: 54px;
  }

  .contact-top h2 {
    font-size: clamp(58px, 17vw, 88px);
  }

  .contact-grid {
    display: block;
    margin-top: 18px;
  }

  .contact-mail {
    font-size: 22px;
  }

  .qr-grid {
    margin-top: 16px;
  }

  .qr-card {
    width: 108px;
    padding: 6px;
  }

  .qr-card strong {
    font-size: 10px;
  }

  .footer {
    flex-wrap: wrap;
    gap: 5px 14px;
    font-size: 7px;
  }

  .moment-layout {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 52%) minmax(0, 48%);
  }

  .moment-figure {
    padding: 18px 18px 8px;
  }

  .moment-figure img {
    max-height: calc(52vh - 52px);
  }

  .moment-story {
    justify-content: start;
    padding: 20px 22px 26px;
    border-left: 0;
    border-top: 1px solid rgba(242, 237, 228, 0.14);
    overflow-y: auto;
  }

  .moment-story h3 {
    margin-top: 8px;
    font-size: 28px;
  }

  .moment-text {
    margin-top: 12px;
    font-size: 12.5px;
    line-height: 1.8;
  }

  .moment-controls {
    margin-top: 16px;
  }

  .moment-close {
    top: 10px;
    right: 10px;
  }

  .toast {
    width: calc(100vw - 32px);
    justify-content: center;
    font-size: 8px;
  }
}

@media (max-width: 520px) {
  .cover-meta {
    gap: 10px;
    font-size: 7px;
  }

  .cover-photo {
    width: 58vw;
  }

  .cover-foot a {
    font-size: 7px;
  }

  .chapter-hint {
    font-size: 7px;
  }

  .journey-track {
    gap: 2px;
  }

  .journey-node .node-label {
    font-size: 9px;
  }

  .journey-desc {
    font-size: 11.5px;
  }

  .contact-mail {
    font-size: 19px;
    gap: 8px;
  }

  .qr-card {
    width: 108px;
  }

  .qr-grid {
    gap: 7px;
  }

  .chapter-foot {
    gap: 8px;
  }
}

/* ---------- journey v2: city stage + progress dots ---------- */

.chapter-journey {
  --journey-title: #6f4e28;
  --journey-body: #49382b;
  --journey-frame: rgba(111, 78, 40, 0.28);
}

[data-theme="dark"] .chapter-journey {
  --journey-title: #d9b77b;
  --journey-body: #d7c3ad;
  --journey-frame: rgba(217, 183, 123, 0.22);
}

.journey {
  justify-content: center;
  align-items: center;
  gap: 10px;
}

.journey-stage {
  position: relative;
  flex: none;
  width: 100%;
  max-width: 840px;
  height: clamp(360px, 46vh, 450px);
  overflow: hidden;
  border: 1px solid var(--journey-frame);
  background: var(--card);
  box-shadow: 0 24px 64px rgba(23, 21, 18, 0.1);
  isolation: isolate;
}

[data-theme="dark"] .journey-stage {
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.38);
}

.journey-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  filter: saturate(0.62) contrast(0.97);
  opacity: 0;
  transform: scale(1.025);
  transition: opacity 1.1s var(--ease);
  pointer-events: none;
  user-select: none;
  will-change: opacity;
}

.journey-stage::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--paper) 88%, transparent) 0%, color-mix(in srgb, var(--paper) 68%, transparent) 40%, color-mix(in srgb, var(--paper) 14%, transparent) 70%, transparent 100%),
    linear-gradient(0deg, color-mix(in srgb, var(--paper) 22%, transparent), transparent 42%);
  pointer-events: none;
}

.journey-copy {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 100%;
  max-width: 540px;
  min-height: 100%;
  padding: clamp(26px, 4vw, 44px);
  animation: journey-copy-in 0.4s var(--ease);
}

.journey-copy.is-switching {
  animation: journey-copy-in 0.55s var(--ease);
}

.journey-title {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(40px, 3.8vw, 54px);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: 0.07em;
  color: var(--journey-title);
  text-wrap: balance;
}

.journey-text {
  max-width: 32em;
  margin-top: 16px;
  font-family: var(--serif);
  font-size: clamp(15px, 1.2vw, 16.5px);
  font-weight: 400;
  line-height: 1.95;
  letter-spacing: 0.01em;
  color: var(--journey-body);
  text-wrap: pretty;
}

.journey-text p + p {
  margin-top: 0.65em;
}

@keyframes journey-copy-in {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: translateY(0); }
}

.journey-dots {
  position: relative;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 840px;
  height: 36px;
  padding: 0 4px;
}

.journey-dots::before {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  top: 50%;
  height: 1px;
  background: var(--line-strong);
  z-index: 0;
}

.journey-dot {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.journey-dot::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: var(--paper);
  transition: width 0.3s var(--ease), height 0.3s var(--ease), background-color 0.3s var(--ease), border-color 0.3s var(--ease), box-shadow 0.3s var(--ease);
}

.journey-dot:hover::before {
  border-color: var(--accent);
}

.journey-dot.is-past::before {
  background: var(--ink-soft);
  border-color: var(--ink-soft);
}

.journey-dot.is-active::before {
  width: 12px;
  height: 12px;
  border-color: var(--accent);
  background: var(--accent);
  animation: journey-breathe 2.8s ease-in-out infinite;
}

.journey-dot:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 2px;
}

@keyframes journey-breathe {
  0%, 100% {
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
  }
  50% {
    box-shadow: 0 0 0 9px color-mix(in srgb, var(--accent) 4%, transparent);
  }
}

@media (max-width: 520px) {
  .journey {
    gap: 8px;
  }

  .journey-stage {
    height: clamp(360px, 48vh, 410px);
  }

  .journey-copy {
    max-width: 100%;
    padding: 24px 20px 26px;
  }

  .journey-title {
    font-size: clamp(36px, 10vw, 44px);
  }

  .journey-text {
    margin-top: 13px;
    font-size: 14px;
    line-height: 1.9;
  }

  .journey-dots {
    height: 32px;
  }

  .journey-dot {
    width: 30px;
    height: 30px;
  }

  .journey-dot.is-active::before {
    width: 11px;
    height: 11px;
  }
}

/* ---------- selves room: light / dark inventory stage ---------- */

.chapter-selves {
  background: #090b0d;
  overflow: hidden;
}

.selves-room {
  position: relative;
  width: 100%;
  height: 100svh;
  overflow: hidden;
  color: #f2ede4;
  background: #090b0d;
  user-select: none;
  -webkit-user-select: none;
}

.selves-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  opacity: 0;
  transition: opacity 0.8s var(--ease);
  filter: saturate(0.9) contrast(0.98);
  pointer-events: none;
}

.selves-bg.is-active {
  opacity: 1;
}

.selves-bg-dark {
  filter: saturate(0.76) brightness(0.92);
}

.selves-shade {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(6, 8, 10, 0.62) 0%, rgba(6, 8, 10, 0.1) 20%, transparent 42%, transparent 68%, rgba(6, 8, 10, 0.62) 100%),
    linear-gradient(90deg, rgba(6, 8, 10, 0.4), transparent 30%, transparent 72%, rgba(6, 8, 10, 0.28));
}

.selves-head {
  position: absolute;
  top: clamp(20px, 3.5vh, 36px);
  left: clamp(22px, 3vw, 42px);
  z-index: 7;
  color: #f2ede4;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.55);
}

.selves-head .chapter-no {
  display: block;
  margin-bottom: 8px;
  color: #d6b37d;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.16em;
}

.selves-head h2 {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(38px, 4.2vw, 58px);
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.05em;
  color: #f2ede4;
}

.selves-head .chapter-translation {
  color: rgba(242, 237, 228, 0.62);
  font-size: 9px;
  letter-spacing: 0.12em;
}

.selves-lamp {
  position: absolute;
  left: 50%;
  top: 1.5%;
  z-index: 2;
  width: 30%;
  height: 10%;
  transform: translateX(-50%);
  background: radial-gradient(ellipse at center, rgba(255, 242, 205, 0.38), transparent 68%);
  filter: blur(8px);
  opacity: 0.42;
  pointer-events: none;
  transition: opacity 0.6s var(--ease);
}

.selves-room[data-stage="2"] .selves-lamp {
  background: radial-gradient(ellipse at center, rgba(186, 220, 255, 0.3), transparent 68%);
  animation: selves-lamp-flicker 3.8s linear infinite;
}

@keyframes selves-lamp-flicker {
  0%, 12%, 14%, 18%, 22%, 54%, 58%, 100% { opacity: 0; }
  12.5%, 13.5%, 18.5%, 21%, 55%, 56.5% { opacity: 0.3; }
  13%, 19%, 21.5%, 57% { opacity: 0.62; }
}

.selves-monitor {
  position: absolute;
  left: 50%;
  top: 38.67%;
  z-index: 4;
  width: min(75.1vh, 92%);
  aspect-ratio: 1.69 / 1;
  transform: translate(-50%, -50%);
  pointer-events: auto;
}

.selves-screen {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: #123fb5;
  color: #f7fbff;
  box-shadow: 0 0 0 6px rgba(6, 8, 10, 0.54), 0 18px 46px rgba(0, 0, 0, 0.35);
}

.selves-screen[data-mode="standby"] {
  background:
    radial-gradient(circle at 50% 35%, rgba(76, 132, 255, 0.9), transparent 54%),
    linear-gradient(160deg, #2057d8, #0c2b8e 60%, #071754);
}

.selves-screen[data-mode="item"],
.selves-screen[data-mode="verdict"] {
  background: linear-gradient(155deg, #1552d7, #0d329d 60%, #081e66);
}

.selves-room[data-stage="2"] .selves-screen,
.selves-room[data-stage="2"] .selves-screen[data-mode="static"],
.selves-room[data-stage="2"] .selves-screen[data-mode="item"],
.selves-room[data-stage="2"] .selves-screen[data-mode="verdict"] {
  background: #020304;
  border-color: rgba(195, 218, 237, 0.18);
}

.selves-screen-grain {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='0.75'/%3E%3C/svg%3E");
  background-size: 160px 160px;
  opacity: 0.1;
  mix-blend-mode: screen;
  pointer-events: none;
}

.selves-room[data-stage="2"] .selves-screen-grain {
  opacity: 0.08;
  animation: selves-screen-noise 0.24s steps(2) infinite;
}

@keyframes selves-screen-noise {
  0% { background-position: 0 0; }
  50% { background-position: 23px -17px; }
  100% { background-position: -11px 19px; }
}

.selves-screen-snow {
  position: absolute;
  inset: -12%;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  background-image: url("/hub/%E5%9B%BE%E7%89%87/snow.png");
  background-size: 280px 280px;
  mix-blend-mode: screen;
}

.selves-room[data-stage="2"] .selves-screen-snow {
  opacity: 0.64;
  animation:
    selves-snow-shift 0.15s steps(2) infinite,
    selves-snow-flicker 1.25s steps(2) infinite;
}

.selves-room[data-stage="2"] .selves-screen[data-mode="item"] .selves-screen-inner,
.selves-room[data-stage="2"] .selves-screen[data-mode="verdict"] .selves-screen-inner {
  background: linear-gradient(90deg, rgba(2, 3, 4, 0.92), rgba(2, 3, 4, 0.62));
}

.selves-screen-snow::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.16) 0 1px, transparent 1px 4px);
  opacity: 0.45;
  animation: selves-scan 2.1s linear infinite;
}

@keyframes selves-snow-shift {
  0% { background-position: 0 0; }
  50% { background-position: -47px 31px; }
  100% { background-position: 39px -23px; }
}

@keyframes selves-snow-flicker {
  0%, 100% { opacity: 0.56; }
  23% { opacity: 0.72; }
  24% { opacity: 0.38; }
  25% { opacity: 0.68; }
  63% { opacity: 0.52; }
  64% { opacity: 0.74; }
}

@keyframes selves-scan {
  from { transform: translateY(-18%); }
  to { transform: translateY(18%); }
}

.selves-screen-inner {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(14px, 2vw, 24px);
  overflow-y: auto;
  scrollbar-width: none;
}

.selves-screen-inner::-webkit-scrollbar {
  display: none;
}

.selves-standby {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  font-family: var(--mono);
  font-size: clamp(9px, 1vw, 12px);
  letter-spacing: 0.26em;
  color: rgba(244, 249, 255, 0.8);
}

.selves-standby::after {
  content: "";
  width: 6px;
  height: 1em;
  background: rgba(244, 249, 255, 0.8);
  animation: selves-cursor 1.15s steps(2) infinite;
}

@keyframes selves-cursor {
  0%, 45% { opacity: 1; }
  46%, 100% { opacity: 0; }
}

.selves-screen-item {
  display: grid;
  grid-template-columns: clamp(66px, 10vw, 104px) minmax(0, 1fr);
  gap: clamp(12px, 2vw, 20px);
  align-items: start;
}

.selves-screen-icon {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.35));
}

.selves-screen-name {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(18px, 2vw, 26px);
  font-weight: 500;
  letter-spacing: 0.05em;
  line-height: 1.25;
  color: #f7fbff;
}

.selves-screen-code {
  display: block;
  margin-bottom: 7px;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.12em;
  color: rgba(225, 239, 255, 0.55);
}

.selves-screen-body {
  margin-top: 9px;
  font-size: clamp(9px, 0.88vw, 11.5px);
  line-height: 1.75;
  color: rgba(238, 247, 255, 0.88);
}

.selves-screen-body p + p {
  margin-top: 0.6em;
}

.selves-verdict {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  text-align: center;
}

.selves-verdict-label {
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.24em;
  color: rgba(225, 239, 255, 0.52);
}

.selves-verdict-text {
  max-width: 30em;
  margin-top: 12px;
  font-family: var(--serif);
  font-size: clamp(15px, 1.55vw, 21px);
  line-height: 1.7;
  letter-spacing: 0.04em;
  color: #f7fbff;
}

.selves-detector {
  position: absolute;
  left: 59%;
  top: 69.5%;
  z-index: 5;
  width: 28%;
  height: 14%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  cursor: default;
}

.selves-detector-ring {
  position: absolute;
  inset: -4%;
  border: 1px dashed rgba(214, 179, 125, 0.66);
  border-radius: 50%;
  box-shadow: inset 0 0 28px rgba(214, 179, 125, 0.08), 0 0 26px rgba(214, 179, 125, 0.06);
  transition: border-color 0.25s var(--ease), box-shadow 0.25s var(--ease), background-color 0.25s var(--ease);
}

.selves-detector:hover .selves-detector-ring,
.selves-detector.is-over .selves-detector-ring {
  border-color: rgba(239, 213, 164, 0.95);
  background: rgba(214, 179, 125, 0.08);
  box-shadow: inset 0 0 28px rgba(214, 179, 125, 0.16), 0 0 34px rgba(214, 179, 125, 0.16);
}

.selves-detector-content {
  position: absolute;
  inset: 8%;
  display: grid;
  place-items: center;
  border-radius: 50%;
}

.selves-detector-content .selves-item {
  width: 96px;
  height: 96px;
  padding: 4px;
  background: rgba(5, 9, 12, 0.22);
  border-radius: 50%;
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.28));
}

.selves-detector-content .selves-item img {
  width: 100%;
  height: 100%;
}

.selves-item {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  padding: 7px;
  border: 0;
  background: transparent;
  color: #f2ede4;
  cursor: grab;
  touch-action: none;
}

.selves-item:active {
  cursor: grabbing;
}

.selves-item img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.26));
}

.selves-item-code {
  position: absolute;
  left: 3px;
  bottom: 2px;
  padding: 1px 3px;
  border-radius: 2px;
  background: rgba(5, 8, 10, 0.68);
  color: rgba(244, 239, 228, 0.88);
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.05em;
  pointer-events: none;
}

.selves-item.is-dragging {
  opacity: 0.25;
}

.selves-hotbar-wrap {
  position: absolute;
  left: 50%;
  bottom: 20px;
  z-index: 8;
  width: min(94%, 520px);
  transform: translateX(-50%);
}

.selves-hotbar {
  display: flex;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 8px;
  border: 1px solid rgba(242, 237, 228, 0.22);
  background: rgba(9, 11, 13, 0.7);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.25);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
}

.selves-slot {
  position: relative;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  flex: none;
  border: 1px solid rgba(242, 237, 228, 0.22);
  background: rgba(242, 237, 228, 0.07);
  transition: border-color 0.2s var(--ease), background-color 0.2s var(--ease);
}

.selves-slot.is-over {
  border-color: rgba(239, 213, 164, 0.8);
  background: rgba(214, 179, 125, 0.12);
}

.selves-slot:empty::after {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(242, 237, 228, 0.2);
}

.selves-room[data-stage="2"] .selves-hotbar {
  opacity: 0.58;
  border-color: rgba(214, 179, 125, 0.3);
}

.selves-room[data-stage="2"] .selves-hotbar .selves-item {
  pointer-events: none;
  filter: grayscale(0.7) brightness(0.56);
}

.selves-hotbar-chain {
  position: absolute;
  left: 4px;
  right: 4px;
  top: 50%;
  z-index: 3;
  height: 20px;
  transform: translateY(-50%);
  pointer-events: none;
  border-top: 1px solid rgba(218, 218, 218, 0.38);
  border-bottom: 1px solid rgba(90, 90, 90, 0.5);
  background:
    repeating-linear-gradient(135deg, rgba(240, 240, 240, 0.76) 0 3px, rgba(40, 42, 44, 0.85) 3px 8px, transparent 8px 15px);
  opacity: 0.9;
}

.selves-hotbar-chain span {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 18px;
  height: 14px;
  transform: translate(-50%, -50%);
  border: 2px solid #e6e0d5;
  border-radius: 2px;
  background: #1d2124;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.selves-hotbar-chain span::before {
  content: "";
  position: absolute;
  left: 3px;
  top: -8px;
  width: 9px;
  height: 8px;
  border: 2px solid #e6e0d5;
  border-bottom: 0;
  border-radius: 6px 6px 0 0;
}

.selves-shelf {
  position: absolute;
  left: 50%;
  bottom: 96px;
  z-index: 8;
  display: flex;
  gap: 7px;
  padding: 6px;
  border: 1px solid rgba(214, 179, 125, 0.3);
  background: rgba(9, 11, 13, 0.62);
  transform: translateX(-50%);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
}

.selves-shelf[hidden] {
  display: none;
}

.selves-shelf .selves-item {
  width: 54px;
  height: 54px;
  padding: 5px;
  border: 1px solid rgba(242, 237, 228, 0.15);
  background: rgba(242, 237, 228, 0.06);
}

.selves-toast {
  position: absolute;
  left: 50%;
  bottom: 108px;
  z-index: 20;
  max-width: min(86vw, 380px);
  padding: 8px 14px;
  border: 1px solid rgba(214, 179, 125, 0.55);
  background: rgba(8, 10, 12, 0.9);
  color: #f2ede4;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-align: center;
  opacity: 0;
  transform: translate(-50%, 8px);
  pointer-events: none;
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
}

.selves-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.selves-final {
  position: absolute;
  left: 50%;
  top: 38.67%;
  z-index: 30;
  display: grid;
  place-items: center;
  width: min(75.1vh, 92%);
  aspect-ratio: 1.69 / 1;
  transform: translate(-50%, -50%);
  color: #f2ede4;
  font-family: var(--serif);
  font-size: clamp(24px, 3.2vw, 42px);
  font-weight: 500;
  letter-spacing: 0.1em;
  text-align: center;
  text-shadow: 0 4px 26px rgba(0, 0, 0, 0.55);
}

.selves-final[hidden] {
  display: none;
}

.selves-next {
  position: absolute;
  left: 50%;
  bottom: 28px;
  z-index: 31;
  display: grid;
  place-items: center;
  width: 88px;
  height: 38px;
  transform: translateX(-50%);
  color: rgba(242, 237, 228, 0.82);
  text-decoration: none;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.5));
  animation: selves-next-bob 2.4s ease-in-out infinite;
}

.selves-next[hidden] {
  display: none;
}

.selves-next svg {
  width: 76px;
  height: 28px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.selves-next:hover {
  color: #f2ede4;
}

@keyframes selves-next-bob {
  0%, 100% { transform: translate(-50%, 0); }
  50% { transform: translate(-50%, -5px); }
}

.selves-lock {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(2, 3, 4, 0.36);
  cursor: wait;
}

.selves-lock[hidden] {
  display: none;
}

.selves-ghost {
  position: fixed;
  z-index: 120;
  width: 58px;
  height: 58px;
  padding: 6px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  border: 1px solid rgba(214, 179, 125, 0.5);
  background: rgba(9, 11, 13, 0.74);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.38);
}

.selves-ghost img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

@media (max-width: 900px) {
  .selves-head h2 {
    font-size: 40px;
  }

  .selves-detector {
    width: 34%;
    height: 12%;
    left: 58%;
  }

  .selves-detector-content .selves-item {
    width: 70px;
    height: 70px;
  }

  .selves-slot {
    width: 46px;
    height: 46px;
  }

  .selves-hotbar-wrap {
    width: min(94%, 430px);
  }

  .selves-shelf .selves-item {
    width: 46px;
    height: 46px;
  }
}

@media (max-width: 520px) {
  .selves-head {
    top: 16px;
    left: 16px;
  }

  .selves-head .chapter-no {
    margin-bottom: 5px;
    font-size: 8px;
  }

  .selves-head h2 {
    gap: 8px;
    font-size: 31px;
  }

  .selves-head .chapter-translation {
    font-size: 7px;
  }

  .selves-monitor {
    top: 34%;
    width: 92%;
    aspect-ratio: 1.55 / 1;
  }

  .selves-screen {
    box-shadow: 0 0 0 3px rgba(6, 8, 10, 0.54), 0 12px 28px rgba(0, 0, 0, 0.35);
  }

  .selves-screen-inner {
    padding: 10px;
  }

  .selves-screen-item {
    grid-template-columns: 52px minmax(0, 1fr);
    gap: 9px;
  }

  .selves-screen-name {
    font-size: 15px;
  }

  .selves-screen-body {
    margin-top: 5px;
    font-size: 8px;
    line-height: 1.6;
  }

  .selves-screen-code {
    font-size: 6px;
  }

  .selves-verdict-text {
    margin-top: 7px;
    font-size: 12px;
    line-height: 1.55;
  }

  .selves-verdict-label {
    font-size: 6px;
  }

  .selves-standby {
    font-size: 8px;
  }

  .selves-detector {
    top: 64%;
    left: 58%;
    width: 46%;
    height: 9%;
  }

  .selves-detector-content .selves-item {
    width: 52px;
    height: 52px;
  }

  .selves-hotbar-wrap {
    bottom: 12px;
    width: 96%;
  }

  .selves-hotbar {
    gap: 4px;
    padding: 5px;
  }

  .selves-slot {
    width: 34px;
    height: 34px;
  }

  .selves-item {
    padding: 4px;
  }

  .selves-item-code {
    font-size: 5.5px;
    padding: 0 2px;
  }

  .selves-shelf {
    bottom: 58px;
    gap: 4px;
    padding: 4px;
  }

  .selves-shelf .selves-item {
    width: 36px;
    height: 36px;
    padding: 3px;
  }

  .selves-toast {
    bottom: 64px;
    font-size: 10px;
    padding: 6px 10px;
  }

  .selves-final {
    top: 34%;
    width: 92%;
    aspect-ratio: 1.55 / 1;
    font-size: 21px;
    letter-spacing: 0.05em;
  }

  .selves-next {
    bottom: 14px;
    width: 66px;
    height: 32px;
  }

  .selves-next svg {
    width: 56px;
    height: 22px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
