@font-face {
  font-family: "Fusion Pixel 12px";
  src: url("assets/fonts/fusion-pixel-12px-zh_hans.woff2") format("woff2");
  font-display: swap;
}

img { max-width: 100%; }
[hidden] { display: none !important; }

:root {
  color-scheme: dark;
  --night: #26215C;
  --panel: #3C3489;
  --panel-hi: #534AB7;
  --line: #AFA9EC;
  --line-dim: #7F77DD;
  --text: #EEEDFE;
  --text-dim: #CECBF6;
  --gold: #FAC775;
  --mint: #5DCAA5;
  --pink: #ED93B1;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px;
  overflow: hidden;
  background: var(--night);
  color: var(--text);
  font: 12px/1.7 "Pixelify Sans", "Fusion Pixel 12px", "Zpix", "Microsoft YaHei", "PingFang SC", sans-serif;
  -webkit-font-smoothing: none;
  font-smooth: never;
}
:root:lang(en) body { font-family: "Pixelify Sans", "Fusion Pixel 12px", "Zpix", "Microsoft YaHei", "PingFang SC", sans-serif; font-size: 16px; }
button { border-radius: 0; color: inherit; font: inherit; cursor: pointer; }
button:focus-visible, a:focus-visible, .pixel-window:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}
button { -webkit-tap-highlight-color: transparent; }
.pixel { font-family: "Pixelify Sans", "Fusion Pixel 12px", "Zpix", "Microsoft YaHei", "PingFang SC", sans-serif; }
.console {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  grid-template-rows: 70px minmax(220px, 1fr) 184px;
  width: min(1100px, 100%);
  height: min(660px, calc(100% - 36px));
  flex-shrink: 0;
  min-height: 0;
  border: 3px solid var(--line);
  background: var(--panel);
}
.site-footer { flex-shrink: 0; width: min(1100px, 100%); color: var(--text-dim); text-align: center; font-size: 12px; line-height: 24px; overflow-wrap: anywhere; }
:root:lang(en) .site-footer { font-size: 13px; }
#windows { position: fixed; }
.status-bar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 12px 26px;
  border-bottom: 3px solid var(--line);
}
.identity { display: flex; align-items: baseline; gap: 18px; }
.player-name { font-size: 30px; font-weight: 600; letter-spacing: 2px; line-height: 1; }
.level { color: var(--text-dim); font-size: 19px; white-space: nowrap; }
.health { display: flex; align-items: center; gap: 6px; }
.health > .pixel { margin-right: 7px; font-size: 21px; }
.hp-cell { width: 17px; height: 19px; border: 3px solid var(--mint); }
.hp-cell.filled { background: var(--mint); }
.status-controls { display: flex; align-items: center; gap: 16px; }
.language-toggle { min-height: 32px; padding: 0 8px; border: 3px solid var(--line); background: var(--panel); color: var(--text-dim); font-size: 12px; white-space: nowrap; }
.language-toggle .pixel { font-size: 18px; }
.language-toggle .active { color: var(--gold); }
.language-toggle:hover { background: var(--panel-hi); }
.clock { min-width: 68px; font-size: 25px; text-align: right; line-height: 1; }
.menu {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  min-width: 0;
  padding: 16px 12px;
  border-right: 3px solid var(--line);
}
.menu-button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 46px;
  padding: 5px 8px;
  border: 3px solid var(--line);
  background: var(--panel);
  text-align: left;
  font-size: 24px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.menu-label { min-width: 0; }
