:root {
  --art-panel: rgba(8, 17, 25, 0.94);
  --art-panel-2: rgba(15, 31, 40, 0.94);
  --art-border: rgba(171, 204, 188, 0.2);
  --art-blue: #9dc7e7;
}

.battle-art-hero .hero-inner {
  width: min(1320px, calc(100% - 32px));
}

.battle-art-main {
  width: min(1320px, calc(100% - 32px));
  margin: 28px auto 0;
}

.review-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 28px;
  align-items: center;
  padding: 24px 26px;
  border: 1px solid var(--art-border);
  border-radius: 9px;
  background:
    linear-gradient(125deg, rgba(26, 62, 55, 0.68), rgba(6, 15, 23, 0.95) 58%),
    var(--art-panel);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.28);
}

.section-kicker {
  margin: 0 0 6px;
  color: var(--gold);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.22em;
}

.review-summary h2,
.section-heading h2 {
  margin: 0;
  color: #f5f0de;
  font-size: clamp(22px, 3vw, 30px);
  letter-spacing: 0.06em;
}

.review-summary p:not(.section-kicker),
.section-heading > p {
  max-width: 760px;
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.75;
}

.review-summary code {
  color: #b7ddcf;
}

.review-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(90px, 1fr));
  gap: 8px;
  margin: 0;
}

.review-stats div {
  min-width: 100px;
  padding: 13px 15px;
  border: 1px solid rgba(228, 197, 114, 0.18);
  border-radius: 7px;
  text-align: center;
  background: rgba(2, 10, 16, 0.58);
}

.review-stats dt {
  color: var(--faint);
  font-size: 11px;
}

.review-stats dd {
  margin: 4px 0 0;
  color: var(--gold);
  font-size: 25px;
  font-weight: 800;
}

.art-notes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.art-notes article {
  display: flex;
  gap: 15px;
  padding: 18px 20px;
  border: 1px solid rgba(224, 138, 135, 0.24);
  border-radius: 8px;
  background: linear-gradient(115deg, rgba(83, 34, 38, 0.34), rgba(10, 19, 27, 0.94));
}

.note-index {
  flex: 0 0 auto;
  color: var(--danger);
  font: 800 12px/1.4 ui-monospace, monospace;
}

.art-notes h2 {
  margin: 0;
  color: #f4d7c8;
  font-size: 16px;
}

.art-notes p {
  margin: 6px 0 0;
  color: #b9c2c0;
  font-size: 13px;
  line-height: 1.7;
}

.gallery-controls {
  position: sticky;
  top: 8px;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin: 18px 0 0;
  padding: 10px 12px;
  border: 1px solid rgba(228, 197, 114, 0.24);
  border-radius: 8px;
  background: rgba(3, 10, 17, 0.92);
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(12px);
}

.gallery-controls label {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
}

.gallery-controls select,
.gallery-controls button,
.gallery-controls a,
.animation-filters button {
  min-height: 34px;
  border: 1px solid rgba(150, 189, 173, 0.25);
  border-radius: 5px;
  color: #d9e8e2;
  font: inherit;
  text-decoration: none;
  background: rgba(20, 47, 46, 0.72);
}

.gallery-controls select,
.gallery-controls button,
.gallery-controls a {
  padding: 7px 11px;
}

.gallery-controls button,
.gallery-controls a,
.animation-filters button {
  cursor: pointer;
}

.gallery-controls button:hover,
.gallery-controls a:hover,
.animation-filters button:hover,
.animation-filters button[aria-pressed="true"] {
  border-color: var(--gold-soft);
  color: #fff1b9;
  background: rgba(64, 83, 53, 0.78);
}

.gallery-section {
  margin-top: 42px;
  scroll-margin-top: 75px;
}

.section-heading {
  display: flex;
  gap: 22px;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-heading > p {
  max-width: 480px;
  text-align: right;
}

.terrain-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.animation-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.authored-groups {
  display: grid;
  gap: 38px;
}

.animation-group {
  min-width: 0;
}

.animation-group-heading {
  display: grid;
  grid-template-columns: minmax(190px, auto) minmax(260px, 1fr) auto;
  gap: 18px;
  align-items: end;
  margin-bottom: 14px;
  padding: 0 2px 12px;
  border-bottom: 1px solid rgba(228, 197, 114, 0.22);
}

.animation-group-heading h3 {
  margin: 2px 0 0;
  color: #f1ead4;
  font-size: clamp(18px, 2vw, 24px);
}

.animation-group-heading > p {
  max-width: 520px;
  margin: 0;
  color: var(--faint);
  font-size: 12px;
  line-height: 1.65;
}

.animation-group-count {
  min-width: 68px;
  padding: 7px 10px;
  border: 1px solid rgba(228, 197, 114, 0.28);
  border-radius: 999px;
  color: #d9e8e2;
  font-size: 11px;
  text-align: center;
  background: rgba(77, 61, 29, 0.28);
}

.animation-group-count strong {
  color: #f1d887;
  font-size: 14px;
}

.terrain-card,
.animation-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--art-border);
  border-radius: 8px;
  background: var(--art-panel);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.24);
}

