:root {
  color-scheme: dark;
  --bg: #060909;
  --panel: #141a1d;
  --panel-hover: #1b252a;
  --border: rgba(182, 255, 227, 0.14);
  --text: #f5fff9;
  --muted: #879796;
  --green: #a9ff7a;
  --blue: #44baff;
  --shadow: rgba(0, 0, 0, 0.5);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 48% 35%, rgba(68, 186, 255, 0.09), transparent 26rem),
    linear-gradient(180deg, #050606 0%, var(--bg) 58%, #030505 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

.home-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 3rem 1.25rem 7rem;
}

.center-stage {
  width: min(100%, 31rem);
  display: grid;
  justify-items: center;
  gap: 1.5rem;
  transform: translateY(-0.9rem);
}

.brand-wrap {
  position: relative;
  display: grid;
  place-items: center;
  width: min(84vw, 26rem);
}

.brand-wrap h1 {
  position: relative;
  z-index: 1;
  margin: 0;
  font-size: clamp(5.6rem, 16vw, 9rem);
  line-height: 0.8;
  font-weight: 950;
  letter-spacing: 0;
  color: #fbfffb;
  text-shadow: 0 1.1rem 2.4rem var(--shadow);
}

.brand-line {
  position: absolute;
  inset-inline: 0.35rem;
  top: 50%;
  height: 0.55rem;
  border-radius: 999px;
  transform: translateY(-35%);
  background: linear-gradient(90deg, var(--green), var(--blue));
  box-shadow: 0 0 1.5rem rgba(68, 186, 255, 0.22);
}

.tagline {
  margin: -0.35rem 0 1.2rem;
  color: var(--muted);
  font-size: 0.98rem;
  font-weight: 700;
  letter-spacing: 0;
  text-align: center;
}

.main-nav {
  width: min(100%, 21rem);
  display: grid;
  gap: 0.92rem;
}

.nav-button {
  min-height: 3.55rem;
  display: grid;
  place-items: center;
  padding: 0.9rem 1.4rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.025));
  color: var(--text);
  font-size: 1rem;
  font-weight: 700;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.nav-button:hover,
.nav-button:focus-visible {
  border-color: rgba(169, 255, 122, 0.48);
  background: var(--panel-hover);
  box-shadow: 0 0.65rem 1.5rem rgba(68, 186, 255, 0.1);
  transform: translateY(-2px);
  outline: none;
}

.site-footer {
  position: fixed;
  left: 1.35rem;
  right: 2rem;
  bottom: 0.95rem;
  display: flex;
  align-items: end;
  justify-content: end;
  gap: 1rem;
  pointer-events: none;
}

.footer-links {
  display: grid;
  gap: 0.48rem;
  pointer-events: auto;
}

.footer-links a {
  width: fit-content;
  min-width: 7.7rem;
  display: grid;
  place-items: center;
  padding: 0.48rem 0.78rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 850;
  transition: border-color 160ms ease, background 160ms ease;
}

.footer-links a:hover,
.footer-links a:focus-visible {
  border-color: rgba(68, 186, 255, 0.58);
  background: rgba(68, 186, 255, 0.13);
  outline: none;
}

.site-footer p {
  margin: 0;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0;
  text-align: right;
  pointer-events: auto;
}

.builder-page {
  background: #070909;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 3;
  min-height: 3.4rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.45rem 1rem;
  border-bottom: 1px solid rgba(182, 255, 227, 0.1);
  background: rgba(7, 9, 9, 0.92);
  backdrop-filter: blur(12px);
}

.home-mark {
  position: relative;
  display: inline-grid;
  place-items: center;
  min-width: 4.1rem;
  min-height: 2.4rem;
  font-size: 1.55rem;
  font-weight: 950;
}

.home-mark::after {
  content: "";
  position: absolute;
  left: 0.08rem;
  right: 0.08rem;
  top: 56%;
  height: 0.18rem;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--green), var(--blue));
}

.home-mark span {
  position: relative;
  z-index: 1;
}

