:root {
  --bg-night: #0f1d34;
  --bg-deep: #081126;
  --panel: rgba(13, 24, 45, 0.82);
  --panel-soft: rgba(20, 33, 61, 0.72);
  --line: #2c4168;
  --line-strong: #4f6ea4;
  --gold: #e6c26b;
  --gold-soft: #d8b15a;
  --text: #f1f5ff;
  --text-dim: #aebee0;
  --good: #6ae39f;
  --bad: #ff7e7e;
  --btn: #20457b;
  --btn-hover: #2e5ca0;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  font-family: "Yu Mincho", "Hiragino Mincho ProN", "MS PMincho", serif;
  background:
    radial-gradient(circle at 80% -10%, rgba(93, 130, 211, 0.28), transparent 34%),
    radial-gradient(circle at 15% 120%, rgba(71, 120, 199, 0.22), transparent 34%),
    linear-gradient(160deg, var(--bg-night), var(--bg-deep));
  min-height: 100vh;
  padding: 12px;
}

.hidden {
  display: none;
}

.gameIntro {
  display: grid;
  grid-template-columns: minmax(0, 0.72fr) minmax(0, 1fr);
  gap: 14px;
  margin-top: 18px;
  border: 1px solid rgba(117, 159, 221, 0.72);
  border-radius: 14px;
  padding: 14px;
  background: rgba(8, 17, 38, 0.72);
}

.gameIntro img {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 10px;
  object-fit: cover;
  border: 1px solid rgba(168, 201, 255, 0.38);
}

.gameIntro h2 {
  margin: 0 0 8px;
  color: #f1f5ff;
  font-size: 1.15rem;
}

.gameIntro p,
.gameIntro li {
  color: var(--text-dim);
  line-height: 1.7;
}

.gameIntro ul {
  margin: 10px 0;
  padding-left: 1.2em;
}

.gameIntro a {
  color: #8fd2ff;
  font-weight: 700;
  text-decoration: none;
}

@media (max-width: 760px) {
  .gameIntro {
    grid-template-columns: 1fr;
  }
}

/* ===== layout ===== */

.app,
.battleApp {
  max-width: 1260px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 12px;
  align-items: start;
}

.panel {
  background: linear-gradient(180deg, var(--panel), var(--panel-soft));
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  box-shadow: 0 15px 45px rgba(1, 8, 22, 0.35);
  min-width: 0;
}

.battleMainPanel,
.battleLogPanel {
  min-width: 0;
}

h1 {
  margin: 0 0 8px;
  font-size: 20px;
  letter-spacing: 0.4px;
  color: #f7e7b3;
}

.sub {
  margin: 0 0 10px;
  color: var(--text-dim);
  font-size: 13px;
}

/* ===== hud ===== */

.status,
.battleHud {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.chip {
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: rgba(8, 18, 39, 0.7);
  padding: 8px;
  font-size: 13px;
  color: var(--text);
}

.battleHud .chip,
.missionChip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  line-height: 1;
}

.missionChip {
  width: 100%;
  justify-content: flex-start;
  min-width: 0;
}

.chipIcon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid rgba(168, 201, 255, 0.7);
  display: grid;
  place-items: center;
  font-size: 12px;
  background: linear-gradient(180deg, rgba(44, 78, 129, 0.86), rgba(24, 45, 79, 0.9));
  box-shadow: inset 0 0 8px rgba(163, 206, 255, 0.2);
}

.chipTurn .chipIcon {
  background: linear-gradient(180deg, rgba(81, 123, 193, 0.9), rgba(40, 71, 130, 0.92));
}

.chipPlayerHp .chipIcon {
  background: linear-gradient(180deg, rgba(79, 144, 221, 0.9), rgba(29, 86, 149, 0.92));
}

.chipEnemyHp .chipIcon {
  background: linear-gradient(180deg, rgba(191, 101, 123, 0.9), rgba(125, 43, 66, 0.92));
}

.chipPp .chipIcon {
  background: linear-gradient(180deg, rgba(123, 164, 237, 0.9), rgba(54, 92, 159, 0.92));
}

.battleHud .chip strong,
.missionChip strong {
  font-size: 18px;
  letter-spacing: 0.2px;
}

.missionChip strong {
  min-width: 0;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.resultBanner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  border-radius: 10px;
  border: 1px solid rgba(119, 162, 235, 0.65);
  background: linear-gradient(180deg, rgba(14, 30, 59, 0.88), rgba(9, 20, 42, 0.92));
  padding: 7px 10px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.resultBanner strong {
  font-size: 14px;
  letter-spacing: 0.2px;
}

.resultBanner span {
  font-size: 12px;
  color: #d7e6ff;
}

.resultBanner.resultWin {
  border-color: rgba(117, 232, 179, 0.78);
  background: linear-gradient(180deg, rgba(24, 77, 66, 0.9), rgba(11, 46, 40, 0.94));
}

.resultBanner.resultWin strong {
  color: #b8ffe0;
}

.resultBanner.resultLose {
  border-color: rgba(243, 140, 140, 0.75);
  background: linear-gradient(180deg, rgba(88, 40, 52, 0.92), rgba(55, 24, 32, 0.94));
}

.resultBanner.resultLose strong {
  color: #ffd0d0;
}

.resultBanner.resultPvp {
  border-color: rgba(143, 202, 255, 0.76);
  background: linear-gradient(180deg, rgba(36, 71, 117, 0.9), rgba(18, 40, 75, 0.94));
}

.resultBanner.hidden {
  display: none;
}

.chipPp strong {
  font-size: 16px;
}

.statusGood {
  color: var(--good);
  font-weight: 700;
}

.statusBad {
  color: var(--bad);
  font-weight: 700;
}

.win {
  color: var(--good);
  font-weight: 700;
}

.lose {
  color: var(--bad);
  font-weight: 700;
}

/* ===== leaders ===== */

.leaderRow {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-bottom: 10px;
}

.leaderTop {
  margin-bottom: 8px;
}

.leaderBottom {
  margin-top: 8px;
  margin-bottom: 8px;
}

.leaderCard {
  border: 1px solid #5375b2;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(27, 46, 84, 0.95), rgba(13, 25, 49, 0.95));
  padding: 8px;
  min-height: 88px;
  position: relative;
  overflow: hidden;
}

.leaderCard::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.14), transparent 50%);
  pointer-events: none;
}

.leaderCard::after {
  content: none;
  display: none;
}

.leaderCard.enemyLeader {
  border-color: #9b5f5f;
  background: linear-gradient(180deg, rgba(84, 33, 44, 0.92), rgba(42, 16, 27, 0.94));
}

.leaderCard.playerLeader {
  border-color: #4b83bb;
  background: linear-gradient(180deg, rgba(28, 58, 96, 0.92), rgba(16, 33, 58, 0.94));
}

.targetLeader {
  cursor: pointer;
  transition: transform 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease;
}

.targetLeader:hover {
  transform: translateY(-2px);
}

.leaderTargetable {
  border-color: var(--gold) !important;
  box-shadow: 0 0 0 2px rgba(230, 194, 107, 0.35), 0 0 18px rgba(230, 194, 107, 0.28);
}

.leaderInner {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
  z-index: 1;
}

.leaderFace {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.5);
  display: grid;
  place-items: center;
  font-size: 24px;
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.08));
}

.leaderInfo {
  font-size: 12px;
  color: #d8e5ff;
}

.leaderName {
  font-size: 13px;
  font-weight: 700;
  color: #f7f9ff;
}

.mascotLeader {
  width: 100%;
  justify-content: flex-start;
}

.leaderMascot {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.62);
  box-shadow: inset 0 0 14px rgba(255, 255, 255, 0.14), 0 2px 8px rgba(0, 0, 0, 0.25);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.enemyMascot {
  background-image: url("assets/leader-dog.svg");
}

.playerMascot {
  background-image: url("assets/leader-cat.svg");
}

.lionMascot {
  background-image: url("assets/leader-lion.svg");
}

.leaderVitals {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  flex-shrink: 0;
}

.hpBadge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  padding: 4px 8px;
  line-height: 1;
  white-space: nowrap;
  border-radius: 999px;
  border: 1px solid rgba(255, 232, 189, 0.68);
  color: #fff4d6;
  font-weight: 700;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.4);
  text-align: center;
  background: linear-gradient(180deg, rgba(143, 45, 62, 0.9), rgba(88, 28, 39, 0.9));
}

.orderBadge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  padding: 4px 8px;
  line-height: 1;
  white-space: nowrap;
  border-radius: 999px;
  border: 1px solid rgba(180, 210, 255, 0.62);
  color: #f2f8ff;
  font-size: 11px;
  font-weight: 700;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
}

.orderBadge.orderFirst {
  border-color: rgba(132, 226, 255, 0.78);
  background: linear-gradient(180deg, rgba(42, 129, 182, 0.92), rgba(24, 75, 121, 0.94));
}

.orderBadge.orderSecond {
  border-color: rgba(246, 199, 124, 0.72);
  background: linear-gradient(180deg, rgba(154, 108, 41, 0.9), rgba(104, 69, 24, 0.92));
}

/* ===== arena ===== */

.battleArena {
  border: 1px solid rgba(89, 129, 191, 0.55);
  border-radius: 14px;
  padding: 8px;
  background:
    radial-gradient(circle at 50% 48%, rgba(125, 171, 255, 0.16), transparent 38%),
    linear-gradient(180deg, rgba(10, 22, 44, 0.68), rgba(6, 15, 33, 0.72));
  box-shadow: inset 0 0 40px rgba(3, 10, 24, 0.55);
}

.board {
  display: grid;
  gap: 8px;
  margin-bottom: 8px;
}

.lane {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px;
  background: rgba(4, 12, 28, 0.55);
  min-height: 96px;
}

.enemyLane {
  background: linear-gradient(180deg, rgba(73, 30, 40, 0.32), rgba(23, 11, 17, 0.38));
}

.playerLane {
  background: linear-gradient(180deg, rgba(28, 58, 96, 0.32), rgba(13, 25, 44, 0.38));
}

.handLane {
  margin-bottom: 10px;
}

.lane h3 {
  margin: 0 0 6px;
  font-size: 12px;
  color: #c8d6fa;
  letter-spacing: 0.2px;
}

.handCountBadge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 6px;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid rgba(125, 168, 238, 0.72);
  background: rgba(15, 33, 63, 0.72);
  color: #e4efff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.2;
}

.boardRow,
.hand {
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x;
  scrollbar-width: thin;
  padding-bottom: 4px;
}

.boardRow > *,
.hand > * {
  flex: 0 0 auto;
}

#playerBoard.dropReady {
  border-radius: 12px;
  box-shadow: 0 0 0 2px rgba(111, 215, 255, 0.55), inset 0 0 20px rgba(89, 180, 255, 0.25);
  background: linear-gradient(180deg, rgba(45, 91, 156, 0.22), rgba(17, 35, 67, 0.24));
}

.handCardCompact {
  touch-action: pan-x;
}

.handCardCompact.dragSource {
  opacity: 0.35;
}

.dragGhost {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 9999;
  margin: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(1.03);
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.45));
}

/* ===== cards ===== */

.card {
  border: 1px solid var(--line-strong);
  background: linear-gradient(180deg, #172d53, #112242);
  border-radius: 11px;
  padding: 8px;
  font-size: 13px;
  line-height: 1.35;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}

.card:hover {
  transform: translateY(-2px);
  border-color: var(--gold-soft);
  box-shadow: 0 4px 14px rgba(8, 20, 42, 0.35);
}

.battleCard {
  width: 110px;
  min-height: 160px;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 6px;
  position: relative;
  overflow: hidden;
  border: 1px solid #5e79b0;
  background: linear-gradient(180deg, rgba(29, 49, 89, 0.92), rgba(20, 31, 58, 0.96));
  border-radius: 11px;
  padding: 6px;
}

.battleCard::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 20% 15%, rgba(255, 255, 255, 0.12), transparent 45%);
  pointer-events: none;
}

.battleCard.spellCard {
  border-color: #8a66c9;
  background: linear-gradient(180deg, rgba(60, 42, 111, 0.92), rgba(31, 24, 62, 0.96));
}

.battleCard.evolutionCard {
  border-color: #2ea9ad;
  background: linear-gradient(180deg, rgba(26, 79, 89, 0.92), rgba(14, 42, 49, 0.96));
}

.battleCard.selected {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(230, 194, 107, 0.35);
}

.battleCard.used {
  opacity: 0.62;
}

.cardTop {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 6px;
  position: relative;
  z-index: 1;
}

