:root {
  --paper: #f3efe6;
  --ink: #1c1c1c;
  --muted: #3c3c3c;
  --line: rgba(28, 24, 18, 0.16);
  --chip: #161616;
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  height: 100dvh;
  background: var(--paper);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

body { overflow: hidden; overscroll-behavior: none; }

html.has-gojo-cursor,
html.has-gojo-cursor * {
  cursor: none !important;
}

.gojo-cursor {
  position: fixed;
  left: 0;
  top: 0;
  width: 72px;
  height: 72px;
  margin: -4px 0 0 -14px;
  pointer-events: none;
  z-index: 10000;
  opacity: 0;
  will-change: transform;
}

.gojo-cursor.is-on { opacity: 1; }
.gojo-cursor.is-pointer { margin-left: -50px; margin-top: -4px; }

.gojo-cursor img {
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: auto;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.18));
}

@media (prefers-reduced-motion: reduce) {
  .gojo-cursor { display: none; }
  html.has-gojo-cursor,
  html.has-gojo-cursor * { cursor: auto !important; }
}

.skip {
  position: absolute;
  left: 12px;
  top: -40px;
  background: #fff;
  color: #000;
  padding: 8px 12px;
  z-index: 20;
}
.skip:focus { top: 12px; }

.stage {
  min-height: 100%;
  position: relative;
}

.world {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 1440px;
  height: 900px;
  transform: translate(-50%, -50%) scale(var(--fit, 1));
  transform-origin: center center;
}

body.mobile .world {
  width: 430px;
  height: 980px;
}

.object,
.stack-chip,
.create,
.back {
  position: absolute;
  border: 0;
  background: none;
  padding: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.object {
  display: flex;
  flex-direction: column;
  align-items: center;
  left: var(--x);
  top: var(--y);
  width: var(--w);
  transform: translate(-50%, -50%) translate(var(--px, 0px), var(--py, 0px));
  z-index: var(--z);
}

.object img {
  width: 100%;
  height: auto;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
  filter: drop-shadow(12px 18px 14px rgba(70, 48, 24, 0.16));
  transition: transform 280ms ease;
}

.object:hover img,
.object:focus-visible img { transform: translateY(-8px); }

.person:hover img,
.person:focus-visible img { transform: none; }

@media (hover: none) {
  .object:hover img { transform: none; }
}

body.mobile .label {
  font-size: 11px;
  padding: 3px 8px 4px;
}

.object.is-off { display: none; }

.label {
  margin-top: 2px;
  padding: 4px 10px 5px;
  border-radius: 999px;
  background: rgba(255, 252, 247, 0.78);
  border: 1px solid var(--line);
  color: #2a2a2a;
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: -0.012em;
  line-height: 1.15;
  text-align: center;
  white-space: pre-line;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.7) inset;
}

.object:focus-visible .label,
.stack-chip:focus-visible,
.create:focus-visible,
.popover a:focus-visible,
.panel a:focus-visible,
.panel button:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

.stack-chip {
  left: var(--chip-x, 720px);
  top: var(--chip-y, 668px);
  transform: translate(-50%, -50%);
  z-index: 30;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px 6px 6px;
  border-radius: 999px;
  background: var(--chip);
  color: #fff;
  font-size: 13px;
  font-weight: 550;
  letter-spacing: -0.014em;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.12);
}

.chip-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  flex: 0 0 auto;
  background: #f3efe6;
}

.plus {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  color: var(--chip);
  display: grid;
  place-items: center;
  font-size: 15px;
  line-height: 1;
  font-weight: 500;
}

.stack-chip:hover,
.back:hover,
.tome:hover,
.disc:hover,
.work:hover,
.tool:hover { filter: brightness(1.03); }

@media (prefers-reduced-motion: reduce) {
  .orbit-item,
  .person {
    opacity: 1;
    transform: translate(-50%, -50%) translate(var(--px, 0px), var(--py, 0px)) rotate(var(--rot));
    transition: none;
  }

  .person.is-in .person-figure,
  .person:hover .person-figure,
  .person:focus-visible .person-figure {
    animation: none;
    transform: none;
    transition: none;
  }
}

.back,
.scene-name {
  position: absolute;
  z-index: 32;
}

.back {
  left: 36px;
  top: 32px;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(255, 252, 247, 0.86);
  border: 1px solid var(--line);
  font-size: 13px;
  font-weight: 550;
  z-index: 32;
}

.scene-name {
  left: 50%;
  top: 28px;
  transform: translateX(-50%);
  margin: 0;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--chip);
  color: #fff;
  font-size: 13px;
  font-weight: 550;
  letter-spacing: -0.02em;
}

