#screen-character {
  flex-direction: row;
  align-items: stretch;
  justify-content: flex-start;
  padding: 0;
  gap: 0;
}

.bh-head {
  position: absolute;
  top: max(clamp(10px, 2.8vh, 30px), env(safe-area-inset-top));
  left: max(clamp(14px, 3.9vw, 50px), env(safe-area-inset-left));
  z-index: 3;
  display: flex;
  align-items: baseline;
  gap: clamp(8px, 1.1vw, 14px);
}
.bh-gem {
  align-self: center;
  width: clamp(18px, 2vw, 26px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 36% 30%, #fff 6%, var(--gem-emerald) 52%, rgba(0, 0, 0, .5));
  box-shadow: 0 0 12px var(--gem-emerald), 0 0 26px rgba(92, 224, 160, .6), inset 0 1px 2px rgba(255, 255, 255, .7);
  animation: gemShimmer 3.6s var(--zen-ease) infinite;
}
.bh-title {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: clamp(20px, 4.2vh, 30px);
  color: var(--cream-warm);
  text-shadow: 0 2px 0 rgba(0, 0, 0, .5), 0 0 22px rgba(255, 200, 110, .35);
}
.bh-title b { color: var(--gem-gold); }
.bh-sub {
  font-family: var(--font-body);
  font-weight: 800;
  font-size: clamp(9px, 1.5vh, 11px);
  letter-spacing: .26em;
  text-transform: uppercase;
  color: var(--gold-hot);
  opacity: .8;
}

.coin-chip {
  position: absolute;
  top: max(clamp(10px, 3vh, 32px), env(safe-area-inset-top));
  right: max(clamp(14px, 3.75vw, 48px), env(safe-area-inset-right));
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 16px 7px 11px;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(60, 38, 22, .86), rgba(34, 20, 12, .92));
  box-shadow:
    0 6px 16px rgba(0, 0, 0, .5),
    inset 0 0 0 1.5px var(--brass-lo),
    inset 0 1px 0 rgba(255, 225, 150, .3);
}
.coin-chip .coin-dot {
  width: clamp(16px, 1.7vw, 22px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 32%, var(--gold-hot), #C89A36 70%, #7A5A1A);
  box-shadow: 0 0 10px rgba(255, 200, 110, .55), inset 0 1px 1px rgba(255, 255, 255, .6);
}
.coin-chip span:last-child {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: clamp(14px, 1.5vw, 19px);
  color: var(--gold-hot);
  text-shadow: 0 1px 2px rgba(0, 0, 0, .6);
}

#cs-left {
  flex: 1 1 auto;
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: clamp(48px, 9vh, 66px) 0 clamp(10px, 2.4vh, 22px) clamp(14px, 3vw, 40px);
}
.cs-stage {
  position: relative;
  flex: 1;
  min-height: 0;
}
.stage-aura {
  position: absolute;
  left: 50%;
  top: 44%;
  width: min(82%, 460px);
  aspect-ratio: 1.3;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(255, 205, 120, .42), rgba(255, 180, 90, .14) 46%, transparent 70%);
  filter: blur(6px);
  pointer-events: none;
}
.stage-spotlight {
  position: absolute;
  left: 50%;
  top: -6%;
  width: min(54%, 250px);
  height: 86%;
  transform: translateX(-50%);
  background: linear-gradient(180deg, rgba(255, 222, 140, .34), rgba(255, 200, 110, .10) 52%, transparent 78%);
  clip-path: polygon(34% 0, 66% 0, 100% 100%, 0 100%);
  filter: blur(3px);
  pointer-events: none;
}
.rune-disc {
  position: absolute;
  left: 50%;
  bottom: 4%;
  width: min(76%, 360px);
  aspect-ratio: 2.7;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(255, 200, 110, .18), rgba(124, 252, 208, .07) 54%, transparent 70%);
  box-shadow:
    0 0 34px rgba(255, 196, 100, .34),
    0 0 18px rgba(88, 214, 224, .16),
    inset 0 0 26px rgba(255, 205, 120, .24);
  border: 1.5px solid rgba(255, 206, 128, .5);
  pointer-events: none;
}
.rune-disc::after {
  content: '';
  position: absolute;
  inset: 12% 11%;
  border-radius: 50%;
  border: 1px solid rgba(124, 232, 212, .3);
}
#char-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
  z-index: 2;
}
.cs-pedestal {
  position: absolute;
  bottom: 2%;
  left: 50%;
  transform: translateX(-50%);
  width: clamp(170px, 36%, 312px);
  pointer-events: none;
  z-index: 1;
  opacity: .9;
  filter: drop-shadow(0 14px 24px rgba(0, 0, 0, .55)) drop-shadow(0 0 26px rgba(255, 200, 110, .32));
}
.ped-medallion {
  position: absolute;
  left: 50%;
  bottom: 3%;
  width: clamp(32px, 3.75vw, 48px);
  aspect-ratio: 1;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(circle at 38% 30%, var(--brass-hi), var(--brass) 46%, var(--brass-lo) 84%);
  box-shadow:
    0 4px 10px rgba(0, 0, 0, .5),
    inset 0 0 0 2px var(--brass-lo),
    inset 0 2px 3px rgba(255, 235, 170, .5),
    inset 0 -3px 5px rgba(0, 0, 0, .4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
}
.ped-medallion::before {
  content: '';
  position: absolute;
  inset: -7px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 208, 90, .55), transparent 68%);
  filter: blur(3px);
}
.ped-medallion .ped-gem {
  position: relative;
  width: 46%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 36% 28%, #fff 6%, var(--gem-gold) 50%, #B5811F 92%);
  box-shadow:
    0 0 14px var(--gem-gold),
    0 0 26px rgba(255, 208, 90, .75),
    inset 0 1px 2px rgba(255, 255, 255, .85);
  animation: gemShimmer 3.6s var(--zen-ease) infinite;
}
.char-loading {
  position: absolute;
  bottom: 12px;
  left: 20px;
  z-index: 3;
  font-size: 12px;
  font-weight: 700;
  color: rgba(255, 243, 220, .6);
  text-shadow: 0 1px 2px rgba(0, 0, 0, .6);
  pointer-events: none;
}

