html,
body {
  height: 100%;
  overflow: hidden;
  background: #fff;
}

.viewport {
  position: fixed;
  top: var(--header);
  right: 0;
  bottom: 0;
  left: 0;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
  background: #fff;
}

.viewport.is-down {
  cursor: grabbing;
}

.world {
  position: absolute;
  top: 0;
  left: 0;
  width: 6400px;
  height: 4200px;
  transform-origin: 0 0;
}

.threads {
  position: absolute;
  inset: 0;
  width: 6400px;
  height: 4200px;
  overflow: visible;
  pointer-events: none;
}

.thread {
  fill: none;
  stroke: rgba(26, 26, 26, 0.22);
  stroke-width: 1px;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

.thread.is-live {
  stroke: rgba(154, 118, 64, 0.85);
}

.thread.is-near {
  stroke: rgba(154, 118, 64, 0.7);
}

.idea {
  position: absolute;
  top: 0;
  left: 0;
  margin: 0;
  padding: 0;
  border: 0;
  appearance: none;
  background: transparent;
  cursor: grab;
  user-select: none;
  -webkit-user-drag: none;
  will-change: transform;
  transition: opacity 0.8s ease;
}

.idea.is-dim {
  opacity: 0.72;
}

.idea:focus {
  outline: none;
}

.idea:focus-visible {
  outline: 2px solid var(--gold-deep);
  outline-offset: 4px;
}

.idea img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1080 / 1350;
  object-fit: cover;
  background: #e5ddd2;
  pointer-events: none;
  box-shadow: 0 14px 28px rgba(48, 32, 18, 0.1);
}

.slip {
  display: block;
  margin: 0;
  padding: 0.9rem 0.85rem 1rem;
  background: #f7f1e6;
  color: #2c1810;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 500;
  font-size: 1.28rem;
  line-height: 1.12;
  text-align: left;
  box-shadow: 0 12px 26px rgba(48, 32, 18, 0.08);
}

.hint {
  position: fixed;
  z-index: 4;
  left: 50%;
  bottom: max(0.85rem, env(safe-area-inset-bottom));
  margin: 0;
  padding: 0.35rem 0.85rem;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.9);
  color: #5c5854;
  font-family: var(--serif);
  font-size: 1.2rem;
  font-style: italic;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  pointer-events: none;
  transition: opacity 1.4s ease;
}

.hint.is-gone {
  opacity: 0;
}

.viewer {
  position: fixed;
  top: var(--header);
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  padding: 1.25rem 1rem max(0.85rem, env(safe-area-inset-bottom));
}

.viewer[hidden] {
  display: none;
}

.viewer-bg {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(255, 255, 255, 0.86);
  cursor: zoom-out;
}

.viewer-piece {
  position: relative;
  z-index: 1;
  margin: 0;
}

.viewer-piece img {
  display: block;
  width: auto;
  height: auto;
  max-width: min(88vw, 920px);
  max-height: min(72dvh, calc(100dvh - var(--header) - 7rem - env(safe-area-inset-bottom)));
  box-shadow: 0 22px 50px rgba(48, 32, 18, 0.16);
}

.viewer-slip {
  max-width: min(88vw, 11em);
  margin: 0;
  padding: 1.35rem 1.15rem 1.5rem;
  background: #f7f1e6;
  color: var(--ink);
  font-family: var(--serif);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(2.2rem, 9vw, 6.5rem);
  line-height: 1.05;
  box-shadow: 0 18px 40px rgba(48, 32, 18, 0.12);
}

.viewer-nav {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding-inline: 0.6rem;
}

.viewer-nav[hidden],
.viewer-step[hidden],
.viewer-count[hidden],
.viewer-slip[hidden],
.viewer-piece img[hidden] {
  display: none;
}

.viewer-step {
  min-width: 5.5rem;
  min-height: 2.75rem;
  padding: 0.65rem 0.7rem;
  border: 0;
  background: transparent;
  color: #6d6258;
  font-family: var(--sans);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
}

.viewer-step:hover {
  color: var(--ink);
}

.viewer-count {
  margin: 0;
  color: #8a7b6c;
  font-family: var(--serif);
  font-size: 1.15rem;
  font-style: italic;
}

@media (max-width: 720px) {
  .hint {
    font-size: 1.05rem;
  }

  .slip {
    font-size: 1.15rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .idea,
  .hint {
    transition: none;
  }
}
