:root {
  color-scheme: light;
  --ink: #25224a;
  --muted: #6d688c;
  --paper: #fff8ef;
  --panel: rgba(255, 250, 241, 0.92);
  --line: #7b64bd;
  --line-soft: rgba(123, 100, 189, 0.22);
  --pink: #f4a8c7;
  --coral: #ee8f85;
  --mint: #95dfce;
  --sky: #a8c8ff;
  --butter: #ffe39a;
  --violet: #8f73df;
  --shadow: rgba(82, 55, 130, 0.22);
  --pixel: "Press Start 2P", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "Inter", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: #f7ecff;
}

body {
  min-height: 100vh;
  margin: 0;
  display: grid;
  place-items: center;
  padding: clamp(12px, 2vw, 28px);
  background:
    radial-gradient(circle at 12% 10%, rgba(244, 168, 199, 0.32), transparent 24rem),
    radial-gradient(circle at 90% 16%, rgba(149, 223, 206, 0.26), transparent 22rem),
    linear-gradient(135deg, #fbf4ff, #f8f1e8 48%, #eef7ff);
  color: var(--ink);
  font-family: var(--sans);
}

button,
a {
  color: inherit;
}

button {
  font: inherit;
}

.boot-screen {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    linear-gradient(rgba(123, 100, 189, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(123, 100, 189, 0.08) 1px, transparent 1px),
    radial-gradient(circle at 50% 42%, rgba(255, 227, 154, 0.34), transparent 20rem),
    #fff7ef;
  background-size: 18px 18px, 18px 18px, auto, auto;
  transition: opacity 360ms ease, visibility 360ms ease, transform 360ms ease;
}

.boot-screen.is-hidden {
  visibility: hidden;
  opacity: 0;
  transform: scale(1.02);
  pointer-events: none;
}

.boot-card {
  width: min(440px, 100%);
  border: 4px solid var(--line);
  border-radius: 18px;
  padding: 28px;
  background: var(--panel);
  box-shadow: 0 18px 60px var(--shadow), inset 0 0 0 3px rgba(255, 255, 255, 0.75);
  text-align: center;
}

.boot-avatar {
  width: min(210px, 62vw);
  image-rendering: pixelated;
  animation: idle 1.8s steps(2, end) infinite;
}

.pixel-kicker,
.map-hotspot span,
.hud-card span,
.star-card span,
.nav-pill,
.pixel-button {
  font-family: var(--pixel);
}

.pixel-kicker {
  margin: 0 0 10px;
  color: var(--violet);
  font-size: 0.66rem;
  line-height: 1.7;
  text-transform: uppercase;
}

.boot-card h1 {
  margin: 0 0 12px;
  font-size: clamp(1.8rem, 7vw, 3rem);
  line-height: 1;
}

.boot-card p:not(.pixel-kicker) {
  margin: 0 0 20px;
  color: var(--muted);
  font-weight: 700;
}

.pixel-button {
  width: 100%;
  min-height: 52px;
  border: 3px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(135deg, var(--butter), var(--pink));
  color: var(--ink);
  cursor: pointer;
  font-size: 0.78rem;
  box-shadow: 6px 6px 0 var(--line);
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.pixel-button:hover {
  transform: translate(2px, 2px);
  box-shadow: 4px 4px 0 var(--line);
}

.game-shell {
  width: min(1760px, 100%);
  height: min(94vh, 1080px);
  min-height: 720px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  border: 5px solid #2c225f;
  border-radius: 36px;
  background: rgba(255, 248, 239, 0.72);
  box-shadow: 0 26px 80px rgba(68, 45, 111, 0.24);
}

.topbar {
  z-index: 5;
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 18px;
  padding: 16px 24px;
  border-bottom: 3px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 250, 241, 0.98), rgba(255, 250, 241, 0.84));
  backdrop-filter: blur(16px);
}

.identity {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
}

.identity img {
  width: 58px;
  height: 58px;
  border: 3px solid var(--line);
  border-radius: 50%;
  object-fit: cover;
  object-position: 50% 18%;
  image-rendering: pixelated;
  background: #efe7ff;
}

.identity strong,
.identity small {
  display: block;
}

.identity strong {
  font-size: clamp(1.25rem, 2.2vw, 2rem);
  line-height: 1;
}

.identity small {
  margin-top: 6px;
  color: var(--muted);
  font-weight: 800;
  letter-spacing: 0.08em;
}

.topnav {
  display: flex;
  gap: 14px;
}

.nav-pill,
.heart-button {
  min-height: 54px;
  border: 2px solid var(--line-soft);
  border-radius: 12px;
  background: rgba(255, 250, 241, 0.76);
  color: var(--ink);
  cursor: pointer;
  font-weight: 900;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

.nav-pill {
  min-width: 152px;
  padding: 0 18px;
  font-size: 0.68rem;
}

.nav-pill:hover,
.nav-pill.is-active,
.heart-button:hover {
  border-color: var(--pink);
  background: #fff0f7;
  box-shadow: 0 8px 0 rgba(244, 168, 199, 0.2);
  transform: translateY(-2px);
}

.heart-button {
  width: 58px;
  font-family: var(--pixel);
  font-size: 0.7rem;
  color: #c94c82;
}

.map-stage {
  position: relative;
  min-height: 0;
  overflow: hidden;
}

.map-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: pixelated;
}

.map-stage::after {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 48%, transparent 0 36%, rgba(255, 248, 239, 0.12) 58%, rgba(38, 29, 86, 0.18) 100%),
    linear-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px);
  background-size: auto, 100% 7px;
  content: "";
}

