/* 捏捏小鹰 · 软物研究所
   奶油底 + 木色墨，尽量把注意力留给中间那只小鹰 */

:root {
  --ink: #463b2e;
  --muted: #8b7c68;
  --faint: #a99b86;
  --line: #3a302618;
  --accent: #c08a3e;
  --gold: #e2a93b;
  --surface: #f6f2ea;
  --white: #fffdf8;
  --shadow: 0 10px 30px #6b573b14;
  --radius: 16px;
  color: var(--ink);
  font-size: 16px;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
    "Noto Sans SC", "Hiragino Sans GB", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100dvh;
  background: #f7f3ec;
  background: radial-gradient(ellipse at 50% 24%, #fdfbf7 0, #f8f5ef 32%, #f1ebe1 72%, #eae2d5 100%);
  overflow-x: hidden;
}

/* 细颗粒质感 */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 20;
  opacity: .035;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Cpath fill='%23000' filter='url(%23n)' opacity='.5' d='M0 0h180v180H0z'/%3E%3C/svg%3E");
}

button, a { -webkit-tap-highlight-color: transparent; }

button {
  font: inherit;
  border: 0;
  cursor: pointer;
  color: inherit;
  background: none;
  transition: background .2s, transform .2s, box-shadow .2s, opacity .2s;
}
button:hover { transform: translateY(-2px); }
button:active { transform: scale(.96); }
button:disabled { opacity: .3; cursor: default; transform: none; }
button:focus-visible, a:focus-visible, canvas:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

svg { width: 21px; height: 21px; stroke: currentColor; stroke-width: 1.4; fill: none;
  stroke-linecap: round; stroke-linejoin: round; }

/* ── 顶栏 ───────────────────────────────── */
.topbar {
  position: relative;
  z-index: 6;
  height: 94px;
  margin: 0 4.5%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex;
  align-items: center;
  gap: 13px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: .6px;
  color: inherit;
  text-decoration: none;
}
.brand small {
  display: block;
  margin-top: 5px;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 1.7px;
  color: var(--faint);
}
.brand-mark { font-size: 40px; line-height: 1; letter-spacing: -2px; }
.edition {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  color: var(--muted);
  letter-spacing: .5px;
}
.edition span { margin-left: 16px; font-size: 10px; letter-spacing: 1.4px; color: var(--accent); }
.header-actions { display: flex; gap: 10px; }
.round-control {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 16px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--muted);
  background: #ffffff7a;
  border: 1px solid var(--line);
  backdrop-filter: blur(6px);
}
.round-control:hover { background: #fff; color: var(--ink); }
.round-control[aria-pressed="false"] svg { opacity: .35; }

/* ── 舞台 ───────────────────────────────── */
#experience {
  position: relative;
  height: calc(100dvh - 132px);
  min-height: 620px;
  max-height: 1000px;
  max-width: 1800px;
  margin: 0 auto;
}
.headline { position: absolute; left: 4.5%; top: 6%; pointer-events: none; }
.eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  letter-spacing: .6px;
  color: var(--muted);
}
.edition-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 4px #e2a93b26;
}
.headline h1 {
  margin: 16px 0 12px;
  font-size: 46px;
  line-height: 1.22;
  letter-spacing: -1.5px;
  font-weight: 800;
}
.headline h1 em { font-style: normal; color: var(--accent); }
.headline p { margin: 0; font-size: 13px; color: var(--muted); }

.spec-label {
  position: absolute;
  z-index: 3;
  right: 4.5%;
  top: 7%;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  text-align: right;
  pointer-events: none;
}
.spec-label span { font-size: 10px; letter-spacing: 2px; color: var(--faint); }
.spec-label strong { font-size: 14px; }
.spec-label small { font-size: 10px; letter-spacing: 1.2px; color: var(--faint); }

