/* box-sizing already set globally */
#battle-page {
  --gold1: #faecc8;
  --gold2: #d4b85a;
  --gold3: rgba(220, 192, 100, .85);
  --gold-dim: rgba(196, 168, 74, .3);
  --bg0: #0c0806;
  --bg1: #130b07;
  --bg2: #1c1009;
  --bg3: #26160b;
  --ink: rgba(255, 238, 210, .95);
  --ink2: rgba(255, 238, 210, .80);
  --ink3: rgba(255, 238, 210, .55);
  --ink4: rgba(255, 238, 210, .30);
  --red: #c03030;
  --red2: #e04040;
  --teal: #20c090;
  --blue: #4488cc;
  --atk: rgba(220, 60, 40, .9);
  --def: rgba(40, 100, 220, .9);
  --atk-dim: rgba(220, 60, 40, .15);
  --def-dim: rgba(40, 100, 220, .15);
  --border: rgba(196, 168, 74, .18);
  --border2: rgba(196, 168, 74, .35);
}

#battle-page {
  position: fixed;
  inset: 0;
  z-index: 85;
  overflow-y: auto;
  background:
    radial-gradient(ellipse 100% 50% at 50% 100%, rgba(120, 25, 8, .45) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 15% 85%, rgba(90, 18, 5, .35) 0%, transparent 50%),
    radial-gradient(ellipse 60% 40% at 85% 80%, rgba(80, 15, 4, .3) 0%, transparent 50%),
    #0c0806;
  color: var(--ink);
  font-family: 'MedievalSharp', 'Cinzel', serif;
  min-height: 100vh;
  overflow-x: hidden
}

/* ── Noise texture overlay ── */
#battle-page::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  opacity: .4;
}

/* ── ENTRY SCREEN ── */
#entryScreen {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #0c0806;
  gap: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 40px 0;
}

/* Base flame layer — large, slow */
#entryScreen::before {
  content: '';
  position: absolute;
  inset: -20%;
  background:
    radial-gradient(ellipse 90% 70% at 50% 110%, rgba(160, 30, 5, .75) 0%, transparent 55%),
    radial-gradient(ellipse 60% 50% at 30% 115%, rgba(120, 20, 3, .5) 0%, transparent 45%),
    radial-gradient(ellipse 60% 50% at 70% 115%, rgba(110, 18, 3, .45) 0%, transparent 45%);
  animation: flameBase 4s ease-in-out infinite alternate;
  pointer-events: none;
}

/* Mid flame layer — medium, offset phase */
#entryScreen::after {
  content: '';
  position: absolute;
  inset: -20%;
  background:
    radial-gradient(ellipse 55% 65% at 48% 108%, rgba(200, 50, 8, .55) 0%, transparent 45%),
    radial-gradient(ellipse 35% 45% at 60% 112%, rgba(180, 35, 5, .4) 0%, transparent 40%),
    radial-gradient(ellipse 35% 45% at 38% 112%, rgba(170, 30, 4, .35) 0%, transparent 40%);
  animation: flameMid 2.7s ease-in-out infinite alternate;
  animation-delay: .6s;
  pointer-events: none;
}

@keyframes flameBase {
  0% {
    transform: scaleX(1) scaleY(1) translateY(0);
    opacity: .85;
  }

  25% {
    transform: scaleX(1.04) scaleY(.97) translateY(1%);
    opacity: .9;
  }

  50% {
    transform: scaleX(.97) scaleY(1.03) translateY(-1%);
    opacity: 1;
  }

  75% {
    transform: scaleX(1.03) scaleY(.98) translateY(.5%);
    opacity: .88;
  }

  100% {
    transform: scaleX(.98) scaleY(1.02) translateY(-2%);
    opacity: .95;
  }
}

