/* ── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #0d0d0f;
  --bg2: #141418;
  --bg3: #1c1c24;
  --border: #2a2a38;
  --accent: #e63946;
  --accent2: #ff6b35;
  --text: #e8e8f0;
  --muted: #6b6b80;
  --win: #2ecc71;
  --loss: #e74c3c;
  --gold: #f39c12;
  --radius: 10px;
}
html, body { height: 100%; font-family: 'Segoe UI', system-ui, sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }

/* ── Layout ───────────────────────────────────────────────────────────────── */
.app { display: grid; grid-template-columns: 1fr; grid-template-rows: auto 1fr; height: 100vh; overflow: hidden; }
.header { display: flex; flex-direction: column; gap: 8px; padding: 10px 20px; background: var(--bg2); border-bottom: 1px solid var(--border); min-width: 0; overflow: hidden; }
.header-top { display: flex; align-items: center; gap: 10px; min-width: 0; }
.header-top h1 { min-width: 0; }
.header h1 { font-size: 1.3rem; font-weight: 900; color: var(--accent); letter-spacing: 1px; flex: 1; }
.header h1 span { color: var(--text); }
.action-bar { display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; }
.version-badge { font-size: 0.65rem; font-weight: 600; color: var(--muted); letter-spacing: 0.5px; vertical-align: middle; }

.main { display: grid; grid-template-columns: 1fr 320px; overflow: hidden; }

.roster-search { padding: 6px 8px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
#roster-search { width: 100%; box-sizing: border-box; background: var(--bg); border: 1px solid var(--border); color: var(--text); border-radius: 4px; padding: 5px 8px; font-size: 0.8rem; outline: none; }
#roster-search:focus { border-color: var(--accent); }
#roster-search::placeholder { color: var(--muted); }
#roster-list { overflow-y: auto; flex: 1; padding: 8px; display: flex; flex-direction: column; gap: 4px; }
.roster-section-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); padding: 10px 4px 4px; border-top: 1px solid var(--border); margin-top: 6px; }