.cardName {
  font-size: 10px;
  font-weight: 700;
  color: #f6fbff;
  line-height: 1.1;
  word-break: break-word;
  max-height: 2.2em;
  overflow: hidden;
}

.costOrb {
  min-width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid #8dc4ff;
  background: radial-gradient(circle at 30% 30%, #8fd2ff, #2a67b7);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.cardArt {
  border: 1px solid rgba(147, 174, 230, 0.7);
  border-radius: 8px;
  background:
    linear-gradient(160deg, rgba(132, 171, 238, 0.25), rgba(255, 255, 255, 0.04)),
    repeating-linear-gradient(
      45deg,
      rgba(255, 255, 255, 0.04),
      rgba(255, 255, 255, 0.04) 6px,
      transparent 6px,
      transparent 12px
    );
  padding: 6px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 64px;
  position: relative;
  z-index: 1;
}

.artFrame {
  width: 100%;
  height: 100%;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 6px;
  gap: 6px;
}

.artSigil {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.42);
  display: grid;
  place-items: center;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.14);
}

.artName {
  font-size: 9px;
  letter-spacing: 0.3px;
  color: #ecf4ff;
  background: rgba(0, 0, 0, 0.28);
  padding: 2px 6px;
  border-radius: 999px;
  display: none;
}

.art-dragon { background: linear-gradient(145deg, rgba(178, 91, 72, 0.42), rgba(84, 32, 25, 0.52)); }
.art-forest { background: linear-gradient(145deg, rgba(83, 158, 101, 0.38), rgba(24, 67, 33, 0.52)); }
.art-sea { background: linear-gradient(145deg, rgba(70, 137, 186, 0.38), rgba(24, 48, 86, 0.52)); }
.art-holy { background: linear-gradient(145deg, rgba(199, 180, 91, 0.34), rgba(91, 74, 20, 0.5)); }
.art-shadow { background: linear-gradient(145deg, rgba(127, 82, 153, 0.36), rgba(45, 24, 68, 0.56)); }
.art-neutral { background: linear-gradient(145deg, rgba(120, 136, 166, 0.34), rgba(40, 52, 74, 0.52)); }

.cardText {
  font-size: 10px;
  color: #d9e6ff;
  line-height: 1.25;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  padding: 3px 5px;
  display: none;
}

.cardBottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  position: relative;
  z-index: 1;
}

.stat {
  min-width: 24px;
  padding: 2px 5px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  font-weight: 700;
  text-align: center;
  font-size: 11px;
}

.statAtk {
  background: rgba(231, 83, 83, 0.38);
}

