/* BattleScope — Brand: Gold #c9a84c, Dark Red #8b2500, Navy #1a1a2e */
@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600;700;900&family=Source+Sans+Pro:wght@300;400;600;700&display=swap');

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --gold: #c9a84c;
  --gold-light: #e0c872;
  --red: #8b2500;
  --red-light: #b33a00;
  --navy: #1a1a2e;
  --navy-light: #252542;
  --navy-lighter: #30305a;
  --text: #e8e6e3;
  --text-dim: #9a9a9a;
  --greek: #3b82f6;
  --union: #3b82f6;
  --persian: #ef4444;
  --confederate: #9ca3af;
}

html, body {
  height: 100%;
  background: var(--navy);
  color: var(--text);
  font-family: 'Source Sans Pro', sans-serif;
  overflow-x: hidden;
  overflow-y: auto;
}

/* Header */
#header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 24px;
  background: linear-gradient(180deg, #0f0f23, var(--navy));
  border-bottom: 1px solid var(--gold);
  height: 56px;
}

.header-left {
  flex: 0 0 auto;
}

.header-center {
  flex: 1 1 auto;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

#header-battle-name {
  font-family: 'Cinzel', serif;
  font-size: 16px;
  font-weight: 600;
  color: var(--gold-light);
  letter-spacing: 1px;
}

#header-battle-year {
  font-size: 13px;
  color: var(--text-dim);
}

.header-right {
  flex: 0 0 auto;
}

#btn-choose-battle {
  background: var(--navy-light);
  color: var(--gold);
  border: 1px solid var(--gold);
  padding: 7px 16px;
  font-family: 'Cinzel', serif;
  font-size: 13px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

#btn-choose-battle:hover {
  background: var(--navy-lighter);
  color: var(--gold-light);
}

#header h1 {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 22px;
  color: var(--gold);
  letter-spacing: 3px;
  text-transform: uppercase;
}

#header .subtitle {
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 1px;
}

/* ===== Battle Browser Overlay ===== */
.battle-browser-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 10, 20, 0.88);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.25s;
}

.battle-browser-overlay.hidden {
  display: none;
}

.battle-browser {
  background: var(--navy-light);
  border: 1px solid var(--gold);
  border-radius: 12px;
  width: 92vw;
  max-width: 1100px;
  height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
}

.battle-browser-header {
  display: flex;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #333;
  gap: 12px;
}

.battle-browser-header h2 {
  font-family: 'Cinzel', serif;
  font-size: 18px;
  color: var(--gold);
  flex: 0 0 auto;
}

.battle-browser-count {
  flex: 1;
  font-size: 13px;
  color: var(--text-dim);
  text-align: center;
}

.battle-browser-close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 28px;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
  transition: color 0.2s;
}

.battle-browser-close:hover {
  color: var(--gold);
}

.battle-browser-search {
  padding: 12px 20px;
  border-bottom: 1px solid #2a2a4a;
}

.battle-browser-search input {
  width: 100%;
  background: var(--navy);
  border: 1px solid #444;
  color: var(--text);
  padding: 10px 14px;
  font-size: 15px;
  border-radius: 6px;
  outline: none;
  font-family: 'Source Sans Pro', sans-serif;
}

.battle-browser-search input:focus {
  border-color: var(--gold);
}

.battle-browser-search input::placeholder {
  color: var(--text-dim);
}

.battle-browser-filters {
  padding: 10px 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  border-bottom: 1px solid #2a2a4a;
}

.era-filter {
  background: var(--navy);
  border: 1px solid #444;
  color: var(--text-dim);
  padding: 5px 12px;
  font-size: 12px;
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'Source Sans Pro', sans-serif;
}

.era-filter:hover {
  border-color: var(--gold);
  color: var(--text);
}

.era-filter.active {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--navy);
  font-weight: 600;
}

.battle-browser-grid {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
  align-content: start;
}

