:root {
  color-scheme: light dark;
  --bg: #0f1419;
  --panel: #1a2332;
  --text: #e8eef5;
  --muted: #9aa8b8;
  --accent: #6ec1ff;
  --chip: #2a3a52;
  --border: #334155;
  --error: #fca5a5;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.page {
  max-width: 42rem;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

.loading,
.error {
  padding: 1rem;
  border-radius: 8px;
  background: var(--panel);
}

.error {
  color: var(--error);
  border: 1px solid #7f1d1d;
}

.hero {
  display: grid;
  grid-template-columns: 8rem 1fr;
  gap: 1.25rem;
  align-items: start;
  margin-bottom: 1.5rem;
}

.portrait {
  width: 8rem;
  height: 8rem;
  object-fit: contain;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.5rem;
}

.portraitCaption {
  margin: 0.35rem 0 0;
  font-size: 0.75rem;
  color: var(--muted);
}

.paldex {
  margin: 0;
  font-size: 0.875rem;
  color: var(--muted);
}

h1 {
  margin: 0.25rem 0 0.5rem;
  font-size: 2rem;
}

.stem {
  margin: 0;
  font-size: 0.875rem;
  color: var(--muted);
}

.stem code {
  font-size: 0.8125rem;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}

.panel h2 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.panel h3.partnerName {
  margin: 0 0 0.5rem;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text);
  text-transform: none;
  letter-spacing: normal;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}

.stat {
  text-align: center;
  padding: 0.75rem;
  background: var(--bg);
  border-radius: 8px;
}

.statValue {
  display: block;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--accent);
}

.statLabel {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.8125rem;
  color: var(--muted);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chip {
  display: inline-block;
  padding: 0.35rem 0.75rem;
  background: var(--chip);
  border-radius: 999px;
  font-size: 0.875rem;
}

.workList {
  margin: 0;
  padding: 0;
  list-style: none;
}

.workList li {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

.workList li:last-child {
  border-bottom: none;
}

.workLevel {
  color: var(--accent);
  font-weight: 600;
}

.description {
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.6;
}

.description p {
  margin: 0 0 0.75rem;
}

.description p:last-child {
  margin-bottom: 0;
}

.partnerMeta {
  margin: 0.75rem 0 0;
  font-size: 0.875rem;
  color: var(--muted);
}

.factList {
  margin: 0;
  padding: 0;
  list-style: none;
}

.factList li {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

.factList li:last-child {
  border-bottom: none;
}

.factValue {
  color: var(--accent);
  font-weight: 600;
}

.skillsTableWrap {
  overflow-x: auto;
  margin: 0 -0.25rem;
  padding: 0 0.25rem;
}

.skillsTable {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.skillsTable th {
  text-align: left;
  padding: 0.5rem 0.75rem 0.5rem 0;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
}

.skillsTable td {
  padding: 0.5rem 0.75rem 0.5rem 0;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
}

.skillsTable tbody tr:last-child td {
  border-bottom: none;
}

.skillsTable td:nth-child(4),
.skillsTable th:nth-child(4) {
  text-align: right;
  padding-right: 0;
}

.skillsTable td.skillDescription,
.skillsTable th:nth-child(5) {
  text-align: left;
  padding-right: 0;
  max-width: 16rem;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--muted);
  white-space: normal;
}

.howToGetLinks {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.relatedPalsLinks {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.actionLink {
  display: inline-block;
  padding: 0.55rem 1rem;
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  background: var(--chip);
  color: var(--text);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.actionLink:hover,
.actionLink:focus-visible {
  border-color: var(--accent);
  background: var(--panel);
  outline: none;
}

.badge {
  display: inline-block;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: var(--chip);
  color: var(--muted);
  font-size: 0.8125rem;
}

.sourcesPanel,
.buildInfo {
  padding-top: 0.75rem;
}

.sourcesSummary {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  cursor: pointer;
  list-style: none;
}

.sourcesSummary::-webkit-details-marker {
  display: none;
}

.sourcesTable {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.sourcesTable th {
  text-align: left;
  padding: 0.5rem 0.75rem 0.5rem 0;
  color: var(--muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}

.sourcesTable td {
  padding: 0.5rem 0.75rem 0.5rem 0;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
}

.sourcesTable tbody tr:last-child td {
  border-bottom: none;
}

.sourcesTable code {
  font-size: 0.75rem;
}

.provenance {
  margin-top: 0;
  font-size: 0.8125rem;
  color: var(--muted);
}

.buildInfo .provenance {
  margin-top: 0.75rem;
}

.provenance code {
  font-size: 0.75rem;
}

@media (max-width: 480px) {
  .hero {
    grid-template-columns: 1fr;
  }

  .portrait {
    width: 6rem;
    height: 6rem;
  }
}