.content { display: flex; flex-direction: column; overflow: hidden; }
.nav-tabs { display: flex; border-bottom: 1px solid var(--border); background: var(--bg2); }
.nav-tab { padding: 10px 18px; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; transition: all 0.15s; font-size: 0.85rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.nav-tab:hover { color: var(--text); }
.nav-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-pane { display: none; overflow-y: auto; flex: 1; padding: 20px; }
.tab-pane.active { display: block; }
#tab-roster { padding: 0; }
#tab-roster.active { display: flex; flex-direction: column; }

.right-panel { background: var(--bg2); border-left: 1px solid var(--border); display: flex; flex-direction: column; overflow: hidden; }

/* ── Fighter Cards ────────────────────────────────────────────────────────── */
.fighter-card { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius); border: 1px solid transparent; cursor: pointer; transition: all 0.15s; position: relative; }
.fighter-card:hover { background: var(--bg3); border-color: var(--border); }
.fighter-card.selected { background: rgba(230,57,70,0.12); border-color: var(--accent); }
.fighter-card.injured { opacity: 0.65; }
.fighter-card.retired { opacity: 0.4; }
.fighter-card.new-fighter { animation: flash 1.5s ease; }
@keyframes flash { 0%,100%{background:transparent} 50%{background:rgba(230,57,70,0.25)} }
@keyframes timePulse { 0%{color:var(--text);transform:scale(1)} 40%{color:var(--gold);transform:scale(1.12)} 100%{color:var(--text);transform:scale(1)} }
#time-display.time-flash { animation: timePulse 0.5s ease; }
.card-avatar { flex-shrink: 0; }
.card-info { flex: 1; min-width: 0; }
.card-name { font-weight: 700; font-size: 0.88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-meta { font-size: 0.75rem; color: var(--muted); }
.card-record { font-size: 0.75rem; color: var(--gold); }
.card-tags { display: flex; gap: 4px; margin-top: 2px; }
.card-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.card-ovr { font-size: 1.1rem; font-weight: 900; color: var(--accent); }
.btn-card-info { background: none; border: none; cursor: pointer; font-size: 0.85rem; opacity: 0.5; padding: 0; line-height: 1; }
.btn-card-info:hover { opacity: 1; }
.btn-card-fav { background: none; border: none; cursor: pointer; font-size: 0.85rem; opacity: 0.4; padding: 0; line-height: 1; }
.btn-card-fav:hover, .btn-card-fav.active { opacity: 1; }
.tag-inj { font-size: 0.65rem; background: rgba(231,76,60,0.2); color: #e74c3c; padding: 1px 5px; border-radius: 4px; }

/* ── Detail Panel ─────────────────────────────────────────────────────────── */
#detail-panel { padding: 20px; overflow-y: auto; flex: 1; }
.select-hint { color: var(--muted); text-align: center; margin-top: 40px; }
.detail-header { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 20px; }
.detail-name-block h2 { font-size: 1.1rem; }
.detail-sub { color: var(--muted); font-size: 0.8rem; margin: 2px 0; }
.detail-record { font-size: 0.85rem; color: var(--gold); margin-bottom: 4px; display: flex; align-items: center; gap: 8px; }
.detail-title-info { font-size: 0.8rem; color: var(--gold); margin-bottom: 6px; opacity: 0.85; }
.badge-ready { background: rgba(46,204,113,0.2); color: var(--win); padding: 2px 8px; border-radius: 4px; font-size: 0.7rem; font-weight: 700; }
.badge-injured { background: rgba(231,76,60,0.2); color: var(--loss); padding: 2px 8px; border-radius: 4px; font-size: 0.7rem; font-weight: 700; }
.badge-retired { background: rgba(107,107,128,0.2); color: var(--muted); padding: 2px 8px; border-radius: 4px; font-size: 0.7rem; font-weight: 700; }
.xp-bar-wrap { display: flex; align-items: center; gap: 8px; }
.xp-bar { height: 6px; width: 120px; background: var(--border); border-radius: 3px; overflow: hidden; }
.xp-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2)); border-radius: 3px; transition: width 0.3s; }
.xp-label { font-size: 0.72rem; color: var(--muted); }
.detail-body { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.detail-body h3 { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin-bottom: 8px; }
.stat-row { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.stat-label { width: 68px; font-size: 0.72rem; color: var(--muted); text-align: right; }
.stat-track { flex: 1; height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.stat-fill { height: 100%; border-radius: 3px; transition: width 0.3s; }
.stat-val { width: 22px; text-align: right; font-size: 0.75rem; font-weight: 700; }
.inj-row { font-size: 0.78rem; color: var(--loss); margin-bottom: 3px; }
.inj-row.perm { color: #c084fc; }
.hist-row { font-size: 0.78rem; margin-bottom: 3px; padding: 3px 6px; border-radius: 4px; }
.hist-row.win { background: rgba(46,204,113,0.1); color: var(--win); }
.hist-row.loss { background: rgba(231,76,60,0.1); color: var(--loss); }
.hist-rank { opacity: 0.6; font-size: 0.72rem; }
.hist-died { color: #e74c3c; font-size: 0.72rem; font-weight: 700; }

/* ── Fight Picker (right panel) ───────────────────────────────────────────── */
.right-panel { padding: 12px; gap: 0; }
.picker-compact { display: flex; align-items: center; gap: 6px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.picker-slots-compact { display: flex; align-items: center; gap: 4px; flex: 1; min-width: 0; }
.pick-slot { flex: 1; background: var(--bg3); border: 1px dashed var(--border); border-radius: 6px; padding: 6px; text-align: center; min-height: 44px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-width: 0; }
.pick-empty { color: var(--muted); font-size: 0.7rem; }
.pick-name { font-size: 0.68rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 70px; }
.vs-badge-sm { font-size: 0.8rem; font-weight: 900; color: var(--accent); flex-shrink: 0; }
.vs-badge { font-size: 1.2rem; font-weight: 900; color: var(--accent); }
.btn-fight-compact { background: var(--accent); color: #000; border: none; border-radius: 6px; font-weight: 900; font-size: 0.75rem; padding: 6px 10px; cursor: pointer; white-space: nowrap; flex-shrink: 0; }
.btn-fight-compact.disabled { opacity: 0.35; cursor: not-allowed; }

/* ── Recent Events feed ───────────────────────────────────────────────────── */
.recent-events-panel { flex: 1; display: flex; flex-direction: column; overflow: hidden; margin-top: 10px; }
.recent-events-title { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.1em; color: var(--muted); text-transform: uppercase; margin-bottom: 6px; }
#recent-events { overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.re-row { font-size: 0.75rem; padding: 6px 8px; background: var(--bg3); border-radius: 6px; display: flex; flex-direction: column; gap: 1px; }
.re-row.re-title { border-left: 2px solid #facc15; }
.re-winner { font-weight: 700; color: var(--text); }
.re-def { color: var(--muted); font-size: 0.7rem; }
.re-method { color: var(--accent); font-size: 0.7rem; }
.re-flavor { color: var(--muted); font-style: italic; font-size: 0.72rem; }
.re-empty { color: var(--muted); font-size: 0.75rem; padding: 8px; }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn-primary, .btn-secondary, .btn-auto, .btn-sm, .nav-tab, .rank-row, .roster-card, .style-btn, .modal-close, .btn-card-fav, .btn-card-info { touch-action: manipulation; }
.btn-primary { background: var(--accent); color: white; border: none; border-radius: var(--radius); padding: 10px 20px; font-size: 0.9rem; font-weight: 700; cursor: pointer; transition: all 0.15s; text-transform: uppercase; letter-spacing: 0.5px; width: 100%; }
.btn-primary:hover:not(.disabled) { background: #c0392b; transform: translateY(-1px); }
.btn-primary.disabled { opacity: 0.4; cursor: not-allowed; }
.btn-primary.big { font-size: 1.1rem; padding: 14px; }
.btn-sm { background: var(--bg); border: 1px solid var(--border); color: var(--text); border-radius: 4px; padding: 2px 8px; cursor: pointer; font-size: 0.75rem; }
.btn-sm:hover { background: var(--border); }
.btn-secondary { background: var(--bg3); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius); padding: 7px 14px; font-size: 0.8rem; cursor: pointer; transition: all 0.15s; }
.btn-secondary:hover { background: var(--border); }
.btn-auto { background: rgba(230,57,70,0.15); color: var(--accent); border: 1px solid rgba(230,57,70,0.35); border-radius: var(--radius); padding: 7px 14px; font-size: 0.8rem; font-weight: 700; cursor: pointer; transition: all 0.15s; }
.btn-auto:hover { background: rgba(230,57,70,0.28); border-color: var(--accent); }
.btn-auto:disabled { opacity: 0.35; cursor: not-allowed; }
.rec-retired { font-size: 0.6rem; background: rgba(107,107,128,0.25); color: var(--muted); padding: 1px 4px; border-radius: 3px; vertical-align: middle; margin-left: 4px; }

/* ── Recruit form ─────────────────────────────────────────────────────────── */
.form-row { display: flex; flex-direction: column; gap: 5px; }
.form-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.8px; color: var(--muted); }
.form-input { background: var(--bg3); border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; color: var(--text); font-size: 0.88rem; outline: none; transition: border-color 0.15s; }
.form-input:focus { border-color: var(--accent); }
.form-input::placeholder { color: var(--muted); }
.style-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.style-btn { background: var(--bg3); border: 1px solid var(--border); border-radius: 6px; padding: 6px 10px; color: var(--muted); font-size: 0.78rem; cursor: pointer; transition: all 0.15s; }
.style-btn:hover { border-color: var(--accent); color: var(--text); }
.style-btn.active { background: rgba(230,57,70,0.15); border-color: var(--accent); color: var(--text); font-weight: 700; }

/* ── Time Controls ────────────────────────────────────────────────────────── */
.time-controls { display: flex; align-items: center; gap: 10px; }
#time-display { font-size: 0.85rem; color: var(--muted); }

/* ── Event Log ────────────────────────────────────────────────────────────── */
#event-log { display: flex; flex-direction: column; gap: 6px; }
.event-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--bg3); border-radius: 6px; font-size: 0.82rem; }
.ev-date { color: var(--muted); min-width: 70px; }
.ev-main { flex: 1; }
.ev-method { color: var(--accent); font-size: 0.75rem; }
.ev-fatality { color: #ff4444; font-size: 0.75rem; font-weight: 700; }
.ev-medical { color: #f0a500; font-size: 0.75rem; font-weight: 700; }
.ev-training .ev-main { color: #a3e635; font-size: 0.8rem; }
.ev-title { background: rgba(250,204,21,0.06); border-left: 2px solid #facc15; padding-left: 8px; }
.ev-title-badge { font-size: 0.7rem; font-weight: 700; color: #facc15; margin-right: 4px; }
.ev-fav-badge { font-size: 0.7rem; margin-right: 4px; }
.ev-new-champ { font-size: 0.75rem; font-weight: 700; color: #facc15; }
.tag-champ { background: rgba(250,204,21,0.15); color: #facc15; border: 1px solid rgba(250,204,21,0.3); font-size: 0.7rem; padding: 1px 6px; border-radius: 4px; font-weight: 700; }
.tag-champ-ret { opacity: 0.6; }
.tag-cup { background: rgba(241,196,15,0.1); color: #f39c12; border: 1px solid rgba(241,196,15,0.25); font-size: 0.7rem; padding: 1px 6px; border-radius: 4px; font-weight: 700; }
.title-fight-banner { text-align: center; font-size: 1rem; font-weight: 800; color: #facc15; letter-spacing: 0.15em; padding: 8px; background: rgba(250,204,21,0.08); border-bottom: 1px solid rgba(250,204,21,0.2); }
.rivalry-banner { text-align: center; font-size: 0.9rem; font-weight: 800; color: #e74c3c; letter-spacing: 0.12em; padding: 7px; background: rgba(231,76,60,0.08); border-bottom: 1px solid rgba(231,76,60,0.2); }
.rivalry-first { color: #e67e22; background: rgba(230,126,34,0.08); border-bottom-color: rgba(230,126,34,0.2); }
.tag-rivalry { background: rgba(231,76,60,0.12); color: #e74c3c; border: 1px solid rgba(231,76,60,0.25); font-size: 0.7rem; padding: 1px 6px; border-radius: 4px; font-weight: 700; }
.tag-streak-w { background: rgba(34,197,94,0.12); color: #22c55e; border: 1px solid rgba(34,197,94,0.25); font-size: 0.7rem; padding: 1px 6px; border-radius: 4px; font-weight: 700; }
.tag-streak-l { background: rgba(239,68,68,0.12); color: #ef4444; border: 1px solid rgba(239,68,68,0.25); font-size: 0.7rem; padding: 1px 6px; border-radius: 4px; font-weight: 700; }
.rival-row { font-size: 0.82rem; padding: 3px 0; color: var(--text); }
.rival-series { color: var(--muted); font-size: 0.78rem; margin-left: 4px; }
.help-modal-box { max-width: 600px; }
.help-body { overflow-y: auto; padding: 20px; flex: 1; display: flex; flex-direction: column; gap: 20px; }
.help-section h3 { font-size: 0.9rem; font-weight: 700; margin-bottom: 8px; color: var(--accent-light, #a5b4fc); }
.help-section p { font-size: 0.82rem; color: var(--text); line-height: 1.5; margin-bottom: 6px; }
.help-section ul { font-size: 0.82rem; padding-left: 16px; line-height: 1.7; color: var(--text); }
.help-footer { font-size: 0.75rem; color: var(--muted); text-align: center; padding-top: 12px; border-top: 1px solid var(--border); margin-top: 4px; }
.help-footer b { color: var(--text); }
.help-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.help-table td { padding: 3px 8px; }
.help-table td:first-child { font-weight: 600; color: var(--muted); width: 110px; }

#event-modal-body { display: flex; flex-direction: column; overflow: hidden; flex: 1; min-height: 0; }
.ef-list { padding: 12px 16px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; flex: 1; min-height: 0; }
.ef-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; background: var(--bg3); border-radius: 8px; }
.ef-names { display: flex; align-items: center; gap: 8px; flex: 1; }
.ef-name { font-weight: 600; font-size: 0.9rem; }
.ef-vs { font-size: 0.75rem; color: var(--muted); }
.cup-ef-row { align-items: center; }
.cup-ef-names { align-items: center; }
.cup-fighter-cell { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cup-inj { font-size: 0.7rem; color: #e74c3c; }
.cup-healthy { color: #27ae60; }
.btn-watch-toggle { font-size: 0.78rem; padding: 4px 12px; border-radius: 6px; border: 1px solid var(--accent); background: rgba(99,102,241,0.15); color: var(--accent); cursor: pointer; white-space: nowrap; }
.btn-watch-toggle[disabled] { opacity: 0.9; cursor: default; }
.btn-skip-toggle { border-color: var(--border); background: transparent; color: var(--muted); }
.ef-footer { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-top: 1px solid var(--border); }
.ef-hint { font-size: 0.75rem; }

/* ── Modals ───────────────────────────────────────────────────────────────── */
#fight-modal, #recruit-modal, #event-modal, #help-modal, #fighter-modal, #bulk-modal { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.8); z-index: 100; align-items: center; justify-content: center; }
#fight-modal.open, #recruit-modal.open, #event-modal.open, #help-modal.open, #fighter-modal.open, #bulk-modal.open { display: flex; }
.modal-box { background: var(--bg2); border: 1px solid var(--border); border-radius: 16px; width: min(700px,95vw); max-height: 90vh; overflow: hidden; display: flex; flex-direction: column; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.modal-header h2 { font-size: 1rem; }
#event-modal-subtitle { font-size: 0.72rem; color: #facc15; font-weight: 700; letter-spacing: 0.04em; margin-top: 2px; min-height: 0; }
.modal-close { background: none; border: none; color: var(--muted); font-size: 1.4rem; cursor: pointer; line-height: 1; }
.modal-close:hover { color: var(--text); }

/* ── Drama popup ─────────────────────────────────────────────────────────── */
#drama-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.85); z-index: 200; display: flex; align-items: center; justify-content: center; animation: fadeIn 0.2s ease; }
.drama-box { background: var(--bg2); border: 1px solid var(--border); border-radius: 20px; padding: 40px 48px; text-align: center; max-width: 440px; width: 90%; display: flex; flex-direction: column; align-items: center; gap: 12px; animation: popIn 0.3s cubic-bezier(0.34,1.56,0.64,1); }
.drama-icon { font-size: 4rem; line-height: 1; }
.drama-title { font-size: 1.6rem; font-weight: 900; text-transform: uppercase; letter-spacing: 0.05em; }
.drama-subtitle { font-size: 1rem; color: var(--muted); }
.drama-body { font-size: 0.85rem; color: var(--muted); line-height: 1.6; margin-top: 4px; }
.drama-btns { display: flex; gap: 10px; margin-top: 12px; justify-content: center; }
.drama-btns .btn-primary, .drama-btns .btn-secondary { min-width: 120px; }
.drama-btn { min-width: 120px; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { transform: scale(0.7); opacity: 0; } to { transform: scale(1); opacity: 1; } }
#modal-body { overflow-y: auto; padding: 20px; flex: 1; }

/* Pre-fight */
.prefight { display: flex; align-items: center; justify-content: space-around; padding: 20px 0; }
.prefight-fighter { text-align: center; max-width: 200px; }
.pf-champ-title { font-size: 0.72rem; font-weight: 900; letter-spacing: 0.1em; color: #facc15; text-transform: uppercase; margin-top: 8px; }
.pf-name { font-weight: 700; font-size: 0.95rem; margin-top: 6px; }
.pf-from { font-size: 0.75rem; color: var(--muted); margin-top: 2px; }
.pf-desc { font-size: 0.72rem; color: var(--accent); font-style: italic; margin-top: 1px; }
.pf-rank { font-size: 0.8rem; color: var(--muted); letter-spacing: 0.05em; margin-top: 4px; }
.pf-record { color: var(--gold); font-size: 0.85rem; }
.pf-defenses { font-size: 0.72rem; color: #facc15; margin-top: 2px; }
.vs-big { font-size: 2rem; font-weight: 900; color: var(--accent); }

/* Result */
.result-banner { display: flex; align-items: center; justify-content: space-between; padding: 16px; background: var(--bg3); border-radius: 10px; margin-bottom: 14px; }
.res-fighter { text-align: center; font-size: 0.82rem; flex: 1; }
.res-rank { font-size: 0.7rem; opacity: 0.5; margin-top: 2px; }
.res-fighter.winner { color: var(--win); }
.res-fighter.loser { color: var(--loss); opacity: 0.7; }
.res-center { text-align: center; }
.res-method { font-size: 1.3rem; font-weight: 900; color: var(--accent); }
.res-detail { color: var(--muted); font-size: 0.85rem; }
.levelup-banner { background: rgba(243,156,18,0.15); color: var(--gold); padding: 8px 12px; border-radius: 6px; margin-bottom: 8px; font-size: 0.85rem; }
.inj-summary { color: var(--loss); font-size: 0.8rem; margin-bottom: 10px; }

/* Fight Log */
/* ── Live fight stats ────────────────────────────────────────────────────── */
.fight-live-stats { padding: 10px 16px; display: flex; flex-direction: column; gap: 8px; }
.live-hp-row { display: flex; align-items: center; gap: 8px; }
.live-name-left, .live-name-right { font-size: 0.75rem; font-weight: 700; min-width: 50px; color: var(--muted); }
.live-name-right { text-align: right; }
.live-hp-bars { flex: 1; display: flex; align-items: center; gap: 6px; }
.live-hp-bar { flex: 1; height: 8px; background: var(--bg3); border-radius: 4px; overflow: hidden; }
.live-hp-bar.left { transform: scaleX(-1); }
.live-hp-fill { height: 100%; border-radius: 4px; transition: width 0.3s ease; background: #22c55e; }
.live-hp-fill.fill-left  { background: linear-gradient(90deg, #ef4444, #f97316); }
.live-hp-fill.fill-right { background: linear-gradient(90deg, #3b82f6, #8b5cf6); }
.live-hp-label { font-size: 0.6rem; color: var(--muted); min-width: 20px; text-align: center; }
.live-momentum-row { display: flex; align-items: center; gap: 8px; }
.live-momentum-track { flex: 1; height: 6px; background: var(--bg3); border-radius: 3px; overflow: hidden; position: relative; }
.live-momentum-fill { height: 100%; border-radius: 3px; transition: all 0.4s ease; background: var(--accent); position: absolute; top: 0; }
.live-momentum-fill.mom-f1 { background: linear-gradient(90deg, #ef4444, #f97316); }
.live-momentum-fill.mom-f2 { background: linear-gradient(90deg, #3b82f6, #8b5cf6); }
.live-momentum-center { position: absolute; left: 50%; top: -1px; width: 2px; height: 8px; background: var(--border); transform: translateX(-50%); }
.live-momentum-label { font-size: 0.65rem; color: var(--muted); min-width: 90px; text-align: right; }

.fight-log-wrap { margin-bottom: 14px; }
.fight-log-controls { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.log-status { font-size: 0.72rem; color: var(--muted); }
.fight-log { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; height: 320px; overflow-y: auto; overflow-x: hidden; }
.ll span { overflow-wrap: break-word; min-width: 0; }

/* Log lines */
.ll { display: flex; align-items: baseline; gap: 7px; padding: 3px 0; font-size: 0.83rem; animation: fadeSlide 0.18s ease; border-bottom: 1px solid transparent; }
@keyframes fadeSlide { from { opacity:0; transform:translateY(4px); } to { opacity:1; transform:none; } }
.ll-icon { flex-shrink: 0; width: 16px; text-align: center; font-size: 0.75rem; }

.ll-round  { justify-content: center; padding: 10px 0 4px; border-bottom: 1px solid var(--border) !important; margin-bottom: 2px; }
.ll-round-label { font-size: 0.7rem; font-weight: 900; letter-spacing: 3px; color: var(--accent); }

.ll-finish    { color: var(--gold); font-weight: 700; font-size: 0.9rem; padding: 8px 0 4px; border-top: 1px solid var(--border); }
.ll-ko        { color: #ff4757; font-weight: 700; }
.ll-knockdown { color: #ff6b35; font-weight: 600; }
.ll-critical  { color: #facc15; font-weight: 800; font-size: 0.92rem; padding: 5px 8px; margin: 3px 0; background: rgba(250,204,21,0.12); border-radius: 6px; border-left: 3px solid #facc15 !important; animation: critFlash 0.4s ease; }
.ll-fumble    { color: #fb923c; font-weight: 700; font-size: 0.88rem; padding: 4px 8px; margin: 2px 0; background: rgba(251,146,60,0.1); border-radius: 6px; border-left: 3px solid #fb923c !important; }
@keyframes critFlash { 0%{background:rgba(250,204,21,0.35)} 100%{background:rgba(250,204,21,0.12)} }
.ll-hit       { color: var(--text); }
.ll-td        { color: #74b9ff; }
.ll-sub       { color: #a29bfe; }
.ll-miss      { color: var(--muted); font-size: 0.78rem; }
.ll-score     { color: var(--muted); font-size: 0.78rem; font-style: italic; justify-content: center; padding: 4px 0; }
.ll-inj       { color: #fb923c; font-size: 0.82rem; }
.ll-normal    { color: var(--muted); }

/* ── Rankings ─────────────────────────────────────────────────────────────── */
.section-title { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 1.5px; color: var(--muted); margin-bottom: 12px; }
.vacant-belt-banner { background: rgba(250,204,21,0.08); border: 1px solid rgba(250,204,21,0.3); border-radius: 8px; color: #facc15; font-size: 0.8rem; font-weight: 700; text-align: center; padding: 10px; margin-bottom: 12px; letter-spacing: 0.04em; }
.rank-list { display: flex; flex-direction: column; margin: 0 -20px; }
.rank-row { display: flex; align-items: center; gap: 10px; padding: 9px 20px; border-bottom: 1px solid rgba(255,255,255,0.05); cursor: pointer; transition: background 0.1s; }
.rank-row:hover { background: var(--bg3); }
.rank-pos { width: 26px; text-align: right; font-size: 0.8rem; font-weight: 900; color: var(--muted); flex-shrink: 0; }
.rank-row:nth-child(1) .rank-pos { color: var(--gold); }
.rank-row:nth-child(2) .rank-pos { color: #aaa; }
.rank-row:nth-child(3) .rank-pos { color: #cd7f32; }
.rank-avatar { flex-shrink: 0; }
.rank-info { flex: 1; min-width: 0; }
.rank-line1 { display: flex; align-items: center; gap: 6px; min-width: 0; }
.rank-fname { font-size: 0.9rem; font-weight: 700; flex-shrink: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-line2 { display: flex; align-items: center; gap: 8px; margin-top: 3px; font-size: 0.72rem; flex-wrap: wrap; }
.rank-meta { color: var(--muted); }
.rank-record { font-weight: 700; color: var(--text); }
.rank-pct { color: var(--muted); }
.rank-ovr { font-weight: 900; color: var(--accent); }
.btn-book { font-size: 0.7rem; padding: 3px 8px; background: transparent; border: 1px solid var(--accent); color: var(--accent); border-radius: 4px; cursor: pointer; white-space: nowrap; flex-shrink: 0; margin-left: auto; }
.btn-book:hover { background: var(--accent); color: #000; }
.rank-inj { font-size: 0.65rem; background: rgba(231,76,60,0.15); color: #e74c3c; padding: 2px 6px; border-radius: 4px; flex-shrink: 0; }
.streak-badge { font-size: 0.7rem; font-weight: 800; padding: 2px 7px; border-radius: 4px; margin-right: 4px; }
.streak-w { background: rgba(46,204,113,0.15); color: var(--win); }
.streak-l { background: rgba(231,76,60,0.15); color: var(--loss); }

/* ── Records ──────────────────────────────────────────────────────────────── */
.records-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.record-card { background: var(--bg3); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; transition: border-color 0.15s; }
.record-card:hover { border-color: var(--accent); }
.rec-label { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin-bottom: 10px; }
.rec-holder { display: flex; align-items: center; gap: 10px; }
.rec-info {}
.rec-name { font-weight: 700; font-size: 0.85rem; }
.rec-value { color: var(--gold); font-size: 0.85rem; font-weight: 700; margin-top: 2px; }
.rec-date { font-size: 0.72rem; color: var(--muted); margin-top: 2px; }

/* ── Mobile ───────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  html, body { font-size: 15px; }
  .app { height: auto; min-height: 100vh; overflow-x: hidden; }
  .header { gap: 6px; padding: 8px 12px; }
  .header h1 { font-size: 0.95rem; }
  .time-controls { flex-wrap: nowrap; }
  .action-bar { position: fixed; bottom: 0; left: 0; right: 0; z-index: 50; background: var(--bg2); border-top: 2px solid var(--border); padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0px)); flex-wrap: wrap; overflow: visible; gap: 6px; width: auto; }
  .action-bar .btn-auto { flex: 1 1 calc(25% - 6px); height: 52px; font-size: 0.73rem; padding: 4px; white-space: nowrap; min-width: 0; flex-shrink: 1; }
  .action-bar .btn-secondary { flex: 1 1 calc(50% - 6px); height: 44px; font-size: 0.73rem; padding: 4px 8px; white-space: nowrap; min-width: 0; flex-shrink: 1; }
  .btn-secondary, .btn-auto { padding: 6px 10px; font-size: 0.75rem; white-space: nowrap; flex-shrink: 0; }
  .app { padding-bottom: calc(120px + env(safe-area-inset-bottom, 0px)); }
  .main { grid-template-columns: 1fr; height: auto; overflow: visible; min-width: 0; }
  .content { min-height: 50vh; overflow: visible; min-width: 0; }
  .tab-pane { overflow-x: hidden; overflow-y: visible; }
  .right-panel { border-left: none; border-top: 1px solid var(--border); min-width: 0; }
  .rank-avatar { display: none; }
  .rank-list { margin: 0 -12px; }
  .rank-row { padding: 8px 12px; gap: 8px; }
  .rank-line2 { gap: 6px; }
  .records-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .fighter-card { min-width: 0; }
  .modal-box { width: calc(100vw - 20px) !important; max-width: calc(100vw - 20px) !important; max-height: 90vh; }
  .help-body { padding: 14px; }
}
@media (max-width: 480px) {
  .detail-header { flex-direction: column; align-items: flex-start; gap: 10px; }
  .stats-col, .history-col { font-size: 0.85rem; }
  .prefight { flex-direction: column; gap: 12px; }
  .vs-big { display: none; }
}

/* ── Desktop ──────────────────────────────────────────────────────────────── */
@media (min-width: 769px) {
  .content {
    display: grid;
    grid-template-columns: 310px 1fr;
    grid-template-rows: auto 1fr;
  }
  .nav-tabs { grid-column: 2; grid-row: 1; }
  [data-tab="tab-roster"] { display: none; }
  #tab-roster {
    display: flex;
    flex-direction: column;
    grid-column: 1;
    grid-row: 1 / 3;
    border-right: 1px solid var(--border);
    overflow: hidden;
  }
  .tab-pane:not(#tab-roster) {
    grid-column: 2;
    grid-row: 2;
  }
}

/* ── Misc ──────────────────────────────────────────────────────────────────── */
.muted { color: var(--muted); font-size: 0.85rem; }
h3 { font-size: 0.85rem; }
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }
