:root {
  --bg: #0a0a12;
  --panel: #12121e;
  --line: #232338;
  --text: #e8e8f0;
  --dim: #8888a0;
  --accent: #ffd34d;
  --crit: #ff5d5d;
  --ok: #5dff8f;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: "SF Mono", "Cascadia Code", Menlo, Consolas, "PingFang SC", monospace;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px;
  gap: 14px;
}

header { text-align: center; position: relative; width: 100%; max-width: 1020px; }
header h1 { font-size: 22px; letter-spacing: 1px; }
header .sub { color: var(--dim); font-size: 12px; margin-top: 6px; }
#lang-btn {
  position: absolute;
  right: 0; top: 0;
  font-size: 12px;
  padding: 5px 10px;
}
#auto-btn {
  position: absolute;
  left: 0; top: 0;
  font-size: 12px;
  padding: 5px 10px;
}

/* 说明卡折叠 */
#card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
}
#card-fold { color: var(--dim); font-size: 14px; }
#step-card.collapsed #step-desc,
#step-card.collapsed #step-params,
#step-card.collapsed #step-source { display: none; }
#step-card.collapsed { flex: 0 0 auto; }

main {
  display: flex;
  gap: 14px;
  width: 100%;
  max-width: 1020px;
  align-items: flex-start;
}

#stage {
  position: relative;
  flex: 0 0 auto;
}

#game {
  display: block;
  background: #0d0d18;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: crosshair;
  width: 640px;
  height: 440px;
  touch-action: none;          /* 手机:点按攻击不触发滚动/缩放 */
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}


#ab-btn {
  position: absolute;
  top: 10px;
  right: 10px;
}

#view-btn {
  position: absolute;
  top: 10px;
  left: 10px;
}

#panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

#step-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  flex: 1;
}

#step-tag {
  display: inline-block;
  background: var(--accent);
  color: #000;
  font-size: 11px;
  font-weight: bold;
  padding: 2px 8px;
  border-radius: 4px;
  margin-bottom: 10px;
}
/* 篇章配色:游戏=金 动漫=粉 电影=青 综合=红 警告=灰 */
#step-tag[data-act="动漫篇"] { background: #ff8ab8; }
#step-tag[data-act="电影篇"] { background: #5dc8ff; }
#step-tag[data-act="综合"]   { background: #ff5d5d; color: #fff; }
#step-tag[data-act="警告"]   { background: #8888a0; }
.dot[data-act="动漫篇"].active { background: #ff8ab8; }
.dot[data-act="电影篇"].active { background: #5dc8ff; }
.dot[data-act="综合"].active   { background: #ff5d5d; }

#ult-btn-dom {
  position: absolute;
  bottom: 14px;
  right: 14px;          /* 右下:不压充能条 */
  top: auto;            /* 通用 button 规则有 top:0(按压效果),绝对定位下会和 bottom 同锚把按钮拉满高 */
  animation: ult-pulse 0.9s ease-in-out infinite;
}
#ult-btn-dom:active { top: auto; }
@keyframes ult-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.07); filter: brightness(1.3); }
}

#step-card h2 { font-size: 18px; margin-bottom: 10px; }
#step-desc { font-size: 13px; line-height: 1.7; color: var(--text); }

#step-params {
  margin-top: 12px;
  font-size: 12px;
  line-height: 1.8;
  color: var(--accent);
  white-space: pre-line;
}

#step-source {
  margin-top: 12px;
  font-size: 11px;
  color: var(--dim);
}
#step-source::before { content: "📚 "; }

#free-mode {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 16px;
}
#free-mode h3 { font-size: 13px; margin-bottom: 8px; }
#free-mode .hint { color: var(--dim); font-weight: normal; font-size: 11px; }

#toggles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 12px;
  font-size: 12px;
}
#toggles label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  color: var(--dim);
  user-select: none;
}
#toggles label.on { color: var(--text); }
#toggles input { accent-color: var(--accent); }

#stepper {
  display: flex;
  align-items: center;
  gap: 16px;
}

#dots { display: flex; gap: 6px; }
.dot {
  width: 10px; height: 10px;
  border-radius: 2px;            /* 方形像素点,呼应街机控制台 */
  background: var(--line);
  cursor: pointer;
  transition: background .2s;
}
.dot.active { background: var(--accent); }
.dot.passed { background: #6a6a40; }

/* ===== 按钮系统:街机控制台 =====
   三级:primary(金实底,主行动) / secondary(金描边,模式切换) / ghost(灰,辅助)
   统一:等宽大写 + 硬阴影(无模糊)+ 按下位移 = 实体键手感 */
button {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 8px 14px;
  white-space: nowrap;
  font-family: inherit;
  font-size: 12px;
  font-weight: bold;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 3px 0 #06060c;
  transition: filter .12s;
  position: relative;
  top: 0;
}
button:hover { filter: brightness(1.25); }
button:active { top: 3px; box-shadow: 0 0 0 #06060c; }
button:disabled { opacity: .3; cursor: default; box-shadow: 0 3px 0 #06060c; top: 0; }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn-primary {
  background: linear-gradient(180deg, #ffe289, var(--accent) 40%, #d9a82e);
  color: #1a1200;
  border: 1px solid #8a6d1e;
  box-shadow: 0 3px 0 #6e5512;
}
.btn-primary:active { box-shadow: 0 0 0 #6e5512; }

.btn-secondary {
  color: var(--accent);
  border-color: #5a4d1e;
}

.btn-ghost {
  color: var(--dim);
  font-weight: normal;
}

#overload-row[hidden] { display: none; }
#overload-row {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 16px;
}
#overload-row .warn { color: var(--crit); font-size: 11px; }
#overload { accent-color: var(--crit); width: 160px; }
#overload-val { color: var(--accent); }

footer {
  display: flex;
  gap: 12px;
  align-items: center;
  color: var(--dim);
  font-size: 12px;
}
footer a { color: var(--dim); }

@media (max-width: 768px) {
  body { padding: 10px; gap: 10px; padding-bottom: 118px; }
  main { flex-direction: column; }
  #game { width: 100%; height: auto; aspect-ratio: 640/440; }
  #toggles { grid-template-columns: 1fr 1fr; font-size: 11px; }
  /* 触摸热区加大 */
  button { padding: 12px 14px; font-size: 14px; }
  .dot { width: 13px; height: 13px; }
  /* 步进条吸底:竖屏拇指可达。点阵独占一整行(否则 19 点折 4 行撑爆高度盖住内容) */
  #stepper {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: rgba(10,10,18,0.95);
    border-top: 1px solid var(--line);
    padding: 8px 12px calc(10px + env(safe-area-inset-bottom));
    width: 100%;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px;
    z-index: 10;
  }
  #dots {
    order: -1;
    flex-basis: 100%;
    flex-wrap: nowrap;
    justify-content: center;
    gap: 4px;
    max-width: none;
  }
  .dot { width: 11px; height: 11px; }
  #stage-hint { font-size: 10px; }
  #lang-btn, #auto-btn { position: static; margin-top: 6px; }
  header { display: flex; flex-direction: column; align-items: center; }
  header { flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 8px; }
  header h1 { width: 100%; }
  header .sub { display: none; }     /* 手机:副标让位 */
}