@keyframes flameMid {
  0% {
    transform: scaleX(1) scaleY(1) translateY(0) translateX(0);
    opacity: .7;
  }

  30% {
    transform: scaleX(1.06) scaleY(.95) translateY(1.5%) translateX(-1%);
    opacity: .85;
  }

  60% {
    transform: scaleX(.94) scaleY(1.05) translateY(-2%) translateX(1%);
    opacity: .95;
  }

  100% {
    transform: scaleX(1.02) scaleY(.97) translateY(1%) translateX(-.5%);
    opacity: .75;
  }
}

.entry-crest {
  font-size: 52px;
  margin-top: auto;
  margin-bottom: 20px;
  filter: drop-shadow(0 0 24px rgba(196, 168, 74, .4));
  animation: crestPulse 3s ease-in-out infinite;
  position: relative;
  z-index: 1;
}

@keyframes crestPulse {

  0%,
  100% {
    filter: drop-shadow(0 0 18px rgba(196, 168, 74, .3))
  }

  50% {
    filter: drop-shadow(0 0 32px rgba(196, 168, 74, .6))
  }
}

.entry-title {
  font-family: 'Cinzel Decorative', 'Cinzel', serif;
  font-size: clamp(18px, 3vw, 28px);
  font-weight: 700;
  color: var(--gold3);
  letter-spacing: .22em;
  text-transform: uppercase;
  margin-bottom: 6px;
  text-align: center;
  position: relative;
  z-index: 1;
}

.entry-sub {
  font-size: 13px;
  color: var(--ink3);
  letter-spacing: .18em;
  text-transform: uppercase;
  margin-bottom: 48px;
  position: relative;
  z-index: 1;
}

.entry-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 440px;
  padding: 0 20px;
  position: relative;
  z-index: 1;
}

.entry-label {
  font-size: 12px;
  color: var(--ink3);
  letter-spacing: .14em;
  text-transform: uppercase;
  align-self: flex-start
}

.entry-input-row {
  display: flex;
  width: 100%;
  gap: 0
}

.entry-input {
  flex: 1;
  background: rgba(0, 0, 0, .5);
  border: 1px solid var(--border2);
  border-right: none;
  color: var(--gold1);
  font-family: 'MedievalSharp', serif;
  font-size: 13px;
  padding: 12px 16px;
  outline: none;
  transition: border-color .15s;
  letter-spacing: .04em;
}

.entry-input:focus {
  border-color: var(--gold2);
}

.entry-input::placeholder {
  color: var(--ink4);
  font-size: 14px
}

.entry-btn {
  background: linear-gradient(160deg, rgba(196, 168, 74, .22), rgba(196, 168, 74, .1));
  border: 1px solid var(--gold2);
  color: var(--gold1);
  font-family: 'Cinzel', serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  padding: 12px 20px;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}

.entry-btn:hover {
  background: linear-gradient(160deg, rgba(196, 168, 74, .35), rgba(196, 168, 74, .2));
}

.entry-btn:disabled {
  opacity: .4;
  cursor: not-allowed
}

.entry-error {
  font-size: 13px;
  color: var(--red2);
  letter-spacing: .06em;
  min-height: 16px;
  text-align: center;
}

.entry-back-btn {
  margin-top: 28px;
  margin-bottom: auto;
  background: none;
  border: 1px solid rgba(196, 168, 74, .2);
  color: var(--ink3);
  font-family: 'Cinzel', serif;
  font-size: 12px;
  letter-spacing: .1em;
  padding: 8px 20px;
  cursor: pointer;
  transition: all .15s;
  position: relative;
  z-index: 1;
}

.entry-back-btn:hover {
  border-color: rgba(196, 168, 74, .5);
  color: var(--ink);
}

/* ── Danger Leaderboard ── */
.danger-board {
  width: min(480px, 92vw);
  margin-top: 28px;
  position: relative;
  z-index: 1;
}