.bot-guide,
.map-hotspot,
.avatar-anchor,
.hud,
.chapter-modal {
  image-rendering: pixelated;
}

.bot-guide {
  position: absolute;
  left: 3.5%;
  top: 7%;
  z-index: 3;
  display: grid;
  grid-template-columns: 78px minmax(160px, 230px);
  align-items: center;
  gap: 12px;
}

.bot-face {
  width: 78px;
  height: 78px;
  display: grid;
  place-items: center;
  border: 4px solid var(--line);
  border-radius: 24px;
  background: #f5f1ff;
  box-shadow: 5px 5px 0 rgba(44, 34, 95, 0.18);
}

.bot-face span {
  width: 42px;
  height: 28px;
  border-radius: 12px;
  background: #25224a;
  box-shadow: inset 10px 8px 0 #77dce2, inset -10px 8px 0 #77dce2;
}

.bot-guide p,
.map-hotspot,
.avatar-anchor p,
.quest-log,
.hud-card,
.star-card {
  border: 3px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: 6px 6px 0 rgba(82, 55, 130, 0.18);
}

.bot-guide p {
  margin: 0;
  padding: 16px;
  color: var(--ink);
  font-weight: 900;
}

.map-hotspot {
  position: absolute;
  z-index: 4;
  width: min(260px, 17vw);
  min-height: 96px;
  padding: 15px 16px;
  text-align: left;
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}

.map-hotspot:hover,
.map-hotspot:focus-visible {
  border-color: var(--pink);
  transform: translateY(-5px) scale(1.02);
  box-shadow: 8px 10px 0 rgba(244, 168, 199, 0.24);
}

.map-hotspot span,
.map-hotspot small {
  display: block;
}

.map-hotspot span {
  font-size: clamp(0.64rem, 1vw, 0.86rem);
  line-height: 1.6;
}

.map-hotspot small {
  margin-top: 8px;
  color: var(--muted);
  font-weight: 900;
}

.school {
  left: 14%;
  top: 21%;
}

.work {
  left: 53%;
  top: 6%;
}

.projects {
  right: 4%;
  top: 17%;
}

.ai {
  right: 9%;
  top: 39%;
}

.roots {
  right: 16%;
  bottom: 22%;
}

.mocha {
  left: 3%;
  bottom: 32%;
}

.avatar-anchor {
  position: absolute;
  left: 44%;
  bottom: 13%;
  z-index: 3;
  transform: translateX(-50%);
  display: grid;
  justify-items: center;
}

.avatar-anchor p {
  width: 250px;
  margin: 0 0 6px;
  padding: 14px;
  font-weight: 900;
}

.avatar-anchor img {
  width: clamp(140px, 13vw, 210px);
  image-rendering: pixelated;
  animation: idle 1.8s steps(2, end) infinite;
}

.signpost {
  display: grid;
  gap: 4px;
  margin-top: -12px;
  color: #fff9eb;
  font-weight: 900;
  text-align: center;
}

.signpost span {
  min-width: 92px;
  border: 2px solid #775236;
  border-radius: 8px;
  padding: 3px 10px;
  background: #a16b45;
  box-shadow: 3px 3px 0 rgba(73, 48, 29, 0.32);
}

.hud {
  z-index: 5;
  display: grid;
  grid-template-columns: minmax(320px, 1.5fr) repeat(3, minmax(150px, 0.58fr)) minmax(250px, 0.8fr);
  gap: 14px;
  padding: 16px 24px 20px;
  border-top: 3px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 250, 241, 0.86), rgba(255, 245, 230, 0.96));
}

