/* public/css/style.css - 龙虾部署模拟器 深色科技风格 */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --red: #E74C3C;
  --red-glow: rgba(231,76,60,0.4);
  --bg: #0a0a1a;
  --bg2: #0f0f2a;
  --card-bg: rgba(255,255,255,0.05);
  --card-border: rgba(255,255,255,0.1);
  --term-bg: #1a1a2e;
  --term-green: #00ff41;
  --text: #e0e0e0;
  --text-dim: #888;
  --success: #2ecc71;
  --error: #e74c3c;
}
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}
.hidden { display: none !important; }
.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px;
  min-height: 100vh;
  position: relative;
}

/* 屏幕通用 */
.screen { min-height: 100vh; padding-bottom: 60px; }
.screen-title {
  font-size: 20px;
  font-weight: 700;
  text-align: center;
  margin: 20px 0 16px;
  color: var(--red);
}
.screen-subtitle {
  text-align: center;
  color: var(--text-dim);
  font-size: 14px;
  margin-bottom: 20px;
}

/* 开始界面 */
.game-logo { font-size: 48px; text-align: center; margin-top: 60px; }
.game-title {
  font-size: 28px; font-weight: 800; text-align: center;
  color: var(--red); margin: 12px 0 8px;
  text-shadow: 0 0 20px var(--red-glow);
}
.game-subtitle { text-align: center; color: var(--text-dim); font-size: 15px; margin-bottom: 40px; }
.btn-group { display: flex; flex-direction: column; gap: 12px; padding: 0 20px; }
.btn {
  display: block; width: 100%; padding: 14px; border: none; border-radius: 12px;
  font-size: 16px; font-weight: 600; cursor: pointer; transition: all 0.2s;
  text-align: center;
}
.btn-primary {
  background: var(--red); color: #fff;
  box-shadow: 0 4px 15px var(--red-glow);
}
.btn-primary:active { transform: scale(0.97); }
.btn-secondary {
  background: var(--card-bg); color: var(--text);
  border: 1px solid var(--card-border);
}
.btn-secondary:active { background: rgba(255,255,255,0.1); }
.deploy-stat {
  text-align: center; color: var(--text-dim); font-size: 13px;
  margin-top: 40px;
}
#user-btn { position: absolute; top: 16px; right: 16px; }