#cs-info {
  flex: 0 0 auto;
  padding-top: clamp(4px, 1vh, 10px);
  max-width: 480px;
}
.bh-nameplate {
  position: relative;
  display: inline-flex;
  align-items: baseline;
  gap: 12px;
  padding: clamp(7px, 1.5vh, 11px) clamp(12px, 1.4vw, 18px);
  border-radius: 13px;
  background:
    repeating-linear-gradient(94deg, rgba(0, 0, 0, .10) 0 1px, transparent 1px 8px),
    linear-gradient(180deg, var(--walnut-hi), var(--walnut) 55%, var(--walnut-lo));
  box-shadow:
    0 8px 18px rgba(0, 0, 0, .5),
    inset 0 0 0 2px var(--brass-lo),
    inset 0 1px 0 rgba(255, 225, 150, .28),
    inset 0 -3px 8px rgba(0, 0, 0, .4);
}
.bh-nameplate::before {
  content: '';
  position: absolute;
  inset: 4px;
  border-radius: 9px;
  border: 1px solid rgba(184, 137, 58, .45);
  pointer-events: none;
}
.cs-name {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: clamp(20px, 4.6vh, 33px);
  line-height: 1;
  color: var(--cream-warm);
  text-shadow: 0 2px 0 rgba(0, 0, 0, .55), 0 0 18px rgba(255, 200, 110, .3);
}
.cs-title {
  font-family: var(--font-body);
  font-weight: 800;
  font-size: clamp(9px, 1.7vh, 12px);
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--gold-hot);
  white-space: nowrap;
}

