body.page-legends {
  --lg-text: #142236;
  --lg-muted: #627489;
  --lg-line: rgba(20, 34, 54, 0.1);
  --lg-line-strong: rgba(20, 34, 54, 0.16);
  --lg-surface: rgba(255, 255, 255, 0.72);
  --lg-focus: rgba(27, 177, 242, 0.14);
  background:
    radial-gradient(circle at 8% 10%, rgba(27, 177, 242, 0.1), transparent 38%),
    radial-gradient(circle at 92% 12%, rgba(255, 7, 108, 0.06), transparent 40%),
    linear-gradient(180deg, #f8fbff 0%, #f1f6fd 48%, #edf3fb 100%);
  color: var(--lg-text);
}

body.page-legends::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(20, 34, 54, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(20, 34, 54, 0.02) 1px, transparent 1px);
  background-size: 30px 30px;
}

.page-legends .bg-orb {
  opacity: 0.14;
}

.page-legends .site-header,
.page-legends .site-footer {
  background: rgba(248, 251, 255, 0.8);
  backdrop-filter: blur(10px);
}

.page-legends .nav-link,
.page-legends .footer-list a {
  color: #5e7086;
}

.page-legends .nav-lang-toggle {
  color: #5e7086;
}

.page-legends .nav-link:hover,
.page-legends .footer-list a:hover,
.page-legends .nav-lang-toggle:hover,
.page-legends .nav-lang.is-open .nav-lang-toggle {
  color: #142236;
}

.page-legends .nav-link.is-active {
  color: #142236;
}

.page-legends .nav-lang-menu {
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(15, 29, 49, 0.12);
  box-shadow: 0 18px 40px rgba(15, 29, 49, 0.16);
  color: #1a2a3f;
}

.page-legends .nav-lang-option:hover,
.page-legends .nav-lang-option:focus-visible {
  color: #0f1d31;
  background: linear-gradient(120deg, rgba(56, 234, 215, 0.12), rgba(255, 79, 183, 0.12));
}

.page-legends .nav-lang-option.is-active {
  color: #0f1d31;
  background: linear-gradient(120deg, rgba(56, 234, 215, 0.16), rgba(255, 79, 183, 0.14));
}

.page-legends .main-content {
  width: min(100% - 2rem, 1680px);
  max-width: none;
  padding-top: 1rem;
  padding-bottom: 2.5rem;
}

.legends-shell {
  display: block;
}

.legends-hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(18rem, 0.8fr);
  gap: 1.5rem;
  padding: 0.5rem 0 0.9rem;
  border-top: 1px solid var(--lg-line);
}

.legends-hero-copy h1 {
  margin: 0.35rem 0 0;
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 3.25rem);
  line-height: 0.95;
  letter-spacing: -0.03em;
}

.legends-hero-note {
  max-width: 60rem;
  margin: 0.8rem 0 0;
  color: var(--lg-muted);
  font-size: 0.96rem;
  line-height: 1.55;
}

.legends-hero-side {
  display: grid;
  gap: 0.45rem;
  align-content: end;
}

.legends-hero-meter {
  display: grid;
  grid-template-columns: 4.2rem 1fr;
  gap: 0.75rem;
  align-items: baseline;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--lg-line);
}

.legends-hero-meter--soft {
  border-bottom: 0;
}

.legends-hero-meter span {
  font-family: var(--font-display);
  font-size: 1.65rem;
  line-height: 1;
}

.legends-hero-meter small,
.legends-toolbar-label,
.legends-preview-label,
.legends-session-stat span,
.legends-session-history-title {
  color: var(--lg-muted);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.legends-app {
  display: grid;
  gap: 1rem;
  margin-top: 0.45rem;
}

.legends-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  flex-wrap: wrap;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--lg-line);
}

.legends-toolbar-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.legends-team-select-wrap {
  min-width: min(100%, 18rem);
}