/* 卡片 */
.card-grid { display: grid; gap: 12px; padding: 0 4px; }
.card-grid.hw { grid-template-columns: 1fr 1fr; }
.card-grid.models { grid-template-columns: 1fr 1fr; }
.card {
  background: var(--card-bg); border: 1px solid var(--card-border);
  border-radius: 12px; padding: 14px; cursor: pointer;
  transition: all 0.2s; backdrop-filter: blur(10px);
}
.card:active { transform: scale(0.97); }
.card.selected {
  border-color: var(--red);
  box-shadow: 0 0 15px var(--red-glow);
}
.card.recommended { border-color: rgba(231,76,60,0.3); }
.card-icon { font-size: 28px; margin-bottom: 6px; }
.card-title { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.card-price { font-size: 13px; color: var(--red); margin-bottom: 4px; }
.card-stars { font-size: 12px; color: #f39c12; margin-bottom: 4px; }
.card-desc { font-size: 12px; color: var(--text-dim); line-height: 1.4; }
.badge { font-size: 10px; background: var(--red); color: #fff; padding: 1px 6px; border-radius: 8px; }
.budget-bar {
  text-align: center; padding: 12px; margin: 16px 0;
  font-size: 18px; font-weight: 700; color: var(--success);
}
.btn-confirm { margin-top: 16px; }

/* 系统配置 */
.sys-layout { display: flex; flex-direction: column; gap: 12px; }
.task-list { list-style: none; }
.task-item {
  padding: 8px 12px; font-size: 13px; color: var(--text-dim);
  border-left: 2px solid var(--card-border); margin-bottom: 4px;
  transition: all 0.3s;
}
.task-item.active { color: var(--text); border-color: var(--red); }
.task-item.done { color: var(--success); border-color: var(--success); }
.task-item.done::before { content: '✓ '; }
.task-item.active::before { content: '▸ '; }
.progress-bar-wrap {
  background: rgba(255,255,255,0.1); border-radius: 4px;
  height: 6px; margin: 12px 0; overflow: hidden;
}
.progress-bar-fill {
  height: 100%; background: var(--red); border-radius: 4px;
  transition: width 0.4s ease; width: 0%;
}

/* 终端 */
.terminal {
  background: var(--term-bg); border-radius: 8px;
  padding: 12px; font-family: 'Menlo', 'Consolas', 'Courier New', monospace;
  font-size: 12px; line-height: 1.6; color: var(--term-green);
  height: 280px; overflow-y: auto; position: relative;
  border: 1px solid rgba(0,255,65,0.15);
}
.terminal.big { height: 400px; }
.terminal.scanlines::after {
  content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background: repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0,0,0,0.08) 2px, rgba(0,0,0,0.08) 4px);
  pointer-events: none; border-radius: 8px;
}
.term-line { white-space: pre-wrap; word-break: break-all; }
.term-line.cmd { color: #00bfff; }
.term-line.error { color: var(--error); }
.term-line.success { color: var(--success); }
.term-line.art { color: var(--red); font-weight: bold; }
.term-line.big { font-size: 16px; }
.term-cursor {
  display: inline-block; animation: blink 0.8s infinite;
  color: var(--term-green);
}
@keyframes blink { 0%,50% { opacity: 1; } 51%,100% { opacity: 0; } }
.term-options { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.term-option-btn {
  background: rgba(0,255,65,0.1); border: 1px solid rgba(0,255,65,0.3);
  color: var(--term-green); padding: 8px 12px; border-radius: 6px;
  font-family: inherit; font-size: 12px; cursor: pointer;
  text-align: left; transition: all 0.2s;
}
.term-option-btn:active { background: rgba(0,255,65,0.2); }
.term-option-btn.selected { background: rgba(0,255,65,0.25); border-color: var(--term-green); }
.term-option-btn.disabled { opacity: 0.5; cursor: default; }

/* 倒计时 */
.term-countdown {
  display: inline-block; float: right; color: var(--error);
  font-weight: bold; font-size: 14px; animation: pulse 1s infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }

/* 渠道卡片 */
.card-grid.channels { grid-template-columns: 1fr 1fr; }
.channel-card .card-diff { font-size: 11px; color: var(--text-dim); margin-top: 4px; }

/* 模型选择 */
.model-cost {
  text-align: center; font-size: 14px; color: var(--text-dim);
  margin: 12px 0;
}

/* 结算 */
.result-card {
  background: var(--card-bg); border-radius: 16px;
  padding: 24px; text-align: center; margin-bottom: 16px;
  border: 1px solid var(--card-border);
}
.grade {
  font-size: 72px; font-weight: 900; line-height: 1;
  margin-bottom: 8px;
}
.grade-S { color: #f1c40f; text-shadow: 0 0 30px rgba(241,196,15,0.5); }
.grade-A { color: var(--red); text-shadow: 0 0 20px var(--red-glow); }
.grade-B { color: #3498db; }
.grade-C { color: var(--text-dim); }
.grade-D { color: #666; }
.result-score { font-size: 20px; font-weight: 600; margin-bottom: 16px; }
.result-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; text-align: left; }
.stat-item { font-size: 13px; padding: 8px; background: rgba(255,255,255,0.03); border-radius: 8px; }
.stat-label { color: var(--text-dim); font-size: 11px; }
.stat-value { font-weight: 600; margin-top: 2px; }
.result-badges {
  display: flex; flex-wrap: wrap; gap: 8px;
  justify-content: center; margin: 16px 0;
}
.badge-item {
  background: var(--card-bg); border: 1px solid var(--card-border);
  padding: 6px 12px; border-radius: 20px; font-size: 13px;
}
.btn-share {
  background: var(--success); color: #fff;
  font-size: 18px; padding: 16px;
}

/* 下一个游戏引导 */
.next-game-banner {
  margin: 20px 0 12px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.08);
}
.banner-terminal {
  background: rgba(0,0,0,0.4);
  padding: 12px 16px;
  font-family: 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.7;
}
.banner-line { color: var(--text); }
.banner-line.dim { color: var(--text-dim); }
.banner-line.success { color: var(--success); }
.btn-next-game {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--red), #c0392b);
  color: #fff;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-next-game span {
  font-size: 16px;
  font-weight: 700;
}
.btn-next-game small {
  font-size: 12px;
  opacity: 0.8;
  margin-top: 2px;
}
.btn-next-game:active {
  transform: scale(0.98);
}

/* 排行榜弹窗 */
.modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.8); z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.modal {
  background: var(--bg2); border-radius: 16px;
  width: 100%; max-width: 420px; max-height: 80vh;
  overflow-y: auto; padding: 20px;
}
.modal-title { font-size: 18px; font-weight: 700; text-align: center; margin-bottom: 16px; }
.lb-row {
  display: flex; align-items: center; padding: 10px 8px;
  border-bottom: 1px solid var(--card-border); font-size: 14px;
}
.lb-rank { width: 36px; text-align: center; font-weight: 700; }
.lb-name { flex: 1; }
.lb-score { color: var(--red); font-weight: 600; }
.loading, .empty { text-align: center; color: var(--text-dim); padding: 40px 0; }

/* 底部进度 */
.progress-dots {
  position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 8px; z-index: 50;
}
.progress-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: rgba(255,255,255,0.2); transition: all 0.3s;
}
.progress-dot.active { background: rgba(231,76,60,0.5); }
.progress-dot.current { background: var(--red); box-shadow: 0 0 8px var(--red-glow); transform: scale(1.3); }

/* 动画 */
@keyframes shake {
  0%,100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}
.shake { animation: shake 0.4s ease; }

/* 响应式 */
@media (min-width: 481px) {
  .container { padding: 20px; }
  .terminal { height: 320px; }
  .terminal.big { height: 450px; }
}
/* 全局预算条 */
.global-budget {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.85);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 20px;
  padding: 6px 16px;
  font-size: 15px;
  font-weight: 700;
  z-index: 90;
  display: flex;
  align-items: center;
  gap: 6px;
  backdrop-filter: blur(10px);
  transition: all 0.3s;
}
.global-budget .budget-icon { font-size: 16px; }
#budget-amount { transition: color 0.3s; color: #2ecc71; }
.budget-low { animation: budget-pulse 1s infinite; }
@keyframes budget-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }

.grade-hint { font-size: 11px; color: var(--text-dim); margin-top: -4px; margin-bottom: 12px; }

/* 选项对错反馈 */
.term-option-btn.opt-correct { border-color: var(--success) !important; background: rgba(46,204,113,0.2) !important; color: var(--success) !important; }
.term-option-btn.opt-wrong { border-color: var(--error) !important; background: rgba(231,76,60,0.2) !important; color: var(--error) !important; }
.term-option-btn.opt-correct::after { content: ' ✓'; }
.term-option-btn.opt-wrong::after { content: ' ✗'; }

/* 倒计时进度条 */
.term-countdown-bar {
  height: 3px;
  background: var(--success);
  border-radius: 2px;
  margin: 4px 0;
  transition: width 1s linear, background 0.3s;
}
.term-countdown-bar.urgent { background: var(--error); }
/* 终端边框闪烁（最后3秒） */
.terminal.countdown-urgent {
  border-color: var(--error) !important;
  animation: border-flash 0.5s infinite;
}
@keyframes border-flash {
  0%,100% { border-color: var(--error); box-shadow: 0 0 10px rgba(231,76,60,0.3); }
  50% { border-color: rgba(231,76,60,0.3); box-shadow: none; }
}

.card-trap-rate { font-size: 11px; color: var(--error); opacity: 0.7; margin-bottom: 4px; }

