/* With the menus on their own rails, the map can start at the top of a desktop screen. */
@media (orientation: landscape) and (min-height: 561px) {
  .app-shell {
    --rail: clamp(159px, 16.4vw, 262px);
    --trade: clamp(222px, 23.1vw, 374px);
    --pad: clamp(10px, 1.65vw, 30px);
    position: relative;
    max-width: 1840px;
    grid-template-rows: minmax(0, 1fr);
    padding-top: clamp(4px, 0.72vh, 9px);
  }
  .top {
    position: absolute;
    inset: 0 var(--pad) auto;
    height: var(--head);
    z-index: 2;
    pointer-events: none;
  }
  .top > * {
    pointer-events: auto;
  }
  .dashboard {
    grid-row: 1;
  }
  .app-shell .left-column,
  .app-shell .right-column {
    box-sizing: border-box;
    padding-top: calc(var(--head) - clamp(4px, 0.72vh, 9px));
  }
  .map-head {
    height: clamp(34px, 4.7vh, 49px);
  }
  .right-column > .bench {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    margin-top: 0;
    gap: clamp(4px, 0.75vh, 9px);
  }
  .right-column > .shop {
    flex: 0 0 auto;
  }
  .right-column .bench-info {
    margin-bottom: 0;
  }
  .bench .bench-slots {
    flex: 1 1 auto;
    min-height: 0;
    grid-template-rows: repeat(2, minmax(0, 1fr));
  }
  .bench .bench-slot {
    min-height: 0;
    height: 100%;
  }
}
@media (orientation: landscape) and (min-height: 561px) and (max-width: 1249px) {
  .top .nav-button {
    font-size: 0;
    gap: 0;
    min-width: 30px;
    padding-inline: 6px;
  }
}
.bench-info h2 .icon {
  color: #4d746b;
}
.plan-options i {
  display: grid;
  place-items: center;
  flex: none;
  font-style: normal;
}
.plan-options i img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.plan-options .trait-faces {
  width: 100%;
  height: 100%;
}
.reserve-actions {
  gap: 6px;
}
.reserve-actions .reserve-guide,
.reserve-actions .trash-target {
  display: inline-grid;
  place-items: center;
  box-sizing: border-box;
  width: 32px;
  height: 32px;
  min-width: 0;
  min-height: 0;
  padding: 5px;
  border: 1.5px solid #859a91;
  border-radius: 50%;
  background: transparent;
  color: #48665c;
  box-shadow: none;
}
.reserve-actions .reserve-guide {
  border-color: transparent;
}
.reserve-actions .icon,
.reserve-actions img,
.reserve-actions .trait-faces {
  width: 17px;
  height: 17px;
  object-fit: contain;
}
.reserve-actions button:hover,
.reserve-actions button:focus-visible {
  background: #5e87751a;
}
.app-shell[data-dragging='hero'] .trash-target:not([data-drop-state]) {
  border-color: #9b614d;
  color: #86513e;
  background: transparent;
  outline: 1px dashed #ad7966;
  outline-offset: 2px;
}
.bench .bench-slots {
  --foot: clamp(18px, 2.25vh, 25px);
  --headroom: 3px;
  padding: 3px 4px 5px;
  row-gap: 4px;
  overflow: visible;
  background:
    linear-gradient(0deg, transparent 49.3%, #e1eddb8c 49.8%, #79a5989c 50.2%, transparent 50.8%),
    radial-gradient(ellipse at 48% 8%, #e4efcd, transparent 67%),
    linear-gradient(125deg, #bbd7c4, #96bbad);
}
.bench-slot .reserve-pad {
  bottom: calc(var(--foot) - 9px);
  left: 8%;
  width: 84%;
  height: clamp(10px, 2.25vh, 24px);
  opacity: 0.43;
}
.bench-slot .bench-actor {
  --standing-room: calc(100% - var(--foot) - var(--headroom));
  inset: auto auto calc(var(--foot) - var(--standing-room) * 0.16) -50%;
  width: 200%;
  max-width: none;
  height: calc(var(--standing-room) * 1.52);
  max-height: none;
}
.reserve-caption {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  position: absolute;
  inset: auto 1px 0;
  height: 15px;
  pointer-events: none;
}
.bench-slot .reserve-name,
.bench-slot .reserve-stars {
  position: static;
  flex: 0 1 auto;
  min-width: 0;
}
.bench-slot .reserve-stars {
  flex: 0 0 auto;
  display: flex;
}
.bounty-stars {
  --star-size: 15px;
  display: inline-flex;
  align-items: center;
  flex: none;
  vertical-align: -0.12em;
  width: max-content;
  height: var(--star-size);
}
.bounty-stars > img {
  box-sizing: border-box;
  display: block;
  position: static;
  flex: none;
  width: calc(var(--star-size) * 0.959);
  height: var(--star-size);
  margin: 0;
  border: 0;
  border-radius: 0;
  background: none;
  object-fit: contain;
  pointer-events: none;
}
.bounty-stars > img + img {
  margin-left: -1px;
}
.bench-slot .bounty-stars {
  position: static;
  inset: auto;
  text-shadow: none;
}
.reserve-caption .bounty-stars {
  --star-size: 11px;
}
.star-tabs .bounty-stars {
  --star-size: 15px;
}
.commander-title,
.deployed-count {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.deployed-count {
  flex: none;
  gap: 3px;
  white-space: nowrap;
  color: #49645f;
}
.deployed-count > .icon {
  width: 14px;
  height: 14px;
}
.deployed-count > b {
  font: 13px/1 Lilita, var(--font);
  font-variant-numeric: tabular-nums;
}
.bench-slot[data-match] {
  outline: 2px solid #ac7f2d;
  outline-offset: -2px;
}
.shop-card .lineup-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #69441b;
  background: #ffe28c;
  border-radius: 50%;
  width: 14px;
  height: 14px;
  vertical-align: middle;
  margin-left: 3px;
}
.shop-card .lineup-mark .icon {
  width: 11px;
  height: 11px;
}

.plan-browser {
  display: grid;
  gap: 10px;
}
.plan-groups {
  display: flex;
  gap: 3px;
  width: fit-content;
  border: 1px solid #b9cac0;
  padding: 2px;
  background: #e6eee6;
  border-radius: 7px;
}
.plan-groups button,
.plan-options button,
.lineup-switch button {
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #47655a;
  font: 700 12px/1.2 var(--font);
}
.plan-groups button {
  padding: 5px 12px;
}
.plan-groups [aria-pressed='true'],
.lineup-switch [aria-pressed='true'] {
  background: #406b61;
  color: #fff;
}
.plan-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
}
.plan-options button {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  min-height: 34px;
  border: 1px solid #c1cfc0;
  padding: 4px 5px;
  text-align: left;
  background: #edf3e7;
}
.plan-options button > span {
  flex: 1;
}
.plan-options button[aria-pressed='true'] {
  background: #ffe6a8;
  color: #674c23;
  border-color: #ba9348;
}
.plan-options button small {
  font:
    11px/1 Lilita,
    var(--font);
}
.plan-options i {
  width: 20px;
  height: 20px;
}
.plan-detail {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid #c0d0c1;
  background: #f4f7ed;
  border-radius: 8px;
}
.plan-heading,
.plan-member {
  display: flex;
  align-items: center;
  gap: 6px;
}
.plan-heading {
  justify-content: space-between;
}
.plan-heading h3,
.plan-detail p {
  margin: 0;
}
.plan-heading h3 {
  color: #293f40;
  font: 800 17px/1.2 var(--font);
}
.plan-heading b {
  font: 750 11px/1.2 var(--font);
  color: #436356;
}
.plan-detail p {
  color: #455854;
  font: 500 12px/1.5 var(--font);
}
.plan-members {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
}
.plan-member {
  min-width: 0;
  padding: 3px;
  border-radius: 5px;
  background: #e4ece3;
}
.plan-member img {
  width: 29px;
  height: 29px;
  border-radius: 4px;
  object-fit: cover;
}
.plan-member > span {
  display: grid;
  gap: 2px;
}
.plan-member b {
  color: #314d43;
  font: 700 12px/1.2 var(--font);
}
.plan-member small {
  color: #56665e;
  font: 500 10px/1.1 var(--font);
}
.plan-member[data-location='board'] {
  background: #d6e7d3;
}
.plan-member[data-location='shop'] {
  background: #faeac3;
}
.plan-track {
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border: 1px solid #aa894b;
  border-radius: 6px;
  background: #ffda80;
  color: #594521;
  font: 750 12px/1 var(--font);
}
.plan-track .icon {
  width: 14px;
  height: 14px;
}
.plan-track[aria-pressed='true'] {
  color: #3f6151;
  background: #e2ecd7;
  border-color: #a8bca8;
}

@media (max-width: 1100px) and (orientation: portrait) {
  .bench .bench-slots {
    --foot: 12px;
    --headroom: 2px;
    --seat-h: clamp(42px, min(14vw, 6.4dvh), 70px);
    grid-template-columns: repeat(8, minmax(0, 1fr));
    grid-template-rows: var(--seat-h);
    gap: 1px;
    padding: 1px 3px 3px;
    background: linear-gradient(124deg, #d5e5ca, #a2c2b4);
  }
  .bench-slot .reserve-pad {
    bottom: calc(var(--foot) - 5px);
    height: 10px;
    left: 6%;
    width: 88%;
  }
  .bench-slot .bench-actor { --standing-room: calc(122% - var(--foot) - var(--headroom)); }
  .reserve-caption {
    height: 10px;
    gap: 2px;
  }
  .reserve-caption .bounty-stars {
    --star-size: 9px;
  }
  .reserve-actions .reserve-guide,
  .reserve-actions .trash-target {
    width: 24px;
    height: 24px;
    padding: 3px;
    min-height: 0;
    min-width: 0;
  }
  .reserve-actions .icon {
    width: 14px;
    height: 14px;
  }
  .commander > div {
    display: flex;
    align-items: center;
    gap: 5px;
  }
  .deployed-count .icon {
    width: 12px;
    height: 12px;
  }
  .deployed-count b {
    font-size: 11px;
  }
}
@media (max-width: 550px) and (orientation: portrait) {
  .app-shell { --head: 38px; }
  .map-head, .arena-bottom { height: 30px; }
  .dashboard { row-gap: 3px; }
  .warehouse.panel { padding-block: 2px; }
  .bench.panel { padding-block: 2px 3px; }
  .bench .bench-info { margin-bottom: 1px; }
  .shop.panel { padding-block: 3px; row-gap: 2px; }
  .reserve-caption { gap: 1px; }
  .reserve-caption .bounty-stars { --star-size: 7px; }
  .shop-label .shop-name-prefix { display: none; }
  .shop .shop-head { gap: 4px; }
}
@media (max-width: 374px) and (orientation: portrait) {
  .shop-label > .icon:first-child,
  .shop-actions .shop-action-name { display: none; }
  .right-column .shop { column-gap: 3px; }
  .shop .commander { gap: 2px; }
  .shop .commander > .btn { margin-left: 0; padding-inline: 3px; }
  .commander > div > small {
    position: absolute;
    width: 1px;
    height: 1px;
    clip-path: inset(50%);
    overflow: hidden;
  }
}
@media (max-height: 560px) and (orientation: landscape) {
  .reserve-actions .reserve-guide,
  .reserve-actions .trash-target {
    width: 23px;
    height: 23px;
    padding: 3px;
  }
  .reserve-actions .icon { width: 13px; height: 13px; }
  .bench .bench-slots {
    --foot: 10px;
    --headroom: 1px;
    --seat-h: clamp(29px, 9.6dvh, 52px);
    row-gap: 1px;
    padding: 1px 2px 2px;
  }
  .bench-slot .reserve-pad {
    height: 10px;
    bottom: calc(var(--foot) - 4px);
  }
  .reserve-caption { height: 9px; gap: 1px; }
  .reserve-caption .bounty-stars { --star-size: 7px; }
}
@media (max-width: 430px) {
  .plan-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .plan-browser {
    gap: 6px;
  }
  .plan-member {
    gap: 3px;
  }
  .plan-member img {
    width: 24px;
    height: 24px;
  }
  .plan-member b {
    font-size: 11px;
  }
}
@media (max-width: 550px) and (max-height: 620px) and (orientation: portrait) {
  .app-shell {
    --head: 32px;
  }
  .top .brand-skull {
    width: 23px;
  }
  .top .wordmark > span {
    display: none;
  }
  .top .brand h1 {
    font-size: 15px;
  }
  .map-head {
    height: 25px;
    gap: 3px;
    padding-inline: 4px;
  }
  .map-name {
    min-width: 0;
  }
  .map-name small {
    display: none;
  }
  .app-shell .map-name h2 {
    font-size: 15px;
    white-space: nowrap;
  }
  .map-insignia,
  .map-badge {
    width: 19px;
    height: 19px;
  }
  .arena-bottom {
    height: 27px;
    padding-inline: 3px;
  }
  .battle-status {
    gap: 3px;
  }
  .battle-status > small {
    display: none;
  }
  .shop-card,
  .shop-card.sold {
    height: 40px;
  }
  .card-meta strong {
    font-size: 10px;
  }
  .mobile-tools .btn {
    min-height: 17px;
  }
}

@media (max-width: 550px) and (max-height: 740px) and (orientation: portrait) {
  .app-shell {
    --head: 32px;
  }
  .dashboard { row-gap: 3px; }
  .top .brand-skull { width: 24px; }
  .top .wordmark > span { display: none; }
  .warehouse.panel { gap: 0; padding-block: 2px; }
  .bench .bench-slots { --seat-h: 40px; }
  .bench.panel { padding-block: 1px 3px; }
  .bench .bench-info { margin: 0; }
}
@media (orientation: landscape) and (max-height: 460px) {
  .plan-browser {
    grid-template-columns: minmax(0, 0.93fr) minmax(0, 1.07fr);
    align-items: start;
    gap: 5px 8px;
  }
  .plan-groups {
    grid-column: 1/-1;
  }
  .plan-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .plan-options button {
    min-height: 28px;
    padding: 2px 4px;
    font-size: 11px;
  }
  .plan-detail {
    padding: 7px;
    gap: 6px;
  }
  .plan-members {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* A turned phone gives the field its own column. The reserve stays above the shop. */
@media (orientation: landscape) and (max-height: 560px) and (max-width: 1000px) {
  .app-shell .dashboard {
    grid-template-columns: minmax(0, 1.08fr) minmax(265px, 1fr);
    grid-template-rows: auto auto minmax(0, 1fr);
    grid-template-areas: 'center bench' 'center shop' 'center gear';
  }
  .app-shell .left-column, .app-shell .right-column { display: contents; }
  .app-shell .left-column > :is(.roster-info, .damage, .schedule-rail) { display: none; }
  .app-shell .left-column > .warehouse { grid-area: gear; }
  .right-column > .shop {
    grid-area: shop;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: 'head actions' 'cards cards' 'level level';
    gap: 3px 6px;
  }
  .shop .shop-head { grid-area: head; }
  .shop .shop-head h2 { flex: 1; }
  .shop .shop-actions { grid-area: actions; }
  .shop .commander { grid-area: level; }
  .shop .shop-rack { grid-area: cards; grid-template-columns: repeat(5, minmax(0,1fr)); }
  .shop .shop-card, .shop .shop-card.sold { height: clamp(39px, 13dvh, 63px); }
  .shop .shop-card:last-child { grid-column: auto; }
  .shop .shop-card:not(.sold) .shop-picture img { width: 101%; height: 120%; right: -15%; top: 3%; }
  .shop .card-price { right: 2px; top: 2px; }
  .shop .card-meta { top: auto; bottom: 1px; }
  .shop .card-role { top: 2px; left: 2px; }
  .shop .card-trio { top: 15px; left: 2px; }
  .shop .card-pair { top: 27px; left: 2px; }
  .right-column > .bench { grid-area: bench; margin: 0; }
  .bench .bench-slots {
    --seat-h: clamp(39px, 13dvh, 65px);
    grid-template-columns: repeat(8, minmax(0,1fr));
    grid-template-rows: var(--seat-h);
    background: linear-gradient(124deg, #d5e5ca, #a2c2b4);
  }
  .bench-slot .bench-actor { --standing-room: calc(122% - var(--foot) - var(--headroom)); }
  .warehouse-head .mobile-tools { display: flex; margin-left: auto; align-items: center; gap: 2px; }
  .warehouse .mobile-tools .btn { min-height: 24px; gap: 2px; padding: 2px 4px; font-size: 10px; }
  .warehouse .mobile-tools .icon { width: 12px; height: 12px; }
  .app-shell[data-panel='mobile-traits'] .left-column > .roster-info,
  .app-shell[data-panel='mobile-damage'] .left-column > .damage {
    position: fixed;
    right: 8px;
    top: 36px;
    z-index: 15;
    display: grid;
    gap: 4px;
    max-height: calc(100dvh - 75px);
    width: min(250px, 43vw);
    overflow: auto;
  }
}
