/* 抱抱熊出气屋 · 样式 */
:root {
  --cream: #f6ecdd;
  --paper: #fff9ed;
  --paper-2: #fbefd9;
  --ink: #3a2b25;
  --ink-soft: #5c463c;
  --muted: #8c7566;
  --pink: #f3a6b5;
  --pink-deep: #e27b90;
  --red: #d95d45;
  --amber: #f2c46d;
  --mint: #a9d8c4;
  --line: rgba(58, 43, 37, 0.14);
  --shadow: 0 18px 40px -20px rgba(58, 43, 37, 0.45);
  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  --round: "Yuanti SC", "Hiragino Maru Gothic ProN", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--font);
  background:
    radial-gradient(1100px 600px at 12% -10%, rgba(243, 166, 181, 0.28), transparent 60%),
    radial-gradient(900px 520px at 92% 8%, rgba(169, 216, 196, 0.3), transparent 60%),
    linear-gradient(180deg, #fbf3e6 0%, var(--cream) 48%, #f1e4d2 100%);
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.35;
  background-image: radial-gradient(rgba(58, 43, 37, 0.07) 1px, transparent 1px);
  background-size: 4px 4px;
  z-index: 0;
}

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

button { font: inherit; color: inherit; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 14px clamp(16px, 4vw, 42px);
  background: rgba(255, 249, 237, 0.82);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.brand { display: flex; align-items: center; gap: 11px; margin-right: auto; }
.brand__mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: var(--ink);
  color: var(--paper);
  transform: rotate(-4deg);
  box-shadow: 3px 3px 0 var(--pink);
}
.brand__mark svg { width: 22px; height: 22px; }
.brand strong { display: block; font-family: var(--round); font-size: 19px; letter-spacing: 0.02em; }
.brand small { display: block; color: var(--muted); font-size: 10px; letter-spacing: 0.22em; margin-top: 1px; }

.modes {
  display: flex;
  padding: 4px;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  background: var(--paper);
  box-shadow: 2px 2px 0 rgba(58, 43, 37, 0.16);
}
.mode {
  border: 0;
  background: transparent;
  padding: 7px 15px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  transition: background 0.18s, color 0.18s;
}
.mode.is-on { background: var(--ink); color: var(--paper); }

.top-actions { display: flex; align-items: center; gap: 8px; }
.ghost, .icon-btn {
  border: 1.5px solid var(--ink);
  background: var(--paper);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 2px 2px 0 rgba(58, 43, 37, 0.16);
  transition: transform 0.15s, box-shadow 0.15s, background 0.18s;
}
.icon-btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; }
.icon-btn svg { width: 17px; height: 17px; }
.ghost:hover, .icon-btn:hover, .primary:hover, .weapon:hover { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 rgba(58, 43, 37, 0.22); }
.ghost:active, .icon-btn:active, .primary:active, .weapon:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 rgba(58, 43, 37, 0.2); }
button:focus-visible { outline: 3px solid var(--pink-deep); outline-offset: 2px; }

/* ---------- page ---------- */
.page {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100% - clamp(20px, 4vw, 48px)));
  margin: clamp(18px, 3vw, 34px) auto 0;
}

.stage-card {
  border: 2px solid var(--ink);
  border-radius: 30px;
  background: var(--paper);
  box-shadow: 8px 9px 0 rgba(58, 43, 37, 0.14), var(--shadow);
  padding: 10px;
}

.arena {
  position: relative;
  aspect-ratio: 16 / 10;
  min-height: 430px;
  max-height: 720px;
  overflow: hidden;
  border-radius: 22px;
  border: 1.5px solid rgba(58, 43, 37, 0.55);
  background:
    radial-gradient(70% 80% at 50% 30%, rgba(255, 250, 238, 0.98) 0%, rgba(250, 233, 209, 0.9) 58%, rgba(235, 207, 176, 0.95) 100%),
    linear-gradient(180deg, #fdf6e9 0%, #f2dfc4 100%);
  cursor: crosshair;
  touch-action: none;
  user-select: none;
}
.arena::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(46% 52% at 50% 40%, rgba(255, 255, 255, 0.75), transparent 70%),
    repeating-linear-gradient(90deg, transparent 0 78px, rgba(58, 43, 37, 0.035) 78px 79px),
    repeating-linear-gradient(0deg, transparent 0 78px, rgba(58, 43, 37, 0.035) 78px 79px);
  mix-blend-mode: multiply;
  opacity: 0.55;
}
.arena::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 30%;
  pointer-events: none;
  background:
    linear-gradient(180deg, transparent, rgba(226, 123, 144, 0.14) 42%, rgba(226, 123, 144, 0.22)),
    radial-gradient(80% 120% at 50% 100%, rgba(255, 255, 255, 0.45), transparent 70%);
  border-top: 1px dashed rgba(58, 43, 37, 0.18);
}
.arena.is-playing { cursor: none; }
.arena.is-playing.over-open { cursor: default; }

