:root {
  --paper: #fbfaf6;
  --ink: #11110f;
  --muted: #69665f;
  --quiet: #d9d4ca;
  --measure: 760px;
  --wide: 1120px;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--paper);
  color: var(--ink);
  font-family: "Times New Roman", Times, serif;
  font-size: 18px;
  line-height: 1.55;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover,
a:focus-visible {
  color: var(--muted);
}

a:focus-visible {
  outline: 1px solid var(--ink);
  outline-offset: 5px;
}

.book-shell {
  width: min(var(--wide), calc(100% - 48px));
  margin: 0 auto;
  padding: 56px 0 72px;
}

.contents-page {
  min-height: 100vh;
}

.contents-hero {
  max-width: 900px;
  padding: 72px 0 88px;
}

.kicker,
.part-label,
.contents-part h2,
.entry-section h2,
.sound-area h2,
.trace-section h2 {
  margin: 0;
  color: var(--muted);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.68rem;
  font-weight: 400;
  letter-spacing: 0.12em;
  line-height: 1.4;
  text-transform: uppercase;
}

.contents-hero h1,
.entry-header h1 {
  margin: 18px 0 0;
  max-width: 940px;
  font-size: clamp(3rem, 7vw, 7.2rem);
  font-weight: 400;
  letter-spacing: 0;
  line-height: 0.92;
}

.subtitle {
  max-width: 560px;
  margin: 34px 0 0;
  color: var(--muted);
  font-size: 1.22rem;
  line-height: 1.5;
}

.contents-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 56px;
  padding-top: 40px;
  border-top: 1px solid var(--quiet);
}

.contents-part ol {
  margin: 24px 0 0;
  padding: 0;
  list-style: none;
}

.contents-part li + li {
  margin-top: 15px;
}

.contents-part a {
  display: inline-block;
  font-size: 1.22rem;
  line-height: 1.25;
}

.explore-page {
  min-height: 100vh;
  overflow: hidden;
  background: var(--paper);
}

.explore-header {
  position: fixed;
  z-index: 4;
  top: 32px;
  left: 36px;
  max-width: 390px;
  pointer-events: none;
}

.explore-title,
.explore-header > p {
  pointer-events: auto;
}

.explore-title {
  display: inline-block;
  max-width: 360px;
  appearance: none;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.86rem;
  letter-spacing: 0.08em;
  line-height: 1.22;
  text-align: left;
  text-transform: uppercase;
}

.explore-title {
  display: block;
}

.explore-title:hover,
.explore-title:focus,
.explore-title:focus-visible {
  outline: 0;
  color: var(--muted);
}

.explore-menu-panel p {
  max-width: 330px;
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.explore-title-menu {
  position: fixed;
  inset: 0;
  display: grid;
  width: 100vw;
  max-height: none;
  margin: 0;
  padding: 0;
  border-top: 0;
  place-items: center;
  pointer-events: none;
  overflow: hidden;
}

.explore-title-menu[hidden] {
  display: none !important;
}

.explore-menu-panel {
  display: none;
  max-width: 390px;
  color: var(--ink);
  font-size: 0.9rem;
  line-height: 1.5;
}

.explore-menu-panel.is-active {
  display: block;
}

.explore-menu-panel p + p {
  margin-top: 0.7em;
}

.rules-backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  border: 0;
  background: rgba(249, 247, 242, 0.78);
  cursor: default;
  pointer-events: auto;
}

