:root {
  color-scheme: dark;
  --bg: #050505;
  --row: rgba(255, 255, 255, 0.055);
  --row-hover: rgba(255, 255, 255, 0.085);
  --text: #f1eee9;
  --muted: rgba(241, 238, 233, 0.58);
  --faint: rgba(241, 238, 233, 0.28);
  --accent: #f26b3a;
  --green: #b9e37b;
  --blue: #98d5ea;
  --trivial-bg: rgba(85, 160, 92, 0.22);
  --standard-bg: rgba(210, 174, 78, 0.24);
  --heavy-bg: rgba(205, 63, 48, 0.26);
  --open-bg: rgba(255, 255, 255, 0.045);
  font-family: "Arial Narrow", "Roboto Condensed", "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background: var(--bg);
  letter-spacing: 0;
  overflow-x: hidden;
}

.app-shell {
  width: min(1160px, calc(100vw - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 34px 0 44px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 28px;
}

.topbar-actions {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.brand-block {
  text-transform: uppercase;
}

.eyebrow,
.status-label,
.operator-panel label,
.mission-group,
.mission-order {
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.eyebrow {
  display: block;
  margin-bottom: 6px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(34px, 6vw, 62px);
  font-weight: 400;
  line-height: 0.92;
  text-transform: uppercase;
}

.operator-panel {
  min-width: 230px;
}

.operator-panel label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
}

.operator-select {
  width: 100%;
  min-height: 42px;
  border: 0;
  border-radius: 14px;
  padding: 0 38px 0 13px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  font: inherit;
  font-weight: 700;
  text-transform: uppercase;
  outline: none;
}

.operator-select option,
.login-form select option {
  color: #f1eee9;
  background: #111;
}

.operator-select:focus-visible {
  box-shadow: 0 0 0 3px rgba(242, 107, 58, 0.28);
}

.operator-select:disabled {
  color: var(--faint);
}

.view-switch {
  display: flex;
  gap: 4px;
  padding: 5px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
}

.view-button {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 11px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease;
}

.view-button:hover,
.view-button.is-active {
  color: var(--text);
  background: rgba(255, 255, 255, 0.1);
}

.icon-list,
.icon-grid {
  position: relative;
  width: 18px;
  height: 18px;
}

.icon-list::before {
  position: absolute;
  top: 3px;
  right: 0;
  width: 12px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  content: "";
  box-shadow:
    0 5px 0 currentColor,
    0 10px 0 currentColor;
}

.icon-list::after {
  position: absolute;
  top: 2px;
  left: 0;
  width: 4px;
  height: 4px;
  border-radius: 2px;
  background: currentColor;
  content: "";
  box-shadow:
    0 5px 0 currentColor,
    0 10px 0 currentColor;
}

.icon-grid::before,
.icon-grid::after {
  position: absolute;
  left: 1px;
  width: 6px;
  height: 6px;
  border: 1.5px solid currentColor;
  border-radius: 3px;
  content: "";
  box-shadow: 9px 0 0 -1.5px var(--bg), 9px 0 0 0 currentColor;
}

.icon-grid::before {
  top: 1px;
}

.icon-grid::after {
  bottom: 1px;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 14px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
}

.icon-button:hover,
.icon-button.is-authenticated {
  background: rgba(242, 107, 58, 0.22);
}

.icon-user {
  position: relative;
  width: 18px;
  height: 18px;
  border: 2px solid currentColor;
  border-radius: 50%;
}

.icon-user::after {
  position: absolute;
  left: 50%;
  bottom: -13px;
  width: 24px;
  height: 14px;
  border: 2px solid currentColor;
  border-bottom: 0;
  border-radius: 14px 14px 0 0;
  content: "";
  transform: translateX(-50%);
}

.status-strip {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 22px;
}

.status-strip strong {
  display: block;
  margin-top: 3px;
  font-size: 18px;
  font-weight: 400;
  text-transform: uppercase;
}

.status-metrics {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 14px;
}

.status-metrics span {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.empty-state,
.error-state {
  margin-bottom: 20px;
  padding: 18px 20px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.06);
}

.empty-state h2 {
  font-size: 22px;
  font-weight: 400;
  text-transform: uppercase;
}

.empty-state p {
  max-width: 620px;
  margin-top: 8px;
  color: var(--muted);
}

code {
  color: var(--accent);
}

.error-state {
  color: #ffd3ca;
  background: rgba(150, 39, 28, 0.28);
}

.filter-shell {
  margin-bottom: 16px;
}

.filter-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-toggle {
  min-height: 34px;
  border: 0;
  border-radius: 999px;
  padding: 0 13px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.06);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  cursor: pointer;
}

.filter-toggle:hover,
.filter-toggle.is-active {
  color: var(--text);
  background: rgba(255, 255, 255, 0.12);
}

.filter-panel {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 22px;
  padding: 14px 0 4px;
}

.range-filter,
.compare-filter {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.range-filter {
  flex-wrap: wrap;
}

.compare-filter {
  min-width: 0;
  flex: 1;
  justify-content: flex-end;
}

.filter-label,
.range-filter label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.filter-label {
  color: var(--accent);
}

.range-filter select {
  min-height: 38px;
  border: 0;
  border-radius: 13px;
  max-width: 132px;
  padding: 0 10px;
  color: var(--text);
  background: #1a1a1a;
  font: inherit;
  font-weight: 700;
  outline: none;
  text-transform: uppercase;
}

.range-filter select option {
  color: #f1eee9;
  background: #111;
}

.range-filter select:focus-visible {
  box-shadow: 0 0 0 3px rgba(242, 107, 58, 0.28);
}

.compare-users {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.compare-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  border-radius: 999px;
  padding: 0 10px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.06);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  cursor: pointer;
}

.compare-chip:has(input:checked) {
  color: var(--text);
  background: rgba(255, 255, 255, 0.12);
}

.compare-chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.compare-empty {
  color: var(--faint);
  font-size: 11px;
  text-transform: uppercase;
}

.board-head,
.mission-row {
  display: grid;
  grid-template-columns: minmax(260px, 560px) 118px;
  justify-content: start;
  gap: 18px;
}

.board-head {
  padding: 0 18px 10px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.board-head span:not(:first-child) {
  text-align: center;
}

.mission-board.is-grid .board-head {
  display: none;
}

.mission-list {
  display: grid;
  gap: 9px;
}

.mission-list-grid {
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
}

.mission-row {
  position: relative;
  align-items: center;
  min-height: 92px;
  padding: 15px 18px;
  border-radius: 18px;
  background: var(--row);
  overflow: hidden;
  transition: background 160ms ease, transform 160ms ease;
}

.mission-row.difficulty-trivial {
  background:
    linear-gradient(90deg, var(--row) 0%, var(--row) 58%, var(--trivial-bg) 100%);
}

.mission-row.difficulty-standard {
  background:
    linear-gradient(90deg, var(--row) 0%, var(--row) 58%, var(--standard-bg) 100%);
}

.mission-row.difficulty-heavy {
  background:
    linear-gradient(90deg, var(--row) 0%, var(--row) 58%, var(--heavy-bg) 100%);
}

.mission-row::after {
  position: absolute;
  inset: 0 0 0 auto;
  width: min(42%, 420px);
  background:
    linear-gradient(90deg, rgba(5, 5, 5, 0.98), rgba(5, 5, 5, 0.3) 42%, rgba(5, 5, 5, 0.76)),
    var(--preview-image) center right / cover no-repeat;
  content: "";
  opacity: 0.38;
  z-index: 0;
}

.mission-row:hover {
  background: var(--row-hover);
  transform: translateY(-1px);
}

.mission-row.is-filter-muted {
  opacity: 0.28;
  filter: grayscale(0.8);
}

.mission-row.is-filter-muted:hover {
  opacity: 0.44;
}

.mission-briefing,
.best-slot {
  position: relative;
  z-index: 1;
}

.mission-briefing {
  min-width: 0;
}

.mission-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.mission-order {
  color: var(--faint);
}

.mission-briefing h2 {
  overflow-wrap: anywhere;
  font-size: 20px;
  font-weight: 500;
  line-height: 1.08;
  text-transform: uppercase;
}

.mission-briefing p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
}

.mission-list-grid .mission-row {
  display: flex;
  min-height: 186px;
  flex-direction: column;
  justify-content: flex-end;
  gap: 8px;
  padding: 128px 12px 0;
}

.mission-list-grid .mission-row.difficulty-trivial {
  background: var(--trivial-bg);
}

.mission-list-grid .mission-row.difficulty-standard {
  background: var(--standard-bg);
}

.mission-list-grid .mission-row.difficulty-heavy {
  background: var(--heavy-bg);
}

.mission-list-grid .mission-row::after {
  inset: 0 0 auto 0;
  width: 100%;
  height: 128px;
  background:
    linear-gradient(180deg, rgba(5, 5, 5, 0.02), rgba(5, 5, 5, 0.76)),
    var(--preview-image) center / cover no-repeat;
  opacity: 0.88;
}

.mission-list-grid .mission-briefing {
  position: absolute;
  inset: 0 0 auto 0;
  min-height: 128px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.mission-list-grid .mission-meta {
  margin-bottom: 5px;
}

.mission-list-grid .mission-briefing h2 {
  min-height: 0;
  max-width: 92%;
  font-size: 19px;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.9);
}

.mission-list-grid .mission-briefing p {
  max-width: 88%;
  margin-top: 3px;
  font-size: 11px;
  color: rgba(241, 238, 233, 0.66);
}

.mission-list-grid .team-strip {
  display: none;
}

.best-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: transparent;
}

.best-value {
  display: grid;
  min-width: 104px;
  gap: 1px;
  border: 0;
  border-radius: 0;
  padding: 6px 0;
  color: var(--text);
  background: transparent;
  font: inherit;
  text-align: center;
  outline: none;
}

.best-value:is(button) {
  cursor: pointer;
}

.best-value:is(button):hover {
  color: #fff;
  filter: none;
}

.best-value:focus-visible {
  box-shadow: 0 0 0 3px rgba(242, 107, 58, 0.26);
}

.best-rank {
  font-size: 27px;
  font-weight: 700;
  line-height: 1;
}

.best-difficulty {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.mission-list-grid .best-slot {
  min-height: 58px;
  justify-content: flex-start;
  align-items: center;
  margin: 0 -12px -12px;
  padding: 0 12px;
  border-radius: 0 0 18px 18px;
}

.mission-list-grid .best-value {
  min-width: 0;
  width: 100%;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 8px;
  padding: 0;
  background: transparent;
  text-align: left;
}

.mission-list-grid .best-rank {
  font-size: 24px;
}

.empty-rank {
  color: rgba(241, 238, 233, 0.2);
}

.rank-s {
  color: #ffe29a;
}

.rank-a {
  color: var(--green);
}

.rank-b {
  color: var(--blue);
}

.rank-c {
  color: #ddd08e;
}

.rank-d {
  color: #f19b6f;
}

.rank-f {
  color: #ff6b5f;
}

.rank-custom {
  color: var(--accent);
}

.team-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.team-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

.team-badge.is-out-range {
  opacity: 0.42;
}

.team-badge.is-in-range {
  color: var(--text);
}

.operator-swatch {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.badge-name {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge-difficulty {
  color: var(--faint);
}

.login-modal {
  width: min(420px, calc(100vw - 28px));
  border: 0;
  border-radius: 22px;
  padding: 0;
  color: var(--text);
  background: #111;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.7);
}

.login-modal::backdrop {
  background: rgba(0, 0, 0, 0.72);
}

.login-form {
  position: relative;
  display: grid;
  gap: 13px;
  padding: 26px;
}

.login-form h2 {
  font-size: 24px;
  font-weight: 400;
  text-transform: uppercase;
}

.login-form p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.login-form label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.login-form input {
  width: 100%;
  min-height: 48px;
  border: 0;
  border-radius: 14px;
  padding: 0 14px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  font: inherit;
  font-size: 24px;
  letter-spacing: 0.16em;
  outline: none;
}

.login-form select {
  width: 100%;
  min-height: 44px;
  border: 0;
  border-radius: 14px;
  padding: 0 14px;
  color: var(--text);
  background: #1a1a1a;
  font: inherit;
  font-weight: 700;
  outline: none;
  text-transform: uppercase;
}

.login-form select:focus-visible {
  box-shadow: 0 0 0 3px rgba(242, 107, 58, 0.28);
}

.login-form input:focus-visible {
  box-shadow: 0 0 0 3px rgba(242, 107, 58, 0.28);
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 12px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.06);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}

.primary-button,
.ghost-button {
  min-height: 42px;
  border: 0;
  border-radius: 14px;
  padding: 0 16px;
  color: var(--text);
  font: inherit;
  font-weight: 700;
  text-transform: uppercase;
  cursor: pointer;
}

.primary-button {
  background: var(--accent);
}

.ghost-button {
  background: rgba(255, 255, 255, 0.08);
}

.login-error {
  color: #ffb5aa;
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100% - 20px, 620px);
    padding-top: 22px;
  }

  .topbar,
  .status-strip {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar-actions {
    align-items: flex-end;
  }

  .operator-panel {
    flex: 1;
    min-width: 0;
  }

  .status-metrics {
    justify-content: flex-start;
  }

  .filter-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .range-filter,
  .compare-filter,
  .compare-users {
    justify-content: flex-start;
  }

  .range-filter {
    flex-wrap: wrap;
  }

  .board-head {
    display: none;
  }

  .mission-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 98px;
    min-height: 0;
    padding: 16px;
  }

  .mission-list-grid {
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  }

  .mission-list-grid .mission-row {
    display: flex;
    min-height: 184px;
    padding: 128px 12px 0;
  }

  .mission-row::after {
    width: 58%;
    opacity: 0.26;
  }

  .mission-list-grid .mission-row::after {
    inset: 0 0 auto 0;
    width: 100%;
    height: 128px;
    opacity: 0.88;
  }
}

@media (max-width: 430px) {
  h1 {
    font-size: 40px;
  }
  .board-head,
  .mission-row {
    grid-template-columns: minmax(0, 1fr) 88px;
    gap: 10px;
  }
}