/* Battle Card */
.battle-card {
  background: var(--navy);
  border: 1px solid #333;
  border-radius: 8px;
  padding: 14px 16px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.battle-card:hover {
  border-color: var(--gold);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.battle-card.locked {
  opacity: 0.7;
}

.battle-card.locked:hover {
  border-color: var(--text-dim);
}

.battle-card-name {
  font-family: 'Cinzel', serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--gold-light);
  margin-bottom: 4px;
  padding-right: 28px;
}

.battle-card-year {
  font-size: 12px;
  color: var(--gold);
  font-weight: 600;
  margin-bottom: 2px;
}

.battle-card-location {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.battle-card-summary {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 8px;
}

.battle-card-sides {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-dim);
}

.battle-card-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.battle-card-vs {
  color: #666;
  font-weight: 600;
}

/* Card badges */
.battle-card-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-free {
  background: #16a34a;
  color: #fff;
}

.badge-locked {
  background: #444;
  color: var(--text-dim);
  font-size: 14px;
  padding: 2px 6px;
}

/* ===== Paywall Overlay ===== */
.paywall-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 10, 20, 0.92);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.paywall-overlay.hidden {
  display: none;
}

.paywall-box {
  background: var(--navy-light);
  border: 1px solid var(--gold);
  border-radius: 16px;
  padding: 48px 40px;
  text-align: center;
  max-width: 440px;
  width: 90vw;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
}

.paywall-lock {
  font-size: 48px;
  margin-bottom: 16px;
}

.paywall-box h2 {
  font-family: 'Cinzel', serif;
  font-size: 18px;
  color: var(--gold);
  margin-bottom: 12px;
}

.paywall-box p {
  font-size: 15px;
  color: var(--text-dim);
  margin-bottom: 24px;
}

.paywall-box p strong {
  color: var(--gold-light);
  font-size: 20px;
}

.paywall-btn {
  display: inline-block;
  background: var(--gold);
  color: var(--navy);
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 16px;
  padding: 12px 36px;
  border-radius: 8px;
  text-decoration: none;
  transition: all 0.2s;
  margin-bottom: 16px;
}

.paywall-btn:hover {
  background: var(--gold-light);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(201, 168, 76, 0.3);
}

.paywall-back {
  display: block;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 14px;
  cursor: pointer;
  margin: 0 auto;
  padding: 8px;
  transition: color 0.2s;
}

.paywall-back:hover {
  color: var(--gold);
}

/* ===== Auth Buttons in Header ===== */
.auth-btn {
  background: var(--navy-light);
  color: var(--gold);
  border: 1px solid var(--gold);
  padding: 7px 16px;
  font-family: 'Cinzel', serif;
  font-size: 13px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  margin-left: 8px;
}

.auth-btn:hover {
  background: var(--navy-lighter);
  color: var(--gold-light);
}

.auth-btn-logout {
  background: transparent;
  border-color: var(--text-dim);
  color: var(--text-dim);
  font-family: 'Source Sans Pro', sans-serif;
  font-size: 12px;
  padding: 5px 12px;
}

.auth-btn-logout:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.auth-user-area {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 8px;
}

.auth-user-email {
  font-size: 12px;
  color: var(--gold-light);
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hidden {
  display: none !important;
}

/* ===== Buy Now Banner ===== */
.buy-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 10px 24px;
  background: linear-gradient(90deg, #1a1a2e, #2a2240, #1a1a2e);
  border-bottom: 1px solid var(--gold);
  font-size: 14px;
  color: var(--text);
  position: relative;
}

.buy-banner-text strong {
  color: var(--gold-light);
  font-size: 16px;
}

.buy-banner-btn {
  display: inline-block;
  background: var(--gold);
  color: var(--navy);
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 13px;
  padding: 6px 20px;
  border-radius: 4px;
  text-decoration: none;
  transition: all 0.2s;
}

.buy-banner-btn:hover {
  background: var(--gold-light);
  transform: translateY(-1px);
}

.buy-banner-link {
  background: none;
  border: none;
  color: var(--gold);
  font-size: 13px;
  cursor: pointer;
  text-decoration: underline;
  font-family: 'Source Sans Pro', sans-serif;
}

.buy-banner-link:hover {
  color: var(--gold-light);
}

.buy-banner-close {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
}

.buy-banner-close:hover {
  color: var(--gold);
}

/* ===== Auth Modal ===== */
.auth-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 10, 20, 0.92);
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-modal-overlay.hidden {
  display: none;
}

.auth-modal {
  background: var(--navy-light);
  border: 1px solid var(--gold);
  border-radius: 12px;
  padding: 32px 36px;
  max-width: 400px;
  width: 90vw;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
  position: relative;
}

.auth-modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
}

.auth-modal-close:hover {
  color: var(--gold);
}

.auth-modal-title {
  font-family: 'Cinzel', serif;
  font-size: 16px;
  color: var(--gold);
  margin-bottom: 8px;
  text-align: center;
}

.auth-modal-subtitle {
  font-size: 13px;
  color: var(--text-dim);
  text-align: center;
  margin-bottom: 20px;
  line-height: 1.5;
}

.auth-tabs {
  display: flex;
  border-bottom: 1px solid #444;
  margin-bottom: 20px;
}

.auth-tab {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-dim);
  font-family: 'Cinzel', serif;
  font-size: 14px;
  padding: 10px 0;
  cursor: pointer;
  transition: all 0.2s;
  border-bottom: 2px solid transparent;
}

.auth-tab:hover {
  color: var(--text);
}

.auth-tab.active {
  color: var(--gold);
  border-bottom-color: var(--gold);
}

.auth-error {
  background: rgba(139, 37, 0, 0.3);
  border: 1px solid var(--red);
  color: #ff8a65;
  font-size: 13px;
  padding: 8px 12px;
  border-radius: 6px;
  margin-bottom: 16px;
  text-align: center;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-input {
  width: 100%;
  background: var(--navy);
  border: 1px solid #444;
  color: var(--text);
  padding: 10px 14px;
  font-size: 14px;
  border-radius: 6px;
  outline: none;
  font-family: 'Source Sans Pro', sans-serif;
}

.auth-input:focus {
  border-color: var(--gold);
}

.auth-input::placeholder {
  color: var(--text-dim);
}

.auth-submit {
  background: var(--gold);
  color: var(--navy);
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 14px;
  padding: 10px 0;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 4px;
}

.auth-submit:hover {
  background: var(--gold-light);
}

.auth-forgot {
  text-align: center;
}

.auth-forgot-link {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 12px;
  cursor: pointer;
  font-family: 'Source Sans Pro', sans-serif;
}

.auth-forgot-link:hover {
  color: var(--gold);
}

/* Paywall sign-in prompt */
.paywall-signin-prompt {
  margin-bottom: 12px;
}

.paywall-signin-prompt p {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 0;
}

.paywall-signin-link {
  background: none;
  border: none;
  color: var(--gold);
  font-size: 13px;
  cursor: pointer;
  text-decoration: underline;
  font-family: 'Source Sans Pro', sans-serif;
}

.paywall-signin-link:hover {
  color: var(--gold-light);
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--gold);
  color: var(--navy);
  font-family: 'Source Sans Pro', sans-serif;
  font-weight: 600;
  font-size: 14px;
  padding: 10px 24px;
  border-radius: 8px;
  z-index: 5000;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  animation: toast-in 0.3s ease-out;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(20px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* Main Layout */
#app {
  display: grid;
  grid-template-columns: 320px 1fr;
  grid-template-rows: 1fr auto;
  height: calc(100vh - 56px);
}

/* Sidebar */
#sidebar {
  background: var(--navy-light);
  border-right: 1px solid #333;
  overflow-y: auto;
  padding: 16px;
}

