/* v2.50 guaranteed hand composition UI, unified card copy panels, and wandering-card repair */

/* Every sculpted frame now uses the same protected text surface.
   Frame/source/rarity artwork remains visible around the panel, but copy never sits
   directly on top of a light parchment or decorative legendary background. */
.battle-card {
  grid-template-rows: 164px minmax(132px, 1fr) !important;
  gap: 7px !important;
  min-height: 360px !important;
}

.battle-card > .battle-card-copy {
  position: relative !important;
  z-index: 4 !important;
  grid-row: 2 !important;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) !important;
  grid-template-rows: auto auto auto minmax(0, 1fr) !important;
  align-content: start !important;
  align-self: stretch !important;
  gap: 3px !important;
  width: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 8px 9px 9px 11px !important;
  overflow: hidden !important;
  border: 1px solid rgba(229, 210, 174, .24) !important;
  border-radius: 9px !important;
  background: linear-gradient(180deg, rgba(21, 18, 14, .95), rgba(8, 7, 6, .98)) !important;
  box-shadow:
    inset 3px 0 0 var(--frame-color, #8a8983),
    inset 0 1px 0 rgba(255, 255, 255, .055),
    0 4px 10px rgba(0, 0, 0, .46) !important;
  box-sizing: border-box !important;
  color: #f2eadb !important;
  text-align: left !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .92) !important;
}

.battle-card-copy > .battle-card-stars,
.battle-card-copy > small,
.battle-card-copy > b,
.battle-card-copy > p {
  position: relative !important;
  z-index: 1 !important;
  width: 100% !important;
  min-width: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  box-sizing: border-box !important;
  color: inherit !important;
  text-align: left !important;
  text-shadow: inherit !important;
}

.battle-card-copy > .battle-card-stars {
  grid-row: 1 !important;
  color: #e2c57d !important;
  font-size: 11px !important;
  line-height: 1.2 !important;
  letter-spacing: .04em !important;
}

.battle-card-copy > small {
  grid-row: 2 !important;
  color: #bfb39e !important;
  font-size: 9px !important;
  line-height: 1.3 !important;
  white-space: normal !important;
  word-break: keep-all !important;
}

.battle-card-copy > b {
  grid-row: 3 !important;
  color: #fff0c9 !important;
  font-size: 17px !important;
  line-height: 1.25 !important;
  white-space: normal !important;
  word-break: keep-all !important;
  overflow-wrap: anywhere !important;
}

.battle-card-copy > p {
  grid-row: 4 !important;
  min-height: calc(1.42em * 3) !important;
  display: -webkit-box !important;
  overflow: hidden !important;
  color: #ddd4c4 !important;
  font-size: 10.5px !important;
  line-height: 1.42 !important;
  word-break: keep-all !important;
  overflow-wrap: anywhere !important;
  -webkit-box-orient: vertical !important;
  -webkit-line-clamp: 3 !important;
}

/* Unique and legendary frames previously switched to dark copy over parchment.
   The shared protected panel makes a single light-copy rule reliable everywhere. */
.source-unique .battle-card-copy,
.rarity-5 .battle-card-copy,
.source-unique .battle-card-copy > small,
.source-unique .battle-card-copy > b,
.source-unique .battle-card-copy > p {
  color: #f2eadb !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .92) !important;
}

/* Revealed cards and the compact card inside each fighter receive the same surface. */
.revealed-card .revealed-card-copy,
.battle-screen .fighter-card-visual .revealed-card-copy {
  min-width: 0 !important;
  padding: 7px 8px 8px 10px !important;
  overflow: hidden !important;
  border: 1px solid rgba(229, 210, 174, .22) !important;
  border-radius: 8px !important;
  background: linear-gradient(180deg, rgba(21, 18, 14, .94), rgba(8, 7, 6, .98)) !important;
  box-shadow:
    inset 3px 0 0 var(--frame-color, #8a8983),
    inset 0 1px 0 rgba(255, 255, 255, .045) !important;
  box-sizing: border-box !important;
  color: #f2eadb !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .9) !important;
}

.revealed-card .revealed-card-copy small,
.revealed-card .revealed-card-copy b,
.revealed-card .revealed-card-copy p,
.revealed-card.source-unique .revealed-card-copy small,
.revealed-card.source-unique .revealed-card-copy b,
.revealed-card.source-unique .revealed-card-copy p {
  color: inherit !important;
  text-shadow: inherit !important;
}

.revealed-card .battle-card-help {
  top: 14px !important;
  right: 14px !important;
  bottom: auto !important;
}

/* Enemy-city recruitment guidance used to occupy an auto-sized third column.
   Its long sentence squeezed the officer name and stats into one-character lines. */
.compact-general-card.wandering {
  grid-template-columns: 52px minmax(0, 1fr) auto !important;
  align-items: center !important;
}

.compact-general-card.wandering > .portrait-wrap {
  grid-column: 1 !important;
  grid-row: 1 !important;
}

.compact-general-card.wandering .compact-general-copy {
  grid-column: 2 !important;
  width: 100% !important;
  min-width: 0 !important;
  overflow: hidden !important;
}

.compact-general-card.wandering .compact-general-copy > b,
.compact-general-card.wandering .compact-general-copy > span {
  white-space: nowrap !important;
  word-break: keep-all !important;
}

.compact-general-card.wandering .compact-general-copy > span {
  font-variant-numeric: tabular-nums;
}

.wandering-recruit-hint {
  grid-column: 1 / -1 !important;
  display: block !important;
  width: 100% !important;
  margin: 0 !important;
  padding: 7px 9px !important;
  border: 1px solid rgba(185, 150, 87, .25) !important;
  border-radius: 7px !important;
  background: rgba(71, 52, 27, .24) !important;
  color: #d9ccb3 !important;
  line-height: 1.45 !important;
  word-break: keep-all !important;
  overflow-wrap: anywhere !important;
  box-sizing: border-box !important;
}

@media (max-width: 760px) {
  .battle-card {
    min-height: 338px !important;
    grid-template-rows: 142px minmax(142px, 1fr) !important;
  }

  .battle-card > .battle-card-copy {
    padding: 7px 8px 8px 10px !important;
  }

  .battle-card-copy > b {
    font-size: 15px !important;
  }

  .battle-card-copy > p {
    font-size: 10px !important;
    line-height: 1.4 !important;
    -webkit-line-clamp: 4 !important;
  }
}

@media (max-width: 520px) {
  .compact-general-card.wandering {
    grid-template-columns: 52px minmax(0, 1fr) !important;
    gap: 8px 10px !important;
  }

  .compact-general-card.wandering .recruit-wandering,
  .compact-general-card.wandering .wandering-recruit-hint {
    grid-column: 1 / -1 !important;
    width: 100% !important;
  }
}