.terrain-card canvas,
.animation-card canvas {
  display: block;
  width: 100%;
  height: auto;
  background: #050914;
}

.terrain-card canvas {
  aspect-ratio: 16 / 9;
}

.animation-card canvas {
  aspect-ratio: 16 / 10;
}

.card-meta {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  min-height: 62px;
  padding: 11px 13px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  background: linear-gradient(100deg, rgba(13, 31, 38, 0.98), rgba(6, 14, 22, 0.98));
}

.card-title {
  min-width: 0;
}

.card-title strong {
  display: block;
  overflow: hidden;
  color: #f1ead4;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-title span {
  display: block;
  margin-top: 4px;
  color: var(--faint);
  font-size: 11px;
}

.art-badge {
  flex: 0 0 auto;
  padding: 4px 7px;
  border: 1px solid rgba(157, 199, 231, 0.25);
  border-radius: 999px;
  color: var(--art-blue);
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
  background: rgba(41, 78, 104, 0.26);
}

.art-badge.illustrated,
.art-badge.authored {
  border-color: rgba(228, 197, 114, 0.34);
  color: #f1d887;
  background: rgba(104, 78, 31, 0.28);
}

.art-badge.pending {
  border-color: rgba(224, 138, 135, 0.3);
  color: #f0aaa6;
  background: rgba(104, 40, 44, 0.28);
}

.card-note {
  min-height: 42px;
  margin: 0;
  padding: 9px 13px 12px;
  color: #9faeaa;
  font-size: 11px;
  line-height: 1.55;
  background: rgba(5, 12, 19, 0.95);
}

.card-scale-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 9px;
  align-items: center;
  padding: 9px 13px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(8, 20, 27, 0.98);
}

.card-scale-control label {
  display: flex;
  gap: 8px;
  align-items: center;
  min-width: 0;
  color: #b9c8c3;
  font-size: 11px;
  font-weight: 700;
}

.card-scale-control input {
  width: 76px;
  min-height: 32px;
  padding: 5px 7px;
  border: 1px solid rgba(150, 189, 173, 0.32);
  border-radius: 5px;
  color: #f1ead4;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  background: rgba(3, 10, 17, 0.78);
}

.card-scale-control input:focus {
  border-color: var(--gold-soft);
  outline: 2px solid rgba(228, 197, 114, 0.18);
  outline-offset: 1px;
}

.card-scale-control input[aria-invalid="true"] {
  border-color: var(--danger);
}

.scale-original {
  color: var(--faint);
  font-size: 10px;
  white-space: nowrap;
}

.card-scale-control button {
  min-height: 32px;
  padding: 5px 9px;
  border: 1px solid rgba(150, 189, 173, 0.25);
  border-radius: 5px;
  color: #d9e8e2;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  background: rgba(20, 47, 46, 0.72);
}

.card-scale-control button:hover {
  border-color: var(--gold-soft);
  color: #fff1b9;
  background: rgba(64, 83, 53, 0.78);
}

.class-heading-row {
  align-items: center;
}

.animation-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  justify-content: flex-end;
}

.animation-filters button {
  padding: 7px 12px;
  font-size: 12px;
}

.animation-card[hidden] {
  display: none;
}

.render-error {
  display: grid;
  min-height: 180px;
  place-items: center;
  padding: 20px;
  color: var(--danger);
  text-align: center;
}

@media (max-width: 1050px) {
  .terrain-grid,
  .animation-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .review-summary {
    grid-template-columns: 1fr;
  }

  .review-stats {
    width: 100%;
  }
}

@media (max-width: 700px) {
  .battle-art-main {
    width: min(100% - 20px, 1320px);
    margin-top: 16px;
  }

  .review-summary,
  .art-notes article {
    padding: 16px;
  }

  .review-stats {
    grid-template-columns: repeat(3, 1fr);
  }

  .review-stats div {
    min-width: 0;
    padding: 10px 5px;
  }

  .art-notes,
  .terrain-grid,
  .animation-grid {
    grid-template-columns: 1fr;
  }

  .section-heading,
  .class-heading-row,
  .animation-group-heading {
    display: block;
  }

  .section-heading > p {
    text-align: left;
  }

  .animation-group-heading > p,
  .animation-group-count {
    display: block;
    width: fit-content;
    margin-top: 10px;
  }

  .animation-filters {
    justify-content: flex-start;
    margin-top: 13px;
  }

  .gallery-controls {
    position: static;
  }

  .card-scale-control {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .scale-original {
    display: none;
  }
}
