/* Univers page — simplified views of the real Plumelin interface. */

.expanding-world-page {
  background: var(--paper-grid), linear-gradient(180deg, var(--paper-2), var(--paper));
}

.ew-hero {
  padding: calc(var(--nav-height) + 62px) 0 clamp(78px, 9vw, 118px);
  background:
    radial-gradient(circle at 8% 15%, rgba(var(--coral-rgb), 0.17), transparent 28%),
    var(--paper-grid), linear-gradient(145deg, var(--paper-2), var(--paper) 72%);
}

.ew-hero__layout {
  display: grid;
  grid-template-columns: minmax(480px, 0.9fr) minmax(500px, 1.1fr);
  gap: clamp(42px, 6vw, 86px);
  align-items: center;
}

.ew-hero__copy {
  display: grid;
  justify-items: start;
  gap: 20px;
}

.ew-hero__copy :is(.breadcrumb, h1, p) { margin: 0; }

.ew-hero__copy h1 {
  max-width: 14ch;
  font-size: clamp(3rem, 5.3vw, 64px);
  line-height: var(--title-line-height);
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.ew-hero__copy > p {
  max-width: 55ch;
  color: var(--body);
  font-size: clamp(1rem, 1.3vw, 1.16rem);
  line-height: 1.65;
}

.ew-hero-figure {
  min-height: 490px;
}

.ew-hero-figure__page {
  position: absolute;
  top: 52px;
  left: 20px;
  z-index: 2;
  width: min(61%, 350px);
  min-height: 386px;
  padding: 44px 58px 44px 38px;
  border: 1px solid rgba(var(--ink-rgb), 0.1);
  border-radius: 10px;
  background: var(--white);
  box-shadow: 0 22px 48px rgba(var(--ink-rgb), 0.12);
}

.ew-hero-figure__page h2 {
  margin: 11px 0 25px;
  font-size: clamp(1.65rem, 2.5vw, 2.25rem);
  white-space: nowrap;
}

.ew-hero-figure__page p {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(1.05rem, 1.6vw, 1.3rem);
  font-weight: var(--weight-display-regular);
  line-height: 1.62;
}

.ew-entity-ref {
  color: inherit;
  text-decoration: underline dashed;
  text-decoration-color: color-mix(in srgb, currentColor 50%, transparent);
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

.ew-hero-entities {
  position: absolute;
  top: 74px;
  right: 18px;
  z-index: 3;
  display: grid;
  width: min(224px, 43%);
  gap: 8px;
}

.ew-hero-entities .world-entity-card {
  min-height: 48px;
}

.ew-seed { padding-block: clamp(104px, 13vw, 174px); }
.ew-seed__layout { display: grid; gap: clamp(58px, 8vw, 100px); }

.ew-chapter-head {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(300px, 0.85fr);
  gap: clamp(42px, 9vw, 120px);
  align-items: start;
}

.ew-chapter-head :is(h2, p) { margin: 0; }
.ew-chapter-head h2 { max-width: 11ch; }

.ew-chapter-head p {
  max-width: 44ch;
  color: var(--body);
  font-size: 1.05rem;
  line-height: 1.58;
}

.ew-manuscript {
  position: relative;
  min-height: 520px;
  margin: 0 auto;
  width: min(100%, 1030px);
}

.ew-manuscript__page {
  width: min(78%, 790px);
  min-height: 520px;
  padding: clamp(56px, 7vw, 88px) clamp(52px, 7vw, 94px);
  border: 1px solid rgba(var(--ink-rgb), 0.1);
  border-radius: 6px;
  background: var(--white);
  box-shadow: 0 28px 60px rgba(var(--ink-rgb), 0.1);
  color: var(--ink);
}

.ew-manuscript__page h3 {
  margin: 18px 0 38px;
  font-size: clamp(2.2rem, 4vw, 3.3rem);
}

.ew-manuscript__page p:first-of-type {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(1.25rem, 2.2vw, 1.75rem);
  font-weight: var(--weight-display-regular);
  line-height: 1.62;
}

.ew-manuscript__page p:last-child {
  max-width: 48ch;
  margin: 30px 0 0;
  color: var(--ink);
  line-height: 1.5;
}

.ew-manuscript__entities {
  position: absolute;
  top: 152px;
  right: 0;
  display: grid;
  width: min(280px, 31%);
  gap: 12px;
}

.ew-views {
  --view-character: #e15759;
  --view-location: #4e79a7;
  --relation-family: #9a6700;
  --relation-enemy: #b42318;
  --relation-mentor: #6d3fc2;
  --relation-alliance: #2f7a66;
  --relation-arc: #6d3fc2;
  padding-block: clamp(104px, 13vw, 176px);
}

.ew-views__intro { max-width: 880px; margin-bottom: clamp(72px, 9vw, 118px); }
.ew-views__intro :is(h2, p) { margin: 0; }
.ew-views__intro h2 { max-width: 15ch; font-size: clamp(2.7rem, 5vw, 56px); }
.ew-views__intro p { max-width: 62ch; margin-top: 22px; color: var(--body); font-size: 1.02rem; line-height: 1.65; }

.ew-views__list { display: grid; gap: clamp(112px, 15vw, 204px); }

.ew-view-feature {
  display: grid;
  grid-template-columns: minmax(260px, 0.66fr) minmax(0, 1.34fr);
  gap: clamp(50px, 7vw, 112px);
  align-items: center;
}

.ew-view-feature--reverse { grid-template-columns: minmax(0, 1.34fr) minmax(260px, 0.66fr); }
.ew-view-feature--reverse .ew-view-feature__copy { grid-column: 2; }
.ew-view-feature--reverse .ew-view-figure { grid-column: 1; grid-row: 1; }

.ew-view-feature__copy { display: grid; justify-items: start; gap: 20px; }
.ew-view-feature__copy :is(h3, p) { margin: 0; }
.ew-view-feature__copy h3 { max-width: 18ch; font-family: var(--serif); font-size: clamp(2rem, 3.1vw, 2.625rem); font-weight: var(--weight-title); line-height: var(--title-line-height); letter-spacing: -0.025em; text-wrap: balance; }
.ew-view-feature__copy p { max-width: 52ch; color: var(--body); line-height: 1.68; text-wrap: pretty; }

.ew-view-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border: 1px solid rgba(var(--ink-rgb), 0.12);
  border-radius: 999px;
  color: var(--ink);
  background: rgba(var(--white-rgb), 0.7);
  font-size: 0.75rem;
  font-weight: var(--weight-action);
}

.ew-view-badge svg { width: 16px; height: 16px; fill: none; stroke: var(--coral-ink); stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }

.ew-view-figure {
  position: relative;
  min-height: 470px;
  overflow: hidden;
  margin: 0;
  border: 1px solid rgba(var(--ink-rgb), 0.1);
  border-radius: 14px;
  background: var(--paper-2);
  box-shadow: 0 8px 28px rgba(var(--ink-rgb), 0.13);
}

.ew-links-figure,
.ew-story-figure {
  background:
    radial-gradient(circle, rgba(var(--ink-rgb), 0.085) 1px, transparent 1.2px),
    var(--white);
  background-size: 22px 22px, auto;
}

.ew-figure-toolbar {
  position: absolute;
  z-index: 8;
  top: 16px;
  right: 16px;
  display: flex;
  gap: 5px;
}

.ew-figure-toolbar > span { display: inline-flex; min-height: 30px; align-items: center; justify-content: center; padding: 0 10px; border: 1px solid rgba(var(--ink-rgb), 0.1); border-radius: 999px; color: var(--muted); background: rgba(var(--white-rgb), 0.92); box-shadow: 0 2px 8px rgba(var(--ink-rgb), 0.06); font-size: 0.62rem; }

.ew-figure-toolbar > .ew-figure-select {
  gap: 7px;
  border-radius: 7px;
  color: var(--ink);
  background: var(--white);
  box-shadow: none;
}

.ew-figure-select svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.ew-figure-toolbar > .ew-figure-context { border: 0; background: transparent; box-shadow: none; }

.ew-relation-lines { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }

.ew-relation-link {
  --relation-color: rgba(var(--ink-rgb), 0.35);
  fill: none;
  stroke: var(--relation-color);
  stroke-linecap: round;
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
}

.ew-relation-link--family,
.ew-relation-label--family { --relation-color: var(--relation-family); }
.ew-relation-link--enemy,
.ew-relation-label--enemy { --relation-color: var(--relation-enemy); }
.ew-relation-link--mentor,
.ew-relation-label--mentor { --relation-color: var(--relation-mentor); }
.ew-relation-link--alliance,
.ew-relation-label--alliance { --relation-color: var(--relation-alliance); }
.ew-relation-link--arc,
.ew-relation-label--arc { --relation-color: var(--relation-arc); }

.ew-relation-link.is-scene-relation { stroke-dasharray: 6 5; }

.ew-relation-label {
  position: absolute;
  z-index: 4;
  padding: 5px 9px;
  border: 1px solid color-mix(in srgb, var(--relation-color) 25%, transparent);
  border-radius: 9px;
  color: var(--relation-color);
  background: var(--white);
  box-shadow: 0 2px 8px color-mix(in srgb, var(--relation-color) 12%, transparent);
  font-size: 0.62rem;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

.ew-relation-node {
  min-width: 0;
  min-height: 40px;
  gap: 8px;
  padding: 5px 11px 5px 6px;
  border-color: color-mix(in srgb, var(--entity-color) 30%, transparent);
  border-radius: 11px;
  background: color-mix(in srgb, var(--entity-color) 3%, var(--white));
}

.ew-relation-node .world-entity-icon { width: 28px; height: 28px; flex-basis: 28px; border-radius: 7px; }
.ew-relation-node b { font-size: 0.74rem; font-weight: 600; letter-spacing: 0.005em; }
.ew-relation-node--ysee { left: 16%; top: 57%; }
.ew-relation-node--tobias { left: 46%; top: 29%; }
.ew-relation-node--varek { left: 83%; top: 44%; }
.ew-relation-node--sibylle { left: 70%; top: 72%; }
.ew-relation-label--family { left: 29%; top: 41%; }
.ew-relation-label--enemy { left: 63%; top: 31%; }
.ew-relation-label--mentor { left: 57%; top: 57%; }
.ew-relation-label--alliance { left: 80%; top: 59%; }

.ew-story-figure { min-height: 540px; }
.ew-story-arc--mobile { display: none; }
.ew-story-figure__toolbar { left: 16px; right: auto; }
.ew-story-figure__toolbar .ew-figure-select--arc { border-color: color-mix(in srgb, var(--relation-arc) 36%, rgba(var(--ink-rgb), 0.1)); color: var(--relation-arc); background: color-mix(in srgb, var(--relation-arc) 8%, var(--white)); }

.ew-scene-node {
  position: absolute;
  z-index: 3;
  display: grid;
  width: min(154px, 23%);
  min-height: 70px;
  gap: 7px;
  padding: 11px 14px;
  border: 1px solid rgba(var(--ink-rgb), 0.12);
  border-radius: 16px;
  background: rgba(var(--white-rgb), 0.96);
  box-shadow: 0 2px 8px rgba(var(--ink-rgb), 0.08), inset 0 1px 0 rgba(var(--white-rgb), 0.8);
  transform: translate(-50%, -50%);
}

.ew-scene-node small { overflow: hidden; color: var(--muted); font-size: 0.56rem; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.ew-scene-node > span { display: flex; min-width: 0; align-items: center; gap: 7px; }
.ew-scene-node b { overflow: hidden; color: var(--ink); font-size: 0.7rem; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.ew-scene-node.is-in-arc { border-color: color-mix(in srgb, var(--relation-arc) 38%, rgba(var(--ink-rgb), 0.12)); background: linear-gradient(180deg, color-mix(in srgb, var(--relation-arc) 8%, transparent), transparent), var(--white); }
.ew-scene-node.is-muted { opacity: 0.32; filter: grayscale(0.65); }
.ew-scene-node--one { left: 13%; top: 33%; }
.ew-scene-node--two { left: 37%; top: 27%; }
.ew-scene-node--three { left: 62%; top: 32%; }
.ew-scene-node--four { left: 85%; top: 40%; }
.ew-scene-node--five { left: 68%; top: 72%; }
.ew-scene-node--six { left: 40%; top: 68%; }
.ew-scene-node--seven { left: 15%; top: 78%; }
.ew-story-figure .ew-relation-label--arc { left: 40%; top: 16%; }

.ew-timeline-figure__toolbar { left: 16px; right: 16px; justify-content: space-between; }
.ew-timeline-axis { position: absolute; inset: 58px 26px 20px; }
.ew-timeline-axis__line { position: absolute; top: 54%; left: 5%; right: 5%; border-top: 1px solid rgba(var(--ink-rgb), 0.32); }
.ew-timeline-tick { position: absolute; z-index: 2; top: calc(54% - 4px); width: 9px; height: 9px; border: 2px solid var(--paper-2); border-radius: 50%; background: var(--coral-ink); transform: translateX(-50%); }
.ew-timeline-tick--one { left: 12%; }
.ew-timeline-tick--two { left: 38%; }
.ew-timeline-tick--three { left: 65%; }
.ew-timeline-tick--four { left: 88%; }

.ew-event {
  position: absolute;
  z-index: 3;
  display: grid;
  width: min(170px, 27%);
  gap: 5px;
  padding: 11px 13px;
  border: 1px solid rgba(var(--ink-rgb), 0.1);
  border-radius: 9px;
  background: var(--white);
  box-shadow: 0 3px 10px rgba(var(--ink-rgb), 0.08);
  transform: translateX(-50%);
}

.ew-event::after { position: absolute; left: 50%; height: 43px; border-left: 1px dashed rgba(var(--ink-rgb), 0.32); content: ""; }
.ew-event b { color: var(--ink); font-size: 0.7rem; font-weight: 650; }
.ew-event small { color: var(--coral-ink); font-size: 0.56rem; font-weight: 600; }
.ew-event__scene { display: flex; min-width: 0; align-items: center; gap: 4px; color: var(--muted); font-size: 0.54rem; line-height: 1.3; }
.ew-event__scene svg { width: 11px; height: 11px; flex: 0 0 11px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.ew-event__scene.is-unlinked { font-style: italic; opacity: 0.75; }
.ew-event--one { bottom: 57%; left: 12%; }
.ew-event--one::after { top: 100%; }
.ew-event--two { top: 59%; left: 38%; }
.ew-event--two::after { bottom: 100%; }
.ew-event--three { bottom: 57%; left: 65%; }
.ew-event--three::after { top: 100%; }
.ew-event--four { top: 59%; left: 88%; }
.ew-event--four::after { bottom: 100%; }

.ew-map-figure { background: #dfe9e4; }
.ew-map-art { position: absolute; inset: 0; width: 100%; height: 100%; }
.map-land { fill: #eee4cf; stroke: #c7bda5; stroke-width: 2; }
.map-highland { fill: #d5d5b8; opacity: 0.72; }
.map-river { fill: none; stroke: #8bb5bb; stroke-linecap: round; stroke-width: 6; }
.map-road { fill: none; stroke: #a7977c; stroke-dasharray: 8 6; stroke-linecap: round; stroke-width: 2; }
.map-road--branch { stroke-width: 1.5; }
.map-contours path { fill: none; stroke: #a9a889; stroke-width: 1.2; }
.map-mountains path { fill: #a6aa91; stroke: #747b69; stroke-linejoin: round; stroke-width: 1.5; }
.map-city { fill: #77806d; stroke: #5f6859; stroke-linejoin: round; stroke-width: 1.5; }
.ew-map-label { position: absolute; z-index: 2; color: rgba(var(--ink-rgb), 0.52); font-family: var(--serif); font-size: 0.68rem; font-style: italic; letter-spacing: 0.04em; }
.ew-map-label--sea { left: 14px; top: 50%; color: #506c76; writing-mode: vertical-rl; transform: translateY(-50%) rotate(180deg); }
.ew-map-label--road { left: 38%; top: 57%; transform: rotate(-15deg); }

.ew-map-marker {
  --marker-color: var(--entity-color, var(--view-location));
  position: absolute;
  z-index: 4;
  width: 152px;
  height: 1px;
  margin: 0;
  padding: 0;
  border: 0;
  color: var(--ink);
  background: transparent;
  font: inherit;
  transform: translateX(-50%);
  cursor: pointer;
}

.ew-map-marker__label,
.ew-map-marker__count,
.ew-map-marker__entities span {
  border: 1px solid color-mix(in srgb, var(--marker-color) 22%, rgba(var(--ink-rgb), 0.1));
  background: rgba(var(--white-rgb), 0.97);
  box-shadow: 0 2px 8px rgba(var(--ink-rgb), 0.1);
}

.ew-map-marker__label {
  position: absolute;
  bottom: 48px;
  left: 50%;
  max-width: 148px;
  overflow: hidden;
  padding: 5px 9px;
  border-radius: 7px;
  font-size: 0.65rem;
  font-weight: 600;
  line-height: 1.15;
  text-overflow: ellipsis;
  transform: translateX(-50%);
  white-space: nowrap;
}

.ew-map-marker__pin {
  position: absolute;
  bottom: 0;
  left: 50%;
  display: grid;
  width: 36px;
  height: 42px;
  place-items: center;
  color: var(--marker-color);
  filter: drop-shadow(0 2px 3px rgba(var(--ink-rgb), 0.18));
  transform: translateX(-50%);
}

.ew-map-marker__pin-shape {
  position: absolute;
  inset: 0;
  width: 36px;
  height: 42px;
  overflow: visible;
}

.ew-map-marker__pin-shape path {
  fill: color-mix(in srgb, var(--marker-color) 11%, var(--white));
  stroke: var(--marker-color);
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
}

.ew-map-marker__pin-icon {
  position: absolute;
  top: 10px;
  left: 50%;
  z-index: 1;
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  color: var(--marker-color);
  transform: translateX(-50%);
}

.ew-map-marker__pin-icon svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.ew-map-marker__presence {
  position: absolute;
  top: 7px;
  left: 50%;
  display: flex;
  width: max-content;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  transform: translateX(-50%);
}

.ew-map-marker__count,
.ew-map-marker__entities span {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.58rem;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

.ew-map-marker__count { color: var(--muted); }
.ew-map-marker__count svg,
.ew-map-marker__entities svg { width: 12px; height: 12px; fill: none; stroke: var(--view-character); stroke-width: 1.8; }

.ew-map-marker__entities {
  display: flex;
  max-height: 0;
  flex-direction: column;
  gap: 4px;
  opacity: 0;
  transform: translateY(-4px);
  transition: max-height 180ms ease, opacity 160ms ease, transform 180ms ease;
}

.ew-map-marker:is(:hover, :focus-visible, .is-expanded) .ew-map-marker__entities {
  max-height: 80px;
  opacity: 1;
  transform: translateY(0);
}

.ew-map-marker:is(:hover, :focus-visible, .is-expanded) .ew-map-marker__pin { filter: drop-shadow(0 2px 5px color-mix(in srgb, var(--marker-color) 42%, transparent)); }
.ew-map-marker:focus-visible { outline: none; }
.ew-map-marker:focus-visible .ew-map-marker__label { outline: 2px solid var(--marker-color); outline-offset: 2px; }

.ew-map-marker--port { left: 17.1%; top: 79.5%; }
.ew-map-marker--pass { left: 46.05%; top: 50%; }
.ew-map-marker--roumat { left: 81.6%; top: 31.8%; }

.ew-depth { padding-block: clamp(104px, 12vw, 160px); }

.ew-depth__layout {
  display: grid;
  gap: clamp(56px, 8vw, 96px);
}

.ew-depth__head {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(320px, 0.92fr);
  gap: clamp(38px, 8vw, 112px);
  align-items: end;
}

.ew-depth__head :is(h2, p) { margin: 0; text-wrap: balance; }
.ew-depth__head h2 { max-width: 17ch; }
.ew-depth__head p { max-width: 50ch; color: var(--body); line-height: 1.62; }

.world-model-bento {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 14px;
}

.world-model-card {
  --world-model-content-gap: 44px;

  display: grid;
  min-width: 0;
  align-content: start;
  gap: var(--world-model-content-gap);
  overflow: hidden;
  margin: 0;
  padding: clamp(22px, 3vw, 34px);
  border: 1px solid rgba(var(--ink-rgb), 0.11);
  border-radius: 14px;
  background: var(--white);
}

.world-model-card figcaption { display: grid; align-content: start; gap: 16px; }
.world-model-card figcaption :is(h3, p) { margin: 0; text-wrap: balance; }
.world-model-card figcaption h3 { font-size: clamp(1.28rem, 2vw, 1.72rem); }
.world-model-card figcaption p { max-width: 49ch; color: var(--body); font-size: 0.88rem; line-height: 1.5; }

.world-model-card--sheet { grid-column: span 5; min-height: 640px; }
.world-model-card--template { grid-column: span 7; min-height: 640px; }
.world-model-card--relations {
  grid-column: 1 / -1;
  grid-template-columns: 1fr;
  min-height: 0;
  align-items: stretch;
  background: rgba(var(--coral-rgb), 0.08);
}

.world-model-card--relations figcaption h3 { max-width: 700px; }
.world-model-card--relations figcaption p { max-width: 80ch; }

@media (min-width: 701px) {
  .world-model-card--sheet,
  .world-model-card--template {
    grid-template-rows: auto minmax(0, 1fr);
    min-height: 0;
  }

  .world-model-card--sheet > .model-sheet,
  .world-model-card--template > .model-template { align-self: stretch; }
  .world-model-card--template > .model-template { grid-template-rows: auto minmax(0, 1fr) auto; }
}

.model-sheet,
.model-template {
  align-self: end;
  overflow: hidden;
  border-radius: 11px;
  background: var(--white);
  box-shadow:
    0 22px 56px rgba(var(--ink-rgb), 0.07),
    0 4px 12px rgba(var(--ink-rgb), 0.045);
}

.model-sheet {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.model-sheet__group {
  overflow: hidden;
  border: 1px solid rgba(var(--ink-rgb), 0.08);
  border-radius: 8px;
  background: var(--white);
}

.model-sheet__group > header {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 12px 13px;
  background: var(--paper-2);
}

.model-sheet__group > header > svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: var(--muted);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.model-sheet__group > header strong { font-size: 0.68rem; }
.model-sheet__group > header small { margin-left: auto; color: var(--muted); font-size: 0.56rem; }
.model-sheet__group > header .model-lucide-chevron { margin-left: auto; }
.model-sheet__group > header small + .model-lucide-chevron { margin-left: 0; }
.model-sheet__group.is-open > header { border-bottom: 1px solid rgba(var(--ink-rgb), 0.08); }
.model-sheet__fields { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 13px 13px 0; }
.model-sheet__group label { display: grid; gap: 5px; color: var(--muted); font-size: 0.58rem; }
.model-sheet__group label span { min-height: 38px; padding: 11px; border-radius: 6px; color: var(--ink); background: var(--paper-2); font-size: 0.68rem; }
.model-sheet__description { padding: 12px 13px 14px; }
.model-sheet__description span { line-height: 1.45; }

.model-template { display: grid; align-self: end; }
.model-template svg,
.model-relationship-modes svg { fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }

.model-template__kinds {
  display: flex;
  gap: 5px;
  overflow: hidden;
  padding: 12px;
  border-bottom: 1px solid rgba(var(--ink-rgb), 0.08);
}

.model-template__kinds span {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 5px;
  padding: 6px 7px;
  border-radius: 6px;
  color: var(--muted);
  background: var(--paper-2);
  font-size: 0.55rem;
}

.model-template__kinds span.is-selected { color: var(--coral-ink); background: rgba(var(--coral-rgb), 0.15); font-weight: var(--weight-action); }
.model-template__kinds svg { width: 12px; height: 12px; }

.model-template__workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(150px, 0.75fr);
  gap: 10px;
  padding: 12px;
}

.model-template__editor { border: 1px solid rgba(var(--ink-rgb), 0.09); border-radius: 8px; }
.model-template__section-title,
.model-template__field { display: flex; align-items: center; padding: 10px; }
.model-template__section-title { border-bottom: 1px solid rgba(var(--ink-rgb), 0.08); background: var(--paper-2); }
.model-template__section-title b { font-size: 0.66rem; }
.model-template__section-title > span { display: grid; width: 24px; height: 24px; margin-left: auto; place-items: center; color: var(--muted); }
.model-template__section-title > span svg { width: 13px; height: 13px; }
.model-template__field + .model-template__field { border-top: 1px solid rgba(var(--ink-rgb), 0.07); }
.model-template__field span { display: grid; gap: 0; }
.model-template__field b { font-size: 0.64rem; line-height: 1.2; }
.model-template__field small { color: var(--muted); font-size: 0.55rem; line-height: 1.2; }
.model-template__add { display: flex; align-items: center; gap: 6px; margin: 4px 10px 10px; padding: 7px 9px; border-radius: 5px; color: var(--coral-ink); background: rgba(var(--coral-rgb), 0.1); font: var(--weight-action) 0.59rem/1 var(--sans); }
.model-template__add svg { width: 12px; height: 12px; }

.model-field-types {
  padding: 11px;
  border-radius: 8px;
  background: var(--paper-2);
}

.model-field-types > strong { font-size: 0.62rem; }
.model-field-types > div { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 10px; }
.model-field-types span { display: grid; min-height: 64px; align-content: center; justify-items: center; gap: 6px; padding: 8px 5px; border-radius: 6px; color: var(--muted); background: var(--white); text-align: center; }
.model-field-types svg { width: 15px; height: 15px; }
.model-field-types b { font-size: 0.54rem; font-weight: var(--weight-regular); }

.model-template footer { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-top: 1px solid rgba(var(--ink-rgb), 0.08); font-size: 0.58rem; }
.model-template footer span { display: flex; align-items: center; gap: 5px; color: var(--muted); }
.model-template footer span svg { width: 12px; height: 12px; }
.model-template footer b { margin-left: auto; padding: 7px 10px; border-radius: 5px; color: var(--white); background: var(--coral-ink); }

.model-relationship-modes {
  display: grid;
  grid-template-columns: minmax(300px, 0.75fr) minmax(540px, 1.25fr);
  gap: 12px;
  min-width: 0;
}

.model-general-relation,
.model-relation-history {
  padding: 15px;
  border-radius: 10px;
  background: var(--white);
  box-shadow:
    0 20px 50px rgba(var(--ink-rgb), 0.055),
    0 3px 10px rgba(var(--ink-rgb), 0.04);
}

.model-general-relation > header,
.model-relation-history > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.model-general-relation > header span,
.model-relation-history > header span { display: flex; align-items: center; gap: 7px; font-size: 0.65rem; font-weight: var(--weight-action); }
.model-general-relation > header svg,
.model-relation-history > header svg { width: 14px; height: 14px; color: var(--coral-ink); }
.model-general-relation > header b,
.model-relation-history > header b { color: var(--muted); font-size: 0.56rem; font-weight: var(--weight-regular); }

.model-general-relation > div {
  display: grid;
  grid-template-columns: minmax(80px, 1fr) minmax(100px, 1.4fr) minmax(80px, 1fr);
  max-width: 430px;
  align-items: center;
  margin: 16px auto 0;
}

.model-general-relation article { display: grid; justify-items: center; gap: 5px; font-size: 0.62rem; }
.model-general-relation i { position: relative; border-top: 1px solid rgba(var(--ink-rgb), 0.2); font-style: normal; }
.model-general-relation i span { position: absolute; top: 50%; left: 50%; padding: 4px 7px; border-radius: 4px; color: var(--muted); background: var(--paper-2); font-size: 0.54rem; transform: translate(-50%, -50%); }

.model-relation-timeline {
  display: grid;
  grid-template-columns: minmax(112px, 1fr) minmax(28px, 0.35fr) minmax(112px, 1fr) minmax(28px, 0.35fr) minmax(112px, 1fr);
  align-items: center;
  margin-top: 15px;
}

.model-relation-timeline article {
  display: grid;
  min-height: 82px;
  align-content: center;
  gap: 3px;
  padding: 12px;
  border-radius: 8px;
  background: var(--paper-2);
}

.model-relation-timeline article:nth-of-type(2) { background: rgba(var(--coral-rgb), 0.13); }
.model-relation-timeline article:nth-of-type(3) { color: var(--paper-2); background: var(--ink); }
.model-relation-timeline small { color: var(--muted); font-size: 0.53rem; }
.model-relation-timeline strong { font-family: var(--serif); font-size: 0.92rem; }
.model-relation-timeline article > span { color: var(--muted); font-size: 0.52rem; }
.model-relation-timeline article:nth-of-type(3) :is(small, span) { color: rgba(var(--paper-2-rgb), 0.7); }
.model-relation-timeline > i { border-top: 1px solid rgba(var(--ink-rgb), 0.22); }

.ew-return { padding-block: clamp(110px, 13vw, 175px); }
.ew-return__layout { display: grid; grid-template-columns: minmax(570px, 1.2fr) minmax(300px, 0.8fr); gap: clamp(52px, 8vw, 110px); align-items: center; }
.ew-return__copy :is(h2, p) { margin: 0; }
.ew-return__copy h2 { max-width: 10ch; }
.ew-return__copy > p { max-width: 44ch; margin-top: 22px; color: var(--body); line-height: 1.62; }
.ew-return__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 24px; margin-top: 30px; }

.writing-context-demo { position: relative; min-height: 530px; }
.writing-context-page { width: 100%; min-height: 500px; padding: clamp(48px, 7vw, 74px); border: 1px solid rgba(var(--ink-rgb), 0.1); border-radius: 10px; background: var(--white); box-shadow: 0 26px 60px rgba(var(--ink-rgb), 0.12); }
.writing-context-page h3 { margin: 12px 0 34px; font-size: clamp(2rem, 4vw, 3rem); }
.writing-context-page p { max-width: 540px; margin: 0 0 18px; font-family: var(--serif); font-size: clamp(1.05rem, 1.7vw, 1.3rem); font-weight: var(--weight-display-regular); line-height: 1.62; }
.writing-context-entity { position: relative; display: inline-block; }
.writing-context-tooltip { position: absolute; z-index: 2; top: calc(100% + 14px); left: 50%; display: grid; width: min(278px, calc(100vw - 88px)); gap: 10px; padding: 16px; border: 1px solid rgba(var(--coral-rgb), 0.28); border-radius: 8px; color: var(--ink); background: var(--white); box-shadow: var(--shadow-card-soft); font-family: var(--sans); font-size: 0.72rem; font-weight: var(--weight-regular); line-height: 1.35; transform: translateX(-28%); }
.writing-context-tooltip::before { position: absolute; top: -6px; left: calc(28% - 5px); width: 10px; height: 10px; border-top: 1px solid rgba(var(--coral-rgb), 0.28); border-left: 1px solid rgba(var(--coral-rgb), 0.28); background: var(--white); content: ""; transform: rotate(45deg); }
.writing-context-tooltip__header { display: flex; align-items: center; gap: 10px; }
.writing-context-tooltip__header > strong { font-size: 0.875rem; font-weight: var(--weight-action); }
.writing-context-tooltip__type { display: inline-flex; align-items: center; gap: 5px; padding: 2px 7px 2px 4px; border-radius: 3px; color: var(--entity-color); background: color-mix(in srgb, var(--entity-color) 15%, var(--paper-2)); font-size: 0.5rem; text-transform: uppercase; }
.writing-context-tooltip__type .world-entity-icon { width: 18px; height: 18px; flex-basis: 18px; border-radius: 3px; background: transparent; }
.writing-context-tooltip__type .world-entity-icon svg { width: 12px; height: 12px; }
.writing-context-tooltip__fields { display: flex; flex-wrap: wrap; gap: 4px; }
.writing-context-tooltip__fields > span { padding: 4px 6px; border-radius: 3px; background: rgba(var(--coral-rgb), 0.14); }
.writing-context-tooltip__description { max-width: 34ch; }

@media (max-width: 1100px) {
  .ew-hero__layout,
  .ew-depth__layout,
  .ew-return__layout { grid-template-columns: 1fr; }

  .ew-hero__copy { max-width: 700px; }
  .ew-hero-figure { width: min(100%, 720px); margin-inline: auto; }
  .ew-views__intro h2,
  .ew-depth__head h2,
  .ew-return__copy h2 { max-width: 15ch; }
  .ew-depth__head { grid-template-columns: 1fr; gap: 24px; }
  .ew-depth__head p { max-width: 60ch; }
  .model-relationship-modes { grid-template-columns: 1fr; }
  .writing-context-demo { width: min(100%, 760px); margin-inline: auto; }
  .ew-return__copy { grid-row: 1; }
}

@media (max-width: 920px) {
  .ew-view-feature,
  .ew-view-feature--reverse { grid-template-columns: 1fr; gap: 42px; }
  .ew-view-feature--reverse .ew-view-feature__copy,
  .ew-view-feature--reverse .ew-view-figure { grid-column: 1; grid-row: auto; }
  .ew-view-feature--reverse .ew-view-feature__copy { grid-row: 1; }
  .ew-view-feature__copy { max-width: 680px; }
  .ew-view-figure { width: min(100%, 780px); margin-inline: auto; }
}

@media (max-width: 700px) {
  .ew-hero { padding-top: calc(var(--nav-height) + 40px); }
  .ew-hero__layout { grid-template-columns: minmax(0, 1fr); }
  .ew-hero__copy h1 { font-size: clamp(2.7rem, 14vw, 4rem); }
  .ew-hero-figure { min-height: 440px; }
  .ew-hero-figure__page { top: 28px; left: 0; width: 71%; min-height: 370px; padding: 34px 72px 34px 25px; }
  .ew-hero-entities { top: 70px; right: 0; width: min(210px, 46%); }
  .ew-chapter-head { grid-template-columns: 1fr; gap: 24px; }
  .ew-chapter-head h2 { max-width: 12ch; }
  .ew-manuscript { min-height: 600px; }
  .ew-manuscript__page { width: 100%; min-height: 490px; padding: 45px 28px 130px; }
  .ew-manuscript__entities { top: auto; bottom: 0; left: 4px; right: 4px; width: auto; grid-template-columns: repeat(3, 1fr); gap: 4px; }
  .ew-manuscript__entities .world-entity-card { padding-inline: 8px; }
  .ew-views { padding-block: 94px; }
  .ew-views__list { gap: 104px; }
  .ew-view-feature__copy h3 { font-size: 2rem; }
  .ew-view-figure { min-height: 430px; border-radius: 10px; }
  .ew-story-figure { min-height: 540px; }
  .ew-scene-node { padding-inline: 10px; }
  .world-model-bento { grid-template-columns: 1fr; }
  .world-model-card { --world-model-content-gap: 26px; grid-column: 1; min-height: 0; padding: 22px; }
  .world-model-card--sheet,
  .world-model-card--template { min-height: 540px; }
  .world-model-card--relations { min-height: 0; }
  .model-template__kinds { flex-wrap: wrap; }
  .model-template__workspace { grid-template-columns: 1fr; }
  .model-field-types > div { grid-template-columns: repeat(4, 1fr); }
  .model-relation-timeline { grid-template-columns: 1fr; }
  .model-relation-timeline > i { width: 0; height: 22px; justify-self: center; border-top: 0; border-left: 1px solid rgba(var(--ink-rgb), 0.22); }
  .writing-context-demo { min-height: 580px; }
  .writing-context-page { min-height: 540px; padding: 45px 24px; }
  .writing-context-tooltip { transform: translateX(-22%); }
  .writing-context-tooltip::before { left: calc(22% - 5px); }
}

@media (max-width: 430px) {
  .ew-hero-figure__page h2 { font-size: 1.5rem; }
  .ew-hero-figure__page p { font-size: 0.98rem; }
  .ew-hero-entities { top: 62px; width: min(196px, 48%); gap: 8px; }
  .ew-hero-entities .world-entity-card { min-height: 48px; }
  .ew-manuscript__entities small { display: none; }
  .ew-view-figure { min-height: 390px; }
  .ew-figure-toolbar > span { min-height: 26px; padding-inline: 8px; font-size: 0.55rem; }
  .ew-links-figure { min-height: 470px; }
  .ew-relation-node { min-height: 36px; padding: 4px 9px 4px 5px; }
  .ew-relation-node .world-entity-icon { width: 26px; height: 26px; flex-basis: 26px; }
  .ew-relation-node b { font-size: 0.68rem; }
  .ew-relation-node--ysee { left: 18%; }
  .ew-relation-node--varek { left: 80%; }
  .ew-relation-node--sibylle { left: 68%; }
  .ew-relation-label { padding: 4px 7px; font-size: 0.54rem; }
  .ew-relation-label--enemy { left: 60%; }
  .ew-relation-label--mentor { left: 55%; }
  .ew-relation-label--alliance { left: 78%; top: 60%; }
  .ew-story-figure { min-height: 720px; }
  .ew-story-arc--desktop { display: none; }
  .ew-story-arc--mobile { display: initial; }
  .ew-scene-node { width: 46%; }
  .ew-scene-node--one { left: 26%; top: 22%; }
  .ew-scene-node--two { left: 74%; top: 22%; }
  .ew-scene-node--three { left: 26%; top: 40%; }
  .ew-scene-node--four { left: 74%; top: 40%; }
  .ew-scene-node--five { left: 26%; top: 58%; }
  .ew-scene-node--six { left: 74%; top: 58%; }
  .ew-scene-node--seven { left: 50%; top: 78%; }
  .ew-story-figure .ew-relation-label--arc { left: 29%; top: 12%; }
  .ew-timeline-axis { inset-inline: 12px; }
  .ew-event { width: 118px; padding: 9px; }
  .ew-event b { font-size: 0.62rem; }
  .ew-event--one,
  .ew-timeline-tick--one { left: 15%; }
  .ew-event--two,
  .ew-timeline-tick--two { left: 38%; }
  .ew-event--three,
  .ew-timeline-tick--three { left: 64%; }
  .ew-event--four,
  .ew-timeline-tick--four { left: 86%; }
  .ew-map-marker { width: 126px; }
  .ew-map-marker__label { max-width: 122px; padding: 4px 7px; font-size: 0.56rem; }
  .ew-map-marker__presence { top: 5px; }
  .ew-map-marker__count,
  .ew-map-marker__entities span { min-height: 22px; padding: 4px 7px; font-size: 0.52rem; }
  .model-sheet__fields { grid-template-columns: 1fr 1fr; }
  .model-sheet__fields label:first-child { grid-column: 1 / -1; }
  .model-field-types > div { grid-template-columns: 1fr 1fr; }
  .model-general-relation > header,
  .model-relation-history > header { align-items: flex-start; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  .expanding-world-page * { scroll-behavior: auto; }
  .ew-map-marker__entities { transition: none; }
}
