:root {
  --paper: #f7f2ea;
  --paper-deep: #eee5d8;
  --ink: #443d36;
  --muted: #7e7469;
  --line: rgba(93, 78, 62, .17);
  --accent: #b88b5a;
  --accent-dark: #8f643e;
  --white: rgba(255, 255, 255, .72);
  --shadow: 0 22px 60px rgba(82, 66, 49, .10);
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 4%, rgba(255,255,255,.92), transparent 24rem),
    radial-gradient(circle at 90% 28%, rgba(218,194,158,.18), transparent 30rem),
    linear-gradient(180deg, #faf7f2 0%, var(--paper) 48%, #f4ede4 100%);
  font-family:
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
    "Noto Sans CJK SC", system-ui, -apple-system, sans-serif;
  line-height: 1.8;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .18;
  background-image:
    linear-gradient(rgba(120,100,78,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120,100,78,.025) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: linear-gradient(to bottom, black, transparent 85%);
}

button, a { font: inherit; }

.page {
  width: min(860px, calc(100% - 34px));
  margin: 0 auto;
  padding: 44px 0 28px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 34px;
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
}

.back-link:hover { color: var(--accent-dark); }

.intro-card {
  position: relative;
  overflow: hidden;
  padding: clamp(30px, 7vw, 66px);
  border: 1px solid var(--line);
  border-radius: 34px;
  background: rgba(255,255,255,.64);
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}

.intro-card::after {
  content: "";
  position: absolute;
  width: 220px;
  height: 220px;
  right: -72px;
  top: -82px;
  border-radius: 50%;
  background: rgba(184,139,90,.08);
  pointer-events: none;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 12px;
  letter-spacing: .25em;
  font-weight: 700;
}

h1 {
  margin: 0;
  font-family: "Songti SC", "STSong", "Noto Serif CJK SC", serif;
  font-size: clamp(44px, 9vw, 76px);
  line-height: 1.08;
  font-weight: 500;
  letter-spacing: .06em;
}

.lead {
  max-width: 690px;
  margin: 24px 0 34px;
  color: #62584f;
  font-size: clamp(16px, 2.5vw, 19px);
}

.tips {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.tips > div {
  min-height: 138px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(247,242,234,.72);
}

.tips span {
  display: block;
  margin-bottom: 12px;
  color: var(--accent);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  letter-spacing: .08em;
}

.tips p {
  margin: 0;
  color: #61574d;
  font-size: 14px;
  line-height: 1.7;
}

.motion-note {
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.start-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 190px;
  min-height: 54px;
  margin-top: 28px;
  padding: 0 28px;
  border: 0;
  border-radius: 999px;
  color: #fffaf5;
  background: var(--accent-dark);
  box-shadow: 0 12px 28px rgba(112,77,45,.18);
  cursor: pointer;
  transition: transform .18s ease, opacity .18s ease, box-shadow .18s ease;
}

.start-button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 16px 30px rgba(112,77,45,.22);
}

.start-button:active:not(:disabled) { transform: translateY(0); }

.start-button:disabled {
  opacity: .5;
  cursor: wait;
}

.status {
  min-height: 24px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
}

footer {
  margin-top: 34px;
  padding: 24px 0 8px;
  border-top: 1px solid var(--line);
  color: #8a8178;
  text-align: center;
  font-size: 13px;
  line-height: 2;
}

.game-stage {
  position: fixed;
  z-index: 9999;
  inset: 0;
  display: none;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% -8%, rgba(255,255,255,.96), transparent 34%),
    linear-gradient(180deg, #f9f5ef 0%, #f3ebdf 100%);
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.game-stage.running {
  display: block;
  cursor: none;
}

.game-stage:fullscreen,
.game-stage:-webkit-full-screen {
  width: 100vw;
  height: 100vh;
}

.top-band {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: max(10vh, 84px);
  border-bottom: 1px solid rgba(112,92,70,.055);
  background: linear-gradient(180deg, rgba(255,255,255,.24), rgba(255,255,255,0));
  pointer-events: none;
}

.food {
  position: absolute;
  left: 0;
  top: 0;
  width: 50px;
  height: 50px;
  object-fit: contain;
  object-position: center;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  transform: translate3d(-999px, -999px, 0);
  will-change: transform;
  filter: drop-shadow(0 4px 5px rgba(75,58,39,.10));
}

.exit-button {
  position: absolute;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 3;
  padding: 10px 16px;
  border: 1px solid rgba(89,72,54,.18);
  border-radius: 999px;
  color: #665b50;
  background: rgba(255,255,255,.72);
  box-shadow: 0 8px 24px rgba(77,61,43,.08);
  backdrop-filter: blur(8px);
}

.game-toast {
  position: absolute;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  max-width: min(80vw, 520px);
  padding: 9px 14px;
  border-radius: 999px;
  color: #5f554c;
  background: rgba(255,255,255,.75);
  font-size: 13px;
  text-align: center;
  opacity: 0;
  transition: opacity .2s ease;
  pointer-events: none;
}

.game-toast.show { opacity: 1; }

@media (max-width: 720px) {
  .page { padding-top: 22px; }
  .intro-card { border-radius: 26px; }
  .tips { grid-template-columns: 1fr; }
  .tips > div { min-height: auto; }
  .food { width: 44px; height: 44px; }
  .top-band { height: max(6.666vh, 44px); }
}

/* ======================================================
   自动手机 / 平板桌面逗鸟模式
   ====================================================== */

.game-stage.mobile-mode .top-band {
  display: none;
}

.game-stage.mobile-mode {
  background:
    radial-gradient(
      circle at 50% 20%,
      rgba(255,255,255,.96),
      transparent 42%
    ),
    linear-gradient(
      180deg,
      #faf7f1 0%,
      #f4ede3 100%
    );
}

/*
 * 手机放桌上以后，不让退出按钮长期抢鸟的注意力。
 * 开始 3 秒以后自动淡下去。
 */
.game-stage.mobile-mode.running .exit-button {
  animation:
    mobileExitButtonFade
    .45s ease
    3s forwards;
}

.game-stage.mobile-mode .exit-button:active,
.game-stage.mobile-mode .exit-button:focus-visible {
  opacity: 1 !important;
  animation: none;
}

@keyframes mobileExitButtonFade {
  from {
    opacity: 1;
  }

  to {
    opacity: .18;
  }
}
