:root {
  --ink: #f8f3ff;
  --muted: #bcb3d9;
  --night: #09071c;
  --panel: #171137;
  --purple: #8a4dff;
  --pink: #ff4fa3;
  --cyan: #39e7e0;
  --gold: #ffd34e;
  --orange: #ff8d3a;
  --green: #67e480;
  --pixel-shadow: 4px 4px 0 #05030d;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  overflow-x: hidden;
  color: var(--ink);
  background: var(--night);
  font-family: "ZCOOL QingKe HuangYou", "Microsoft YaHei", sans-serif;
}

button {
  font: inherit;
}

button:focus-visible {
  outline: 3px solid var(--cyan);
  outline-offset: 4px;
}

#starfield,
#confetti {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}

#starfield {
  z-index: -2;
  background: #09071c;
}

#confetti {
  z-index: 20;
  pointer-events: none;
  display: none;
}

.game-shell {
  position: relative;
  width: min(1180px, calc(100% - 32px));
  min-height: calc(100vh - 32px);
  margin: 16px auto;
  overflow: hidden;
  border: 4px solid #5d35b5;
  background: rgba(9, 7, 28, 0.88);
  box-shadow:
    0 0 0 4px #21134a,
    0 0 0 8px #080512,
    0 0 42px rgba(138, 77, 255, 0.38);
}

.game-shell::before,
.game-shell::after {
  content: "";
  position: absolute;
  z-index: 12;
  width: 20px;
  height: 20px;
  border-color: var(--cyan);
  pointer-events: none;
}

.game-shell::before {
  top: 6px;
  left: 6px;
  border-top: 4px solid;
  border-left: 4px solid;
}

.game-shell::after {
  right: 6px;
  bottom: 6px;
  border-right: 4px solid;
  border-bottom: 4px solid;
}

.topbar {
  position: absolute;
  z-index: 15;
  top: 18px;
  left: 22px;
  right: 22px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-mark {
  display: grid;
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 3px solid var(--ink);
  background: var(--pink);
  color: #170720;
  font-size: 24px;
  font-weight: 900;
  box-shadow: var(--pixel-shadow);
}

.progress-wrap {
  width: min(360px, 50vw);
  padding: 8px 10px;
  border: 2px solid #514277;
  background: rgba(10, 7, 28, 0.82);
}

.progress-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 14px;
}

.progress-track {
  height: 8px;
  padding: 2px;
  background: #070512;
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  background: repeating-linear-gradient(90deg, var(--cyan) 0 12px, #1aa7ae 12px 15px);
  transition: width 0.5s steps(6);
}

.icon-button {
  display: grid;
  width: 44px;
  height: 44px;
  margin-left: auto;
  padding: 0;
  place-items: center;
  border: 2px solid #66588c;
  border-radius: 0;
  background: #15102d;
  color: var(--cyan);
  cursor: pointer;
  box-shadow: 3px 3px 0 #05030d;
}

.icon-button.is-on {
  border-color: var(--cyan);
  background: #183c46;
}

.inventory {
  position: absolute;
  z-index: 14;
  top: 84px;
  left: 22px;
  display: none;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border: 2px solid #5b4a83;
  background: rgba(9, 7, 28, 0.9);
  box-shadow: 3px 3px 0 #05030d;
}

.inventory.is-visible {
  display: flex;
}

.inventory-title {
  color: var(--muted);
  font-size: 13px;
}

.inventory-items {
  display: flex;
  gap: 7px;
}

.inventory-item {
  display: flex;
  align-items: center;
  gap: 5px;
  min-height: 30px;
  padding: 3px 8px;
  border: 2px solid var(--gold);
  background: #31234b;
  color: #fff1aa;
  animation: item-pop 0.45s steps(5);
}

.screen {
  position: absolute;
  inset: 0;
  display: none;
  min-height: calc(100vh - 40px);
  padding: 104px 42px 34px;
}

.screen.is-active {
  display: flex;
  animation: screen-in 0.55s steps(8);
}

.start-screen {
  align-items: center;
  justify-content: center;
  text-align: center;
  background:
    radial-gradient(circle at 50% 42%, rgba(109, 55, 209, 0.34), transparent 36%),
    linear-gradient(180deg, rgba(9, 7, 28, 0.05), rgba(18, 8, 48, 0.84));
}

.start-screen::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 25%;
  opacity: 0.4;
  background:
    linear-gradient(90deg, transparent 0 4%, #1b1842 4% 9%, transparent 9% 12%, #2c1f5a 12% 18%, transparent 18% 23%, #13153b 23% 31%, transparent 31% 37%, #28164e 37% 43%, transparent 43% 50%, #15153d 50% 58%, transparent 58% 64%, #2d1d5d 64% 70%, transparent 70% 76%, #181642 76% 84%, transparent 84% 89%, #2e1a54 89% 96%, transparent 96%);
  clip-path: polygon(0 46%, 4% 46%, 4% 20%, 9% 20%, 9% 62%, 12% 62%, 12% 8%, 18% 8%, 18% 66%, 23% 66%, 23% 30%, 31% 30%, 31% 72%, 37% 72%, 37% 15%, 43% 15%, 43% 60%, 50% 60%, 50% 28%, 58% 28%, 58% 70%, 64% 70%, 64% 10%, 70% 10%, 70% 55%, 76% 55%, 76% 18%, 84% 18%, 84% 68%, 89% 68%, 89% 34%, 96% 34%, 96% 48%, 100% 48%, 100% 100%, 0 100%);
}

.start-content {
  position: relative;
  z-index: 3;
  width: min(760px, 100%);
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--cyan);
  font-size: 16px;
  letter-spacing: 0;
}

