/* ===== ClassCraft：Reborn 样式 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #14161f;
  --panel: #1e2230;
  --panel2: #262c3d;
  --border: #343b52;
  --text: #e8eaf2;
  --dim: #9aa3bf;
  --gold: #f5c542;
  --blue: #4d9fff;
  --red: #ff5d6c;
  --green: #4ade80;
  --purple: #b07dff;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;
  overflow: hidden;
}

#app { height: 100%; display: flex; flex-direction: column; }

.screen { height: 100%; display: flex; flex-direction: column; padding: 16px; gap: 12px; }
.hidden { display: none !important; }

/* ===== 标题 ===== */
.game-title {
  text-align: center;
  font-size: 42px;
  letter-spacing: 4px;
  background: linear-gradient(135deg, var(--gold), #ff9d5c, var(--red));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-top: 20px;
  text-shadow: 0 0 30px rgba(245, 197, 66, .25);
}
.game-subtitle { text-align: center; color: var(--dim); margin-bottom: 8px; }

/* ===== 按钮 ===== */
.btn {
  padding: 10px 22px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel2);
  color: var(--text);
  font-size: 15px;
  cursor: pointer;
  transition: all .15s;
  font-family: inherit;
}
.btn:hover:not(:disabled) { border-color: var(--gold); transform: translateY(-1px); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn-primary { background: linear-gradient(135deg, #2c5fae, #1d4a8f); border-color: #3a74c9; }
.btn-primary:hover:not(:disabled) { filter: brightness(1.15); }
.btn-danger { background: linear-gradient(135deg, #a8323e, #7c2330); border-color: #c94a58; }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 6px; }
.btn-ult { background: linear-gradient(135deg, #6a3fa0, #4a2a75); border-color: #8a5cc4; }

/* ===== 角色选择 ===== */
.char-panels { display: flex; gap: 16px; flex: 1; min-height: 0; }
.char-panel { flex: 1; display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.panel-title { font-size: 18px; font-weight: bold; text-align: center; }
.char-cards { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 4px; }

.char-card {
  border: 2px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  padding: 10px 12px;
  cursor: pointer;
  transition: all .15s;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.char-card:hover { border-color: var(--dim); background: var(--panel2); }
.char-card.selected { border-color: var(--gold); background: linear-gradient(135deg, #2a2a1a, var(--panel)); box-shadow: 0 0 12px rgba(245,197,66,.25); }
.char-card.taken { opacity: .35; cursor: not-allowed; }
.char-card.readonly { cursor: default; opacity: .9; }
.char-card.readonly:hover { border-color: var(--border); background: var(--panel); }
.char-card .cc-emoji { font-size: 34px; line-height: 1; }
.char-card .cc-name { font-weight: bold; font-size: 17px; }
.char-card .cc-role { color: var(--gold); font-size: 12px; margin-bottom: 4px; }
.char-card .cc-stats { font-size: 12px; color: var(--dim); line-height: 1.7; }
.char-card .cc-skill { font-size: 12px; color: var(--text); line-height: 1.6; margin-top: 2px; }
.char-card .cc-skill b { color: var(--blue); }
.char-card .cc-ult b { color: var(--purple); }

.select-actions { text-align: center; padding-bottom: 12px; }

/* ===== 顶栏 ===== */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 4px;
}
.topbar-actions { display: flex; gap: 8px; align-items: center; }
.topbar-info { font-size: 17px; font-weight: bold; }

/* ===== 暂停菜单按钮 ===== */
.pause-btn {
  position: absolute; top: 8px; left: 8px; z-index: 20;
  width: 40px; height: 40px; font-size: 20px;
  border: 1px solid var(--border); border-radius: 8px;
  background: rgba(30, 34, 48, .9); color: var(--text);
  cursor: pointer; transition: all .15s;
}
.pause-btn:hover { border-color: var(--gold); background: rgba(42, 42, 26, .95); }

/* ===== 棋盘容器 ===== */
.board-wrap {
  flex: 1; min-height: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  position: relative;
}
#board, #board-battle { image-rendering: pixelated; display: block; }

/* ===== 主菜单 ===== */
.menu-buttons {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 20px;
}
.menu-btn { font-size: 22px; padding: 18px 60px; border-radius: 12px; letter-spacing: 2px; }

/* ===== 角色图鉴 ===== */
.codex-grid {
  flex: 1; overflow-y: auto;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
  gap: 12px; padding: 4px; align-content: start;
}
.codex-grid .char-card { cursor: default; }
.codex-grid .char-card:hover { border-color: var(--border); background: var(--panel); }

/* ===== 模式选择 ===== */
.mode-select { display: flex; gap: 10px; justify-content: center; padding: 4px 0; }
.mode-btn {
  padding: 10px 32px; font-size: 16px; font-weight: bold;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--panel2); color: var(--dim); cursor: pointer; font-family: inherit;
  transition: all .15s;
}
.mode-btn:hover { border-color: var(--gold); color: var(--text); }
.mode-btn.active {
  background: linear-gradient(135deg, #2c5fae, #1d4a8f);
  border-color: #3a74c9; color: #fff;
  box-shadow: 0 0 12px rgba(77,159,255,.3);
}

/* ===== 选角槽位 ===== */
.slots { display: flex; gap: 6px; padding: 4px 2px; min-height: 46px; }
.slot {
  flex: 1; max-width: 84px;
  border: 2px dashed var(--border); border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; cursor: pointer; position: relative;
  min-height: 44px; transition: all .15s;
}
.slot:hover { border-color: var(--dim); }
.slot.filled { border-style: solid; border-color: var(--gold); background: rgba(245,197,66,.08); }
.slot .slot-name {
  position: absolute; bottom: 2px; left: 0; right: 0;
  font-size: 9px; color: var(--dim); text-align: center;
  white-space: nowrap; overflow: hidden;
}

/* ===== 联机界面 ===== */
.net-lobby {
  flex: 1; display: flex; align-items: center; justify-content: center;
  gap: 30px; flex-wrap: wrap;
}
.net-card {
  width: 340px; padding: 26px 28px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
  display: flex; flex-direction: column; gap: 12px; align-items: center;
}
.net-card-title { font-size: 20px; font-weight: bold; }
.net-card-desc { font-size: 13px; color: var(--dim); text-align: center; line-height: 1.6; }
.net-divider { color: var(--dim); font-size: 14px; }
.net-join-row { display: flex; gap: 8px; }
.net-join-row input {
  width: 130px; padding: 10px 14px; font-size: 20px; letter-spacing: 4px; text-align: center;
  background: #10131c; color: var(--gold); border: 1px solid var(--border); border-radius: 8px;
  font-family: inherit; text-transform: uppercase;
}
.net-join-row input:focus { outline: none; border-color: var(--gold); }
.net-waiting {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px;
}
.net-code-display {
  font-size: 64px; font-weight: bold; letter-spacing: 16px; padding: 16px 30px 16px 42px;
  background: linear-gradient(135deg, #2a2a1a, var(--panel2));
  border: 2px dashed var(--gold); border-radius: 16px; color: var(--gold);
  text-shadow: 0 0 20px rgba(245,197,66,.4);
}
.net-waiting-text { color: var(--dim); font-size: 15px; }
.net-status {
  text-align: center; color: var(--dim); font-size: 14px; padding-bottom: 14px;
}

/* ===== 战斗布局 ===== */
.battle-layout { display: flex; gap: 12px; flex: 1; min-height: 0; }
.battle-layout .board-wrap { flex: 1; }

.side-panel {
  width: 380px;
  display: flex; flex-direction: column; gap: 8px;
  min-height: 0;
}

.banner {
  text-align: center; font-size: 16px; font-weight: bold;
  padding: 8px; border-radius: 8px; background: var(--panel2);
  border: 1px solid var(--border); min-height: 40px;
  display: flex; align-items: center; justify-content: center;
}
.banner.turn-p1 { border-color: var(--red); color: #ffa8b1; }
.banner.turn-p2 { border-color: var(--blue); color: #9cc5ff; }

.hud-hp {
  background: var(--panel); border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 10px; font-size: 13px;
}
.hud-hp .hud-name { font-weight: bold; font-size: 15px; }
.hud-hp .hud-bar { height: 10px; background: #10131c; border-radius: 5px; margin: 4px 0; overflow: hidden; display: flex; }
.hud-hp .hud-bar > div { height: 100%; transition: width .3s; }
.hud-hp .hud-hp-fill { background: linear-gradient(90deg, #3fae5f, #4ade80); }
.hud-hp .hud-shield-fill { background: linear-gradient(90deg, #3a7fd6, #7cc0ff); }
.hud-hp .hud-meta { color: var(--dim); font-size: 12px; }

.turn-info { font-size: 13px; color: var(--dim); text-align: center; }

/* ===== 行动面板 ===== */
.action-panel {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 8px; background: var(--panel2); border: 1px solid var(--border);
  border-radius: 10px; min-height: 46px; align-content: flex-start;
}
.action-btn {
  padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--panel); color: var(--text); cursor: pointer;
  font-size: 13px; font-family: inherit; transition: all .12s;
  min-width: 96px; text-align: center;
}
.action-btn:hover:not(:disabled) { border-color: var(--gold); }
.action-btn:disabled { opacity: .38; cursor: not-allowed; }
.action-btn.active { border-color: var(--gold); background: #2a2a1a; box-shadow: 0 0 8px rgba(245,197,66,.35); }
.action-btn .ab-name { display: block; font-weight: bold; }
.action-btn .ab-sub { display: block; font-size: 11px; color: var(--dim); }
.action-btn.ult { border-color: #6a3fa0; }
.action-btn.ult .ab-name { color: var(--purple); }

.skill-detail {
  min-height: 64px; max-height: 120px; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 10px; font-size: 12px; color: var(--dim); line-height: 1.6;
}

/* ===== 战斗日志 ===== */
.log {
  flex: 1; min-height: 0; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 10px; font-size: 12px; line-height: 1.7;
}
.log .lg { margin-bottom: 2px; }
.log .lg.dmg { color: #ff9c7a; }
.log .lg.heal { color: #7affa8; }
.log .lg.shield { color: #7cc0ff; }
.log .lg.info { color: var(--dim); }
.log .lg.dim { color: #6b7390; }
.log .lg.buff { color: var(--gold); }
.log .lg.gold { color: var(--gold); }
.log .lg.purple { color: var(--purple); }
.log .lg.red { color: var(--red); }

/* ===== 模态框 ===== */
#modal-root { position: fixed; inset: 0; pointer-events: none; z-index: 100; display: flex; align-items: center; justify-content: center; }
.modal-mask { position: absolute; inset: 0; background: rgba(0,0,0,.6); pointer-events: auto; }
.modal {
  position: relative; pointer-events: auto;
  background: var(--panel2); border: 1px solid var(--gold); border-radius: 12px;
  padding: 18px 22px; min-width: 320px; max-width: 560px; max-height: 80vh;
  overflow-y: auto; box-shadow: 0 8px 40px rgba(0,0,0,.6);
}
.modal h3 { margin-bottom: 10px; font-size: 18px; }
.modal .modal-body { font-size: 14px; line-height: 1.8; margin-bottom: 14px; color: var(--text); }
.modal .modal-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.opt-btn {
  padding: 10px 16px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--panel); color: var(--text); cursor: pointer; font-size: 14px; font-family: inherit;
  text-align: left; line-height: 1.5;
}
.opt-btn:hover { border-color: var(--gold); background: #2a2a1a; }
.opt-btn .ob-sub { font-size: 12px; color: var(--dim); display: block; }

/* ===== 飘字 ===== */
#float-root { position: fixed; inset: 0; pointer-events: none; z-index: 90; overflow: hidden; }
.float-text {
  position: absolute; font-weight: bold; font-size: 18px;
  text-shadow: 0 1px 3px rgba(0,0,0,.9), 0 0 8px rgba(0,0,0,.5);
  animation: floatUp 1.1s ease-out forwards;
  white-space: nowrap;
}
.float-text.dmg { color: #ff6b4a; }
.float-text.heal { color: #5dff8e; }
.float-text.shield { color: #7cc0ff; }
.float-text.miss { color: #b9c0d8; font-size: 15px; }
.float-text.buff { color: var(--gold); font-size: 15px; }
.float-text.ult { color: var(--purple); font-size: 20px; }
@keyframes floatUp {
  0% { transform: translateY(0); opacity: 1; }
  100% { transform: translateY(-46px); opacity: 0; }
}

/* ===== 结算 ===== */
#screen-end { align-items: center; justify-content: center; gap: 20px; }
#screen-end .btn { font-size: 18px; padding: 14px 40px; }

/* 滚动条 */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-thumb { background: #3a4158; border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }
