/* ==========================================================================
   基础层：重置、排版、通用组件
   ========================================================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

/* 关键：作者样式里的 display 会覆盖 UA 的 [hidden]，这里强制生效 */
[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  overscroll-behavior: none;
}

html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: "Nunito", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
    system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1100px 700px at 12% -8%, #ffe9d3 0%, rgba(255, 233, 211, 0) 62%),
    radial-gradient(900px 700px at 96% 4%, #dff4e9 0%, rgba(223, 244, 233, 0) 60%),
    var(--bg);
  min-height: 100dvh;
  overflow-x: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  font-weight: 600;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
  font-weight: 800;
  letter-spacing: 0.01em;
}

button {
  font-family: inherit;
  font-weight: 800;
  color: inherit;
  border: 0;
  background: none;
  cursor: pointer;
  font-size: inherit;
}

img {
  display: block;
  max-width: 100%;
  -webkit-user-drag: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- 启动页 ---------- */
.boot {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  background:
    radial-gradient(700px 520px at 50% 30%, #fff6ea 0%, rgba(255, 246, 234, 0) 70%),
    var(--bg);
  transition: opacity 0.5s var(--ease), visibility 0.5s;
}
.boot.is-gone {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.boot__card {
  display: grid;
  justify-items: center;
  gap: 14px;
  padding: 40px 48px;
  animation: float-in 0.7s var(--ease-out) both;
}
.boot__mascot {
  width: clamp(120px, 18vw, 180px);
  height: auto;
  animation: bob 2.6s ease-in-out infinite;
}
.boot__name {
  font-size: var(--f-title);
  color: var(--ink);
  letter-spacing: 0.08em;
}
.boot__bar {
  width: 190px;
  height: 12px;
  border-radius: 99px;
  background: #f1e5d8;
  overflow: hidden;
}
.boot__bar span {
  display: block;
  width: 8%;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--green), #a5e2c4);
  transition: width 0.35s var(--ease);
}
.boot__hint {
  font-size: var(--f-small);
  color: var(--muted);
}

.app {
  position: relative;
  min-height: 100dvh;
  padding: calc(var(--safe-t) + 10px) calc(var(--safe-r) + var(--pad))
    calc(var(--safe-b) + 18px) calc(var(--safe-l) + var(--pad));
  display: flex;
  flex-direction: column;
}

.fx {
  position: fixed;
  inset: 0;
  z-index: 80;
  pointer-events: none;
  width: 100%;
  height: 100%;
}

.layer {
  position: fixed;
  inset: 0;
  z-index: 70;
  pointer-events: none;
}
.layer > * {
  pointer-events: auto;
}

/* ---------- 按钮 ---------- */
.btn {
  --btn-bg: var(--surface);
  --btn-fg: var(--ink);
  --btn-shadow: rgba(94, 78, 110, 0.14);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: var(--tap);
  padding: 0 30px;
  border-radius: 999px;
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-size: var(--f-head);
  box-shadow: 0 5px 0 var(--btn-shadow), 0 12px 22px rgba(94, 78, 110, 0.1);
  transition: transform var(--fast) var(--ease), box-shadow var(--fast) var(--ease),
    filter var(--fast) var(--ease);
  white-space: nowrap;
}
.btn:active,
.btn.is-press {
  transform: translateY(4px);
  box-shadow: 0 1px 0 var(--btn-shadow), 0 6px 12px rgba(94, 78, 110, 0.1);
}
.btn--primary {
  --btn-bg: linear-gradient(180deg, #7fd3ae, #5bbc93);
  --btn-fg: #fff;
  --btn-shadow: #3f8f6c;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.08);
}
.btn--sun {
  --btn-bg: linear-gradient(180deg, #ffd97a, #f3bd4d);
  --btn-fg: #7a5410;
  --btn-shadow: #cf9a31;
}
.btn--coral {
  --btn-bg: linear-gradient(180deg, #ffa9a0, #ef8b81);
  --btn-fg: #fff;
  --btn-shadow: #c96a61;
}
.btn--ghost {
  --btn-bg: rgba(255, 255, 255, 0.72);
  --btn-shadow: rgba(94, 78, 110, 0.1);
}
.btn--sm {
  min-height: 60px;
  padding: 0 22px;
  font-size: var(--f-body);
  box-shadow: 0 4px 0 var(--btn-shadow);
}
.btn--big {
  min-height: clamp(96px, 11vh, 124px);
  padding: 0 44px;
  font-size: clamp(24px, 2.8vw, 34px);
}
.btn[disabled] {
  opacity: 0.45;
  pointer-events: none;
}
.btn__icon {
  width: 1.35em;
  height: 1.35em;
  flex: none;
}
.btn svg {
  width: 1.3em;
  height: 1.3em;
  flex: none;
}
.btn--big svg {
  width: 1.25em;
  height: 1.25em;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 66px;
  height: 66px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 4px 0 rgba(94, 78, 110, 0.08), 0 10px 20px rgba(94, 78, 110, 0.08);
  transition: transform var(--fast) var(--ease);
}
.icon-btn:active {
  transform: scale(0.93);
}
.icon-btn img,
.icon-btn svg {
  width: 56%;
  height: 56%;
}

/* ---------- 卡片 ---------- */
.card {
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-m);
  padding: clamp(18px, 2.4vw, 30px);
}
.card--soft {
  background: var(--surface-soft);
  box-shadow: var(--shadow-s);
}

/* ---------- 顶部栏 ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: clamp(12px, 2vh, 22px);
  flex: none;
}
.topbar__spacer {
  flex: 1;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 62px;
  padding: 0 22px;
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow-s);
  font-size: var(--f-body);
  font-weight: 800;
  color: var(--ink-soft);
}
.chip img {
  width: 30px;
  height: 30px;
}
.chip--stars {
  color: #a9781a;
  background: linear-gradient(180deg, #fff6d8, #ffeeb8);
}

/* ---------- 进度环 ---------- */
.ring {
  --p: 0;
  --size: 56px;
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(var(--ring-color, var(--green)) calc(var(--p) * 1turn), rgba(94, 78, 110, 0.1) 0);
  position: relative;
  flex: none;
}
.ring::after {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  background: var(--surface);
}
.ring > * {
  position: relative;
  z-index: 1;
  font-size: calc(var(--size) * 0.26);
  font-weight: 900;
  color: var(--ink-soft);
}

/* ---------- 星星 ---------- */
.stars {
  display: inline-flex;
  gap: 2px;
}
.stars svg {
  width: 1em;
  height: 1em;
}

/* ---------- 通用动效 ---------- */
@keyframes bob {
  0%, 100% { transform: translateY(0) rotate(-1deg); }
  50% { transform: translateY(-10px) rotate(1.5deg); }
}
@keyframes float-in {
  from { opacity: 0; transform: translateY(24px) scale(0.96); }
  to { opacity: 1; transform: none; }
}
@keyframes pop-in {
  0% { opacity: 0; transform: scale(0.86); }
  70% { transform: scale(1.03); }
  100% { opacity: 1; transform: scale(1); }
}
@keyframes screen-in {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}
@keyframes wobble {
  0%, 100% { transform: translateX(0) rotate(0); }
  20% { transform: translateX(-9px) rotate(-1.6deg); }
  45% { transform: translateX(8px) rotate(1.4deg); }
  70% { transform: translateX(-4px) rotate(-0.6deg); }
}
@keyframes pulse-soft {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}
@keyframes shimmer {
  from { background-position: -140% 0; }
  to { background-position: 240% 0; }
}
@keyframes rise {
  from { opacity: 0; transform: translateY(20px) scale(0.9); }
  to { opacity: 1; transform: none; }
}
@keyframes fall-away {
  to { opacity: 0; transform: translateY(-90px) scale(0.7); }
}

.screen {
  animation: screen-in 0.42s var(--ease-out) both;
  display: flex;
  flex-direction: column;
  flex: 1;
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