#game { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* ---------- HUD ---------- */
.hud {
  position: absolute;
  inset: 16px 16px auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  pointer-events: none;
  z-index: 3;
}
.score, .combo {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 13px;
  border: 1.5px solid var(--ink);
  border-radius: 14px;
  background: rgba(255, 249, 237, 0.92);
  box-shadow: 3px 3px 0 rgba(58, 43, 37, 0.16);
}
.score span, .combo span { font-size: 9px; letter-spacing: 0.12em; color: var(--muted); align-self: flex-end; margin-bottom: 3px; }
.score strong { font-size: 26px; font-variant-numeric: tabular-nums; letter-spacing: 0.02em; font-family: var(--round); }
.combo { transform: rotate(2deg); opacity: 0.55; transition: opacity 0.2s, transform 0.2s; }
.combo[data-on="true"] { opacity: 1; background: var(--ink); color: var(--paper); border-color: var(--ink); }
.combo strong { font-size: 24px; font-variant-numeric: tabular-nums; }
.combo em { font-style: normal; font-size: 12px; opacity: 0.7; }
.combo.is-hit { animation: comboPunch 0.22s ease-out; }
@keyframes comboPunch {
  0% { transform: rotate(2deg) scale(1); }
  45% { transform: rotate(-2deg) scale(1.16); }
  100% { transform: rotate(2deg) scale(1); }
}

/* ---------- taunt ---------- */
.taunt {
  position: absolute;
  top: 54px;
  left: 50%;
  z-index: 4;
  transform: translate(-50%, -8px) scale(0.94);
  max-width: min(64%, 400px);
  padding: 8px 16px;
  border: 1.5px solid var(--ink);
  border-radius: 14px 14px 14px 4px;
  background: var(--paper);
  box-shadow: 3px 3px 0 rgba(58, 43, 37, 0.16);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}
.taunt.is-on { opacity: 1; transform: translate(-50%, 0) scale(1); }

/* ---------- dock ---------- */
.dock {
  position: absolute;
  left: 50%;
  bottom: 16px;
  z-index: 5;
  display: flex;
  gap: 8px;
  padding: 8px;
  transform: translateX(-50%);
  border: 1.5px solid var(--ink);
  border-radius: 18px;
  background: rgba(255, 249, 237, 0.94);
  box-shadow: 4px 4px 0 rgba(58, 43, 37, 0.18);
  backdrop-filter: blur(6px);
}
.weapon {
  position: relative;
  width: 64px;
  height: 66px;
  display: grid;
  place-items: center;
  gap: 2px;
  border: 1.5px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  transition: background 0.16s, transform 0.15s, border-color 0.16s;
}
.weapon svg { width: 27px; height: 27px; }
.weapon__name { font-size: 11px; color: var(--ink-soft); font-weight: 600; }
.weapon__key {
  position: absolute;
  top: 4px;
  right: 6px;
  font-size: 9px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0 3px;
  line-height: 1.4;
}
.weapon.is-active { background: var(--pink); border-color: var(--ink); box-shadow: 2px 2px 0 rgba(58, 43, 37, 0.2); }
.weapon.is-active .weapon__name { color: var(--ink); }

/* ---------- ultimate ---------- */
.ult {
  position: absolute;
  right: 18px;
  bottom: 96px;
  z-index: 5;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  overflow: hidden;
  box-shadow: 4px 4px 0 rgba(58, 43, 37, 0.18);
  transition: transform 0.16s;
}
.ult:hover { transform: translateY(-2px) rotate(-2deg); }
.ult__ring { position: absolute; inset: 6px; border: 1.5px dashed rgba(58, 43, 37, 0.45); border-radius: 50%; }
.ult__fill {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 0%;
  background: linear-gradient(180deg, var(--pink) 0%, var(--pink-deep) 100%);
  transition: height 0.2s ease-out;
}
.ult__label { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; line-height: 1.05; }
.ult__label strong { display: block; font-size: 17px; letter-spacing: 0.04em; }
.ult__label small { font-size: 9px; letter-spacing: 0.18em; opacity: 0.7; }
.ult.is-ready { animation: ultPulse 1.1s ease-in-out infinite; background: var(--amber); }
.ult.is-active { background: var(--red); color: var(--paper); transform: scale(0.94); }
@keyframes ultPulse {
  0%, 100% { box-shadow: 4px 4px 0 rgba(58, 43, 37, 0.18), 0 0 0 0 rgba(226, 123, 144, 0.5); }
  50% { box-shadow: 4px 4px 0 rgba(58, 43, 37, 0.18), 0 0 0 12px rgba(226, 123, 144, 0); }
}