.statHp {
  background: rgba(72, 175, 112, 0.38);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.tag {
  font-size: 9px;
  border: 1px solid #7394cf;
  border-radius: 999px;
  padding: 1px 6px;
  color: #dbe8ff;
  background: rgba(39, 63, 108, 0.6);
}

.keymarks {
  display: inline-flex;
  gap: 3px;
  align-items: center;
}

.keymark {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1px solid #7ea4dc;
  display: grid;
  place-items: center;
  font-size: 10px;
  color: #ecf4ff;
  background: rgba(20, 42, 77, 0.85);
}

.key-ward {
  border-color: #e1bf70;
  background: rgba(86, 63, 18, 0.82);
}

.key-rush {
  border-color: #eea35f;
  background: rgba(92, 44, 16, 0.82);
}

.key-storm {
  border-color: #75cbff;
  background: rgba(20, 52, 99, 0.82);
}

.key-spell {
  border-color: #ab90f2;
  background: rgba(52, 34, 89, 0.86);
}

.battleCard.kw-ward {
  clip-path: polygon(8% 0, 92% 0, 100% 8%, 100% 92%, 92% 100%, 8% 100%, 0 92%, 0 8%);
  border-color: #dfc27b;
  box-shadow: inset 0 0 0 1px rgba(223, 194, 123, 0.55);
}

.battleCard.kw-rush {
  border-color: #ea9d59;
  box-shadow: inset 0 0 0 1px rgba(234, 157, 89, 0.45);
}

.battleCard.kw-storm {
  border-color: #72bfff;
  box-shadow: inset 0 0 0 1px rgba(114, 191, 255, 0.45), 0 0 10px rgba(114, 191, 255, 0.2);
}

.emptySlot {
  width: 110px;
  min-height: 160px;
  border: 1px dashed #466091;
  border-radius: 11px;
  display: grid;
  place-items: center;
  color: #93a8d4;
  font-size: 12px;
  background: rgba(13, 26, 50, 0.45);
}

/* ===== hand / preview ===== */

.hand {
  min-height: 150px;
  border: 1px dashed #3c5480;
  border-radius: 11px;
  padding: 8px;
  background: rgba(10, 20, 41, 0.6);
}

#hand .battleCard,
.hand .battleCard {
  width: 116px;
  min-height: 168px;
}

#hand .battleCard .cardText,
.hand .battleCard .cardText {
  display: none;
}

.cardInspect {
  margin-top: 6px;
  border: 1px solid #466393;
  border-radius: 8px;
  background: rgba(8, 18, 36, 0.75);
  padding: 6px 8px;
  min-height: 52px;
}

.inspectTitle {
  font-size: 12px;
  color: #e8f0ff;
  margin-bottom: 2px;
  font-weight: 700;
}

.inspectText {
  font-size: 11px;
  color: #b8c9e8;
  line-height: 1.3;
}

.miniInfoBtn {
  display: grid;
  place-items: center;
  position: absolute;
  right: 6px;
  bottom: 6px;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  border: 1px solid #7fa9e4;
  padding: 0;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  background: linear-gradient(180deg, #234d8a, #183868);
}

/* ===== actions ===== */

.actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}

button {
  border: 1px solid #4f6ea6;
  background: linear-gradient(180deg, var(--btn), #1a3663);
  color: #f0f6ff;
  border-radius: 9px;
  padding: 8px 11px;
  font-size: 13px;
  cursor: pointer;
}

button:hover {
  background: linear-gradient(180deg, var(--btn-hover), #285495);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.evoBtn {
  width: 100%;
  margin-top: 6px;
  border-color: #7cb6d1;
  background: linear-gradient(180deg, #1b7181, #13505c);
}

.actions #attackHint {
  display: inline-flex;
  align-items: center;
  margin-left: 4px;
}

#endTurnBtn {
  border-color: rgba(97, 235, 255, 0.9);
  box-shadow: 0 8px 20px rgba(17, 118, 223, 0.25);
}

#resetBtn {
  border-color: rgba(239, 204, 124, 0.52);
}

/* ===== log ===== */

.log {
  min-height: 520px;
  max-height: 70vh;
  overflow: auto;
  background: rgba(6, 14, 30, 0.78);
  border: 1px solid #2f4570;
  border-radius: 10px;
  padding: 10px;
  font-size: 13px;
  white-space: pre-wrap;
}

/* ===== battle compact mode ===== */

.battleApp.compact {
  max-width: 1200px;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 10px;
}

.battleApp.compact .panel {
  padding: 8px;
  border-radius: 12px;
}

.battleApp.compact .battleArena {
  padding: 6px;
  border-radius: 12px;
}

.battleApp.compact .status,
.battleApp.compact .battleHud {
  gap: 6px;
  margin-bottom: 6px;
}

.battleApp.compact .chip {
  padding: 6px 7px;
  font-size: 12px;
  border-radius: 8px;
}

.battleApp.compact .chipIcon {
  width: 18px;
  height: 18px;
  font-size: 10px;
}

.battleApp.compact .battleHud .chip strong,
.battleApp.compact .missionChip strong {
  font-size: 15px;
}

.battleApp.compact .missionChip {
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 124px;
  justify-self: start;
}

.battleApp.compact .resultBanner {
  margin-bottom: 6px;
  padding: 5px 8px;
  border-radius: 9px;
}

.battleApp.compact .resultBanner strong {
  font-size: 12px;
}

.battleApp.compact .resultBanner span {
  font-size: 10px;
}

.battleApp.compact .leaderRow {
  gap: 6px;
  margin-bottom: 6px;
}

.battleApp.compact .leaderTop {
  margin-bottom: 5px;
}

.battleApp.compact .leaderBottom {
  margin-top: 5px;
  margin-bottom: 6px;
}

.battleApp.compact .leaderCard {
  min-height: 74px;
  padding: 6px;
  border-radius: 10px;
}

.battleApp.compact .leaderFace {
  width: 42px;
  height: 42px;
  font-size: 20px;
}

.battleApp.compact .leaderMascot {
  width: 40px;
  height: 40px;
  font-size: 20px;
}

.battleApp.compact .hpBadge {
  min-width: 32px;
  padding: 3px 7px;
  font-size: 13px;
}

.battleApp.compact .orderBadge {
  min-width: 32px;
  padding: 3px 7px;
  font-size: 10px;
}

.battleApp.compact .leaderInfo {
  font-size: 11px;
}

.battleApp.compact .leaderName {
  font-size: 12px;
}

.battleApp.compact .board {
  gap: 6px;
  margin-bottom: 6px;
}

.battleApp.compact .lane {
  padding: 6px;
  border-radius: 10px;
  min-height: 84px;
}

.battleApp.compact .lane h3 {
  margin: 0 0 4px;
  font-size: 11px;
}

.battleApp.compact .handLane {
  margin-bottom: 6px;
}

.battleApp.compact .boardRow,
.battleApp.compact .hand {
  gap: 6px;
  padding-bottom: 2px;
}

.battleApp.compact .battleCard {
  width: 100px;
  min-height: 146px;
  border-radius: 10px;
  padding: 5px;
  gap: 4px;
}

.battleApp.compact .cardName {
  font-size: 9px;
}

.battleApp.compact .costOrb {
  min-width: 22px;
  height: 22px;
  font-size: 11px;
}

.battleApp.compact .cardArt {
  min-height: 56px;
  padding: 5px;
}

.battleApp.compact .artSigil {
  width: 20px;
  height: 20px;
  font-size: 10px;
}

.battleApp.compact .stat {
  min-width: 22px;
  font-size: 10px;
}

.battleApp.compact .keymark {
  width: 14px;
  height: 14px;
  font-size: 9px;
}

.battleApp.compact .emptySlot {
  width: 100px;
  min-height: 146px;
  font-size: 11px;
}

.battleApp.compact .hand {
  min-height: 130px;
  border-radius: 10px;
  padding: 6px;
}

.battleApp.compact #hand .battleCard,
.battleApp.compact .hand .battleCard {
  width: 106px;
  min-height: 152px;
}

.battleApp.compact .cardInspect {
  margin-top: 4px;
  min-height: 42px;
  padding: 5px 7px;
}

.battleApp.compact .inspectTitle {
  font-size: 11px;
}

.battleApp.compact .inspectText {
  font-size: 10px;
  line-height: 1.2;
}

.battleApp.compact .miniInfoBtn {
  width: 18px;
  height: 18px;
  right: 5px;
  bottom: 5px;
}

.battleApp.compact .actions {
  gap: 6px;
  margin-top: 6px;
}

.battleApp.compact .actions button {
  min-height: 38px;
  padding: 7px 10px;
  font-size: 12px;
}

.battleApp.compact .evoBtn {
  margin-top: 4px;
}

.battleApp.compact .battleLogPanel h1 {
  font-size: 16px;
  margin-bottom: 6px;
}

.battleApp.compact .log {
  min-height: 440px;
  max-height: 68vh;
  padding: 8px;
  font-size: 12px;
}

/* ===== title / intro ===== */

.titleWrap {
  min-height: calc(100vh - 36px);
  display: grid;
  place-items: center;
}

.titlePanel {
  width: min(880px, 96vw);
  border: 1px solid #3e5f95;
  border-radius: 18px;
  padding: 20px;
  background: linear-gradient(180deg, rgba(13, 25, 49, 0.9), rgba(7, 15, 31, 0.9));
  box-shadow: 0 16px 55px rgba(1, 9, 26, 0.45);
  text-align: center;
}

.titleKicker {
  margin: 0;
  color: #9ab4e8;
  letter-spacing: 1.5px;
  font-size: 12px;
}

.titleMain {
  margin: 8px 0 4px;
  font-size: clamp(42px, 9vw, 88px);
  line-height: 1;
  letter-spacing: 4px;
  color: #f8d98b;
  text-shadow: 0 0 20px rgba(243, 200, 96, 0.28);
}

.titleSub {
  margin: 0 0 14px;
  color: #c4d5f7;
}

.titleStage {
  position: relative;
  margin: 0 auto;
  width: min(520px, 95%);
  height: 250px;
  border-radius: 14px;
  border: 1px solid #345483;
  background:
    radial-gradient(circle at 78% 18%, rgba(250, 241, 179, 0.2), transparent 20%),
    linear-gradient(180deg, rgba(24, 46, 84, 0.65), rgba(10, 24, 50, 0.8));
  overflow: hidden;
}

.moonGlow {
  position: absolute;
  right: 38px;
  top: 30px;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff7cc, #d0b064);
  opacity: 0.9;
}

.kungfuCat {
  position: absolute;
  left: 50%;
  top: 55%;
  transform: translate(-50%, -50%);
  width: 110px;
  height: 140px;
}

.catHead {
  position: absolute;
  left: 38px;
  top: 0;
  font-size: 34px;
}

.catBody {
  position: absolute;
  left: 41px;
  top: 38px;
  width: 30px;
  height: 54px;
  border-radius: 14px;
  background: linear-gradient(180deg, #f6d28e, #d3975e);
  border: 1px solid rgba(75, 35, 12, 0.36);
}

.paw,
.leg {
  position: absolute;
  width: 12px;
  background: linear-gradient(180deg, #f6d28e, #d3975e);
  border-radius: 999px;
}

.paw {
  top: 40px;
  height: 34px;
}

.leg {
  top: 90px;
  height: 36px;
}

.pawLeft { left: 30px; }
.pawRight { left: 68px; }
.legLeft { left: 40px; }
.legRight { left: 60px; }

.tail {
  position: absolute;
  left: 73px;
  top: 62px;
  width: 36px;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(180deg, #f6d28e, #d3975e);
}

.titleActions {
  margin-top: 16px;
}

.titleBtn {
  display: inline-block;
  min-width: 220px;
  text-decoration: none;
  border: 1px solid #4f6ea6;
  background: linear-gradient(180deg, #2b5da5, #1a3d70);
  color: #f6fbff;
  border-radius: 10px;
  padding: 12px 18px;
  font-weight: 700;
  letter-spacing: 0.4px;
}

.titleBtn:hover {
  background: linear-gradient(180deg, #3c74c4, #245394);
}

/* ===== overlays ===== */

.rotateGuide {
  display: none;
}

.passOverlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(2, 8, 20, 0.82);
  display: grid;
  place-items: center;
}

.passOverlay.hidden {
  display: none !important;
}

.modalOpen {
  overflow: hidden;
}

.passCard {
  width: min(360px, 88vw);
  border: 1px solid #6688c7;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(22, 39, 74, 0.96), rgba(12, 24, 48, 0.96));
  padding: 14px;
  text-align: center;
}

.passTitle {
  font-weight: 700;
  color: #f6df9a;
  margin-bottom: 4px;
}

.passText {
  font-size: 12px;
  color: #c6d6f4;
  margin-bottom: 10px;
}

.fx-layer,
.fx-particle,
.screen-flash::after {
  pointer-events: none;
}

.mobileLogBtn {
  display: none;
}

.logModal {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
}

.logModal.hidden {
  display: none;
}

.logModalBackdrop {
  position: absolute;
  inset: 0;
  background: rgba(1, 7, 19, 0.76);
}

.logModalCard {
  position: relative;
  z-index: 1;
  width: min(92vw, 560px);
  max-height: min(82vh, 720px);
  background: linear-gradient(180deg, rgba(11, 23, 48, 0.96), rgba(6, 14, 33, 0.97));
  border: 1px solid #4a6aa0;
  border-radius: 14px;
  padding: 10px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.48);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.logModalHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.logModalHeader h2 {
  margin: 0;
  font-size: 18px;
  color: #f7e7b3;
}

#logModalBody {
  min-height: 200px;
  max-height: calc(min(82vh, 720px) - 84px);
}

/* ===== scrollbars ===== */

.boardRow::-webkit-scrollbar,
.hand::-webkit-scrollbar {
  height: 7px;
}

.boardRow::-webkit-scrollbar-thumb,
.hand::-webkit-scrollbar-thumb {
  background: rgba(117, 148, 204, 0.55);
  border-radius: 999px;
}

/* ===== tablet ===== */

@media (max-width: 1100px) {
  .app,
  .battleApp {
    grid-template-columns: 1fr;
  }

  .log {
    min-height: 180px;
    max-height: 240px;
  }

  .battleApp.compact .log {
    min-height: 170px;
    max-height: 220px;
  }
}

/* ===== smartphone portrait ===== */

@media (max-width: 760px) {
  body {
    padding: 8px;
  }

  .panel {
    padding: 8px;
    border-radius: 12px;
  }

  .battleApp,
  .battleApp.compact {
    grid-template-columns: 1fr;
  }

  .battleLogPanel {
    display: none;
  }

  .mobileLogBtn {
    position: fixed;
    right: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    z-index: 25;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 56px;
    min-height: 40px;
    border-radius: 999px;
    border: 1px solid #5a81c2;
    background: linear-gradient(180deg, rgba(45, 87, 154, 0.96), rgba(25, 52, 98, 0.96));
    box-shadow: 0 8px 18px rgba(2, 10, 24, 0.42);
    font-size: 12px;
    letter-spacing: 0.4px;
  }

  h1 {
    font-size: 18px;
  }

  .sub {
    font-size: 12px;
    margin-bottom: 8px;
  }

  .status,
  .battleHud {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .chip {
    font-size: 12px;
    padding: 7px;
  }

  .leaderRow {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .leaderCard {
    min-height: 74px;
  }

  .leaderFace {
    width: 40px;
    height: 40px;
    font-size: 20px;
  }

  .lane {
    padding: 7px;
    min-height: 0;
  }

  .lane h3 {
    font-size: 12px;
    margin-bottom: 6px;
  }

  .boardRow {
    min-height: 130px;
  }

  .battleCard,
  .emptySlot {
    width: 90px;
    min-height: 126px;
  }

  .cardName {
    font-size: 11px;
  }

  .cardText {
    font-size: 10px;
  }

  .costOrb {
    min-width: 22px;
    height: 22px;
    font-size: 11px;
  }

  .artSigil {
    width: 22px;
    height: 22px;
    font-size: 11px;
  }

  .stat {
    min-width: 22px;
    font-size: 10px;
  }

  .hand {
    min-height: 124px;
  }

  #hand .battleCard,
  .hand .battleCard {
    width: 98px;
    min-height: 136px;
  }

  #hand .battleCard .cardText,
  .hand .battleCard .cardText {
    display: none;
  }

  .cardInspect {
    min-height: 44px;
    padding: 5px 7px;
  }

  .inspectTitle {
    font-size: 11px;
  }

  .inspectText {
    font-size: 10px;
  }

  .actions {
    gap: 6px;
  }

  .actions button {
    flex: 1 1 calc(50% - 6px);
    min-height: 40px;
    font-size: 12px;
    padding: 8px 10px;
  }

  #resetBtn {
    flex-basis: 100%;
  }

  .log {
    min-height: 130px;
    max-height: 180px;
    font-size: 11px;
  }

  .battleApp.compact .leaderCard {
    min-height: 68px;
  }

  .battleApp.compact .leaderFace {
    width: 38px;
    height: 38px;
    font-size: 18px;
  }

  .battleApp.compact .battleCard,
  .battleApp.compact .emptySlot {
    width: 86px;
    min-height: 122px;
  }

  .battleApp.compact #hand .battleCard,
  .battleApp.compact .hand .battleCard {
    width: 94px;
    min-height: 130px;
  }

  .battleApp.compact .actions button {
    min-height: 36px;
  }

  .battleApp.compact .log {
    min-height: 120px;
    max-height: 160px;
  }

  .logModalCard {
    width: min(94vw, 560px);
    max-height: 84vh;
    padding: 9px;
  }

  .logModalHeader h2 {
    font-size: 16px;
  }

  #logModalBody {
    min-height: 180px;
    max-height: calc(84vh - 80px);
    font-size: 12px;
  }

  .battleApp.fitScreen,
  .battleApp.fitScreen.compact {
    gap: 0;
  }

  .battleApp.fitScreen .battleMainPanel {
    padding: 4px;
    border-radius: 10px;
    height: calc(100vh - 8px);
    height: calc(100dvh - 8px);
    overflow: hidden;
  }

  .battleApp.fitScreen .battleArena {
    height: 100%;
    padding: 4px;
    display: grid;
    grid-template-rows: auto auto 1fr auto auto auto auto;
    gap: 4px;
    overflow: hidden;
    position: relative;
  }

  .battleApp.fitScreen .battleArena > * {
    min-height: 0;
  }

  .battleApp.fitScreen .status,
  .battleApp.fitScreen .battleHud {
    margin-bottom: 0;
    gap: 4px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .battleApp.fitScreen .chip {
    padding: 4px 3px;
    font-size: 10px;
    border-radius: 7px;
  }

  .battleApp.fitScreen .battleHud .chip {
    gap: 4px;
  }

  .battleApp.fitScreen .chipIcon {
    width: 14px;
    height: 14px;
    font-size: 8px;
    border-width: 1px;
  }

  .battleApp.fitScreen .chip strong {
    font-size: 12px;
  }

  .battleApp.fitScreen .missionChip {
    display: none;
  }

  .battleApp.fitScreen .resultBanner {
    margin-bottom: 0;
    padding: 3px 6px;
    border-radius: 8px;
  }

  .battleApp.fitScreen .resultBanner strong {
    font-size: 10px;
  }

  .battleApp.fitScreen .resultBanner span {
    font-size: 9px;
  }

  .battleApp.fitScreen .leaderRow {
    margin: 0;
    gap: 4px;
  }

  .battleApp.fitScreen .battleHud {
    grid-row: 1;
  }

  .battleApp.fitScreen .leaderTop {
    grid-row: 2;
  }

  .battleApp.fitScreen .board {
    grid-row: 3;
  }

  .battleApp.fitScreen .leaderBottom {
    grid-row: 4;
  }

  .battleApp.fitScreen .handLane {
    grid-row: 5;
  }

  .battleApp.fitScreen .cardInspect {
    grid-row: 6;
  }

  .battleApp.fitScreen .actions {
    grid-row: 7;
  }

  .battleApp.fitScreen .leaderCard {
    min-height: 50px;
    padding: 4px 8px 4px 6px;
    border-radius: 9px;
  }

  .battleApp.fitScreen .leaderFace,
  .battleApp.fitScreen .leaderMascot {
    width: 30px;
    height: 30px;
    font-size: 16px;
  }

  .battleApp.fitScreen .leaderInfo,
  .battleApp.fitScreen .leaderName {
    font-size: 0;
  }

  .battleApp.fitScreen .leaderVitals {
    gap: 4px;
    margin-left: auto;
  }

  .battleApp.fitScreen .hpBadge {
    min-width: 26px;
    font-size: 11px;
    padding: 2px 6px;
    line-height: 1.1;
  }

  .battleApp.fitScreen .orderBadge {
    min-width: 24px;
    padding: 2px 6px;
    font-size: 9px;
  }

  .battleApp.fitScreen .playerLeader .hpBadge {
    background: linear-gradient(180deg, rgba(48, 105, 183, 0.9), rgba(22, 63, 122, 0.9));
  }

  .battleApp.fitScreen .board {
    gap: 4px;
    margin: 0;
    min-height: 0;
  }

  .battleApp.fitScreen .lane {
    min-height: 0;
    padding: 4px;
    border-radius: 9px;
  }

  .battleApp.fitScreen .lane h3 {
    display: none;
  }

  .battleApp.fitScreen .boardRow {
    min-height: 66px;
  }

  .battleApp.fitScreen .battleCard,
  .battleApp.fitScreen .emptySlot {
    width: 64px;
    min-height: 90px;
    padding: 3px;
    border-radius: 8px;
    gap: 3px;
  }

  .battleApp.fitScreen .cardName {
    font-size: 8px;
    max-height: 2.1em;
  }

  .battleApp.fitScreen .costOrb {
    min-width: 16px;
    height: 16px;
    font-size: 9px;
  }

  .battleApp.fitScreen .cardArt {
    min-height: 36px;
    padding: 3px;
  }

  .battleApp.fitScreen .artSigil {
    width: 13px;
    height: 13px;
    font-size: 8px;
  }

  .battleApp.fitScreen .cardBottom {
    gap: 3px;
  }

  .battleApp.fitScreen .stat {
    min-width: 16px;
    font-size: 8px;
    padding: 1px 2px;
  }

  .battleApp.fitScreen .keymark {
    width: 11px;
    height: 11px;
    font-size: 7px;
  }

  .battleApp.fitScreen .evoBtn {
    margin-top: 2px;
    min-height: 0;
    padding: 3px 2px;
    font-size: 8px;
  }

  .battleApp.fitScreen .handLane {
    margin: 0;
    min-height: 0;
  }

  .battleApp.fitScreen .hand {
    min-height: 86px;
    padding: 4px;
    border-radius: 8px;
    gap: 4px;
  }

  .battleApp.fitScreen #hand .battleCard,
  .battleApp.fitScreen .hand .battleCard {
    width: 70px;
    min-height: 96px;
  }

  .battleApp.fitScreen .miniInfoBtn {
    width: 16px;
    height: 16px;
    right: 3px;
    bottom: 3px;
    font-size: 9px;
  }

  .battleApp.fitScreen .cardInspect {
    display: block;
    position: static;
    margin: 0;
    min-height: 24px;
    padding: 2px 6px;
    border-radius: 8px;
    border: 1px solid rgba(107, 150, 221, 0.72);
    background: rgba(6, 16, 35, 0.78);
    box-shadow: inset 0 0 0 1px rgba(152, 191, 255, 0.08);
  }

  .battleApp.fitScreen .inspectTitle {
    display: none;
  }

  .battleApp.fitScreen .inspectText {
    font-size: 9px;
    line-height: 1.2;
    color: #d8e7ff;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .battleApp.fitScreen .actions {
    margin-top: 0;
    gap: 4px;
    padding-right: 0;
  }

  .battleApp.fitScreen .actions button {
    min-height: 30px;
    padding: 4px 8px;
    font-size: 11px;
  }

  .battleApp.fitScreen #resetBtn {
    flex-basis: auto;
  }

  .battleApp.fitScreen .mobileLogBtn {
    right: 6px;
    bottom: calc(52px + env(safe-area-inset-bottom, 0px));
    min-width: 50px;
    min-height: 34px;
    font-size: 11px;
  }
}

/* ===== small smartphone ===== */

@media (max-width: 430px) {
  body {
    padding: 6px;
  }

  .chip {
    font-size: 11px;
    padding: 6px;
  }

  .boardRow {
    min-height: 120px;
  }

  .battleCard,
  .emptySlot {
    width: 84px;
    min-height: 118px;
  }

  #hand .battleCard,
  .hand .battleCard {
    width: 92px;
    min-height: 128px;
  }

  .cardName {
    font-size: 10px;
  }

  .cardText {
    font-size: 9px;
  }

  .battleApp.compact .battleCard,
  .battleApp.compact .emptySlot {
    width: 80px;
    min-height: 114px;
  }

  .battleApp.compact #hand .battleCard,
  .battleApp.compact .hand .battleCard {
    width: 88px;
    min-height: 122px;
  }

  .battleApp.compact.fitScreen .battleCard,
  .battleApp.compact.fitScreen .emptySlot {
    width: 60px;
    min-height: 84px;
  }

  .battleApp.compact.fitScreen #hand .battleCard,
  .battleApp.compact.fitScreen .hand .battleCard {
    width: 66px;
    min-height: 92px;
  }

  .battleApp.fitScreen .chipIcon {
    width: 12px;
    height: 12px;
    font-size: 7px;
  }

  .battleApp.fitScreen .chip strong {
    font-size: 11px;
  }

  .battleApp.fitScreen .cardInspect {
    min-height: 22px;
    padding: 2px 5px;
  }

  .battleApp.fitScreen .inspectText {
    font-size: 8px;
  }
}

/* ===== smartphone landscape ===== */

@media (max-width: 950px) and (orientation: landscape) {
  body {
    padding: 8px;
  }

  .app,
  .battleApp {
    grid-template-columns: 1fr;
  }

  .battleLogPanel {
    display: none;
  }

  .status,
  .battleHud {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
  }

  .leaderRow {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .leaderCard {
    min-height: 66px;
    padding: 6px;
  }

  .leaderFace {
    width: 34px;
    height: 34px;
    font-size: 16px;
  }

  .leaderName {
    font-size: 12px;
  }

  .leaderInfo {
    font-size: 11px;
  }

  .lane {
    padding: 6px;
  }

  .boardRow {
    min-height: 108px;
  }

  .battleCard,
  .emptySlot {
    width: 78px;
    min-height: 108px;
    padding: 5px;
  }

  .cardName {
    font-size: 10px;
  }

  .cardArt {
    min-height: 52px;
    padding: 4px;
  }

  .cardText {
    font-size: 9px;
    line-height: 1.2;
  }

  .costOrb {
    min-width: 19px;
    height: 19px;
    font-size: 10px;
  }

  .artSigil {
  width: 16px;
  height: 16px;
  font-size: 9px;
  }

  .stat {
    min-width: 18px;
    font-size: 9px;
    padding: 1px 3px;
  }

  .hand {
    min-height: 104px;
  }

  #hand .battleCard,
  .hand .battleCard {
    width: 86px;
    min-height: 116px;
  }

  #hand .battleCard .cardText,
  .hand .battleCard .cardText {
    display: none;
  }

  .cardInspect {
    min-height: 38px;
    padding: 4px 6px;
  }

  .inspectTitle {
    font-size: 10px;
    margin-bottom: 1px;
  }

  .inspectText {
    font-size: 9px;
    line-height: 1.2;
  }

  .keymark {
    width: 13px;
    height: 13px;
    font-size: 8px;
  }

  .actions button {
    min-height: 36px;
    font-size: 12px;
    padding: 7px 9px;
  }

  .battleApp.compact .battleCard,
  .battleApp.compact .emptySlot {
    width: 74px;
    min-height: 102px;
    padding: 4px;
  }

  .battleApp.compact #hand .battleCard,
  .battleApp.compact .hand .battleCard {
    width: 82px;
    min-height: 110px;
  }

  .battleApp.compact .leaderFace {
    width: 30px;
    height: 30px;
    font-size: 15px;
  }

  .battleApp.compact.fitScreen .battleMainPanel {
    height: calc(100vh - 12px);
    height: calc(100dvh - 12px);
  }

  .battleApp.compact.fitScreen .battleArena {
    grid-template-rows: auto auto 1fr auto auto auto auto;
  }

  .battleApp.compact.fitScreen .missionChip,
  .battleApp.compact.fitScreen .cardInspect {
    display: none;
  }

  .battleApp.compact.fitScreen .battleCard,
  .battleApp.compact.fitScreen .emptySlot {
    width: 62px;
    min-height: 86px;
  }

  .battleApp.compact.fitScreen #hand .battleCard,
  .battleApp.compact.fitScreen .hand .battleCard {
    width: 68px;
    min-height: 92px;
  }

  .battleApp.compact.fitScreen .actions button {
    min-height: 28px;
    font-size: 10px;
    padding: 3px 6px;
  }

  .battleApp.fitScreen .chipIcon {
    width: 12px;
    height: 12px;
    font-size: 7px;
  }
}

/* ===== app refresh: title + deck ===== */

.pageTitle,
.pageDeck {
  font-family: "Hiragino Sans", "Yu Gothic", "Meiryo", sans-serif;
}

.pageTitle {
  background:
    radial-gradient(circle at 12% 12%, rgba(120, 210, 255, 0.24), transparent 38%),
    radial-gradient(circle at 88% 88%, rgba(255, 121, 143, 0.22), transparent 40%),
    linear-gradient(160deg, #060d1d 0%, #0f2142 52%, #091426 100%);
}

.pageTitle .titleWrap {
  min-height: 100dvh;
  padding: 16px;
}

.pageTitle .titlePanel {
  width: min(980px, 100%);
  border: 1px solid rgba(124, 176, 255, 0.42);
  border-radius: 28px;
  padding: clamp(18px, 3.6vw, 36px);
  text-align: left;
  background:
    radial-gradient(circle at 86% 12%, rgba(255, 227, 152, 0.2), transparent 36%),
    linear-gradient(170deg, rgba(14, 28, 56, 0.92), rgba(7, 15, 31, 0.95));
  box-shadow:
    0 28px 60px rgba(2, 9, 22, 0.55),
    inset 0 0 0 1px rgba(170, 204, 255, 0.12);
}

.pageTitle .titleKicker {
  margin: 0 0 10px;
  font-size: 11px;
  letter-spacing: 2px;
  color: #9cc5ff;
  text-transform: uppercase;
}

.pageTitle .titleMain {
  margin: 0;
  font-size: clamp(44px, 10vw, 102px);
  line-height: 0.95;
  letter-spacing: 2px;
  color: #eaf3ff;
  text-shadow: 0 8px 30px rgba(84, 168, 255, 0.35);
}

.pageTitle .titleSub {
  margin: 12px 0 0;
  max-width: 38ch;
  color: #cde0ff;
  font-size: clamp(14px, 2.2vw, 20px);
  line-height: 1.5;
}

.pageTitle .titleStage {
  margin-top: 20px;
  width: 100%;
  height: clamp(220px, 44vw, 360px);
  border-radius: 24px;
  border: 1px solid rgba(122, 170, 242, 0.45);
  background:
    radial-gradient(circle at 20% 15%, rgba(124, 213, 255, 0.2), transparent 36%),
    radial-gradient(circle at 85% 78%, rgba(255, 138, 161, 0.18), transparent 30%),
    linear-gradient(180deg, rgba(25, 42, 78, 0.78), rgba(11, 20, 40, 0.92));
  box-shadow: inset 0 0 30px rgba(13, 22, 44, 0.66);
}

.pageTitle .titleOrb {
  position: absolute;
  border-radius: 999px;
  filter: blur(2px);
}

.pageTitle .titleOrbA {
  width: 90px;
  height: 90px;
  left: 14px;
  top: 14px;
  background: radial-gradient(circle, rgba(133, 223, 255, 0.8), rgba(95, 151, 255, 0.18));
}

.pageTitle .titleOrbB {
  width: 120px;
  height: 120px;
  right: 22px;
  top: 30px;
  background: radial-gradient(circle, rgba(255, 197, 129, 0.76), rgba(255, 121, 152, 0.16));
}

.pageTitle .titleOrbC {
  width: 70px;
  height: 70px;
  right: 90px;
  bottom: 22px;
  background: radial-gradient(circle, rgba(167, 171, 255, 0.72), rgba(129, 93, 255, 0.12));
}

.pageTitle .versusStage {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  grid-template-columns: 1fr auto 1fr;
  gap: 18px;
  padding: 14px;
}

.pageTitle .mascotCard {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 12px;
  border-radius: 20px;
  border: 1px solid rgba(164, 203, 255, 0.45);
  background: linear-gradient(170deg, rgba(22, 41, 74, 0.8), rgba(10, 21, 45, 0.88));
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.3);
}

.pageTitle .mascotCard img {
  width: clamp(100px, 18vw, 148px);
  height: clamp(100px, 18vw, 148px);
  border-radius: 50%;
  border: 2px solid rgba(223, 238, 255, 0.75);
}

.pageTitle .mascotCard span {
  font-size: 12px;
  letter-spacing: 1px;
  color: #dcecff;
  font-weight: 700;
}

.pageTitle .catSide {
  transform: rotate(-4deg);
}

.pageTitle .dogSide {
  transform: rotate(4deg);
}

.pageTitle .vsBadge {
  display: grid;
  place-items: center;
  width: 66px;
  height: 66px;
  border-radius: 50%;
  border: 2px solid rgba(255, 227, 173, 0.75);
  color: #fff3d2;
  font-size: 20px;
  font-weight: 800;
  background: radial-gradient(circle at 35% 30%, #ffce74, #cf7c3f 58%, #8c4a1d);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.34);
}

.pageTitle .titleActions {
  margin-top: 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.pageTitle .titleBtn {
  min-width: 240px;
  padding: 13px 18px;
  border-radius: 14px;
  text-align: center;
  font-weight: 800;
  letter-spacing: 0.4px;
}

.pageTitle .titleBtnPrimary {
  border: 1px solid rgba(164, 228, 255, 0.8);
  background: linear-gradient(180deg, #2f91d2, #1a5f9b);
  box-shadow: 0 12px 26px rgba(20, 94, 162, 0.35);
}

.pageTitle .titleBtnPrimary:hover {
  background: linear-gradient(180deg, #46a8e7, #2574b5);
}

.pageTitle .titleHint {
  margin: 0;
  color: #aec8ee;
  font-size: 12px;
}

.pageDeck {
  background:
    radial-gradient(circle at 8% 16%, rgba(120, 203, 255, 0.22), transparent 30%),
    radial-gradient(circle at 85% 84%, rgba(255, 146, 167, 0.2), transparent 36%),
    linear-gradient(165deg, #071226 0%, #102345 54%, #081325 100%);
}

.pageDeck .deckApp {
  max-width: 1280px;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
  gap: 14px;
}

.pageDeck .panel {
  border-radius: 20px;
  border: 1px solid rgba(121, 165, 238, 0.42);
  background:
    radial-gradient(circle at 82% 12%, rgba(255, 230, 170, 0.12), transparent 30%),
    linear-gradient(170deg, rgba(15, 29, 58, 0.88), rgba(8, 16, 34, 0.94));
  box-shadow:
    0 22px 46px rgba(1, 9, 24, 0.45),
    inset 0 0 0 1px rgba(153, 195, 255, 0.08);
  padding: 14px;
}

.pageDeck .deckHeader h1 {
  margin-bottom: 4px;
  font-size: clamp(26px, 4vw, 34px);
  color: #eef5ff;
}

.pageDeck .deckKicker {
  margin: 0 0 6px;
  font-size: 11px;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  color: #92b8ef;
}

.pageDeck .sub {
  margin-bottom: 12px;
  color: #c5d9f8;
}

.pageDeck .deckStats {
  margin-bottom: 10px;
  gap: 8px;
}

.pageDeck .deckChip {
  display: grid;
  gap: 4px;
  justify-items: start;
  padding: 9px 10px;
  border-radius: 12px;
  border-color: rgba(121, 171, 248, 0.75);
  background: linear-gradient(180deg, rgba(17, 34, 67, 0.92), rgba(10, 21, 45, 0.94));
}

.pageDeck .deckChip strong {
  font-size: 22px;
  line-height: 1;
  color: #f3f7ff;
}

.pageDeck .chipLabel {
  font-size: 10px;
  letter-spacing: 1px;
  color: #8cb2e6;
}

.pageDeck #deckStatus.statusGood {
  color: #7cf7b7;
}

.pageDeck #deckStatus.statusBad {
  color: #ff9595;
}

.pageDeck .deckTools {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.pageDeck .deckTools button {
  flex: 1;
  min-height: 38px;
  border-radius: 12px;
}

.pageDeck .deckCatalogLane {
  min-height: 0;
  padding: 10px;
  border-radius: 14px;
  border: 1px solid rgba(92, 132, 204, 0.58);
  background: linear-gradient(180deg, rgba(9, 19, 40, 0.72), rgba(9, 18, 38, 0.84));
}

.pageDeck .deckSectionHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.pageDeck .deckSectionHead h3 {
  margin: 0;
  font-size: 13px;
  color: #d8e7ff;
}

.pageDeck .deckSectionHead span {
  font-size: 11px;
  color: #99b6df;
}

.pageDeck .catalog {
  display: grid;
  gap: 8px;
  max-height: min(64vh, 720px);
  overflow: auto;
  padding-right: 4px;
}

.pageDeck .catalogRow {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid rgba(97, 146, 225, 0.56);
  background:
    radial-gradient(circle at 92% 18%, rgba(146, 198, 255, 0.2), transparent 32%),
    linear-gradient(170deg, rgba(18, 37, 72, 0.88), rgba(10, 21, 44, 0.94));
}

.pageDeck .catalogRow strong {
  color: #eef5ff;
  font-size: 14px;
}

.pageDeck .catalogMeta {
  margin-top: 4px;
  font-size: 11px;
  color: #a9c2e8;
  line-height: 1.4;
}

.pageDeck .catalogRowLocked {
  border-color: rgba(186, 120, 134, 0.5);
  background:
    radial-gradient(circle at 92% 18%, rgba(255, 181, 193, 0.12), transparent 32%),
    linear-gradient(170deg, rgba(55, 29, 42, 0.72), rgba(20, 13, 25, 0.88));
}

.pageDeck .catalogLock {
  margin-top: 5px;
  font-size: 10px;
  color: #ffbfca;
}

.pageDeck .rowControls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.pageDeck .rowControls button {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 10px;
  font-size: 16px;
  line-height: 1;
}

.pageDeck .qty {
  min-width: 36px;
  text-align: center;
  font-weight: 800;
  font-size: 15px;
  color: #f0f7ff;
  padding: 4px 8px;
  border-radius: 10px;
  border: 1px solid rgba(121, 168, 238, 0.7);
  background: rgba(10, 23, 47, 0.82);
}

.pageDeck .deckSidePanel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 10px;
}

.pageDeck .deckSummaryLog {
  min-height: min(54vh, 560px);
  max-height: min(62vh, 680px);
  padding: 10px;
  border-radius: 14px;
  border-color: rgba(105, 148, 220, 0.64);
  background: rgba(8, 16, 34, 0.82);
}

.pageDeck .deckSummaryLog > div {
  padding: 6px 8px;
  border-bottom: 1px solid rgba(103, 138, 200, 0.24);
  font-size: 13px;
  color: #d7e7ff;
}

.pageDeck .deckSummaryLog > div:last-child {
  border-bottom: none;
}

.pageDeck .small {
  color: #98b7e3;
  font-size: 12px;
}

.pageDeck .cpuDifficultyPanel {
  display: grid;
  gap: 8px;
  padding: 10px;
  border-radius: 14px;
  border: 1px solid rgba(106, 150, 224, 0.56);
  background:
    radial-gradient(circle at 86% 16%, rgba(122, 190, 255, 0.14), transparent 38%),
    linear-gradient(172deg, rgba(13, 26, 54, 0.86), rgba(8, 17, 36, 0.9));
}

.pageDeck .cpuDifficultyHead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.pageDeck .cpuDifficultyHead strong {
  font-size: 13px;
  color: #e7f1ff;
}

.pageDeck #cpuDifficultyCurrent {
  font-size: 11px;
  color: #92c3ff;
}

.pageDeck .cpuDifficultyPicker {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.pageDeck .cpuDifficultyOption {
  position: relative;
  display: grid;
  gap: 2px;
  padding: 8px 10px;
  border-radius: 11px;
  border: 1px solid rgba(96, 139, 208, 0.56);
  background: rgba(11, 24, 50, 0.78);
  cursor: pointer;
  transition: border-color 140ms ease, transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.pageDeck .cpuDifficultyOption:hover {
  border-color: rgba(147, 197, 255, 0.72);
  transform: translateY(-1px);
}

.pageDeck .cpuDifficultyOption input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.pageDeck .cpuDifficultySize {
  font-size: 12px;
  font-weight: 800;
  color: #ecf5ff;
}

.pageDeck .cpuDifficultyAnimal {
  font-size: 11px;
  color: #9fc0eb;
}

.pageDeck .cpuDifficultyOption.isActive {
  border-color: rgba(122, 237, 255, 0.88);
  background:
    radial-gradient(circle at 88% 22%, rgba(130, 223, 255, 0.22), transparent 44%),
    rgba(14, 34, 67, 0.88);
  box-shadow: 0 8px 20px rgba(40, 136, 212, 0.25);
}

.pageDeck .cpuDifficultyHint {
  margin: 0;
  font-size: 10px;
  color: #86addf;
}

.pageDeck .deckLaunchActions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.pageDeck .deckLaunchActions button {
  min-height: 44px;
  border-radius: 12px;
  font-weight: 800;
}

.pageDeck #startGameBtn {
  border-color: rgba(98, 237, 255, 0.9);
  box-shadow: 0 10px 22px rgba(36, 134, 219, 0.24);
}

.pageDeck #startPvpBtn {
  border-color: rgba(255, 203, 118, 0.74);
  box-shadow: 0 10px 22px rgba(156, 100, 20, 0.24);
}

@media (max-width: 980px) {
  .pageTitle .titlePanel {
    border-radius: 22px;
  }

  .pageTitle .versusStage {
    gap: 10px;
  }

  .pageDeck .deckApp {
    grid-template-columns: 1fr;
  }

  .pageDeck .deckSummaryLog {
    min-height: 220px;
    max-height: 300px;
  }
}

@media (max-width: 760px) {
  .pageTitle .titleWrap {
    padding: 10px;
  }

  .pageTitle .titlePanel {
    padding: 14px;
    border-radius: 18px;
  }

  .pageTitle .titleSub {
    font-size: 14px;
  }

  .pageTitle .titleStage {
    height: 220px;
    border-radius: 16px;
  }

  .pageTitle .mascotCard {
    padding: 8px;
    border-radius: 14px;
  }

  .pageTitle .mascotCard img {
    width: 82px;
    height: 82px;
  }

  .pageTitle .vsBadge {
    width: 48px;
    height: 48px;
    font-size: 16px;
  }

  .pageTitle .titleBtn {
    min-width: 0;
    width: 100%;
  }

  .pageDeck {
    padding: 8px;
  }

  .pageDeck .panel {
    padding: 10px;
    border-radius: 14px;
  }

  .pageDeck .deckStats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pageDeck .deckChip strong {
    font-size: 18px;
  }

  .pageDeck .deckTools {
    gap: 6px;
  }

  .pageDeck .deckTools button,
  .pageDeck .deckLaunchActions button {
    min-height: 40px;
    font-size: 12px;
  }

  .pageDeck .catalog {
    max-height: 46vh;
  }

  .pageDeck .catalogRow {
    padding: 8px;
    gap: 8px;
  }

  .pageDeck .catalogRow strong {
    font-size: 13px;
  }

  .pageDeck .catalogMeta {
    font-size: 10px;
  }

  .pageDeck .rowControls button {
    width: 30px;
    height: 30px;
  }

  .pageDeck .qty {
    min-width: 32px;
    font-size: 13px;
  }

  .pageDeck .cpuDifficultyPanel {
    padding: 9px;
    gap: 7px;
  }

  .pageDeck .cpuDifficultyPicker {
    grid-template-columns: 1fr;
  }

  .pageDeck .deckLaunchActions {
    grid-template-columns: 1fr;
  }
}

/* ===== battle smartphone reset ===== */

@media (max-width: 760px) {
  .battleApp.compact {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .battleApp.compact .battleMainPanel {
    padding: 6px;
    border-radius: 14px;
  }

  .battleApp.compact .battleArena {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 6px;
    overflow: visible;
  }

  .battleApp.compact .status,
  .battleApp.compact .battleHud {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    margin-bottom: 0;
  }

  .battleApp.compact .chip {
    min-height: 30px;
    padding: 4px 5px;
    border-radius: 9px;
  }

  .battleApp.compact .chipIcon {
    width: 14px;
    height: 14px;
    font-size: 8px;
  }

  .battleApp.compact .battleHud .chip strong,
  .battleApp.compact .missionChip strong {
    font-size: 12px;
  }

  .battleApp.compact .missionChip {
    display: inline-flex;
    min-height: 28px;
    padding: 4px 8px;
    border-radius: 9px;
  }

  .battleApp.compact .leaderRow {
    margin: 0;
    gap: 4px;
  }

  .battleApp.compact .leaderTop,
  .battleApp.compact .leaderBottom {
    margin: 0;
  }

  .battleApp.compact .leaderCard {
    min-height: 44px;
    padding: 4px 6px;
    border-radius: 10px;
  }

  .battleApp.compact .leaderMascot {
    width: 28px;
    height: 28px;
  }

  .battleApp.compact .leaderVitals {
    gap: 4px;
  }

  .battleApp.compact .hpBadge {
    min-width: 24px;
    padding: 2px 6px;
    font-size: 11px;
  }

  .battleApp.compact .board {
    gap: 4px;
    margin-bottom: 0;
  }

  .battleApp.compact .lane {
    min-height: 0;
    padding: 4px;
    border-radius: 10px;
  }

  .battleApp.compact .lane h3 {
    display: none;
  }

  .battleApp.compact .boardRow,
  .battleApp.compact .hand {
    gap: 4px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 2px 0 4px;
    scroll-snap-type: x proximity;
    scroll-padding-left: 2px;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
  }

  .battleApp.compact .boardRow > *,
  .battleApp.compact .hand > * {
    scroll-snap-align: start;
  }

  .battleApp.compact .battleCard,
  .battleApp.compact .emptySlot {
    width: 68px;
    min-height: 94px;
    padding: 3px;
    gap: 3px;
    border-radius: 9px;
  }

  .battleApp.compact #hand .battleCard,
  .battleApp.compact .hand .battleCard {
    width: 72px;
    min-height: 98px;
  }

  .battleApp.compact .cardName {
    font-size: 8px;
    max-height: 2.1em;
  }

  .battleApp.compact .costOrb {
    min-width: 16px;
    height: 16px;
    font-size: 9px;
  }

  .battleApp.compact .cardArt {
    min-height: 38px;
    padding: 3px;
  }

  .battleApp.compact .artSigil {
    width: 12px;
    height: 12px;
    font-size: 7px;
  }

  .battleApp.compact .cardBottom {
    gap: 3px;
  }

  .battleApp.compact .stat {
    min-width: 16px;
    font-size: 8px;
    padding: 1px 3px;
  }

  .battleApp.compact .keymark {
    width: 11px;
    height: 11px;
    font-size: 7px;
  }

  .battleApp.compact .evoBtn {
    margin-top: 2px;
    min-height: 0;
    padding: 3px 2px;
    font-size: 8px;
  }

  .battleApp.compact .handLane {
    margin: 0;
  }

  .battleApp.compact .hand {
    min-height: 96px;
    padding: 4px;
    border-radius: 9px;
  }

  .battleApp.compact .miniInfoBtn {
    width: 15px;
    height: 15px;
    right: 3px;
    bottom: 3px;
    font-size: 8px;
  }

  .battleApp.compact .cardInspect {
    margin: 0;
    min-height: 22px;
    padding: 3px 6px;
    border-radius: 8px;
  }

  .battleApp.compact .inspectTitle {
    display: none;
  }

  .battleApp.compact .inspectText {
    font-size: 9px;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .battleApp.compact .actions {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 6px;
    align-items: center;
    margin-top: 0;
  }

  .battleApp.compact .actions button {
    min-height: 34px;
    padding: 0 10px;
    font-size: 11px;
    border-radius: 12px;
  }

  .battleApp.compact #endTurnBtn {
    min-width: 0;
  }

  .battleApp.compact #resetBtn,
  .battleApp.compact #logOpenBtn {
    min-width: 52px;
  }

  .battleApp.compact .mobileLogBtn {
    position: static;
    right: auto;
    bottom: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    min-width: 52px;
    min-height: 34px;
    box-shadow: none;
    font-size: 11px;
  }

  .battleApp.compact .battleLogPanel {
    display: none;
  }
}

@media (max-width: 430px) {
  .battleApp.compact .battleCard,
  .battleApp.compact .emptySlot {
    width: 64px;
    min-height: 90px;
  }

  .battleApp.compact #hand .battleCard,
  .battleApp.compact .hand .battleCard {
    width: 68px;
    min-height: 94px;
  }

  .battleApp.compact .chip {
    min-height: 28px;
    padding: 3px 4px;
  }

  .battleApp.compact .battleHud .chip strong {
    font-size: 11px;
  }

  .battleApp.compact .actions button {
    min-height: 32px;
    padding: 0 8px;
    font-size: 10px;
  }
}

/* ===== battle polish refresh ===== */

.pageBattle {
  font-family: "Hiragino Sans", "Yu Gothic", "Meiryo", sans-serif;
  position: relative;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 18% 16%, rgba(86, 128, 255, 0.18), transparent 22%),
    radial-gradient(circle at 84% 12%, rgba(255, 120, 135, 0.14), transparent 18%),
    radial-gradient(circle at 52% 58%, rgba(84, 208, 255, 0.1), transparent 30%),
    linear-gradient(180deg, #08101f 0%, #0a1731 42%, #091325 100%);
}

.pageBattle::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 36%, rgba(109, 179, 255, 0.18), transparent 28%),
    linear-gradient(120deg, rgba(255, 255, 255, 0.03), transparent 40%, rgba(255, 255, 255, 0.02) 60%, transparent 72%);
  mix-blend-mode: screen;
  opacity: 0.9;
}

.pageBattle button {
  font-family: inherit;
}

.pageBattle .battleMainPanel {
  background:
    linear-gradient(180deg, rgba(14, 26, 49, 0.88), rgba(8, 16, 33, 0.94)),
    radial-gradient(circle at top, rgba(116, 176, 255, 0.1), transparent 36%);
  border-color: rgba(101, 146, 217, 0.52);
  box-shadow:
    0 20px 48px rgba(3, 7, 20, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.pageBattle .battleArena {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  border-color: rgba(113, 170, 255, 0.52);
  background:
    radial-gradient(circle at 50% 48%, rgba(86, 135, 255, 0.22), transparent 32%),
    radial-gradient(circle at 16% 18%, rgba(255, 130, 138, 0.16), transparent 18%),
    radial-gradient(circle at 86% 82%, rgba(86, 220, 255, 0.12), transparent 20%),
    linear-gradient(180deg, rgba(7, 18, 37, 0.92), rgba(8, 18, 35, 0.98));
  box-shadow:
    inset 0 0 0 1px rgba(171, 214, 255, 0.05),
    inset 0 0 42px rgba(4, 9, 26, 0.72),
    0 16px 38px rgba(2, 7, 18, 0.42);
}

.pageBattle .battleArena::before {
  content: "";
  position: absolute;
  inset: -12%;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 52%, rgba(117, 189, 255, 0.12), transparent 22%),
    repeating-linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.028),
      rgba(255, 255, 255, 0.028) 2px,
      transparent 2px,
      transparent 14px
    );
  opacity: 0.72;
  animation: battleArenaDrift 18s linear infinite;
  z-index: 0;
}

.pageBattle .battleArena::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), transparent 22%, transparent 78%, rgba(255, 255, 255, 0.03)),
    radial-gradient(circle at 50% 52%, rgba(255, 255, 255, 0.06), transparent 34%);
  z-index: 0;
}

.pageBattle .battleArena > * {
  position: relative;
  z-index: 1;
}

.pageBattle .battleHud .chip,
.pageBattle .missionChip {
  border-color: rgba(123, 176, 255, 0.62);
  background:
    linear-gradient(180deg, rgba(12, 30, 61, 0.9), rgba(8, 19, 40, 0.94)),
    radial-gradient(circle at top, rgba(146, 205, 255, 0.14), transparent 68%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 10px 18px rgba(4, 10, 26, 0.28);
  backdrop-filter: blur(8px);
}

.pageBattle .battleHud .chip strong,
.pageBattle .missionChip strong {
  text-shadow: 0 0 12px rgba(153, 208, 255, 0.22);
}

.pageBattle .leaderCard {
  backdrop-filter: blur(10px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 12px 28px rgba(3, 8, 22, 0.34);
}

.pageBattle .leaderCard.enemyLeader {
  box-shadow:
    inset 0 1px 0 rgba(255, 240, 240, 0.08),
    0 14px 28px rgba(55, 13, 20, 0.32);
}

.pageBattle .leaderCard.playerLeader {
  box-shadow:
    inset 0 1px 0 rgba(233, 247, 255, 0.09),
    0 14px 28px rgba(8, 28, 68, 0.3);
}

.pageBattle .leaderMascot {
  box-shadow:
    inset 0 0 16px rgba(255, 255, 255, 0.18),
    0 0 0 2px rgba(255, 255, 255, 0.07),
    0 6px 16px rgba(0, 0, 0, 0.28);
}

.pageBattle .hpBadge {
  min-width: 34px;
  background:
    linear-gradient(180deg, rgba(242, 132, 149, 0.96), rgba(131, 41, 58, 0.94)),
    radial-gradient(circle at 30% 22%, rgba(255, 255, 255, 0.16), transparent 50%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    0 8px 16px rgba(73, 18, 29, 0.28);
}

.pageBattle .playerLeader .hpBadge {
  background:
    linear-gradient(180deg, rgba(109, 176, 255, 0.96), rgba(34, 78, 144, 0.94)),
    radial-gradient(circle at 30% 22%, rgba(255, 255, 255, 0.14), transparent 50%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    0 8px 16px rgba(15, 35, 77, 0.28);
}

.pageBattle .lane {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(10, 20, 39, 0.74), rgba(7, 14, 28, 0.82)),
    radial-gradient(circle at center, rgba(110, 174, 255, 0.08), transparent 55%);
  box-shadow:
    inset 0 0 0 1px rgba(160, 205, 255, 0.03),
    inset 0 18px 28px rgba(255, 255, 255, 0.015);
}

.pageBattle .enemyLane::before,
.pageBattle .playerLane::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.9;
}

.pageBattle .enemyLane::before {
  background: linear-gradient(90deg, rgba(188, 75, 98, 0.1), transparent 30%, transparent 70%, rgba(188, 75, 98, 0.08));
}

.pageBattle .playerLane::before {
  background: linear-gradient(90deg, rgba(76, 148, 227, 0.12), transparent 30%, transparent 70%, rgba(76, 148, 227, 0.08));
}

.pageBattle .boardRow,
.pageBattle .hand {
  padding-right: 8px;
}

.pageBattle .battleCard {
  border-color: rgba(124, 171, 248, 0.68);
  background:
    linear-gradient(180deg, rgba(35, 59, 106, 0.95), rgba(15, 27, 51, 0.97)),
    radial-gradient(circle at top, rgba(153, 215, 255, 0.1), transparent 60%);
  box-shadow:
    0 10px 22px rgba(4, 10, 28, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.pageBattle .battleCard::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.18), transparent 28%, transparent 72%, rgba(255, 255, 255, 0.05));
}

.pageBattle .battleCard:hover {
  transform: translateY(-3px);
  box-shadow:
    0 14px 28px rgba(4, 10, 28, 0.42),
    0 0 18px rgba(106, 170, 255, 0.16);
}

.pageBattle .emptySlot {
  border-color: rgba(94, 138, 209, 0.7);
  background:
    linear-gradient(180deg, rgba(12, 23, 44, 0.76), rgba(8, 17, 34, 0.92)),
    radial-gradient(circle at center, rgba(110, 174, 255, 0.07), transparent 58%);
}

.pageBattle .costOrb,
.pageBattle .stat,
.pageBattle .miniInfoBtn {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    0 4px 10px rgba(4, 10, 26, 0.24);
}

.pageBattle .cardInspect {
  background:
    linear-gradient(180deg, rgba(8, 18, 36, 0.96), rgba(5, 12, 24, 0.98)),
    radial-gradient(circle at 30% 0, rgba(111, 180, 255, 0.08), transparent 45%);
  border-color: rgba(102, 152, 230, 0.68);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 10px 20px rgba(2, 8, 20, 0.28);
}

.pageBattle .inspectText {
  color: #eef5ff;
  letter-spacing: 0.01em;
}

.pageBattle .actions button {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.09),
    0 10px 20px rgba(4, 10, 26, 0.24);
}

.pageBattle #endTurnBtn {
  background:
    linear-gradient(180deg, rgba(52, 140, 255, 0.96), rgba(26, 76, 167, 0.98)),
    radial-gradient(circle at 50% 0, rgba(255, 255, 255, 0.16), transparent 40%);
  border-color: rgba(116, 218, 255, 0.95);
  text-shadow: 0 0 12px rgba(209, 241, 255, 0.24);
}

