:root {
  color-scheme: dark;
  --bg: #050505;
  --panel: #101010;
  --panel-2: #171717;
  --text: #f7f7f2;
  --muted: #b9b9b3;
  --line: #2b2b2b;
  --accent: #ffffff;
  --danger: #ff6961;
  --ok: #8ee6a1;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #050505;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: inherit;
}

.page {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 56px;
}

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card,
.panel {
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  border: 1px solid var(--line);
  box-shadow: 0 24px 80px rgba(0,0,0,.45);
}

.auth-card {
  width: min(560px, 100%);
  padding: 28px;
}

.brand-lockup {
  display: grid;
  grid-template-columns: 1fr 1px 1fr;
  gap: 22px;
  align-items: center;
  margin-bottom: 24px;
}

.brand-lockup::before {
  content: "";
  grid-column: 2;
  grid-row: 1;
  width: 1px;
  height: 78px;
  background: var(--line);
}

.brand-lockup--single {
  grid-template-columns: 1fr;
}

.brand-lockup--single::before {
  display: none;
}

.brand-side {
  display: grid;
  gap: 10px;
  justify-items: center;
  text-align: center;
}

.brand-side img {
  max-width: 154px;
  max-height: 86px;
  object-fit: contain;
}

.brand-side span,
.eyebrow {
  color: var(--muted);
  font-size: .72rem;
  letter-spacing: .16em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  font-size: clamp(2rem, 5vw, 4.25rem);
  letter-spacing: 0;
  line-height: .96;
}

h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
}

.copy {
  color: var(--muted);
  line-height: 1.65;
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.field label {
  color: var(--muted);
  font-size: .9rem;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #070707;
  color: var(--text);
  padding: 13px 14px;
  font: inherit;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
}

textarea {
  min-height: 180px;
  resize: vertical;
}

.button,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #050505;
  padding: 12px 18px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  min-height: 46px;
}

.button.secondary,
button.secondary {
  background: transparent;
  color: var(--text);
  border-color: var(--line);
}

button:disabled,
button[disabled] {
  cursor: not-allowed;
  opacity: .5;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.inline-claim-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-top: 12px;
}

.inline-claim-form input {
  min-width: 0;
}

.inline-claim-form button {
  min-height: 42px;
  padding: 10px 14px;
  white-space: nowrap;
}

.form-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 2px 0 4px;
}

.form-links a,
.notice a {
  color: var(--text);
  font-weight: 800;
}

.notice {
  border: 1px solid var(--line);
  background: #0a0a0a;
  padding: 12px 14px;
  color: var(--muted);
  margin-bottom: 16px;
}

.notice.error {
  border-color: color-mix(in srgb, var(--danger) 60%, var(--line));
  color: #ffd5d2;
}

.notice.ok {
  border-color: color-mix(in srgb, var(--ok) 60%, var(--line));
  color: #d8ffde;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 0 28px;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  font-weight: 900;
}

.topbar-brand img {
  width: 44px;
  height: 44px;
  object-fit: contain;
}

.nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.docs-page code {
  color: #f7f7f2;
  background: #050505;
  border: 1px solid var(--line);
  padding: 2px 6px;
  font-family: "Cascadia Code", "Consolas", ui-monospace, monospace;
  font-size: .92em;
}

.docs-page pre {
  overflow-x: auto;
  margin: 14px 0 0;
  padding: 16px;
  background: #050505;
  border: 1px solid var(--line);
  color: #f7f7f2;
  line-height: 1.55;
}

.docs-page pre code {
  display: block;
  border: 0;
  padding: 0;
  background: transparent;
  white-space: pre;
}

.docs-hero {
  padding: 28px;
  margin-bottom: 20px;
}

.docs-hero h1 {
  max-width: 820px;
  margin-bottom: 12px;
}

.docs-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 20px;
}

.docs-meta-grid > div {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  background: #070707;
}

.docs-meta-grid span {
  color: var(--muted);
  font-size: .8rem;
  text-transform: uppercase;
}

.docs-meta-grid code {
  overflow-wrap: anywhere;
}

.docs-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 20px;
}

.docs-toc {
  position: sticky;
  top: 18px;
  align-self: start;
  display: grid;
  gap: 8px;
  padding: 18px;
}

.docs-toc strong {
  margin-bottom: 6px;
}

.docs-toc a {
  color: var(--muted);
  text-decoration: none;
  padding: 8px 0;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
}

.docs-toc a:hover {
  color: var(--text);
}

.docs-content {
  display: grid;
  gap: 20px;
  min-width: 0;
}

.docs-section {
  padding: 24px;
}

.docs-section h2 {
  margin-bottom: 10px;
}

.docs-section h3 {
  margin: 22px 0 8px;
}

.docs-callout {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--ok) 42%, var(--line));
  background: color-mix(in srgb, var(--ok) 8%, #050505);
}

.docs-callout p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.docs-list {
  display: grid;
  gap: 10px;
  padding-left: 22px;
  color: var(--muted);
  line-height: 1.6;
}