/* ---------- cursor ---------- */
.cursor {
  position: absolute;
  z-index: 6;
  width: 56px;
  height: 56px;
  margin: -30px 0 0 -18px;
  pointer-events: none;
  opacity: 0;
  transform: rotate(var(--rot, -8deg)) scale(var(--scale, 1));
  transform-origin: 20% 80%;
  transition: opacity 0.12s;
  color: var(--ink);
  filter: drop-shadow(2px 3px 0 rgba(58, 43, 37, 0.22));
}
.cursor.is-on { opacity: 1; }
.cursor svg { width: 100%; height: 100%; }

/* ---------- overlays ---------- */
.overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(16px, 4vw, 42px);
  background:
    radial-gradient(70% 70% at 50% 45%, rgba(255, 249, 237, 0.92), rgba(250, 236, 214, 0.97)),
    rgba(250, 236, 214, 0.94);
  backdrop-filter: blur(5px);
  overflow: auto;
  cursor: default;
}
.overlay[hidden] { display: none; }
.intro__inner, .ko__inner { width: min(660px, 100%); text-align: center; }

.eyebrow { margin: 0 0 10px; font-size: 10px; font-weight: 700; letter-spacing: 0.26em; color: var(--muted); text-transform: uppercase; }
h1, h2 { margin: 0; font-family: var(--round); line-height: 1.1; letter-spacing: -0.01em; }
h1 { font-size: clamp(30px, 4.6vw, 48px); }
h2 { font-size: clamp(28px, 4vw, 42px); }
.intro__lede { margin: 14px auto 0; max-width: 540px; color: var(--ink-soft); font-size: 14px; line-height: 1.8; }

.intro__bears { display: flex; justify-content: center; align-items: flex-end; gap: clamp(24px, 6vw, 64px); margin: 18px 0 6px; }
.intro__bears figure { margin: 0; display: grid; justify-items: center; gap: 4px; }
.intro__bears img { height: clamp(96px, 15vh, 142px); width: auto; object-fit: contain; filter: drop-shadow(0 10px 8px rgba(58, 43, 37, 0.18)); animation: floaty 3.6s ease-in-out infinite; }
.intro__bears figure:nth-child(2) img { animation-delay: -1.2s; }
@keyframes floaty { 0%, 100% { transform: translateY(0) rotate(-1deg); } 50% { transform: translateY(-7px) rotate(1.5deg); } }
.intro__bears figcaption { font-family: var(--round); font-size: 14px; font-weight: 700; }
.intro__bears small { display: block; font-family: var(--font); font-size: 10px; font-weight: 500; color: var(--muted); letter-spacing: 0.08em; }

.intro__row { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 12px; margin-top: 8px; }
.seg { display: flex; padding: 3px; border: 1.5px solid var(--ink); border-radius: 999px; background: var(--paper); }
.seg__btn { border: 0; background: transparent; padding: 8px 14px; border-radius: 999px; font-size: 12px; font-weight: 600; color: var(--ink-soft); cursor: pointer; }
.seg__btn.is-on { background: var(--ink); color: var(--paper); }

.primary {
  border: 1.5px solid var(--ink);
  background: var(--red);
  color: var(--paper);
  border-radius: 999px;
  padding: 13px 30px;
  font-family: var(--round);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  box-shadow: 3px 3px 0 rgba(58, 43, 37, 0.28);
}
.intro__hint { margin: 16px 0 0; font-size: 11px; color: var(--muted); letter-spacing: 0.02em; }