#cs-stats {
  margin-top: clamp(8px, 1.8vh, 16px);
  display: flex;
  flex-direction: column;
  gap: clamp(6px, 1.5vh, 11px);
  padding-right: 6px;
}
.stat { display: flex; align-items: center; gap: clamp(8px, 1vw, 12px); }
.stat-gem {
  width: 13px;
  height: 13px;
  flex: none;
  border-radius: 50%;
  background: radial-gradient(circle at 36% 30%, #fff 8%, var(--sgc, var(--gem-gold)) 55%, rgba(0, 0, 0, .45));
  box-shadow: 0 0 9px var(--sgc, var(--gem-gold)), inset 0 1px 1px rgba(255, 255, 255, .7);
}
.stat-label {
  width: clamp(58px, 6.1vw, 78px);
  flex: none;
  font-family: var(--font-body);
  font-weight: 800;
  font-size: clamp(9px, 1.55vh, 11px);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--cream-warm);
  opacity: .92;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .6);
}
.stat-track {
  position: relative;
  flex: 1;
  max-width: 280px;
  height: clamp(12px, 2vh, 15px);
  border-radius: 8px;
  background: linear-gradient(180deg, #241626, #160D18);
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, .6), inset 0 0 0 1.5px var(--brass-lo);
  overflow: hidden;
}
.stat-track i {
  position: absolute;
  inset: 2px auto 2px 2px;
  width: 0%;
  border-radius: 6px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--sgc, var(--gem-gold)) 55%, #6B4A18), var(--sgc, var(--gem-gold)));
  box-shadow: 0 0 12px var(--sgc, var(--gem-gold)), inset 0 1px 1px rgba(255, 255, 255, .45);
  transition: width .5s cubic-bezier(.34, 1.3, .5, 1);
}
.stat-track .stat-val {
  position: absolute;
  right: 7px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-head);
  font-weight: 700;
  font-size: clamp(9px, 1.55vh, 11px);
  color: var(--cream-warm);
  text-shadow: 0 1px 3px rgba(0, 0, 0, .8);
  z-index: 1;
}

#cs-right {
  flex: 0 0 clamp(300px, 38vw, 500px);
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: clamp(48px, 9.5vh, 70px) clamp(14px, 2.2vw, 28px) clamp(10px, 2.4vh, 22px);
}
.roster-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 6px clamp(8px, 1.9vh, 14px);
}
.roster-title {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: clamp(11px, 2vh, 15px);
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--cream-warm);
  opacity: .82;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .6);
  white-space: nowrap;
}
.roster-rope {
  flex: 1;
  height: 4px;
  border-radius: 3px;
  background: repeating-linear-gradient(72deg, var(--rope) 0 4px, #8A6A30 4px 8px);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .5);
  opacity: .7;
}
.roster-count {
  font-family: var(--font-body);
  font-weight: 800;
  font-size: clamp(10px, 1.7vh, 12px);
  color: var(--gold-hot);
  letter-spacing: .08em;
  white-space: nowrap;
}

#cs-grid {
  flex: 1 1 0;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(8px, 1.8vh, 14px);
  align-content: start;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 4px 4px;
}
#cs-grid::-webkit-scrollbar { width: 8px; }
#cs-grid::-webkit-scrollbar-track { background: rgba(0, 0, 0, .25); border-radius: 4px; }
#cs-grid::-webkit-scrollbar-thumb { background: var(--brass-lo); border-radius: 4px; }

