/* ============ tokens ============ */
:root {
  --bg: #0b0e13;
  --card: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.02));
  --card-solid: #141821;
  --line: rgba(255,255,255,.12);
  --line-soft: rgba(255,255,255,.06);
  --text: #eef2f6;
  --muted: #8a919b;
  --accent: #74e6ac;            /* 绿色坏蛋的绿 */
  --accent-ink: #062615;
  --btn-grad: linear-gradient(180deg, #9af2c4, #4fd393);
  --shadow: 0 10px 30px rgba(0,0,0,.35);
  /* ink used on top of the pets' pastel colours, in both themes */
  --ink: #1b1f27;
  --ink-soft: rgba(27, 31, 39, .62);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --serif: Georgia, "Times New Roman", "Songti SC", serif;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f2f3f1;
  --card: linear-gradient(180deg, #ffffff, #fbfbfa);
  --card-solid: #ffffff;
  --line: rgba(20, 24, 30, .12);
  --line-soft: rgba(20, 24, 30, .06);
  --text: #15181e;
  --muted: #6a717b;
  --accent: #1f9d63;
  --accent-ink: #ffffff;
  --btn-grad: linear-gradient(180deg, #2fbf7b, #1b9459);
  --shadow: 0 10px 30px rgba(20, 30, 40, .08);
  color-scheme: light;
}

/* ============ base ============ */
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  transition: background-color .3s, color .3s;
}
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

/* ============ splash ============ */
#splash {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center;
  background: var(--bg); transition: opacity .6s ease, visibility .6s;
}
#splash.hide { opacity: 0; visibility: hidden; }
.splash-card {
  text-align: center; padding: 26px 34px; border-radius: 18px;
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow);
  animation: pop .7s cubic-bezier(.2, 1.4, .4, 1) both;
}
.splash-name { font-size: 30px; font-weight: 800; color: var(--accent); letter-spacing: 1px; }
.splash-tag { margin-top: 12px; font-size: 18px; font-weight: 700; color: var(--accent); }
.splash-hello { margin-top: 16px; font-size: 13px; color: var(--muted); }
@keyframes pop { from { opacity: 0; transform: scale(.92) translateY(8px); } to { opacity: 1; transform: none; } }

/* ============ chrome: progress, language + theme, dots ============ */
#progress {
  position: fixed; top: 0; left: 0; height: 2px; width: 0; z-index: 50;
  background: var(--accent); transition: width .15s linear;
}
/* plain type in the corner, no container */
.toolbar {
  position: fixed; top: 24px; right: 30px; z-index: 40;
  display: flex; align-items: center; gap: 26px;
}
.lang-switch { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--muted); }
.lang-switch span { opacity: .45; font-weight: 300; }
.lang-switch button {
  border: 0; background: none; padding: 4px 0; font-size: 13px; letter-spacing: .06em;
  color: var(--muted); transition: color .2s;
}
.lang-switch button:hover { color: var(--text); }
:root[data-lang="zh"] [data-set-lang="zh"], :root[data-lang="en"] [data-set-lang="en"] { color: var(--text); font-weight: 700; }
/* half-filled disc: turns over when the theme flips */
.theme-btn {
  width: 22px; height: 22px; padding: 0; border: 0; background: none; color: var(--text);
  display: grid; place-items: center; transition: transform .6s cubic-bezier(.3, 1.3, .5, 1);
}
.theme-btn svg { width: 18px; height: 18px; }
:root[data-theme="light"] .theme-btn { transform: rotate(180deg); }

#dots {
  position: fixed; right: 18px; top: 50%; transform: translateY(-50%); z-index: 30;
  display: flex; flex-direction: column; gap: 10px;
}
#dots button {
  width: 11px; height: 11px; padding: 0; border-radius: 50%;
  border: 1.5px solid var(--muted); background: transparent; opacity: .7;
  transition: all .25s;
}
#dots button:hover { opacity: 1; border-color: var(--accent); }
#dots button.on { width: 13px; height: 13px; margin-left: -1px; background: var(--accent); border-color: var(--accent); opacity: 1; box-shadow: 0 0 10px var(--accent); }

#toTop {
  position: fixed; right: 18px; bottom: 18px; z-index: 30; width: 44px; height: 44px;
  border-radius: 50%; border: 1px solid var(--line); background: var(--card-solid);
  display: grid; place-items: center; box-shadow: var(--shadow);
  opacity: 0; transform: translateY(10px); pointer-events: none; transition: opacity .3s, transform .3s, border-color .2s;
}
#toTop svg { width: 18px; height: 18px; stroke: var(--text); }
#toTop.show { opacity: 1; transform: none; pointer-events: auto; }
#toTop:hover { border-color: var(--accent); }
#toTop:hover svg { stroke: var(--accent); }

#toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 60; transform: translate(-50%, 20px);
  padding: 10px 18px; border-radius: 999px; background: var(--card-solid); border: 1px solid var(--line);
  box-shadow: var(--shadow); font-size: 14px; opacity: 0; pointer-events: none; transition: all .25s;
  max-width: calc(100vw - 32px); text-align: center;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ============ pages ============ */
#pages {
  height: 100vh; height: 100dvh; overflow-y: auto; overflow-x: hidden;
  scroll-snap-type: y proximity; scroll-behavior: smooth;
  scrollbar-width: none;
}
#pages::-webkit-scrollbar { display: none; }
@media (min-width: 900px) and (min-height: 640px) {
  #pages { scroll-snap-type: y mandatory; }
}
.page {
  position: relative; min-height: 100vh; min-height: 100dvh; scroll-snap-align: start;
  display: flex; align-items: center; justify-content: center;
  padding: 80px 56px 70px;
}
.wrap { width: 100%; max-width: 1080px; }
.sec-head { text-align: center; margin: 0 auto 36px; }
.sec-head h2 { margin: 0; font-size: clamp(28px, 3.4vw, 36px); font-weight: 900; letter-spacing: 1px; }

/* the small, widely tracked name under a big one */
.subname { display: block; margin-top: 12px; margin-right: -.42em; font-size: 14px; font-weight: 500; letter-spacing: .42em; color: var(--muted); }

/* ============ hero ============ */
.hero {
  display: flex; align-items: center; justify-content: center; gap: clamp(32px, 6vw, 80px);
  width: 100%; max-width: 1000px;
}
.avatar-wrap {
  flex: none; width: clamp(180px, 22vw, 260px); aspect-ratio: 1; border-radius: 50%;
  padding: 8px; background: var(--card-solid); border: 1px solid var(--line);
  box-shadow: 0 0 0 10px color-mix(in srgb, var(--card-solid) 60%, transparent), var(--shadow);
}
.avatar { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; background: #fff; }
.name { margin: 0; font-size: clamp(40px, 6.2vw, 62px); line-height: 1.1; font-weight: 900; letter-spacing: 2px; }
.name .subname { margin-top: 14px; font-size: clamp(13px, 1.3vw, 15px); line-height: 1; }
.tagline { margin: 24px 0 0; font-size: clamp(19px, 2.2vw, 23px); font-weight: 800; color: var(--accent); }
.intro { margin: 12px 0 0; font-size: 15px; line-height: 1.8; color: color-mix(in srgb, var(--text) 78%, var(--muted)); }
.intro .now { display: block; margin-top: 2px; font-size: 14px; color: var(--muted); }
.actions { margin-top: 28px; display: flex; gap: 12px; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 11px 20px; border-radius: 999px; font-weight: 700; font-size: 15px;
  text-decoration: none; border: 1px solid var(--line); transition: transform .15s, box-shadow .2s, border-color .2s, background .2s;
}
.btn:hover { transform: translateY(-2px); }
.btn.primary { background: var(--btn-grad); color: var(--accent-ink); border-color: transparent; box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 35%, transparent); }
.btn.ghost { background: var(--card-solid); color: var(--text); }
.btn.ghost:hover { border-color: var(--accent); }

.scroll-hint {
  position: absolute; left: 50%; bottom: 20px; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  font-size: 12px; color: var(--muted); text-decoration: none;
}
.scroll-hint svg { width: 22px; height: 22px; stroke: var(--muted); animation: bob 1.8s ease-in-out infinite; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(5px); } }