.pageBattle #resetBtn,
.pageBattle #logOpenBtn {
  background:
    linear-gradient(180deg, rgba(26, 49, 88, 0.96), rgba(16, 30, 53, 0.98)),
    radial-gradient(circle at top, rgba(152, 202, 255, 0.08), transparent 62%);
}

@keyframes battleArenaDrift {
  0% {
    transform: translate3d(-1.5%, 0, 0) rotate(0deg);
  }
  50% {
    transform: translate3d(1.5%, -1%, 0) rotate(0.4deg);
  }
  100% {
    transform: translate3d(-1.5%, 0, 0) rotate(0deg);
  }
}

@media (max-width: 760px) {
  .pageBattle .battleApp.compact .battleMainPanel {
    padding: 5px;
    border-radius: 14px;
  }

  .pageBattle .battleApp.compact .battleArena {
    gap: 5px;
    padding: 5px;
    border-radius: 12px;
  }

  .pageBattle .battleApp.compact .chip {
    min-height: 28px;
    padding: 3px 4px;
  }

  .pageBattle .battleApp.compact .chipIcon {
    width: 13px;
    height: 13px;
    font-size: 8px;
  }

  .pageBattle .battleApp.compact .battleHud .chip strong {
    font-size: 11px;
  }

  .pageBattle .battleApp.compact .missionChip {
    display: inline-flex;
    width: 100%;
    min-height: 26px;
    padding: 4px 8px;
    border-radius: 10px;
  }

  .pageBattle .battleApp.compact .missionChip strong {
    font-size: 10px;
    line-height: 1.2;
  }

  .pageBattle .battleApp.compact .resultBanner {
    margin-bottom: 2px;
    padding: 4px 8px;
    border-radius: 8px;
  }

  .pageBattle .battleApp.compact .resultBanner strong {
    font-size: 10px;
  }

  .pageBattle .battleApp.compact .resultBanner span {
    font-size: 9px;
  }

  .pageBattle .battleApp.compact .leaderCard {
    min-height: 42px;
    padding: 4px 8px;
  }

  .pageBattle .battleApp.compact .leaderMascot {
    width: 29px;
    height: 29px;
  }

  .pageBattle .battleApp.compact .hpBadge {
    min-width: 28px;
    padding: 2px 6px;
    font-size: 11px;
  }

  .pageBattle .battleApp.compact .boardRow,
  .pageBattle .battleApp.compact .hand {
    gap: 5px;
    padding: 2px 8px 5px 0;
    scrollbar-width: none;
  }

  .pageBattle .battleApp.compact .boardRow::-webkit-scrollbar,
  .pageBattle .battleApp.compact .hand::-webkit-scrollbar {
    display: none;
  }

  .pageBattle .battleApp.compact .battleCard,
  .pageBattle .battleApp.compact .emptySlot {
    width: 66px;
    min-height: 92px;
    border-radius: 10px;
  }

  .pageBattle .battleApp.compact #hand .battleCard,
  .pageBattle .battleApp.compact .hand .battleCard {
    width: 70px;
    min-height: 96px;
  }

  .pageBattle .battleApp.compact .cardInspect {
    min-height: 34px;
    padding: 4px 8px;
    border-radius: 9px;
  }

  .pageBattle .battleApp.compact .inspectText {
    font-size: 10px;
    line-height: 1.3;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    display: block;
    max-height: 7.8em;
    overflow-y: auto;
    padding-right: 2px;
  }

  .pageBattle .battleApp.compact .actions {
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 5px;
  }

  .pageBattle .battleApp.compact .actions button {
    min-height: 32px;
    padding: 0 9px;
    font-size: 10px;
    border-radius: 11px;
  }

  .pageBattle .battleApp.compact #resetBtn,
  .pageBattle .battleApp.compact #logOpenBtn,
  .pageBattle .battleApp.compact .mobileLogBtn {
    min-width: 46px;
  }
}