.danger-board-hdr {
  display: flex;
  flex-direction: column;
  gap: 3px;
  border-bottom: 1px solid rgba(196, 168, 74, .2);
  padding-bottom: 10px;
  margin-bottom: 10px;
}

.danger-board-title {
  font-family: 'Cinzel', serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .12em;
  color: var(--gold2);
  text-transform: uppercase;
}

.danger-board-sub {
  font-family: 'MedievalSharp', serif;
  font-size: 10px;
  color: var(--ink4);
  letter-spacing: .08em;
}

.danger-board-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.danger-board-empty {
  font-family: 'MedievalSharp', serif;
  font-size: 11px;
  color: var(--ink4);
  text-align: center;
  padding: 12px 0;
  letter-spacing: .06em;
}

.danger-row {
  display: grid;
  grid-template-columns: 22px 1fr auto auto;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  background: rgba(255, 238, 210, .025);
  border: 1px solid transparent;
  transition: background .12s, border-color .12s;
}

.danger-row:hover {
  background: rgba(196, 168, 74, .06);
  border-color: rgba(196, 168, 74, .15);
}

.danger-row.rank-1 {
  border-left: 2px solid rgba(220, 60, 40, .8);
}

.danger-row.rank-2 {
  border-left: 2px solid rgba(196, 168, 74, .7);
}

.danger-row.rank-3 {
  border-left: 2px solid rgba(140, 140, 160, .6);
}

.danger-rank {
  font-family: 'Cinzel', serif;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink4);
  text-align: center;
}

.danger-row.rank-1 .danger-rank {
  color: rgba(220, 60, 40, .9);
}

.danger-row.rank-2 .danger-rank {
  color: var(--gold2);
}

.danger-row.rank-3 .danger-rank {
  color: rgba(160, 160, 180, .8);
}

.danger-name {
  font-family: 'Cinzel', serif;
  font-size: 12px;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.danger-pts {
  font-family: 'Cinzel', serif;
  font-size: 13px;
  font-weight: 700;
  color: rgba(220, 60, 40, .9);
  white-space: nowrap;
}

.danger-battle {
  font-family: 'MedievalSharp', serif;
  font-size: 9px;
  color: var(--ink4);
  letter-spacing: .04em;
  white-space: nowrap;
}


/* ── BATTLE PAGE ── */
#battlePage {
  display: none;
  min-height: 100vh;
  position: relative;
  z-index: 1
}

#battlePage::before {
  content: '';
  position: fixed;
  inset: -30%;
  background:
    radial-gradient(ellipse 70% 60% at 50% 50%, rgba(160, 28, 5, .32) 0%, transparent 55%),
    radial-gradient(ellipse 45% 40% at 50% 50%, rgba(200, 40, 8, .22) 0%, transparent 40%),
    radial-gradient(ellipse 25% 25% at 50% 50%, rgba(240, 60, 12, .12) 0%, transparent 30%);
  animation: battleGlow 5s ease-in-out infinite alternate;
  pointer-events: none;
  z-index: 0;
}

@keyframes battleGlow {
  0% {
    transform: scale(1);
    opacity: .85;
  }

  30% {
    transform: scale(1.04);
    opacity: 1;
  }

  60% {
    transform: scale(.97);
    opacity: .9;
  }

  100% {
    transform: scale(1.02);
    opacity: .95;
  }
}

/* Header */
.battle-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 24px;
  background: linear-gradient(180deg, rgba(16, 8, 3, .98) 0%, rgba(10, 6, 2, .95) 100%);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 2px 20px rgba(0, 0, 0, .7);
}

.battle-header-title {
  font-family: 'Cinzel Decorative', 'Cinzel', serif;
  font-size: 12px;
  font-weight: 700;
  color: var(--gold3);
  letter-spacing: .18em;
}

.battle-header-id {
  font-family: 'Nunito', monospace;
  font-size: 13px;
  color: var(--ink4);
}