.stage { position: absolute; inset: 0; }
#toy { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: grab; }
#toy:active { cursor: grabbing; }
/* 注意：canvas 是替换元素，只写 inset:0 不会把它拉伸到容器大小，
   它会用 width/height 属性的固有尺寸。而 renderer 把属性设成了 w*dpr，
   所以在缩放不是 100% 的屏幕上，特效层会整体放大 dpr 倍，粒子位置全偏。
   必须显式给 100%。 */
#effects { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

.floor-shadow {
  position: absolute;
  top: 60%;
  left: calc(50% - 150px);
  width: 300px;
  height: 26px;
  border-radius: 50%;
  background: #6b573b;
  opacity: .55;
  filter: blur(18px);
  transition: opacity .3s;
  pointer-events: none;
}

.loading {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--muted);
  pointer-events: none;
}
.loading span {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--gold);
  animation: pulse 1.1s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: .3; transform: scale(.7); } 50% { opacity: 1; transform: scale(1); } }

.speech {
  position: absolute;
  left: 50%;
  top: 24%;
  transform: translateX(-50%) translateY(6px);
  padding: 9px 17px;
  border-radius: 999px;
  font-size: 12.5px;
  white-space: nowrap;
  color: var(--ink);
  background: #ffffffc4;
  border: 1px solid var(--line);
  box-shadow: 0 6px 22px #6b573b12;
  backdrop-filter: blur(8px);
  opacity: 0;
  transition: opacity .3s, transform .3s;
  pointer-events: none;
}
.speech.reaction { opacity: 1; transform: translateX(-50%) translateY(0); }

.object-caption {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: baseline;
  gap: 12px;
  pointer-events: none;
}
.object-caption .name { font-size: 17px; font-weight: 800; letter-spacing: 3px; }
.object-caption #mood { font-size: 12px; color: var(--muted); }

