*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --color-bg: #fff;
  --color-text: #1a1a1a;
  --color-muted: #666;
  --color-border: #e0e0e0;
  --color-accent: #2563eb;
  --color-accent-hover: #1d4ed8;
  --color-surface: #f8f9fa;
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, monospace;
  --max-width: 64rem;
}

html {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
}

header {
  border-bottom: 1px solid var(--color-border);
}

nav {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-brand {
  font-weight: 700;
  font-size: 1.125rem;
  color: var(--color-text);
  text-decoration: none;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.nav-user {
  font-size: 0.875rem;
  font-weight: 500;
}

.nav-link {
  font-size: 0.875rem;
  color: var(--color-accent);
  text-decoration: none;
}

.nav-link:hover {
  text-decoration: underline;
}

.avatar {
  border-radius: 50%;
  vertical-align: middle;
}

main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

h2 {
  font-size: 1.375rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

p {
  margin-bottom: 1rem;
  color: var(--color-muted);
}

a {
  color: var(--color-accent);
}

.btn {
  display: inline-block;
  padding: 0.625rem 1.25rem;
  background: var(--color-accent);
  color: #fff;
  text-decoration: none;
  border-radius: 0.375rem;
  font-size: 0.9375rem;
  font-weight: 500;
  transition: background 0.15s;
}

.btn:hover {
  background: var(--color-accent-hover);
}

.center-content {
  text-align: center;
  margin-top: 4rem;
}

code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--color-surface);
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
}

.card-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1.5rem;
}

.card {
  border: 1px solid var(--color-border);
  border-radius: 0.5rem;
  padding: 1.25rem;
}

.card-selectable {
  transition: border-color 0.15s;
}

.card-selectable:hover {
  border-color: var(--color-accent);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.card-header h2 {
  margin-bottom: 0;
}

.card-header h2 a {
  text-decoration: none;
  color: var(--color-text);
}

.card-header h2 a:hover {
  color: var(--color-accent);
}

.card-meta {
  font-size: 0.875rem;
  font-family: var(--font-mono);
  color: var(--color-muted);
  margin-bottom: 0.5rem;
}

.card-desc {
  font-size: 0.9375rem;
}

.card-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.625rem;
  border-radius: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.badge-completed {
  background: #dcfce7;
  color: #166534;
}

.badge-pending {
  background: #fef9c3;
  color: #854d0e;
}

.badge-error {
  background: #fee2e2;
  color: #991b1b;
}

.badge-incomplete {
  background: #fef3c7;
  color: #92400e;
}

.badge-enrolled {
  background: #dbeafe;
  color: #1e40af;
}

.btn-secondary {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
}

.btn-secondary:hover {
  background: var(--color-border);
}

.btn-small {
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
}

.repo-name {
  font-family: var(--font-mono);
  font-size: 0.9375rem;
}

.empty-state {
  text-align: center;
  margin-top: 3rem;
}

.empty-state p {
  margin-bottom: 1rem;
}

.page-header {
  margin-bottom: 1.5rem;
}

.page-meta {
  font-size: 0.875rem;
  color: var(--color-muted);
}

.page-meta a {
  color: var(--color-accent);
  text-decoration: none;
}

.page-meta a:hover {
  text-decoration: underline;
}

.submission-summary {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.summary-desc {
  font-size: 0.9375rem;
  color: var(--color-muted);
}

.commit-info {
  margin-top: 1.5rem;
  font-size: 0.875rem;
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
}

.results-table th,
.results-table td {
  padding: 0.625rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}

.results-table th {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-muted);
}

.results-table td a {
  text-decoration: none;
}

.results-table td a:hover {
  text-decoration: underline;
}

.cell-muted {
  color: var(--color-muted);
  font-size: 0.875rem;
}

.status-icon {
  display: inline-block;
  width: 1.25rem;
  text-align: center;
  font-weight: 700;
}

.status-pass {
  color: #16a34a;
}

.status-fail {
  color: #dc2626;
}

.status-error {
  color: #dc2626;
}

.exercise-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1rem;
}

.exercise-detail {
  border: 1px solid var(--color-border);
  border-radius: 0.375rem;
}

.exercise-detail summary {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.exercise-detail summary::-webkit-details-marker {
  display: none;
}

.exercise-detail summary::before {
  content: "\25b6";
  font-size: 0.625rem;
  transition: transform 0.15s;
  color: var(--color-muted);
}

.exercise-detail[open] summary::before {
  transform: rotate(90deg);
}

.exercise-name {
  font-weight: 600;
}

.exercise-desc {
  color: var(--color-muted);
  font-size: 0.875rem;
}

.exercise-output {
  margin: 0;
  padding: 1rem;
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.5;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
}