/* =====================================================================
 * 奉国牧马 —— style.css
 * 奉国牧马样式表。
 * 原则：信息可读性优先，装饰克制；字号舒适、留白充足。
 * ===================================================================== */

/* ----------------------- 设计令牌 ----------------------- */
:root {
  --paper:        #f3ead4;   /* 宣纸米白 */
  --paper-2:      #ece1c6;
  --paper-3:      #e3d5b3;
  --card-bg:      #fcf7ea;
  --card-bg-2:    #f8f0db;
  --ink:          #2a2722;   /* 墨黑 */
  --ink-soft:     #4b463d;
  --ink-light:    #807868;
  --ochre:        #a98554;   /* 淡赭 */
  --cyan:         #527679;   /* 青灰 */
  --vermilion:    #b03a2e;   /* 朱砂（强调/警示）*/
  --vermilion-d:  #8f2d22;
  --gold:         #b8923a;   /* 金墨 */
  --line:         #c9b88e;
  --line-soft:    #ddcfac;
  --card-border:  #d4c194;
  --shadow:       0 3px 10px rgba(70, 55, 25, 0.10);
  --shadow-lg:    0 6px 20px rgba(60, 45, 20, 0.16);

  /* 马匹等级印章色 */
  --lv1: #9a958c;
  --lv2: #4a90a4;
  --lv3: #a0784a;
  --lv4: #b03a2e;
  --lv5: #b8923a;

  --radius: 10px;
  --radius-sm: 6px;
  --font: 'STKaiti', 'KaiTi', 'Kaiti SC', 'Songti SC', 'STSong', 'SimSun', '宋体', serif;
  --font-nu: 'STKaiti', 'KaiTi', 'Georgia', serif;
}

