:root {
  --bg-start: #f7efe3;
  --bg-end: #edf5e9;
  --panel: #fffaf2;
  --panel-strong: #fff5e6;
  --ink: #1f2f34;
  --muted: #52676f;
  --line: #dbcdbb;
  --accent: #cb5c1c;
  --accent-strong: #983f14;
  --core-link: #cc6a2e;
  --team-link: #2f6ba8;
  --support-link: #2c8a62;
  --shadow: 0 20px 45px rgba(31, 47, 52, 0.14);
}

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

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Zen Kaku Gothic New", sans-serif;
  background: linear-gradient(155deg, var(--bg-start), var(--bg-end));
}

.backdrop-blob {
  position: fixed;
  z-index: -1;
  border-radius: 999px;
  filter: blur(12px);
  opacity: 0.7;
  animation: drift 16s ease-in-out infinite;
}

.backdrop-blob-a {
  width: 420px;
  height: 420px;
  top: -180px;
  right: -100px;
  background: radial-gradient(circle at 30% 30%, #ffe7c7, #f8ba87);
}

.backdrop-blob-b {
  width: 300px;
  height: 300px;
  left: -120px;
  bottom: -120px;
  animation-duration: 20s;
  background: radial-gradient(circle at 30% 30%, #d0edd8, #9ad4c1);
}

.hero {
  max-width: 1000px;
  margin: 0 auto;
  padding: 56px 20px 24px;
}

.hero-kicker {
  margin: 0 0 8px;
  color: var(--accent-strong);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.85rem;
}

.hero h1 {
  margin: 0;
  font-family: "Kaisei Decol", serif;
  font-size: clamp(2rem, 4.8vw, 3.4rem);
  line-height: 1.15;
}

.hero-description {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 2.2vw, 1.16rem);
}

.hero-meta {
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 0.9rem;
  color: var(--muted);
}

.layout {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 20px 56px;
}

.section-head h2 {
  margin: 0;
  font-family: "Kaisei Decol", serif;
  font-size: clamp(1.35rem, 2.6vw, 2rem);
  line-height: 1.2;
}

.section-description {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.96rem;
  line-height: 1.5;
}

.story-meta {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--muted);
  font-size: 0.84rem;
}

.story-section {
  margin-top: 8px;
}

.story-grid {
  margin-top: 16px;
  display: grid;
  gap: 16px;
  align-items: start;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
}

.story-panel {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 14px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.panel-head h3 {
  margin: 0;
  font-family: "Kaisei Decol", serif;
  font-size: 1.13rem;
}

.ghost-button {
  padding: 8px 12px;
  background: transparent;
  font-size: 0.82rem;
}

.relationship-map {
  position: relative;
  min-height: 560px;
  border-radius: 16px;
  border: 1px dashed #d7c8b6;
  background:
    radial-gradient(circle at 18% 20%, #fff5e6, #fff9f1 45%, rgba(212, 239, 224, 0.84)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(248, 251, 245, 0.95));
  overflow: hidden;
}

.relationship-lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.relation-line {
  stroke-width: 2.5;
  opacity: 0.82;
  stroke-linecap: round;
}

.relation-core {
  stroke: var(--core-link);
}

.relation-team {
  stroke: var(--team-link);
}

.relation-support {
  stroke: var(--support-link);
  stroke-dasharray: 6 6;
}

.relation-line.is-active {
  opacity: 1;
  stroke-width: 3.2;
}

.relation-line.is-muted {
  opacity: 0.15;
}

.member-node {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 118px;
  border: 1px solid #d8c4ad;
  border-radius: 14px;
  padding: 7px 8px 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 10px 20px rgba(31, 47, 52, 0.12);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease, border-color 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
}

.member-node:hover {
  transform: translate(-50%, -52%);
  box-shadow: 0 12px 26px rgba(31, 47, 52, 0.18);
}

.member-node.is-focus {
  border-color: var(--accent);
  box-shadow: 0 14px 30px rgba(203, 92, 28, 0.28);
}

.member-node.is-connected:not(.is-focus) {
  border-color: #93aecf;
}

.member-node.is-dim {
  opacity: 0.35;
}

.member-node img {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #f0d6bb;
  background: #f7e7d3;
}

.member-node-name {
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.25;
}

.member-node-meta {
  font-size: 0.64rem;
  line-height: 1.25;
  color: var(--muted);
}

.map-empty {
  position: absolute;
  inset: 0;
  margin: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 0.92rem;
  text-align: center;
  padding: 18px;
}

.relation-legend {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.legend-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
}

.legend-chip::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: currentColor;
}

.legend-core {
  color: var(--core-link);
  background: #fbe9dc;
}

.legend-team {
  color: var(--team-link);
  background: #e3edf8;
}

.legend-support {
  color: var(--support-link);
  background: #e1f2e9;
}

.panel-note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.story-timeline {
  margin-top: 4px;
  display: grid;
  gap: 12px;
  max-height: 660px;
  overflow: auto;
  padding-right: 4px;
}

.timeline-card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fffdf8;
  padding: 12px 14px 12px 18px;
  box-shadow: 0 10px 24px rgba(31, 47, 52, 0.08);
  opacity: 0;
  transform: translateY(12px);
  animation: rise 0.4s ease-out forwards;
  animation-delay: var(--delay, 0ms);
}