.top-nav {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.top-nav a,
.save-button {
  min-height: 2.2rem;
  display: grid;
  place-items: center;
  padding: 0.45rem 1.05rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 700;
}

.top-nav a:hover,
.top-nav a:focus-visible,
.save-button:hover,
.save-button:focus-visible {
  border-color: rgba(68, 186, 255, 0.5);
  background: rgba(68, 186, 255, 0.12);
  outline: none;
}

.builder-shell {
  min-height: calc(100vh - 3.4rem);
  display: grid;
  grid-template-columns: 15.5rem minmax(0, 1fr);
}

.map-sidebar {
  padding: 1.6rem 1rem;
  border-right: 1px solid rgba(182, 255, 227, 0.1);
  background: rgba(255, 255, 255, 0.012);
}

.map-sidebar h2 {
  margin: 0 0 0.72rem;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.map-list {
  display: grid;
  gap: 0.48rem;
}

.map-button {
  min-height: 2.25rem;
  padding: 0.48rem 0.75rem;
  border: 1px solid rgba(182, 255, 227, 0.11);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--text);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
}

.map-button:hover,
.map-button:focus-visible {
  border-color: rgba(68, 186, 255, 0.45);
  background: rgba(68, 186, 255, 0.1);
  outline: none;
}

.map-button.is-active {
  border-color: rgba(169, 255, 122, 0.65);
  background: linear-gradient(90deg, rgba(169, 255, 122, 0.18), rgba(68, 186, 255, 0.1));
}

.composition-panel {
  padding: 2rem 1.75rem;
}

.composition-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.3rem;
}

.composition-top h1 {
  margin: 0;
  font-size: clamp(1.75rem, 4vw, 2.45rem);
  line-height: 1;
  font-weight: 950;
}

.save-button {
  min-width: 7.4rem;
  background: rgba(68, 102, 255, 0.28);
  border-color: rgba(68, 186, 255, 0.2);
  color: rgba(245, 255, 249, 0.86);
  cursor: pointer;
}

.save-button.is-warning {
  border-color: rgba(255, 186, 82, 0.42);
  background: rgba(255, 186, 82, 0.12);
}

.roster-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(6.8rem, 1fr));
  gap: 0.75rem;
  max-width: 49rem;
  margin-bottom: 2rem;
}

.player-slot {
  min-height: 7.5rem;
  display: grid;
  place-items: center;
  border: 1px solid rgba(182, 255, 227, 0.12);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.02)),
    rgba(255, 255, 255, 0.025);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.slot-empty {
  min-width: 4rem;
  height: 4rem;
  display: grid;
  place-items: center;
  border: 2px dashed rgba(182, 255, 227, 0.13);
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  padding-inline: 0.5rem;
}

.player-slot:hover,
.player-slot:focus-visible,
.player-slot.is-selected {
  border-color: rgba(68, 186, 255, 0.5);
  box-shadow: 0 0 0 1px rgba(68, 186, 255, 0.16), 0 0.8rem 1.6rem rgba(68, 186, 255, 0.08);
  outline: none;
}

.player-slot.has-agent {
  grid-template-rows: auto 1fr auto;
  align-content: center;
  gap: 0.18rem;
  padding: 0.62rem 0.5rem 0.55rem;
  background:
    radial-gradient(circle at 50% 42%, rgba(68, 186, 255, 0.1), transparent 4.6rem),
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.02)),
    rgba(255, 255, 255, 0.025);
}

.slot-player {
  max-width: 100%;
  color: rgba(169, 255, 122, 0.78);
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  overflow: hidden;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.slot-agent {
  color: rgba(245, 255, 249, 0.82);
  font-size: 0.68rem;
  font-weight: 850;
  letter-spacing: 0;
  line-height: 1.1;
}

.slot-portrait {
  width: 4.85rem;
  height: 4.85rem;
  object-fit: contain;
  object-position: center bottom;
  filter: drop-shadow(0 0.7rem 0.9rem rgba(0, 0, 0, 0.45));
}

.agent-library {
  display: grid;
  gap: 2rem;
  max-width: 50rem;
}

.agent-role {
  display: grid;
  gap: 0.8rem;
}

.agent-role h2 {
  margin: 0;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid rgba(182, 255, 227, 0.08);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.agent-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(5.7rem, 1fr));
  gap: 0.72rem;
}