.cs-card {
  position: relative;
  cursor: pointer;
  min-height: clamp(108px, 21vh, 158px);
  padding: 14px 10px 12px;
  border-style: solid;
  border-width: 18px 14px 22px 14px;
  border-image: url(../refined-asset/card-frame.webp) 90 70 110 70 fill / 18px 14px 22px 14px / 0 stretch;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, .45));
  transition: transform var(--engine-dur) var(--engine-ease), filter var(--engine-dur) var(--engine-ease);
}
.cs-card:hover { transform: translateY(-4px); filter: drop-shadow(0 10px 18px rgba(0, 0, 0, .5)) drop-shadow(0 0 12px rgba(var(--glow-warm), .3)); }
.cs-card .portrait {
  width: clamp(44px, 8.4vh, 62px);
  aspect-ratio: 1;
  border-radius: 50%;
  object-fit: cover;
  background: var(--teal-lo);
  box-shadow: 0 4px 10px rgba(0, 0, 0, .5), inset 0 0 0 2px var(--brass-lo);
  margin-bottom: 7px;
}
.cs-card .c-name {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: clamp(12px, 2.2vh, 16px);
  line-height: 1;
  color: var(--cream-warm);
  text-shadow: 0 1px 0 rgba(0, 0, 0, .55);
}
.cs-card .c-title {
  font-family: var(--font-body);
  font-weight: 800;
  font-size: clamp(7px, 1.25vh, 9px);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--gold-hot);
  opacity: .82;
  margin-top: 3px;
  text-align: center;
}
.cs-card .corner {
  position: absolute;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: radial-gradient(circle at 36% 30%, #fff 8%, var(--cgc, var(--gem-aqua)) 55%, rgba(0, 0, 0, .5));
  box-shadow: 0 0 7px var(--cgc, var(--gem-aqua)), inset 0 1px 1px rgba(255, 255, 255, .7);
  opacity: .9;
}
.cs-card .c-tl { top: -10px; left: -6px; }
.cs-card .c-tr { top: -10px; right: -6px; }
.cs-card .c-bl { bottom: -12px; left: -6px; }
.cs-card .c-br { bottom: -12px; right: -6px; }
.cs-card .sel-badge {
  display: none;
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  padding: 2px 12px;
  border-radius: 11px;
  background: linear-gradient(180deg, var(--gold-hot), #C89A36);
  box-shadow: 0 3px 8px rgba(0, 0, 0, .5), 0 0 14px rgba(255, 208, 90, .6), inset 0 1px 0 rgba(255, 255, 255, .6);
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #2A1A06;
  white-space: nowrap;
  z-index: 2;
}
.cs-card.on { filter: drop-shadow(0 0 12px rgba(255, 208, 90, .35)) drop-shadow(0 10px 18px rgba(0, 0, 0, .5)); }
.cs-card.on .sel-badge { display: block; }
.cs-card.on .portrait { box-shadow: 0 4px 12px rgba(0, 0, 0, .5), inset 0 0 0 2px var(--gem-gold), 0 0 11px rgba(255, 208, 90, .34); }
.cs-card.on .c-name { color: #FFF7E0; text-shadow: 0 1px 0 rgba(0, 0, 0, .55), 0 0 9px rgba(255, 208, 90, .4); }
.cs-card.on .corner {
  --cgc: var(--gem-gold);
  width: 11px;
  height: 11px;
  box-shadow: 0 0 8px var(--gem-gold), 0 0 13px rgba(255, 208, 90, .5), inset 0 1px 1px rgba(255, 255, 255, .8);
  opacity: 1;
}

.cs-actions {
  display: flex;
  gap: 10px;
  margin-top: clamp(8px, 1.9vh, 14px);
  flex: 0 0 auto;
}
.cs-actions .btn { flex: 1 1 0; text-align: center; }
.cs-actions #cs-select { flex: 1.6; }

@media (max-width: 760px) {
  #screen-character { flex-direction: column; }
  #cs-left { flex: 1 1 0; min-height: 38vh; padding: 46px 12px 0 12px; }
  #cs-right { flex: 1 1 0; padding: 6px 12px 10px; }
  #cs-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (orientation: landscape) and (max-height: 480px) {
  .bh-sub { display: none; }
  #cs-info { display: flex; align-items: center; gap: 12px; }
  #cs-stats { margin-top: 0; flex: 1; }
  .stat-label { width: 52px; }
  #cs-grid { grid-template-columns: repeat(3, 1fr); }
  .cs-card { min-height: 96px; padding: 8px 8px 6px; }
  .cs-card .portrait { width: 34px; }
}

@media (prefers-reduced-motion: reduce) {
  .bh-gem, .ped-medallion .ped-gem { animation: none !important; }
}