.endpoint-list {
  display: grid;
  gap: 14px;
}

.endpoint-card {
  padding: 16px;
  border: 1px solid var(--line);
  background: #080808;
}

.endpoint-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
}

.endpoint-card__head h3 {
  margin: 0;
  font-size: 1.05rem;
}

.endpoint-card__head > span {
  max-width: 240px;
  color: var(--muted);
  font-size: .9rem;
  text-align: right;
}

.endpoint-card details {
  margin-top: 10px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.endpoint-card summary {
  cursor: pointer;
  font-weight: 800;
}

@media (max-width: 860px) {
  .docs-layout,
  .docs-meta-grid {
    grid-template-columns: 1fr;
  }

  .docs-toc {
    position: static;
  }

  .endpoint-card__head {
    display: grid;
  }

  .endpoint-card__head > span {
    max-width: none;
    text-align: left;
  }
}

.nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 9px 12px;
}

.nav a:hover,
.nav a.is-linked {
  color: var(--text);
  background: var(--panel);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 24px;
  align-items: stretch;
  margin-bottom: 24px;
}

.panel {
  padding: 24px;
}

.profile-strip {
  display: grid;
  gap: 16px;
}

.avatar {
  width: 96px;
  height: 96px;
  border: 1px solid var(--line);
  background: #050505;
  object-fit: cover;
}

.avatar-fallback {
  display: grid;
  place-items: center;
  font-size: 2rem;
  font-weight: 900;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.game-card,
.stat-card {
  position: relative;
  border: 1px solid var(--line);
  background: var(--panel-2);
  padding: 18px;
}

.game-card {
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 16px;
  align-items: center;
}

.game-card img {
  width: 76px;
  height: 76px;
  object-fit: contain;
  background: #050505;
}

.game-card.is-locked,
.stat-card.is-locked {
  opacity: .42;
  filter: grayscale(1);
}

.game-card.is-owned,
.stat-card.is-owned {
  border-color: color-mix(in srgb, var(--ok) 52%, var(--line));
}

.ownership-badge {
  position: absolute;
  left: 12px;
  bottom: 12px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  background: rgba(5, 5, 5, .9);
  color: var(--muted);
  padding: 6px 8px;
  font-size: .72rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.ownership-badge.owned {
  border-color: color-mix(in srgb, var(--ok) 60%, var(--line));
  color: var(--ok);
}

.ownership-badge.locked {
  color: var(--muted);
}

.section-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.purchase-list {
  display: grid;
  gap: 10px;
}

.purchase-row {
  position: relative;
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  border: 1px solid var(--line);
  background: var(--panel-2);
  padding: 14px;
}

.purchase-row img {
  width: 54px;
  height: 54px;
  object-fit: contain;
  background: #050505;
}

.purchase-row .ownership-badge {
  position: static;
}

.stat-card span {
  display: block;
  color: var(--muted);
  font-size: .86rem;
  margin-bottom: 8px;
}

.stat-card strong {
  font-size: 1.8rem;
}

.dashboard-page {
  padding-top: 24px;
}

.dashboard-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  gap: 18px;
  margin-bottom: 18px;
}

.account-card {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 20px;
  align-items: center;
}

.account-card h1 {
  margin-bottom: 8px;
  font-size: clamp(2rem, 4.6vw, 3.5rem);
}

.avatar-form {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.avatar-form label {
  color: var(--muted);
  font-size: .84rem;
  font-weight: 800;
}

.link-card {
  display: grid;
  gap: 16px;
  align-content: space-between;
}

.link-card__icon {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #050505;
  font-size: 1.55rem;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
}

.game-dashboard-card {
  display: grid;
  gap: 18px;
}

.game-dashboard-card.is-locked {
  border-color: color-mix(in srgb, var(--danger) 36%, var(--line));
}

.game-dashboard-card__head {
  position: relative;
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
}

.game-dashboard-card__head img {
  width: 78px;
  height: 78px;
  object-fit: contain;
  background: #050505;
  border: 1px solid var(--line);
}

.game-dashboard-card__head h2 {
  margin-bottom: 6px;
}

.stat-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  gap: 10px;
}

.game-dashboard-card__head .ownership-badge {
  position: static;
  align-self: start;
  justify-self: end;
}

.stat-strip > div,
.detail-box,
.friend-panel,
.history-row {
  border: 1px solid var(--line);
  background: #0b0b0b;
}

.stat-strip > div {
  padding: 14px;
}

.stat-strip span,
.stat-list span,
.history-row span {
  display: block;
  color: var(--muted);
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.stat-strip strong {
  display: block;
  margin-top: 7px;
  font-size: 1.15rem;
  overflow-wrap: anywhere;
}

.detail-box {
  padding: 0;
}

.detail-box summary {
  cursor: pointer;
  padding: 14px 16px;
  color: var(--text);
  font-weight: 900;
}

.detail-box[open] summary {
  border-bottom: 1px solid var(--line);
}

.stat-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
}

.stat-list > div {
  min-width: 0;
  padding: 12px;
  background: #0b0b0b;
}

.stat-list strong {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.achievement-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 10px;
  padding: 14px;
}

.achievement-row,
.friend-row,
.history-row {
  display: grid;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  background: var(--panel-2);
}

.achievement-row {
  grid-template-columns: 52px minmax(0, 1fr);
  align-items: start;
}

.achievement-row img {
  width: 52px;
  height: 52px;
  object-fit: cover;
  background: #050505;
  border: 1px solid var(--line);
}

.achievement-row > span {
  grid-column: 2;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.achievement-row.is-unlocked {
  border-color: color-mix(in srgb, var(--ok) 50%, var(--line));
}

.achievement-row.is-unlocked > span {
  color: var(--ok);
}

.friend-panel {
  padding: 16px;
}

.friend-panel h3 {
  margin-bottom: 0;
}

.friend-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.friend-row {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.friend-row .copy {
  margin-bottom: 0;
}

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

.card-actions {
  display: flex;
  justify-content: flex-end;
}

.dashboard-lower-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, .72fr);
  gap: 18px;
  margin-top: 18px;
}

.history-list {
  display: grid;
  gap: 10px;
}

.history-row {
  grid-template-columns: minmax(0, 1fr) auto;
}

.history-row > span {
  text-align: right;
  text-transform: none;
  letter-spacing: 0;
}

.security-center {
  display: grid;
  gap: 14px;
}

.security-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.security-grid > div {
  border: 1px solid var(--line);
  background: #0b0b0b;
  padding: 14px;
}

.security-grid span {
  display: block;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.security-grid strong {
  display: block;
  margin-top: 6px;
  font-size: 1.16rem;
}

.security-list {
  padding: 12px;
}

.game-lock-notice {
  margin-bottom: 0;
}

.ecosystem-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 18px;
}

.ecosystem-panel {
  display: grid;
  gap: 16px;
  align-content: start;
}

.ecosystem-form {
  display: grid;
  gap: 12px;
}

.privacy-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.privacy-form > button,
.privacy-form > .check-row {
  grid-column: 1 / -1;
}

.check-row {
  display: flex;
  gap: 10px;
  align-items: center;
  color: var(--muted);
}

.check-row input {
  width: auto;
}

.ecosystem-list,
.challenge-grid {
  display: grid;
  gap: 10px;
}

.ecosystem-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  background: #0b0b0b;
  padding: 12px;
}