@media (max-width: 430px) {
  .pageBattle .battleApp.compact .battleCard,
  .pageBattle .battleApp.compact .emptySlot {
    width: 62px;
    min-height: 88px;
  }

  .pageBattle .battleApp.compact #hand .battleCard,
  .pageBattle .battleApp.compact .hand .battleCard {
    width: 66px;
    min-height: 92px;
  }

  .pageBattle .battleApp.compact .cardName {
    font-size: 8px;
  }

  .pageBattle .battleApp.compact .inspectText {
    font-size: 9px;
  }

  .pageBattle .battleApp.compact .missionChip strong {
    font-size: 9px;
  }
}

/* ===== reference arena layout ===== */

.pageBattle .battleApp.referenceLayout {
  grid-template-columns: minmax(0, 1fr);
  max-width: min(98vw, 1540px);
  gap: 0;
}

.pageBattle .battleApp.referenceLayout .battleLogPanel {
  display: none;
}

.pageBattle .battleApp.referenceLayout .battleMainPanel {
  padding: 10px;
  border-radius: 22px;
  border: 1px solid rgba(149, 108, 76, 0.74);
  background:
    radial-gradient(circle at 18% 12%, rgba(255, 212, 165, 0.16), transparent 18%),
    radial-gradient(circle at 84% 16%, rgba(255, 197, 140, 0.1), transparent 16%),
    linear-gradient(160deg, rgba(58, 36, 24, 0.96), rgba(31, 20, 14, 0.98));
  box-shadow:
    inset 0 0 0 2px rgba(216, 164, 108, 0.2),
    0 24px 42px rgba(0, 0, 0, 0.52);
}

