.online-lobby { display: grid; gap: 14px; margin-block: 0 19px; max-width: 1180px; }
.online-intro { display: flex; align-items: start; justify-content: space-between; gap: 14px; }
.online-intro h2 { margin-block: 2px 6px; }
.online-entry { display: flex; flex-wrap: wrap; align-items: end; gap: 9px; }
.online-entry label { display: grid; gap: 4px; flex: 1 1 180px; color: #f0d4b0; font-size: 13px; }
.online-entry input, .online-entry select, .dialog-inner > input {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 7px 10px;
  border: 1px solid #8d6c4c;
  border-radius: 5px;
  color: #fbe7ca;
  background: #191714;
  font: inherit;
}
.online-entry input::placeholder { color: #ab9582; }
.online-invite-entry { padding-top: 12px; border-top: 1px solid #8a6c4a65; }
.online-notice { color: #ffce93; font-size: 13px; }
.online-replay-entry { border-top: 1px solid #8a6c4a65; padding-top: 10px; }
.online-replay-entry summary { color: #ead0a7; cursor: pointer; }
.online-replay-entry .online-entry { margin-top: 8px; }
.online-waiting { width: min(100%, 610px); margin: 14px auto; }
.online-search-status { display: flex; align-items: center; gap: 10px; color: #f0d4b0; }
.online-search-status > span {
  width: 14px;
  height: 14px;
  border: 2px solid #8d6c4c;
  border-top-color: #fae5b1;
  border-radius: 50%;
  animation: online-search 1s linear infinite;
}
@keyframes online-search { to { transform: rotate(1turn); } }
@media (prefers-reduced-motion: reduce) {
  .online-search-status > span { animation: none; }
}
.online-code { font: 800 clamp(24px, 5vw, 38px)/1.1 var(--numbers); letter-spacing: .08em; overflow-wrap: anywhere; }
.online-members { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.online-members li { display: flex; flex-wrap: wrap; gap: 12px; padding: 9px; border-top: 1px solid #9d785658; }
.online-members li span:last-child { margin-inline-start: auto; color: #d8ba99; }
.online-match-strip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  color: #d6ecc9;
  font-size: 12px;
}
.online-match-strip strong { color: #a8e5ef; }
.online-match-strip .btn { min-height: 29px; padding: 2px 6px; font-size: 11px; }
.replay-controls { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 7px; }
.replay-controls h2 { font-size: 16px; }
.replay-controls label { display: flex; align-items: center; gap: 8px; width: 100%; color: #ebd7b8; }
.replay-controls input { flex: 1 1 auto; min-width: 0; accent-color: #c4945a; }
.replay-buttons { display: flex; flex-wrap: wrap; gap: 6px; }
.replay-buttons .btn { min-height: 35px; padding: 4px 8px; font-size: 12px; }
@media (max-width: 540px) {
  .online-entry { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
  .online-match-entry, .online-invite-entry { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .online-match-entry .btn, .online-invite-entry label { grid-column: 1 / -1; }
  .online-intro { flex-wrap: wrap; }
}
.online-match-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

.hand-readiness { color: #a9e4d2; font-variant-numeric: tabular-nums; white-space: nowrap; }
.arena-shell .hand-playability {
  position: absolute;
  inset: 4px 4px auto auto;
  max-width: 60%;
  overflow: hidden;
  padding: 2px 3px;
  border-radius: 4px;
  color: #eef1ea;
  background: #141c23ec;
  font: 700 9px/1.2 var(--sans);
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;
}
.arena-shell .hand-card:is([data-playability="ready"], [data-playability="target"], [data-playability="reserve"]) .hand-playability {
  color: #c6fae6;
  background: #13372fef;
}
.arena-shell .hand-card[data-playability="cost"] .hand-playability { color: #ffcfac; background: #462724f2; }
.arena-shell .arena-champion-slot .hand-playability { display: none; }
@media (max-width: 460px) {
  .arena-shell .hand-playability { inset: 3px 2px auto auto; font-size: 9px; }
  .arena-shell .hand-card[data-playability="blocked"] .hand-playability { display: none; }
}

.match-lobby { display: grid; gap: clamp(12px, 1.5vw, 20px); }

.match-lobby > .page-heading,
[data-page="battle"]:has(> .online-waiting) > .page-heading {
  position: relative;
  min-height: clamp(172px, 18vw, 252px);
  margin: 0;
  padding: clamp(18px, 3.25vw, 44px);
  border: 1px solid #765742;
  border-radius: 11px;
  background:
    linear-gradient(0deg, #19120ee8, transparent 69%),
    linear-gradient(90deg, #16110fe8 6%, #1c130e9c 42%, #1b15113d 72%),
    #271a14 url('./assets/court.webp') center 47% / cover;
  box-shadow: inset 0 -2px #a5795942, 0 9px 24px #0d0b0980;
}

.match-lobby > .page-heading h1,
[data-page="battle"]:has(> .online-waiting) > .page-heading h1 {
  margin-block: 4px 7px;
  color: #fff1da;
  font-size: clamp(32px, 4vw, 54px);
  font-weight: 850;
  letter-spacing: .055em;
  text-shadow: 0 2px 14px #120b08;
}

.match-lobby > .page-heading .page-description,
[data-page="battle"]:has(> .online-waiting) > .page-heading .page-description { color: #e0cbb0; }

.match-lobby > :is(.battle-lineup, .cloud-profile) { margin-block: 0; }
.match-lobby > .battle-lineup { padding: clamp(11px, 1.7vw, 19px); border-color: #69513e; }
.match-lobby .battle-lineup-top small { font-size: .79rem; }

.match-lobby .online-lobby:not(.online-waiting) {
  max-width: none;
  margin: 0;
  padding: clamp(12px, 2vw, 24px);
  gap: clamp(11px, 1.6vw, 18px);
  border-color: #6a5140;
  border-radius: 9px;
  background: linear-gradient(145deg, #2b231b, #1e1916 68%);
}

.match-lobby .online-intro { align-items: center; }
.match-lobby .online-intro h2 { margin: 0; font-size: clamp(19px, 2.5vw, 27px); }
.match-lobby .online-seat-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 530px; }
.match-lobby .online-entry label { min-width: 0; }
.match-lobby .online-entry :is(input, select), .lobby-mode select {
  border-color: #735b48;
  background: #150f0ddf;
}

.lobby-mode-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(8px, 1.3vw, 16px); }
.lobby-mode {
  --mode-accent: #edbb83;
  --mode-edge: #765440;
  --mode-surface: #342119;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 11px;
  min-width: 0;
  padding: clamp(11px, 1.55vw, 18px);
  border: 1px solid var(--mode-edge);
  border-radius: 8px;
  background: radial-gradient(ellipse at 93% 0%, var(--mode-surface), transparent 86%), #211c18;
}
.lobby-mode--friend { --mode-accent: #b5d8da; --mode-edge: #526d6c; --mode-surface: #253336; }
.lobby-mode--practice { --mode-accent: #c7d7a9; --mode-edge: #657055; --mode-surface: #2c3224; }
.lobby-mode h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--mode-accent);
  font: 780 clamp(16px, 1.8vw, 20px)/1.25 var(--serif);
}
.lobby-mode h3::before {
  flex: 0 0 4px;
  height: 14px;
  border-radius: 2px;
  background: currentColor;
  content: '';
}

.lobby-mode :is(.online-entry, .start-battle) { align-self: end; margin: 0; }
.lobby-mode .online-match-entry { display: grid; }
.lobby-mode .online-invite-entry {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 0;
  border: 0;
}
.lobby-mode .online-invite-entry label { grid-column: 1 / -1; }
.lobby-mode .start-battle { display: grid; grid-template-columns: minmax(0, 1fr); }
.lobby-mode .start-battle .filter-select { display: grid; gap: 4px; min-width: 0; }
.lobby-mode .start-battle select { width: 100%; min-width: 0; min-height: 44px; }
.lobby-mode .btn { min-height: 44px; padding-inline: 8px; text-wrap: balance; }
.lobby-mode--friend .btn { border-color: #577a77; background: #253937; color: #e1eeeb; }
.lobby-mode--practice .btn { border-color: #7b854f; background: #3a4429; color: #eff3dc; }
.lobby-mode--friend .btn:hover:not(:disabled) { border-color: #a1c5bf; background: #304947; }
.lobby-mode--practice .btn:hover:not(:disabled) { border-color: #b5c38c; background: #4a5732; }

.match-lobby .online-replay-entry { padding-top: 9px; }
.match-lobby .online-replay-entry > summary { min-height: 34px; padding-block: 5px; }
.match-lobby .online-replay-entry .online-entry { max-width: 540px; }

.match-lobby .battle-lobby > .section-heading { margin-block: 5px 11px; }
.match-lobby .deck-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(8px, 1vw, 14px); }
.match-lobby .deck-choice {
  position: relative;
  min-height: 153px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 3px;
  padding: clamp(11px, 1.5vw, 19px);
  border-color: #674e3b;
  border-radius: 8px;
  background:
    linear-gradient(0deg, #211615fa 8%, #27191215 84%),
    linear-gradient(90deg, #261b16eb 14%, #261b165c 70%),
    #241c16 var(--portrait, none) right 27% / cover no-repeat;
}
.match-lobby .deck-choice .deck-emblem {
  grid-row: auto;
  width: 33px;
  margin-block-end: 4px;
  border-color: #ba8d61;
  background: #733b31;
  color: #ffe7c4;
  font-size: 19px;
}
.match-lobby .deck-choice strong { color: #fff0d5; font-size: clamp(16px, 2vw, 24px); }
.match-lobby .deck-choice > span:last-child { color: #e4ccb1; line-height: 1.45; }
.match-lobby .deck-choice:hover, .match-lobby .deck-choice.is-selected { border-color: #c79964; }
.match-lobby .deck-choice.is-selected { box-shadow: inset 0 0 0 1px #deaa7361; }
.match-lobby .deck-choice.is-selected::after {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 3px 6px;
  border: 1px solid #a97746;
  border-radius: 4px;
  background: #482a1edb;
  color: #ffe1ad;
  font-size: 10px;
  content: '已选';
}

.online-waiting {
  margin-block: 16px;
  border-color: #88674e;
  border-radius: 9px;
  background: linear-gradient(140deg, #32231c, #211a16);
}
.online-waiting .online-members li { min-height: 42px; }
.online-waiting > .btn { justify-self: start; min-height: 44px; }

@media (max-width: 850px) {
  .lobby-mode-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lobby-mode--practice { grid-column: 1 / -1; }
  .lobby-mode--practice .start-battle { grid-template-columns: minmax(0, 1fr) auto; align-items: end; }
}
@media (max-width: 540px) {
  .match-lobby > .page-heading, [data-page="battle"]:has(> .online-waiting) > .page-heading {
    min-height: 148px;
    background-position: center 62%;
  }
  .match-lobby > .page-heading .page-description, [data-page="battle"]:has(> .online-waiting) > .page-heading .page-description { font-size: 13px; }
  .lobby-mode-grid { grid-template-columns: minmax(0, 1fr); }
  .lobby-mode--practice { grid-column: auto; }
  .lobby-mode .online-invite-entry .btn { grid-column: auto; }
  .match-lobby .deck-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .match-lobby .deck-choice { min-height: 144px; }
}