.tome,
.disc,
.work,
.tool { transform: translate(-50%, -50%) translate(var(--px, 0px), var(--py, 0px)) rotate(var(--rot)); }

.tome img { width: 100%; }

.person-figure {
  display: block;
  width: 100%;
  transform-origin: 50% 92%;
  will-change: transform;
}

.person.is-in .person-figure {
  animation: person-breathe 4.8s ease-in-out infinite;
}

.person:hover .person-figure,
.person:focus-visible .person-figure {
  animation-play-state: paused;
  transform: translate3d(0, -10px, 0);
  transition: transform 280ms ease;
}

.person img {
  filter: drop-shadow(10px 16px 16px rgba(40, 28, 16, 0.18));
}

@keyframes person-breathe {
  0%,
  100% {
    transform: translate3d(0, 0, 0) rotate(-0.55deg) scale(1);
  }
  50% {
    transform: translate3d(0, -7px, 0) rotate(0.55deg) scale(1.018);
  }
}

.tool .label {
  max-width: 120px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.mobile .back {
  left: 16px;
  top: 18px;
}

body.mobile .scene-name {
  top: 18px;
  font-size: 12px;
}

.orbit-item,
.person {
  opacity: 0;
  transform: translate(-50%, -50%) translate(var(--px, 0px), calc(var(--py, 0px) + 14px)) rotate(var(--rot)) scale(0.96);
  transition: opacity 320ms ease, transform 420ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.orbit-item.is-in,
.person.is-in {
  opacity: 1;
  transform: translate(-50%, -50%) translate(var(--px, 0px), var(--py, 0px)) rotate(var(--rot)) scale(1);
}

.disc .sleeve,
.tool-mark {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 14px;
}

.tool-mark {
  border-radius: 18px;
  box-shadow: 0 10px 20px rgba(40, 28, 16, 0.12);
}

.rec {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  margin-top: 8px;
}

.rec-artist {
  font-size: 11px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: #6a645c;
}

.disc .label {
  max-width: 168px;
  white-space: normal;
}

.work {
  width: var(--w);
  padding: 16px 16px 18px;
  border-radius: 18px;
  background: rgba(255, 252, 248, 0.82);
  border: 1px solid rgba(28, 24, 18, 0.08);
  box-shadow: 10px 16px 22px rgba(60, 40, 20, 0.08);
  text-align: left;
}

.work-tag {
  display: block;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6d675f;
}

.work-title {
  display: block;
  margin-top: 6px;
  font-size: 22px;
  letter-spacing: -0.03em;
  font-weight: 560;
}

.popover {
  position: fixed;
  z-index: 40;
  width: min(280px, calc(100vw - 24px));
  padding: 14px 16px 15px;
  border-radius: 18px;
  background: rgba(255, 252, 248, 0.96);
  border: 1px solid rgba(28, 24, 18, 0.08);
  box-shadow: 0 18px 44px rgba(40, 30, 10, 0.14);
}

.popover[hidden] { display: none; }

.popover-title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.popover-note {
  margin: 6px 0 0;
  font-size: 13.5px;
  line-height: 1.4;
  color: var(--muted);
}

.popover-link {
  display: inline-block;
  margin-top: 10px;
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 550;
  text-decoration: none;
}

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

.panel {
  border: 0;
  padding: 22px 22px 18px;
  width: min(440px, calc(100vw - 28px));
  border-radius: 24px;
  background: rgba(255, 252, 248, 0.97);
  color: var(--ink);
  box-shadow: 0 28px 70px rgba(40, 30, 10, 0.18);
}

.panel::backdrop { background: rgba(48, 38, 22, 0.16); }

.panel h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 560;
  letter-spacing: -0.03em;
}

.panel p {
  margin: 10px 0 0;
  font-size: 14.5px;
  line-height: 1.45;
  color: var(--muted);
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 16px;
}

.links a, .text-button, .choice {
  color: var(--ink);
  font-size: 14px;
}

.links a { text-decoration: none; font-weight: 550; }
.links a:hover { text-decoration: underline; }

.choices {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.choice {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
  border-radius: 999px;
  padding: 7px 12px;
  cursor: pointer;
  font-weight: 500;
}

.choice[aria-pressed="false"] {
  color: #8a847b;
  background: transparent;
  text-decoration: line-through;
}

.panel-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 18px;
}

.text-button {
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
  font-weight: 550;
}

.done {
  border: 0;
  background: var(--chip);
  color: #fff;
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
  font-weight: 550;
}

@media (prefers-reduced-motion: reduce) {
  .object img { transition: none; }
}