.battle-status-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border: 1px solid;
  font-size: 12px;
  font-family: 'Cinzel', serif;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.battle-status-pill.active {
  border-color: rgba(32, 192, 144, .4);
  color: var(--teal);
  background: rgba(32, 192, 144, .08)
}

.battle-status-pill.ended {
  border-color: rgba(196, 168, 74, .3);
  color: var(--gold2);
  background: rgba(196, 168, 74, .06)
}

.hdr-sep {
  flex: 1
}

.back-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--ink3);
  font-family: 'Cinzel', serif;
  font-size: 12px;
  letter-spacing: .1em;
  padding: 5px 12px;
  cursor: pointer;
  transition: all .12s;
}

.back-btn:hover {
  border-color: var(--gold-dim);
  color: var(--ink)
}

/* Auto-refresh indicator */
.refresh-ring {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(32, 192, 144, .2);
  border-top-color: var(--teal);
  animation: spin 3s linear infinite;
  display: none;
}

.refresh-ring.spinning {
  display: block
}

@keyframes spin {
  to {
    transform: rotate(360deg)
  }
}

/* ── Layout ── */
.battle-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px 20px;
  position: relative;
  z-index: 1;
}

@media(max-width:768px) {
  .battle-layout {
    grid-template-columns: 1fr
  }
}

/* ── Cards ── */
.b-card {
  background: linear-gradient(160deg, rgba(30, 16, 8, .92) 0%, rgba(20, 10, 5, .95) 100%);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

.b-card::before,
.b-card::after {
  content: '';
  position: absolute;
  width: 8px;
  height: 8px;
  border-color: rgba(220, 192, 100, .4);
  border-style: solid;
  pointer-events: none;
}

.b-card::before {
  top: 3px;
  left: 3px;
  border-width: 1px 0 0 1px
}

.b-card::after {
  bottom: 3px;
  right: 3px;
  border-width: 0 1px 1px 0
}

.b-card-title {
  font-family: 'Cinzel', serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--gold2);
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(196, 168, 74, .05);
  display: flex;
  align-items: center;
  gap: 8px;
}

.b-card-body {
  padding: 16px
}

/* ── VS Hero section ── */
.battle-vs {
  grid-column: 1/-1;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 20px;
  background: linear-gradient(160deg, rgba(28, 14, 7, .94) 0%, rgba(18, 9, 4, .97) 100%);
  border: 1px solid var(--border);
  padding: 24px 28px;
  position: relative;
  overflow: hidden;
}

.battle-vs::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 50%, rgba(196, 168, 74, .04) 0%, transparent 70%);
  pointer-events: none;
}

.vs-side {
  display: flex;
  flex-direction: column;
  gap: 6px
}

.vs-side.atk {
  align-items: flex-start
}

.vs-side.def {
  align-items: flex-end
}

.vs-role {
  font-size: 11px;
  letter-spacing: .18em;
  text-transform: uppercase;
  font-family: 'Cinzel', serif;
  font-weight: 700;
}

.vs-role.atk {
  color: rgba(220, 80, 60, .7)
}

.vs-role.def {
  color: rgba(60, 120, 220, .7)
}

.vs-country {
  font-family: 'Cinzel Decorative', 'Cinzel', serif;
  font-size: clamp(14px, 2.5vw, 22px);
  font-weight: 700;
  color: var(--gold1);
  letter-spacing: .08em;
}

.vs-region {
  font-size: 13px;
  color: var(--ink3)
}

.vs-dmg {
  font-family: 'Cinzel', serif;
  font-size: clamp(18px, 3vw, 28px);
  font-weight: 700;
  margin-top: 4px;
}

.vs-dmg.atk {
  color: rgba(220, 100, 80, .9)
}

.vs-dmg.def {
  color: rgba(80, 140, 240, .9)
}

.vs-hits {
  font-size: 13px;
  color: var(--ink3)
}

.vs-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px
}