#sidebar h2 {
  font-family: 'Cinzel', serif;
  font-size: 16px;
  color: var(--gold);
  margin-bottom: 4px;
}

#sidebar .battle-meta {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 12px;
  line-height: 1.5;
}

#sidebar .battle-meta .year {
  color: var(--gold);
  font-weight: 600;
}

#sidebar .summary {
  font-size: 13px;
  line-height: 1.6;
  margin-bottom: 16px;
  color: var(--text);
}

/* Commander Cards */
.commander-card {
  background: var(--navy);
  border: 1px solid #444;
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 8px;
}

.commander-card .faction {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 2px;
}

.commander-card .name {
  font-family: 'Cinzel', serif;
  font-size: 14px;
  font-weight: 600;
}

.commander-card .strength {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 2px;
}

/* Phase List */
#phase-list {
  margin-top: 16px;
}

#phase-list h3 {
  font-family: 'Cinzel', serif;
  font-size: 13px;
  color: var(--gold);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.phase-item {
  background: var(--navy);
  border: 1px solid #333;
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.phase-item:hover { border-color: var(--gold); }
.phase-item.active { border-color: var(--gold); background: var(--navy-lighter); }
.phase-item.what-if { border-color: var(--red); border-style: dashed; }
.phase-item.what-if:hover { border-color: var(--red-light); }
.phase-item.what-if.active { border-color: var(--red-light); background: #2e1a1a; }

.phase-item .phase-name {
  font-size: 13px;
  font-weight: 600;
}

.phase-item.what-if .phase-name::before {
  content: "\26A1 ";
  color: var(--red-light);
}

.phase-item .phase-desc {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 3px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* What-If Section */
#whatif-section {
  margin-top: 16px;
}

#whatif-section h3 {
  font-family: 'Cinzel', serif;
  font-size: 13px;
  color: var(--red-light);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Key Takeaways */
#takeaways {
  margin-top: 16px;
}

#takeaways h3 {
  font-family: 'Cinzel', serif;
  font-size: 13px;
  color: var(--gold);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

#takeaways ul {
  list-style: none;
  padding: 0;
}

#takeaways li {
  font-size: 12px;
  line-height: 1.5;
  padding: 6px 0 6px 16px;
  border-left: 2px solid var(--gold);
  margin-bottom: 6px;
  color: var(--text-dim);
}

/* Map Canvas Area */
#map-container {
  position: relative;
  background: #0d1117;
  overflow: hidden;
}

#battle-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* Event Overlay */
#event-overlay {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(26, 26, 46, 0.92);
  border: 1px solid var(--gold);
  border-radius: 8px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  color: var(--gold-light);
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s;
  max-width: 500px;
  z-index: 10;
}

#event-overlay.visible { opacity: 1; }

/* Narrative Box */
#narrative-box {
  position: absolute;
  bottom: 80px;
  left: 16px;
  right: 16px;
  background: rgba(26, 26, 46, 0.88);
  border: 1px solid #444;
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
  max-height: 120px;
  overflow-y: auto;
  z-index: 5;
}

#narrative-box .phase-title {
  font-family: 'Cinzel', serif;
  font-size: 14px;
  color: var(--gold);
  margin-bottom: 6px;
}

/* Timeline Controls */
#timeline {
  grid-column: 1 / -1;
  background: #0f0f23;
  border-top: 1px solid #333;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  height: 60px;
}

#timeline .controls {
  display: flex;
  gap: 8px;
}

#timeline button {
  background: var(--navy-light);
  border: 1px solid var(--gold);
  color: var(--gold);
  width: 36px;
  height: 36px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

#timeline button:hover { background: var(--navy-lighter); color: var(--gold-light); }
#timeline button.active { background: var(--gold); color: var(--navy); }

#timeline .scrubber {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
}

#timeline input[type="range"] {
  flex: 1;
  -webkit-appearance: none;
  height: 4px;
  background: #333;
  border-radius: 2px;
  outline: none;
}