.timeline-card::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 14px;
  bottom: 14px;
  width: 3px;
  border-radius: 999px;
  background: #f0d5b6;
}

.timeline-card[data-status="planned"] {
  border-color: #bdd8c0;
  background: #f5fff5;
}

.timeline-card[data-status="planned"]::before {
  background: #7fbb88;
}

.timeline-era {
  margin: 0;
  color: var(--accent-strong);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.timeline-date {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.timeline-title {
  margin: 7px 0 0;
  font-size: 1.03rem;
  line-height: 1.4;
}

.timeline-description {
  margin: 8px 0 0;
  line-height: 1.62;
  color: var(--ink);
}

.timeline-members {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.timeline-member {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px 5px 7px;
  border: 1px solid #e4d4bf;
  border-radius: 999px;
  background: #fff5e7;
  font-size: 0.75rem;
}

.timeline-member img {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid #e8ccb1;
  background: #f7e7d3;
}

.timeline-member.is-focus {
  border-color: var(--accent);
  background: #ffeedc;
}

.timeline-member:hover {
  background: #fff0df;
}

.feed-head {
  margin-top: 28px;
}

.control-panel {
  display: flex;
  gap: 16px;
  align-items: end;
  flex-wrap: wrap;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.control-group span,
.control-group legend {
  color: var(--muted);
  font-size: 0.82rem;
}

select,
button {
  border-radius: 12px;
  border: 1px solid var(--line);
  background: white;
  font-size: 0.95rem;
  color: var(--ink);
}

select {
  min-width: 220px;
  padding: 10px 12px;
}

button {
  padding: 10px 16px;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

button:hover {
  background: var(--panel-strong);
  transform: translateY(-1px);
}

.radio-group {
  margin: 0;
  border: 0;
  padding: 0;
  display: flex;
  gap: 12px;
}

.radio-group label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.9rem;
}

.feed {
  margin-top: 22px;
  display: grid;
  gap: 16px;
}

.post-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 18px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  animation: rise 0.45s ease-out forwards;
  animation-delay: var(--delay, 0ms);
}

.post-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
}

.avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid #f0d6bb;
  object-fit: cover;
  background: #f7e7d3;
}

.author-meta {
  min-width: 0;
}

.author-name {
  margin: 0;
  font-weight: 700;
  line-height: 1.2;
}

.author-handle {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.post-link {
  color: var(--accent-strong);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 700;
}

.post-link:hover {
  text-decoration: underline;
}

.post-text {
  margin: 14px 0 0;
  line-height: 1.72;
  white-space: pre-wrap;
}

.media-list {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.media-list a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  color: #1f583e;
  text-decoration: none;
  background: #dff1e6;
}

.media-list a:hover {
  text-decoration: underline;
}

.post-footer {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  color: var(--muted);
  font-size: 0.84rem;
}

.metrics {
  display: flex;
  gap: 10px;
}

.metrics span {
  padding: 4px 8px;
  border-radius: 999px;
  background: #f8eddd;
}

.empty-message {
  margin-top: 20px;
  color: var(--muted);
}

@keyframes rise {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes drift {
  0%,
  100% {
    transform: translateY(0) translateX(0);
  }
  50% {
    transform: translateY(-10px) translateX(10px);
  }
}

@media (max-width: 980px) {
  .story-grid {
    grid-template-columns: 1fr;
  }

  .relationship-map {
    min-height: 510px;
  }
}

@media (max-width: 720px) {
  .hero {
    padding-top: 42px;
  }

  .story-meta {
    flex-direction: column;
    gap: 6px;
  }

  .panel-head {
    flex-direction: column;
    align-items: stretch;
  }

  .ghost-button {
    width: 100%;
  }

  .relationship-map {
    min-height: 470px;
  }

  .member-node {
    width: 96px;
    padding: 6px 6px 7px;
  }

  .member-node img {
    width: 42px;
    height: 42px;
  }

  .member-node-name {
    font-size: 0.69rem;
  }

  .member-node-meta {
    display: none;
  }

  .story-timeline {
    max-height: none;
  }

  .control-panel {
    align-items: stretch;
  }

  select {
    min-width: 0;
    width: 100%;
  }

  .post-header {
    grid-template-columns: auto 1fr;
  }

  .post-link {
    grid-column: 1 / -1;
    justify-self: start;
  }
}