.vs-badge {
  font-family: 'Cinzel Decorative', 'Cinzel', serif;
  font-size: clamp(20px, 3vw, 32px);
  font-weight: 700;
  color: rgba(196, 168, 74, .5);
  letter-spacing: .1em;
}

.vs-rounds {
  display: flex;
  gap: 6px;
  align-items: center;
}

.vs-round-pip {
  box-sizing: border-box !important;
  width: 20px !important;
  height: 20px !important;
  min-width: 20px !important;
  min-height: 20px !important;
  max-width: 20px !important;
  max-height: 20px !important;
  border-radius: 50% !important;
  border: 1.5px solid rgba(196, 168, 74, .3);
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  align-self: center !important;
  font-size: 10px;
  line-height: 1;
  overflow: hidden;
  flex-shrink: 0;
  padding: 0 !important;
  margin: 0 !important;
}

.vs-round-pip.atk-win {
  background: rgba(220, 80, 60, .25);
  border-color: rgba(220, 80, 60, .7);
  color: rgba(220, 80, 60, .95)
}

.vs-round-pip.def-win {
  background: rgba(60, 120, 220, .25);
  border-color: rgba(60, 120, 220, .7);
  color: rgba(60, 120, 220, .95)
}

.vs-round-pip.empty {
  background: transparent;
  border-color: rgba(196, 168, 74, .2);
}

.vs-round-pip svg {
  width: 10px;
  height: 10px;
  flex-shrink: 0;
}

.vs-rounds-to-win {
  font-size: 12px;
  color: var(--ink4);
  letter-spacing: .08em;
  margin-top: 2px
}

/* ── Round bar ── */
.round-section {
  grid-column: 1/-1
}

.round-bar-wrap {
  padding: 16px
}

.round-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.round-label {
  font-family: 'Cinzel', serif;
  font-size: 14px;
  color: var(--gold2);
  letter-spacing: .08em
}

.round-timer {
  font-size: 14px;
  color: var(--ink3)
}

.round-timer span {
  color: var(--gold2);
  font-family: 'Cinzel', serif
}

.dmg-bar-container {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.dmg-bar-track {
  height: 36px;
  background: rgba(0, 0, 0, .6);
  border: 1px solid var(--border);
  overflow: hidden;
  position: relative;
}

.dmg-bar-fill {
  height: 100%;
  transition: width .6s ease
}

.dmg-bar-fill.atk {
  background: linear-gradient(90deg, rgba(120, 25, 10, .9), rgba(200, 60, 40, .95), rgba(240, 90, 60, 1));
  float: right;
  box-shadow: inset 0 1px 0 rgba(255, 160, 120, .2);
}

.dmg-bar-fill.def {
  background: linear-gradient(90deg, rgba(30, 80, 180, .95), rgba(50, 120, 230, .95), rgba(70, 150, 255, 1));
  box-shadow: inset 0 1px 0 rgba(120, 180, 255, .2);
}

.dmg-pct {
  font-family: 'Cinzel', serif;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
}

.pts-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
}

.pts-side {
  display: flex;
  align-items: center;
  gap: 8px
}

.pts-val {
  font-family: 'Cinzel', serif;
  font-size: 20px;
  font-weight: 700;
}

.pts-val.atk {
  color: rgba(220, 80, 60, .9)
}

.pts-val.def {
  color: rgba(80, 140, 240, .9)
}

.pts-label {
  font-size: 12px;
  color: var(--ink4);
  letter-spacing: .08em;
  text-transform: uppercase
}

.tick-pts {
  font-size: 13px;
  color: var(--ink3);
  text-align: center;
  background: rgba(196, 168, 74, .06);
  border: 1px solid var(--border);
  padding: 3px 10px;
  font-family: 'Cinzel', serif;
}

/* ── Side Scanner ── */
.scanner-body {
  padding: 28px 24px
}

