* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #1a1614;
  color: #d4cdc1;
  line-height: 1.6;
}

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

.screen { display: none; flex: 1; overflow: hidden; }
/* Children of a screen stack vertically (header/userbar on top, content below).
   Default flex-direction is row, which puts the user-bar on the LEFT of the
   setup container — leaving a huge blank on the left of the main content. */
.screen.active { display: flex; flex-direction: column; }

/* ===== 登录屏 ===== */
#auth-screen { overflow-y: auto; }
.auth-container {
  max-width: 480px; margin: 0 auto; padding: 60px 24px;
  width: 100%;
}
.auth-card { padding: 28px; }
.auth-form { display: none; flex-direction: column; gap: 14px; }
.auth-form.active { display: flex; }
.auth-form label { display: flex; flex-direction: column; gap: 4px;
  font-size: 0.85rem; color: #a89070; }
.auth-form button[type="submit"] {
  margin-top: 4px; padding: 12px;
  background: #8b5a2b; border-color: #d4a35a;
}
.auth-error { color: #ff8888; font-size: 0.85rem; min-height: 1.2em; }

.user-bar {
  display: flex; justify-content: flex-end; align-items: center;
  gap: 12px; padding: 10px 24px; max-width: 880px;
  margin: 0 auto; width: 100%;
  font-size: 0.85rem; color: #888;
}
.user-bar #current-user { color: #d4a35a; }
.user-bar #logout-btn {
  background: transparent; border: 1px solid #4a3a2a;
  padding: 4px 12px; font-size: 0.82rem;
}

/* ===== 启动屏 ===== */
#setup-screen { overflow-y: auto; }
.setup-container {
  max-width: 1280px; margin: 0 auto; padding: 32px 24px;
  width: 100%;
}
/* 2-column grid for scenario + investigator sections. Single column < 980px. */
.setup-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr);
  gap: 20px;
  align-items: start;
}
.setup-grid .setup-left {
  display: flex; flex-direction: column; gap: 20px;
}
@media (max-width: 980px) {
  .setup-grid { grid-template-columns: 1fr; }
}
h1 {
  font-size: 2.4rem; text-align: center; color: #e8d4a8;
  text-shadow: 0 0 24px rgba(232, 180, 100, 0.3);
  font-weight: 300; letter-spacing: 4px;
}
.subtitle { text-align: center; color: #888; margin-bottom: 32px; }
h2 { color: #d4a35a; font-size: 1.2rem; margin-bottom: 16px; font-weight: 500; }
h3 { color: #a89070; font-size: 1rem; margin: 16px 0 8px; font-weight: 500; }

.card {
  background: #221d19;
  border: 1px solid #3a2f24;
  border-radius: 8px;
  padding: 24px; margin-bottom: 20px;
}

.scenario-list { display: grid; gap: 12px; }
.scenario-item {
  background: #2a221c; border: 2px solid transparent;
  padding: 14px 18px; border-radius: 6px; cursor: pointer;
  transition: all 0.15s;
}
.scenario-item:hover { border-color: #5a4533; }
.scenario-item.selected { border-color: #c4934a; background: #332720; }
.scenario-item h4 { color: #e8d4a8; margin-bottom: 4px; font-size: 1.05rem; }
.scenario-item .meta { font-size: 0.85rem; color: #888; margin-bottom: 6px; }
.scenario-item .summary { font-size: 0.9rem; color: #b8aea0; }

.upload-section {
  margin-top: 16px; padding-top: 16px;
  border-top: 1px dashed #3a2f24;
}
.upload-section input { display: block; margin: 8px 0; }
input[type="text"], input[type="password"], input[type="email"], input[type="number"], select, textarea {
  background: #1a1410; border: 1px solid #4a3a2a; color: #d4cdc1;
  padding: 8px 12px; border-radius: 4px; font-size: 0.95rem;
  font-family: inherit; width: 100%;
}
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
  -webkit-text-fill-color: #d4cdc1;
  -webkit-box-shadow: 0 0 0 1000px #1a1410 inset;
  caret-color: #d4cdc1;
  transition: background-color 9999s ease-in-out 0s;
}
input[type="file"] {
  color: #aaa; font-size: 0.9rem;
}
textarea { resize: vertical; }

.char-form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.char-form label {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 0.85rem; color: #a89070;
}
.char-form button { grid-column: 1 / -1; }

button {
  background: #5a4030; color: #e8d4a8; border: 1px solid #c4934a;
  padding: 10px 18px; border-radius: 4px; cursor: pointer;
  font-family: inherit; font-size: 0.95rem;
  transition: all 0.15s;
}
button:hover:not(:disabled) { background: #6e5040; }
button:disabled { opacity: 0.4; cursor: not-allowed; }

.start-btn {
  display: block; width: 100%; padding: 14px;
  font-size: 1.1rem; margin-top: 8px;
  background: #8b5a2b; border-color: #d4a35a;
}

/* Tab 切换: 调查员库 / 新建 */
.char-tabs {
  display: flex; gap: 4px; margin-bottom: 14px;
  border-bottom: 1px solid #3a2f24;
}
.tab-btn {
  background: transparent; border: none; border-bottom: 2px solid transparent;
  color: #888; padding: 8px 16px; font-size: 0.95rem;
  border-radius: 0; cursor: pointer;
}
.tab-btn.active { color: #d4a35a; border-bottom-color: #c4934a; }
.tab-btn:hover:not(.active) { color: #b8aea0; }
.char-tab { display: none; }
.char-tab.active { display: block; }

/* 调查员库列表 (复用 saves-list 风格,加上"已退役"显示) */
.char-card { position: relative; }
.char-card.selected { border: 2px solid #c4934a; }
.char-card.retired .info .name::after {
  content: " [已退役]"; color: #c08080; font-size: 0.85rem;
}

/* 创建编辑器 */
.char-editor {
  margin-top: 20px; padding-top: 16px;
  border-top: 1px dashed #3a2f24;
}
.char-editor.hidden { display: none; }
.char-editor h3 {
  margin: 14px 0 8px; color: #d4a35a;
  font-size: 0.95rem; font-weight: 500;
}
.editor-attrs {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 8px;
}
.attr-cell {
  background: #2a221c; padding: 8px 10px; border-radius: 4px;
  display: flex; justify-content: space-between; align-items: center;
}
.attr-cell .label { color: #a89070; font-size: 0.8rem; }
.attr-cell .value {
  background: transparent; border: none; color: #e8d4a8;
  font-size: 1.15rem; font-weight: 500; width: 50px;
  text-align: right; padding: 0;
}
.attr-cell .reroll {
  background: transparent; border: 1px solid #4a3a2a;
  color: #888; padding: 2px 6px; font-size: 0.75rem;
  margin-left: 4px;
}
.attr-cell .reroll:hover { color: #d4a35a; border-color: #c4934a; }
.attr-cell.locked { opacity: 0.85; }
.attr-cell.locked .value {
  color: #c4a070; cursor: not-allowed;
}
.attr-lock-banner {
  grid-column: 1 / -1;
  background: #1a1410; border-left: 3px solid #d4a35a;
  padding: 6px 10px; border-radius: 4px;
  font-size: 0.82rem; color: #d4a35a;
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  margin-bottom: 4px;
}
.attr-lock-banner button {
  font-size: 0.78rem; padding: 3px 10px;
  background: transparent; border: 1px solid #4a3a2a; color: #a89070;
}
.attr-lock-banner button:hover { color: #d4a35a; border-color: #c4934a; }

.editor-derived {
  display: flex; flex-wrap: wrap; gap: 8px;
  background: #1a1410; padding: 10px; border-radius: 4px;
  font-size: 0.9rem;
}
.editor-derived .stat {
  background: #2a221c; padding: 4px 10px; border-radius: 3px;
}
.editor-derived .stat b { color: #d4a35a; font-weight: normal; }
.editor-derived .stat.hp b { color: #e87171; }
.editor-derived .stat.san b { color: #b08ad4; }

.ai-bg-btn {
  font-size: 0.78rem; padding: 4px 10px; margin-left: 8px;
  background: #2a3a4a; border: 1px solid #5a7a8a; color: #b8d4e8;
  border-radius: 4px; cursor: pointer; font-weight: normal;
}
.ai-bg-btn:hover { background: #3a4a5a; color: #d4e8f0; }
.ai-bg-btn:disabled { opacity: 0.6; cursor: wait; }
.ai-bg-status {
  background: #1a1410; padding: 8px 12px; border-radius: 4px;
  font-size: 0.82rem; color: #a89070; margin: 8px 0;
  border-left: 3px solid #7ba9c8;
}
.ai-bg-status.error { border-left-color: #e87171; color: #e87171; }
.ai-bg-status.success { border-left-color: #d4a35a; color: #d4cdc1; }
.ai-bg-status ul { margin: 6px 0 0 0; padding-left: 20px; }
.ai-bg-status li { margin: 2px 0; }
.ai-bg-status li b { color: #d4a35a; }
.ai-bg-narrative {
  background: #221d19; padding: 12px 14px; border-radius: 4px;
  font-size: 0.88rem; color: #d4cdc1; margin: 8px 0;
  border-left: 3px solid #d4a35a; line-height: 1.6;
  white-space: pre-wrap;
}
.bg-fields {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
.bg-fields label {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 0.82rem; color: #a89070;
}
.bg-fields label.full { grid-column: 1 / -1; }

.editor-skills {
  background: #1a1410; padding: 10px; border-radius: 4px;
  max-height: 280px; overflow-y: auto;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 6px;
}
.skill-cell {
  display: flex; justify-content: space-between; align-items: center;
  gap: 6px;
  padding: 4px 8px; background: #2a221c; border-radius: 3px;
  font-size: 0.85rem;
  border-left: 3px solid transparent;
}
.skill-cell.occupation { border-left-color: #d4a35a; background: #332720; }
.skill-cell.interest { border-left-color: #7ba9c8; background: #20262e; }
.skill-cell .name { color: #d4cdc1; flex: 1; min-width: 0; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.skill-cell.occupation .name { color: #e8d4a8; }
.skill-cell.interest .name { color: #b8d4e8; }
.skill-cell .badge {
  font-size: 0.6rem; padding: 1px 5px; border-radius: 8px;
  color: #1a1410; flex-shrink: 0;
}
.skill-cell.occupation .badge { background: #d4a35a; }
.skill-cell .badge.interest-badge { background: #7ba9c8; }
.skill-cell .badge.derived { background: #555; color: #ddd; }
.skill-cell .hint { color: #a89070; font-size: 0.72rem; flex-shrink: 0; }
/* Skill category mini-badge (e.g. 战斗 / 调查 / 学术 ...) */
.skill-cell .cat-badge {
  font-size: 0.6rem; padding: 1px 5px; border-radius: 8px;
  background: #2a2520; color: #a89070; flex-shrink: 0;
  border: 1px solid #3a2f24;
}
.skill-cell .cat-badge.cat-战斗   { color: #e87171; border-color: #5a3030; }
.skill-cell .cat-badge.cat-调查   { color: #d4a35a; border-color: #5a4030; }
.skill-cell .cat-badge.cat-社交   { color: #d4a8d4; border-color: #4a3a4a; }
.skill-cell .cat-badge.cat-体能   { color: #a8d4a8; border-color: #3a4a3a; }
.skill-cell .cat-badge.cat-学术   { color: #b8d4e8; border-color: #2f4050; }
.skill-cell .cat-badge.cat-医疗   { color: #f4a8a8; border-color: #4f3030; }
.skill-cell .cat-badge.cat-技术   { color: #c0c0d8; border-color: #383848; }
.skill-cell .cat-badge.cat-驾驶   { color: #c8a878; border-color: #4a3a28; }
.skill-cell .cat-badge.cat-艺术工艺 { color: #d8c068; border-color: #4a4028; }
.skill-cell .cat-badge.cat-科学   { color: #80c8c0; border-color: #2a4848; }
.skill-cell .cat-badge.cat-其他   { color: #888; border-color: #3a3a3a; }

.editor-toolbar select.cat-filter, .editor-toolbar #skill-category-filter {
  flex: 0 1 140px; min-width: 110px;
  background: #1a1410; border: 1px solid #4a3a2a; color: #d4cdc1;
  padding: 6px 10px; border-radius: 4px; font-size: 0.85rem;
}

/* Skill row layout: [name] [badge] [base]+[addon]=[total] */
.skill-cell .base {
  color: #888; font-size: 0.85rem; font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
.skill-cell .plus, .skill-cell .eq {
  color: #666; font-size: 0.78rem; flex-shrink: 0;
}
.skill-cell input.addon,
.skill-cell input.total-only,
.skill-cell input[type="number"] {
  background: #1a1410 !important; border: 1px solid #3a2f24 !important;
  outline: none; color: #e8d4a8;
  width: 40px; text-align: right; font-size: 0.9rem;
  padding: 1px 4px !important; font-weight: 500; border-radius: 3px;
  font-variant-numeric: tabular-nums; flex-shrink: 0;
}
.skill-cell input.addon:focus,
.skill-cell input.total-only:focus { border-color: #d4a35a !important; color: #fff5d0; }
.skill-cell input.addon[value="0"] { color: #6a5a4a; }
.skill-cell .total {
  color: #e8d4a8; font-weight: 600;
  font-variant-numeric: tabular-nums;
  min-width: 28px; text-align: right; flex-shrink: 0;
}
.skill-cell.occupation .total { color: #f0c878; }
.skill-cell.interest .total { color: #a8d4ec; }

.editor-toolbar {
  display: flex; gap: 8px; margin-bottom: 8px; align-items: center;
  flex-wrap: wrap;
}
.editor-toolbar input[type="search"], .editor-toolbar input.search {
  flex: 1; min-width: 140px;
  background: #1a1410; border: 1px solid #4a3a2a; color: #d4cdc1;
  padding: 6px 10px; border-radius: 4px; font-size: 0.85rem;
}
.editor-toolbar .pts {
  font-size: 0.8rem; color: #a89070;
  background: #1a1410; padding: 4px 10px; border-radius: 4px;
  border: 1px solid #3a2f24;
}
.editor-toolbar .pts b { color: #d4a35a; font-weight: 500; }

.occ-info {
  background: #1a1410; padding: 8px 12px; border-radius: 4px;
  font-size: 0.82rem; color: #a89070;
  margin-bottom: 10px; border-left: 3px solid #d4a35a;
}
.occ-info b { color: #d4a35a; font-weight: 500; }

.era-badge {
  display: inline-block; font-size: 0.7rem;
  background: #3a2f24; color: #d4a35a;
  padding: 1px 6px; border-radius: 8px; margin-left: 6px;
}
.era-badge.modern { background: #2a3a4a; color: #7ba9c8; }
.era-badge.classic { background: #3a2f24; color: #d4a35a; }
.era-badge.any { background: #2a2a2a; color: #aaa; }

select optgroup { color: #d4a35a; font-style: normal; font-weight: 500; }
select optgroup option { color: #d4cdc1; padding-left: 12px; }

.editor-inventory ul {
  list-style: none; padding: 0; margin: 0 0 8px;
  background: #1a1410; border-radius: 4px;
  max-height: 120px; overflow-y: auto;
}
.editor-inventory li {
  display: flex; justify-content: space-between; align-items: center;
  padding: 4px 10px; border-bottom: 1px solid #2a221c;
  font-size: 0.9rem; color: #b8aea0;
}
.editor-inventory li button {
  background: transparent; border: none; color: #c08080;
  padding: 0 6px; font-size: 1rem;
}
.editor-inventory .inv-input { display: flex; gap: 6px; }
.editor-inventory .inv-input input { flex: 1; }

.editor-actions {
  display: flex; gap: 10px; margin-top: 16px;
  padding-top: 12px; border-top: 1px dashed #3a2f24;
}
.editor-actions button { padding: 8px 16px; }

/* 结算面板 */
.settlement-panel {
  background: linear-gradient(180deg, #2a2018 0%, #1a1410 100%);
  border: 2px solid #c4934a; border-radius: 8px;
  padding: 18px 22px; margin: 16px 20px;
}
.settlement-panel h3 {
  color: #e8d4a8; margin-bottom: 10px;
  font-size: 1.2rem; font-weight: 500;
}
.settlement-panel .grow-list {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 6px; margin-bottom: 10px;
}
.settlement-panel .grow-item {
  background: #2a221c; padding: 6px 10px; border-radius: 3px;
  font-size: 0.88rem;
}
.settlement-panel .grow-item.improved { border-left: 3px solid #a0e87a; }
.settlement-panel .grow-item.no-improve { border-left: 3px solid #5a4a40; color: #888; }
.settlement-panel .summary-line { margin: 6px 0; }
.settlement-panel .actions { margin-top: 12px; display: flex; gap: 10px; }
.settlement-panel .actions button { padding: 8px 16px; }

/* 守秘人复盘 */
.recap-block {
  background: #1f1714; border: 1px solid #5a4533;
  border-radius: 6px; padding: 12px 16px; margin-bottom: 14px;
}
.recap-block.recap-error {
  background: #2a1818; border-color: #5a3030; color: #e87171;
}
.recap-streaming {
  font-size: 0.78rem; color: #888;
  font-weight: normal; margin-left: 8px;
  display: inline-flex; align-items: center; gap: 6px;
}
.recap-header {
  color: #d4a35a; font-size: 1rem; font-weight: 500;
  margin-bottom: 8px;
}
.recap-verdict {
  color: #d4cdc1; font-size: 0.92rem;
  background: rgba(196, 147, 74, 0.08);
  padding: 6px 10px; border-radius: 4px;
  border-left: 3px solid #c4934a;
  margin-bottom: 10px;
}
.recap-verdict b { color: #e8d4a8; font-weight: 500; }
.recap-section { margin-top: 10px; }
.recap-label {
  color: #a89070; font-size: 0.85rem;
  margin-bottom: 4px;
}
.recap-decisions { list-style: decimal inside; padding: 0; margin: 0; color: #d4cdc1; font-size: 0.9rem; }
.recap-decisions li { margin: 6px 0; padding-left: 4px; }
.recap-choice { color: #b8aea0; }
.recap-consequence { color: #d4a35a; font-size: 0.85rem; margin-left: 12px; }
.recap-highlights { list-style: '— ' outside; padding-left: 18px; margin: 0; color: #d4cdc1; font-size: 0.9rem; }
.recap-highlights li { margin: 4px 0; }

.char-preview {
  margin-top: 16px; padding: 16px;
  background: #1a1410; border-radius: 4px;
  font-size: 0.9rem;
}
.char-preview.hidden { display: none; }
.char-preview .row { display: flex; flex-wrap: wrap; gap: 12px; }
.char-preview .stat {
  background: #2a221c; padding: 4px 10px; border-radius: 3px;
  font-size: 0.85rem;
}
.char-preview .stat b { color: #d4a35a; }
.char-preview .skills {
  margin-top: 10px; padding-top: 10px;
  border-top: 1px dashed #3a2f24;
  font-size: 0.82rem; color: #a89070;
}

/* ===== 游戏屏 ===== */
.game-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 20px; background: #0f0d0b;
  border-bottom: 1px solid #3a2f24;
}
.game-header h2 { color: #e8d4a8; font-size: 1.1rem; }
.header-actions { display: flex; gap: 8px; }
.quit-btn {
  background: transparent; border: 1px solid #4a3a2a;
  padding: 6px 14px; font-size: 0.85rem;
}

/* 存档列表 */
.saves-list { display: grid; gap: 10px; }
.saves-list .empty { color: #888; font-size: 0.9rem; padding: 8px 0; }
.save-item {
  background: #2a221c; padding: 12px 16px; border-radius: 6px;
  display: flex; justify-content: space-between; align-items: center;
  gap: 10px;
}
.save-item .info { flex: 1; min-width: 0; }
.save-item .info .name { color: #e8d4a8; font-size: 1rem; margin-bottom: 4px; word-break: break-all; }
.save-item .info .meta { color: #888; font-size: 0.82rem; }
.save-item .info .meta b { color: #d4a35a; font-weight: normal; }
.save-item .actions { display: flex; gap: 6px; flex-shrink: 0; }
.save-item button { padding: 6px 12px; font-size: 0.85rem; }
.save-item .delete-btn {
  background: transparent; border-color: #5a2a2a; color: #c08080;
}
.save-item .delete-btn:hover { background: #3a1a1a; }

.game-body { flex: 1; display: flex; overflow: hidden; }
.sidebar {
  width: 260px; flex-shrink: 0;
  background: #1a1614; padding: 14px;
  overflow-y: auto; border-right: 1px solid #3a2f24;
}
.main-panel { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
/* When the scenario is settled, hide the action form + dice bar (no more play)
   and let the whole main panel scroll so the recap/buttons are reachable. */
.main-panel.complete { overflow-y: auto; }
.main-panel.complete > .log { flex: none; max-height: none; overflow-y: visible; }
.main-panel.complete > .action-form,
.main-panel.complete > .dice-bar { display: none; }
/* Anchor the content column to the LEFT of the main panel so there's no
   visual gap between the sidebar and the log/combat/pending content. On wide
   screens the right side fills with the action form + dice bar (full width)
   to ground the layout. */
.main-panel > .log,
.main-panel > #combat-area,
.main-panel > #pending-area,
.main-panel > #settlement-panel {
  max-width: 920px; width: 100%; margin-left: 0; margin-right: auto;
}

/* KP 建议 */
.kp-suggest-btn {
  display: block; width: 100%;
  background: linear-gradient(135deg, #3a2a4a 0%, #2a3a4a 100%);
  border: 1px solid #5a4a7a; color: #d4c8e8;
  padding: 8px 12px; border-radius: 4px;
  font-size: 0.88rem; margin-bottom: 10px;
  cursor: pointer;
}
.kp-suggest-btn:hover { background: linear-gradient(135deg, #4a3a5a 0%, #3a4a5a 100%); }
.kp-suggest-list {
  background: #1a1410; border-left: 3px solid #8a7aa8;
  padding: 8px; border-radius: 4px;
  margin-bottom: 12px;
  font-size: 0.82rem;
}
.kp-suggest-list.hidden { display: none; }
.kp-suggest-loading { color: #888; font-style: italic; padding: 4px; }
.kp-suggestion {
  padding: 6px 8px; border-radius: 3px; cursor: pointer;
  color: #c4b8d4; line-height: 1.4;
  margin: 2px 0;
}
.kp-suggestion:hover { background: #2a2030; color: #e8d8f0; }
.kp-suggestion .idx { color: #8a7aa8; margin-right: 4px; font-weight: 600; }

.char-panel { font-size: 0.85rem; }
.char-panel h3 {
  font-size: 1rem; color: #e8d4a8;
  margin-bottom: 10px; padding-bottom: 6px;
  border-bottom: 1px solid #3a2f24;
}
.char-panel .vitals {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px;
  margin-bottom: 12px;
}
.vital {
  background: #221d19; padding: 8px; border-radius: 4px;
}
.vital .label { font-size: 0.7rem; color: #888; }
.vital .value { font-size: 1.1rem; color: #e8d4a8; }
.vital.hp .value { color: #e87171; }
.vital.san .value { color: #b08ad4; }
.vital.mp .value { color: #71b8e8; }

.attrs, .skills-list {
  background: #221d19; padding: 8px; border-radius: 4px;
  margin-bottom: 10px;
  font-size: 0.78rem;
}
.attrs .item, .skills-list .item {
  display: flex; justify-content: space-between;
  padding: 2px 0;
}
.skills-list { max-height: 180px; overflow-y: auto; }
.skills-list .item.clickable { cursor: pointer; }
.skills-list .item.clickable:hover { background: #2a221c; }
.inventory { font-size: 0.82rem; }
.inventory li { padding: 2px 0; color: #b8aea0; }
.status-tags { display: flex; flex-wrap: wrap; gap: 4px; margin: 8px 0; }
.status-tag {
  background: #5a2a2a; color: #ffaaaa; padding: 2px 8px;
  border-radius: 10px; font-size: 0.75rem;
}

.log {
  flex: 1; overflow-y: auto; padding: 20px;
  scroll-behavior: smooth;
}
.log-entry { margin-bottom: 16px; }
.log-entry .role {
  font-size: 0.75rem; color: #888;
  text-transform: uppercase; letter-spacing: 1px;
  margin-bottom: 4px;
}
.log-entry.kp .role { color: #d4a35a; }
.log-entry.player .role { color: #71b8e8; }
.log-entry.system .role { color: #a0e87a; }
.log-entry .text {
  background: #221d19; padding: 12px 16px;
  border-radius: 6px;
  white-space: pre-wrap;
}
.log-entry.kp .text { border-left: 3px solid #c4934a; }
.log-entry.player .text { border-left: 3px solid #71b8e8; background: #1a2128; }
.log-entry.system .text {
  background: #1a2820; font-size: 0.88rem;
  border-left: 3px solid #4a8a4a;
}

/* COC 7 检定结果 — 颜色标记 */
.roll-crit {
  color: #8fdc9c; font-weight: 600;
  background: rgba(80, 180, 100, 0.12);
  padding: 1px 6px; border-radius: 3px;
}
.roll-fumble {
  color: #e87171; font-weight: 600;
  background: rgba(220, 90, 90, 0.12);
  padding: 1px 6px; border-radius: 3px;
}
.roll-extreme { color: #f4cf6a; font-weight: 600; }
.roll-hard { color: #c4934a; font-weight: 500; }

/* ===== 战斗面板 ===== */
.combat-area {
  margin: 12px 20px; padding: 14px 16px;
  background: linear-gradient(180deg, #2a1a18 0%, #1f1410 100%);
  border: 1px solid #8b3030; border-radius: 8px;
  box-shadow: 0 0 24px rgba(180, 60, 60, 0.15);
}
.combat-area .combat-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px; padding-bottom: 8px;
  border-bottom: 1px dashed #5a3030;
}
.combat-area .combat-header .round {
  color: #f0a070; font-weight: 500; font-size: 1.05rem;
}
.combat-area .combat-header .player-status {
  color: #b8aea0; font-size: 0.88rem;
}
.combat-area .combat-header .player-status b { color: #e8d4a8; }
.combat-area .enemy-list {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px; margin-bottom: 14px;
}
.combat-area .enemy {
  background: #1a1410; border: 1px solid #4a3a2a;
  padding: 10px 12px; border-radius: 6px; cursor: pointer;
  transition: all 0.15s;
}
.combat-area .enemy:hover { border-color: #c0604a; }
.combat-area .enemy.selected { border-color: #f4a060; background: #2a1812; }
.combat-area .enemy.dead {
  opacity: 0.35; cursor: not-allowed; text-decoration: line-through;
  filter: grayscale(0.7);
}
.combat-area .enemy-head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 4px;
}
.combat-area .enemy-head .name { color: #f0c098; font-weight: 500; }
.combat-area .enemy-head .hp { color: #e87171; font-variant-numeric: tabular-nums; font-size: 0.9rem; }
.combat-area .enemy-head .hp.dead { color: #555; }
.combat-area .hp-bar {
  background: #2a1812; height: 4px; border-radius: 2px;
  overflow: hidden; margin-bottom: 6px;
}
.combat-area .hp-bar .hp-fill {
  background: linear-gradient(90deg, #e87171 0%, #f4a060 100%);
  height: 100%; transition: width 0.3s;
}
.combat-area .enemy-stats {
  font-size: 0.78rem; color: #888;
  font-variant-numeric: tabular-nums;
}
.combat-area .enemy-notes {
  font-size: 0.78rem; color: #a89070;
  margin-top: 4px; font-style: italic;
}
.combat-area .combat-actions {
  padding-top: 12px; border-top: 1px dashed #5a3030;
}
.combat-area .combat-action-row {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
}
.combat-area .combat-action-row label {
  font-size: 0.85rem; color: #b8aea0;
  display: flex; align-items: center; gap: 6px;
}
.combat-area .combat-action-row select {
  width: auto; min-width: 160px;
  padding: 4px 8px; font-size: 0.85rem;
}
.combat-area .combat-action-row button {
  padding: 6px 12px; font-size: 0.88rem;
  background: #5a3030; border-color: #c06060; color: #f0c098;
}
.combat-area .combat-action-row button:hover:not(:disabled) {
  background: #6a3838;
}

.pending-area {
  padding: 0 20px;
}
.pending-card {
  background: #2a2018; border: 1px solid #c4934a;
  padding: 12px 16px; border-radius: 6px;
  margin-bottom: 10px;
}
.pending-card .header {
  color: #e8d4a8; font-weight: 500; margin-bottom: 4px;
}
.pending-card .reason {
  font-size: 0.85rem; color: #b8aea0; margin-bottom: 8px;
}
.pending-card .actions {
  display: flex; gap: 8px; flex-wrap: wrap;
}
.pending-card button {
  padding: 6px 14px; font-size: 0.88rem;
}

.action-form {
  display: flex; gap: 10px; padding: 12px 20px;
  border-top: 1px solid #3a2f24; background: #0f0d0b;
}
.action-form textarea { flex: 1; }
.action-form button { padding: 0 24px; }

.dice-bar {
  display: flex; gap: 6px; align-items: center;
  padding: 8px 20px; background: #0f0d0b;
  border-top: 1px solid #3a2f24;
  font-size: 0.85rem; color: #888;
  flex-wrap: wrap;
}
.dice-bar button {
  padding: 4px 10px; font-size: 0.82rem;
  background: #2a221c; border-color: #4a3a2a;
}
.dice-bar input { width: 120px; padding: 4px 8px; font-size: 0.85rem; }

.outcome-tag {
  display: inline-block; padding: 2px 8px;
  border-radius: 3px; font-size: 0.85rem; font-weight: 500;
  margin-left: 6px;
}
.outcome-tag.success { background: #2a5a2a; color: #aaffaa; }
.outcome-tag.failure { background: #5a2a2a; color: #ffaaaa; }
.outcome-tag.critical { background: #c4934a; color: #1a1614; }
.outcome-tag.fumble { background: #8a2020; color: #ffe8e8; }

.spinner {
  display: inline-block; width: 14px; height: 14px;
  border: 2px solid #4a3a2a; border-top-color: #c4934a;
  border-radius: 50%; animation: spin 0.8s linear infinite;
  vertical-align: middle; margin-left: 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 768px) {
  .game-body { flex-direction: column; }
  .sidebar { width: 100%; max-height: 220px; border-right: none; border-bottom: 1px solid #3a2f24; }
  .char-form { grid-template-columns: 1fr; }
}
