:root {
  color-scheme: dark;
  --bg: #10130f;
  --panel: #1b2118;
  --panel-2: #222a20;
  --line: #3b4434;
  --text: #eef1e9;
  --muted: #aab49f;
  --green: #79c267;
  --gold: #d7a843;
  --rust: #c6654e;
  --blue: #65a8c5;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(rgba(12, 16, 12, 0.75), rgba(12, 16, 12, 0.92)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1600' height='900' viewBox='0 0 1600 900'%3E%3Crect width='1600' height='900' fill='%232b3427'/%3E%3Cpath d='M0 645c184-79 303-65 466-22 153 40 291 102 499 46 240-64 379-91 635 4v227H0z' fill='%23181f17'/%3E%3Cpath d='M0 534c172-103 358-98 558-50 220 53 425 24 618-49 151-57 273-63 424-15v276c-222-72-374-54-571-2-169 45-323 25-506-31-188-58-356-66-523 18z' fill='%233c4a32' opacity='.85'/%3E%3Ccircle cx='1240' cy='166' r='68' fill='%23d6a948' opacity='.85'/%3E%3Cpath d='M105 616c50-112 82-204 145-322l54 192 83-120 71 254zM1322 617l63-226 52 128 63-208 70 307z' fill='%23111610' opacity='.7'/%3E%3C/svg%3E");
  background-size: cover;
  background-attachment: fixed;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.studio-intro {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #080a07;
  animation: introExit 5s ease forwards;
}

.studio-intro img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.06);
  animation: introImage 5s ease forwards;
}

.studio-intro__shade {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at center, rgba(0, 0, 0, 0.08), rgba(0, 0, 0, 0.72)),
    linear-gradient(rgba(0, 0, 0, 0.12), rgba(0, 0, 0, 0.48));
}

.studio-intro__text {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 8px;
  color: #f7e7bc;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  text-shadow: 0 6px 24px rgba(0, 0, 0, 0.86);
  animation: introText 5s ease forwards;
}

.studio-intro__text span {
  font-size: clamp(2.5rem, 9vw, 8rem);
  font-weight: 950;
}

.studio-intro__text strong {
  font-size: clamp(0.9rem, 2.2vw, 2rem);
  font-weight: 850;
  letter-spacing: 0.45em;
}

@keyframes introImage {
  0% {
    transform: scale(1.12);
    filter: brightness(0.55) saturate(0.9);
  }
  22%,
  78% {
    transform: scale(1.04);
    filter: brightness(0.94) saturate(1.08);
  }
  100% {
    transform: scale(1.01);
    filter: brightness(0.35) saturate(0.9);
  }
}

@keyframes introText {
  0% {
    opacity: 0;
    transform: translateY(18px) scale(0.96);
  }
  20%,
  74% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(-10px) scale(1.02);
  }
}

@keyframes introExit {
  0%,
  88% {
    opacity: 1;
    visibility: visible;
  }
  100% {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }
}

button,
input,
select {
  font: inherit;
}

.app {
  width: min(1420px, calc(100% - 28px));
  margin: 0 auto;
  padding: 22px 0 40px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  min-height: 168px;
  padding: 12px 0 26px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  max-width: 860px;
  font-size: clamp(2.15rem, 5vw, 5.4rem);
  line-height: 0.95;
  font-weight: 900;
}

.topbar p {
  margin-top: 14px;
  max-width: 760px;
  color: var(--muted);
  font-size: 1.05rem;
}

.primary-btn,
.ghost-btn {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}

.primary-btn {
  background: var(--gold);
  color: #17130a;
  font-weight: 850;
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.35);
}

.ghost-btn {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--line);
}

.control-band,
.teams,
.results,
.animation-section,
.catalog-section,
.log-section {
  margin-top: 16px;
}

.control-band {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px;
  padding: 14px;
  background: rgba(16, 19, 15, 0.82);
  border: 1px solid var(--line);
  border-radius: 8px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
}

select,
input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #11150f;
  color: var(--text);
  padding: 8px 10px;
  outline: none;
}

.teams {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.team-panel,
.summary,
.animation-section,
.catalog-section,
.log-section {
  background: rgba(22, 28, 19, 0.9);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.team-heading,
.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.team-heading h2,
.section-heading h2,
.summary h2 {
  font-size: 1.1rem;
}

.team-heading p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.9rem;
}

.section-heading p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.35;
}

.lineup {
  display: grid;
  gap: 9px;
  min-height: 150px;
  padding: 14px;
}

.slot {
  display: grid;
  grid-template-columns: 1fr 96px 38px;
  gap: 8px;
  align-items: end;
  padding: 10px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
}

.icon-btn {
  width: 38px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #151a13;
  color: var(--text);
  cursor: pointer;
}

.results {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 16px;
}

.arena {
  min-height: 360px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #182017;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 360px;
}

.battle-animation {
  height: 420px;
  overflow: hidden;
  background:
    linear-gradient(rgba(15, 20, 14, 0.1), rgba(10, 12, 10, 0.72)),
    linear-gradient(90deg, rgba(121, 194, 103, 0.18), transparent 35%, transparent 65%, rgba(198, 101, 78, 0.18));
}

#battleAnimationCanvas {
  min-height: 420px;
}

.summary {
  padding: 18px;
}

.summary p {
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.45;
}

.bars {
  display: grid;
  gap: 14px;
  margin-top: 22px;
}

.bars span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 800;
}

.bar {
  height: 13px;
  overflow: hidden;
  border-radius: 999px;
  background: #0e110d;
  border: 1px solid var(--line);
}

.bar i {
  display: block;
  height: 100%;
  width: 0%;
  transition: width 380ms ease;
}

#barA {
  background: var(--green);
}

#barB {
  background: var(--rust);
}

.section-heading input {
  max-width: 280px;
}

.catalog {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
  padding: 14px;
}

.animal-card {
  min-height: 186px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
}

.animal-card h3 {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 8px;
  font-size: 1rem;
}

.animal-card p {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.35;
}

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px 8px;
  margin-top: 9px;
  color: #dce5d5;
  font-size: 0.78rem;
}

.trait-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 10px;
}

.trait-list span {
  border: 1px solid rgba(215, 168, 67, 0.35);
  border-radius: 999px;
  padding: 3px 7px;
  color: #f1ddb2;
  background: rgba(215, 168, 67, 0.08);
  font-size: 0.72rem;
  font-weight: 750;
}

.battle-log {
  display: grid;
  gap: 8px;
  max-height: 380px;
  overflow: auto;
  margin: 0;
  padding: 14px 14px 14px 34px;
  color: #dce5d5;
}

.battle-log li {
  padding-left: 4px;
  line-height: 1.45;
}

@media (max-width: 920px) {
  .topbar,
  .team-heading,
  .section-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .control-band,
  .teams,
  .results {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .app {
    width: min(100% - 18px, 1420px);
  }

  .control-band {
    padding: 10px;
  }

  .slot {
    grid-template-columns: 1fr 76px 36px;
    padding: 8px;
  }

  h1 {
    font-size: 2rem;
  }
}
