/* 合成大猫咪 · 竖屏界面样式
 * 兼容层：Chrome 61 / Android 8.1 WebView 基线，现代能力只做增强。
 * - 不使用 inset / aspect-ratio / 依赖 Flex gap：统一改成 top/left/right/bottom 与子项 margin
 * - clamp()/max() 先写 vmin 固定值兜底，再写现代写法
 * - backdrop-filter 放进 @supports，基线是不依赖模糊的实色背景
 * - 安全区用 var(--safe-area-inset-*, env(...))，PC 模拟器注入变量、真机走 env()
 */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: radial-gradient(120% 90% at 50% 0%, #fff6ea 0%, #ffe6cd 60%, #ffd9b8 100%);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  color: #5b3b2e;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  touch-action: none;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  padding-top: var(--safe-area-inset-top, env(safe-area-inset-top, 0px));
  padding-right: var(--safe-area-inset-right, env(safe-area-inset-right, 0px));
  padding-bottom: var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px));
  padding-left: var(--safe-area-inset-left, env(safe-area-inset-left, 0px));
}

#app {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(180, 110, 70, 0.22);
  background: #ffeede;
}

#app.full { border-radius: 0; box-shadow: none; }

#game {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

#ui {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  pointer-events: none;
  font-size: 3.4vmin;
  font-size: clamp(13px, 3.4vmin, 20px);
}

#ui > * { pointer-events: auto; }

/* ---------- 角落按钮 ---------- */
.corner-btns {
  position: absolute;
  right: 10px;
  right: max(10px, 2.2vmin);
  bottom: 10px;
  bottom: max(10px, 2.2vmin);
  display: flex;
  z-index: 6;
}
.corner-btns > * + * { margin-left: 8px; }

