/* The start screen's sharp Desert Compound artwork, ivory type and acid accent
   continue through every lobby page. HUD layout editing keeps its own canvas. */
body:not(.layout-editor) :is(#page-overlay, #settings) {
  background: #0c151c;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  --page-line: #dce6cf2b;
}

/* After action: the same Day Operations identity, centered with paged records. */
.operation-report {
  --result-rows: 4;
  --result-row-height: 34px;
  isolation: isolate;
  display: grid;
  place-items: center;
  padding: max(22px, env(safe-area-inset-top))
    max(5vw, env(safe-area-inset-right)) max(22px, env(safe-area-inset-bottom))
    max(5vw, env(safe-area-inset-left));
  overflow: hidden;
  background: #0c151c;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.operation-report::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(90deg, #080f16e6, #101923b8 58%, #13233288),
    linear-gradient(0deg, #081017ef, transparent 80%),
    url("../assets/ui/combat/loader.webp") 50% 43% / cover;
  pointer-events: none;
}

.operation-report .results-shell {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: min(1000px, 100%);
  max-width: none;
  max-height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: none;
  border: 0;
  text-align: center;
}

.operation-report .page-brandbar {
  margin: 0;
  flex: none;
}

.result-content {
  display: grid;
  gap: 24px;
  min-height: 0;
}

.result-overview {
  align-self: center;
}

#results .eyebrow {
  justify-content: center;
  font-size: 9px;
  letter-spacing: 0.27em;
  color: #d6e2cb;
}

:is(#results, #death-screen) .operation-outcome-title {
  font:
    700 clamp(62px, 9vh, 100px)/0.98 Barlow,
    sans-serif;
  letter-spacing: 0.055em;
  margin: 6px 0 9px;
}

#results #result-title {
  color: var(--accent);
}

#results[data-outcome="defeat"] #result-title {
  color: var(--red);
}

#results[data-outcome="draw"] #result-title {
  color: #f2f3e6;
}

#results #result-subtitle {
  font-size: 10px;
  letter-spacing: 0.18em;
  color: #c3cec0;
}

#results .result-score {
  gap: 28px;
  margin: 14px 0;
}

#results .result-score > div {
  min-width: 105px;
}

#results .result-score small {
  display: block;
  font-size: 8px;
  letter-spacing: 0.18em;
  color: #afbeaf;
}

#results .result-score b {
  color: #edf2d8;
  font:
    600 48px/1.08 Barlow,
    sans-serif;
}

#results .result-score > div:last-child b {
  color: var(--red);
}

#results .result-score > span {
  font:
    300 25px Barlow,
    sans-serif;
  color: #a4b3a4;
}

#results #result-stats {
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  width: min(560px, 100%);
}

#results #result-stats > div {
  padding: 8px 16px;
  border-right: 1px solid #e7eddb26;
}

#results #result-stats > div:last-child {
  border: 0;
}

#results #result-stats b {
  color: #f2f3e6;
  font:
    600 30px/1.05 Barlow,
    sans-serif;
}

#results #result-stats small {
  display: block;
  margin-top: 5px;
  color: #adbcad;
  font-size: 8px;
  letter-spacing: 0.15em;
}

.result-roster {
  width: min(820px, 100%);
  margin: 0 auto;
  min-width: 0;
}

.result-roster > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 9px;
}

.result-roster h3 {
  color: #e4ebd9;
  font:
    600 12px Rajdhani,
    sans-serif;
  letter-spacing: 0.14em;
}

#result-roster-count {
  font-size: 8px;
  letter-spacing: 0.13em;
  color: #9fac9f;
}

#results #result-board {
  height: calc((var(--result-rows) + 1) * var(--result-row-height));
  max-height: none;
  margin: 0;
  overflow: hidden;
  background: #0a141ccc;
  border: 1px solid #dce6cf2b;
  border-top: 1px solid #d7ff3e7a;
}

#results .board-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
}

#results .board-table :is(th, td) {
  padding: 0 14px;
  height: var(--result-row-height);
  text-align: right;
  white-space: nowrap;
}

#results .board-table th {
  font:
    600 9px Rajdhani,
    sans-serif;
  letter-spacing: 0.13em;
  color: #97a795;
  background: #07111b88;
}

#results .board-table td {
  font:
    500 13px Rajdhani,
    sans-serif;
  color: #d8e1d2;
  border-top: 1px solid #dce6cf0c;
}