/* Loading overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: opacity 0.3s;
}
.loading-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}
.loading-spinner {
  font-size: 64px;
  animation: loading-bounce 1s infinite;
}
@keyframes loading-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-20px); }
}
.loading-text {
  margin-top: 16px;
  color: var(--text-dim);
  font-size: 14px;
}

/* 移动端优化 */
@media (max-width: 640px) {
  /* 选项按钮竖排 */
  .term-options { flex-direction: column; gap: 8px; }
  .term-option-btn { width: 100%; }
  
  /* 终端字体放大 */
  .terminal { font-size: 14px; }
  
  /* 卡片网格单列 */
  .card-grid { grid-template-columns: 1fr; }
  
  /* 结算页按钮竖排 */
  .result-actions { flex-direction: column; }
  .result-actions button { width: 100%; }
}

/* 横屏提示 */
@media (max-width: 896px) and (orientation: landscape) {
  body::before {
    content: '📱 建议竖屏游玩';
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.9);
    color: #fff;
    padding: 20px 40px;
    border-radius: 12px;
    z-index: 9998;
    font-size: 18px;
    pointer-events: none;
  }
  body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 9997;
    pointer-events: none;
  }
}

/* 踩坑回放弹窗 */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.8);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal.hidden { display: none; }
.modal-content {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  max-width: 600px;
  width: 100%;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.modal-header {
  padding: 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-header h3 { margin: 0; font-size: 20px; }
.modal-close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
}
.modal-close:hover { background: rgba(255,255,255,0.1); }
.trap-replay-list {
  padding: 20px;
  overflow-y: auto;
}
.trap-replay-item {
  margin-bottom: 16px;
  padding: 12px;
  background: rgba(255,255,255,0.05);
  border-radius: 8px;
}
.trap-replay-title {
  font-size: 14px;
  margin-bottom: 6px;
  color: var(--text);
}
.trap-replay-choice {
  font-size: 13px;
  padding: 4px 8px;
  border-radius: 4px;
  display: inline-block;
}
.trap-replay-choice.correct { background: rgba(46,204,113,0.2); color: var(--success); }
.trap-replay-choice.wrong { background: rgba(231,76,60,0.2); color: var(--error); }

.lb-config {
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 更多游戏入口 */
.more-games {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.more-games-title {
  font-size: 13px;
  color: var(--text-dim, #888);
  margin-bottom: 12px;
  letter-spacing: 1px;
}
.game-links {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}
.game-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 20px;
  color: var(--text-secondary, #aaa);
  text-decoration: none;
  font-size: 13px;
  transition: all 0.2s ease;
}
.game-link:hover {
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.2);
  color: #fff;
  transform: translateY(-1px);
}
.game-link:active {
  transform: translateY(0);
}
.game-link-icon {
  font-size: 16px;
}
.game-link-name {
  white-space: nowrap;
}
@media (max-width: 480px) {
  .game-links {
    flex-direction: column;
    align-items: center;
  }
  .game-link {
    width: 80%;
    justify-content: center;
  }
}

/* ===== 响应式全面优化 ===== */

/* 基础：容器自适应 */
.container {
  max-width: 100%;
  width: 100%;
  padding: 16px;
  margin: 0 auto;
}

/* 屏幕不强制 100vh，内容自然撑开 */
.screen {
  min-height: auto;
  padding-bottom: 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* 开始界面居中 */
#screen-start {
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
}

/* 内容区域限宽 */
.screen-title,
.screen-subtitle,
.btn-group,
.deploy-stat,
.more-games,
.budget-bar,
.btn-confirm,
.model-cost,
.sys-layout,
.result-card,
.result-badges,
.next-game-banner {
  width: 100%;
  max-width: 520px;
}

.card-grid {
  width: 100%;
  max-width: 640px;
}

.btn-confirm {
  display: block;
}

/* ---- 小手机 (<375px) ---- */
@media (max-width: 374px) {
  .game-logo { font-size: 40px; margin-top: 40px; }
  .game-title { font-size: 22px; }
  .game-subtitle { font-size: 13px; margin-bottom: 28px; }
  .btn { padding: 12px; font-size: 15px; }
  .card-icon { font-size: 22px; }
  .card-title { font-size: 13px; }
  .card-desc { font-size: 11px; }
  .terminal { height: 220px; font-size: 11px; }
  .terminal.big { height: 300px; }
  .grade { font-size: 56px; }
}

/* ---- 标准手机 (375-480px) ---- */
@media (min-width: 375px) and (max-width: 480px) {
  .game-logo { margin-top: 50px; }
  .terminal { height: 260px; }
  .terminal.big { height: 360px; }
}

/* ---- 大手机/小平板 (481-768px) ---- */
@media (min-width: 481px) and (max-width: 768px) {
  .container { padding: 20px; }
  .game-logo { font-size: 56px; margin-top: 60px; }
  .game-title { font-size: 32px; }
  .game-subtitle { font-size: 16px; }
  .btn { padding: 16px; font-size: 17px; border-radius: 14px; }
  .card-grid.hw,
  .card-grid.models,
  .card-grid.channels { grid-template-columns: 1fr 1fr; }
  .card { padding: 16px; }
  .card-title { font-size: 15px; }
  .terminal { height: 320px; font-size: 13px; }
  .terminal.big { height: 420px; }
  .result-stats { grid-template-columns: 1fr 1fr; }
}

/* ---- 平板 (769-1024px) ---- */
@media (min-width: 769px) and (max-width: 1024px) {
  .container { padding: 24px 32px; }
  .game-logo { font-size: 64px; margin-top: 80px; }
  .game-title { font-size: 36px; }
  .game-subtitle { font-size: 17px; margin-bottom: 48px; }
  .btn-group { max-width: 400px; }
  .btn { padding: 16px; font-size: 17px; }
  .card-grid { max-width: 720px; }
  .card-grid.hw,
  .card-grid.models { grid-template-columns: repeat(3, 1fr); }
  .card-grid.channels { grid-template-columns: repeat(3, 1fr); }
  .card { padding: 18px; border-radius: 14px; }
  .card-icon { font-size: 32px; }
  .card-title { font-size: 15px; }
  .card-desc { font-size: 13px; }
  .terminal { height: 360px; font-size: 13px; }
  .terminal.big { height: 480px; }
  .sys-layout { max-width: 640px; }
  .result-card { max-width: 560px; }
  .result-stats { grid-template-columns: repeat(4, 1fr); }
  .grade { font-size: 80px; }
  .result-score { font-size: 22px; }
  .game-links { gap: 12px; }
  .game-link { padding: 10px 20px; font-size: 14px; }
}

/* ---- 桌面 (1025px+) ---- */
@media (min-width: 1025px) {
  .container { padding: 24px 40px; }
  .game-logo { font-size: 72px; margin-top: 100px; }
  .game-title { font-size: 40px; }
  .game-subtitle { font-size: 18px; margin-bottom: 56px; }
  .btn-group { max-width: 420px; }
  .btn { padding: 18px; font-size: 18px; border-radius: 16px; }
  .card-grid { max-width: 800px; }
  .card-grid.hw { grid-template-columns: repeat(4, 1fr); }
  .card-grid.models { grid-template-columns: repeat(4, 1fr); }
  .card-grid.channels { grid-template-columns: repeat(3, 1fr); }
  .card { padding: 20px; border-radius: 16px; }
  .card-icon { font-size: 36px; margin-bottom: 8px; }
  .card-title { font-size: 16px; }
  .card-desc { font-size: 13px; }
  .terminal { height: 400px; font-size: 14px; padding: 16px; }
  .terminal.big { height: 520px; }
  .sys-layout { max-width: 680px; }
  .result-card { max-width: 600px; }
  .result-stats { grid-template-columns: repeat(4, 1fr); }
  .grade { font-size: 88px; }
  .result-score { font-size: 24px; }
  .screen-title { font-size: 24px; }
  .game-links { gap: 14px; }
  .game-link { padding: 10px 22px; font-size: 15px; }
  .term-option-btn { padding: 10px 16px; font-size: 14px; }
  .next-game-banner { max-width: 560px; }
}

/* 安全区域适配（刘海屏等） */
@supports (padding: env(safe-area-inset-top)) {
  .container {
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
    padding-bottom: max(16px, env(safe-area-inset-bottom));
  }
  .progress-dots {
    bottom: max(16px, env(safe-area-inset-bottom));
  }
}

/* 终端高度用 dvh 适配（移动浏览器地址栏） */
@supports (height: 100dvh) {
  .terminal { height: min(280px, 40dvh); }
  .terminal.big { height: min(400px, 55dvh); }
  @media (min-width: 769px) {
    .terminal { height: min(360px, 45dvh); }
    .terminal.big { height: min(480px, 55dvh); }
  }
  @media (min-width: 1025px) {
    .terminal { height: min(400px, 50dvh); }
    .terminal.big { height: min(520px, 60dvh); }
  }
}

/* 修复：移动端卡片网格覆盖（优先级提升） */
@media (max-width: 640px) {
  .card-grid.hw,
  .card-grid.models,
  .card-grid.channels {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 374px) {
  .card-grid.hw,
  .card-grid.models,
  .card-grid.channels {
    grid-template-columns: 1fr;
  }
}

/* 游戏结束动画 */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
#gameover-overlay {
  animation: fadeIn 0.5s ease;
}
#gameover-overlay button:hover {
  transform: scale(1.05);
  transition: transform 0.2s;
}
#gameover-overlay button:active {
  transform: scale(0.97);
}

/* Round 4: Visual polish */

/* Major severity option styling - yellow warning */
.term-option-btn[data-severity="major"] {
  border-color: #f39c12;
  position: relative;
}
.term-option-btn[data-severity="major"]::before {
  content: '⚠️ ';
}

/* Fatal severity option styling - red danger */
.term-option-btn[data-severity="fatal"] {
  border-color: #e74c3c;
  position: relative;
}
.term-option-btn[data-severity="fatal"]::before {
  content: '💀 ';
}

/* Retry message styling */
.term-line.error.retry-msg {
  background: rgba(231,76,60,0.1);
  border-left: 3px solid #e74c3c;
  padding: 4px 8px;
  margin: 4px 0;
  border-radius: 4px;
}

/* Game over overlay animation */
@keyframes pulseRed {
  0%, 100% { box-shadow: 0 0 20px rgba(231,76,60,0.3); }
  50% { box-shadow: 0 0 40px rgba(231,76,60,0.6); }
}
#gameover-overlay > div:first-child {
  animation: pulseRed 2s infinite;
}

/* Trap replay severity badges */
.trap-replay-item .severity-badge {
  display: inline-block;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 8px;
  margin-left: 6px;
  vertical-align: middle;
}
.severity-badge.minor { background: rgba(255,255,255,0.1); color: #888; }
.severity-badge.major { background: rgba(243,156,18,0.2); color: #f39c12; }
.severity-badge.fatal { background: rgba(231,76,60,0.2); color: #e74c3c; }

/* Budget pulse animation when low */
@keyframes budgetPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}
.budget-low {
  animation: budgetPulse 1s infinite;
}

/* Improve option button hover states */
.term-option-btn:not(.disabled):hover {
  background: rgba(0,255,65,0.15);
  transform: translateX(4px);
  transition: all 0.15s ease;
}

/* Better terminal scrollbar */
.terminal::-webkit-scrollbar {
  width: 4px;
}
.terminal::-webkit-scrollbar-track {
  background: transparent;
}
.terminal::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.15);
  border-radius: 2px;
}
.terminal::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.3);
}
