/* Стили страницы «Игра» (RPG внутри EDEM). Переменные (--bg, --accent, ...) — из style.css. */

.game-body { height: auto; min-height: 100vh; overflow-y: auto; }

.game-header {
  display: flex; align-items: center; gap: 16px; padding: 14px 24px;
  background: var(--bg2); border-bottom: 1px solid var(--bg3);
  position: sticky; top: 0; z-index: 10;
}
.game-back { color: var(--muted); text-decoration: none; font-size: 14px; }
.game-back:hover { color: var(--accent); }
.game-title { font-weight: 700; font-size: 18px; color: var(--accent); }
.game-me { margin-left: auto; color: var(--muted); font-size: 14px; }

.game-main { max-width: 960px; margin: 0 auto; padding: 28px 20px 60px; }
.game-view-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; gap: 12px; }
.game-view-header h1 { font-size: 22px; }

.char-empty { color: var(--muted); padding: 40px 0; text-align: center; }

/* ---------- Список персонажей ---------- */
.char-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.char-card {
  background: var(--bg2); border-radius: 12px; padding: 16px; cursor: pointer;
  display: flex; align-items: center; gap: 12px; border: 1px solid transparent;
}
.char-card:hover { border-color: var(--accent); }
.char-card-info { min-width: 0; }
.char-card-name { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.char-card-sub { color: var(--muted); font-size: 13px; }

/* Портрет-заглушка: эмодзи на цветном круге. Когда появятся настоящие картинки
   (game-assets/portraits/<id>.png), <img> подставится клиентом вместо эмодзи. */
.portrait-circle {
  width: 56px; height: 56px; border-radius: 50%; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center; font-size: 28px;
  background: var(--bg3); overflow: hidden;
}
.portrait-circle img { width: 100%; height: 100%; object-fit: cover; }
.portrait-circle.small { width: 40px; height: 40px; font-size: 20px; }
.portrait-circle.large { width: 96px; height: 96px; font-size: 46px; }

/* ---------- Форма создания ---------- */
.form-block { margin-bottom: 26px; }
.form-label { display: block; font-weight: 600; margin-bottom: 8px; }
.form-hint { color: var(--muted); font-size: 13px; margin-bottom: 10px; }
#char-name { width: 100%; max-width: 360px; }

.gender-grid { display: flex; gap: 10px; flex-wrap: wrap; }
.gender-pick {
  background: var(--bg2); border: 2px solid transparent; border-radius: 10px;
  padding: 10px 18px; cursor: pointer; font-size: 14px; color: var(--text);
}
.gender-pick:hover { border-color: var(--bg3); }
.gender-pick.selected { border-color: var(--accent); background: var(--bg3); }

.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.pick-card {
  background: var(--bg2); border: 2px solid transparent; border-radius: 10px; padding: 12px;
  cursor: pointer; text-align: left;
}
.pick-card:hover { border-color: var(--bg3); }
.pick-card.selected { border-color: var(--accent); background: var(--bg3); }
.pick-card-name { font-weight: 600; margin-bottom: 4px; }
.pick-card-bonus { color: var(--accent); font-size: 12px; margin-bottom: 6px; }
.pick-card-feature { color: var(--muted); font-size: 12px; line-height: 1.4; }

.stats-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.stats-toolbar-btns { display: flex; gap: 8px; }
.points-remaining { font-size: 14px; }
.points-remaining b { color: var(--accent); font-size: 16px; }
button.ghost.small { padding: 6px 12px; font-size: 13px; }
button.ghost.small:disabled { opacity: .4; cursor: default; }
button.ghost.small:disabled:hover { border-color: var(--bg3); color: var(--text); }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.stat-row { background: var(--bg2); border-radius: 10px; padding: 10px 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.stat-row label { font-size: 14px; }
.stat-final { flex-basis: 100%; text-align: right; color: var(--accent); font-size: 12px; }
.stat-controls { display: flex; align-items: center; gap: 8px; }
.stat-value { min-width: 22px; text-align: center; font-weight: 700; font-size: 15px; }
.stat-btn {
  width: 26px; height: 26px; border-radius: 6px; border: 1px solid var(--bg3);
  background: var(--bg); color: var(--text); cursor: pointer; font-size: 15px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.stat-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.stat-btn:disabled { opacity: .35; cursor: default; }

.portrait-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.portrait-pick { border: 2px solid transparent; border-radius: 50%; padding: 2px; background: none; cursor: pointer; }
.portrait-pick.selected { border-color: var(--accent); }

.create-submit { margin-top: 6px; }

/* ---------- Карточка персонажа ---------- */
.char-detail { background: var(--bg2); border-radius: 14px; padding: 26px; }
.char-detail-top { display: flex; align-items: center; gap: 18px; margin-bottom: 22px; }
.char-detail-name { font-size: 24px; font-weight: 700; }
.char-detail-sub { color: var(--muted); }
.char-hp { margin-top: 6px; font-size: 14px; }
.char-hp b { color: var(--green); }

.char-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin-bottom: 22px; }
.char-stat { background: var(--bg3); border-radius: 10px; padding: 10px 14px; text-align: center; }
.char-stat-name { color: var(--muted); font-size: 12px; }
.char-stat-value { font-size: 20px; font-weight: 700; }
.char-stat-mod { color: var(--accent); font-size: 13px; }

.char-feature { background: var(--bg3); border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; }
.char-feature b { color: var(--accent); }

.char-inventory-empty { color: var(--muted); font-size: 14px; }

.error { color: var(--error); font-size: 13px; min-height: 16px; margin: 10px 0; }
button.ghost.danger { border-color: var(--error); color: var(--error); }
button.ghost.danger:hover { background: color-mix(in srgb, var(--error) 15%, transparent); }

/* ---------- Тестовый экран бросков (Этап Г2) ---------- */
.game-test-link { color: var(--muted); text-decoration: none; font-size: 13px; }
.game-test-link:hover { color: var(--accent); }
.game-nav-link { color: var(--accent); text-decoration: none; font-size: 13px; font-weight: 600; }
.game-nav-link:hover { text-decoration: underline; }

.test-block { background: var(--bg2); border-radius: 12px; padding: 16px; }
.test-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.test-inline-label { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.test-inline-label input, .test-inline-label select { width: 70px; }
.die-buttons { display: flex; gap: 8px; flex-wrap: wrap; }

.roll-result {
  margin-top: 12px; min-height: 20px; font-size: 15px; font-weight: 600;
}
.roll-result.rolling { color: var(--muted); }
.roll-result.roll-success { color: var(--green); }
.roll-result.roll-fail { color: var(--error); }

/* ---------- Правила игры (глоссарий) ---------- */
.rules-section { margin-bottom: 34px; }
.rules-section h2 { font-size: 18px; margin-bottom: 10px; color: var(--accent); }
.rules-section p { line-height: 1.6; margin-bottom: 10px; color: var(--text); }
.rules-section p.muted { color: var(--muted); font-size: 13px; }
.world-map { max-width: 100%; border-radius: 10px; margin-top: 12px; display: block; }

.mod-table { border-collapse: collapse; margin: 10px 0; }
.mod-table th, .mod-table td { padding: 6px 14px; text-align: center; border-bottom: 1px solid var(--bg3); font-size: 13px; }
.mod-table th { color: var(--muted); font-weight: 600; }

.rules-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.rules-card { background: var(--bg2); border-radius: 10px; padding: 14px; }
.rules-card-name { font-weight: 700; margin-bottom: 4px; }
.rules-card-bonus { color: var(--accent); font-size: 12px; margin-bottom: 6px; }
.rules-card-feature { font-size: 13px; line-height: 1.5; }
.rules-card-feature b { color: var(--accent); }

/* ---------- Тестовый экран сюжета (Этап Г3) ---------- */
.story-node { background: var(--bg2); border-radius: 14px; padding: 24px; text-align: center; }
.story-illustration {
  font-size: 48px; margin-bottom: 14px; min-height: 160px;
  display: flex; align-items: center; justify-content: center;
  background-size: cover; background-position: center; border-radius: 10px;
}
.story-text { white-space: pre-wrap; line-height: 1.6; text-align: left; margin-bottom: 10px; }
#node-narration { text-align: left; margin-bottom: 16px; min-height: 1px; }
.story-actions { display: flex; flex-direction: column; gap: 10px; align-items: stretch; max-width: 420px; margin: 0 auto; }

/* ---------- Снаряжение и сумка (Этап Г4) ---------- */
.char-block-title { font-weight: 700; margin: 18px 0 8px; }
.char-equipment, .char-inventory { text-align: left; }
.equip-row, .inv-row {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 10px; border-radius: 8px; background: var(--bg2); margin-bottom: 6px;
}
.equip-slot { color: var(--muted); font-size: 12px; min-width: 62px; }
.equip-item { flex: 1; }
.equip-value { color: var(--accent); font-size: 13px; }
.inv-name { flex: 1; }
.inv-desc { color: var(--muted); font-size: 12px; margin-top: 2px; }
.inv-worn { color: var(--accent); font-size: 11px; }
.char-inventory-empty { color: var(--muted); font-size: 13px; }

/* Погибший персонаж: бледная карточка, но не удалённая — вещи и опыт при нём. */
.char-card-dead { opacity: 0.45; filter: grayscale(1); }
.char-dead-mark { color: #e0736b; font-size: 11px; font-weight: 400; }
.char-dead-note { color: #e0736b; font-size: 13px; margin-top: 6px; }

/* ---------- Соло-прохождение (Этап Г4): здоровье своё и противника ---------- */
.story-vitals {
  display: flex; flex-wrap: wrap; gap: 8px 18px; justify-content: center;
  font-size: 13px; margin-bottom: 14px;
}
.story-vitals .vital-me { color: var(--accent); }
.story-vitals .vital-enemy { color: #e0736b; }

@media (max-width: 640px) {
  .game-main { padding: 18px 12px 50px; }
  .story-vitals { flex-direction: column; gap: 4px; }
  .char-detail-top { flex-direction: column; text-align: center; }
}