.menu-button:hover, .menu-button.selected { background: var(--panel-hi); }
.menu-button.selected { color: var(--gold); }
.menu-cursor { width: 13px; flex-shrink: 0; font-size: 12px; visibility: hidden; }
.selected .menu-cursor { visibility: visible; }
.menu-button.locked { color: var(--text-dim); }
.menu-button.locked.selected { color: var(--gold); }
.pixel-lock { position: relative; width: 12px; height: 10px; margin-left: auto; background: var(--line-dim); }
.pixel-lock::before { content: ""; position: absolute; left: 2px; top: -6px; width: 8px; height: 8px; border: 2px solid var(--line-dim); }
.pixel-lock::after { content: ""; position: absolute; left: 5px; top: 3px; width: 2px; height: 4px; background: var(--night); }
.scene { position: relative; min-width: 0; min-height: 220px; overflow: hidden; background: var(--night); isolation: isolate; }
.scenery, .stars { position: absolute; inset: 0; pointer-events: none; }
.scene-control { min-width: 28px; min-height: 28px; padding: 0; border: 0; background: none; pointer-events: auto; touch-action: manipulation; }
.scene-control:hover { translate: 0 -2px; }
.stars { z-index: 1; }
.star { position: absolute; width: 28px; height: 28px; margin: -12px; }
.star-dot { position: absolute; left: calc(50% - 1.5px); top: calc(50% - 1.5px); width: 3px; height: 3px; background: var(--line-dim); }
.star.gold .star-dot { background: var(--gold); animation: twinkle 5s steps(2, end) infinite; animation-delay: inherit; }
.star.gold .star-dot::before, .star.gold .star-dot::after { position: absolute; content: ""; background: inherit; }
.star.gold .star-dot::before { width: 9px; height: 3px; left: -3px; }
.star.gold .star-dot::after { width: 3px; height: 9px; top: -3px; }
.star.popping { animation: star-pop 200ms steps(2, end); }
.meteor { position: absolute; left: 85%; top: 8%; width: 4px; height: 4px; background: var(--text); box-shadow: 4px -4px 0 var(--text), 8px -8px 0 var(--text), 12px -12px 0 var(--text); animation: shooting-star 900ms steps(9, end) forwards; }
.moon {
  position: absolute; top: 32px; right: 12%; width: 50px; height: 58px; z-index: 2;
}
.moon-shape { position: absolute; inset: 0; background: var(--gold); clip-path: polygon(24% 0, 76% 0, 76% 11%, 88% 11%, 88% 24%, 100% 24%, 100% 76%, 88% 76%, 88% 89%, 76% 89%, 76% 100%, 24% 100%, 24% 89%, 12% 89%, 12% 76%, 0 76%, 0 24%, 12% 24%, 12% 11%, 24% 11%); }
.moon-shape::after { content: ""; position: absolute; left: 16px; top: -6px; width: 50px; height: 52px; background: var(--night); clip-path: inherit; }
.moon.half .moon-shape::after { left: 25px; top: 0; width: 25px; height: 58px; clip-path: none; }
.moon.full .moon-shape::after { display: none; }
.distant-hill { position: absolute; bottom: 45px; height: 54px; background: var(--panel); z-index: 3; }
.hill-left { left: 0; width: 45%; clip-path: polygon(0 40%, 15% 40%, 15% 20%, 40% 20%, 40% 0, 65% 0, 65% 40%, 82% 40%, 82% 65%, 100% 65%, 100% 100%, 0 100%); }
.hill-right { right: 0; width: 39%; clip-path: polygon(0 80%, 20% 80%, 20% 40%, 40% 40%, 40% 20%, 70% 20%, 70% 0, 100% 0, 100% 100%, 0 100%); }
.tree { position: absolute; left: 9%; bottom: 46px; width: 92px; height: 158px; z-index: 4; }
.tree i, .house i { display: block; position: absolute; }
.tree-trunk { left: 40px; bottom: 0; width: 15px; height: 62px; border: 3px solid var(--line-dim); background: var(--panel-hi); }
.tree-crown { background: var(--mint); clip-path: polygon(36% 0, 64% 0, 64% 18%, 76% 18%, 76% 36%, 88% 36%, 88% 58%, 100% 58%, 100% 100%, 0 100%, 0 58%, 12% 58%, 12% 36%, 24% 36%, 24% 18%, 36% 18%); }
.crown-top { left: 18px; top: 0; width: 58px; height: 55px; }
.crown-mid { left: 8px; top: 30px; width: 78px; height: 58px; }
.crown-low { left: 0; top: 61px; width: 94px; height: 60px; }
.tree.shaking .tree-crown { animation: tree-shake 450ms steps(1, end); }
.house { position: absolute; right: 9%; bottom: 46px; width: 138px; height: 144px; z-index: 4; }
.chimney { right: 23px; top: 0; width: 20px; height: 43px; border: 3px solid var(--line-dim); background: var(--panel); }
.smoke-plume { position: absolute; top: 0; right: 30px; width: 6px; height: 6px; }
.smoke { position: absolute; bottom: 0; width: 6px; height: 6px; background: var(--line-dim); animation: chimney-smoke 4800ms steps(4, end) forwards; }
.roof { height: 17px; border: 3px solid var(--line-dim); border-bottom: 0; background: var(--panel-hi); }
.roof-top { top: 11px; left: 46px; width: 46px; }
.roof-mid { top: 25px; left: 25px; width: 88px; }
.roof-low { top: 39px; left: 4px; width: 130px; border-bottom: 3px solid var(--line-dim); }
.house-wall { position: absolute; top: 56px; left: 15px; width: 108px; height: 83px; border: 3px solid var(--line-dim); border-top: 0; background: var(--panel); }
.house-window { position: absolute; top: 18px; left: 12px; width: 30px; height: 30px; }
.lit-window { inset: 0; width: 30px; height: 30px; border: 3px solid var(--line-dim); background: var(--gold); }
.house-window[aria-pressed="false"] .lit-window { background: var(--panel); border-color: var(--line-dim); }
.lit-window::before { content: ""; position: absolute; left: 10px; top: 0; width: 3px; height: 100%; background: var(--panel); }
.lit-window::after { content: ""; position: absolute; left: 0; top: 10px; width: 100%; height: 3px; background: var(--panel); }
.door-button { position: absolute; right: 12px; bottom: 0; width: 29px; height: 54px; }
.house-door { right: 0; bottom: 0; width: 29px; height: 54px; border: 3px solid var(--line-dim); border-bottom: 0; background: var(--night); }
.door-button.knocking .house-door { animation: door-knock 300ms steps(1, end); }
.house-door::after { position: absolute; content: ""; right: 4px; top: 27px; width: 3px; height: 3px; background: var(--gold); }
.house-step { left: 8px; bottom: 0; width: 122px; height: 8px; background: var(--line-dim); }
.ground { position: absolute; inset: auto 0 0; height: 46px; border-top: 3px solid var(--line-dim); background: var(--panel-hi); z-index: 5; }
.grass { position: absolute; top: -9px; width: 4px; height: 6px; background: var(--mint); box-shadow: 6px 3px 0 var(--mint); }
.grass-one { left: 5%; }.grass-two { left: 37%; }.grass-three { right: 4%; }
.ground-stone { position: absolute; width: 10px; height: 3px; background: var(--line-dim); }
.stone-one { top: 16px; left: 18%; }.stone-two { top: 28px; left: 53%; }.stone-three { top: 12px; right: 14%; }
.scene-drop { position: absolute; bottom: 46px; width: 28px; height: 28px; margin-left: -14px; z-index: 6; pointer-events: none; }
.scene-drop.collectable { pointer-events: auto; }
.drop-shape { position: absolute; bottom: 0; left: 50%; transform: translateX(-50%); width: 8px; height: 8px; background: var(--mint); clip-path: polygon(25% 0, 100% 0, 100% 75%, 75% 75%, 75% 100%, 0 100%, 0 25%, 25% 25%); }
.scene-drop.apple .drop-shape { width: 10px; height: 10px; background: var(--pink); clip-path: none; }
.scene-drop.apple .drop-shape::before { content: ""; position: absolute; left: 4px; top: -4px; width: 2px; height: 4px; background: var(--mint); }
.scene-drop.falling { animation: item-fall 500ms steps(5, end); }
.scene-pet {
  position: absolute; left: 0; bottom: 46px; z-index: 7;
  width: 86px; height: 128px; padding: 0; overflow: visible;
  border: 0; background: none; touch-action: manipulation;
  will-change: transform;
}
.scene-pet img { position: absolute; bottom: 0; left: 50%; display: block; width: auto; max-width: none; height: 128px; transform: translateX(-50%); pointer-events: none; user-select: none; }
.dialogue {
  grid-column: 1 / -1; position: relative;
  display: flex; flex-direction: column; gap: 4px; min-width: 0; min-height: 0;
  padding: 12px 22px 18px; border: 0; border-top: 3px solid var(--line);
  background: var(--panel); text-align: left; overflow: hidden;
}
.dialogue:focus-visible { outline-offset: -7px; }
.speaker { flex-shrink: 0; color: var(--pink); font-size: 24px; font-weight: 600; line-height: 1.5; }
.dialogue-text { display: block; flex: 1; min-height: 0; width: 100%; padding-right: 22px; white-space: pre-wrap; overflow-wrap: anywhere; overflow-y: auto; overscroll-behavior: contain; font-size: 24px; line-height: 1.5; }
.dialogue-next { position: absolute; right: 24px; bottom: 16px; color: var(--gold); font-size: 12px; animation: next-line 1.1s steps(2, end) infinite; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; margin: -1px; padding: 0; border: 0; }
.pixel-window {
  position: fixed; display: flex; flex-direction: column;
  width: 600px; max-width: calc(100% - 32px); max-height: 80%;
  border: 3px solid var(--line); background: var(--panel);
  box-shadow: 6px 6px 0 rgba(0,0,0,.35);
}
.pixel-window.pet-window { width: 560px; }
.pixel-window.contact-window { width: 480px; }
.window-titlebar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 48px; flex-shrink: 0; padding-left: 14px;
  background: var(--line); color: var(--night); cursor: grab; touch-action: none; user-select: none;
}
.window-title { min-width: 0; margin: 0; font-size: 24px; font-weight: 600; overflow-wrap: anywhere; }
.window-titlebar.dragging { cursor: grabbing; }
.close-window { width: 44px; height: 44px; flex-shrink: 0; border: 3px solid var(--line); background: var(--panel); color: var(--text); font: 24px/1 "Pixelify Sans", sans-serif; }
.close-window:hover { color: var(--gold); background: var(--panel-hi); }
.window-content { min-height: 0; padding: 16px; overflow-y: auto; overscroll-behavior: contain; overflow-wrap: anywhere; }
.works-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 16px; }
.work-card { min-width: 0; margin: 0; }
.work-card img { display: block; width: 100%; height: 150px; border: 3px solid var(--line); background: var(--night); object-fit: contain; }
.work-name { margin: 8px 0 0; font-size: 24px; font-weight: 400; overflow-wrap: anywhere; }
.work-note { margin: 1px 0 0; color: var(--text-dim); font-size: 12px; }
:root:lang(en) .work-name { font-size: 24px; }
:root:lang(en) .work-note { font-size: 14px; }
.pet-profile { display: grid; grid-template-columns: 135px minmax(0, 1fr); align-items: center; gap: 16px; }
.pet-portrait { display: block; width: 135px; height: 200px; object-fit: contain; }
.pet-copy h3 { margin: 0 0 12px; color: var(--pink); font-size: 24px; }
.pet-copy p { margin: 0 0 9px; font-size: 24px; overflow-wrap: anywhere; }
:root:lang(en) .pet-copy p { font-size: 22px; }
.pet-copy p, .window-content > p { white-space: pre-wrap; }
.pat-button { grid-column: 1 / -1; justify-self: stretch; min-height: 44px; margin-top: 6px; border: 3px solid var(--line); background: var(--panel-hi); font-size: 24px; }
.pat-button:hover { color: var(--gold); }
.contact-line { margin: 0 0 12px; font-size: 24px; line-height: 1.5; }
:root:lang(en) .contact-line { font-size: 22px; }
.email-box { min-width: 0; padding: 12px; border: 3px solid var(--line); background: var(--night); }
.email-label { margin: 0 0 6px; color: var(--text-dim); font-size: 12px; }
.email-address { margin: 0; color: var(--gold); font: 24px/1.5 "Pixelify Sans", sans-serif; user-select: all; overflow-wrap: anywhere; }
.copy-failure { margin: 12px 0 0; font-size: 12px; }
:root:lang(en) .email-label, :root:lang(en) .copy-failure { font-size: 16px; }
.contact-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; }
.contact-actions .pat-button { display: flex; align-items: center; justify-content: center; flex: 1 1 180px; min-width: 0; margin: 0; padding: 6px 12px; text-align: center; text-decoration: none; overflow-wrap: anywhere; }
.contact-actions a.pat-button, .contact-actions a.pat-button:visited { color: var(--text); }
.contact-actions a.pat-button:hover { color: var(--gold); }
@keyframes twinkle { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes next-line { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(4px); } }
@keyframes chimney-smoke { from { transform: translateY(0) scale(1); } to { transform: translateY(-40px) scale(0); } }
@keyframes door-knock { 0%, 50%, 100% { transform: translateX(0); } 16%, 66% { transform: translateX(-1px); } 33%, 83% { transform: translateX(1px); } }
@keyframes star-pop { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.4); } }
@keyframes shooting-star { to { transform: translate(-280px, 160px); } }
@keyframes tree-shake { 0%, 100% { transform: translateX(0); } 14%, 43%, 71% { transform: translateX(-2px); } 28%, 57%, 86% { transform: translateX(2px); } }
@keyframes item-fall { from { transform: translate(var(--fall-x), var(--fall-y)); } to { transform: translate(0, 0); } }