/* ── 玩法 ───────────────────────────────── */
.tools {
  position: absolute;
  left: 4.5%;
  top: 44%;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.tool {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 150px;
  padding: 13px 16px;
  border-radius: 13px;
  font-size: 13px;
  color: var(--muted);
  background: #ffffff59;
  border: 1px solid var(--line);
  text-align: left;
}
.tool small { margin-left: auto; font-size: 10px; color: var(--faint); letter-spacing: 1px; }
.tool:hover { background: #ffffffa8; }
.tool.active { background: var(--white); color: var(--ink); box-shadow: var(--shadow); }
.tool.active svg { color: var(--accent); }

.side-note {
  position: absolute;
  right: 4.5%;
  bottom: 22%;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  text-align: right;
}
.note-symbol { color: var(--gold); font-size: 15px; }
.side-note p { margin: 0; font-size: 13px; line-height: 1.85; color: var(--muted); pointer-events: none; }
.side-note button {
  padding: 9px 15px;
  border-radius: 999px;
  font-size: 12px;
  background: #ffffff8c;
  border: 1px solid var(--line);
}
.side-note button:hover { background: var(--white); }
.side-note button span { margin-left: 6px; color: var(--accent); }

/* ── 底栏 ───────────────────────────────── */
.bottom-bar {
  position: absolute;
  left: 4.5%;
  right: 4.5%;
  bottom: 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.gesture-hint {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11.5px;
  color: var(--muted);
}
.gesture-hint #hint { max-width: 320px; }
.keycap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px; height: 26px;
  border-radius: 7px;
  font-size: 12px;
  background: #ffffff8c;
  border: 1px solid var(--line);
}
.gesture-hint button { font-size: 11.5px; padding: 6px 10px; border-radius: 8px; color: var(--muted); }
.gesture-hint button:hover { background: #ffffff8c; color: var(--ink); }

.collect {
  display: flex;
  align-items: center;
  gap: 18px;
  padding-left: 22px;
  border-radius: 999px;
  background: var(--white);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.count-label { font-size: 12px; color: var(--muted); }
.count-label b { font-size: 17px; color: var(--accent); }
.collect-label {
  padding: 15px 22px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  color: #fffdf8;
  background: #5c4a33;
}
.collect-label span { margin-left: 6px; color: var(--gold); }
.collect:hover { transform: translateY(-2px); }

.creator-contact {
  display: flex;
  justify-content: center;
  gap: 22px;
  padding: 0 5% 16px;
  font-size: 11px;
  color: var(--faint);
}

/* ── 弹窗 ───────────────────────────────── */
dialog {
  border: 0;
  padding: 0;
  color: var(--ink);
  background: transparent;
  max-width: 100vw;
}
dialog::backdrop { background: #4a3d2a4d; backdrop-filter: blur(5px); }

.settings-dialog .panel,
.card-dialog .panel {
  position: relative;
  width: min(560px, 92vw);
  max-height: 88dvh;
  overflow-y: auto;
  padding: 28px 30px 24px;
  border-radius: 22px;
  background: var(--surface);
  box-shadow: 0 30px 70px #4a3d2a33;
}
.card-dialog .panel { width: min(480px, 92vw); text-align: center; }
.card-dialog .eyebrow { justify-content: center; margin-top: 4px; }
.card-dialog h2 { margin: 10px 0 0; font-size: 21px; letter-spacing: -.3px; }

.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.panel-heading h2 { margin: 10px 0 4px; font-size: 22px; letter-spacing: -.4px; }
.close {
  width: 34px; height: 34px; border-radius: 50%;
  font-size: 19px; line-height: 1; color: var(--muted);
  background: #ffffff8c; border: 1px solid var(--line);
}
.close:hover { background: var(--white); color: var(--ink); }

.setting-group { margin-top: 24px; }
.setting-group h3, .setting-row h3 { margin: 0; font-size: 13.5px; font-weight: 700; }
.setting-group h3 span { margin-left: 8px; font-size: 11.5px; font-weight: 500; color: var(--accent); }
.setting-group p, .setting-row p { margin: 5px 0 0; font-size: 11.5px; color: var(--muted); }

.swatches { display: flex; gap: 10px; margin-top: 13px; }
.swatch {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--swatch);
  border: 1px solid #3a30261f;
  box-shadow: inset 0 -4px 10px #3a302614;
}
.swatch.selected { outline: 2px solid var(--accent); outline-offset: 3px; }

.segments { display: flex; gap: 8px; margin-top: 13px; }
.segments button {
  flex: 1; padding: 11px 8px; border-radius: 11px;
  font-size: 12px; color: var(--muted);
  background: #ffffff8c; border: 1px solid var(--line);
}
.segments button.selected { background: var(--white); color: var(--ink); box-shadow: var(--shadow); }

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.stepper { display: flex; align-items: center; gap: 8px; }
.stepper button {
  width: 32px; height: 32px; border-radius: 9px; font-size: 15px;
  color: var(--muted); background: #ffffff8c; border: 1px solid var(--line);
}
.stepper button:hover { background: var(--white); color: var(--ink); }
.stepper output { min-width: 46px; text-align: center; font-size: 13px; font-weight: 700; }

.mini-button {
  padding: 10px 15px; border-radius: 10px; font-size: 12px;
  background: #ffffff8c; border: 1px solid var(--line);
}
.mini-button:hover { background: var(--white); }

.switch {
  width: 48px; height: 28px; padding: 3px; border-radius: 999px;
  background: #d6ccbd; transition: background .25s;
}
.switch i { display: block; width: 22px; height: 22px; border-radius: 50%; background: #fff;
  transition: transform .25s; }
.switch[aria-checked="true"] { background: var(--accent); }
.switch[aria-checked="true"] i { transform: translateX(20px); }

/* 换一只小鹰 */
.skin-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-top: 13px; }
.skin-card {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 8px 4px 7px; border-radius: 12px;
  font-size: 10.5px; color: var(--muted);
  background: #ffffff7a; border: 1px solid var(--line);
}
.skin-card img { width: 100%; height: 46px; object-fit: contain; }
.skin-card.selected { background: var(--white); color: var(--ink); box-shadow: var(--shadow);
  outline: 2px solid var(--accent); outline-offset: -1px; }

.settings-foot { display: flex; gap: 10px; margin-top: 26px; }
.settings-foot button { flex: 1; padding: 14px; border-radius: 13px; font-size: 13px; font-weight: 600; }
.ghost { background: #ffffff8c; border: 1px solid var(--line); color: var(--muted); }
.solid { background: #5c4a33; color: #fffdf8; }
.solid span { color: var(--gold); }

/* 收藏卡 */
#card-image { width: 100%; border-radius: 14px; margin: 14px 0 4px; box-shadow: var(--shadow); }
.card-actions { display: flex; gap: 10px; margin-top: 14px; }
.card-actions button { flex: 1; padding: 14px; border-radius: 13px; font-size: 13px; font-weight: 600; }
.secondary { background: #ffffff8c; border: 1px solid var(--line); color: var(--muted); }
.primary { background: #5c4a33; color: #fffdf8; }
#share-status { font-size: 11.5px; color: var(--muted); margin: 12px 0 0; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 34px;
  transform: translateX(-50%) translateY(14px);
  z-index: 30;
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 12.5px;
  background: #5c4a33;
  color: #fffdf8;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s, transform .3s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── 响应式 ─────────────────────────────── */
@media (max-width: 1080px) {
  .edition { display: none; }
  .headline { top: 34px; }
  .headline h1 { font-size: 36px; }
  .headline h1 br { display: none; }
  .spec-label { top: 36px; }
  .spec-label strong, .spec-label small { display: none; }
  .tools { top: 40%; }
  .tool { min-width: 128px; padding: 11px 13px; }
  .tool small { display: none; }
  .side-note { right: 4%; bottom: 24%; }
}

@media (max-width: 760px) {
  .topbar { height: 74px; margin: 0 6%; border: 0; }
  .brand { font-size: 15px; gap: 9px; }
  .brand-mark { font-size: 32px; }
  .brand small { display: none; }
  .header-actions { gap: 7px; }
  .round-control { padding: 10px; }
  .round-control > span { display: none; }

  #experience { height: calc(100svh - 112px); min-height: 640px; }

  .headline { left: 6%; top: 14px; }
  .headline h1 { font-size: 30px; margin: 12px 0 8px; }
  .headline p { font-size: 12px; }
  .spec-label { top: 15px; right: 6%; }
  .spec-label span { font-size: 9px; }

  .tools { top: 108px; left: 6%; right: 6%; flex-direction: row; gap: 6px; }
  .tool { flex: 1; min-width: 0; flex-direction: column; gap: 5px; padding: 9px 4px;
    justify-content: center; text-align: center; border-radius: 12px; }
  .tool svg { width: 17px; height: 17px; }
  .tool span { font-size: 11px; white-space: nowrap; }
  .tool small { display: none; }

  .speech { font-size: 11.5px; padding: 8px 14px; }
  .object-caption { gap: 8px; }
  .object-caption .name { font-size: 15px; }
  .object-caption #mood { font-size: 11px; }

  .side-note { right: 6%; bottom: 15%; }
  .side-note p, .note-symbol { display: none; }
  .side-note button { font-size: 11px; }

  .bottom-bar { left: 6%; right: 6%; bottom: 16px; flex-direction: column; align-items: stretch; gap: 12px; }
  .gesture-hint { justify-content: center; font-size: 10px; }
  .gesture-hint #hint { max-width: none; }
  .keycap { display: none; }
  .collect { justify-content: space-between; padding: 5px 5px 5px 18px; }
  .collect-label { padding: 12px 18px; font-size: 12px; }
  .creator-contact { font-size: 10px; gap: 16px; padding-bottom: 12px; }

  .skin-grid { grid-template-columns: repeat(4, 1fr); }
  .settings-dialog .panel, .card-dialog .panel { padding: 22px 20px 18px; }
}

@media (max-width: 380px) {
  .headline h1 { font-size: 26px; }
  .tool span { font-size: 10px; }
  .skin-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