/* Prompt */
.scanner-title {
  font-family: 'Cinzel Decorative', 'Cinzel', serif;
  font-size: clamp(18px, 2.5vw, 26px);
  font-weight: 700;
  color: var(--gold3);
  letter-spacing: .14em;
  text-align: center;
  margin-bottom: 8px;
}

.scanner-sub {
  font-size: 13px;
  color: var(--ink3);
  text-align: center;
  letter-spacing: .06em;
  margin-bottom: 32px;
}

.scanner-btns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  max-width: 700px;
  margin: 0 auto;
}

.scanner-side-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 28px 20px;
  cursor: pointer;
  border: 1px solid;
  transition: all .18s;
  background: rgba(0, 0, 0, .3);
  font-family: 'Cinzel', serif;
}

.scanner-side-btn.atk {
  border-color: rgba(220, 80, 60, .35);
  box-shadow: inset 0 0 30px rgba(220, 80, 60, .04);
}

.scanner-side-btn.def {
  border-color: rgba(80, 140, 240, .35);
  box-shadow: inset 0 0 30px rgba(80, 140, 240, .04);
}

.scanner-side-btn.atk:hover {
  border-color: rgba(220, 80, 60, .7);
  background: rgba(220, 80, 60, .08);
  box-shadow: 0 0 20px rgba(220, 80, 60, .12);
}

.scanner-side-btn.def:hover {
  border-color: rgba(80, 140, 240, .7);
  background: rgba(80, 140, 240, .08);
  box-shadow: 0 0 20px rgba(80, 140, 240, .12);
}

.scanner-side-btn:disabled {
  opacity: .4;
  cursor: not-allowed
}

.ssb-icon {
  font-size: 32px
}

.ssb-label {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.scanner-side-btn.atk .ssb-label {
  color: rgba(220, 100, 80, .95)
}

.scanner-side-btn.def .ssb-label {
  color: rgba(80, 150, 240, .95)
}

.ssb-country {
  font-size: 13px;
  color: var(--ink3);
  letter-spacing: .04em
}

/* Results */
.scanner-results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.scanner-results-title {
  font-family: 'Cinzel Decorative', 'Cinzel', serif;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: .1em;
  color: var(--gold3);
}

.scanner-results-sub {
  font-size: 12px;
  color: var(--ink3);
  margin-top: 4px;
  letter-spacing: .04em
}

.scanner-back-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--ink3);
  font-family: 'Cinzel', serif;
  font-size: 11px;
  letter-spacing: .08em;
  padding: 6px 14px;
  cursor: pointer;
  transition: all .12s;
}

.scanner-back-btn:hover {
  border-color: var(--gold-dim);
  color: var(--ink)
}

/* Country orders compact row */
.country-orders-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  margin-bottom: 10px;
  background: rgba(196, 168, 74, .04);
  border: 1px solid rgba(196, 168, 74, .12);
}

.country-orders-label {
  font-family: 'Cinzel', serif;
  font-size: 11px;
  color: var(--gold2);
  flex-shrink: 0;
}

.country-order-pill {
  font-family: 'MedievalSharp', serif;
  font-size: 11px;
  color: var(--ink2);
  padding: 2px 8px;
  background: rgba(196, 168, 74, .08);
  border: 1px solid rgba(196, 168, 74, .2);
}

/* Order cards */
.scanner-cards {
  display: flex;
  flex-direction: column;
  gap: 8px
}

/* ── Pill summary chips ── */
.pill-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 10px 8px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, .25);
  position: relative;
}

.pill-chip-icon {
  font-size: 14px;
  line-height: 1;
}

.pill-chip-label {
  font-family: 'MedievalSharp', serif;
  font-size: 9px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink3);
  text-align: center;
}

.pill-chip-count {
  font-family: 'Cinzel', serif;
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
}

.pill-ready {
  border-color: rgba(196, 168, 74, .3);
}

.pill-ready .pill-chip-count {
  color: var(--gold2);
}