#results .board-table :is(th, td):first-child {
  width: 46%;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
}

#results .board-table .player-row td {
  background: #d7ff3e0d;
  color: #eff3dd;
}

#results .board-table td:first-child > span {
  display: inline-block;
  vertical-align: middle;
  max-width: calc(100% - 52px);
  overflow: hidden;
  text-overflow: ellipsis;
}

#results .board-table td:first-child > small {
  color: var(--accent);
  font-size: 7px;
  letter-spacing: 0.08em;
  margin-left: 10px;
}

.result-team-dot {
  display: inline-block;
  width: 4px;
  height: 4px;
  background: #c4dc93;
  margin-right: 10px;
  vertical-align: middle;
}

.result-team-dot.hostile {
  background: var(--red);
}

.result-pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 34px;
  margin-top: 5px;
}

.result-pagination button {
  display: flex;
  gap: 7px;
  align-items: center;
  color: #d2deca;
  font-size: 8px;
  letter-spacing: 0.12em;
  min-height: 32px;
  padding: 6px 3px;
}

.result-pagination button svg {
  width: 14px;
  height: 14px;
}

#result-prev svg {
  transform: rotate(180deg);
}

.result-pagination button:hover {
  color: var(--accent);
}

.result-pagination button:disabled {
  opacity: 0.25;
}

#result-page {
  color: #afbfaa;
  font:
    600 10px Rajdhani,
    sans-serif;
  letter-spacing: 0.2em;
}

.result-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex: none;
}

.result-actions > button {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 26px;
  min-height: 46px;
  padding: 12px 24px;
  font:
    600 15px Barlow,
    sans-serif;
  letter-spacing: 0.07em;
}

.result-actions > button svg {
  width: 17px;
  height: 17px;
}

.operation-report .page-footer {
  margin-top: 0;
  padding-top: 12px;
}

@media (max-height: 760px) {
  #results {
    padding-top: 14px;
    padding-bottom: 14px;
    --result-row-height: 30px;
  }

  #results .results-shell {
    gap: 14px;
  }

  #results .page-brandbar {
    min-height: 40px;
    padding-bottom: 8px;
  }

  #results .page-brandbar img {
    height: 38px;
    width: 128px;
  }

  .result-content {
    gap: 16px;
  }

  #results #result-title {
    font-size: 62px;
    margin: 4px 0 7px;
  }

  #results .result-score {
    margin: 9px 0;
  }

  #results .result-score b {
    font-size: 38px;
  }

  #results #result-stats b {
    font-size: 25px;
  }

  #results #result-stats > div {
    padding-top: 5px;
    padding-bottom: 5px;
  }
}

@media (max-width: 600px) {
  #results {
    padding-left: max(20px, env(safe-area-inset-left));
    padding-right: max(20px, env(safe-area-inset-right));
  }

  #results .page-brandbar > span {
    font-size: 7px;
    letter-spacing: 0.08em;
    max-width: 145px;
  }

  #results #result-title {
    font-size: 64px;
  }

  #results #result-subtitle {
    font-size: 8px;
    letter-spacing: 0.09em;
  }

  #results #result-stats > div {
    padding-left: 7px;
    padding-right: 7px;
  }

  #results #result-stats small {
    font-size: 7px;
    letter-spacing: 0.08em;
  }

  #results .board-table :is(th, td) {
    padding-left: 7px;
    padding-right: 7px;
  }

  #results .board-table th {
    font-size: 7px;
    letter-spacing: 0.03em;
  }

  #results .board-table td {
    font-size: 11px;
  }

  #results .board-table :is(th, td):first-child {
    width: 42%;
  }

  #results .board-table td:first-child > span {
    max-width: calc(100% - 39px);
  }

  .result-team-dot {
    margin-right: 6px;
  }

  #results .board-table td:first-child > small {
    margin-left: 5px;
    font-size: 6px;
  }

  .result-actions {
    gap: 9px;
  }

  .result-actions > button {
    flex: 1;
    padding: 11px;
    gap: 12px;
    font-size: 12px;
  }

  #results .page-footer {
    font-size: 6px;
    letter-spacing: 0.05em;
  }
}