.agent-card {
  min-height: 7.1rem;
  display: grid;
  align-content: end;
  justify-items: center;
  gap: 0.38rem;
  padding: 0.72rem 0.48rem 0.62rem;
  border: 1px solid rgba(182, 255, 227, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: rgba(245, 255, 249, 0.76);
  font: inherit;
  font-size: 0.74rem;
  font-weight: 800;
  cursor: pointer;
}

.agent-card:hover,
.agent-card:focus-visible {
  border-color: rgba(68, 186, 255, 0.48);
  background: rgba(68, 186, 255, 0.11);
  color: var(--text);
  outline: none;
}

.agent-card.is-picked {
  border-color: rgba(169, 255, 122, 0.56);
  background: rgba(169, 255, 122, 0.12);
}

.agent-avatar {
  width: 4.4rem;
  height: 4.4rem;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background:
    radial-gradient(circle at 36% 30%, rgba(169, 255, 122, 0.58), transparent 1.4rem),
    linear-gradient(135deg, rgba(68, 186, 255, 0.72), rgba(49, 92, 255, 0.22));
  color: #fafffb;
  font-size: 1.65rem;
  font-weight: 950;
  text-shadow: 0 0.45rem 1rem rgba(0, 0, 0, 0.48);
}

.agent-portrait {
  width: 4.7rem;
  height: 4.7rem;
  object-fit: contain;
  object-position: center bottom;
  filter: drop-shadow(0 0.55rem 0.8rem rgba(0, 0, 0, 0.42));
}

.saved-shell {
  padding: 2rem 1.75rem;
}

.saved-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.8rem;
}

.saved-top h1 {
  margin: 0;
  font-size: clamp(1.9rem, 4vw, 2.45rem);
  line-height: 1;
  font-weight: 950;
}

.download-button {
  min-height: 2.55rem;
  display: grid;
  place-items: center;
  padding: 0.55rem 1.15rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.055);
  color: rgba(245, 255, 249, 0.8);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 800;
  cursor: pointer;
}

.download-button:hover,
.download-button:focus-visible {
  border-color: rgba(68, 186, 255, 0.48);
  background: rgba(68, 186, 255, 0.11);
  outline: none;
}

.saved-list {
  display: grid;
  gap: 1rem;
}

.saved-map-card {
  min-height: 9.6rem;
  padding: 1.35rem 1.4rem;
  border: 1px solid rgba(182, 255, 227, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.025);
}

.saved-map-card h2 {
  margin: 0 0 1rem;
  font-size: 1.18rem;
  line-height: 1;
  font-weight: 950;
}