.start-content h1 {
  margin: 0;
  font-family: "ZCOOL KuaiLe", "Microsoft YaHei", sans-serif;
  text-shadow: 5px 5px 0 #281153, 8px 8px 0 #05030d;
}

.start-content h1 span {
  display: block;
  color: #fff;
  font-size: clamp(46px, 8vw, 92px);
  line-height: 1;
}

.start-content h1 small {
  display: block;
  margin-top: 12px;
  color: var(--gold);
  font-size: clamp(25px, 4vw, 46px);
}

.subtitle {
  margin: 26px auto 28px;
  color: #ddd5f5;
  font-size: clamp(18px, 2.1vw, 24px);
}

.pixel-button {
  position: relative;
  min-height: 54px;
  padding: 0 28px;
  border: 3px solid #fff;
  border-radius: 0;
  color: #180d2d;
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 5px 5px 0 #05030d;
  transition: transform 0.12s steps(2), box-shadow 0.12s steps(2);
}

.pixel-button::before,
.pixel-button::after {
  content: "";
  position: absolute;
  width: 7px;
  height: 7px;
  background: #05030d;
}

.pixel-button::before {
  top: -3px;
  left: -3px;
}

.pixel-button::after {
  right: -3px;
  bottom: -3px;
}

.pixel-button:hover {
  transform: translate(-2px, -2px);
  box-shadow: 7px 7px 0 #05030d;
}

.pixel-button:active {
  transform: translate(4px, 4px);
  box-shadow: 1px 1px 0 #05030d;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  gap: 18px;
  background: var(--gold);
  animation: button-pulse 1.7s steps(5) infinite;
}

.primary-button b {
  font-size: 16px;
}

.secondary-button {
  background: var(--cyan);
}

.ghost-button {
  border-color: #8f80b6;
  background: #1d1639;
  color: var(--ink);
}

.text-button {
  display: block;
  margin: 18px auto 0;
  border: 0;
  border-bottom: 2px solid var(--pink);
  background: transparent;
  color: #ffc3e2;
  font-size: 16px;
  cursor: pointer;
}

.is-hidden {
  display: none !important;
}

.start-decor {
  position: absolute;
  z-index: 3;
  right: 10%;
  bottom: 12%;
  transform: rotate(4deg);
}

.mini-chest {
  transform: scale(0.7);
  opacity: 0.7;
}

.spark {
  position: absolute;
  color: var(--gold);
  animation: blink 1s steps(2) infinite;
}

.spark-a {
  top: -28px;
  left: -10px;
}

.spark-b {
  top: 4px;
  right: -26px;
  animation-delay: 0.45s;
}

.scene-screen {
  align-items: stretch;
  flex-direction: column;
}

.scene-heading {
  position: relative;
  z-index: 4;
  margin: 4px auto 16px;
  text-align: center;
}

.scene-heading p {
  margin: 0 0 4px;
  color: var(--pink);
  font-size: 15px;
}

.scene-heading h2 {
  margin: 0;
  font-family: "ZCOOL KuaiLe", sans-serif;
  font-size: clamp(25px, 4vw, 38px);
  text-shadow: 3px 3px 0 #05030d;
}

.scene {
  position: relative;
  flex: 1;
  width: min(980px, 100%);
  min-height: 460px;
  max-height: 650px;
  margin: 0 auto;
  overflow: hidden;
  border: 4px solid #6f55a4;
  box-shadow: 8px 8px 0 #05030d;
  image-rendering: pixelated;
}

.hotspot {
  position: absolute;
  z-index: 6;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  color: inherit;
  cursor: pointer;
}

.click-hint {
  position: absolute;
  z-index: 8;
  left: 50%;
  bottom: -45px;
  min-width: 108px;
  padding: 7px 10px;
  border: 2px solid #fff;
  background: var(--pink);
  color: #1b0920;
  font-style: normal;
  font-weight: 700;
  transform: translateX(-50%);
  box-shadow: 3px 3px 0 #05030d;
  animation: hint-bounce 1s steps(4) infinite;
}

.click-hint::before {
  content: "";
  position: absolute;
  top: -8px;
  left: calc(50% - 5px);
  width: 8px;
  height: 8px;
  border-top: 2px solid #fff;
  border-left: 2px solid #fff;
  background: var(--pink);
  transform: rotate(45deg);
}