@media (max-height: 600px) and (min-width: 480px) and (orientation: landscape) {
  #results {
    --result-rows: 4;
    --result-row-height: 27px;
  }

  #results .results-shell {
    gap: 12px;
  }

  #results .page-brandbar {
    min-height: 30px;
    padding-bottom: 5px;
  }

  #results .page-brandbar img {
    height: 28px;
    width: 105px;
  }

  .result-content {
    grid-template-columns: 0.85fr 1.15fr;
    align-items: center;
    gap: 30px;
  }

  #results #result-title {
    font-size: 56px;
  }

  #results #result-subtitle {
    font-size: 7px;
    letter-spacing: 0.08em;
  }

  #results .result-score {
    gap: 18px;
    margin: 9px 0;
  }

  #results .result-score > div {
    min-width: 70px;
  }

  #results .result-score b {
    font-size: 34px;
  }

  #results .result-score small {
    font-size: 6px;
  }

  #results #result-stats > div {
    padding: 4px 7px;
  }

  #results #result-stats b {
    font-size: 23px;
  }

  #results #result-stats small {
    font-size: 6px;
    letter-spacing: 0.04em;
  }

  #results .board-table :is(th, td) {
    padding-left: 7px;
    padding-right: 7px;
  }

  #results .board-table th {
    font-size: 7px;
  }

  #results .board-table td {
    font-size: 11px;
  }

  .result-roster h3 {
    font-size: 10px;
  }

  .result-actions > button {
    min-height: 36px;
    padding: 8px 20px;
    font-size: 12px;
  }

  #results .page-footer {
    padding-top: 7px;
  }
}

@media (max-height: 610px) and (max-width: 659px) {
  #results {
    --result-rows: 3;
    --result-row-height: 27px;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  #results .results-shell {
    gap: 10px;
  }

  .result-content {
    gap: 10px;
  }

  #results #result-title {
    font-size: 48px;
  }

  #results .result-score b {
    font-size: 30px;
  }

  #results .page-brandbar img {
    height: 30px;
    width: 105px;
  }

  .result-actions > button {
    min-height: 38px;
    padding: 8px;
  }
}

@media (max-height: 380px) {
  #results {
    --result-rows: 3;
    --result-row-height: 25px;
    padding-top: 8px;
    padding-bottom: 8px;
  }

  #results .results-shell {
    gap: 8px;
  }

  #results .page-footer {
    display: none;
  }
}

body:not(.layout-editor) :is(#page-overlay, #settings)::before {
  inset: 0;
  background:
    linear-gradient(90deg, #080f16d9, #101923a8 58%, #1323326b),
    linear-gradient(0deg, #081017e8, transparent 66%),
    url("../assets/ui/combat/loader.webp") 50% 43% / cover;
  filter: none;
}

body:not(.layout-editor) :is(#page-overlay, #settings)::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    #ffffff02 0 1px,
    transparent 1px 4px
  );
}

body:not(.layout-editor) #page-overlay .page-shell,
body:not(.layout-editor) #settings .settings-shell {
  width: min(1440px, 90%);
  padding: 2.5vh 0 2vh;
  gap: 0;
}

.page-brandbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 58px;
  flex: none;
  gap: 24px;
  border-bottom: 1px solid #e6eddb2b;
  padding-bottom: 13px;
  margin-bottom: 28px;
}

.page-brandbar img {
  width: 154px;
  height: 53px;
  object-fit: contain;
  object-position: left center;
}

.page-brandbar > span {
  font:
    600 9px Rajdhani,
    sans-serif;
  color: #d2ddcf;
  letter-spacing: 0.2em;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: right;
}

.page-brandbar i,
.page-footer i {
  width: 5px;
  height: 5px;
  background: var(--accent);
  display: inline-block;
  flex: none;
}

body:not(.layout-editor) :is(#page-overlay, #settings) .page-header {
  margin: 0 0 24px;
  padding: 0;
  min-height: 78px;
  align-items: center;
  gap: 24px;
}

body:not(.layout-editor) :is(#page-overlay, #settings) .page-header .eyebrow {
  color: #d5e1c9;
  font:
    600 9px Rajdhani,
    sans-serif;
  letter-spacing: 0.23em;
  margin-bottom: 8px;
}

body:not(.layout-editor) :is(#page-overlay, #settings) .page-header h2 {
  color: #f2f3e6;
  font:
    700 clamp(36px, 5.2vw, 76px)/0.96 Barlow,
    sans-serif;
  letter-spacing: -0.015em;
  gap: 15px;
  margin: 0;
}