/* ---------- KO ---------- */
.ko__line { min-height: 24px; margin: 14px 0 0; font-family: var(--round); font-size: 18px; font-weight: 700; color: var(--ink); }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 22px 0 0; padding: 0; }
.stats div { padding: 12px 8px; border: 1.5px solid var(--ink); border-radius: 14px; background: var(--paper); box-shadow: 2px 2px 0 rgba(58, 43, 37, 0.12); }
.stats dt { font-size: 10px; letter-spacing: 0.12em; color: var(--muted); }
.stats dd { margin: 5px 0 0; font-family: var(--round); font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.ko__best { min-height: 20px; margin: 16px 0 0; font-size: 12px; color: var(--ink-soft); }
.ko__actions { display: flex; justify-content: center; gap: 10px; margin-top: 20px; }

/* KO 结果只占顶部一条，不挡爆炸肢解 */
.overlay.ko {
  inset: 10px 10px auto;
  z-index: 30;
  align-items: flex-start;
  justify-content: center;
  padding: 0;
  background: none;
  backdrop-filter: none;
  overflow: visible;
  pointer-events: none;
}
.overlay.ko .ko__inner {
  width: min(720px, calc(100% - 8px));
  margin: 0 auto;
  padding: 10px 16px 12px;
  border: 1.5px solid var(--ink);
  border-radius: 16px;
  background: rgba(255, 249, 237, 0.95);
  box-shadow: 3px 3px 0 rgba(58, 43, 37, 0.2);
  pointer-events: auto;
}
.overlay.ko .eyebrow { display: none; }
.overlay.ko h2 { font-size: clamp(20px, 2.4vw, 28px); }
.overlay.ko .ko__line { min-height: 0; margin: 4px 0 0; font-size: 12px; }
.overlay.ko .stats { margin: 8px 0 0; gap: 6px; }
.overlay.ko .stats div { padding: 5px 6px; border-radius: 10px; box-shadow: 1px 1px 0 rgba(58, 43, 37, 0.1); }
.overlay.ko .stats dt { font-size: 8px; letter-spacing: 0.08em; }
.overlay.ko .stats dd { margin: 2px 0 0; font-size: 16px; }
.overlay.ko .ko__best { min-height: 0; margin: 5px 0 0; font-size: 10px; }
.overlay.ko .ko__actions { margin-top: 8px; gap: 8px; }
.overlay.ko .ko__actions .primary { padding: 7px 16px; font-size: 12px; box-shadow: 2px 2px 0 rgba(58, 43, 37, 0.22); }
.overlay.ko .ko__actions .ghost { padding: 7px 14px; font-size: 12px; }

/* ---------- tips ---------- */
.tips {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin: 22px 0 0;
}
.tips article {
  position: relative;
  padding: 18px 18px 16px;
  border: 1.5px solid var(--ink);
  border-radius: 18px;
  background: rgba(255, 249, 237, 0.72);
  box-shadow: 3px 3px 0 rgba(58, 43, 37, 0.1);
}
.tips article:nth-child(2) { background: rgba(243, 166, 181, 0.16); }
.tips article:nth-child(3) { background: rgba(169, 216, 196, 0.18); }
.tips span { font-family: var(--round); font-size: 11px; font-weight: 800; color: var(--muted); letter-spacing: 0.1em; }
.tips h3 { margin: 4px 0 6px; font-family: var(--round); font-size: 16px; }
.tips p { margin: 0; font-size: 12.5px; line-height: 1.75; color: var(--ink-soft); }

/* ---------- foot ---------- */
.foot {
  width: min(1180px, calc(100% - clamp(20px, 4vw, 48px)));
  margin: 28px auto 0;
  padding: 18px 0 34px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.7;
}
.foot p { margin: 0; }
.foot__meta { margin-top: 6px; letter-spacing: 0.08em; }

/* ---------- responsive ---------- */
@media (max-width: 1020px) {
  .topbar { flex-wrap: wrap; gap: 10px 14px; }
  .brand { order: 1; }
  .top-actions { order: 2; margin-left: auto; }
  .modes { order: 3; }
  .arena { min-height: 390px; }
  .tips { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .topbar { padding: 11px 14px; }
  .brand small { display: none; }
  .brand strong { font-size: 16px; }
  .ghost { padding: 7px 10px; font-size: 11.5px; }
  .icon-btn span { display: none; }
  .modes { width: 100%; justify-content: center; }
  .mode { flex: 1; }
  .page { width: calc(100% - 20px); margin-top: 14px; }
  .stage-card { padding: 6px; border-radius: 22px; box-shadow: 5px 6px 0 rgba(58, 43, 37, 0.14); }
  .arena { aspect-ratio: 4 / 5; min-height: 430px; max-height: 620px; border-radius: 17px; }
  .hud { inset: 10px 10px auto; }
  .score strong { font-size: 21px; }
  .combo strong { font-size: 19px; }
  .dock { gap: 3px; padding: 6px; bottom: 10px; max-width: calc(100% - 20px); }
  .weapon { width: 52px; height: 58px; }
  .weapon svg { width: 23px; height: 23px; }
  .weapon__name { font-size: 9.5px; }
  .weapon__key { display: none; }
  .ult { width: 68px; height: 68px; right: 10px; bottom: 82px; }
  .ult__label strong { font-size: 14px; }
  .taunt { top: 58px; font-size: 13px; max-width: 80%; }
  .intro__bears img { height: 84px; }
  .intro__lede { font-size: 12.5px; }
  .intro__hint { display: none; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .foot { width: calc(100% - 24px); }
}

@media (max-width: 420px) {
  .brand__mark { width: 36px; height: 36px; border-radius: 12px; }
  .arena { min-height: 400px; }
  .weapon { width: 48px; height: 54px; }
  .weapon svg { width: 21px; height: 21px; }
}

/* ---------- reduced motion ---------- */
body.reduce-motion *, body.reduce-motion *::before, body.reduce-motion *::after {
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
}
body.reduce-motion .intro__bears img { animation: none; }
body.reduce-motion .ult.is-ready { animation: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .intro__bears img { animation: none; }
  .ult.is-ready { animation: none; }
  .combo.is-hit { animation: none; }
}
