:root {
  color-scheme: dark;
  --bg: #08100e;
  --panel: #111916;
  --panel-strong: #17211d;
  --panel-blue: #121a23;
  --line: #31463b;
  --line-soft: #223128;
  --text: #edf7f0;
  --muted: #a7b8ae;
  --green: #8ddc9b;
  --amber: #f0bf73;
  --blue: #91b8ff;
  --ink: #07100c;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  font: 16px/1.5 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
  color: var(--text);
  background:
    linear-gradient(135deg, rgba(12, 18, 17, 0.97), rgba(7, 12, 13, 0.99)),
    repeating-linear-gradient(90deg, rgba(141, 220, 155, 0.045) 0 1px, transparent 1px 88px),
    repeating-linear-gradient(0deg, rgba(145, 184, 255, 0.035) 0 1px, transparent 1px 88px);
}

button,
a {
  font: inherit;
}

a {
  color: inherit;
}

[hidden] {
  display: none !important;
}

.player-shell {
  width: min(1240px, calc(100vw - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 22px 0 28px;
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  gap: 16px;
}

.topbar,
.brand,
.top-actions,
.copy-row,
.section-heading,
.dashboard-tabs {
  display: flex;
  align-items: center;
}

.topbar {
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
}

.brand {
  min-width: 0;
  gap: 10px;
  color: #d5e4da;
  text-decoration: none;
  font-weight: 850;
}

.brand span:last-child {
  min-width: 0;
  overflow-wrap: anywhere;
}

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  background: var(--green);
  color: var(--ink);
  font-size: 0.9rem;
}

.top-actions {
  justify-content: flex-end;
  gap: 12px;
  min-width: 0;
}

.status-line {
  max-width: 38ch;
  margin: 0;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-line.good {
  color: var(--green);
}

.overview-grid {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.75fr);
  gap: 16px;
}

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 94%, black);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
}

.identity-panel {
  padding: 28px;
  display: grid;
  align-content: center;
  gap: 18px;
}

.members-panel,
.tab-panel {
  padding: 22px;
}

.debug-launch-panel {
  grid-column: 1 / -1;
  padding: 18px 22px;
}

.launch-controls {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  align-items: end;
  gap: 12px;
}

.select-stack {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.select-stack span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.select-stack select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: rgba(11, 16, 14, 0.72);
  color: var(--text);
  font: inherit;
}

.eyebrow,
dt {
  margin: 0;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.76rem;
  font-weight: 850;
}

h1,
h2,
p,
dl,
dd {
  margin: 0;
}

h1 {
  max-width: 18ch;
  font-size: 3rem;
  line-height: 1;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

h2 {
  color: var(--amber);
  font-size: 1rem;
  line-height: 1.25;
}

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

.facts > div {
  min-width: 0;
  display: grid;
  gap: 4px;
}

dd,
code {
  min-width: 0;
  overflow-wrap: anywhere;
}

code {
  color: var(--amber);
  font: 0.95rem/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.copy-row {
  gap: 10px;
}

button,
.primary-action,
.inline-action,
.tab-link {
  min-height: 42px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-weight: 850;
}

button {
  border: 1px solid var(--line);
  padding: 0 14px;
  background: rgba(11, 16, 14, 0.72);
  color: var(--text);
  cursor: pointer;
}

.primary-action {
  min-width: 136px;
  padding: 0 18px;
  background: var(--green);
  color: var(--ink);
}

.primary-action[aria-disabled="true"] {
  opacity: 0.55;
  cursor: wait;
}

.inline-action {
  min-width: 132px;
  padding: 0 14px;
  border: 1px solid var(--line);
  background: rgba(11, 16, 14, 0.72);
  color: var(--text);
}

.section-heading {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section-heading strong {
  color: var(--blue);
}

.dashboard-tabs {
  min-width: 0;
  gap: 8px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(7, 12, 10, 0.72);
}

.tab-link {
  flex: 1 1 0;
  min-width: 0;
  padding: 0 12px;
  border: 1px solid transparent;
  color: var(--muted);
  white-space: nowrap;
}

.tab-link.active {
  border-color: color-mix(in srgb, var(--green) 58%, var(--line));
  background: var(--panel-strong);
  color: var(--text);
}

.tab-panels {
  min-width: 0;
  min-height: 0;
  display: grid;
}

.challenge-list,
.member-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.member-list {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.member-list li {
  min-width: 0;
  min-height: 50px;
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(7, 12, 10, 0.6);
}

.member-list li span:nth-child(2) {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.member-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--green);
}

.member-list strong,
.challenge-list strong {
  color: var(--amber);
  font-size: 0.9rem;
}

.member-list .empty-row,
.challenge-list .empty-row {
  grid-column: 1 / -1;
  min-height: 50px;
  color: var(--muted);
}

.challenge-list {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.challenge-list li {
  min-width: 0;
  min-height: 92px;
  display: grid;
  align-content: space-between;
  gap: 8px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 12px;
  background: rgba(7, 12, 10, 0.6);
}

.challenge-list .challenge-row.complete {
  border-color: color-mix(in srgb, var(--green) 72%, var(--line));
  background: rgba(44, 73, 53, 0.5);
}

.challenge-title,
.challenge-meta {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.challenge-title {
  color: var(--text);
  font-weight: 850;
  line-height: 1.25;
}

.challenge-meta {
  color: var(--muted);
  font-size: 0.88rem;
  white-space: nowrap;
}

.challenge-list .complete strong {
  color: var(--green);
}

.scoreboard-panel {
  display: grid;
  grid-template-rows: auto minmax(380px, 52vh);
}

#scoreboard-frame {
  width: 100%;
  height: 100%;
  min-height: 380px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--panel-blue);
}

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

.copy-grid section {
  min-width: 0;
  display: grid;
  gap: 8px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 16px;
  background: rgba(7, 12, 10, 0.58);
}

.copy-grid p {
  color: var(--muted);
}

@media (max-width: 820px) {
  .player-shell {
    width: min(100vw - 20px, 1240px);
    padding: 12px 0 18px;
  }

  .topbar,
  .top-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions,
  .primary-action,
  .inline-action {
    width: 100%;
  }

  .status-line {
    max-width: none;
    white-space: normal;
  }

  .overview-grid,
  .facts,
  .copy-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  h1 {
    font-size: 2.25rem;
  }

  .identity-panel,
  .members-panel,
  .debug-launch-panel,
  .tab-panel {
    padding: 18px;
  }

  .dashboard-tabs {
    overflow-x: auto;
  }

  .tab-link {
    flex: 0 0 auto;
    min-width: 132px;
  }

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

  .launch-controls {
    grid-template-columns: minmax(0, 1fr);
  }

  .scoreboard-panel {
    grid-template-rows: auto 360px;
  }

  #scoreboard-frame {
    min-height: 360px;
  }
}