.icon-btn {
  width: 38px;
  width: max(38px, 7vmin);
  height: 38px;
  height: max(38px, 7vmin);
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  color: #a2653f;
  font-size: 14px;
  font-size: max(14px, 2.6vmin);
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 10px rgba(170, 110, 70, 0.18);
  cursor: pointer;
  transition: transform 0.12s, background 0.12s;
}
.icon-btn:active { transform: scale(0.92); background: #fff; }

/* ---------- 提示 ---------- */
.hint {
  position: absolute;
  left: 50%;
  top: 63%;
  transform: translate(-50%, 0);
  padding: 8px 18px;
  border-radius: 999px;
  background: rgba(91, 59, 46, 0.72);
  color: #fff7ec;
  font-size: 13px;
  font-size: max(13px, 2.9vmin);
  font-weight: 600;
  letter-spacing: 0.02em;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
  z-index: 5;
  white-space: nowrap;
}
.hint.show { opacity: 1; visibility: visible; animation: hintFloat 2.4s ease-in-out infinite; }
@keyframes hintFloat {
  0%, 100% { transform: translate(-50%, 0); }
  50% { transform: translate(-50%, -6px); }
}

/* ---------- 通用弹层 ---------- */
.screen {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3.4vmin;
  padding: clamp(16px, 4vmin, 40px);
  background: rgba(255, 244, 232, 0.985);
  opacity: 0;
  visibility: hidden;
  transform: scale(0.98);
  transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s;
  z-index: 4;
}
.screen > * + * { margin-top: 2.2vmin; }
.screen.show { opacity: 1; visibility: visible; transform: scale(1); }

/* 毛玻璃只是增强：Chrome 61 用上面的实色背景 */
@supports ((-webkit-backdrop-filter: blur(10px)) or (backdrop-filter: blur(10px))) {
  .screen {
    background: rgba(255, 244, 232, 0.9);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
  }
  .icon-btn {
    background: rgba(255, 255, 255, 0.62);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
  }
}

/* ---------- 首页 ---------- */
.logo-wrap { text-align: center; }
.logo-sub {
  font-size: 10px;
  font-size: max(10px, 2.1vmin);
  letter-spacing: 0.35em;
  color: rgba(176, 120, 92, 0.75);
  font-weight: 700;
  margin-bottom: 4px;
}
.logo {
  font-size: 11.5vmin;
  font-size: clamp(40px, 11.5vmin, 76px);
  font-weight: 900;
  letter-spacing: 0.02em;
  color: #5b3b2e;
  line-height: 1.08;
  text-shadow: 0 2px 0 #fff, 0 6px 0 rgba(255, 255, 255, 0.6), 0 12px 22px rgba(200, 130, 90, 0.28);
}
.logo span { color: #f4661e; }
.tagline {
  margin-top: 8px;
  font-size: 13px;
  font-size: max(13px, 3vmin);
  font-weight: 600;
  color: rgba(150, 96, 70, 0.9);
}

/* canvas 自带 720×150 的固有比例，height:auto 即可等比，无需 aspect-ratio */
#menu-chain {
  width: 100%;
  max-width: 460px;
  height: auto;
  opacity: 0.95;
}

.howto {
  list-style: none;
  display: flex;
  flex-direction: column;
  font-size: 12px;
  font-size: max(12px, 2.75vmin);
  color: rgba(110, 74, 56, 0.92);
  line-height: 1.55;
  padding: 0 6px;
  max-width: 440px;
}
.howto li + li { margin-top: 6px; }
.howto li { position: relative; padding-left: 1.5em; }
.howto li::before { content: "🐾"; position: absolute; left: 0; font-size: 0.9em; }
.howto b { color: #e2702a; }

/* ---------- 按钮 ---------- */
.btn-main {
  border: none;
  cursor: pointer;
  padding: 0.72em 2.1em;
  border-radius: 999px;
  font-size: 4.6vmin;
  font-size: clamp(18px, 4.6vmin, 28px);
  font-weight: 900;
  letter-spacing: 0.12em;
  color: #fff8ef;
  background: linear-gradient(180deg, #ffb066 0%, #ff8a3d 100%);
  box-shadow: 0 8px 0 #e2702a, 0 16px 26px rgba(226, 112, 42, 0.32);
  transition: transform 0.1s, box-shadow 0.1s;
  font-family: inherit;
  -webkit-appearance: none;
  appearance: none;
}
.btn-main:active { transform: translateY(5px); box-shadow: 0 3px 0 #e2702a, 0 8px 14px rgba(226, 112, 42, 0.3); }

.btn-ghost {
  border: 2px solid rgba(226, 112, 42, 0.45);
  background: rgba(255, 255, 255, 0.66);
  color: #c9682b;
  cursor: pointer;
  padding: 0.6em 1.5em;
  border-radius: 999px;
  font-size: 14px;
  font-size: max(14px, 3.2vmin);
  font-weight: 700;
  font-family: inherit;
  transition: transform 0.1s, background 0.12s;
  -webkit-appearance: none;
  appearance: none;
}
.btn-ghost:active { transform: scale(0.96); background: #fff; }

.row-btns {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
}
.row-btns > * + * { margin-left: 10px; }

.footnote {
  font-size: 11px;
  font-size: max(11px, 2.4vmin);
  color: rgba(150, 100, 76, 0.75);
  text-align: center;
  line-height: 1.5;
}

/* ---------- 结束页 ---------- */
.over-head { display: flex; align-items: center; }
.over-head > * + * { margin-left: 10px; }
.over-label {
  font-size: 12px;
  font-size: max(12px, 2.6vmin);
  letter-spacing: 0.3em;
  color: rgba(150, 96, 70, 0.85);
  font-weight: 700;
}
.record {
  background: linear-gradient(180deg, #ff7aa2, #ff4d7d);
  color: #fff;
  font-size: 12px;
  font-size: max(12px, 2.6vmin);
  font-weight: 900;
  letter-spacing: 0.14em;
  padding: 4px 12px;
  border-radius: 999px;
  transform: rotate(-6deg) scale(0);
  transition: transform 0.3s cubic-bezier(0.2, 1.6, 0.4, 1);
  box-shadow: 0 4px 12px rgba(255, 77, 125, 0.4);
}
.record.show { transform: rotate(-6deg) scale(1); }
.over-score {
  font-size: 21vmin;
  font-size: clamp(76px, 21vmin, 148px);
  font-weight: 900;
  line-height: 1;
  color: #f4661e;
  text-shadow: 0 4px 0 #fff, 0 10px 0 rgba(255, 255, 255, 0.7), 0 18px 30px rgba(226, 112, 42, 0.3);
  font-variant-numeric: tabular-nums;
}
.over-best { font-size: 13px; font-size: max(13px, 2.9vmin); color: rgba(140, 92, 68, 0.9); }
.over-best b { color: #5b3b2e; font-size: 1.2em; }

.stat-grid {
  display: flex;
  width: 100%;
  max-width: 440px;
}
.stat-grid > div + div { margin-left: 8px; }
.stat-grid > div {
  flex: 1;
  min-width: 0;
  background: rgba(255, 255, 255, 0.78);
  border-radius: 16px;
  padding: 10px 4px;
  text-align: center;
  box-shadow: 0 4px 12px rgba(190, 130, 95, 0.12);
}
.stat-grid span { display: block; font-size: 10px; font-size: max(10px, 2.2vmin); color: rgba(150, 100, 76, 0.8); margin-bottom: 2px; }
.stat-grid b { font-size: 15px; font-size: max(15px, 3.4vmin); color: #5b3b2e; }

/* ---------- 暂停 ---------- */
.pause-title {
  font-size: 7vmin;
  font-size: clamp(26px, 7vmin, 42px);
  font-weight: 900;
  color: #5b3b2e;
  letter-spacing: 0.08em;
  text-shadow: 0 3px 0 #fff;
}

/* ---------- 战绩卡 ---------- */
#share-img {
  max-width: 100%;
  max-height: 58%;
  max-height: 58vh;
  border-radius: 18px;
  box-shadow: 0 14px 34px rgba(180, 110, 70, 0.28);
  background: #fff;
}
.save-tip {
  position: absolute;
  bottom: 12%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(91, 59, 46, 0.86);
  color: #fff7ec;
  font-size: 12px;
  font-size: max(12px, 2.6vmin);
  padding: 8px 16px;
  border-radius: 999px;
  opacity: 0;
  transition: opacity 0.25s;
  pointer-events: none;
  white-space: nowrap;
}
.save-tip.show { opacity: 1; }

/* ---------- Flex gap 增强层（Chrome 61 走上面的 margin 基线） ---------- */
.supports-flex-gap .corner-btns { column-gap: 8px; }
.supports-flex-gap .corner-btns > * + * { margin-left: 0; }
.supports-flex-gap .screen { row-gap: 2.2vmin; row-gap: clamp(10px, 2.2vmin, 22px); }
.supports-flex-gap .screen > * + * { margin-top: 0; }
.supports-flex-gap .howto { row-gap: 6px; }
.supports-flex-gap .howto li + li { margin-top: 0; }
.supports-flex-gap .row-btns { column-gap: 10px; }
.supports-flex-gap .row-btns > * + * { margin-left: 0; }
.supports-flex-gap .over-head { column-gap: 10px; }
.supports-flex-gap .over-head > * + * { margin-left: 0; }
.supports-flex-gap .stat-grid { column-gap: 8px; }
.supports-flex-gap .stat-grid > div + div { margin-left: 0; }

@media (max-height: 560px) {
  .howto { display: none; }
  #menu-chain { max-width: 380px; }
  .logo { font-size: 9vmin; font-size: clamp(30px, 9vmin, 46px); }
}

/* ============================================================
 * 图鉴收集 + 评论区挑战（2026-10-26 按 GAME-CONVENTIONS §9/§10 追加）
 * ============================================================ */
.hidden { display: none !important; }

/* ---------- 图鉴解锁提示（游戏内浮层） ---------- */
.coll-toast {
  position: absolute;
  top: 13%;
  left: 50%;
  transform: translate(-50%, -6px);
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(91, 59, 46, 0.88);
  color: #fff7ec;
  font-size: 12px;
  font-size: max(12px, 2.7vmin);
  font-weight: 700;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.24s, transform 0.24s, visibility 0.24s;
  pointer-events: none;
  z-index: 6;
}
.coll-toast.show { opacity: 1; visibility: visible; transform: translate(-50%, 0); }

/* ---------- 被挑战横幅 ---------- */
.rival {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 440px;
  padding: 9px 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 6px 18px rgba(190, 130, 90, 0.16);
  font-size: 13px;
  font-size: max(13px, 2.9vmin);
  color: #7a5038;
}
.rival-line { flex: 1; margin-right: 10px; line-height: 1.45; }
.rival-line b { color: #e2702a; }
.btn-mini {
  flex: 0 0 auto;
  padding: 7px 13px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffa75c, #ff8a3d);
  color: #fff;
  font-family: inherit;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  box-shadow: 0 4px 0 #e2702a;
}
.btn-mini:active { transform: translateY(2px); box-shadow: 0 2px 0 #e2702a; }

/* ---------- 首页统计行 / 猫名 ---------- */
.menu-stats {
  display: flex;
  align-items: baseline;
  justify-content: center;
  flex-wrap: wrap;
  font-size: 12px;
  font-size: max(12px, 2.7vmin);
  color: rgba(150, 96, 70, 0.95);
  font-weight: 600;
}
.menu-stats b { color: #e2702a; font-size: 1.35em; font-weight: 900; }
.menu-stats .dot { margin: 0 6px; color: rgba(176, 120, 92, 0.5); }

.nick-row {
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 340px;
  padding: 6px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.8);
  box-shadow: 0 4px 12px rgba(190, 130, 90, 0.12);
}
.nick-row label { flex: 0 0 auto; font-size: 12px; font-weight: 800; color: rgba(150, 96, 70, 0.9); margin-right: 10px; }
#nick {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  color: #5b3b2e;
  text-align: center;
}
#nick::placeholder { color: rgba(160, 110, 84, 0.45); font-weight: 500; }

.btn-small {
  width: auto;
  min-width: 46%;
  padding: 10px 18px;
  font-size: 13px;
  font-size: max(13px, 3vmin);
}

/* ---------- 图鉴进度条（首页/结算共用） ---------- */
.coll-mini {
  width: 100%;
  max-width: 440px;
  background: rgba(255, 255, 255, 0.78);
  border-radius: 14px;
  padding: 9px 12px;
  box-shadow: 0 4px 12px rgba(190, 130, 95, 0.12);
}
.coll-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-size: 12px;
  font-size: max(12px, 2.6vmin);
  color: rgba(150, 100, 76, 0.9);
  font-weight: 700;
}
.coll-head b { color: #e2702a; font-size: 1.3em; }
.coll-track {
  height: 6px;
  margin-top: 6px;
  border-radius: 999px;
  background: rgba(198, 150, 110, 0.24);
  overflow: hidden;
}
.coll-fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #ffcf6a, #ff9d5c);
  transition: width 0.35s ease;
}
.compare {
  width: 100%;
  max-width: 440px;
  padding: 9px 12px;
  border-radius: 14px;
  background: rgba(255, 238, 214, 0.95);
  font-size: 13px;
  font-size: max(13px, 2.8vmin);
  color: #7a5038;
  line-height: 1.5;
}

/* ---------- 图鉴面板 ---------- */
#gallery {
  justify-content: flex-start;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  text-align: center;
}
.gal-head { width: 100%; max-width: 460px; text-align: left; }
.gal-title { font-size: 20px; font-size: max(20px, 4.6vmin); font-weight: 900; color: #5b3b2e; }
.gal-title span { color: #e2702a; }
.gal-sub { margin-top: 3px; font-size: 12px; font-size: max(12px, 2.7vmin); color: rgba(150, 96, 70, 0.9); }
.gal-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  width: 100%;
  max-width: 460px;
  margin-top: 6px;
}
.gal-cell {
  width: calc(50% - 5px);
  margin-top: 10px;
  padding: 10px 8px 9px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 6px 16px rgba(190, 130, 90, 0.12);
}
.gal-cell.locked { background: rgba(255, 255, 255, 0.5); box-shadow: none; }
.gal-cell canvas { display: block; width: 64px; height: 64px; margin: 0 auto; }
.gal-name { margin-top: 5px; font-size: 13px; font-size: max(13px, 2.9vmin); font-weight: 800; color: #5b3b2e; }
.gal-cell.locked .gal-name { color: rgba(120, 96, 82, 0.55); }
.gal-meta { margin-top: 2px; font-size: 11px; font-size: max(11px, 2.4vmin); color: rgba(150, 100, 76, 0.85); }
.gal-tip { font-size: 11px; font-size: max(11px, 2.4vmin); color: rgba(160, 110, 84, 0.75); margin-top: 10px; }

/* ---------- 分享面板的评论文案 ---------- */
.row-btns-2 { margin-top: 8px; }
.share-text {
  width: 100%;
  max-width: 440px;
  max-height: 22%;
  max-height: 22vh;
  overflow-y: auto;
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.9);
  font-size: 12px;
  font-size: max(12px, 2.6vmin);
  color: #6b4a38;
  line-height: 1.6;
  text-align: left;
  white-space: pre-wrap;
  -webkit-user-select: text;
  user-select: text;
}

@media (max-height: 620px) {
  .menu-stats { font-size: 11px; }
  .nick-row { padding: 5px 12px; }
  .btn-small { padding: 8px 14px; }
  .gal-cell canvas { width: 52px; height: 52px; }
  .gal-cell { margin-top: 8px; padding: 8px 6px; }
  .coll-mini, .compare { padding: 7px 10px; }
  .stat-grid > div { padding: 8px 3px; }
  #over-score { font-size: 20vmin; font-size: clamp(64px, 20vmin, 120px); }
}

/* 结算页三按钮一行放得下 */
.row-btns > .btn-ghost {
  padding-left: 12px;
  padding-right: 12px;
  font-size: 12px;
  font-size: max(12px, 2.9vmin);
}

/* ============================================================
 * 短屏兜底（2026-10-27）：保证「开始」与「图鉴」入口一定在首屏
 * - .screen 可纵向滚动 + auto 外边距：内容超出时从顶部开始，可滑到按钮
 * - 矮屏逐级收起说明文字/进化链，优先保住两个按钮
 * ============================================================ */
.screen {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}
#menu > *:first-child,
#over > *:first-child,
#pause > *:first-child { margin-top: auto; }
#menu > *:last-child,
#over > *:last-child,
#pause > *:last-child { margin-bottom: auto; }

@media (max-height: 700px) {
  #menu-chain { max-width: 340px; }
}

@media (max-height: 600px) {
  .howto { display: none; }
  #menu-chain { display: none; }
  .logo { font-size: 9.5vmin; font-size: clamp(30px, 9.5vmin, 52px); }
  .logo-sub { letter-spacing: 0.24em; margin-bottom: 2px; }
  .tagline { margin-top: 5px; font-size: 12px; font-size: max(12px, 2.7vmin); }
  .screen > * + * { margin-top: 1.4vmin; margin-top: clamp(7px, 1.5vmin, 14px); }
  .menu-stats { font-size: 11px; }
  .nick-row { padding: 4px 10px; }
  .btn-main { padding-top: 11px; padding-bottom: 11px; }
  .footnote { display: none; }
}

@media (max-height: 500px) {
  .logo { font-size: 8.5vmin; font-size: clamp(26px, 8.5vmin, 44px); }
  .tagline { display: none; }
  .btn-small { padding-top: 7px; padding-bottom: 7px; }
}