body:not(.layout-editor) :is(#page-overlay, #settings) .close-button {
  background: #09121d66;
  border: 1px solid #dce6ce4a;
  color: #e5ebdb;
  min-height: 44px;
  padding: 11px 16px;
  flex: none;
}

body:not(.layout-editor) :is(#page-overlay, #settings) .close-button:hover {
  background: #d7ff3e16;
  border-color: var(--accent);
}

body:not(.layout-editor) #page-content {
  flex: 1;
  padding: 0 3px 20px;
  scrollbar-color: #d7ff3e88 #0b151d55;
  scrollbar-gutter: stable;
}

.page-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: none;
  gap: 18px;
  padding-top: 13px;
  border-top: 1px solid #e6eddb2b;
  font-size: 8px;
  letter-spacing: 0.2em;
  color: #acbbaf;
}

.page-footer > span {
  display: flex;
  gap: 9px;
  align-items: center;
}

body:not(.layout-editor) #page-content :is(.section-tabs, .weapon-list) {
  background: #0a141dd4;
  border: 1px solid var(--page-line);
}

body:not(.layout-editor) #page-content .section-tabs {
  margin-bottom: 20px;
  min-height: 46px;
}

body:not(.layout-editor) #page-content .section-tabs button.active {
  background: #d7ff3e12;
  border-color: var(--accent);
}

body:not(.layout-editor)
  #page-content
  :is(.profile-identity, .stat-cell, .store-card, .event-row, .control-item) {
  border: 1px solid var(--page-line);
  background: linear-gradient(135deg, #14232bee, #0a141cdb);
}

body:not(.layout-editor) #page-content :is(.profile-identity, .store-card) {
  border-top: 2px solid #d7ff3e86;
}

body:not(.layout-editor) #page-content .store-grid {
  gap: 20px;
}

body:not(.layout-editor) #page-content .store-card {
  min-height: 395px;
  padding: 27px;
  background:
    radial-gradient(
      ellipse at 65% 18%,
      color-mix(in srgb, var(--skin-color), transparent 84%),
      transparent 70%
    ),
    linear-gradient(135deg, #14232be8, #0a141ce8);
}

body:not(.layout-editor) #page-content .store-weapon {
  height: clamp(130px, 18vh, 190px);
  margin: 8px 0 11px;
}

body:not(.layout-editor) #page-content .store-card > h3 {
  font:
    700 36px Barlow,
    sans-serif;
  letter-spacing: 0.01em;
}

body:not(.layout-editor)
  #page-content
  :is(.store-card > small, .profile-identity > .eyebrow) {
  color: #c1cfbd;
  letter-spacing: 0.16em;
}

body:not(.layout-editor) #page-content .stat-cell {
  padding: 24px 20px;
  border-top-color: #d7ff3e60;
}

body:not(.layout-editor) #page-content .stat-cell > b {
  color: #f2f3e6;
  font:
    600 48px Barlow,
    sans-serif;
}

body:not(.layout-editor) #page-content :is(.controls-note, .credits-content p) {
  color: #c3d0c1;
  text-shadow: 0 1px 3px #07101c;
}

body:not(.layout-editor) #page-content .menu-grid > button {
  background: linear-gradient(120deg, #14232bec, #09131cbb);
  border: 1px solid var(--page-line);
  border-left: 2px solid #d7ff3e55;
}

body:not(.layout-editor) #page-content .menu-grid > button:hover {
  background: #d7ff3e1c;
  border-color: var(--accent);
}

body:not(.layout-editor) #page-content :is(.mode-card, .operator-card) {
  border-color: var(--page-line);
}

body:not(.layout-editor)
  #page-content
  :is(.mode-card.selected, .operator-card.selected) {
  border-color: var(--accent);
}

body:not(.layout-editor) #page-content .credits-content {
  background: #0a141cd9;
  border: 1px solid var(--page-line);
  padding: 25px 30px;
}

body:not(.layout-editor) #settings .settings-tab-rail {
  background: #0a141dd4;
  border: 1px solid var(--page-line);
}

body:not(.layout-editor) #settings :is(#settings-rows, .settings-description) {
  background-color: #0c1822e6;
}

body:not(.layout-editor) #settings .settings-footer {
  border-top-color: var(--page-line);
}

.layout-editor .page-brandbar,
.layout-editor .page-footer {
  display: none;
}

