.r23-brand-mark,.r23-wordmark img { object-fit: contain; }
:root {
  --r23-night: #102b31;
  --r23-night-raised: #1d4143;
  --r23-copper: #bc965f;
  --r23-glint: #ffd38a;
  --r23-ivory: #fbf1d9;
  --r23-paper: #f6efdf;
  --r23-display: Georgia, "Songti SC", "Noto Serif CJK SC", SimSun, serif;
  --r23-body: system-ui, "Microsoft YaHei", "PingFang SC", sans-serif;
}

#app #startup-screen {
  background: var(--r23-night) url("../img/r22-court-wide.webp") center 47%/cover no-repeat;
  align-items: center;
}
#app #startup-screen::before {
  background: linear-gradient(90deg,#0c252cf5 4%,#122f34eb 30%,#163e427a 58%,#0e2d3533);
  opacity: 1;
}
#app #startup-screen .startup-content {
  width: min(88vw, 1100px);
  max-width: none;
  align-items: flex-start;
  text-align: start;
  margin-inline: auto;
  padding: max(20px,env(safe-area-inset-top)) 0 max(20px,env(safe-area-inset-bottom));
  gap: 13px;
  background: none;
}
#app #startup-screen .r23-brand-mark {
  width: clamp(78px,11.5vh,118px);
  height: auto;
  border: 0;
  border-radius: 0;
  background: transparent;
}
#app #startup-screen .startup-content h1 {
  font-family: var(--r23-display);
  color: var(--r23-ivory);
  font-size: clamp(40px,7vw,94px);
  font-weight: 700;
  letter-spacing: -.034em;
  line-height: 1;
  margin: 0;
  text-shadow: 0 3px 14px #0b242ac0;
}
html:lang(zh-CN) #app #startup-screen .startup-content h1 { letter-spacing: .025em; }
#app #startup-screen .r8-kicker {
  color: #f0d39d;
  font: 650 clamp(12px,1.5vw,17px)/1.45 var(--r23-body);
  letter-spacing: .07em;
  text-transform: none;
}
#app #startup-screen .startup-loading { width: min(290px,100%); margin-top: 12px; }
#app #startup-screen .startup-loading progress { height: 5px; border-radius: 12px; }
#app #startup-screen #enter-continent { width: auto; min-width: min(238px,100%); min-height: 54px; border-radius: 999px; overflow: hidden; }
#app #startup-screen #enter-continent::before,
#app #startup-screen #enter-continent::after { border-radius: inherit; }
#app #startup-screen .language-switch { margin: 0 0 7px; }
#app .language-switch button { border-radius: 999px; }
#mobile-diag { border: 1px solid #bb9e6c; border-radius: 9px; }

#app #lobby-screen::before {
  background: linear-gradient(100deg,#0b292ddd,#16373893 47%,#0d2c32cd),
              linear-gradient(0deg,#0b242aff 0%,#112e3408 57%);
}
#app #lobby-screen .r8-lobby-header {
  border-bottom-color: #c4a27280;
  background: #10292fea;
}
#app #lobby-screen .r23-wordmark {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  font-size: clamp(17px,2.2vw,31px);
  font-weight: 700;
  font-family: var(--r23-display);
  letter-spacing: -.025em;
  line-height: 1.08;
}
.r23-wordmark img { flex: 0 0 auto; width: 44px; height: 44px; }
#app #lobby-screen #net-commander {
  border-radius: 14px;
  border-color: #c4a67753;
  background: #102a2fe6;
  box-shadow: none;
}
#app #net-commander .net-name { background: transparent; }
#app #lobby-screen .lobby-character {
  border-color: #cead786f;
  border-radius: 22px;
  background: linear-gradient(169deg,#244b47e8,#122f33f5);
  box-shadow: 0 12px 28px #091d2173;
}
#app #lobby-screen .lobby-character>.commander-portrait {
  border-radius: 16px;
  border-color: #caa56878;
}
#app #lobby-screen .commander-copy h2,
#app #lobby-screen .lobby-heading h1 { color: var(--r23-ivory); font-family: var(--r23-display); }
#app #lobby-screen .lobby-entry.casual {
  border-color: #efbd76;
  background-color: #225351;
  box-shadow: inset 0 1px #fbe9b087, 0 7px 16px #061b229d;
}
#app #lobby-screen .lobby-entry.ranked { border-color: #a6a99196; background-color: #233841; }
#app #lobby-screen .lobby-entry .entry-copy>b { font-family: var(--r23-display); letter-spacing: -.015em; }
#app #lobby-screen .lobby-entry .entry-go { color: #ffe1a5; font-weight: 700; }
#app #lobby-screen .net-chat-launcher { background: var(--r23-paper); }

