:root {
  --battle-panel: rgba(5, 24, 19, 0.92);
  --battle-panel-strong: rgba(3, 17, 14, 0.97);
  --battle-border: rgba(80, 185, 166, 0.25);
  --battle-orange: #efa66d;
  --battle-teal: #62c9bc;
  --battle-cream: #eee9df;
  --battle-muted: #aaa99f;
  --battle-red: #e77f77;
}

.page-battle-log-working .app {
  width: min(1480px, calc(100% - 2rem));
}

.battle-hero {
  max-width: 980px;
  margin: 3.2rem auto 3rem;
  text-align: center;
}

.battle-eyebrow {
  margin: 0 0 0.5rem;
  color: var(--battle-orange);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.battle-hero h1 {
  margin: 0;
  color: var(--battle-cream);
  font-family: "Arial Narrow", "Roboto Condensed", Arial, sans-serif;
  font-size: clamp(3rem, 6vw, 5.3rem);
  font-weight: 900;
  letter-spacing: -0.045em;
  line-height: 0.94;
  text-transform: uppercase;
}

.battle-hero > p:last-child {
  max-width: 760px;
  margin: 1.35rem auto 0;
  color: #cac9bf;
  font-size: 1.08rem;
  line-height: 1.55;
}

.battle-pro-gate {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  max-width: 1080px;
  margin: -0.75rem auto 1.5rem;
  border: 1px solid rgba(239, 166, 109, 0.4);
  border-radius: 0.9rem;
  padding: 1rem 1.15rem;
  background: rgba(40, 25, 13, 0.55);
  color: #c7c4bb;
}

.battle-pro-gate div { display: grid; gap: 0.25rem; }
.battle-pro-gate strong { color: var(--battle-cream); }
.battle-pro-gate span { line-height: 1.45; }
.battle-pro-gate a {
  flex: 0 0 auto;
  border: 1px solid rgba(239, 166, 109, 0.55);
  border-radius: 0.7rem;
  padding: 0.65rem 0.9rem;
  color: #ffe0c4;
  font-weight: 900;
  text-decoration: none;
  text-transform: uppercase;
}

.battle-pro-gate a:hover { background: rgba(239, 166, 109, 0.12); }

.battle-import-panel,
.battle-results {
  max-width: 1180px;
  margin: 0 auto;
}

.battle-import-panel {
  padding: clamp(1.2rem, 3vw, 2rem);
  border: 1px solid rgba(196, 128, 55, 0.5);
  border-radius: 1rem;
  background: linear-gradient(135deg, rgba(8, 33, 27, 0.95), rgba(4, 18, 15, 0.98));
  box-shadow: 0 1.2rem 3rem rgba(0, 0, 0, 0.2);
}

.battle-import-panel > header,
.battle-upload-heading,
.battle-results-header,
.battle-section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
}

.battle-import-panel h2,
.battle-results h2,
.battle-results h3 {
  margin: 0;
  color: var(--battle-cream);
  line-height: 1.06;
}

.battle-import-panel h2 { font-size: clamp(1.45rem, 3vw, 2.1rem); }
.battle-results h2 { font-size: clamp(2rem, 4vw, 3rem); }
.battle-results h3 { font-size: clamp(1.25rem, 2.6vw, 1.75rem); }

.battle-step,
.battle-private-chip,
.battle-count-chip {
  flex: 0 0 auto;
  border: 1px solid rgba(239, 166, 109, 0.35);
  border-radius: 999px;
  padding: 0.45rem 0.75rem;
  color: #efbd91;
  background: rgba(239, 166, 109, 0.08);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.battle-setup-grid {
  display: grid;
  gap: 1rem;
  margin-top: 1.25rem;
}

.battle-setup-grid { grid-template-columns: 0.8fr 1.2fr; }

.battle-setup-grid > label {
  align-content: start;
  grid-template-rows: auto 3.25rem auto;
}

.battle-import-panel label:not(.battle-drop-zone) {
  display: grid;
  gap: 0.45rem;
  color: #d8d5ca;
  font-size: 0.73rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.battle-import-panel label small {
  margin-left: 0.3rem;
  color: #8f968f;
  font-weight: 700;
}

.battle-import-panel .battle-field-helper {
  margin: 0;
  color: #98a39d;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: normal;
  line-height: 1.35;
  text-transform: none;
}

.battle-import-panel input[type="text"],
.battle-import-panel select {
  width: 100%;
  height: 3.25rem;
  min-height: 3.25rem;
  box-sizing: border-box;
  border: 1px solid rgba(99, 200, 188, 0.3);
  border-radius: 0.7rem;
  padding: 0 0.95rem;
  background: #020c0a;
  color: var(--battle-cream);
  font: inherit;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: normal;
  text-transform: none;
}

.battle-import-panel input:focus,
.battle-import-panel select:focus,
.battle-button:focus-visible,
.battle-drop-zone:focus-within {
  outline: 3px solid rgba(98, 201, 188, 0.4);
  outline-offset: 2px;
}

.battle-upload-heading {
  margin-top: 2rem;
  padding-top: 1.65rem;
  border-top: 1px solid var(--battle-border);
}

.battle-drop-zone {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.25rem 0.65rem;
  min-height: 52px;
  margin-top: 1.2rem;
  border: 1px dashed rgba(98, 201, 188, 0.55);
  border-radius: 0.9rem;
  padding: 0.55rem 1.5rem;
  background: rgba(2, 14, 11, 0.6);
  color: #b9c5bf;
  text-align: center;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.battle-drop-zone:hover,
.battle-drop-zone.is-dragging {
  border-color: var(--battle-teal);
  background: rgba(18, 67, 57, 0.32);
  transform: translateY(-1px);
}

.battle-drop-zone.is-pro-locked {
  border-color: rgba(239, 166, 109, 0.28);
  color: #777d78;
  cursor: not-allowed;
  opacity: 0.68;
}

.battle-drop-zone.is-pro-locked:hover {
  border-color: rgba(239, 166, 109, 0.28);
  background: rgba(2, 14, 11, 0.6);
  transform: none;
}

.battle-drop-zone strong {
  color: var(--battle-cream);
  font-size: 1.05rem;
}

.battle-drop-zone input { position: absolute; width: 1px; height: 1px; opacity: 0; }

.battle-status {
  margin-top: 1rem;
  border: 1px solid var(--battle-border);
  border-radius: 0.7rem;
  padding: 0.85rem 1rem;
  color: #aebcb5;
  background: rgba(7, 31, 25, 0.7);
  font-size: 0.88rem;
}

.battle-status.is-error {
  border-color: rgba(255, 170, 163, 0.42);
  color: #ffaaa3;
}

.battle-import-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.battle-button {
  min-height: 3rem;
  border-radius: 0.65rem;
  padding: 0 1.2rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
}

.battle-button:disabled { opacity: 0.45; cursor: not-allowed; }
.battle-button-primary { border: 1px solid rgba(100, 225, 207, 0.45); background: #197b6f; color: #fff; }
.battle-button-secondary { border: 1px solid rgba(239, 166, 109, 0.42); background: transparent; color: var(--battle-cream); }

.battle-results { margin-top: 2rem; }

.battle-results-header {
  padding: clamp(1.3rem, 3vw, 2rem);
  border: 1px solid rgba(196, 128, 55, 0.5);
  border-radius: 1rem 1rem 0 0;
  background: linear-gradient(135deg, rgba(11, 44, 36, 0.96), rgba(5, 23, 19, 0.98));
}

.battle-results-subtitle,
.battle-results-header p:last-child {
  margin: 0.7rem 0 0;
  color: #b9c1ba;
}

.battle-confidence {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 0.6rem 0.85rem;
  background: rgba(239, 166, 109, 0.16);
  color: #f4bd8d;
  font-size: 0.76rem;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.battle-confidence[data-level="strong"] { background: rgba(76, 185, 126, 0.15); color: #7ee0aa; }
.battle-confidence[data-level="recurring"] { background: rgba(98, 201, 188, 0.14); color: #85dcd1; }

.battle-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.8rem;
  padding: 1rem;
  border: solid rgba(196, 128, 55, 0.5);
  border-width: 0 1px 1px;
  background: rgba(3, 17, 14, 0.82);
}

.battle-summary-card {
  min-height: 115px;
  border: 1px solid var(--battle-border);
  border-radius: 0.8rem;
  padding: 1rem;
  background: rgba(9, 34, 28, 0.72);
}

.battle-summary-card span { display: block; color: #98aaa1; font-size: 0.73rem; font-weight: 900; letter-spacing: 0.08em; text-transform: uppercase; }
.battle-summary-card strong { display: block; margin-top: 0.35rem; color: var(--battle-cream); font-size: clamp(1.65rem, 4vw, 2.35rem); line-height: 1; }
.battle-summary-card small { display: block; margin-top: 0.45rem; color: #929d96; }

.battle-report-section {
  margin-top: 1rem;
  border: 1px solid var(--battle-border);
  border-radius: 1rem;
  padding: clamp(1.1rem, 3vw, 1.6rem);
  background: var(--battle-panel);
}

.battle-team-plan {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
  margin-top: 1rem;
}

.battle-team-member {
  border: 1px solid rgba(98, 201, 188, 0.2);
  border-radius: 0.75rem;
  padding: 1rem;
  background: var(--battle-panel-strong);
}

.battle-team-member span { color: var(--battle-orange); font-size: 0.7rem; font-weight: 900; letter-spacing: 0.08em; text-transform: uppercase; }
.battle-team-member strong { display: block; margin-top: 0.4rem; color: var(--battle-cream); font-size: 1.08rem; }

.battle-save-status {
  min-height: 1.25rem;
  margin: 0.85rem 0 0;
  color: #8dc8bb;
  font-size: 0.86rem;
}

.battle-team-mode {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: normal;
  line-height: 1.35;
  text-transform: none;
}

.battle-team-mode.is-saved {
  color: #84e4c2;
  font-weight: 800;
}

.battle-save-status.is-error { color: #ffaaa3; }

.battle-report-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

.battle-pattern-list,
.battle-practice-list { margin: 1rem 0 0; }
.battle-section-intro { margin: 0.35rem 0 0; color: #9fa9a0; font-size: 0.86rem; line-height: 1.45; max-width: 44rem; }

.battle-pattern-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  padding: 0.8rem 0;
  border-top: 1px solid rgba(98, 201, 188, 0.14);
}

.battle-pattern-row:first-child { border-top: 0; }
.battle-pattern-row strong { color: var(--battle-cream); }
.battle-pattern-row p { margin: 0.25rem 0 0; color: #aeb7b0; line-height: 1.45; }
.battle-pattern-count { color: #f0b17e; font-weight: 900; white-space: nowrap; }

.battle-practice-list { padding-left: 1.4rem; }
.battle-practice-list li { padding: 0.15rem 0 1rem 0.35rem; color: #c7c8bf; line-height: 1.52; }
.battle-practice-list li::marker { color: var(--battle-orange); font-weight: 900; }
.battle-practice-list strong { color: var(--battle-cream); }

.battle-table-wrap { overflow-x: auto; margin-top: 1rem; }
.battle-table { width: 100%; border-collapse: collapse; min-width: 760px; }
.battle-table th { padding: 0.7rem; color: var(--battle-orange); font-size: 0.7rem; letter-spacing: 0.08em; text-align: left; text-transform: uppercase; }
.battle-table td { border-top: 1px solid rgba(98, 201, 188, 0.14); padding: 0.85rem 0.7rem; color: #c3c5bd; vertical-align: top; }
.battle-table td strong { color: var(--battle-cream); }
.battle-outcome { display: inline-flex; min-width: 2rem; justify-content: center; border-radius: 999px; padding: 0.25rem 0.48rem; font-size: 0.72rem; font-weight: 950; }
.battle-outcome.win { background: rgba(72, 179, 120, 0.15); color: #79dba5; }
.battle-outcome.loss { background: rgba(231, 127, 119, 0.15); color: #ffa59e; }

.battle-boundary-note {
  margin: 1rem 0 3rem;
  border-left: 3px solid var(--battle-orange);
  border-radius: 0.35rem 0.8rem 0.8rem 0.35rem;
  padding: 1rem 1.2rem;
  background: rgba(40, 29, 17, 0.42);
  color: #bbb8ad;
}

.battle-boundary-note strong { color: var(--battle-cream); }
.battle-boundary-note p { margin: 0.45rem 0 0; line-height: 1.52; }

.battle-delete-panel {
  display: flex;
  justify-content: center;
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(255, 122, 122, 0.2);
}

.battle-delete-button {
  width: auto;
  min-width: 14rem;
  border: 1px solid rgba(255, 122, 122, 0.62);
  background: rgba(92, 20, 27, 0.22);
  color: #ffaaa3;
}

.battle-delete-button:hover:not(:disabled) {
  border-color: #ff8f87;
  background: rgba(122, 28, 37, 0.38);
}

.hidden { display: none !important; }

@media (max-width: 800px) {
  .battle-pro-gate { align-items: stretch; flex-direction: column; }
  .battle-pro-gate a { text-align: center; }
  .battle-hero { margin-top: 3.2rem; }
  .battle-setup-grid,
  .battle-summary,
  .battle-team-plan,
  .battle-report-grid { grid-template-columns: 1fr; }
  .battle-import-panel > header,
  .battle-upload-heading,
  .battle-results-header,
  .battle-section-heading { align-items: flex-start; }
  .battle-import-actions { flex-direction: column-reverse; }
  .battle-button { width: 100%; }
  .battle-delete-panel { justify-content: stretch; }
  .battle-delete-button { width: 100%; }
}

@media (max-width: 560px) {
  .page-battle-log-working .app { width: min(100% - 1rem, 1480px); }
  .battle-hero h1 { font-size: clamp(2.4rem, 13vw, 3.7rem); }
  .battle-results-header { flex-direction: column; }
}