/* ----- 夜晚暗黑主题（由 ui.js 按昼夜切换 body.night） ----- */
body.night {
  --paper:        #1c1812;
  --paper-2:      #251f18;
  --paper-3:      #2f2820;
  --card-bg:      #2a241d;
  --card-bg-2:    #241f19;
  --ink:          #ece0c4;
  --ink-soft:     #c8bca0;
  --ink-light:    #8e826a;
  --ochre:        #c79a5e;
  --cyan:         #6a9698;
  --vermilion:    #d4503f;
  --vermilion-d:  #b03a2e;
  --gold:         #d4ad54;
  --line:         #4a3d2c;
  --line-soft:    #3a3225;
  --card-border:  #4a3d2c;
  --shadow:       0 3px 10px rgba(0, 0, 0, 0.40);
  --shadow-lg:    0 6px 20px rgba(0, 0, 0, 0.55);
  background-image:
    radial-gradient(ellipse at 20% 15%, rgba(106, 150, 152, 0.10) 0, transparent 40%),
    radial-gradient(ellipse at 80% 85%, rgba(212, 173, 84, 0.06) 0, transparent 45%);
}
/* 夜晚：覆盖硬编码点缀色（标签/吐司/进度条/按钮等）使其同步变暗 */
body.night .tag.good  { background: #2c3f2a; color: #9bcf8f; border-color: #3a5235; }
body.night .tag.bad   { background: #3f2a26; color: #e8907f; border-color: #523535; }
body.night .tag.warn  { background: #3f3528; color: #d8b878; border-color: #524432; }
body.night .tag.event { background: #322a3f; color: #bfa0d0; border-color: #423552; }
body.night .toast { background: #2a241d; }
body.night .grass-bar > i { background: linear-gradient(90deg, #5a8045, #3f6a3f); }
body.night .bar.energy > i { background: linear-gradient(90deg, #4a8a4a, #3a6a3a); }
body.night .bar.eco > i { background: linear-gradient(90deg, #4a7878, #5a8a4a); }
body.night .bar.day { background: linear-gradient(90deg, #3a3526 0%, #3a3526 60%, #1a2438 60%, #1a2438 100%); }
body.night .btn.primary { background: linear-gradient(180deg, #c04438, #9c3528); }
body.night .btn.gold { background: linear-gradient(180deg, #c9a44c, #95701f); }
body.night .horse-card.lv5 { background: linear-gradient(135deg, var(--card-bg) 55%, #4a3e20); }
body.night .pill-card.active { background: linear-gradient(135deg, #3a3220, #4a3f28); }
body.night .lv-tag.lv5 { background: #d4ad54; }
body.night #status-bar { background: linear-gradient(180deg, #251f18, #1c1812); }
body.night #log-bar { background: linear-gradient(0deg, #251f18, #1c1812); border-top-color: #3a3225; }
body.night #nav { background: linear-gradient(180deg, rgba(40, 34, 26, 0.6), rgba(28, 24, 18, 0.3)); border-right-color: #3a3225; }

/* ----------------------- 重置 ----------------------- */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background-color: var(--paper);
  /* 宣纸纹理 + 淡墨晕染（多层径向渐变） */
  background-image:
    radial-gradient(ellipse at 15% 20%, rgba(169, 133, 84, 0.10) 0, transparent 38%),
    radial-gradient(ellipse at 85% 15%, rgba(82, 118, 121, 0.08) 0, transparent 40%),
    radial-gradient(ellipse at 75% 85%, rgba(176, 58, 46, 0.05) 0, transparent 40%),
    radial-gradient(ellipse at 25% 90%, rgba(184, 146, 58, 0.06) 0, transparent 42%),
    repeating-linear-gradient(45deg, rgba(160,120,60,0.012) 0 2px, transparent 2px 6px);
  background-attachment: fixed;
  font-size: 16px;
  line-height: 1.65;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
/* 昼夜主题切换平滑过渡（已有自身 transition 的元素如 .btn/.nav-item 不受影响） */
*, *::before, *::after { transition: background-color 0.5s ease, color 0.5s ease, border-color 0.5s ease, box-shadow 0.5s ease; }

button { font-family: var(--font); cursor: pointer; }
.hidden { display: none !important; }

/* ----------------------- 通用按钮 ----------------------- */
.btn {
  background: linear-gradient(180deg, var(--card-bg), var(--card-bg-2));
  color: var(--ink);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  font-size: 15px;
  line-height: 1.3;
  transition: all 0.16s ease;
  white-space: nowrap;
  box-shadow: 0 1px 0 rgba(120,90,40,0.06);
}
.btn:hover { background: var(--paper-2); border-color: var(--ochre); transform: translateY(-1px); box-shadow: var(--shadow); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; box-shadow: none; }
.btn.primary {
  background: linear-gradient(180deg, #c04438, var(--vermilion));
  color: #fff7ec; border-color: var(--vermilion-d);
  box-shadow: 0 2px 6px rgba(176,58,46,0.3);
  font-weight: bold;
}
.btn.primary:hover { background: linear-gradient(180deg, var(--vermilion), var(--vermilion-d)); }
.btn.gold {
  background: linear-gradient(180deg, #c9a44c, var(--gold));
  color: #3a2e10; border-color: #95701f; font-weight: bold;
  box-shadow: 0 2px 6px rgba(184,146,58,0.3);
}
.btn.ghost { background: transparent; border-color: var(--line); }
.btn.mini { padding: 6px 12px; font-size: 14px; border-radius: var(--radius-sm); }

/* ----------------------- 顶部状态栏 ----------------------- */
#status-bar {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 10px 22px;
  background:
    linear-gradient(180deg, #ece1c6, #e3d5b3);
  border-bottom: 3px double var(--line);
  box-shadow: var(--shadow);
  z-index: 20;
  flex-shrink: 0;
  position: relative;
}
#status-bar::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -3px; height: 3px;
  background: linear-gradient(90deg, transparent, var(--vermilion), transparent);
  opacity: 0.35;
}
.brand { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.seal {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px;
  background: var(--vermilion); color: #fff7ec;
  border-radius: 6px; font-size: 22px; font-weight: bold;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,0.3), 0 2px 5px rgba(176,58,46,0.4);
  transform: rotate(-3deg);
}
.brand-name {
  font-size: 24px; font-weight: bold; letter-spacing: 4px; color: var(--ink);
  text-shadow: 0 1px 0 rgba(255,255,255,0.4);
}

.stats {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px;
  flex: 1; justify-content: center;
}
.stat {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; background: var(--card-bg);
  border: 1px solid var(--card-border); border-radius: 22px;
  font-size: 15px; box-shadow: 0 1px 2px rgba(120,90,40,0.06);
}
.stat .ico { font-size: 17px; }
.stat .val { font-family: var(--font-nu); font-weight: bold; color: var(--ink); font-size: 16px; }
.stat.warn { border-color: var(--vermilion); }
.stat.warn .val { color: var(--vermilion); }
.stat.good .val { color: #4a7a4a; }

.top-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* 进度条 */
.bar {
  position: relative; width: 78px; height: 9px;
  background: var(--paper-3); border-radius: 5px; overflow: hidden;
  border: 1px solid var(--line);
}
.bar > i {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--ochre), var(--gold));
  transition: width 0.3s ease;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.3);
}
.bar.energy > i { background: linear-gradient(90deg, #5a8f5a, #3f6a3f); }
.bar.eco > i { background: linear-gradient(90deg, var(--cyan), #6f9a5a); }
/* 当日进度条：背景昼夜双色（前60%白昼·后40%夜晚），填充半透明白指示已过部分 */
.bar.day {
  width: 96px;
  background: linear-gradient(90deg, #efd78a 0%, #efd78a 60%, #3e4e6e 60%, #3e4e6e 100%);
}
.bar.day > i { background: rgba(255, 247, 236, 0.6); }

/* ----------------------- 主体布局 ----------------------- */
.layout { display: flex; flex: 1; min-height: 0; }
#nav {
  display: flex; flex-direction: column; gap: 4px;
  width: 150px; flex-shrink: 0;
  padding: 16px 10px;
  background: linear-gradient(180deg, rgba(227,213,179,0.6), rgba(227,213,179,0.3));
  border-right: 2px solid var(--line);
  overflow-y: auto;
}
.nav-item {
  text-align: left;
  background: transparent; border: 1px solid transparent;
  border-radius: var(--radius-sm); padding: 11px 14px;
  font-size: 16px; color: var(--ink-soft);
  transition: all 0.16s ease;
  display: flex; align-items: center; gap: 8px;
}
.nav-item:hover { background: var(--card-bg); color: var(--ink); }
.nav-item.active {
  background: var(--card-bg); border-color: var(--ochre);
  color: var(--ink); font-weight: bold;
  box-shadow: inset 4px 0 0 var(--vermilion), var(--shadow);
}

#main {
  flex: 1; overflow-y: auto; padding: 20px 26px 28px; min-width: 0;
  scroll-behavior: smooth;
}
.panel { animation: fadeIn 0.22s ease; max-width: 1200px; margin: 0 auto; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.panel h2 {
  font-size: 26px; color: var(--ink); margin-bottom: 6px;
  padding-bottom: 10px;
  display: flex; align-items: center; gap: 12px;
  position: relative;
}
.panel h2::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 2px;
  background: linear-gradient(90deg, var(--vermilion) 0, var(--vermilion) 60px, var(--line) 60px, var(--line) 100%);
  opacity: 0.7;
}
.panel h2 .h-seal {
  font-size: 15px; color: #fff7ec; background: var(--vermilion);
  padding: 3px 10px; border-radius: 4px; font-weight: normal; letter-spacing: 2px;
  box-shadow: inset 0 0 0 1.5px rgba(255,255,255,0.25);
}
.panel .panel-desc { color: var(--ink-soft); font-size: 15px; margin: 12px 0 18px; line-height: 1.7; }
.panel section.block { margin-bottom: 24px; }
.panel h3 {
  font-size: 18px; color: var(--ink-soft); margin: 10px 0 12px;
  display: flex; align-items: center; gap: 8px;
}
.panel h3::before {
  content: '◆'; color: var(--vermilion); font-size: 13px;
}

/* ----------------------- 卡片网格 ----------------------- */
.grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}
.card {
  background: linear-gradient(180deg, var(--card-bg), var(--card-bg-2));
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
  transition: transform 0.16s ease, box-shadow 0.16s ease;
  position: relative;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.card .card-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 10px; gap: 8px;
}
.card .card-title { font-weight: bold; font-size: 17px; color: var(--ink); }
.card .card-body { font-size: 14px; color: var(--ink-soft); }
.card .card-actions {
  display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px;
}

/* 马匹卡片 */
.horse-card { border-left: 6px solid var(--lv1); }
.horse-card.lv1 { border-left-color: var(--lv1); }
.horse-card.lv2 { border-left-color: var(--lv2); }
.horse-card.lv3 { border-left-color: var(--lv3); }
.horse-card.lv4 { border-left-color: var(--lv4); }
.horse-card.lv5 {
  border-left-color: var(--lv5);
  background: linear-gradient(135deg, var(--card-bg) 55%, #f3e4b8);
  box-shadow: 0 3px 12px rgba(184,146,58,0.25);
}
.horse-card .horse-icon { font-size: 26px; line-height: 1; }
.lv-tag {
  display: inline-block; font-size: 13px; padding: 2px 10px;
  border-radius: 12px; color: #fff7ec; font-weight: bold; letter-spacing: 1px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.2);
}
.lv-tag.lv1 { background: var(--lv1); }
.lv-tag.lv2 { background: var(--lv2); }
.lv-tag.lv3 { background: var(--lv3); }
.lv-tag.lv4 { background: var(--lv4); }
.lv-tag.lv5 { background: var(--lv5); color: #3a2e10; }
.gender { font-size: 15px; font-weight: bold; }
.gender.male { color: var(--cyan); }
.gender.female { color: var(--vermilion); }
.horse-card.baby { background: linear-gradient(180deg, var(--card-bg), #f3ead4); }
.horse-card .badge-baby {
  position: absolute; top: 10px; right: 12px;
  font-size: 12px; background: var(--ochre); color: #fff7ec;
  padding: 2px 8px; border-radius: 10px;
}

/* 草场卡片 */
.pasture-card .grass-bar {
  height: 14px; background: var(--paper-3); border-radius: 7px;
  overflow: hidden; border: 1px solid var(--line); margin: 8px 0;
  position: relative;
}
.pasture-card .grass-bar > i {
  display: block; height: 100%;
  background: linear-gradient(90deg, #7ba05b, #4f8a4f);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.3);
  transition: width 0.3s ease;
}

/* ----------------------- 表单控件 ----------------------- */
input[type="number"], input[type="text"], textarea, select {
  font-family: var(--font); font-size: 15px;
  background: var(--card-bg); color: var(--ink);
  border: 1px solid var(--card-border); border-radius: var(--radius-sm);
  padding: 6px 10px; width: 100px;
}
textarea { width: 100%; }
label.chk { display: inline-flex; align-items: center; gap: 6px; font-size: 15px; cursor: pointer; }
label.chk input { width: 16px; height: 16px; }

.row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 8px 0; }

/* 双胎丹等药剂卡片开关 */
.pill-card {
  display: flex; align-items: center; gap: 14px;
  padding: 13px 18px; margin: 10px 0 18px;
  background: linear-gradient(135deg, var(--card-bg), var(--card-bg-2));
  border: 1.5px solid var(--card-border); border-radius: 14px;
  cursor: pointer; transition: all 0.18s ease;
  max-width: 380px; box-shadow: var(--shadow);
  user-select: none;
}
.pill-card:hover { border-color: var(--gold); transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.pill-card.active {
  border-color: var(--gold);
  background: linear-gradient(135deg, #fbf3d8, #f1e0ac);
  box-shadow: 0 0 0 3px rgba(184, 146, 58, 0.22), var(--shadow-lg);
}
.pill-card.disabled { opacity: 0.55; cursor: not-allowed; }
.pill-card.disabled:hover { transform: none; border-color: var(--card-border); box-shadow: var(--shadow); }
.pill-icon { font-size: 30px; line-height: 1; filter: drop-shadow(0 1px 2px rgba(0,0,0,0.15)); }
.pill-card.active .pill-icon { filter: drop-shadow(0 0 4px rgba(184,146,58,0.6)); }
.pill-info { flex: 1; }
.pill-name { font-weight: bold; font-size: 17px; color: var(--ink); }
.pill-count { color: var(--vermilion); font-family: var(--font-nu); margin-left: 2px; }
.pill-desc { font-size: 13px; color: var(--ink-light); margin-top: 2px; }
.pill-toggle {
  font-size: 13px; padding: 4px 12px; border-radius: 12px;
  border: 1px solid var(--line); color: var(--ink-light); white-space: nowrap;
}
.pill-card.active .pill-toggle {
  background: linear-gradient(180deg, #c9a44c, var(--gold));
  color: #3a2e10; border-color: #95701f; font-weight: bold;
}

/* 自动收割滑动开关 */
.switch { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; user-select: none; font-size: 14px; color: var(--ink-soft); }
.switch input { display: none; }
.switch-track {
  position: relative; width: 36px; height: 20px;
  background: var(--paper-3); border-radius: 10px;
  border: 1px solid var(--card-border);
  transition: background 0.2s ease, border-color 0.2s ease;
  flex-shrink: 0;
}
.switch-track::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 14px; height: 14px; border-radius: 50%;
  background: #fff7ec; box-shadow: 0 1px 3px rgba(0,0,0,0.3);
  transition: transform 0.2s ease;
}
.switch input:checked + .switch-track { background: linear-gradient(90deg, var(--cyan), #4a8a4a); border-color: var(--cyan); }
.switch input:checked + .switch-track::after { transform: translateX(16px); }
body.night .switch-track { background: #2f2820; }
.muted { color: var(--ink-light); font-size: 14px; }
.tag {
  display: inline-block; font-size: 14px; padding: 3px 11px;
  border-radius: 12px; background: var(--paper-2); color: var(--ink-soft);
  border: 1px solid var(--line-soft);
}
.tag.good { background: #e4efd9; color: #3f6a3f; border-color: #b3d49a; }
.tag.bad  { background: #f3ddd7; color: var(--vermilion-d); border-color: #e0aa9a; }
.tag.warn { background: #f6eccf; color: #8a6a2a; border-color: #e0cf9a; }
.tag.event{ background: #ece2f0; color: #6a4a7a; border-color: #c8b4d4; }

/* ----------------------- 日志条 ----------------------- */
#log-bar {
  height: 104px; flex-shrink: 0;
  display: flex; gap: 12px;
  padding: 8px 18px;
  background: linear-gradient(0deg, #ece1c6, #e3d5b3);
  border-top: 3px double var(--line);
  overflow: hidden;
}
.log-label {
  writing-mode: vertical-rl; letter-spacing: 6px;
  color: var(--vermilion); font-weight: bold; font-size: 18px;
  padding: 4px 6px; border-right: 1px solid var(--line); flex-shrink: 0;
}
#log-list {
  flex: 1; overflow-y: auto; font-size: 14px; line-height: 1.8;
  padding-right: 6px;
}
#log-list::-webkit-scrollbar { width: 6px; }
#log-list::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }
.log-line { color: var(--ink-soft); }
.log-line .log-day { color: var(--ink-light); font-family: var(--font-nu); margin-right: 8px; font-size: 13px; }
.log-line.good { color: #3f6a3f; }
.log-line.bad  { color: var(--vermilion-d); }
.log-line.warn { color: #8a6a2a; }
.log-line.event{ color: #6a4a7a; }

/* ----------------------- Toast ----------------------- */
#toast-container {
  position: fixed; top: 76px; right: 22px; z-index: 200;
  display: flex; flex-direction: column; gap: 10px;
  pointer-events: none;
}
.toast {
  background: var(--card-bg); border: 1px solid var(--card-border);
  border-left: 5px solid var(--ochre);
  border-radius: var(--radius); padding: 10px 16px;
  box-shadow: var(--shadow-lg); font-size: 15px;
  animation: toastIn 0.28s ease; max-width: 340px;
}
.toast.good { border-left-color: #4a7a4a; }
.toast.bad  { border-left-color: var(--vermilion); }
.toast.warn { border-left-color: var(--ochre); }
@keyframes toastIn { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }

/* ----------------------- 遮罩 / 模态 ----------------------- */
.overlay {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(42, 39, 34, 0.55);
  backdrop-filter: blur(3px);
  display: none; align-items: center; justify-content: center;
  padding: 20px;
}
.overlay.show { display: flex; animation: fadeIn 0.2s ease; }
.overlay-card {
  background: linear-gradient(180deg, var(--card-bg), var(--card-bg-2));
  border: 1px solid var(--card-border);
  border-radius: 14px; padding: 30px 34px;
  max-width: 580px; width: 100%; max-height: 86vh; overflow-y: auto;
  box-shadow: 0 12px 40px rgba(40, 30, 15, 0.4);
  position: relative;
}
.ink-card::before {
  content: ''; position: absolute; inset: 8px;
  border: 1px solid var(--line); border-radius: 10px; pointer-events: none;
}

/* 开始页 */
#start-overlay { background: radial-gradient(ellipse at center, rgba(42,39,34,0.74), rgba(16,14,10,0.95)); overflow-y: auto; align-items: flex-start; padding: 40px 20px; }
#start-overlay .overlay-card { max-height: none; margin: auto; }
.game-title {
  font-size: 60px; text-align: center; letter-spacing: 16px; color: #f3ead4;
  text-shadow: 0 2px 0 rgba(0,0,0,0.35), 0 0 32px rgba(212,173,84,0.25);
  padding-left: 16px; position: relative;
}
.game-title::after {
  content: ''; display: block; width: 130px; height: 2px; margin: 16px auto 0;
  background: linear-gradient(90deg, transparent, var(--vermilion), transparent);
}
.game-sub { text-align: center; color: var(--vermilion); letter-spacing: 10px; margin: 16px 0 32px; font-size: 19px; }
.start-actions { display: flex; flex-direction: column; gap: 14px; align-items: center; }
.start-actions .btn {
  min-width: 264px; font-size: 18px; padding: 13px 24px;
  border-radius: 10px; letter-spacing: 2px;
}
.start-actions .btn.primary { box-shadow: 0 4px 14px rgba(176,58,46,0.42); }
.start-help { margin-top: 26px; width: 100%; }
.help-toggle { width: 100%; background: rgba(255,255,255,0.06); border: 1px solid rgba(212,173,84,0.4); border-radius: 10px; padding: 11px 16px; font-size: 15px; color: var(--ochre); display: flex; justify-content: space-between; align-items: center; cursor: pointer; letter-spacing: 2px; transition: background 0.2s, border-color 0.2s; }
.help-toggle:hover, .help-toggle.expanded { background: rgba(212,173,84,0.14); border-color: var(--ochre); }
.help-toggle .caret { transition: transform 0.25s; font-size: 13px; }
.help-toggle.expanded .caret { transform: rotate(180deg); }
.help-content { max-height: 0; overflow: hidden; transition: max-height 0.3s ease, padding 0.3s, margin 0.3s; padding: 0 16px; }
.help-content.open { max-height: 300px; padding: 12px 16px; margin-top: 8px; }
.help-content p { margin: 6px 0; line-height: 1.85; color: var(--ink-light); font-size: 14px; text-align: left; }
.import-area { width: 100% !important; max-width: 480px; height: 100px; margin-top: 14px; font-family: monospace; font-size: 13px; }

/* 模态内容 */
.modal-title { font-size: 24px; margin-bottom: 12px; text-align: center; color: var(--ink); }
.modal-body { margin: 14px 0; font-size: 15px; line-height: 1.8; }
.modal-body p { margin: 6px 0; }
.modal-actions { display: flex; gap: 12px; justify-content: center; margin-top: 20px; }
.modal-close {
  position: absolute; top: 12px; right: 16px; font-size: 24px;
  color: var(--ink-light); background: none; border: none; line-height: 1;
}
.modal-close:hover { color: var(--vermilion); }

/* 事件全局公告卡片 */
.event-announce {
  text-align: center; max-width: 420px;
  border-top: 8px solid var(--vermilion);
  animation: fadeIn 0.25s ease;
}
.event-announce.tone-good { border-top-color: #4a7a4a; }
.event-announce.tone-bad  { border-top-color: var(--vermilion); }
.event-announce.tone-warn { border-top-color: var(--ochre); }
.event-announce.tone-event{ border-top-color: #6a4a7a; }
.event-announce.tone-gold { border-top-color: var(--gold); }
.event-announce.tone-gold .ev-title { color: var(--gold); }
.event-announce.tone-gold .ev-loss { color: var(--gold); }
.event-announce.tone-gold .ev-icon { filter: drop-shadow(0 0 10px rgba(184,146,58,0.7)); }
.event-announce .ev-icon { font-size: 52px; line-height: 1; margin-bottom: 6px; }
.event-announce .ev-title { font-size: 30px; letter-spacing: 6px; color: var(--ink); margin-bottom: 8px; }
.event-announce .ev-body { font-size: 15px; color: var(--ink-light); margin-bottom: 14px; line-height: 1.7; }
.event-announce .ev-loss { font-size: 20px; font-weight: bold; color: var(--vermilion); margin-bottom: 16px; letter-spacing: 2px; }
.event-announce.tone-good .ev-loss { color: #4a7a4a; }
.event-announce.tone-event .ev-loss { color: #6a4a7a; }

/* ----------------------- 结局页 ----------------------- */
.ending-card { text-align: center; border-top: 8px solid var(--gold); animation: endingRise 0.7s cubic-bezier(.2,.8,.2,1); }
@keyframes endingRise { from { opacity: 0; transform: translateY(30px) scale(.96); } to { opacity: 1; transform: none; } }
.ending-ritual {
  position: absolute; inset: 0; border-radius: 14px; pointer-events: none;
  background: radial-gradient(ellipse at center top, rgba(212,173,84,0.22), transparent 60%);
  animation: ritualGlow 2.4s ease-in-out infinite;
}
@keyframes ritualGlow { 0%, 100% { opacity: 0.55; } 50% { opacity: 1; } }
.ending-emblem { font-size: 60px; line-height: 1; margin-bottom: 4px; animation: emblemPop 0.9s ease; }
@keyframes emblemPop { 0% { transform: scale(0); opacity: 0; } 70% { transform: scale(1.18); } 100% { transform: scale(1); opacity: 1; } }
.ending-bigtitle {
  font-size: 44px; letter-spacing: 14px; color: var(--ink); margin: 2px 0 6px;
  text-shadow: 0 2px 0 rgba(0,0,0,0.2), 0 0 24px rgba(212,173,84,0.3);
  animation: titleIn 1s ease 0.2s both;
}
.ending-inscription {
  font-size: 32px; letter-spacing: 10px; margin: 4px 0 8px;
  animation: titleIn 1s ease 0.4s both;
}
.ending-card.tone-gold .ending-inscription { color: var(--gold); }
.ending-card.tone-vermilion .ending-inscription { color: var(--vermilion); }
.ending-card.tone-cyan .ending-inscription { color: var(--cyan); }
.ending-title-line { color: var(--ink-soft); letter-spacing: 3px; margin-bottom: 14px; animation: titleIn 1s ease 0.6s both; }
@keyframes titleIn { from { opacity: 0; letter-spacing: 28px; } to { opacity: 1; } }
.ending-chart-title { color: var(--ochre); font-size: 15px; letter-spacing: 2px; margin-bottom: 6px; }
.ending-chart-wrap { background: var(--paper-2); border-radius: 10px; padding: 10px; margin: 0 auto 16px; max-width: 540px; }
.ending-chart-wrap canvas { display: block; width: 100%; max-width: 520px; height: auto; }
.ending-card.tone-gold    { border-top-color: var(--gold); }
.ending-card.tone-vermilion { border-top-color: var(--vermilion); }
.ending-card.tone-cyan    { border-top-color: var(--cyan); }
.ending-card h1 { font-size: 46px; letter-spacing: 12px; margin-bottom: 10px; padding-left: 12px; }
.ending-card .inscription {
  font-size: 36px; color: var(--vermilion); letter-spacing: 10px; margin: 14px 0 22px; padding-left: 10px;
}
.ending-card.tone-gold .inscription { color: var(--gold); }
.ending-card.tone-cyan .inscription { color: var(--cyan); }
.ending-card .ending-stats {
  text-align: left; background: var(--paper-2); border-radius: var(--radius);
  padding: 16px 18px; margin: 18px 0; font-size: 15px;
}
.ending-card .ending-stats div { display: flex; justify-content: space-between; padding: 5px 0; border-bottom: 1px dashed var(--line-soft); }
.ending-card .ending-stats div:last-child { border-bottom: none; }
.ending-card .ending-stats span:last-child { font-family: var(--font-nu); font-weight: bold; }

.gameover-card { text-align: center; }
.gameover-card h1 { font-size: 44px; color: var(--vermilion); letter-spacing: 10px; margin-bottom: 14px; padding-left: 10px; }
.gameover-card p { font-size: 17px; color: var(--ink-soft); margin-bottom: 22px; }

/* ----------------------- 新手引导 ----------------------- */
.tutorial-hint {
  position: fixed; z-index: 250;
  top: 130px; left: 168px;
  background: linear-gradient(135deg, var(--vermilion), var(--vermilion-d));
  color: #fff7ec;
  padding: 11px 16px 11px 12px; border-radius: 12px;
  font-size: 15px; box-shadow: 0 6px 22px rgba(176,58,46,0.45);
  max-width: 280px; animation: pulse 1.8s ease infinite;
  border: 1px solid rgba(255,255,255,0.18);
  display: inline-flex; align-items: center; gap: 8px;
}
.tutorial-hint::before { content: '💡'; font-size: 17px; flex-shrink: 0; }
.tutorial-hint::after {
  content: ''; position: absolute; top: -9px; left: 28px;
  border: 9px solid transparent; border-bottom-color: var(--vermilion); border-top: 0;
}
@keyframes pulse { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }

/* ----------------------- 工具类 ----------------------- */
.text-right { text-align: right; }
.mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; }
.flex-between { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.kv { display: flex; justify-content: space-between; align-items: center; padding: 3px 0; font-size: 14px; gap: 10px; }
.kv .k { color: var(--ink-light); }

/* 滚动条美化 */
#main::-webkit-scrollbar, #nav::-webkit-scrollbar { width: 8px; }
#main::-webkit-scrollbar-thumb, #nav::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }
#main::-webkit-scrollbar-track, #nav::-webkit-scrollbar-track { background: transparent; }

/* ==================== 大结局（奉国牧马特色 · 宣纸卷轴 · 约 35 秒） ==================== */
.eg-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center; flex-direction: column;
  overflow: hidden; background: #f3ead4;  /* 宣纸米白底（区别赛博黑底） */
}
.eg-paper {  /* 宣纸纹理 */
  position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(ellipse at 20% 20%, rgba(176,141,87,0.10) 0, transparent 40%),
    radial-gradient(ellipse at 80% 80%, rgba(82,118,121,0.08) 0, transparent 45%),
    repeating-linear-gradient(45deg, rgba(160,120,60,0.015) 0 2px, transparent 2px 6px);
}
.eg-sky {  /* 天空昼夜流转 */
  position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, #f5e6c0 0%, #f3ead4 40%, #e8dcc0 70%, #d4c8a8 100%);
  animation: egSkyShift 35s ease forwards;
}
@keyframes egSkyShift { 0% { filter: brightness(1); } 60% { filter: brightness(0.96); } 100% { filter: brightness(0.86) sepia(0.12); } }
.eg-grass-field {  /* 草场 */
  position: absolute; bottom: 0; left: 0; right: 0; height: 32%; pointer-events: none;
  background: linear-gradient(0deg, rgba(90,122,74,0.65) 0%, rgba(90,122,74,0.2) 60%, transparent 100%);
  animation: egGrassGrow 5s ease forwards; transform-origin: bottom;
}
@keyframes egGrassGrow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
.eg-petals { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }  /* 飘落花瓣 */
.eg-petal { position: absolute; top: -30px; opacity: 0; will-change: transform, opacity; animation: egPetalFall linear infinite; }
@keyframes egPetalFall {
  0% { transform: translateY(-30px) translateX(0) rotate(0); opacity: 0; }
  10% { opacity: 0.9; } 90% { opacity: 0.9; }
  100% { transform: translateY(110vh) translateX(40px) rotate(360deg); opacity: 0; }
}
.eg-stage { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; flex-direction: column; text-align: center; padding: 20px; }
@keyframes egFadeUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 0.95; transform: translateY(0); } }
/* 阶段1：墨笔题字 */
.eg-ink-title { font-size: 64px; font-weight: bold; color: #2a2722; letter-spacing: 24px; text-shadow: 0 2px 0 rgba(0,0,0,0.1); opacity: 0; animation: egFadeUp 1.6s ease 0.3s forwards; }
.eg-ink-sub { margin-top: 18px; font-size: 26px; letter-spacing: 12px; color: #b03a2e; opacity: 0; animation: egFadeUp 1.5s ease 1.4s forwards; }
/* 阶段2：神驹奔入 */
.eg-divine { font-size: 96px; line-height: 1; filter: drop-shadow(0 0 20px rgba(212,175,55,0.6)); animation: egDivineIn 2s ease; }
@keyframes egDivineIn { from { transform: translateX(60vw); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.eg-stage2-sub { margin-top: 22px; font-size: 24px; letter-spacing: 10px; color: #4b4640; opacity: 0; animation: egFadeUp 1.5s ease 1s forwards; }
/* 阶段3：三枚朱砂印章盖落 */
.eg-seals { display: flex; gap: 56px; }
.eg-stamp {
  width: 90px; height: 90px; display: flex; align-items: center; justify-content: center;
  color: #fff7ec; font-size: 24px; font-weight: bold; line-height: 1.1; text-align: center;
  border-radius: 6px; transform: rotate(-3deg);
  box-shadow: inset 0 0 0 3px rgba(255,255,255,0.2), 0 4px 12px rgba(0,0,0,0.2);
  opacity: 0; animation: egStampDrop 0.6s cubic-bezier(.5,1.8,.5,1) forwards;
}
.eg-stamp.gold { background: #b8923a; animation-delay: 0.3s; }
.eg-stamp.vermilion { background: #b03a2e; animation-delay: 1.5s; }
.eg-stamp.cyan { background: #527679; animation-delay: 2.7s; }
@keyframes egStampDrop {
  0% { transform: rotate(-3deg) translateY(-80px) scale(1.4); opacity: 0; }
  60% { transform: rotate(-3deg) translateY(6px) scale(0.95); opacity: 1; }
  100% { transform: rotate(-3deg) translateY(0) scale(1); opacity: 1; }
}
.eg-stage3-sub { margin-top: 30px; font-size: 28px; letter-spacing: 12px; color: #2a2722; opacity: 0; animation: egFadeUp 1.5s ease 3.6s forwards; }
/* 阶段4：牧场纪要 */
.eg-recap-title { font-size: 26px; letter-spacing: 8px; color: #b03a2e; margin-bottom: 24px; }
.eg-recap { display: flex; flex-direction: column; gap: 8px; min-width: 340px; }
.eg-recap-row {
  display: flex; justify-content: space-between; gap: 40px; padding: 9px 24px;
  background: rgba(176,141,87,0.1); border-bottom: 1px solid rgba(176,141,87,0.25);
  opacity: 0; transform: translateX(-30px); animation: egRecapRow 0.6s ease forwards;
}
.eg-recap-row .recap-label { color: #6b655c; font-size: 15px; letter-spacing: 2px; }
.eg-recap-row .recap-value { color: #2a2722; font-size: 17px; font-weight: bold; }
@keyframes egRecapRow { to { opacity: 1; transform: translateX(0); } }
/* 阶段5：万马奔腾 + 金墨标题 */
.eg-seal-big {
  width: 96px; height: 96px; background: #b03a2e; color: #fff7ec;
  display: flex; align-items: center; justify-content: center; font-size: 52px; font-weight: bold;
  border-radius: 8px; margin-bottom: 24px; transform: rotate(-5deg);
  box-shadow: inset 0 0 0 4px rgba(255,255,255,0.22), 0 6px 18px rgba(0,0,0,0.25);
  animation: egStampDrop 1s cubic-bezier(.5,1.8,.5,1) forwards;
}
.eg-final-title { font-size: 68px; font-weight: bold; color: #2a2722; letter-spacing: 20px; text-shadow: 0 2px 0 rgba(0,0,0,0.1); }
.eg-final-sub { margin-top: 18px; font-size: 22px; letter-spacing: 10px; color: #b8923a; opacity: 0; animation: egFadeUp 1.6s ease 0.8s forwards; }
/* 阶段6：按钮（卷轴风） */
.eg-actions { margin-top: 48px; display: flex; gap: 20px; opacity: 0; transform: translateY(28px); animation: egActionsIn 0.9s cubic-bezier(.2, .8, .2, 1) 6s forwards; }
@keyframes egActionsIn { to { opacity: 1; transform: translateY(0); } }
.eg-btn {
  padding: 13px 30px; font-size: 17px; font-family: var(--font); letter-spacing: 3px;
  background: #fbf6e9; color: #2a2722; border: 1px solid #b8923a; border-radius: 8px;
  cursor: pointer; transition: background 0.2s, transform 0.2s;
}
.eg-btn:hover { background: #f3e4b8; transform: translateY(-2px); }
.eg-btn.primary { background: #b03a2e; color: #fff7ec; border-color: #8f2d22; font-weight: bold; }
.eg-btn.primary:hover { background: #9c3528; }

/* ----------------------- 响应式 ----------------------- */
@media (max-width: 820px) {
  body { font-size: 15px; }
  #nav { width: 64px; }
  .nav-item { font-size: 13px; padding: 11px 8px; flex-direction: column; gap: 3px; text-align: center; }
  .stats { gap: 5px 8px; }
  .stat { padding: 3px 8px; font-size: 13px; }
  .stat .val { font-size: 14px; }
  .game-title { font-size: 38px; letter-spacing: 8px; }
  #main { padding: 14px; }
  .grid { grid-template-columns: 1fr; }
  .panel h2 { font-size: 22px; }
  .tutorial-hint { left: 76px; }
}