#app #selection-screen {
  background: linear-gradient(180deg,#19363cf2,#132f37f5);
  color: var(--r23-ivory);
}
#app .site-header .r23-prepare-emblem { flex: 0 0 auto; width: 34px; height: 34px; }
#app #selection-screen :is(.selection-intro h1,.section-heading h2) { color: #fcf0d6; }
#app #selection-screen :is(.intro-copy,.section-heading>span,.roster-footnote,.local-record) { color: #cdd5bf; }
#app #selection-screen :is(.selection-intro h1,.race-spotlight h2) { font-family: var(--r23-display); letter-spacing: -.013em; }
#app #selection-screen .race-card { border-color: #b5a98c; box-shadow: none; }
#app #selection-screen .race-card.active {
  border-color: #286052;
  box-shadow: inset 0 0 0 1px #286052, 0 2px 6px #183a272b;
}
#app #selection-screen .launch-button { min-height: 48px; }
#app :is(.shop-screen,.result-card,.r8-modal-card) { font-family: var(--r23-body); }
#app #shop-screen :is(h1,.skin-name),
#app :is(.result-card,.r8-modal-card) h2 { font-family: var(--r23-display); }
#app #settings-dialog .r8-modal-card,#app #result-dialog .result-card {
  border: 1px solid #c4a576;
  border-radius: 21px;
  background: var(--r23-paper);
  box-shadow: 0 12px 34px #0a252e62;
}
#app #result-dialog .result-emblem { border-color: #d0ae73; background: #e8ead7; }
#app #result-dialog .result-card.is-lost .result-emblem { background: #f0dfcd; }
#app #result-dialog .result-actions :is(button,a) { min-height: 46px; }
#net-dialog .net-panel { font-family: var(--r23-body); }
#net-dialog :is(.profile-banner,.net-match-status) { border-color: #ba9a65; }
#net-dialog .profile-banner {
  background: linear-gradient(106deg,#102c31f5,#1a3c41ed 64%,#284c49dd), url("../img/r22-court-wide.webp") center 52%/cover;
}
#net-dialog .profile-identity h3 { font-family: var(--r23-display); }
#net-dialog .net-match-portrait { border-color: #caac73; }
#net-dialog .net-match-clocks strong { color: #ffe0a7; font-variant-numeric: tabular-nums; }

#app #battle-screen .battle-status {
  background: #142f37;
  border-bottom: 1px solid #ad946b;
  box-shadow: 0 2px 4px #0a262732;
}
#app #battle-screen .battle-status .status-stat>b,
#app #battle-screen .battle-clock>b { color: #ffe3a9; font-variant-numeric: tabular-nums; }
#app #battle-screen .dispatch-panel {
  background: #f2ead6;
  border-top: 1px solid #9f8f70;
  box-shadow: none;
}
#app #battle-screen .ratio-buttons button.active {
  border-color: #367f6e;
  color: #fff2cf;
  background: #235d53;
}
#app #map-world .building-count { text-shadow: 0 1px 2px #143335; font-variant-numeric: tabular-nums; }
#app #overview-svg .overview-bank { stroke: #a7ad80; }
#app #overview-svg .overview-river { stroke: #4f9293; }
#app #overview-svg .overview-woodland-edge { fill: #527452; opacity: .42; }
#app #overview-svg .overview-woodland-deep { fill: #2f654e; opacity: .52; }
#app #overview-svg .overview-capital { stroke: #f6d9a1; stroke-width: 1; }
#app #overview-svg .overview-capital.overview-chosen { stroke: #173c3b; stroke-width: 2.2; paint-order: stroke fill; }

.mobile-android #app #map-world { background: transparent; }
.mobile-android #map-world .building.is-offscreen { display: none; }
.mobile-android #battle-map.is-dragging #map-world .city-art { filter: none; }