.pill-active {
  border-color: rgba(32, 192, 144, .4);
  background: rgba(32, 192, 144, .06);
}

.pill-active .pill-chip-count {
  color: var(--teal);
}

.pill-debuff {
  border-color: rgba(192, 48, 48, .35);
  background: rgba(192, 48, 48, .06);
}

.pill-debuff .pill-chip-count {
  color: var(--red2);
}

.country-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  font-family: 'MedievalSharp', serif;
  font-size: 11px;
  color: var(--ink2);
  background: rgba(0, 0, 0, .3);
  border: 1px solid var(--border);
}

.order-card {
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, .3);
  transition: border-color .12s;
  overflow: hidden;
}

.order-card:hover {
  border-color: var(--gold-dim)
}

.order-card-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  cursor: pointer;
  transition: background .12s;
  min-height: 80px;
}

.order-card-header:hover {
  background: rgba(196, 168, 74, .04)
}

/* Entity logo/avatar in header */
.order-card-logo {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, .4);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.order-card-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover
}

.order-card-logo-placeholder {
  font-size: 22px;
  opacity: .5
}

.order-card-type {
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
  font-family: 'Cinzel', serif;
  padding: 3px 8px;
  border: 1px solid;
  flex-shrink: 0;
}

.order-card-type.mu {
  color: var(--teal);
  border-color: rgba(32, 192, 144, .3);
  background: rgba(32, 192, 144, .06)
}

.order-card-type.country {
  color: var(--gold2);
  border-color: rgba(196, 168, 74, .3);
  background: rgba(196, 168, 74, .06)
}

.order-card-info {
  flex: 1;
  min-width: 0
}

.order-card-name {
  font-family: 'Cinzel', serif;
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
}

.order-card-meta {
  font-size: 12px;
  color: var(--ink3);
  margin-top: 3px
}

.order-card-id {
  font-family: 'Nunito', monospace;
  font-size: 11px;
  color: var(--ink4)
}

.order-card-chevron {
  color: var(--ink4);
  font-size: 14px;
  transition: transform .2s;
  flex-shrink: 0;
}

.order-card.open .order-card-chevron {
  transform: rotate(180deg)
}

.order-card-body {
  display: none;
  padding: 0 16px 16px;
  border-top: 1px solid var(--border);
  background: rgba(0, 0, 0, .2);
}

.order-card.open .order-card-body {
  display: block
}

.order-card-loading {
  font-size: 12px;
  color: var(--ink4);
  padding: 14px 0;
  font-family: 'MedievalSharp', serif;
  letter-spacing: .06em;
}

.order-card-members {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-top: 12px
}

/* Member rows */
.member-row {
  display: grid;
  grid-template-columns: 56px 1fr;
  align-items: start;
  gap: 14px;
  padding: 14px 16px;
  background: rgba(0, 0, 0, .25);
  border: 1px solid transparent;
  border-left: 3px solid transparent;
  transition: all .12s;
}

.member-row:hover {
  background: rgba(196, 168, 74, .05);
  border-color: var(--border)
}

.member-row.pill-active {
  border-left-color: rgba(32, 192, 144, .7);
  background: rgba(32, 192, 144, .04)
}

.member-row.pill-debuff {
  border-left-color: rgba(220, 80, 60, .6);
  background: rgba(220, 80, 60, .03)
}

.member-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 1px solid var(--border);
  overflow: hidden;
  background: rgba(0, 0, 0, .4);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.member-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover
}

.member-avatar-placeholder {
  font-size: 22px;
  opacity: .4
}

.member-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px
}

.member-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap
}