.ecosystem-row.is-unread {
  border-color: color-mix(in srgb, var(--ok) 55%, var(--line));
}

.ecosystem-row p,
.ecosystem-row span {
  margin-bottom: 0;
}

.challenge-card {
  border: 1px solid var(--line);
  background: #0b0b0b;
  padding: 14px;
  display: grid;
  gap: 9px;
}

.challenge-card.is-complete {
  border-color: color-mix(in srgb, var(--ok) 55%, var(--line));
}

.challenge-card > span,
.challenge-card small {
  color: var(--muted);
}

.progress-track {
  height: 8px;
  background: #050505;
  border: 1px solid var(--line);
  overflow: hidden;
}

.progress-track span {
  display: block;
  height: 100%;
  background: var(--ok);
}

.comparison-grid {
  display: grid;
  gap: 1px;
  background: var(--line);
}

.comparison-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) repeat(2, minmax(100px, .5fr));
  gap: 12px;
  background: #0b0b0b;
  padding: 14px;
}

.admin-ecosystem {
  margin-top: 18px;
}

@media (max-width: 820px) {
  .brand-lockup,
  .hero,
  .grid,
  .dashboard-hero,
  .dashboard-grid,
  .dashboard-lower-grid,
  .ecosystem-grid,
  .account-card,
  .game-dashboard-card__head,
  .stat-list,
  .privacy-form,
  .comparison-row {
    grid-template-columns: 1fr;
  }

  .brand-lockup::before {
    display: none;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .section-row,
  .purchase-row {
    grid-template-columns: 1fr;
  }

  .section-row {
    align-items: stretch;
    flex-direction: column;
  }

  .purchase-row {
    display: grid;
  }

  .stat-strip {
    grid-template-columns: 1fr;
  }

  .security-grid {
    grid-template-columns: 1fr;
  }

  .card-actions,
  .history-row > span {
    justify-content: stretch;
    text-align: left;
  }
}

@media (max-width: 520px) {
  .auth-page {
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .auth-card {
    width: min(100%, calc(100vw - 48px));
    padding: 28px;
  }

  .actions,
  .inline-claim-form,
  .avatar-form,
  .button,
  button {
    width: 100%;
  }

  .inline-claim-form,
  .avatar-form,
  .game-dashboard-card__head {
    grid-template-columns: 1fr;
  }

  .game-dashboard-card__head .ownership-badge {
    justify-self: start;
  }
}