@media (max-width: 700px) {
  body {
    display: block; height: auto; min-height: 100%; overflow-y: auto; overflow-x: hidden;
    padding-top: max(16px, env(safe-area-inset-top, 0px));
    padding-bottom: max(16px, env(safe-area-inset-bottom, 0px));
    padding-left: max(16px, env(safe-area-inset-left, 0px));
    padding-right: max(16px, env(safe-area-inset-right, 0px));
  }
  .console { height: auto; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 270px auto 220px; }
  .site-footer { margin-top: 12px; }
  .status-bar { grid-row: 1; flex-wrap: wrap; gap: 10px; padding: 15px 14px; }
  .identity { gap: 10px; }.player-name { font-size: 25px; }.level { font-size: 17px; }
  .health { order: 3; width: 100%; justify-content: center; gap: 4px; }.health > .pixel { margin-right: 3px; font-size: 18px; }
  .hp-cell { width: 12px; height: 15px; border-width: 2px; }
  .clock { min-width: 58px; font-size: 22px; }
  .status-controls { margin-left: auto; gap: 8px; }
  .language-toggle { min-height: 44px; }
  .scene { grid-row: 2; }
  .menu { grid-row: 3; flex-direction: row; flex-wrap: wrap; justify-content: flex-start; gap: 8px; padding: 12px; border-right: 0; border-top: 3px solid var(--line); }
  .menu-button { width: auto; min-height: 44px; gap: 6px; padding: 6px 8px; flex: 1 0 auto; }
  .pixel-lock { margin-left: 5px; }
  .scene-pet { width: 66px; height: 98px; }.scene-pet img { height: 98px; }
  .scene-control { min-width: 36px; min-height: 36px; }
  .star { width: 36px; height: 36px; margin: -16px; }
  .scene-drop { width: 36px; height: 36px; margin-left: -18px; }
  .tree { left: 6%; transform: scale(.8); transform-origin: bottom left; }
  .house { right: 5%; transform: scale(.8); transform-origin: bottom right; }
  .house-window { width: 46px; height: 46px; left: 4px; top: 10px; }
  .house-window:hover, .door-button:hover { translate: 0 -2.5px; }
  .lit-window { left: 8px; top: 8px; }
  .door-button { width: 46px; right: 4px; }
  .house-door { right: 8px; }
  .moon { right: 14%; top: 25px; transform: scale(.8); }
  .dialogue { grid-row: 4; padding: 12px 18px 24px; }
  .pixel-window, .pixel-window.pet-window, .pixel-window.contact-window { width: calc(100% - 32px); max-width: none; }
  .window-titlebar { cursor: default; touch-action: auto; }
  .window-content { padding: 16px; }
  .works-grid { gap: 18px 12px; }
  .pet-profile { grid-template-columns: 1fr; }.pet-portrait { justify-self: center; }
}
@media (min-width: 701px) and (max-height: 500px) {
  body { padding: 8px 16px; }
  .console { grid-template-rows: 56px minmax(220px, 1fr) minmax(0, 110px); }
  .menu { gap: 2px; padding: 4px 12px; }.menu-button { min-height: 36px; padding-block: 2px; }
  .dialogue { padding-top: 10px; gap: 3px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; scroll-behavior: auto !important; }
}