#app #net-commander .lobby-friends { position: relative; }
.friend-request-dot {
  position: absolute;
  top: 0;
  right: 0;
  width: 13px;
  height: 13px;
  border: 2px solid #fff2d9;
  border-radius: 50%;
  background: #dd3d38;
  box-shadow: 0 0 0 1px #57392f;
  pointer-events: none;
}
.friend-request-dot[hidden], .net-friend-requests:empty { display: none; }
.net-friend-requests {
  margin-bottom: 14px;
  padding: 9px 12px;
  border-left: 3px solid #dd7469;
  background: #f4e6d9;
}
.net-friend-requests h3 { margin: 4px 0 7px; }
#net-dialog .net-search {
  display: grid;
  grid-template-columns: minmax(104px,.8fr) minmax(0,1.7fr) auto;
  align-items: end;
  gap: 8px;
}
#net-dialog .net-search :is(input,select) {
  display: block;
  width: 100%;
  min-height: 44px;
  margin-top: 4px;
  padding: 8px 10px;
  border: 1px solid #a0a99b;
  border-radius: 8px;
  color: #173a39;
  background: #fbf8eb;
  font: inherit;
  font-size: 16px;
}
.profile-player-id {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 3px 8px;
  margin: 7px 0;
  color: #efe6c9;
  font-size: 13px;
}
.profile-player-id code {
  color: #ffda8b;
  user-select: text;
  font-variant-numeric: tabular-nums;
  letter-spacing: .01em;
}
#net-dialog .profile-player-id button {
  min-height: 44px;
  padding-inline: 11px;
  border: 1px solid #ded3a89c;
  border-radius: 999px;
  color: #fff3cb;
  background: #213d3f;
}
.mobile-android #net-dialog :is(.profile-player-id button,.net-search input,.net-search select) { min-height: 48px; }
.mobile-android #app #battle-screen .battle-status { min-height: calc(50px + var(--r3-safe-top)); }
.mobile-android #app #battle-screen .dispatch-panel {
  min-height: calc(58px + var(--r3-safe-bottom)); padding-top: 4px; padding-bottom: calc(4px + var(--r3-safe-bottom));
}
.mobile-android #app #battle-screen :is(.map-controls button,#pause-button,.ratio-buttons button,#select-all-button) {
  min-width: 48px;
  min-height: 48px;
}
.mobile-android #battle-screen :is(.net-battle-tools button,.rank-heading,.tactics-drawer>summary) { min-height: 48px; }
.mobile-android :is(#net-dialog,.modal-backdrop,.pause-overlay) { backdrop-filter: none; }
#net-dialog select:focus-visible { outline: 2px solid #a67538; outline-offset: 2px; }

@media (orientation: portrait) and (max-width: 760px) {
  #app #startup-screen {
    background-image: url("../img/r22-court-tall.webp");
    background-position: center 26%;
    align-items: end;
  }
  #app #startup-screen::before {
    background: linear-gradient(0deg,#102a31fb 2%,#102b31e8 48%,#18393c33 100%);
  }
  #app #startup-screen .startup-content { padding-bottom: max(30px,env(safe-area-inset-bottom)); }
  #app #startup-screen .startup-content h1 { font-size: clamp(37px,10vw,61px); }
  #app #lobby-screen .r8-lobby-header { min-height: 0; }
  #app #lobby-screen .r23-wordmark img { width: 32px; height: 32px; }
  #app #lobby-screen .lobby-character { border-radius: 16px; }
  #app #lobby-screen .lobby-character>.commander-portrait { border-radius: 10px; }
  #net-dialog .profile-banner {
    background: linear-gradient(110deg,#102c31e8,#1a3c41e6 64%,#284c49dd), url("../img/r22-court-tall.webp") center 40%/cover;
  }
}
@media (max-height: 480px) and (orientation: landscape) {
  #app #startup-screen .startup-content { gap: 7px; }
  #app #startup-screen .startup-content h1 { font-size: clamp(34px,6.7vw,58px); }
  #app #startup-screen .r23-brand-mark { width: 66px; }
  #app #startup-screen #enter-continent { min-height: 48px; }
  #app #startup-screen .startup-loading { margin-top: 3px; }
  .mobile-android #app #battle-screen .dispatch-panel { min-height: calc(54px + var(--r3-safe-bottom)); }
}

@media (max-width: 480px) {
  #net-dialog .net-search { grid-template-columns: minmax(112px,.9fr) minmax(0,1.4fr); }
  #net-dialog .net-search select { padding-inline: 8px; }
  #net-dialog .net-search button { grid-column: 1 / -1; justify-self: start; }
}
@media (max-width: 480px) and (max-height: 720px) {
  #app #result-dialog .result-card { display: flex; flex-direction: column; padding: 16px; }
  #app #result-dialog .result-card > * { flex-shrink: 0; }
  #app #result-dialog .result-emblem { width: 48px; height: 48px; margin: 0 auto 9px; font-size: 28px; }
  #app #result-dialog h2 { font-size: 30px; line-height: 1.15; }
  #app #result-dialog .result-copy { margin: 10px 0 12px; line-height: 1.5; }
  #app #result-dialog .result-race img { width: 30px; height: 35px; }
  #app #result-dialog .result-stats { margin: 12px 0; padding: 10px 0; }
  #app #result-dialog .result-stats b { font-size: 20px; }
  #app #result-dialog .result-mvp { padding: 8px 10px; margin-bottom: 12px; }
  #app #result-dialog .result-actions { order: 1; gap: 6px; margin-bottom: 9px; }
  #app #result-dialog :is(.result-mvp,.result-gold,.result-record,.boss-result,.rematch-races) { order: 2; }
}