#timeline input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  background: var(--gold);
  border-radius: 50%;
  cursor: pointer;
}

#timeline .time-display {
  font-family: 'Source Sans Pro', sans-serif;
  font-size: 13px;
  color: var(--text-dim);
  min-width: 80px;
  text-align: right;
}

#timeline .speed-control {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-dim);
}

#timeline .speed-control select {
  background: var(--navy-light);
  color: var(--text);
  border: 1px solid #444;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
}

/* Legend */
#legend {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(26, 26, 46, 0.9);
  border: 1px solid #444;
  border-radius: 6px;
  padding: 10px 14px;
  z-index: 10;
}

#legend .legend-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  margin-bottom: 4px;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--navy); }
::-webkit-scrollbar-thumb { background: #444; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #555; }

/* Responsive — tablet and mobile */
@media (max-width: 768px) {
  /* Switch from grid to flex column layout */
  #app {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 56px);
  }
  #sidebar {
    width: 100%;
    max-height: 40vh;
    overflow-y: auto;
    order: 2;
    border-right: none;
    border-top: 1px solid #333;
  }
  #map-container {
    width: 100%;
    min-height: 50vh;
    flex: 1;
    order: 1;
  }
  /* Timeline controls - make touch-friendly */
  #timeline {
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px;
    height: auto;
    order: 3;
  }
  .controls button,
  #timeline button {
    min-width: 44px;
    min-height: 44px;
  }
  /* Header */
  #header {
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 12px;
    height: auto;
  }
  .header-center {
    order: 3;
    flex-basis: 100%;
  }
  #header-battle-name {
    font-size: 13px;
  }
  #btn-choose-battle {
    font-size: 12px;
    padding: 6px 12px;
  }
  /* Narrative box */
  #narrative-box {
    font-size: 14px;
    padding: 8px;
  }
  /* Speed control */
  .speed-control,
  #timeline .speed-control {
    font-size: 14px;
  }
  #scrubber,
  #timeline input[type="range"] {
    width: 100%;
  }
  /* Battle Browser responsive */
  .battle-browser {
    width: 100vw;
    height: 100vh;
    border-radius: 0;
    border: none;
  }
  .battle-browser-grid {
    grid-template-columns: 1fr;
  }
  .battle-browser-filters {
    padding: 8px 12px;
  }
  .era-filter {
    font-size: 11px;
    padding: 4px 10px;
  }
  /* Paywall responsive */
  .paywall-box {
    padding: 32px 24px;
  }
  .paywall-box h2 {
    font-size: 16px;
  }
  /* Auth responsive */
  .auth-btn {
    font-size: 11px;
    padding: 5px 10px;
    margin-left: 4px;
  }
  .auth-user-email {
    max-width: 100px;
    font-size: 11px;
  }
  .auth-modal {
    padding: 24px 20px;
    width: 95vw;
  }
  /* Buy banner responsive */
  .buy-banner {
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 40px 8px 12px;
    font-size: 12px;
  }
  .buy-banner-btn {
    font-size: 11px;
    padding: 5px 14px;
  }
}

/* Battle browser loading indicator */
.battle-browser-loading {
  text-align: center;
  padding: 16px;
  color: var(--gold);
  font-size: 14px;
  font-style: italic;
  letter-spacing: 0.5px;
}
.battle-browser-loading::before {
  content: '';
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid var(--gold);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
  margin-right: 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Era filter loading state */
.era-filter.loading {
  opacity: 0.6;
  pointer-events: none;
}
.era-filter.loading::after {
  content: '...';
}

@media (max-width: 480px) {
  #sidebar { max-height: 35vh; }
  .phase-item { padding: 8px; }
  .commander-card { padding: 8px; }
  #header h1 { font-size: 1.2rem; }
  #header .subtitle { font-size: 0.8rem; }
  .battle-browser-grid {
    padding: 12px;
    gap: 8px;
  }
}