.saved-roster {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.saved-slot {
  width: 4.9rem;
  display: grid;
  justify-items: center;
  gap: 0.2rem;
}

.saved-player {
  max-width: 100%;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  overflow: hidden;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.saved-slot img {
  width: 4.1rem;
  height: 4.1rem;
  object-fit: contain;
  filter: drop-shadow(0 0.45rem 0.65rem rgba(0, 0, 0, 0.38));
}

.saved-agent {
  max-width: 100%;
  color: rgba(245, 255, 249, 0.72);
  font-size: 0.66rem;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty-comp {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 750;
}

.settings-shell {
  padding: 2rem 1.55rem;
}

.settings-shell h1 {
  margin: 0 0 1.9rem;
  font-size: clamp(1.9rem, 4vw, 2.45rem);
  line-height: 1;
  font-weight: 950;
}

.settings-section {
  display: grid;
  gap: 0.75rem;
  max-width: 56rem;
}

.settings-section h2 {
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.label-form {
  display: grid;
  grid-template-columns: repeat(5, minmax(6rem, 1fr));
  gap: 0.65rem;
  max-width: 36rem;
}

.label-field {
  min-width: 0;
  display: grid;
  gap: 0.28rem;
}

.label-field span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.1em;
}

.label-field input {
  width: 100%;
  min-width: 0;
  min-height: 2.65rem;
  padding: 0.55rem 0.58rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.label-field input:focus {
  border-color: rgba(68, 186, 255, 0.5);
  box-shadow: 0 0 0 1px rgba(68, 186, 255, 0.16);
  outline: none;
}

.settings-status {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 750;
}

.my-agents-shell {
  padding: 2rem 1.55rem;
}

.my-map-list {
  display: grid;
  gap: 1rem;
}

.my-map-card {
  display: grid;
  gap: 1rem;
  padding: 1.15rem 1.25rem;
  border: 1px solid rgba(182, 255, 227, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.025);
}

.my-map-head {
  display: grid;
  grid-template-columns: minmax(8rem, 12rem) minmax(0, 1fr);
  align-items: center;
  gap: 1rem;
}

.my-map-head h2 {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1;
  font-weight: 950;
}

.my-selected-agents {
  min-height: 4rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.my-selected-agent {
  width: 4.45rem;
  display: grid;
  justify-items: center;
  gap: 0.16rem;
}

.my-selected-agent img {
  width: 3.35rem;
  height: 3.35rem;
  object-fit: contain;
  filter: drop-shadow(0 0.35rem 0.55rem rgba(0, 0, 0, 0.38));
}

.my-selected-agent span {
  max-width: 100%;
  color: rgba(245, 255, 249, 0.76);
  font-size: 0.64rem;
  font-weight: 850;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.my-empty-note {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 750;
}

.my-agent-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(5rem, 1fr));
  gap: 0.52rem;
}

.my-agent-chip {
  min-width: 0;
  min-height: 4.85rem;
  display: grid;
  justify-items: center;
  align-content: end;
  gap: 0.15rem;
  padding: 0.38rem 0.32rem;
  border: 1px solid rgba(182, 255, 227, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
  color: rgba(245, 255, 249, 0.72);
  font: inherit;
  cursor: pointer;
}

.my-agent-chip:hover,
.my-agent-chip:focus-visible {
  border-color: rgba(68, 186, 255, 0.42);
  background: rgba(68, 186, 255, 0.1);
  outline: none;
}

.my-agent-chip.is-selected {
  border-color: rgba(169, 255, 122, 0.58);
  background: rgba(169, 255, 122, 0.12);
}

.my-agent-chip img {
  width: 3.1rem;
  height: 3.1rem;
  object-fit: contain;
  filter: drop-shadow(0 0.35rem 0.55rem rgba(0, 0, 0, 0.34));
}

.my-agent-chip span {
  max-width: 100%;
  font-size: 0.62rem;
  font-weight: 850;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 560px) {
  .home-shell {
    padding-bottom: 10rem;
  }

  .center-stage {
    gap: 2.7rem;
  }

  .main-nav {
    width: min(100%, 19rem);
  }

  .site-footer {
    position: absolute;
    align-items: start;
    flex-direction: column;
    bottom: 1.1rem;
  }

  .site-footer p {
    text-align: left;
  }
}

@media (max-width: 620px) {
  .saved-shell {
    padding: 1.4rem 1rem;
  }

  .saved-top {
    align-items: stretch;
    flex-direction: column;
  }

  .download-button {
    width: fit-content;
  }

  .label-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-width: 100%;
  }

  .my-agents-shell {
    padding: 1.4rem 1rem;
  }

  .my-map-head {
    grid-template-columns: 1fr;
    align-items: start;
  }
}

@media (max-width: 820px) {
  .builder-shell {
    grid-template-columns: 1fr;
  }

  .map-sidebar {
    border-right: 0;
    border-bottom: 1px solid rgba(182, 255, 227, 0.1);
    padding: 1rem;
  }

  .map-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .composition-panel {
    padding: 1.4rem 1rem 2rem;
  }

  .composition-top {
    align-items: stretch;
    flex-direction: column;
  }

  .save-button {
    width: fit-content;
  }

  .roster-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .agent-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 440px) {
  .top-nav {
    gap: 0.45rem;
  }

  .top-nav a {
    padding-inline: 0.72rem;
    font-size: 0.84rem;
  }

  .map-list,
  .roster-grid {
    grid-template-columns: 1fr;
  }

  .agent-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .label-form {
    grid-template-columns: 1fr;
  }
}