.office-scene {
  background:
    linear-gradient(#392b62 0 10%, transparent 10%),
    repeating-linear-gradient(0deg, #71658d 0 3px, #776b94 3px 56px);
}

.office-scene::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 20%;
  background: repeating-linear-gradient(90deg, #4b3056 0 78px, #3f284d 78px 82px);
  border-top: 4px solid #24142e;
}

.office-window {
  position: absolute;
  top: 55px;
  left: 6%;
  width: 24%;
  height: 36%;
  border: 8px solid #29203f;
  background: #15143e;
  box-shadow: inset 0 0 0 3px #6a5d81;
}

.office-window::before,
.office-window::after {
  content: "";
  position: absolute;
  z-index: 2;
  background: #29203f;
}

.office-window::before {
  top: 0;
  bottom: 0;
  left: calc(50% - 3px);
  width: 6px;
}

.office-window::after {
  top: calc(55% - 3px);
  left: 0;
  right: 0;
  height: 6px;
}

.office-window span,
.office-window i,
.office-window b {
  position: absolute;
  bottom: 0;
  width: 24%;
  background: #2e255e;
}

.office-window span {
  left: 6%;
  height: 42%;
}

.office-window i {
  left: 38%;
  height: 64%;
}

.office-window b {
  right: 7%;
  height: 32%;
}

.office-wall-note {
  position: absolute;
  top: 12%;
  width: 60px;
  height: 68px;
  padding-top: 22px;
  background: #ffef81;
  color: #3f3152;
  text-align: center;
  box-shadow: 4px 4px 0 rgba(20, 12, 36, 0.45);
}

.note-one {
  right: 12%;
  transform: rotate(3deg);
}

.note-two {
  right: 23%;
  top: 20%;
  background: #71e4bd;
  transform: rotate(-4deg);
}

.desk {
  position: absolute;
  z-index: 3;
  left: 12%;
  right: 10%;
  bottom: 17%;
  height: 33%;
  border-top: 18px solid #2b1838;
  background: #684466;
  box-shadow: inset 0 7px 0 #906687;
}

.desk::before,
.desk::after {
  content: "";
  position: absolute;
  bottom: -46%;
  width: 9%;
  height: 50%;
  background: #321d3f;
}

.desk::before {
  left: 5%;
}

.desk::after {
  right: 5%;
}

.monitor-base {
  position: absolute;
  left: 45%;
  top: -14px;
  width: 13%;
  height: 15px;
  background: #1e1833;
}

.keyboard {
  position: absolute;
  left: 37%;
  top: 20px;
  width: 30%;
  height: 30px;
  border: 4px solid #20172f;
  background: repeating-linear-gradient(90deg, #bbb2ce 0 13px, #615775 13px 16px);
  transform: skew(-10deg);
}

.cup {
  position: absolute;
  left: 75%;
  top: 20px;
  width: 46px;
  height: 54px;
  border: 4px solid #251934;
  background: var(--cyan);
}

.cup span {
  position: absolute;
  top: 8px;
  right: -18px;
  width: 18px;
  height: 28px;
  border: 5px solid #251934;
  border-left: 0;
}

.calendar {
  position: absolute;
  left: 10%;
  top: 12px;
  display: grid;
  width: 72px;
  height: 78px;
  border: 4px solid #2b1838;
  background: #f7f3e9;
  color: #352443;
  text-align: center;
}

.calendar b {
  padding: 3px;
  background: var(--pink);
}

.calendar span {
  font-size: 28px;
}

.badge {
  position: absolute;
  left: 24%;
  top: 44px;
  display: grid;
  width: 43px;
  height: 52px;
  place-items: center;
  border: 3px solid #30213d;
  background: #f3eafc;
  color: #443155;
}

.badge i {
  position: absolute;
  top: -15px;
  width: 7px;
  height: 16px;
  background: var(--cyan);
}

.computer {
  top: 28%;
  left: 41%;
  width: 27%;
  height: 28%;
  border: 9px solid #21192f;
  background: #0b1023;
  box-shadow: 0 0 0 4px #77708c, 7px 7px 0 #140c22;
}

.computer::after {
  content: "";
  position: absolute;
  inset: -15px;
  border: 3px dashed var(--gold);
  animation: hotspot-glow 1s steps(2) infinite;
}

.monitor-screen {
  position: absolute;
  inset: 7px;
  overflow: hidden;
  background: #102f3c;
  color: var(--green);
}

.monitor-screen b {
  position: absolute;
  left: 12%;
  bottom: 18%;
  font-size: clamp(14px, 2vw, 23px);
}

.code-line {
  position: absolute;
  left: 12%;
  height: 5px;
  background: var(--cyan);
}

.line-a {
  top: 20%;
  width: 58%;
}

.line-b {
  top: 34%;
  width: 35%;
}

.line-c {
  top: 48%;
  width: 68%;
}

.office-chair {
  position: absolute;
  z-index: 5;
  right: 4%;
  bottom: 3%;
  width: 18%;
  height: 36%;
  border: 6px solid #201429;
  background: #3d2860;
}

.office-chair span {
  position: absolute;
  left: 22%;
  right: 22%;
  bottom: -25px;
  height: 25px;
  background: #201429;
}

.plant {
  position: absolute;
  z-index: 4;
  left: 2%;
  bottom: 18%;
  width: 90px;
  height: 130px;
}

.plant i {
  position: absolute;
  bottom: 48px;
  width: 36px;
  height: 56px;
  background: #55c773;
}

.plant i:nth-child(1) {
  left: 27px;
  height: 75px;
}

.plant i:nth-child(2) {
  left: 5px;
  transform: rotate(-25deg);
}

.plant i:nth-child(3) {
  right: 5px;
  transform: rotate(25deg);
}

.plant b {
  position: absolute;
  bottom: 0;
  left: 16px;
  width: 60px;
  height: 52px;
  background: var(--orange);
  border: 5px solid #3e2138;
}

.transit-scene {
  background:
    linear-gradient(90deg, transparent 0 8%, rgba(255,255,255,0.08) 8% 8.5%, transparent 8.5% 91%, rgba(255,255,255,0.08) 91% 91.5%, transparent 91.5%),
    #b7adc6;
}

.transit-roof {
  position: absolute;
  inset: 0 0 auto;
  height: 18%;
  border-bottom: 6px solid #413653;
  background: #776c87;
}

.handles {
  position: absolute;
  z-index: 3;
  top: 5%;
  left: 15%;
  right: 15%;
  display: flex;
  justify-content: space-between;
}

.handles span {
  width: 42px;
  height: 66px;
  border: 7px solid #322944;
  border-top-width: 25px;
  background: #e5dce9;
  clip-path: polygon(30% 0, 70% 0, 70% 34%, 100% 34%, 100% 100%, 0 100%, 0 34%, 30% 34%);
}

.train-window {
  top: 22%;
  left: 14%;
  width: 58%;
  height: 45%;
  border: 9px solid #3e354d;
  background: #101534;
  box-shadow: inset 0 0 0 4px #7f748d, 0 0 0 4px #2e273a;
}

.train-window::after {
  content: "";
  position: absolute;
  inset: -16px;
  border: 3px dashed var(--gold);
  animation: hotspot-glow 1s steps(2) infinite;
}

.timing-game {
  position: absolute;
  z-index: 12;
  left: 10%;
  right: 10%;
  bottom: 5%;
  display: none;
  padding: 14px 16px 16px;
  border: 4px solid #fff;
  background: rgba(18, 11, 43, 0.96);
  box-shadow: 7px 7px 0 #21132d;
  text-align: center;
}

.timing-game.is-active {
  display: block;
  animation: modal-pop 0.35s steps(6);
}

.timing-game p {
  margin: 0 0 10px;
  color: #e9e2fa;
  font-size: 17px;
}

.timing-track {
  position: relative;
  height: 22px;
  margin: 0 auto 13px;
  overflow: hidden;
  border: 4px solid #21172e;
  background: repeating-linear-gradient(90deg, #514968 0 20px, #463e5d 20px 24px);
}

.timing-zone {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 39%;
  width: 22%;
  background: var(--gold);
  box-shadow: inset 0 0 0 3px #ff9e32;
}

.timing-cursor {
  position: absolute;
  z-index: 2;
  top: -3px;
  left: 0;
  width: 10px;
  height: 22px;
  background: var(--cyan);
  box-shadow: 2px 0 0 #0b6170;
}

.timing-game.is-active .timing-cursor {
  animation: timing-sweep 1.65s linear infinite alternate;
}

.timing-button {
  min-height: 43px;
  padding: 0 20px;
  border-width: 2px;
  background: var(--pink);
  color: #260b25;
  font-size: 17px;
}

.train-window.is-opened {
  transform: translateY(-18px);
  transition: transform 0.45s steps(5);
}

.train-window.is-opened .night-view {
  box-shadow: inset 0 -24px 0 rgba(57, 231, 224, 0.18);
}

.night-view {
  position: absolute;
  inset: 5px;
  overflow: hidden;
  background: linear-gradient(#11143b 0 64%, #27234b 64%);
}

.moon {
  position: absolute;
  top: 12%;
  right: 12%;
  width: 38px;
  height: 38px;
  background: var(--gold);
  box-shadow: 8px 0 0 #11143b;
}

.city {
  position: absolute;
  bottom: 0;
  width: 20%;
  background: #0a0b1d;
}

.city::after {
  content: "";
  position: absolute;
  inset: 15% 20%;
  background: repeating-linear-gradient(0deg, var(--gold) 0 4px, transparent 4px 14px);
}

.city-a {
  left: 0;
  height: 45%;
}

.city-b {
  left: 23%;
  width: 30%;
  height: 62%;
}

.city-c {
  right: 8%;
  height: 38%;
}

.speed-line {
  position: absolute;
  left: -20%;
  height: 4px;
  background: #5ef5ef;
  animation: scenery-speed 1.1s linear infinite;
}

.speed-one {
  top: 28%;
  width: 22%;
}

.speed-two {
  top: 50%;
  width: 34%;
  animation-delay: 0.5s;
}

.route-map {
  position: absolute;
  top: 25%;
  right: 4%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-around;
  width: 12%;
  height: 38%;
  border: 5px solid #463b55;
  background: #f4eff0;
}

.route-map::before {
  content: "";
  position: absolute;
  top: 10%;
  bottom: 10%;
  left: calc(50% - 3px);
  width: 6px;
  background: var(--pink);
}

.route-map i {
  z-index: 2;
  width: 16px;
  height: 16px;
  border: 3px solid #412e4d;
  background: var(--gold);
}

.train-seats {
  position: absolute;
  z-index: 2;
  left: 10%;
  right: 10%;
  bottom: 4%;
  display: flex;
  height: 24%;
  border: 7px solid #35283e;
}

.train-seats span {
  flex: 1;
  border-right: 5px solid #35283e;
  background: #d84f78;
  box-shadow: inset 0 8px 0 #f37195;
}

.headphones {
  position: absolute;
  z-index: 5;
  right: 15%;
  bottom: 16%;
  width: 80px;
  height: 82px;
  border: 10px solid var(--cyan);
  border-bottom: 0;
  border-radius: 50% 50% 0 0;
  transform: rotate(8deg);
}

.headphones b,
.headphones em {
  position: absolute;
  bottom: -17px;
  width: 22px;
  height: 34px;
  border: 5px solid #332444;
  background: #854dff;
}

.headphones b {
  left: -17px;
}

.headphones em {
  right: -17px;
}

.train-door-line {
  position: absolute;
  top: 18%;
  bottom: 0;
  left: 8%;
  width: 5px;
  background: #51445f;
}

.home-scene {
  background:
    repeating-linear-gradient(90deg, transparent 0 120px, rgba(45, 24, 57, 0.12) 120px 124px),
    #c59b7d;
}

.home-scene::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 18%;
  border-top: 6px solid #4d2e43;
  background: repeating-linear-gradient(90deg, #724a53 0 90px, #634049 90px 95px);
}

.front-door {
  position: absolute;
  z-index: 2;
  left: 9%;
  bottom: 18%;
  width: 30%;
  height: 70%;
  border: 10px solid #3f283b;
  background: #68475d;
  box-shadow: inset 0 0 0 6px #875f71;
}

.front-door i {
  position: absolute;
  top: 8%;
  left: 12%;
  right: 12%;
  height: 32%;
  border: 5px solid #4b3045;
}

.front-door b {
  position: absolute;
  right: 8%;
  top: 52%;
  width: 18px;
  height: 18px;
  background: var(--gold);
  box-shadow: 2px 2px 0 #2d1830;
}

.front-door span {
  position: absolute;
  left: 25%;
  right: 25%;
  top: 48%;
  padding: 8px 0;
  border: 3px solid #3d253a;
  background: #e6bc78;
  color: #583949;
  text-align: center;
}

.hooks {
  position: absolute;
  top: 18%;
  left: 44%;
  width: 18%;
  height: 8px;
  background: #462d40;
}

.hooks::before,
.hooks::after {
  content: "";
  position: absolute;
  top: 5px;
  width: 6px;
  height: 20px;
  background: #462d40;
}

.hooks::before {
  left: 20%;
}

.hooks::after {
  right: 20%;
}

.hooks i {
  position: absolute;
  top: 20px;
  left: 17%;
  width: 22px;
  height: 22px;
  border: 6px solid var(--gold);
}

.hooks i::after {
  content: "";
  position: absolute;
  top: 12px;
  left: 5px;
  width: 7px;
  height: 35px;
  background: var(--gold);
}

.hooks b {
  position: absolute;
  top: 22px;
  right: 12%;
  width: 36px;
  height: 60px;
  background: #6d4ca2;
  clip-path: polygon(20% 0, 80% 0, 100% 30%, 80% 100%, 20% 100%, 0 30%);
}

.shoe-cabinet {
  position: absolute;
  z-index: 3;
  left: 42%;
  bottom: 18%;
  width: 23%;
  height: 35%;
  border: 7px solid #44283b;
  background: #956b68;
}

.shoe-cabinet i {
  display: block;
  height: 50%;
  border-bottom: 4px solid #44283b;
}

.shoe-cabinet b {
  position: absolute;
  top: -34px;
  left: 20%;
  width: 60%;
  height: 30px;
  border: 5px solid #432638;
  background: #e95f76;
  clip-path: polygon(0 60%, 30% 60%, 42% 0, 78% 0, 100% 60%, 100% 100%, 0 100%);
}

.fridge-wrap {
  position: absolute;
  z-index: 4;
  right: 5%;
  bottom: 18%;
  width: 27%;
  height: 66%;
  perspective: 800px;
}

.fridge {
  inset: 0;
  width: 100%;
  height: 100%;
  border: 7px solid #372b3e;
  background: #b8d9d5;
  box-shadow: 7px 7px 0 rgba(38, 23, 39, 0.5);
  transform-style: preserve-3d;
}

.fridge::after {
  content: "";
  position: absolute;
  inset: -15px;
  border: 3px dashed var(--gold);
  animation: hotspot-glow 1s steps(2) infinite;
}

.fridge-door {
  position: absolute;
  z-index: 3;
  inset: 0;
  border-bottom: 6px solid #50626a;
  background:
    linear-gradient(#d7f0ed 0 62%, #aacdc9 62%);
  transform-origin: right center;
  transform-style: preserve-3d;
  transition: transform 0.9s steps(9);
  backface-visibility: hidden;
}

.fridge-door.is-open {
  transform: rotateY(112deg);
}

.fridge-door i {
  position: absolute;
  top: 14%;
  left: 8%;
  width: 11px;
  height: 35%;
  background: #596975;
}

.fridge-door b {
  position: absolute;
  right: 11%;
  top: 12%;
  width: 48px;
  height: 58px;
  background:
    linear-gradient(90deg, var(--pink) 0 48%, transparent 48% 54%, var(--gold) 54%);
  box-shadow: 3px 3px 0 #68817f;
}

.fridge-door strong {
  position: absolute;
  left: 16%;
  bottom: 16%;
  padding: 4px 7px;
  background: #6d8d8b;
  color: #e8ffff;
  font-size: 14px;
}

.fridge-inside {
  position: absolute;
  inset: 4%;
  overflow: hidden;
  background: #fff4b9;
  box-shadow: inset 0 0 22px #ffd23f;
}

.fridge-inside i {
  position: absolute;
  top: 22%;
  left: 36%;
  color: #fff;
  font-size: 64px;
  font-style: normal;
  text-shadow: 0 0 12px #fff, 0 0 26px var(--gold);
  animation: treasure-pulse 0.8s steps(4) infinite;
}

.fridge-inside b,
.fridge-inside em {
  position: absolute;
  left: 12%;
  right: 12%;
  height: 6px;
  background: #d0a850;
}

.fridge-inside b {
  top: 58%;
}

.fridge-inside em {
  top: 76%;
}

.golden-glow {
  position: absolute;
  z-index: 8;
  inset: -50%;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(circle, rgba(255, 244, 150, 0.96) 0, rgba(255, 201, 53, 0.5) 22%, transparent 62%);
}

.golden-glow.is-shining {
  animation: gold-flash 1.5s steps(8) forwards;
}

.floor-mat {
  position: absolute;
  z-index: 3;
  left: 16%;
  bottom: 4%;
  width: 32%;
  height: 11%;
  padding-top: 14px;
  border: 5px solid #3e2638;
  background: #45a49a;
  color: #17464e;
  text-align: center;
  transform: skew(-12deg);
}

.chest-screen {
  align-items: center;
  flex-direction: column;
  justify-content: center;
  text-align: center;
  background:
    linear-gradient(rgba(9, 7, 28, 0.72), rgba(22, 12, 53, 0.92)),
    repeating-linear-gradient(90deg, transparent 0 58px, rgba(138,77,255,0.08) 58px 60px);
}

.chest-copy {
  position: relative;
  z-index: 3;
  margin-bottom: 26px;
}

.chest-copy h2 {
  margin: 0 0 8px;
  color: var(--gold);
  font-family: "ZCOOL KuaiLe", sans-serif;
  font-size: clamp(35px, 5vw, 56px);
  text-shadow: 4px 4px 0 #4b1d67, 7px 7px 0 #05030d;
}

.chest-copy p:last-child {
  margin: 0;
  color: #d5ccef;
  font-size: 19px;
}

.chest-grid {
  position: relative;
  z-index: 3;
  display: grid;
  width: min(800px, 100%);
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(14px, 4vw, 38px);
  perspective: 1000px;
}

.treasure-card {
  aspect-ratio: 0.82;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  perspective: 800px;
}

.card-inner {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.8s steps(10);
}

.treasure-card:hover .card-inner {
  transform: translateY(-8px);
}

.treasure-card.is-open .card-inner,
.treasure-card.is-open:hover .card-inner {
  transform: rotateY(180deg) translateY(-8px);
}

.treasure-card.is-disabled {
  pointer-events: none;
  filter: saturate(0.3) brightness(0.55);
}

.card-back,
.card-front {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  border: 4px solid #fff;
  background: #28184e;
  box-shadow: 7px 7px 0 #05030d;
  backface-visibility: hidden;
}

.card-back {
  background:
    repeating-linear-gradient(45deg, rgba(255,255,255,0.04) 0 8px, transparent 8px 16px),
    #32205b;
}

.card-back em {
  margin-top: 18px;
  color: #9e8fc6;
  font-style: normal;
  font-size: 18px;
}

.card-front {
  padding: 18px;
  border-color: var(--gold);
  background: #fff2b4;
  color: #311e3d;
  transform: rotateY(180deg);
}

.card-front strong {
  font-size: clamp(48px, 8vw, 78px);
}

.card-front b {
  margin: 12px 0 4px;
  font-size: clamp(18px, 2.2vw, 25px);
}

.card-front small {
  color: #7d5c58;
  font-size: 14px;
}

.pixel-chest {
  position: relative;
  display: block;
  width: clamp(92px, 13vw, 142px);
  height: clamp(76px, 11vw, 116px);
  border: 7px solid #3a2040;
  background: #c45d3d;
  box-shadow:
    inset 0 -14px 0 #8b3d3a,
    inset 0 10px 0 #ed8850,
    7px 7px 0 rgba(5, 3, 13, 0.45);
}

.pixel-chest::before {
  content: "";
  position: absolute;
  left: -7px;
  right: -7px;
  top: 38%;
  height: 9px;
  background: #3a2040;
}

.pixel-chest i {
  position: absolute;
  z-index: 2;
  top: -7px;
  bottom: -7px;
  left: calc(50% - 11px);
  width: 22px;
  border: 6px solid #8f5e20;
  background: var(--gold);
}

.pixel-chest b {
  position: absolute;
  z-index: 3;
  top: 43%;
  left: calc(50% - 16px);
  width: 32px;
  height: 27px;
  border: 5px solid #7d4c18;
  background: var(--gold);
}

#showLockedPrize {
  position: relative;
  z-index: 4;
  margin-top: 28px;
}

.prize-screen {
  align-items: center;
  justify-content: center;
  overflow: hidden;
  text-align: center;
  background: rgba(12, 7, 30, 0.72);
}

.prize-rays {
  position: absolute;
  width: min(85vw, 820px);
  aspect-ratio: 1;
  opacity: 0.22;
  background: repeating-conic-gradient(var(--gold) 0 8deg, transparent 8deg 16deg);
  animation: ray-spin 18s steps(36) infinite;
}

.prize-content {
  position: relative;
  z-index: 3;
  width: min(720px, 100%);
}

.prize-icon {
  display: grid;
  width: clamp(130px, 19vw, 190px);
  aspect-ratio: 1;
  margin: 0 auto 20px;
  place-items: center;
  border: 6px solid #fff;
  background: var(--gold);
  font-size: clamp(72px, 11vw, 112px);
  box-shadow: 9px 9px 0 #5a285c, 14px 14px 0 #05030d;
  animation: prize-jump 1.5s steps(7) infinite;
}

.prize-content h2 {
  margin: 0 0 18px;
  color: #fff5b1;
  font-family: "ZCOOL KuaiLe", sans-serif;
  font-size: clamp(31px, 5vw, 58px);
  text-shadow: 4px 4px 0 #812957, 7px 7px 0 #05030d;
}

.love-note {
  max-width: 630px;
  margin: 0 auto 28px;
  color: #eee5ff;
  font-size: clamp(17px, 2.2vw, 22px);
  line-height: 1.7;
}

.route-memory {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 18px;
  padding: 7px 10px;
  border: 2px solid #67558c;
  background: rgba(20, 13, 48, 0.78);
  color: var(--cyan);
  font-size: 15px;
}

.prize-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
}

.modal {
  position: fixed;
  z-index: 50;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: rgba(4, 3, 13, 0.82);
}

.modal.is-open {
  display: flex;
  animation: modal-bg 0.25s steps(4);
}

.modal-panel {
  position: relative;
  width: min(500px, 100%);
  padding: 34px 34px 30px;
  border: 4px solid var(--ink);
  background: #211541;
  text-align: center;
  box-shadow: 10px 10px 0 #07040f, inset 0 0 0 4px #6844aa;
  animation: modal-pop 0.35s steps(6);
}

.modal-panel::before,
.modal-panel::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  background: var(--pink);
}

.modal-panel::before {
  top: 8px;
  left: 8px;
}

.modal-panel::after {
  right: 8px;
  bottom: 8px;
  background: var(--cyan);
}

.modal-x {
  position: absolute;
  z-index: 2;
  top: 9px;
  right: 11px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 28px;
  cursor: pointer;
}

.modal-icon {
  font-size: 62px;
}

.modal-panel h3 {
  margin: 8px 0;
  color: var(--gold);
  font-size: 28px;
}

.modal-panel p {
  margin: 0 auto 22px;
  color: #e5dcfa;
  font-size: 19px;
  line-height: 1.65;
}

.modal-button {
  min-width: 150px;
  background: var(--cyan);
}

.modal-extra {
  margin: -8px 0 22px;
}

.modal-choices {
  display: grid;
  gap: 10px;
  margin: 0 0 4px;
}

.modal-choice {
  min-height: 48px;
  padding: 8px 14px;
  border: 3px solid #8a75b3;
  border-radius: 0;
  background: #342553;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  box-shadow: 4px 4px 0 #080512;
}

.modal-choice:hover {
  border-color: var(--cyan);
  background: #234858;
}

.claim-box {
  padding: 16px;
  border: 3px solid #6a55a0;
  background: #100b29;
  text-align: left;
}

.qr-placeholder {
  display: grid;
  width: 160px;
  height: 160px;
  margin: 0 auto 14px;
  place-items: center;
  border: 8px solid #fff;
  background:
    linear-gradient(90deg, #111 14%, transparent 14% 28%, #111 28% 42%, transparent 42% 56%, #111 56% 70%, transparent 70% 84%, #111 84%),
    linear-gradient(#111 14%, #fff 14% 28%, #111 28% 42%, #fff 42% 56%, #111 56% 70%, #fff 70% 84%, #111 84%);
  background-blend-mode: multiply;
  color: #fff;
  font-size: 15px;
  text-shadow: 2px 2px 0 #111;
}

.snack-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 12px;
}

.snack-list span {
  padding: 7px;
  border: 2px solid #584778;
  background: #2b2050;
  color: #fff0a3;
  text-align: center;
}

.pixel-transition {
  position: fixed;
  z-index: 45;
  inset: 0;
  display: none;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(3, 1fr);
  pointer-events: none;
}

.pixel-transition.is-running {
  display: grid;
}

.pixel-transition span {
  background: #140b30;
  transform: scale(0);
  animation: pixel-break 0.72s steps(5) forwards;
}

.pixel-transition span:nth-child(2n) {
  background: #5725a5;
  animation-delay: 0.05s;
}

.pixel-transition span:nth-child(3n) {
  background: #e43f91;
  animation-delay: 0.1s;
}

@keyframes screen-in {
  from { opacity: 0; transform: scale(1.03); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes button-pulse {
  0%, 100% { filter: brightness(1); box-shadow: 5px 5px 0 #05030d, 0 0 0 rgba(255, 211, 78, 0); }
  50% { filter: brightness(1.13); box-shadow: 5px 5px 0 #05030d, 0 0 28px rgba(255, 211, 78, 0.75); }
}

@keyframes blink {
  0%, 45% { opacity: 1; transform: scale(1); }
  50%, 100% { opacity: 0.25; transform: scale(0.7); }
}

@keyframes hint-bounce {
  0%, 100% { transform: translate(-50%, 0); }
  50% { transform: translate(-50%, -7px); }
}

@keyframes hotspot-glow {
  0%, 100% { opacity: 0.25; }
  50% { opacity: 1; }
}

@keyframes scenery-speed {
  from { transform: translateX(0); }
  to { transform: translateX(620px); }
}

@keyframes timing-sweep {
  from { left: 0; }
  to { left: calc(100% - 10px); }
}

@keyframes treasure-pulse {
  0%, 100% { transform: scale(0.9) rotate(-4deg); }
  50% { transform: scale(1.12) rotate(4deg); }
}

@keyframes gold-flash {
  0% { opacity: 0; transform: scale(0.5); }
  35% { opacity: 1; transform: scale(1.15); }
  70% { opacity: 0.7; transform: scale(1.35); }
  100% { opacity: 0; transform: scale(1.7); }
}

@keyframes item-pop {
  from { transform: scale(0); }
  70% { transform: scale(1.2); }
  to { transform: scale(1); }
}

@keyframes ray-spin {
  to { transform: rotate(360deg); }
}

@keyframes prize-jump {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-10px) rotate(2deg); }
}

@keyframes modal-bg {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modal-pop {
  from { transform: scale(0.6); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

@keyframes pixel-break {
  0% { transform: scale(0); }
  45%, 72% { transform: scale(1); }
  100% { transform: scale(0); }
}

@media (max-width: 720px) {
  .game-shell {
    width: calc(100% - 16px);
    min-height: calc(100svh - 16px);
    margin: 8px;
    border-width: 3px;
  }

  .topbar {
    top: 13px;
    left: 14px;
    right: 14px;
    gap: 10px;
  }

  .brand-mark {
    flex-basis: 40px;
    width: 40px;
    height: 40px;
    font-size: 20px;
  }

  .progress-wrap {
    width: auto;
    flex: 1;
  }

  .progress-label {
    font-size: 12px;
  }

  .icon-button {
    width: 38px;
    height: 38px;
  }

  .inventory {
    top: 67px;
    left: 14px;
    max-width: calc(100% - 28px);
  }

  .screen {
    min-height: calc(100svh - 22px);
    padding: 96px 15px 24px;
  }

  .start-content h1 span {
    font-size: clamp(42px, 13vw, 64px);
  }

  .start-decor {
    right: 4%;
    bottom: 6%;
  }

  .scene-heading {
    margin-bottom: 10px;
  }

  .scene {
    min-height: 430px;
    max-height: 68vh;
  }

  .office-window {
    left: 3%;
    width: 30%;
  }

  .desk {
    left: 5%;
    right: 4%;
  }

  .computer {
    top: 31%;
    left: 34%;
    width: 40%;
    height: 24%;
  }

  .office-chair {
    right: 1%;
    width: 23%;
  }

  .plant {
    transform: scale(0.75);
    transform-origin: bottom left;
  }

  .calendar {
    left: 4%;
    transform: scale(0.8);
  }

  .badge {
    left: 24%;
  }

  .train-window {
    left: 9%;
    width: 65%;
  }

  .timing-game {
    left: 4%;
    right: 4%;
    bottom: 4%;
    padding: 12px;
  }

  .timing-game p {
    font-size: 15px;
  }

  .route-map {
    right: 2%;
    width: 18%;
  }

  .handles {
    left: 8%;
    right: 8%;
  }

  .handles span {
    transform: scale(0.75);
    transform-origin: top;
  }

  .front-door {
    left: 3%;
    width: 32%;
  }

  .hooks,
  .shoe-cabinet {
    left: 36%;
  }

  .shoe-cabinet {
    width: 24%;
  }

  .fridge-wrap {
    right: 2%;
    width: 35%;
  }

  .floor-mat {
    left: 7%;
  }

  .chest-screen {
    justify-content: flex-start;
    padding-top: 112px;
  }

  .chest-copy {
    margin-bottom: 18px;
  }

  .chest-copy h2 {
    font-size: 38px;
  }

  .chest-copy p:last-child {
    font-size: 16px;
  }

  .chest-grid {
    gap: 9px;
  }

  .card-back,
  .card-front {
    border-width: 3px;
    box-shadow: 4px 4px 0 #05030d;
  }

  .pixel-chest {
    border-width: 5px;
  }

  .card-front {
    padding: 8px;
  }

  .card-front b {
    font-size: 15px;
  }

  .card-front small {
    font-size: 11px;
  }

  .prize-actions {
    flex-direction: column;
  }

  .prize-actions .pixel-button {
    width: min(280px, 100%);
  }

  .modal-panel {
    padding: 30px 20px 24px;
  }
}

@media (max-height: 720px) and (min-width: 721px) {
  .screen {
    padding-top: 88px;
  }

  .scene {
    min-height: 390px;
  }

  .scene-heading {
    margin-bottom: 8px;
  }

  .chest-copy {
    margin-bottom: 14px;
  }

  .chest-grid {
    width: 610px;
  }

  .prize-icon {
    width: 120px;
  }
}

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