.quest-log,
.hud-card,
.star-card {
  padding: 16px;
}

.quest-log h2 {
  margin: 0 0 8px;
  font-size: 1.18rem;
}

.quest-log p:last-child {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.hud-card {
  display: grid;
  align-content: center;
  gap: 8px;
  text-align: center;
  cursor: pointer;
}

.hud-card span {
  font-size: 0.64rem;
}

.hud-card small,
.star-card small {
  color: var(--muted);
  font-weight: 800;
}

.star-card {
  display: grid;
  align-content: center;
  gap: 8px;
}

.star-card strong {
  font-family: var(--pixel);
  color: #c94c82;
  font-size: 0.9rem;
}

.chapter-modal {
  width: min(820px, calc(100% - 28px));
  max-height: min(82vh, 760px);
  border: 4px solid var(--line);
  border-radius: 20px;
  padding: 24px;
  background: rgba(255, 250, 241, 0.98);
  color: var(--ink);
  box-shadow: 0 28px 100px rgba(32, 24, 70, 0.34);
}

.chapter-modal::backdrop {
  background: rgba(37, 34, 74, 0.42);
  backdrop-filter: blur(5px);
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 42px;
  height: 42px;
  border: 3px solid var(--line);
  border-radius: 10px;
  background: #fff0f7;
  color: var(--ink);
  cursor: pointer;
  font-family: var(--pixel);
}

.chapter-modal h2 {
  max-width: calc(100% - 60px);
  margin: 0 0 12px;
  font-size: clamp(1.8rem, 5vw, 3.2rem);
  line-height: 1;
}

.modal-summary {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 1.02rem;
  font-weight: 800;
}

.modal-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.modal-item {
  border: 2px solid var(--line-soft);
  border-radius: 14px;
  padding: 16px;
  background: #fffdf8;
}

.modal-item h3 {
  margin: 0 0 8px;
  font-size: 1.06rem;
}

.modal-item p,
.modal-item li {
  color: var(--muted);
  font-weight: 700;
}

.modal-item p {
  margin: 0;
}

.modal-item ul {
  margin: 8px 0 0;
  padding-left: 18px;
}

.modal-item.full {
  grid-column: 1 / -1;
}

@keyframes idle {
  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-5px);
  }
}

@media (max-width: 1100px) {
  body {
    display: block;
    padding: 0;
  }

  .game-shell {
    width: 100%;
    height: auto;
    min-height: 100vh;
    border: 0;
    border-radius: 0;
    overflow: visible;
  }

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

  .topnav {
    grid-column: 1 / -1;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .nav-pill {
    min-width: 128px;
  }

  .map-stage {
    min-height: 720px;
  }

  .map-hotspot {
    width: 220px;
  }

  .hud {
    grid-template-columns: 1fr 1fr;
  }

  .quest-log,
  .star-card {
    grid-column: 1 / -1;
  }
}

@media (max-width: 720px) {
  .topbar {
    padding: 12px;
  }

  .identity img {
    width: 48px;
    height: 48px;
  }

  .identity strong {
    font-size: 1.12rem;
  }

  .identity small {
    font-size: 0.72rem;
  }

  .heart-button {
    width: 48px;
    min-height: 48px;
  }

  .map-stage {
    min-height: 980px;
  }

  .map-art {
    width: 176%;
    max-width: none;
    transform: translateX(-24%);
  }

  .bot-guide {
    left: 16px;
    top: 18px;
    grid-template-columns: 60px 1fr;
    right: 16px;
  }

  .bot-face {
    width: 60px;
    height: 60px;
  }

  .bot-guide p {
    padding: 12px;
    font-size: 0.88rem;
  }

  .map-hotspot {
    width: min(280px, calc(100% - 32px));
    left: 16px;
    right: auto;
  }

  .school {
    top: 160px;
  }

  .work {
    top: 280px;
  }

  .projects {
    top: 400px;
  }

  .ai {
    top: 520px;
  }

  .roots {
    top: 640px;
    bottom: auto;
  }

  .mocha {
    top: 760px;
    bottom: auto;
  }

  .avatar-anchor {
    left: 72%;
    bottom: 34px;
  }

  .avatar-anchor p {
    display: none;
  }

  .avatar-anchor img {
    width: 128px;
  }

  .hud {
    grid-template-columns: 1fr;
    padding: 14px;
  }

  .modal-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