.pageBattle .battleApp.referenceLayout .battleArena {
  position: relative;
  min-height: calc(100vh - 52px);
  border-radius: 18px;
  border: 1px solid rgba(214, 171, 122, 0.36);
  padding: 12px 16px;
  overflow: hidden;
  background:
    radial-gradient(circle at 16% 18%, rgba(235, 182, 119, 0.16), transparent 25%),
    radial-gradient(circle at 86% 74%, rgba(252, 224, 185, 0.12), transparent 28%),
    repeating-linear-gradient(
      120deg,
      rgba(66, 44, 31, 0.35) 0,
      rgba(66, 44, 31, 0.35) 3px,
      rgba(53, 34, 24, 0.36) 3px,
      rgba(53, 34, 24, 0.36) 14px
    ),
    linear-gradient(170deg, #4d3122 0%, #392417 48%, #2a1b12 100%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 221, 181, 0.1),
    inset 0 0 60px rgba(0, 0, 0, 0.35);
}

.pageBattle .battleApp.referenceLayout .battleArena::before,
.pageBattle .battleApp.referenceLayout .battleArena::after {
  content: none;
}

.pageBattle .battleApp.referenceLayout .tableFx {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
}

.pageBattle .battleApp.referenceLayout .enemyHandFan {
  position: absolute;
  top: 8px;
  left: 22px;
  display: flex;
  align-items: flex-end;
  min-height: 102px;
}

.pageBattle .battleApp.referenceLayout .enemyHandCardBack {
  --fan-offset: 0;
  width: 68px;
  height: 94px;
  margin-left: -36px;
  border-radius: 8px;
  border: 1px solid rgba(214, 194, 162, 0.75);
  background:
    radial-gradient(circle at 28% 22%, rgba(171, 209, 255, 0.3), transparent 44%),
    repeating-linear-gradient(
      45deg,
      rgba(50, 60, 92, 0.88),
      rgba(50, 60, 92, 0.88) 4px,
      rgba(37, 43, 66, 0.92) 4px,
      rgba(37, 43, 66, 0.92) 8px
    );
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.1),
    0 6px 12px rgba(0, 0, 0, 0.32);
  transform-origin: bottom center;
  transform: rotate(calc(var(--fan-offset) * 14deg));
}