.member-name {
  font-family: 'Cinzel', serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.member-sub {
  font-size: 12px;
  color: var(--ink3)
}

/* Bars row */
.member-bars {
  display: flex;
  flex-direction: column;
  gap: 4px
}

.member-bar-row {
  display: flex;
  align-items: center;
  gap: 8px
}

.member-bar-label {
  font-family: 'Cinzel', serif;
  font-size: 10px;
  color: var(--ink4);
  width: 22px;
  flex-shrink: 0;
}

.member-bar-track {
  flex: 1;
  height: 8px;
  background: rgba(0, 0, 0, .5);
  border: 1px solid rgba(255, 255, 255, .06);
  overflow: hidden;
  clip-path: polygon(3px 0%, 100% 0%, calc(100% - 3px) 100%, 0% 100%);
}

.member-bar-fill {
  height: 100%;
  transition: width .4s
}

.member-bar-fill.hp {
  background: linear-gradient(90deg, #1a6040, #22c070)
}

.member-bar-fill.hunger {
  background: linear-gradient(90deg, #8a3010, #e05020)
}

.member-bar-val {
  font-family: 'Cinzel', serif;
  font-size: 11px;
  color: var(--ink2);
  min-width: 52px;
  text-align: right;
  flex-shrink: 0;
}

/* Stats chips */
.member-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 2px
}

.mstat {
  display: flex;
  align-items: center;
  gap: 3px;
  font-family: 'Cinzel', serif;
  font-size: 11px;
  color: var(--ink2);
  padding: 3px 7px;
  background: rgba(0, 0, 0, .35);
  border: 1px solid rgba(196, 168, 74, .12);
  white-space: nowrap;
}

.mstat-label {
  font-size: 9px;
  color: var(--ink4);
  margin-right: 2px
}

/* Pill status block */
.pill-block {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  border: 1px solid;
  font-family: 'Cinzel', serif;
  font-size: 11px;
  margin-top: 2px;
}

.pill-block.available {
  border-color: rgba(196, 168, 74, .2);
  color: var(--ink3);
  background: rgba(0, 0, 0, .2);
}

.pill-block.active {
  border-color: rgba(32, 192, 144, .4);
  color: var(--teal);
  background: rgba(32, 192, 144, .07);
}

.pill-block.debuff {
  border-color: rgba(220, 80, 60, .35);
  color: rgba(220, 100, 80, .9);
  background: rgba(220, 80, 60, .05);
}

.pill-block-icon {
  font-size: 14px
}

.pill-block-text {
  flex: 1
}

.pill-block-note {
  font-size: 10px;
  color: var(--ink4);
  margin-top: 1px
}

/* Danger badge */
.danger-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  font-family: 'Cinzel', serif;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid;
  letter-spacing: .04em;
  flex-shrink: 0;
  margin-left: auto;
}




/* ── Stats kpi row ── */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--border)
}

.kpi-item {
  background: var(--bg2);
  padding: 12px 14px;
  text-align: center;
}

.kpi-val {
  font-family: 'Cinzel', serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--gold2);
  display: block;
}

.kpi-label {
  font-size: 11px;
  color: var(--ink4);
  letter-spacing: .1em;
  text-transform: uppercase;
  margin-top: 3px;
  display: block
}

/* ── Weapon icons map ── */
.weapon-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 12px;
  color: var(--ink3);
}

/* ── Skeleton ── */
.skel {
  background: linear-gradient(90deg, rgba(196, 168, 74, .05) 25%, rgba(196, 168, 74, .1) 50%, rgba(196, 168, 74, .05) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 2px;
}

@keyframes shimmer {
  from {
    background-position: 200% 0
  }

  to {
    background-position: -200% 0
  }
}

/* ── Full width items ── */
.col-span-2 {
  grid-column: 1/-1
}

/* ── Responsive ── */
@media(max-width:600px) {
  .battle-vs {
    grid-template-columns: 1fr;
    text-align: center
  }

  .vs-side.def {
    align-items: flex-start
  }

  .vs-center {
    flex-direction: row
  }

  .kpi-row {
    grid-template-columns: 1fr 1fr
  }
}