:root {
  --bg: #0e1116;
  --panel: #171b22;
  --panel-2: #1f242d;
  --border: #2a313c;
  --text: #e6e9ef;
  --muted: #93a0b4;
  --accent: #5b9cff;
  --accent-2: #7ee0a0;
  --danger: #ff6b6b;
  --warn: #f0c050;
  --gold: #f5c542;
  --purple: #c792ea;
  --shadow: 0 8px 30px rgba(0,0,0,.35);
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(1200px 800px at 70% -10%, #1a2230 0%, var(--bg) 55%);
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
#app { max-width: 920px; margin: 0 auto; padding: 18px 16px 60px; }
a { color: var(--accent); }

/* 顶部栏 */
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 10px 4px 18px; }
.topbar h1 { font-size: 18px; margin: 0; letter-spacing: .5px; }
.topbar .who { color: var(--muted); font-size: 13px; }
.btn {
  appearance: none; border: 1px solid var(--border); background: var(--panel-2); color: var(--text);
  padding: 9px 14px; border-radius: 10px; cursor: pointer; font-size: 14px; transition: .15s;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: linear-gradient(180deg,#5b9cff,#3f7be0); border-color: #3f7be0; color: #fff; font-weight: 600; }
.btn.ghost { background: transparent; }
.btn.danger { background: #3a1f24; border-color: #5a2a30; color: var(--danger); }
.btn.sm { padding: 6px 10px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.next { background: linear-gradient(180deg,#7ee0a0,#46c47e); border-color: #46c47e; color: #06321d; font-weight: 700; animation: nextPulse 1.2s ease-in-out infinite; }
@keyframes nextPulse { 0%,100% { box-shadow: 0 0 0 0 rgba(70,196,126,.5); } 50% { box-shadow: 0 0 0 8px rgba(70,196,126,0); } }

/* 卡片 */
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.grid { display: grid; gap: 14px; }
.grid.cols-2 { grid-template-columns: 1fr 1fr; }
.grid.cols-3 { grid-template-columns: repeat(3,1fr); }
@media (max-width: 720px){ .grid.cols-2,.grid.cols-3{ grid-template-columns:1fr; } }

/* 表单 */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.input, input[type=text], input[type=password], textarea, select {
  width: 100%; padding: 10px 12px; background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 10px; color: var(--text); font-size: 14px; font-family: inherit;
}
.input:focus, input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); }
textarea { resize: vertical; min-height: 90px; }

/* 登录/注册 */
.auth-wrap { max-width: 380px; margin: 8vh auto; }
.auth-wrap h2 { margin: 0 0 4px; }
.auth-wrap .sub { color: var(--muted); font-size: 13px; margin-bottom: 18px; }
.center { text-align: center; }
.muted { color: var(--muted); }
.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; background: var(--panel-2); border: 1px solid var(--border); color: var(--muted); }
.tag.admin { color: var(--gold); border-color: #5a4a1f; background: #2a2410; }

/* 场景/怪兽选择 */
.scene { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.scene .head { padding: 14px 16px; display: flex; align-items: center; gap: 12px; }
.scene .head .emoji { font-size: 30px; }
.scene .body { padding: 0 16px 16px; }
.monster-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; margin-top: 10px; background: var(--panel-2); }
.monster-row .emoji { font-size: 26px; }
.monster-row .meta { flex: 1; }
.monster-row .meta .name { font-weight: 600; }
.monster-row .meta .desc { font-size: 12px; color: var(--muted); }
.badge-clear { color: var(--accent-2); font-size: 12px; }

/* 模式选择 */
.mode-card { cursor: pointer; border: 1px solid var(--border); border-radius: 12px; padding: 14px; background: var(--panel-2); transition: .15s; }
.mode-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.mode-card .lv { font-size: 12px; }
.mode-card h4 { margin: 6px 0 4px; }
.mode-card .hint { font-size: 12px; color: var(--muted); }

/* 战斗界面 */
.battle { display: grid; gap: 16px; }
.arena { position: relative; border-radius: var(--radius); padding: 18px; min-height: 220px; display: flex; flex-direction: column; gap: 12px; border: 1px solid var(--border); overflow: hidden; }
.arena .scene-name { position: absolute; top: 12px; right: 16px; font-size: 12px; color: rgba(255,255,255,.7); }
.combatant { display: flex; align-items: center; gap: 14px; }
.combatant .face { font-size: 54px; line-height: 1; filter: drop-shadow(0 6px 10px rgba(0,0,0,.4)); transition: .2s; }
.combatant .bars { flex: 1; }
.hpbar { height: 14px; border-radius: 999px; background: #2a1414; overflow: hidden; border: 1px solid var(--border); }
.hpbar > i { display: block; height: 100%; background: linear-gradient(90deg,#ff6b6b,#ff9f43); transition: width .4s; }
.hpbar.hero > i { background: linear-gradient(90deg,#5b9cff,#7ee0a0); }
.hpline { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 4px; }

.fx-layer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.float { position: absolute; font-weight: 800; font-size: 20px; animation: floatUp 1s ease-out forwards; text-shadow: 0 2px 6px rgba(0,0,0,.6); }
.float.dmg { color: #ffd166; }
.float.heal { color: #7ee0a0; }
.float.crit { color: #ff6b6b; font-size: 26px; }
@keyframes floatUp { from { transform: translateY(10px); opacity: 0; } 20%{opacity:1;} to { transform: translateY(-40px); opacity: 0; } }
.shake { animation: shake .35s; }
@keyframes shake { 0%,100%{transform:translateX(0);} 25%{transform:translateX(-8px);} 75%{transform:translateX(8px);} }

.question { text-align: center; padding: 8px 0; }
.question .prompt { font-size: 13px; color: var(--muted); }
.question .word { font-size: 40px; font-weight: 800; margin: 6px 0; letter-spacing: 1px; }
.question .word.cn { font-size: 34px; }
.answer-row { display: flex; gap: 10px; margin-top: 10px; }
.answer-row .input { flex: 1; font-size: 18px; text-align: center; }
.log { max-height: 130px; overflow: auto; font-size: 13px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px; }
.log .line { padding: 3px 0; border-bottom: 1px dashed #232a34; }
.log .line .ok { color: var(--accent-2); }
.log .line .no { color: var(--danger); }

/* 武器等级图例 */
.tier-legend { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.tier-legend .t { font-size: 12px; padding: 6px 10px; border-radius: 10px; border: 1px solid var(--border); background: var(--panel-2); }

/* 表格 */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; }
tr:hover td { background: var(--panel-2); }

/* 弹窗 */
.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50; }
.modal { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; width: 100%; max-width: 560px; max-height: 86vh; overflow: auto; box-shadow: var(--shadow); }
.modal h3 { margin-top: 0; }

/* toast */
#toast { position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast-item { background: var(--panel); border: 1px solid var(--border); color: var(--text); padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow); font-size: 14px; animation: toastIn .2s; }
.toast-item.err { border-color: #5a2a30; color: var(--danger); }
@keyframes toastIn { from{opacity:0; transform: translateY(8px);} to{opacity:1;} }

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.hidden { display: none !important; }
.preview-img { max-width: 100%; border-radius: 10px; border: 1px solid var(--border); margin-top: 10px; }
.ocr-status { font-size: 13px; color: var(--muted); margin-top: 8px; }
.kbd { font-family: ui-monospace, monospace; background: var(--panel-2); border: 1px solid var(--border); padding: 1px 6px; border-radius: 6px; }

/* 战斗 Canvas 场景 */
.battle-canvas { width: 100%; height: 340px; display: block; }
/* 答错后显示正确答案 */
.correct-hint { margin-top: 10px; padding: 8px 12px; border-radius: 10px; background: rgba(126,224,160,.12); border: 1px solid rgba(126,224,160,.4); font-size: 15px; }