.pageBattle .battleApp.referenceLayout .enemyHandCardBack:first-child {
  margin-left: 0;
}

.pageBattle .battleApp.referenceLayout .enemyHandMore {
  margin-left: 8px;
  margin-bottom: 10px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(241, 231, 199, 0.72);
  background: rgba(17, 22, 32, 0.76);
  color: #fff2c9;
  font-size: 11px;
  font-weight: 700;
}

.pageBattle .battleApp.referenceLayout .cornerCounters {
  position: absolute;
  display: flex;
  gap: 8px;
}

.pageBattle .battleApp.referenceLayout .enemyCounters {
  top: 10px;
  right: 14px;
}

.pageBattle .battleApp.referenceLayout .playerCounters {
  left: 12px;
  bottom: 116px;
}

.pageBattle .battleApp.referenceLayout .counterBox {
  min-width: 72px;
  height: 34px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid rgba(229, 203, 158, 0.64);
  background:
    linear-gradient(180deg, rgba(32, 23, 18, 0.9), rgba(17, 13, 11, 0.95)),
    radial-gradient(circle at top, rgba(255, 243, 221, 0.12), transparent 62%);
  color: #fff6de;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  box-shadow: 0 8px 14px rgba(0, 0, 0, 0.28);
}

.pageBattle .battleApp.referenceLayout .counterIcon {
  font-size: 14px;
  line-height: 1;
}

.pageBattle .battleApp.referenceLayout .counterBox strong {
  font-size: 18px;
  letter-spacing: 0.03em;
}

.pageBattle .battleApp.referenceLayout .leaderBottom .battleHud {
  position: static;
  margin: 0;
  width: auto;
  height: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  z-index: 12;
  pointer-events: none;
}

.pageBattle .battleApp.referenceLayout .leaderBottom .battleHud .chip {
  position: static;
  transform: none;
  min-width: 78px;
  min-height: 40px;
  padding: 5px 9px;
  border-radius: 10px;
  border: 1px solid rgba(232, 206, 160, 0.72);
  background:
    linear-gradient(180deg, rgba(30, 21, 16, 0.88), rgba(15, 11, 9, 0.93)),
    radial-gradient(circle at top, rgba(255, 229, 178, 0.13), transparent 68%);
  color: #ffeec4;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.11),
    0 8px 14px rgba(0, 0, 0, 0.25);
  pointer-events: none;
}

.pageBattle .battleApp.referenceLayout .leaderBottom .battleHud .chipIcon {
  display: none;
}

.pageBattle .battleApp.referenceLayout .leaderBottom .battleHud .chip strong {
  display: grid;
  justify-items: center;
  gap: 1px;
  font-size: 20px;
  font-weight: 700;
  text-shadow: 0 0 10px rgba(255, 219, 156, 0.16);
}

.pageBattle .battleApp.referenceLayout .chipTurn strong::before,
.pageBattle .battleApp.referenceLayout .chipPp strong::before {
  display: block;
  font-size: 10px;
  letter-spacing: 0.08em;
  color: rgba(255, 235, 194, 0.9);
  text-shadow: none;
}

.pageBattle .battleApp.referenceLayout .chipTurn strong::before {
  content: "TURN";
}

.pageBattle .battleApp.referenceLayout .chipPp strong::before {
  content: "PP";
}

.pageBattle .battleApp.referenceLayout .leaderBottom .chipTurn {
  display: none;
}

.pageBattle .battleApp.referenceLayout .leaderBottom .chipPp {
  transform: none;
}

.pageBattle .battleApp.referenceLayout .leaderBottom .chipTurn {
  border-color: rgba(250, 221, 164, 0.88);
}

.pageBattle .battleApp.referenceLayout .leaderBottom .chipPp {
  border-color: rgba(141, 223, 255, 0.88);
}

.pageBattle .battleApp.referenceLayout .chipEnemyHp,
.pageBattle .battleApp.referenceLayout .chipPlayerHp {
  display: none;
}

.pageBattle .battleApp.referenceLayout .missionChip {
  position: absolute;
  top: 92px;
  left: 18px;
  width: auto;
  max-width: 460px;
  min-height: 32px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(246, 223, 165, 0.76);
  background:
    linear-gradient(180deg, rgba(47, 31, 21, 0.92), rgba(23, 16, 12, 0.95)),
    radial-gradient(circle at top, rgba(255, 227, 169, 0.12), transparent 65%);
  z-index: 6;
}

.pageBattle .battleApp.referenceLayout .missionChip strong {
  font-size: 11px;
  line-height: 1.25;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
}

.pageBattle .battleApp.referenceLayout .resultBanner {
  position: absolute;
  top: 56px;
  left: 50%;
  transform: translateX(-50%);
  width: min(560px, 52vw);
  margin: 0;
  z-index: 7;
}

.pageBattle .battleApp.referenceLayout .resultBanner.hidden {
  display: none;
}

.pageBattle .battleApp.referenceLayout .boardStage {
  position: relative;
  min-height: 34vh;
  padding: 10px 0 42px;
  z-index: 4;
}

.pageBattle .battleApp.referenceLayout .board {
  position: relative;
  width: min(72vw, 980px);
  margin: 0 auto;
  min-height: clamp(180px, 24vh, 280px);
  padding: 24px 42px 22px;
  gap: 4px;
  border: 0;
  background: transparent;
}

.pageBattle .battleApp.referenceLayout .board::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid rgba(210, 156, 118, 0.7);
  background:
    radial-gradient(circle at 38% 30%, rgba(255, 231, 194, 0.34), transparent 26%),
    radial-gradient(circle at 72% 68%, rgba(213, 145, 104, 0.18), transparent 35%),
    repeating-radial-gradient(
      circle at 50% 50%,
      rgba(136, 94, 69, 0.2) 0 8px,
      rgba(118, 82, 61, 0.2) 8px 16px,
      rgba(148, 107, 82, 0.2) 16px 22px
    ),
    linear-gradient(170deg, rgba(244, 209, 167, 0.85), rgba(211, 170, 131, 0.86));
  box-shadow:
    inset 0 0 0 2px rgba(255, 234, 202, 0.4),
    inset 0 0 70px rgba(98, 61, 40, 0.34),
    0 16px 26px rgba(0, 0, 0, 0.26);
  z-index: 0;
}

.pageBattle .battleApp.referenceLayout .board::after {
  content: "";
  position: absolute;
  inset: 12px;
  border-radius: 50%;
  border: 1px solid rgba(255, 232, 203, 0.42);
  pointer-events: none;
  z-index: 0;
}