@media (min-width: 1000px) and (min-height: 780px) {
  body:not(.layout-editor) #page-overlay .page-shell {
    padding-top: 3.6vh;
  }

  body:not(.layout-editor) #page-content .store-grid {
    margin-top: 8px;
  }
}

@media (max-width: 760px) {
  body:not(.layout-editor) #page-overlay .page-shell,
  body:not(.layout-editor) #settings .settings-shell {
    width: 92%;
    padding-top: 12px;
  }

  .page-brandbar {
    min-height: 44px;
    margin-bottom: 20px;
    padding-bottom: 8px;
    gap: 12px;
  }

  .page-brandbar img {
    width: 122px;
    height: 43px;
  }

  .page-brandbar > span {
    max-width: 170px;
    font-size: 8px;
    letter-spacing: 0.1em;
    line-height: 1.5;
  }

  body:not(.layout-editor) :is(#page-overlay, #settings) .page-header {
    min-height: 65px;
    margin-bottom: 18px;
    gap: 10px;
  }

  body:not(.layout-editor) :is(#page-overlay, #settings) .page-header h2 {
    font-size: clamp(30px, 7vw, 46px);
  }

  body:not(.layout-editor) :is(#page-overlay, #settings) .page-header .eyebrow {
    font-size: 7px;
    letter-spacing: 0.12em;
  }

  body:not(.layout-editor) :is(#page-overlay, #settings) .close-button {
    font-size: 9px;
    padding: 8px 10px;
    gap: 6px;
  }

  body:not(.layout-editor) :is(#page-overlay, #settings) .close-button kbd {
    display: none;
  }

  body:not(.layout-editor) #page-content .store-card {
    min-height: 350px;
    padding: 23px;
  }

  body:not(.layout-editor) #page-content .store-weapon {
    height: 155px;
  }

  body:not(.layout-editor) #page-content .store-card > h3 {
    font-size: 30px;
  }

  body:not(.layout-editor) #page-content .profile-layout > * {
    min-width: 0;
  }

  body:not(.layout-editor) #page-content .stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  body:not(.layout-editor) #page-content .stat-cell {
    min-width: 0;
    padding: 21px 12px;
  }

  body:not(.layout-editor) #page-content .stat-cell > b {
    font-size: 38px;
  }

  body:not(.layout-editor) #page-content .stat-cell small {
    font-size: 8px;
    letter-spacing: 0.06em;
  }

  .page-footer {
    font-size: 7px;
    letter-spacing: 0.1em;
    gap: 10px;
    padding-top: 10px;
  }

  .page-footer > span {
    gap: 5px;
  }

  .page-footer > span:last-child {
    text-align: right;
  }

  body:not(.layout-editor) #page-content .credits-content {
    padding: 20px;
  }
}

@media (max-height: 600px) {
  body:not(.layout-editor) #page-overlay .page-shell,
  body:not(.layout-editor) #settings .settings-shell {
    padding: 10px 0;
  }

  .page-brandbar {
    min-height: 31px;
    padding-bottom: 5px;
    margin-bottom: 11px;
  }

  .page-brandbar img {
    height: 30px;
    width: 106px;
  }

  body:not(.layout-editor) :is(#page-overlay, #settings) .page-header {
    min-height: 43px;
    margin-bottom: 12px;
  }

  body:not(.layout-editor) :is(#page-overlay, #settings) .page-header h2 {
    font-size: 34px;
  }

  body:not(.layout-editor) :is(#page-overlay, #settings) .page-header .eyebrow {
    margin-bottom: 4px;
  }

  .page-footer {
    padding-top: 7px;
    font-size: 7px;
  }
}

/* Reports retain readable labels and scroll naturally on short displays. */
#results {
  overflow-x: hidden;
  overflow-y: auto;
}

#results .results-shell {
  max-height: none;
  overflow: visible;
}

#results
  :is(
    .eyebrow,
    #result-subtitle,
    .page-brandbar > span,
    .result-score small,
    #result-stats small,
    .board-table th,
    .board-table td small,
    .result-roster > header > span,
    .result-pagination button,
    .result-pagination > span,
    .page-footer
  ) {
  font-size: clamp(11px, 0.75vw, 13px);
  line-height: 1.35;
  letter-spacing: 0.04em;
}

#results .result-roster h3 {
  font-size: clamp(13px, 1vw, 16px);
}

#results .page-footer {
  flex-wrap: wrap;
  gap: 6px 12px;
}

@media (max-height: 700px) {
  #results {
    align-items: start;
  }
}
