/* ==========================================================================
   军了个训 · 样式表
   目录：
     01 变量 / 基础
     02 操场背景（天空、云、太阳、跑道、看台、标语、红旗）
     03 顶栏与状态栏
     04 屏幕与面板
     05 首页（难度卡片、规则、评价表）
     06 牌桌与卡牌（11 种图案主题、遮挡、消除动画）
     07 卡槽 / 暂存区 / 道具
     08 结算页
     09 排行榜
     10 特效（飘字、连击、彩带、Toast）
     11 响应式
   ========================================================================== */

/* ------------------------------ 01 变量 / 基础 ------------------------------ */
:root {
  --olive-900: #1b2312;
  --olive-800: #26311a;
  --olive-700: #3b4d26;
  --olive-600: #4f6532;
  --khaki: #cabf8e;
  --sand: #efe6c8;
  --paper: #fbf8ec;
  --gold: #e8c33a;
  --red: #c8442f;
  --blue: #2f5fa8;
  --ink: #16210f;
  --shadow-lg: 0 18px 40px rgba(10, 16, 5, 0.32);
  --shadow-md: 0 8px 20px rgba(10, 16, 5, 0.22);
  --radius: 18px;
  --font: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", "Noto Sans SC", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: var(--font);
  color: var(--ink);
  background: #cfe9c4;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

button { font-family: inherit; }

/* --------------------- 02 操场背景（纯 CSS，装饰层） --------------------- */
.bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.bg-sky {
  position: absolute;
  inset: 0 0 44% 0;
  background: linear-gradient(180deg, #6fc0ea 0%, #a5dcf3 45%, #d9f0e4 100%);
}

.sun {
  position: absolute;
  right: 10%;
  top: 6%;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  background: radial-gradient(circle, #fffbe0 0%, #ffdc63 55%, rgba(255, 220, 99, 0) 72%);
  filter: drop-shadow(0 0 40px rgba(255, 214, 88, 0.75));
  animation: sunPulse 6s ease-in-out infinite;
}

.cloud {
  position: absolute;
  height: 30px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 6px 14px rgba(120, 160, 190, 0.25);
  animation: drift linear infinite;
}
.cloud::before,
.cloud::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: inherit;
}
.cloud::before { width: 46px; height: 46px; top: -22px; left: 16px; }
.cloud::after { width: 34px; height: 34px; top: -14px; left: 56px; }

.c1 { width: 120px; top: 12%; left: -20%; animation-duration: 58s; }
.c2 { width: 90px; top: 26%; left: -35%; animation-duration: 76s; animation-delay: -12s; opacity: 0.85; }
.c3 { width: 150px; top: 4%; left: -50%; animation-duration: 92s; animation-delay: -30s; opacity: 0.7; }

.bg-ground {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 58%;
  background: linear-gradient(180deg, #8cc24a 0%, #6ea63a 40%, #54892c 100%);
}

/* 塑胶跑道：椭圆外圈 + 白色分道线 + 内场草地 */
.track {
  position: absolute;
  left: -12%;
  right: -12%;
  top: 2%;
  height: 82%;
  border-radius: 50%;
  background:
    radial-gradient(ellipse at center, #74ad3c 0 39%, rgba(116, 173, 60, 0) 39.6%),
    repeating-radial-gradient(ellipse at center, rgba(255, 255, 255, 0) 0 44px, rgba(255, 255, 255, 0.45) 44px 47px),
    radial-gradient(ellipse at center, #74ad3c 0 39%, #bb5642 39.8% 100%);
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.45), var(--shadow-md);
}

.infield { position: absolute; inset: 25% 22%; }

.center-circle {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 26%;
  aspect-ratio: 1 / 1;
  transform: translate(-50%, -50%);
  border: 3px solid rgba(255, 255, 255, 0.65);
  border-radius: 50%;
}

.midline {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 0;
  border-top: 3px solid rgba(255, 255, 255, 0.6);
}

.lane { position: absolute; border: 3px solid rgba(255, 255, 255, 0.35); border-radius: 50%; }
.l1 { inset: 14%; }
.l2 { inset: 26%; }
.l3 { inset: 38%; }

/* 看台 */
.podium {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 38%;
  height: 90px;
  background:
    repeating-linear-gradient(180deg, #7f8c6a 0 12px, #6a7657 12px 24px);
  border-top-right-radius: 14px;
  box-shadow: 0 -6px 18px rgba(0, 0, 0, 0.18);
  opacity: 0.9;
}

/* 军训标语横幅 */
.slogan {
  position: absolute;
  left: 50%;
  top: 6%;
  transform: translateX(-50%);
  padding: 6px 22px;
  border-radius: 999px;
  background: rgba(200, 68, 47, 0.88);
  color: #fff6e2;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 3px;
  white-space: nowrap;
  box-shadow: var(--shadow-md);
}

/* 红旗（带飘动动画） */
.flag { position: absolute; right: 6%; bottom: 8%; width: 90px; height: 150px; }
.flag-pole {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 5px;
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, #cfd3d6, #8d959b);
}
.flag-cloth {
  position: absolute;
  left: 5px;
  top: 4px;
  width: 78px;
  height: 52px;
  background: linear-gradient(120deg, #e04b31, #b8291a);
  border-radius: 2px 6px 6px 2px;
  transform-origin: left center;
  animation: wave 3.2s ease-in-out infinite;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.2);
}
.flag-cloth::after {
  content: "★";
  position: absolute;
  left: 8px;
  top: 10px;
  color: #ffe680;
  font-size: 20px;
}

/* ------------------------------ 03 顶栏 ------------------------------ */
.app {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 16px;
  background: linear-gradient(180deg, rgba(27, 35, 18, 0.96), rgba(27, 35, 18, 0.82));
  border-bottom: 2px solid rgba(232, 195, 58, 0.4);
  backdrop-filter: blur(6px);
  box-shadow: var(--shadow-md);
}

.brand { display: flex; align-items: center; gap: 10px; }

.brand-badge {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(160deg, #6f8442, #3d4f24);
  border: 2px solid var(--gold);
  color: var(--gold);
  font-size: 22px;
  font-weight: 900;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.25);
}

.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { color: var(--sand); font-size: 19px; letter-spacing: 2px; }
.brand-text em { color: rgba(239, 230, 200, 0.65); font-size: 11px; font-style: normal; letter-spacing: 0.5px; }

.hud { display: flex; gap: 8px; margin-left: auto; flex-wrap: wrap; }

.chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 64px;
  padding: 4px 10px;
  border-radius: 10px;
  background: rgba(239, 230, 200, 0.1);
  border: 1px solid rgba(239, 230, 200, 0.22);
}
.chip span { font-size: 10px; color: rgba(239, 230, 200, 0.7); }
.chip b { font-size: 17px; color: var(--gold); font-variant-numeric: tabular-nums; }

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid rgba(239, 230, 200, 0.3);
  background: rgba(239, 230, 200, 0.12);
  color: var(--sand);
  font-size: 18px;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s ease;
}
.icon-btn:hover { transform: translateY(-2px); background: rgba(239, 230, 200, 0.22); }

/* ------------------------------ 04 屏幕与面板 ------------------------------ */
.stage {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 18px 16px 8px;
}

.screen { display: none; width: 100%; justify-content: center; }
.screen.active { display: flex; animation: screenIn 0.36s ease both; }

.panel {
  width: 100%;
  max-width: 940px;
  padding: 22px;
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(251, 248, 236, 0.97), rgba(240, 234, 214, 0.97));
  border: 2px solid rgba(59, 77, 38, 0.35);
  box-shadow: var(--shadow-lg);
}

/* ------------------------------ 05 首页 ------------------------------ */
.home-panel { max-width: 860px; }

.home-title {
  margin: 0 0 6px;
  text-align: center;
  font-size: 40px;
  letter-spacing: 10px;
  color: var(--olive-700);
  text-shadow: 2px 2px 0 rgba(232, 195, 58, 0.5);
}

.home-sub {
  margin: 0 auto 18px;
  max-width: 640px;
  text-align: center;
  font-size: 14px;
  line-height: 1.8;
  color: #46512f;
}
.home-sub b { color: var(--red); }

.field-row { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.field-row label { font-size: 13px; font-weight: 700; color: var(--olive-700); white-space: nowrap; }
.field-row input {
  flex: 1;
  min-width: 0;
  padding: 11px 14px;
  font-size: 15px;
  border-radius: 12px;
  border: 2px solid rgba(59, 77, 38, 0.3);
  background: #fff;
  color: var(--ink);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.field-row input:focus { border-color: var(--olive-600); box-shadow: 0 0 0 4px rgba(110, 166, 58, 0.2); }

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

.diff-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 12px 12px;
  text-align: left;
  border-radius: 14px;
  border: 2px solid rgba(59, 77, 38, 0.25);
  background: linear-gradient(180deg, #ffffff, #f1ecd8);
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.diff-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.diff-card strong { font-size: 17px; color: var(--olive-700); letter-spacing: 1px; }
.diff-card em { font-size: 11px; font-style: normal; color: #6a7452; line-height: 1.5; }
.diff-card .diff-tag {
  position: absolute;
  right: 10px;
  top: 10px;
  padding: 2px 8px;
  font-size: 11px;
  border-radius: 999px;
  background: rgba(59, 77, 38, 0.12);
  color: var(--olive-700);
}
.diff-card.active {
  border-color: var(--gold);
  box-shadow: 0 0 0 4px rgba(232, 195, 58, 0.3), var(--shadow-md);
  background: linear-gradient(180deg, #fffdf2, #f3ecc9);
}
.diff-card.active .diff-tag { background: var(--gold); color: #4a3c05; }

.home-actions { display: flex; gap: 12px; margin: 18px 0 12px; flex-wrap: wrap; }

.btn {
  padding: 12px 22px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 1px;
  border-radius: 12px;
  border: 2px solid rgba(59, 77, 38, 0.3);
  background: linear-gradient(180deg, #ffffff, #eae4cf);
  color: var(--olive-700);
  cursor: pointer;
  transition: transform 0.14s ease, box-shadow 0.2s ease, filter 0.2s ease;
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.btn:active { transform: translateY(0) scale(0.98); }

.btn-primary {
  border-color: #2f3f1c;
  background: linear-gradient(180deg, #6f8442, #40521f);
  color: #fdf8e4;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.3);
}
.btn-ghost { background: rgba(255, 255, 255, 0.55); }
.btn-sm { padding: 8px 14px; font-size: 13px; }

.home-stats {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  font-size: 13px;
  color: #5a6540;
  padding-bottom: 6px;
  border-bottom: 1px dashed rgba(59, 77, 38, 0.25);
}
.home-stats b { color: var(--red); font-size: 15px; }

.rules { margin-top: 14px; }
.rules h2 { margin: 0 0 8px; font-size: 15px; color: var(--olive-700); letter-spacing: 1px; }
.rule-list { margin: 0 0 14px; padding-left: 20px; font-size: 13px; line-height: 1.9; color: #4c5636; }
.rule-list b { color: var(--red); }

/* 恶搞音效库展示 */
.sfx-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
  padding: 12px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(43, 56, 27, 0.06), rgba(43, 56, 27, 0.02));
  border: 2px dashed rgba(59, 77, 38, 0.25);
}
.sfx-box-title { font-size: 12px; font-weight: 700; color: var(--olive-700); }
.sfx-list { display: flex; flex-wrap: wrap; gap: 6px; }
.sfx-list i {
  padding: 3px 10px;
  border-radius: 999px;
  font-style: normal;
  font-size: 11px;
  color: #5a6540;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(59, 77, 38, 0.18);
}

.rating-table { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.rating-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 8px;
  border-radius: 12px;
  border: 2px solid transparent;
  background: rgba(255, 255, 255, 0.75);
  text-align: center;
  font-size: 11px;
  color: #5a6540;
}
.rating-item b { font-size: 15px; letter-spacing: 1px; }
.rating-item em { font-style: normal; font-size: 10px; opacity: 0.75; }
.r-explode { border-color: #d9a400; background: linear-gradient(180deg, #fff8db, #ffeaa8); }
.r-explode b { color: #a17600; }
.r-top { border-color: #7f9c46; background: linear-gradient(180deg, #f6fbe6, #e2eec2); }
.r-top b { color: #4d6620; }
.r-above { border-color: #6f9bb8; background: linear-gradient(180deg, #f1f8fd, #d9e9f4); }
.r-above b { color: #2f5f86; }
.r-npc { border-color: #b3a98a; }
.r-bottom { border-color: #cf9a8f; background: linear-gradient(180deg, #fdf1ee, #f7ded8); }
.r-bottom b { color: #a33a26; }

/* ------------------------------ 06 牌桌 ------------------------------ */
.game-wrap { width: 100%; max-width: 780px; display: flex; flex-direction: column; gap: 12px; }

.prop-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.prop {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: 12px;
  border: 2px solid rgba(232, 195, 58, 0.5);
  background: linear-gradient(180deg, rgba(43, 56, 27, 0.94), rgba(27, 35, 18, 0.94));
  color: var(--sand);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.14s ease, filter 0.2s ease;
}
.prop b {
  display: grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--gold);
  color: #40340a;
  font-size: 12px;
}
.prop:hover { transform: translateY(-2px); }
.prop.used { filter: grayscale(0.8) brightness(0.7); cursor: not-allowed; }

.board-wrap {
  position: relative;
  width: 100%;
  border-radius: 20px;
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.12), transparent 60%),
    linear-gradient(180deg, rgba(38, 49, 26, 0.86), rgba(24, 32, 16, 0.9));
  border: 2px solid rgba(232, 195, 58, 0.3);
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.35), var(--shadow-lg);
  overflow: hidden;
  transition: height 0.2s ease;
}
.board-wrap::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.03) 0 12px, transparent 12px 24px);
  pointer-events: none;
}

.board { position: absolute; top: 0; left: 0; transform-origin: top left; }

/* 卡牌 */
.tile {
  position: absolute;
  width: 68px;
  height: 68px;
  padding: 3px 3px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  border-radius: 13px;
  border: 2px solid var(--tbd, #7a6f4c);
  background: linear-gradient(180deg, var(--tbg1, #f2ead0), var(--tbg2, #d8caa0));
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.3), inset 0 2px 0 rgba(255, 255, 255, 0.55);
  cursor: pointer;
  transform: rotate(var(--rot, 0deg));
  animation: tileIn 0.3s cubic-bezier(0.2, 1.5, 0.5, 1) backwards;
  transition: transform 0.13s ease, box-shadow 0.13s ease, filter 0.2s ease;
  will-change: transform;
}
.tile:hover { transform: rotate(0deg) translateY(-4px) scale(1.05); box-shadow: 0 9px 16px rgba(0, 0, 0, 0.35); z-index: 9000 !important; }
.tile.covered { filter: brightness(0.62) saturate(0.6); cursor: not-allowed; }
.tile.covered::after {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: 13px;
  background: linear-gradient(180deg, rgba(10, 16, 5, 0.42), rgba(10, 16, 5, 0.62));
  pointer-events: none;
}
.tile.covered:hover { transform: rotate(var(--rot, 0deg)); box-shadow: 0 3px 0 rgba(0, 0, 0, 0.3); }
.tile.picked { animation: tileOut 0.24s ease forwards; pointer-events: none; z-index: 99000 !important; }
.tile.shake { animation: shake 0.32s ease; }
.tile.removed { display: none; }

.tile-icon { display: block; width: 38px; height: 38px; }
.tile-icon svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.25)); }
.tile-name { font-size: 9px; font-weight: 700; letter-spacing: 0.5px; color: #3b3a22; white-space: nowrap; line-height: 1; }
.tile.covered .tile-name { color: rgba(255, 255, 255, 0.55); }

/* 11 种图案主题配色 */
.t-olive  { --tbg1: #eef3d8; --tbg2: #c3d18f; --tbd: #6d7d3c; }
.t-camo   { --tbg1: #e8ecd8; --tbg2: #b7c095; --tbd: #5f6a3a; }
.t-steel  { --tbg1: #eae5d8; --tbg2: #bfb5a2; --tbd: #6b6152; }
.t-gun    { --tbg1: #e4e8dc; --tbg2: #b2bba2; --tbd: #5b6349; }
.t-cream  { --tbg1: #fdf8e8; --tbg2: #e8daae; --tbd: #a58f5a; }
.t-sand   { --tbg1: #f7eed6; --tbg2: #e0cb9d; --tbd: #9c8354; }
.t-sand2  { --tbg1: #f4e8d2; --tbg2: #d9bf8d; --tbd: #8f7546; }
.t-khaki  { --tbg1: #efe8ce; --tbg2: #ccbc8e; --tbd: #847345; }
.t-khaki2 { --tbg1: #eae4cc; --tbg2: #c4ba8f; --tbd: #7d7048; }
.t-moss   { --tbg1: #e9efdc; --tbg2: #bcc9a0; --tbd: #67754a; }
.t-blue   { --tbg1: #eaf2fc; --tbg2: #bad1ef; --tbd: #2f5fa8; }

/* --------------------- 07 卡槽 / 暂存区 / 道具 --------------------- */
.holding {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 14px;
  background: rgba(27, 35, 18, 0.86);
  border: 2px dashed rgba(232, 195, 58, 0.5);
}
.holding.show { display: flex; animation: screenIn 0.28s ease both; }
.holding-tip { font-size: 11px; color: rgba(239, 230, 200, 0.75); }

.hold-tile {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  border: 2px solid var(--tbd, #7a6f4c);
  background: linear-gradient(180deg, var(--tbg1, #f2ead0), var(--tbg2, #d8caa0));
  cursor: pointer;
  animation: slotPop 0.26s cubic-bezier(0.2, 1.6, 0.5, 1);
  transition: transform 0.14s ease;
}
.hold-tile:hover { transform: translateY(-3px) scale(1.05); }
.hold-tile .slot-icon { width: 34px; height: 34px; }
.hold-tile .slot-icon svg { width: 100%; height: 100%; }

.tray-wrap { position: relative; }

.tray {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(38, 49, 26, 0.92), rgba(22, 29, 16, 0.95));
  border: 2px solid rgba(232, 195, 58, 0.38);
  box-shadow: var(--shadow-md);
}
.tray.pulse { animation: trayPulse 0.34s ease; }

.slot {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  border: 2px dashed rgba(239, 230, 200, 0.25);
  background: rgba(255, 255, 255, 0.05);
  display: grid;
  place-items: center;
}
.slot.filled {
  border-style: solid;
  border-color: var(--tbd, #7a6f4c);
  background: linear-gradient(180deg, var(--tbg1, #f2ead0), var(--tbg2, #d8caa0));
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.5);
  animation: slotPop 0.26s cubic-bezier(0.2, 1.6, 0.5, 1);
}
.slot .slot-icon { width: 74%; height: 74%; display: block; }
.slot .slot-icon svg { width: 100%; height: 100%; display: block; }

.tray-tip { margin-top: 8px; text-align: center; font-size: 12px; color: rgba(20, 28, 12, 0.75); font-weight: 700; }
.tray-tip b { color: var(--red); }

/* ------------------------------ 08 结算页 ------------------------------ */
.result-panel { max-width: 720px; text-align: center; }

.result-rating {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 16px 10px 18px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(240, 234, 214, 0.9));
  border: 2px dashed rgba(59, 77, 38, 0.3);
  animation: ratingPop 0.5s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}
.result-emoji { font-size: 46px; animation: bob 1.6s ease-in-out infinite; }
.result-label { font-size: 40px; font-weight: 900; letter-spacing: 6px; color: var(--olive-700); text-shadow: 2px 2px 0 rgba(232, 195, 58, 0.45); }
.result-msg { font-size: 15px; font-weight: 700; color: var(--red); }

.r-explode .result-rating { border-color: #d9a400; background: linear-gradient(180deg, #fffaea, #ffeaa8); }
.r-explode .result-label { color: #a17600; }
.r-top .result-rating { border-color: #7f9c46; background: linear-gradient(180deg, #f8fce9, #e2eec2); }
.r-top .result-label { color: #4d6620; }
.r-above .result-rating { border-color: #6f9bb8; background: linear-gradient(180deg, #f4faff, #d9e9f4); }
.r-above .result-label { color: #2f5f86; }
.r-npc .result-rating { border-color: #b3a98a; }
.r-bottom .result-rating { border-color: #cf9a8f; background: linear-gradient(180deg, #fdf3f0, #f7ded8); }
.r-bottom .result-label { color: #a33a26; }

.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin: 16px 0;
}
.stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(59, 77, 38, 0.18);
}
.stat span { font-size: 11px; color: #6a7452; }
.stat b { font-size: 20px; color: var(--olive-700); font-variant-numeric: tabular-nums; }

.coach {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px;
  text-align: left;
  font-size: 14px;
  line-height: 1.7;
  border-radius: 14px;
  background: rgba(59, 77, 38, 0.08);
  border-left: 5px solid var(--olive-600);
  color: #46512f;
}
.coach b { color: var(--olive-700); }
.coach-extra { font-size: 12px; color: #7a8460; }

.result-actions { display: flex; gap: 10px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }

/* ------------------------------ 09 排行榜 ------------------------------ */
.rank-panel { max-width: 900px; }
.rank-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.rank-head h2 { margin: 0; font-size: 20px; color: var(--olive-700); letter-spacing: 2px; }
.rank-tabs { display: flex; gap: 6px; margin-left: auto; }
.tab {
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 700;
  border-radius: 10px;
  border: 2px solid rgba(59, 77, 38, 0.25);
  background: rgba(255, 255, 255, 0.6);
  color: var(--olive-700);
  cursor: pointer;
}
.tab.active { background: linear-gradient(180deg, #6f8442, #40521f); color: #fdf8e4; border-color: #2f3f1c; }

.rank-note { margin: 0 0 10px; font-size: 12px; color: #6a7452; }
.rank-body { max-height: 58vh; overflow: auto; border-radius: 12px; }

.rank-table { display: flex; flex-direction: column; gap: 4px; }
.rank-row {
  display: grid;
  grid-template-columns: 56px 1.4fr 1fr 1fr 0.9fr 0.9fr 0.7fr;
  align-items: center;
  gap: 6px;
  padding: 9px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.7);
  font-size: 13px;
  color: #3f4a2b;
}
.rank-row.head {
  position: sticky;
  top: 0;
  background: linear-gradient(180deg, #e9e3cb, #dbd4b8);
  font-weight: 700;
  font-size: 12px;
  color: #5a6540;
  z-index: 2;
}
.rank-row.top1 { background: linear-gradient(90deg, #fff6cf, #fdf0b4); font-weight: 700; }
.rank-row.top2 { background: linear-gradient(90deg, #f5f7f8, #e6ebee); font-weight: 700; }
.rank-row.top3 { background: linear-gradient(90deg, #fdf0e0, #f6e0c8); font-weight: 700; }
.c-rank { text-align: center; }
.c-nick { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c-score { color: var(--red); font-weight: 700; }
.c-percent, .c-time, .c-diff, .c-rating { text-align: center; }
.rank-empty { padding: 26px 12px; text-align: center; font-size: 13px; color: #6a7452; line-height: 1.9; }

/* ------------------------------ 10 特效 ------------------------------ */
.float-layer { position: absolute; inset: 0; pointer-events: none; display: grid; place-items: center; z-index: 50; }
.float-text {
  position: absolute;
  font-size: 26px;
  font-weight: 900;
  color: var(--gold);
  text-shadow: 0 2px 0 #7a5b00, 0 0 16px rgba(232, 195, 58, 0.8);
  animation: floatUp 1s ease forwards;
}
.float-text.gain { animation: floatUpGain 1s cubic-bezier(0.2, 1.5, 0.4, 1) forwards; }

.combo {
  position: absolute;
  left: 50%;
  top: -46px;
  transform: translateX(-50%) scale(0.6);
  padding: 6px 16px;
  border-radius: 999px;
  background: linear-gradient(180deg, #e8c33a, #c99a08);
  color: #3d2f02;
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 1px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  z-index: 60;
}
.combo.show { animation: comboPop 1.1s ease forwards; }

/* 恶搞音效名提示（快速连点时只刷新最新一条） */
.sfx-badge {
  position: absolute;
  right: 6px;
  top: -30px;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(27, 35, 18, 0.92);
  border: 1px solid rgba(232, 195, 58, 0.55);
  color: var(--gold);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
  white-space: nowrap;
  opacity: 0;
  transform: translateY(6px) scale(0.9);
  pointer-events: none;
  z-index: 65;
}
.sfx-badge.show { animation: sfxBadgePop 1s ease forwards; }

.confetti-piece {
  position: fixed;
  top: -24px;
  width: 9px;
  height: 15px;
  border-radius: 2px;
  z-index: 200;
  pointer-events: none;
  animation-name: fall;
  animation-timing-function: linear;
  animation-fill-mode: forwards;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 140%);
  padding: 10px 20px;
  border-radius: 999px;
  background: rgba(27, 35, 18, 0.94);
  color: var(--sand);
  font-size: 13px;
  font-weight: 700;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(232, 195, 58, 0.4);
  opacity: 0;
  transition: transform 0.28s cubic-bezier(0.2, 1.3, 0.5, 1), opacity 0.28s ease;
  z-index: 300;
  pointer-events: none;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }

.footer {
  padding: 12px;
  text-align: center;
  font-size: 11px;
  color: rgba(31, 42, 20, 0.7);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
}

/* ------------------------------ 动画关键帧 ------------------------------ */
@keyframes screenIn {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes sunPulse {
  0%, 100% { transform: scale(1); opacity: 0.95; }
  50% { transform: scale(1.08); opacity: 1; }
}
@keyframes drift {
  from { transform: translateX(0); }
  to { transform: translateX(160vw); }
}
@keyframes wave {
  0%, 100% { transform: skewY(0deg) scaleX(1); }
  50% { transform: skewY(-4deg) scaleX(0.94); }
}
@keyframes tileIn {
  from { opacity: 0; transform: rotate(var(--rot, 0deg)) scale(0.4); }
  to { opacity: 1; transform: rotate(var(--rot, 0deg)) scale(1); }
}
@keyframes tileOut {
  0% { opacity: 1; transform: rotate(0deg) scale(1); }
  45% { opacity: 1; transform: rotate(0deg) scale(1.22); filter: brightness(1.5); }
  100% { opacity: 0; transform: rotate(12deg) scale(0.35); }
}
@keyframes shake {
  0%, 100% { transform: translateX(0) rotate(var(--rot, 0deg)); }
  20% { transform: translateX(-5px) rotate(-3deg); }
  45% { transform: translateX(5px) rotate(3deg); }
  70% { transform: translateX(-3px) rotate(-2deg); }
}
@keyframes slotPop {
  from { transform: scale(0.55); opacity: 0.4; }
  to { transform: scale(1); opacity: 1; }
}
@keyframes trayPulse {
  0%, 100% { transform: scale(1); }
  40% { transform: scale(1.025); box-shadow: 0 0 0 4px rgba(232, 195, 58, 0.35), var(--shadow-md); }
}
@keyframes floatUp {
  0% { opacity: 0; transform: translateY(10px) scale(0.8); }
  30% { opacity: 1; transform: translateY(-6px) scale(1.1); }
  100% { opacity: 0; transform: translateY(-56px) scale(1); }
}
@keyframes floatUpGain {
  0% { opacity: 0; transform: translateY(16px) scale(0.6); }
  25% { opacity: 1; transform: translateY(-10px) scale(1.35); }
  60% { transform: translateY(-30px) scale(1.1); opacity: 1; }
  100% { opacity: 0; transform: translateY(-70px) scale(1); }
}
@keyframes comboPop {
  0% { opacity: 0; transform: translateX(-50%) scale(0.5) translateY(10px); }
  20% { opacity: 1; transform: translateX(-50%) scale(1.12) translateY(0); }
  70% { opacity: 1; transform: translateX(-50%) scale(1); }
  100% { opacity: 0; transform: translateX(-50%) scale(0.95) translateY(-16px); }
}
@keyframes sfxBadgePop {
  0% { opacity: 0; transform: translateY(8px) scale(0.85); }
  18% { opacity: 1; transform: translateY(0) scale(1.06); }
  70% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-8px) scale(0.96); }
}
@keyframes ratingPop {
  0% { opacity: 0; transform: scale(0.85) rotate(-2deg); }
  100% { opacity: 1; transform: scale(1) rotate(0deg); }
}
@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
@keyframes fall {
  from { transform: translateY(-10vh) rotate(0deg); opacity: 1; }
  to { transform: translateY(112vh) rotate(760deg); opacity: 0.9; }
}

/* ------------------------------ 11 响应式 ------------------------------ */
@media (max-width: 860px) {
  .home-title { font-size: 32px; letter-spacing: 7px; }
  .diff-grid { grid-template-columns: 1fr; }
  .rating-table { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rank-row { grid-template-columns: 46px 1.3fr 0.9fr 0.9fr 0.9fr; font-size: 12px; }
  .rank-row .c-time, .rank-row .c-diff { display: none; }
}

@media (max-width: 640px) {
  .topbar { gap: 8px; padding: 8px 10px; flex-wrap: wrap; }
  .brand-text em { display: none; }
  .hud { gap: 6px; width: 100%; order: 3; }
  .chip { min-width: 0; flex: 1; padding: 3px 6px; }
  .chip b { font-size: 15px; }
  .stage { padding: 12px 10px 6px; }
  .panel { padding: 16px 14px; }
  .home-title { font-size: 27px; letter-spacing: 5px; }
  .tray { gap: 5px; padding: 7px; }
  .prop { padding: 7px 10px; font-size: 12px; }
  .rating-table { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .result-label { font-size: 30px; letter-spacing: 4px; }
  .slogan { font-size: 11px; letter-spacing: 1px; padding: 4px 12px; }
  .flag { display: none; }
  .rank-tabs { margin-left: 0; width: 100%; }
  .tab { flex: 1; }
}

@media (max-width: 420px) {
  .rank-row { grid-template-columns: 40px 1.2fr 0.8fr 0.8fr; }
  .rank-row .c-rating { display: none; }
  .tile-name { display: none; }
}