/* ============ pets: three lit vitrines, one colour each ============ */
/* each pet's colour: its vitrine, its face in the picker and (via pets.js) its stage */
.t-frog { --tint: #d5e3ee; --tint-deep: #bccfde; }
.t-kaka { --tint: #ddd3ec; --tint-deep: #c9bce0; }
.t-bean { --tint: #c6e6d8; --tint-deep: #a9d5c2; }

.shelf { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.vitrine { position: relative; overflow: hidden; border-radius: 28px; background: var(--tint); color: var(--ink); }
.vitrine-link { position: relative; display: flex; flex-direction: column; height: 100%; color: inherit; text-decoration: none; }
.vitrine-link:focus-visible { outline: none; }
.vitrine:has(.vitrine-link:focus-visible) { outline: 2px solid var(--accent); outline-offset: 4px; }
/* the figure stands on a floor, under a soft light from above */
.figure {
  position: relative; height: clamp(250px, 38vh, 330px);
  background:
    radial-gradient(ellipse 70% 80% at 50% -10%, rgba(255,255,255,.65), rgba(255,255,255,0) 70%),
    linear-gradient(to bottom, transparent 80%, var(--tint-deep) 80%);
}
.figure::after {                    /* contact shadow */
  content: ""; position: absolute; left: 50%; bottom: 13%; width: 46%; height: 7%;
  transform: translateX(-50%); border-radius: 50%;
  background: radial-gradient(closest-side, rgba(27,31,39,.28), rgba(27,31,39,0));
}
.figure img {
  position: absolute; left: 50%; bottom: 15%; height: 82%; width: auto; z-index: 1;
  transform: translateX(-50%); transition: opacity .18s ease, transform .35s cubic-bezier(.3, 1.6, .5, 1);
}
.figure.tall img { height: 74%; }         /* the frog is a tall one; give it the same headroom as the others */
.figure .react { opacity: 0; }
/* it notices you: swaps to an action pose and hops */
.vitrine:hover .figure .rest, .vitrine:focus-within .figure .rest { opacity: 0; }
.vitrine:hover .figure .react, .vitrine:focus-within .figure .react { opacity: 1; }
.vitrine:hover .figure img, .vitrine:focus-within .figure img { transform: translateX(-50%) translateY(-8px); }

.label { padding: 6px 26px 30px; }
.label h3 { margin: 0; display: flex; align-items: baseline; gap: 12px; font-size: 28px; font-weight: 900; letter-spacing: 1px; }
.label h3 em { font-family: var(--serif); font-style: italic; font-weight: 400; font-size: 19px; letter-spacing: 0; color: var(--ink-soft); }
:root[data-lang="en"] .label h3 em { display: none; }
.label p { margin: 10px 0 0; font-size: 14px; line-height: 1.75; color: var(--ink-soft); }

/* ============ playground ============ */
.stage-wrap { position: relative; }
#stage {
  --tint: #d5e3ee; --tint-deep: #bccfde;
  position: relative; height: clamp(340px, 56vh, 520px); border-radius: 28px; overflow: hidden;
  background:
    radial-gradient(ellipse 55% 85% at 50% -15%, rgba(255,255,255,.6), rgba(255,255,255,0) 70%),
    var(--tint);
  transition: background-color .4s;
  user-select: none; -webkit-user-select: none; touch-action: pan-y;
}
.stage-floor { position: absolute; left: 0; right: 0; bottom: 0; height: 12%; background: var(--tint-deep); transition: background-color .4s; }
#stageLoading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--ink-soft); font-size: 14px; }

/* top-left of the stage: the three faces, then who is on stage */
.stage-head { position: absolute; left: 20px; top: 18px; z-index: 5; display: flex; align-items: center; gap: 18px; }
.picker { display: flex; gap: 10px; }
.picker button {
  width: 46px; height: 46px; padding: 0; border: 0; border-radius: 50%; overflow: hidden;
  background: var(--tint); box-shadow: inset 0 0 0 1px rgba(27,31,39,.08);
  opacity: .62; filter: saturate(.75); transition: opacity .2s, filter .2s, transform .25s cubic-bezier(.3, 1.5, .5, 1);
}
.picker button img { width: 100%; height: 100%; object-fit: cover; display: block; }
.picker button:hover { opacity: .85; filter: none; transform: translateY(-2px); }
.picker button.on { opacity: 1; filter: none; outline: 2px solid var(--ink); outline-offset: 3px; }
.stage-name { display: flex; align-items: baseline; gap: 10px; color: var(--ink); }
.stage-name b { font-size: 19px; font-weight: 900; letter-spacing: 1px; }
.stage-name em { font-family: var(--serif); font-style: italic; font-size: 15px; color: var(--ink-soft); }

/* top-right of the stage: quiet text controls */
.stage-tools {
  position: absolute; right: 24px; top: 30px; z-index: 5;
  display: flex; align-items: baseline; gap: 22px; font-size: 13px; color: var(--ink-soft);
}
.stage-tools button { border: 0; background: none; padding: 0; font-size: 13px; color: inherit; transition: color .2s; }
.stage-tools button:hover { color: var(--ink); }
#soundBtn .s-off { display: none; }
#soundBtn:not(.on) .s-on { display: none; }
#soundBtn:not(.on) .s-off { display: inline; }

/* pets on stage */
.pet { position: absolute; left: 0; top: 0; touch-action: none; cursor: grab; will-change: transform; }
.pet.dragging { cursor: grabbing; }
.pet-body { position: absolute; inset: 0; }
.pet-body img, .pet-body canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; pointer-events: none; -webkit-user-drag: none; }
.pet-shadow {
  position: absolute; left: 0; top: 0; border-radius: 50%; pointer-events: none;
  background: radial-gradient(closest-side, rgba(27, 31, 39, .3), rgba(27, 31, 39, 0));
}
.pet-bubble {
  position: absolute; left: 0; top: 0; z-index: 4; padding: 6px 13px; border-radius: 999px; white-space: nowrap;
  background: var(--ink); color: #fff; font-size: 13px; font-weight: 700; pointer-events: none;
  font-family: var(--font); box-shadow: 0 6px 14px rgba(27,31,39,.2);
}
.burst { position: absolute; border-radius: 50%; pointer-events: none; border: 3px solid rgba(255,255,255,.9); animation: burst .45s ease-out forwards; }
@keyframes burst { from { transform: translate(-50%, -50%) scale(.2); opacity: 1; } to { transform: translate(-50%, -50%) scale(1.4); opacity: 0; } }


/* ============ about: who I am on the left, how to reach me on the right ============ */
.end-inner {
  width: 100%; max-width: 980px;
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 48px 64px;
}
.end-name { display: block; font-size: clamp(36px, 4.4vw, 46px); line-height: 1.1; font-weight: 900; letter-spacing: 1.5px; }
.end-tag { margin: 26px 0 0; font-size: 22px; color: var(--muted); }
.end-role { margin: 8px 0 0; font-size: 15px; color: color-mix(in srgb, var(--text) 70%, var(--muted)); }
.end-now { margin: 4px 0 0; font-size: 14px; color: var(--muted); }
.end-domain { display: inline-block; margin-top: 30px; font-size: 13px; color: var(--accent); text-decoration: none; }
.end-domain:hover { text-decoration: underline; text-underline-offset: 4px; }
.end-meta { margin: 10px 0 0; font-size: 12px; letter-spacing: .04em; color: var(--muted); }

.end-contact { min-width: 360px; padding-left: 48px; border-left: 1px solid color-mix(in srgb, var(--accent) 24%, transparent); }
.end-contact h3 { margin: 0 0 12px 12px; font-size: 15px; font-weight: 700; }
.contacts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.contact {
  display: flex; align-items: baseline; gap: 18px; width: 100%; padding: 11px 12px;
  border: 0; border-radius: 10px; background: none; text-align: left; text-decoration: none; cursor: pointer;
  transition: background .2s;
}
.contact:hover { background: var(--line-soft); }
.c-label { flex: none; width: 56px; font-size: 15px; font-weight: 600; color: var(--text); }
:root[data-lang="en"] .c-label { width: 98px; }   /* "Xiaohongshu" */
.c-value { font-size: 14px; font-weight: 700; color: var(--accent); overflow-wrap: anywhere; }
.c-hint { margin-left: auto; padding-left: 12px; font-size: 12px; color: var(--muted); opacity: 0; transition: opacity .2s; }
.c-hint svg { width: 14px; height: 14px; stroke: var(--accent); display: block; }
.contact:hover .c-hint, .contact:focus-visible .c-hint { opacity: 1; }

/* ============ responsive ============ */
@media (max-width: 960px) {
  .shelf { gap: 14px; }
  .label { padding: 6px 20px 26px; }
  .label h3 { font-size: 24px; }
  .end-contact { min-width: 0; }
}
@media (max-width: 760px) {
  .page { padding: 76px 16px 64px; }
  .toolbar { top: 18px; right: 18px; gap: 20px; }
  .hero { flex-direction: column; text-align: center; gap: 26px; }
  .actions { justify-content: center; }
  .avatar-wrap { width: 170px; }
  .shelf { grid-template-columns: 1fr; }
  .figure { height: 250px; }
  #dots { display: none; }                  /* no room beside the content on a phone */
  #toTop { right: 12px; bottom: 12px; width: 40px; height: 40px; }
  .stage-head { left: 14px; top: 14px; gap: 12px; }
  .picker { gap: 8px; }
  .picker button { width: 40px; height: 40px; }
  .stage-name em { display: none; }
  /* the stage is too narrow for controls in its corner: put them under it, in page colours */
  .stage-tools { position: static; margin-top: 16px; justify-content: center; flex-wrap: wrap; color: var(--muted); }
  .stage-tools button:hover { color: var(--text); }
  .end-inner { grid-template-columns: 1fr; text-align: center; }
  .c-hint { display: none; }                /* hover-only hint; phones have no hover */
  .end-contact { padding: 32px 0 0; border-left: 0; border-top: 1px solid color-mix(in srgb, var(--accent) 24%, transparent); text-align: left; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  #pages { scroll-behavior: auto; }
}