.pageBattle .battleApp.referenceLayout .board .lane {
  position: relative;
  min-height: 90px;
  padding: 0;
  border: 0;
  background: transparent;
  overflow: visible;
  box-shadow: none;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

.pageBattle .battleApp.referenceLayout .board .lane::before {
  content: none;
}

.pageBattle .battleApp.referenceLayout .board .lane .boardRow {
  width: 100%;
}

.pageBattle .battleApp.referenceLayout .board .lane h3 {
  display: none;
}

.pageBattle .battleApp.referenceLayout .playerLane::after {
  content: "\6700\5927\0034\4F53";
  position: absolute;
  right: 8px;
  bottom: -8px;
  font-size: 10px;
  line-height: 1;
  color: rgba(80, 59, 47, 0.7);
  background: rgba(255, 236, 209, 0.58);
  border-radius: 999px;
  padding: 2px 6px;
}

.pageBattle .battleApp.referenceLayout .boardRow {
  justify-content: center;
  gap: 6px;
  overflow-x: auto;
  overflow-y: visible;
  scrollbar-width: none;
  padding: 0 6px 2px;
}

.pageBattle .battleApp.referenceLayout .boardRow::-webkit-scrollbar {
  display: none;
}

.pageBattle .battleApp.referenceLayout .enemyLane .battleCard,
.pageBattle .battleApp.referenceLayout .playerLane .battleCard,
.pageBattle .battleApp.referenceLayout .board .emptySlot {
  width: 112px;
  height: 160px;
  min-height: 160px;
  border-radius: 11px;
}

.pageBattle .battleApp.referenceLayout .leaderRow {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: auto;
  margin: 0;
  z-index: 5;
}

.pageBattle .battleApp.referenceLayout .leaderTop {
  top: 0;
}

.pageBattle .battleApp.referenceLayout .leaderBottom {
  bottom: 2px;
  width: max-content;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  z-index: 12;
}

.pageBattle .battleApp.referenceLayout .leaderCard {
  width: 98px;
  min-height: 98px;
  height: 98px;
  overflow: visible;
  border-radius: 50%;
  padding: 8px;
  border: 2px solid rgba(255, 227, 193, 0.74);
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.14),
    0 16px 26px rgba(0, 0, 0, 0.3);
}

.pageBattle .battleApp.referenceLayout .leaderInner {
  width: 100%;
  height: 100%;
  position: relative;
  justify-content: center;
}

.pageBattle .battleApp.referenceLayout .leaderMascot {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 0;
}

.pageBattle .battleApp.referenceLayout .leaderVitals {
  margin: 0;
  position: absolute;
  right: -18px;
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
}

.pageBattle .battleApp.referenceLayout .leaderTop .leaderVitals {
  top: 6px;
}

.pageBattle .battleApp.referenceLayout .leaderBottom .leaderVitals {
  bottom: 4px;
}

.pageBattle .battleApp.referenceLayout .orderBadge {
  min-width: 34px;
  padding: 2px 6px;
  font-size: 10px;
}

.pageBattle .battleApp.referenceLayout .hpBadge {
  min-width: 40px;
  padding: 4px 8px;
  font-size: 23px;
  border: 2px solid rgba(255, 231, 194, 0.72);
}

.pageBattle .battleApp.referenceLayout .handLane {
  position: absolute;
  left: 50%;
  bottom: 4px;
  transform: translateX(-50%);
  width: min(78vw, 1040px);
  min-height: 132px;
  margin: 0;
  padding: 0 6px;
  border: 0;
  background: transparent;
  z-index: 9;
}

.pageBattle .battleApp.referenceLayout .handLane h3 {
  display: none;
}

.pageBattle .battleApp.referenceLayout .hand {
  justify-content: flex-start;
  align-items: flex-start;
  gap: 6px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0 4px 6px;
  scrollbar-width: none;
}

.pageBattle .battleApp.referenceLayout .hand::-webkit-scrollbar {
  display: none;
}

.pageBattle .battleApp.referenceLayout #hand .battleCard,
.pageBattle .battleApp.referenceLayout .hand .battleCard {
  width: 112px;
  height: 160px;
  min-height: 160px;
  margin-left: 0;
  border-radius: 11px;
  transform: none;
}

.pageBattle .battleApp.referenceLayout #hand .battleCard:hover,
.pageBattle .battleApp.referenceLayout .hand .battleCard:hover {
  transform: translateY(-10px) scale(1.02) !important;
  z-index: 30;
}

.pageBattle .battleApp.referenceLayout .cardInspect {
  position: absolute;
  left: 18px;
  bottom: 116px;
  width: min(340px, 29vw);
  min-height: 58px;
  margin: 0;
  z-index: 8;
}

.pageBattle .battleApp.referenceLayout .actions {
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  width: auto;
  margin: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  z-index: 10;
}

.pageBattle .battleApp.referenceLayout #endTurnBtn {
  width: 106px;
  height: 106px;
  border-radius: 50%;
  border: 2px solid rgba(229, 202, 143, 0.88);
  background:
    radial-gradient(circle at 35% 28%, rgba(150, 222, 255, 0.34), transparent 38%),
    linear-gradient(180deg, rgba(18, 93, 143, 0.96), rgba(9, 48, 89, 0.98));
  color: #e9f8ff;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.1em;
  writing-mode: vertical-rl;
  text-orientation: upright;
  line-height: 1.1;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    inset 0 0 26px rgba(130, 223, 255, 0.24),
    0 18px 30px rgba(0, 0, 0, 0.38);
}

.pageBattle .battleApp.referenceLayout #endTurnBtn:hover {
  transform: translateY(-1px) scale(1.02);
}

.pageBattle .battleApp.referenceLayout #resetBtn,
.pageBattle .battleApp.referenceLayout #logOpenBtn,
.pageBattle .battleApp.referenceLayout .mobileLogBtn {
  min-width: 96px;
  min-height: 30px;
  border-radius: 999px;
  font-size: 12px;
  justify-self: center;
}

@media (max-width: 980px) {
  .pageBattle .battleApp.referenceLayout .battleMainPanel {
    padding: 6px;
    border-radius: 16px;
  }

  .pageBattle .battleApp.referenceLayout .battleArena {
    min-height: auto;
    padding: 5px;
    overflow: visible;
  }

  .pageBattle .battleApp.referenceLayout .tableFx,
  .pageBattle .battleApp.referenceLayout .enemyCounters,
  .pageBattle .battleApp.referenceLayout .playerCounters {
    display: none;
  }

  .pageBattle .battleApp.referenceLayout .missionChip,
  .pageBattle .battleApp.referenceLayout .resultBanner {
    position: static;
    transform: none;
    width: 100%;
    margin-bottom: 4px;
  }

  .pageBattle .battleApp.referenceLayout .leaderBottom {
    position: relative;
    bottom: auto;
    width: max-content;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    justify-self: center;
    z-index: 12;
  }

  .pageBattle .battleApp.referenceLayout .leaderBottom .battleHud {
    position: static;
    inset: auto;
    width: auto;
    height: auto;
    display: flex;
    z-index: 11;
  }

  .pageBattle .battleApp.referenceLayout .leaderBottom .battleHud .chip {
    position: static;
    transform: none;
    min-width: 62px;
    min-height: 34px;
    padding: 4px 6px;
    border-radius: 9px;
  }

  .pageBattle .battleApp.referenceLayout .leaderBottom .chipTurn {
    display: none;
  }

  .pageBattle .battleApp.referenceLayout .leaderBottom .chipPp {
    transform: none;
  }

  .pageBattle .battleApp.referenceLayout .missionChip {
    display: inline-flex;
    max-width: 100%;
    min-height: 26px;
    padding: 4px 8px;
    margin-bottom: 3px;
    border-radius: 10px;
  }

  .pageBattle .battleApp.referenceLayout .leaderBottom .battleHud .chip strong {
    font-size: 14px;
  }

  .pageBattle .battleApp.referenceLayout .chipTurn strong::before,
  .pageBattle .battleApp.referenceLayout .chipPp strong::before {
    font-size: 8px;
  }

  .pageBattle .battleApp.referenceLayout .boardStage {
    min-height: 0;
    padding: 0;
    display: grid;
    gap: 1px;
  }

  .pageBattle .battleApp.referenceLayout .board {
    width: 100%;
    min-height: 0;
    padding: 2px;
    gap: 1px;
    border-radius: 18px;
  }

  .pageBattle .battleApp.referenceLayout .board::before,
  .pageBattle .battleApp.referenceLayout .board::after {
    border-radius: 18px;
  }

  .pageBattle .battleApp.referenceLayout .leaderRow {
    position: static;
    transform: none;
    margin: 0 auto;
  }

  .pageBattle .battleApp.referenceLayout .leaderCard {
    width: 62px;
    min-height: 62px;
    height: 62px;
  }

  .pageBattle .battleApp.referenceLayout .hpBadge {
    min-width: 28px;
    padding: 2px 5px;
    font-size: 16px;
  }

  .pageBattle .battleApp.referenceLayout .orderBadge {
    min-width: 30px;
    font-size: 9px;
  }

  .pageBattle .battleApp.referenceLayout .board .lane h3 {
    display: none;
  }

  .pageBattle .battleApp.referenceLayout .enemyLane .battleCard,
  .pageBattle .battleApp.referenceLayout .playerLane .battleCard,
  .pageBattle .battleApp.referenceLayout .board .emptySlot {
    width: 64px;
    height: 92px;
    min-height: 92px;
  }

  .pageBattle .battleApp.referenceLayout .board .lane {
    min-height: 0;
  }

  .pageBattle .battleApp.referenceLayout .handLane {
    position: static;
    transform: none;
    width: 100%;
    min-height: 0;
  }

  .pageBattle .battleApp.referenceLayout .cardInspect {
    position: static;
    display: block;
    width: 100%;
    min-height: 38px;
    margin: 1px 0 3px;
    padding: 3px 7px;
    border-radius: 8px;
  }

  .pageBattle .battleApp.referenceLayout .inspectTitle {
    font-size: 10px;
    margin-bottom: 1px;
  }

  .pageBattle .battleApp.referenceLayout .inspectText {
    font-size: 9px;
    line-height: 1.2;
    max-height: 3.6em;
    overflow-y: auto;
  }

  .pageBattle .battleApp.referenceLayout .hand {
    justify-content: flex-start;
    align-items: flex-start;
    overflow-x: auto;
    overflow-y: visible;
    padding: 0 0 4px;
    gap: 3px;
  }

  .pageBattle .battleApp.referenceLayout #hand .battleCard,
  .pageBattle .battleApp.referenceLayout .hand .battleCard {
    width: 64px;
    height: 92px;
    min-height: 92px;
    margin-left: 0;
    transform: none;
  }

  .pageBattle .battleApp.referenceLayout #hand .battleCard:hover,
  .pageBattle .battleApp.referenceLayout .hand .battleCard:hover {
    transform: translateY(-6px) scale(1.02) !important;
  }

  .pageBattle .battleApp.referenceLayout .actions {
    position: static;
    transform: none;
    width: 100%;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 3px;
  }

  .pageBattle .battleApp.referenceLayout #endTurnBtn {
    width: 100%;
    height: 33px;
    border-radius: 12px;
    writing-mode: horizontal-tb;
    text-orientation: mixed;
    font-size: 13px;
    letter-spacing: 0.03em;
  }

  .pageBattle .battleApp.referenceLayout #resetBtn,
  .pageBattle .battleApp.referenceLayout #logOpenBtn,
  .pageBattle .battleApp.referenceLayout .mobileLogBtn {
    min-width: 52px;
    min-height: 28px;
  }
}

/* ===== mobile final overrides ===== */
@media (max-width: 980px) {
  .pageBattle .battleApp.referenceLayout .leaderBottom {
    flex-direction: row !important;
    align-items: center !important;
    gap: 6px !important;
  }

  .pageBattle .battleApp.referenceLayout .leaderBottom .chipTurn {
    display: none !important;
  }

  .pageBattle .battleApp.referenceLayout .leaderBottom .chipPp {
    display: inline-flex !important;
    margin: 0 !important;
    transform: none !important;
  }

  .pageBattle .battleApp.referenceLayout .boardStage {
    padding: 0 !important;
    gap: 0 !important;
  }

  .pageBattle .battleApp.referenceLayout .board {
    padding: 2px !important;
    gap: 0 !important;
  }

  .pageBattle .battleApp.referenceLayout .boardRow {
    gap: 2px !important;
    padding: 0 2px 2px !important;
  }

  .pageBattle .battleApp.referenceLayout .enemyLane .battleCard,
  .pageBattle .battleApp.referenceLayout .playerLane .battleCard,
  .pageBattle .battleApp.referenceLayout .board .emptySlot,
  .pageBattle .battleApp.referenceLayout #hand .battleCard,
  .pageBattle .battleApp.referenceLayout .hand .battleCard {
    width: 64px !important;
    height: 92px !important;
    min-height: 92px !important;
  }
}