.rules-panel {
  position: relative;
  z-index: 1;
  display: block;
  width: min(640px, calc(100vw - 52px));
  max-width: none;
  max-height: min(78vh, 760px);
  padding: 44px 48px 52px;
  border: 1px solid rgba(42, 40, 36, 0.16);
  background: rgba(252, 250, 246, 0.96);
  box-shadow: 0 18px 70px rgba(42, 40, 36, 0.12);
  overflow: auto;
  overscroll-behavior: contain;
  pointer-events: auto;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.rules-close {
  position: absolute;
  z-index: 2;
  top: 22px;
  right: 26px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.rules-close:hover,
.rules-close:focus-visible {
  color: var(--ink);
  outline: 0;
}

.rules-section + .rules-section {
  margin-top: 24px;
}

.rules-section h2 {
  margin: 0 0 8px;
  color: var(--muted);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.68rem;
  font-weight: 400;
  letter-spacing: 0.12em;
  line-height: 1.4;
  text-transform: uppercase;
}

.rules-section:first-child h2 {
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.18rem;
  letter-spacing: 0.02em;
  text-transform: none;
}

.rules-panel p {
  max-width: 500px;
  font-size: 1rem;
  line-height: 1.58;
}

.rules-open .explore-stage,
.rules-open .contents-fallback,
.rules-open .homepage-about {
  opacity: 0.16;
  transition: opacity 220ms ease;
}

.homepage-about {
  position: fixed;
  z-index: 4;
  left: 36px;
  bottom: 26px;
  width: min(390px, calc(100vw - 72px));
  pointer-events: none;
}

.homepage-about details {
  pointer-events: auto;
}

.homepage-about summary {
  width: fit-content;
  cursor: pointer;
  color: var(--muted);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  line-height: 1.5;
  list-style: none;
  text-transform: uppercase;
}

.homepage-about summary::-webkit-details-marker {
  display: none;
}

.homepage-about summary:hover,
.homepage-about summary:focus-visible {
  color: var(--ink);
  outline: 0;
}

.homepage-about-panel {
  max-height: min(42vh, 380px);
  margin-top: 14px;
  overflow: auto;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
  scrollbar-width: thin;
}

.homepage-about-panel p {
  max-width: 340px;
  margin: 0;
}

.homepage-about-panel p + p {
  margin-top: 0.64em;
}

.explore-stage {
  position: fixed;
  inset: 0;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
}

.explore-stage.is-panning {
  cursor: grabbing;
}

.explore-field,
.explore-hands,
.explore-lines {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
  will-change: transform;
}

.explore-hands {
  z-index: 1;
  overflow: visible;
  pointer-events: none;
}

.explore-hand-connection {
  position: absolute;
  display: block;
  border: 0;
  background: transparent;
  width: auto;
  max-width: none;
  object-fit: contain;
  opacity: 0.86;
  pointer-events: none;
  transform-origin: 50% 100%;
  user-select: none;
}

.explore-lines {
  z-index: 0;
  overflow: visible;
  pointer-events: none;
}

.explore-lines line {
  stroke: rgba(17, 17, 15, 0.08);
  stroke-width: 1;
}

.explore-lines line.is-active {
  stroke: var(--active-line-color, rgba(86, 78, 70, 0.16));
}

.explore-field {
  z-index: 2;
}

.explore-node {
  position: absolute;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-family: "Helvetica Neue", Arial, Helvetica, sans-serif;
  font-weight: 300;
  line-height: 1;
  opacity: 0.64;
  transform:
    translate(-50%, -50%)
    translate(var(--focus-x), var(--focus-y))
    scale(var(--node-scale));
  white-space: nowrap;
}

.explore-node:focus-visible {
  outline: 1px solid rgba(17, 17, 15, 0.28);
  outline-offset: 4px;
}

.explore-node-entry {
  font-size: clamp(1.24rem, 2vw, 2rem);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.explore-node-word {
  color: rgba(17, 17, 15, 0.72);
  font-size: clamp(0.8rem, 0.95vw, 1rem);
  letter-spacing: 0.01em;
}

.explore-node.is-start,
.explore-node.is-selected {
  opacity: 1;
  transform:
    translate(-50%, -50%)
    translate(var(--focus-x), var(--focus-y))
    scale(calc(var(--node-scale) * 1.16));
}

.explore-node.is-related {
  opacity: 0.9;
}

.explore-node.is-muted {
  opacity: 0.12;
}

.explore-node.is-hidden-at-start {
  opacity: 0;
  pointer-events: none;
}

.contents-fallback {
  position: relative;
  z-index: 5;
  margin-top: 100vh;
  padding-top: 36px;
  pointer-events: auto;
}

.contents-fallback details {
  border-top: 1px solid var(--quiet);
}

.contents-fallback summary {
  padding: 22px 0;
  color: var(--muted);
  cursor: pointer;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  list-style: none;
  text-transform: uppercase;
}

.contents-fallback summary::-webkit-details-marker {
  display: none;
}

.entry-page {
  max-width: var(--measure);
}

.fiction-page {
  max-width: 720px;
  padding-top: 92px;
}

.page-nav {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 82px;
  color: var(--muted);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  line-height: 1.4;
  text-transform: uppercase;
}

.page-nav:last-child {
  margin: 92px 0 0;
}

.page-nav div {
  display: flex;
  gap: 28px;
  justify-content: flex-end;
}

.entry-header {
  margin-bottom: 64px;
}

.entry-header h1 {
  font-size: clamp(4.6rem, 16vw, 11rem);
  line-height: 0.86;
}

.image-area {
  width: 100%;
  min-height: 520px;
  margin: 0 0 76px;
}

.image-area img {
  display: block;
  width: 100%;
  height: auto;
}

.image-area figcaption {
  max-width: 620px;
  margin-top: 14px;
  color: var(--muted);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  line-height: 1.45;
}

.image-placeholder {
  display: grid;
  place-items: center;
  border: 1px solid var(--quiet);
  color: var(--muted);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.entry-section,
.sound-area,
.trace-section {
  margin-top: 66px;
}

.feature-section {
  padding-top: 66px;
  border-top: 1px solid var(--quiet);
}

.feature-section .image-area {
  margin: 28px 0 0;
}

.entry-section p,
.trace-section p {
  margin: 18px 0 0;
  font-size: 1.34rem;
  line-height: 1.56;
}

.fiction-entry {
  margin: 0 0 76px;
}

.fiction-introduction {
  margin: 0 0 48px;
  color: var(--muted);
  font-size: 1.24rem;
  line-height: 1.55;
}

.fiction-body {
  max-width: 680px;
}

.fiction-body p {
  margin: 0;
  font-size: 1.22rem;
  line-height: 1.92;
}

.fiction-body p + p {
  margin-top: 1.45em;
}

.description-section p {
  font-size: 1.58rem;
  line-height: 1.52;
}

.sound-area audio {
  width: 100%;
  margin-top: 22px;
}

.audio-placeholder {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 28px;
  min-height: 104px;
  margin-top: 22px;
  border-top: 1px solid var(--quiet);
  border-bottom: 1px solid var(--quiet);
  color: var(--muted);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.audio-line {
  height: 1px;
  background: var(--quiet);
}

.trace-section {
  padding-top: 56px;
  border-top: 1px solid var(--quiet);
}

.trace-section p {
  color: var(--muted);
  font-style: italic;
}

@media (max-width: 900px) {
  .contents-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .explore-header {
    max-width: 310px;
  }

}

@media (max-width: 640px) {
  html {
    font-size: 16px;
  }

  .book-shell {
    width: min(100% - 28px, var(--wide));
    padding-top: 28px;
  }

  .contents-hero {
    padding: 52px 0 64px;
  }

  .contents-list {
    grid-template-columns: 1fr;
    gap: 42px;
  }

  .explore-header {
    top: 22px;
    left: 18px;
    max-width: calc(100vw - 36px);
  }

  .explore-header > p {
    display: none;
  }

  .rules-panel {
    width: calc(100vw - 24px);
    max-height: calc(100dvh - 24px);
    padding: 20px 20px calc(40px + env(safe-area-inset-bottom));
    scroll-padding-top: 52px;
  }

  .rules-close {
    position: sticky;
    top: 0;
    display: block;
    width: fit-content;
    margin: 0 0 20px auto;
    padding: 4px 0 8px 12px;
    background: rgba(252, 250, 246, 0.96);
  }

  .rules-section + .rules-section {
    margin-top: 22px;
  }

  .rules-panel p {
    display: block;
    color: var(--muted);
    opacity: 1;
    font-size: 0.98rem;
    line-height: 1.55;
  }

  .explore-node-entry {
    font-size: 1.25rem;
  }

  .explore-node-word {
    font-size: 0.88rem;
  }

  .page-nav {
    display: block;
    margin-bottom: 56px;
  }

  .page-nav div {
    justify-content: flex-start;
    margin-top: 18px;
  }

  .image-area {
    min-height: 360px;
    margin-bottom: 56px;
  }
}
