/* ==========================================================================
   《重生之我竟成了教官》 样式表
   主题：军营迷彩绿 + 卡其色 + 金色点缀，玻璃拟态卡片，丰富的过渡动画
   ========================================================================== */

/* ---------- 设计变量 ---------- */
:root {
  --green-900: #0f1f14;
  --green-800: #16301e;
  --green-700: #1e4428;
  --green-600: #2c5a33;
  --green-500: #3f7a45;
  --green-400: #5aa05f;
  --khaki: #d8c690;
  --khaki-light: #efe4bd;
  --gold: #f4c94a;
  --gold-dark: #c79a22;
  --red: #e05d5d;
  --blue: #5d9ce0;
  --text: #eef3e6;
  --text-dim: #b9c6ad;
  --card-bg: rgba(20, 38, 26, 0.72);
  --card-border: rgba(216, 198, 144, 0.18);
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  --radius: 20px;
  --font: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, -apple-system, sans-serif;
}

/* ---------- 基础重置 ---------- */
* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  font-family: var(--font);
  color: var(--text);
  background: radial-gradient(1200px 700px at 20% -10%, #23462a 0%, transparent 55%),
              radial-gradient(1000px 800px at 110% 110%, #1a3520 0%, transparent 50%),
              linear-gradient(160deg, #0d1c12 0%, #122416 55%, #0a1710 100%);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ---------- 背景装饰 ---------- */
.bg-decor { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }

.bg-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(216, 198, 144, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(216, 198, 144, 0.04) 1px, transparent 1px);
  background-size: 44px 44px;
}

.bg-blob {
  position: absolute; border-radius: 50%;
  filter: blur(70px); opacity: 0.35;
  animation: blobFloat 16s ease-in-out infinite;
}
.blob-1 { width: 380px; height: 380px; background: #3f7a45; top: -80px; left: -60px; }
.blob-2 { width: 300px; height: 300px; background: #c79a22; bottom: -60px; right: -40px; animation-delay: -5s; opacity: 0.22; }
.blob-3 { width: 260px; height: 260px; background: #2c5a33; top: 40%; left: 60%; animation-delay: -9s; opacity: 0.28; }

@keyframes blobFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(40px, -30px) scale(1.1); }
  66% { transform: translate(-30px, 24px) scale(0.95); }
}

/* ---------- 顶部横幅 ---------- */
.site-header { text-align: center; padding: 30px 16px 6px; }

.brand { display: flex; align-items: center; justify-content: center; gap: 14px; }

.brand-title {
  font-size: clamp(22px, 4vw, 36px);
  letter-spacing: 4px;
  font-weight: 800;
  background: linear-gradient(180deg, var(--khaki-light), var(--khaki));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 2px 18px rgba(216, 198, 144, 0.25);
}

.brand-star { color: var(--gold); font-size: 22px; animation: starSpin 8s linear infinite; }

@keyframes starSpin { to { transform: rotate(360deg); } }

.brand-sub { color: var(--text-dim); margin-top: 8px; letter-spacing: 2px; font-size: 13px; }

/* ---------- 布局容器 ---------- */
.app { width: min(1120px, 94vw); margin: 18px auto 30px; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.panel-title { font-size: 15px; letter-spacing: 2px; color: var(--khaki); margin-bottom: 14px; }

.muted { color: var(--text-dim); font-weight: 400; }

/* ---------- 界面切换动画 ---------- */
.screen { display: none; }
.screen.is-active { display: block; animation: screenIn 0.6s cubic-bezier(0.22, 1, 0.36, 1) both; }

@keyframes screenIn {
  from { opacity: 0; transform: translateY(22px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   开始界面
   ========================================================================== */
.start-card { max-width: 720px; margin: 20px auto; padding: 40px 44px; text-align: center; }

.emblem {
  width: 90px; height: 90px; margin: 0 auto 18px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: radial-gradient(circle at 35% 30%, #2c5a33, #16301e);
  border: 2px solid var(--gold);
  box-shadow: 0 0 0 8px rgba(244, 201, 74, 0.12), 0 0 34px rgba(244, 201, 74, 0.35);
  animation: emblemPulse 3s ease-in-out infinite;
}
.emblem-star { color: var(--gold); font-size: 42px; }

@keyframes emblemPulse {
  0%, 100% { box-shadow: 0 0 0 8px rgba(244, 201, 74, 0.12), 0 0 24px rgba(244, 201, 74, 0.3); }
  50% { box-shadow: 0 0 0 14px rgba(244, 201, 74, 0.05), 0 0 44px rgba(244, 201, 74, 0.5); }
}

.start-title { font-size: 30px; letter-spacing: 3px; margin-bottom: 14px; color: var(--khaki-light); }

.start-lead { color: var(--text); line-height: 1.9; font-size: 16px; margin-bottom: 22px; }
.start-lead b { color: var(--gold); }

.rules { text-align: left; list-style: none; margin: 0 0 26px; display: grid; gap: 10px; }
.rules li {
  background: rgba(0, 0, 0, 0.22);
  padding: 11px 14px; border-radius: 12px;
  border-left: 3px solid var(--green-400);
  line-height: 1.6; font-size: 14.5px; color: var(--text-dim);
  animation: ruleIn 0.5s ease both;
}
.rules li:nth-child(1) { animation-delay: 0.05s; }
.rules li:nth-child(2) { animation-delay: 0.12s; }
.rules li:nth-child(3) { animation-delay: 0.19s; }
.rules li:nth-child(4) { animation-delay: 0.26s; }
.rules li:nth-child(5) { animation-delay: 0.33s; }
.rules b { color: var(--khaki); }

@keyframes ruleIn { from { opacity: 0; transform: translateX(-14px); } to { opacity: 1; transform: none; } }

.hint { margin-top: 16px; font-size: 13px; color: var(--text-dim); }

/* ---------- 按钮 ---------- */
.btn {
  font-family: inherit; cursor: pointer;
  border: 1px solid transparent; border-radius: 12px;
  padding: 12px 22px; font-size: 16px; letter-spacing: 1px;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
  color: var(--text);
}
.btn:active { transform: translateY(2px) scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-primary {
  background: linear-gradient(180deg, var(--green-500), var(--green-700));
  border-color: var(--green-400);
  box-shadow: 0 8px 22px rgba(63, 122, 69, 0.35);
}
.btn-primary:hover { background: linear-gradient(180deg, var(--green-400), var(--green-600)); box-shadow: 0 10px 26px rgba(63, 122, 69, 0.5); }

.btn-ghost { background: rgba(255, 255, 255, 0.05); border-color: var(--card-border); }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.12); }

.btn-big { padding: 16px 34px; font-size: 18px; }
.btn-mini { padding: 6px 12px; font-size: 13px; }

.start-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

/* ==========================================================================
   游戏界面
   ========================================================================== */
.game-layout { display: grid; grid-template-columns: 320px 1fr; gap: 18px; }

@media (max-width: 860px) {
  .game-layout { grid-template-columns: 1fr; }
}

.side-panel { display: flex; flex-direction: column; gap: 18px; }

.day-card { padding: 20px 22px; }
.day-progress-text { font-size: 20px; margin-bottom: 14px; }
.day-progress-text b { font-size: 26px; color: var(--gold); }

.day-dots { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.day-dot {
  width: 16px; height: 16px; border-radius: 4px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--card-border);
  transition: all 0.3s ease;
}
.day-dot.done { background: var(--green-500); border-color: var(--green-400); }
.day-dot.current { background: var(--gold); border-color: var(--gold-dark); box-shadow: 0 0 10px rgba(244, 201, 74, 0.7); animation: dotPulse 1.4s infinite; }

@keyframes dotPulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.25); } }

.phase-label { font-size: 14px; color: var(--khaki); letter-spacing: 1px; }

/* 状态条 */
.stats-card { padding: 22px; }
.stat { margin-bottom: 15px; }
.stat:last-child { margin-bottom: 0; }
.stat-head { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 6px; color: var(--text-dim); }
.stat-val { font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }

.bar {
  height: 12px; border-radius: 999px;
  background: rgba(0, 0, 0, 0.35);
  overflow: hidden; border: 1px solid rgba(255, 255, 255, 0.06);
}
.bar-fill {
  height: 100%; width: 0; border-radius: 999px;
  transition: width 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}
.bar-mood { background: linear-gradient(90deg, #e8a04a, #f4c94a); }
.bar-stamina { background: linear-gradient(90deg, #4a9fe8, #7cc4f4); }
.bar-stress { background: linear-gradient(90deg, #e05d5d, #f09a9a); }
.bar-achievement { background: linear-gradient(90deg, #c79a22, #f4c94a); }
.bar-cohesion { background: linear-gradient(90deg, #5aa05f, #8fd694); }

/* 剧情卡片 */
.main-panel { display: flex; flex-direction: column; gap: 18px; min-width: 0; }

.story-card { padding: 26px 30px; min-height: 160px; max-height: 300px; overflow-y: auto; }
.story-day-tag {
  display: inline-block; font-size: 13px; color: var(--green-900);
  background: var(--khaki); padding: 4px 12px; border-radius: 999px;
  letter-spacing: 1px; margin-bottom: 14px; font-weight: 700;
}
.story-text { font-size: 16.5px; line-height: 2; white-space: pre-wrap; }
.story-text .typed { color: var(--text); }
.story-text .highlight { color: var(--gold); font-weight: 700; }

/* 剧情分块（每次选择 / 事件追加一段） */
.story-chunk { animation: chunkIn 0.45s ease both; margin-bottom: 10px; }
.story-chunk:last-child { margin-bottom: 0; }
@keyframes chunkIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* 选项按钮 */
.choices { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 640px) { .choices { grid-template-columns: 1fr; } }

.choice-btn {
  position: relative; overflow: hidden;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 20px 16px;
  color: var(--text);
  cursor: pointer; text-align: center;
  transition: transform 0.18s ease, border-color 0.2s ease, box-shadow 0.25s ease, background 0.2s ease;
  font-family: inherit;
  animation: choiceIn 0.45s ease both;
}
.choice-btn:nth-child(1) { animation-delay: 0.04s; }
.choice-btn:nth-child(2) { animation-delay: 0.12s; }
.choice-btn:nth-child(3) { animation-delay: 0.2s; }

@keyframes choiceIn { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

.choice-btn:hover { transform: translateY(-4px); border-color: var(--green-400); box-shadow: 0 14px 30px rgba(0, 0, 0, 0.4); }
.choice-btn .choice-icon { font-size: 30px; display: block; margin-bottom: 8px; }
.choice-btn .choice-name { font-size: 17px; font-weight: 700; letter-spacing: 2px; display: block; margin-bottom: 6px; }
.choice-btn .choice-desc { font-size: 12.5px; color: var(--text-dim); line-height: 1.5; display: block; }

.choice-btn.strict:hover { border-color: #e05d5d; box-shadow: 0 14px 30px rgba(224, 93, 93, 0.25); }
.choice-btn.relax:hover { border-color: #5d9ce0; box-shadow: 0 14px 30px rgba(93, 156, 224, 0.25); }
.choice-btn.rest:hover { border-color: var(--green-400); box-shadow: 0 14px 30px rgba(63, 122, 69, 0.3); }

.choice-btn.picking { pointer-events: none; opacity: 0.4; transform: scale(0.96); }

/* 日志 */
.log-card { padding: 20px 22px; max-height: 230px; overflow-y: auto; }
.log-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.log-item {
  font-size: 13.5px; color: var(--text-dim); line-height: 1.6;
  padding: 8px 12px; background: rgba(0, 0, 0, 0.22); border-radius: 10px;
  border-left: 3px solid var(--green-500);
  animation: logIn 0.35s ease both;
}
.log-item.log-event { border-left-color: var(--gold); color: var(--khaki-light); }
.log-item.log-bad { border-left-color: var(--red); }
.log-item.log-good { border-left-color: var(--green-400); }

@keyframes logIn { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: none; } }

/* ==========================================================================
   结算界面
   ========================================================================== */
.ending-card { max-width: 720px; margin: 20px auto; padding: 40px 44px; text-align: center; animation: endingIn 0.7s cubic-bezier(0.22, 1, 0.36, 1) both; }

@keyframes endingIn { from { opacity: 0; transform: scale(0.92); } to { opacity: 1; transform: none; } }

.ending-badge { font-size: 64px; animation: badgePop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both; }
@keyframes badgePop { from { opacity: 0; transform: scale(0.3) rotate(-20deg); } to { opacity: 1; transform: none; } }

.ending-title { font-size: 32px; letter-spacing: 4px; margin: 10px 0 12px; color: var(--khaki-light); }
.ending-desc { line-height: 1.9; color: var(--text-dim); margin-bottom: 22px; font-size: 15px; }

.score-panel { margin: 8px auto 22px; }
.score-big {
  font-size: 72px; font-weight: 900; line-height: 1;
  background: linear-gradient(180deg, #fff3c4, var(--gold));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 4px 30px rgba(244, 201, 74, 0.35);
  animation: scoreCount 0.8s ease-out both;
}
.score-caption { color: var(--text-dim); letter-spacing: 3px; margin-top: 6px; }

@keyframes scoreCount { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.ending-stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-bottom: 24px; }
@media (max-width: 640px) { .ending-stats { grid-template-columns: repeat(2, 1fr); } }

.ending-stat { background: rgba(0, 0, 0, 0.25); border-radius: 12px; padding: 12px 6px; }
.ending-stat .es-label { font-size: 12px; color: var(--text-dim); display: block; }
.ending-stat .es-val { font-size: 20px; font-weight: 800; color: var(--khaki); display: block; margin-top: 4px; }

.leaderboard { margin: 10px 0 18px; text-align: left; }
.leaderboard-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.leaderboard-head h3 { font-size: 16px; letter-spacing: 2px; color: var(--khaki); }
.leaderboard-list { list-style: none; display: flex; flex-direction: column; gap: 6px; max-height: 260px; overflow-y: auto; padding-right: 4px; }
.leaderboard-list li {
  display: flex; justify-content: space-between; align-items: center;
  padding: 9px 14px; background: rgba(0, 0, 0, 0.25); border-radius: 10px; font-size: 14px;
}
.leaderboard-list .rank { color: var(--gold); font-weight: 800; width: 34px; }
.leaderboard-list .rank.r1 { color: #ffd700; } .rank.r2 { color: #c0c0c0; } .rank.r3 { color: #cd7f32; }
.leaderboard-list .name { flex: 1; text-align: left; margin: 0 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leaderboard-list .pts { font-weight: 800; color: var(--khaki); font-variant-numeric: tabular-nums; }

.submit-score { display: flex; gap: 10px; margin-bottom: 20px; }
.submit-score input {
  flex: 1; background: rgba(0, 0, 0, 0.3); border: 1px solid var(--card-border);
  border-radius: 12px; padding: 12px 16px; color: var(--text); font-size: 15px;
  font-family: inherit; outline: none;
  transition: border-color 0.2s ease;
}
.submit-score input:focus { border-color: var(--green-400); }

.ending-actions { display: flex; justify-content: center; }

/* ==========================================================================
   事件弹窗
   ========================================================================== */
.modal-mask {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(0, 0, 0, 0.55);
  display: grid; place-items: center;
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s ease;
  backdrop-filter: blur(3px);
}
.modal-mask.show { opacity: 1; pointer-events: auto; }

.modal {
  width: min(460px, 90vw);
  background: linear-gradient(180deg, #1d3a26, #122416);
  border: 1px solid var(--gold);
  border-radius: 20px; padding: 32px 30px; text-align: center;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  transform: translateY(30px) scale(0.9);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.modal-mask.show .modal { transform: none; }
.modal-icon { font-size: 52px; margin-bottom: 8px; }
.modal-title { font-size: 21px; letter-spacing: 3px; color: var(--khaki-light); margin-bottom: 12px; }
.modal-text { line-height: 1.9; color: var(--text-dim); margin-bottom: 16px; font-size: 15px; }
.modal-effects { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-bottom: 20px; }
.effect-chip {
  padding: 4px 12px; border-radius: 999px; font-size: 13px;
  background: rgba(0, 0, 0, 0.3); border: 1px solid var(--card-border);
}
.effect-chip.pos { color: #8fd694; border-color: rgba(95, 160, 95, 0.4); }
.effect-chip.neg { color: #f09a9a; border-color: rgba(224, 93, 93, 0.4); }

/* 弹窗内的排行榜列表 */
.modal-list { margin-bottom: 14px; text-align: left; }
.modal-list .leaderboard-list { max-height: 320px; }
.empty-list {
  color: var(--text-dim); text-align: center; padding: 20px 10px;
  font-size: 14px; line-height: 1.8;
}

/* 选择后数值漂浮动画 */
.float-num {
  position: fixed; z-index: 40; pointer-events: none;
  font-weight: 800; font-size: 20px;
  animation: floatUp 1.1s ease-out forwards;
}
.float-num.pos { color: #8fd694; }
.float-num.neg { color: #f09a9a; }
@keyframes floatUp {
  0% { opacity: 0; transform: translateY(0) scale(0.8); }
  20% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-70px) scale(1.1); }
}

/* ---------- 页脚 ---------- */
.site-footer { text-align: center; padding: 16px; color: var(--text-dim); font-size: 12.5px; letter-spacing: 1px; }

/* ---------- 滚动条美化 ---------- */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.2); }
::-webkit-scrollbar-thumb { background: var(--green-600); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: var(--green-500); }

/* ---------- 可访问性：减少动画 ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001s !important; transition-duration: 0.001s !important; }
}