.legends-team-select,
.legends-slot-select,
.legends-text-input {
  width: 100%;
  min-height: 1.95rem;
  border: 1px solid rgba(20, 34, 54, 0.12);
  border-radius: 0.7rem;
  background: rgba(255, 255, 255, 0.9);
  color: var(--lg-text);
  font: inherit;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.legends-team-select,
.legends-slot-select {
  padding: 0.34rem 0.68rem;
  font-size: 0.8rem;
}

.legends-text-input {
  padding: 0.34rem 0.74rem;
  font-size: 0.83rem;
  font-weight: 600;
}

.legends-team-select:focus,
.legends-slot-select:focus,
.legends-text-input:focus {
  border-color: rgba(27, 177, 242, 0.34);
  box-shadow: 0 0 0 3px var(--lg-focus);
}

.legends-save-button,
.legends-login-button,
.legends-list-button {
  appearance: none;
  border: 0;
  border-left: 1.5px solid rgba(20, 34, 54, 0.22);
  border-bottom: 1.5px solid rgba(20, 34, 54, 0.22);
  border-radius: 0;
  min-height: 1.95rem;
  padding: 0.34rem 0.74rem;
  background: rgba(255, 255, 255, 0.92);
  color: #183048;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  letter-spacing: 0.01em;
  transition:
    padding 200ms ease,
    letter-spacing 200ms ease,
    border-color 0.18s ease,
    background-color 0.18s ease,
    color 0.18s ease;
}

.legends-icon-button {
  appearance: none;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid rgba(20, 34, 54, 0.1);
  border-radius: 0.65rem;
  background: rgba(255, 255, 255, 0.92);
  color: #29425c;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.18s ease, background-color 0.18s ease, color 0.18s ease, opacity 0.18s ease;
}

.legends-icon-button svg {
  width: 0.95rem;
  height: 0.95rem;
  display: block;
}

.legends-icon-button:hover {
  border-color: rgba(20, 34, 54, 0.22);
  background: rgba(255, 255, 255, 1);
}

.legends-icon-button.is-danger {
  color: #b43d47;
}

.legends-icon-button:disabled {
  opacity: 0.38;
  cursor: default;
}

.legends-save-button,
.legends-login-button {
  background: #13233a;
  border-left-color: rgba(56, 234, 215, 0.5);
  border-bottom-color: rgba(56, 234, 215, 0.5);
  color: #f7fbff;
}

.legends-save-button:hover,
.legends-login-button:hover,
.legends-list-button:hover {
  padding-left: 1.1rem;
  padding-right: 1.1rem;
  letter-spacing: 0.05em;
  border-left-color: rgba(20, 34, 54, 0.35);
  border-bottom-color: rgba(20, 34, 54, 0.35);
  background: rgba(255, 255, 255, 1);
}

.legends-save-button:hover,
.legends-login-button:hover {
  background: #0f1d31;
  border-color: #0f1d31;
}

.legends-save-button[data-dirty="true"] {
  background: linear-gradient(90deg, #1bb1f2, #ff076c);
  border-color: transparent;
}

.legends-list-button.is-danger {
  color: #b43d47;
}

.legends-list-button:disabled,
.legends-save-button:disabled {
  opacity: 0.55;
  cursor: default;
}

.legends-status {
  margin: 0;
  min-height: 1.2rem;
  color: var(--lg-muted);
  font-size: 0.84rem;
}

.legends-status[data-kind="ok"] {
  color: #1b7d5d;
}

.legends-status[data-kind="warn"] {
  color: #a3691d;
}

.legends-status[data-kind="error"] {
  color: #b43d47;
}

.legends-session-panel,
.legends-rounds-panel {
  display: grid;
  gap: 0.55rem;
}

.legends-section-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.08rem;
  line-height: 1;
}

.legends-session-body,
.legends-preview,
.legends-unassigned {
  padding: 0.8rem 0;
  border-top: 1px solid var(--lg-line);
  border-bottom: 1px solid var(--lg-line);
}

.legends-relations {
  display: grid;
  gap: 0.55rem;
  padding: 0.85rem 0;
  border-top: 1px solid var(--lg-line);
}

.legends-relations-head {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  justify-content: flex-start;
  width: fit-content;
}

.legends-session-summary {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.legends-session-stat {
  display: grid;
  gap: 0.14rem;
}

.legends-session-stat strong,
.legends-preview-head strong,
.legends-preview-value strong,
.legends-unassigned-head strong {
  font-size: 0.9rem;
  color: #163049;
}

.legends-session-history {
  display: grid;
  gap: 0.3rem;
  margin-top: 0.7rem;
}

.legends-session-banned-list {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.legends-banned-item {
  border: 1px solid rgba(20, 34, 54, 0.08);
  border-radius: 0.8rem;
  background: rgba(255, 255, 255, 0.88);
  color: #183048;
  min-height: 2rem;
  padding: 0.32rem 0.38rem 0.32rem 0.68rem;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.legends-banned-item strong {
  font-size: 0.84rem;
  font-weight: 700;
}

.legends-banned-unban {
  appearance: none;
  border: 1px solid rgba(180, 61, 71, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  color: #b43d47;
  min-height: 1.65rem;
  padding: 0.16rem 0.58rem;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
}

.legends-banned-unban:hover {
  background: rgba(255, 243, 244, 1);
  border-color: rgba(180, 61, 71, 0.3);
}

.legends-session-history ul {
  margin: 0;
  padding-left: 1rem;
  color: var(--lg-muted);
  font-size: 0.88rem;
}

.legends-session-empty {
  margin: 0;
  color: var(--lg-muted);
}

.legends-map-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 0.55rem;
  padding-bottom: 0.2rem;
}

.legends-map-card {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 1rem;
  background: transparent;
  padding: 0.3rem;
  display: grid;
  gap: 0.35rem;
  text-align: left;
  color: inherit;
  cursor: pointer;
  transition: border-color 0.18s ease, background-color 0.18s ease;
}

.legends-map-card:hover,
.legends-map-card.is-active {
  background: var(--lg-surface);
  border-color: rgba(20, 34, 54, 0.08);
}

.legends-map-card.is-active {
  border-color: rgba(27, 177, 242, 0.22);
}

.legends-map-image {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 7;
  border-radius: 0.82rem;
  background-position: center;
  background-size: cover;
}

.legends-map-name {
  padding: 0 0.15rem 0.1rem;
  font-size: 0.83rem;
  font-weight: 650;
}

.legends-rounds {
  display: grid;
  gap: 1rem;
}

.legends-preview {
  display: grid;
  gap: 0.7rem;
}

.legends-preview-head,
.legends-unassigned-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.legends-preview-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.legends-preview-slot {
  display: grid;
  gap: 0.24rem;
}

.legends-preview-value,
.legends-priority-main {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
}

.legends-preview-list {
  margin: 0;
  padding-left: 1rem;
  color: var(--lg-muted);
  font-size: 0.88rem;
}

.legends-categories-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  align-items: start;
}

.legends-category-card {
  display: grid;
  gap: 0.7rem;
  padding: 0.85rem 0;
  border-top: 1px solid var(--lg-line);
  align-content: start;
  align-self: start;
}

.legends-category-head {
  display: grid;
  gap: 0.3rem;
}

.legends-field {
  display: grid;
  gap: 0.32rem;
}

.legends-category-hint {
  margin: 0;
  color: var(--lg-muted);
  font-size: 0.8rem;
}

.legends-add-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.35rem;
  align-items: center;
}

.legends-relations-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: flex-start;
  justify-content: flex-start;
}

.legends-relation-block {
  display: grid;
  gap: 0.4rem;
  padding: 0.45rem 0.5rem;
  border: 1px solid rgba(20, 34, 54, 0.08);
  border-radius: 0.95rem;
  background: rgba(255, 255, 255, 0.72);
  justify-items: start;
}

.legends-relation-row {
  display: grid;
  grid-template-columns: 2.2rem 2.1rem 2.2rem auto;
  gap: 0.32rem;
  align-items: center;
  justify-content: start;
}

.legends-relation-portrait {
  appearance: none;
  width: 2.2rem;
  height: 2.2rem;
  padding: 0;
  border: 1px solid rgba(20, 34, 54, 0.1);
  border-radius: 0.7rem;
  background: rgba(255, 255, 255, 0.94);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.legends-relation-placeholder {
  color: var(--lg-muted);
  font-size: 1rem;
  font-weight: 700;
}

.legends-relation-line {
  width: 100%;
  height: 1px;
  display: block;
  background: linear-gradient(90deg, rgba(20, 34, 54, 0.16), rgba(27, 177, 242, 0.3), rgba(20, 34, 54, 0.16));
  border-radius: 999px;
  position: relative;
}

.legends-relation-line::after {
  content: "";
  position: absolute;
  right: -0.02rem;
  top: 50%;
  width: 0.38rem;
  height: 0.38rem;
  border-radius: 50%;
  background: rgba(27, 177, 242, 0.42);
  transform: translateY(-50%);
}

.legends-relation-picker {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  padding-left: 0;
  justify-content: flex-start;
  max-width: 13.5rem;
}

.legends-relation-option {
  appearance: none;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid rgba(20, 34, 54, 0.08);
  border-radius: 0.65rem;
  background: rgba(255, 255, 255, 0.94);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.legends-relation-option.is-active {
  border-color: rgba(27, 177, 242, 0.42);
  box-shadow: 0 0 0 2px rgba(27, 177, 242, 0.12);
}

.legends-add-row .legends-slot-select {
  max-width: 15.5rem;
}

.legends-add-row .legends-list-button {
  white-space: nowrap;
}

.legends-priority-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.45rem;
}

.legends-priority-row {
  display: grid;
  grid-template-columns: 1.6rem minmax(0, 1fr) auto;
  gap: 0.55rem;
  align-items: center;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid var(--lg-line);
}

.legends-priority-empty {
  color: var(--lg-muted);
  font-size: 0.88rem;
  padding: 0.15rem 0;
}

.legends-priority-rank {
  color: var(--lg-muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.legends-priority-actions {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.legends-mini-image {
  width: 28px;
  height: 28px;
  border-radius: 0;
  border: 0;
  background: transparent;
  object-fit: contain;
}

.legends-chip-list {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  margin-top: 0.7rem;
}

.legends-chip {
  display: inline-flex;
  align-items: center;
  min-height: 1.85rem;
  padding: 0.28rem 0.68rem;
  border: 1px solid rgba(20, 34, 54, 0.08);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.84);
  font-size: 0.8rem;
  color: #27415b;
}

.legends-lock-card {
  max-width: 46rem;
  padding: 1rem 0 0.4rem;
  border-top: 1px solid var(--lg-line);
}

.legends-lock-card h2 {
  margin: 0.2rem 0 0.55rem;
  font-family: var(--font-display);
  font-size: clamp(1.55rem, 2.7vw, 2.15rem);
  line-height: 1;
}

.legends-lock-card p,
.legends-empty-card p {
  color: var(--lg-muted);
}

.legends-empty-card h3,
.legends-empty-card p {
  margin: 0;
}

@media (max-width: 1080px) {
  .page-legends .main-content {
    width: min(100% - 1.5rem, 1680px);
  }

  .legends-hero-panel,
  .legends-categories-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .page-legends .main-content {
    width: min(100% - 1rem, 1680px);
  }

  .legends-preview-grid {
    grid-template-columns: 1fr;
  }

  .legends-add-row,
  .legends-priority-row,
  .legends-relation-row {
    grid-template-columns: 1fr;
  }

  .legends-relation-line {
    width: 100%;
  }

  .legends-relations-head {
    width: 100%;
    justify-content: space-between;
  }

  .legends-priority-actions {
    justify-content: flex-start;
  }

  .legends-map-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .legends-toolbar,
  .legends-toolbar-meta {
    align-items: stretch;
    flex-direction: column;
  }

  .legends-team-select-wrap,
  .legends-save-button {
    width: 100%;
  }
}
