:root {
  --bg: #f4efe3;
  --panel: rgba(255, 251, 245, 0.92);
  --panel-strong: #fffaf2;
  --ink: #1e1a16;
  --muted: #6a5d4f;
  --line: rgba(31, 22, 15, 0.1);
  --accent: #b0412e;
  --accent-dark: #7d2517;
  --gold: #d69b1d;
  --shadow: 0 18px 50px rgba(80, 46, 18, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "Space Grotesk", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(176, 65, 46, 0.18), transparent 25%),
    radial-gradient(circle at bottom right, rgba(214, 155, 29, 0.16), transparent 22%),
    linear-gradient(180deg, #f7f2e7 0%, #efe5d1 100%);
}

a {
  color: inherit;
  text-decoration: none;
}

.page-shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  margin-bottom: 24px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--panel);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
}

.brand-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.nav-user {
  color: var(--muted);
}

.premium-pill {
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #fff;
  background: linear-gradient(135deg, #d69b1d, #b0412e);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 999px;
  font: inherit;
  cursor: pointer;
  padding: 11px 18px;
}

.button-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
}

.spinup-btn:disabled,
.spinup-btn[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.7;
  filter: saturate(0.6);
}

.button-secondary,
.button-ghost {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.66);
  border: 1px solid var(--line);
}

.flash {
  padding: 14px 18px;
  margin-bottom: 22px;
  border-radius: 16px;
  border: 1px solid var(--line);
}

.flash-success { background: rgba(109, 164, 87, 0.16); }
.flash-warning { background: rgba(214, 155, 29, 0.18); }
.flash-error { background: rgba(176, 65, 46, 0.15); }

.hero,
.section-block,
.auth-card,
.table-card,
.challenge-card,
.challenge-detail-card,
.submission-card,
.not-found-shell {
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.hero {
  display: grid;
  grid-template-columns: 1.4fr 0.9fr;
  gap: 22px;
  padding: 38px;
}

.eyebrow {
  margin: 0 0 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-dark);
  font-size: 0.8rem;
}

h1,
h2,
h3 {
  margin-top: 0;
  font-family: "Source Serif 4", serif;
}

.lead,
.challenge-description,
.empty-state,
.auth-footer,
.locked-note,
.not-found-shell p {
  color: var(--muted);
}

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 22px;
}

.hero-panel {
  display: grid;
  gap: 16px;
}

.metric-card,
.detail-panel {
  padding: 22px;
  border-radius: 22px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
}

.metric-label,
.meta-label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.metric-value,
.meta-value {
  font-size: 1.15rem;
  font-weight: 700;
}

.section-block {
  margin-top: 28px;
  padding: 28px;
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.leader-preview,
.challenge-grid,
.table-grid,
.detail-panel-grid {
  display: grid;
  gap: 18px;
}

.leader-preview {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.leader-card,
.challenge-card {
  padding: 22px;
}

.leader-card {
  display: flex;
  gap: 14px;
  align-items: center;
  border-radius: 20px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
}

.leader-rank,
.score-pill,
.difficulty {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.82rem;
  font-weight: 700;
}

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

.challenge-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.difficulty-easy { background: rgba(110, 160, 88, 0.16); color: #295d17; }
.difficulty-medium { background: rgba(214, 155, 29, 0.2); color: #8a5b00; }
.difficulty-hard { background: rgba(176, 65, 46, 0.18); color: #7d2517; }

.score-pill { background: rgba(18, 18, 18, 0.06); }

.premium-machine-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #fff;
  background: linear-gradient(135deg, #d69b1d 0%, #b0412e 100%);
}

.detail-tag {
  margin-bottom: 10px;
}

.challenge-card h2 {
  margin-bottom: 10px;
}

.challenge-meta {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.challenge-complete {
  outline: 2px solid rgba(110, 160, 88, 0.35);
}

.window-badge,
.window-inline {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  font-size: 0.92rem;
}

.window-active {
  background: rgba(110, 160, 88, 0.12);
  color: #295d17;
}

.window-offline {
  background: rgba(176, 65, 46, 0.14);
  color: #7d2517;
}

.countdown {
  display: block;
  margin: 6px 0 0;
  font-weight: 600;
}

.auth-shell {
  display: flex;
  justify-content: center;
  padding: 40px 12px;
}

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

.auth-form {
  display: grid;
  gap: 16px;
}

.auth-form label {
  display: grid;
  gap: 8px;
}

.auth-form input {
  width: 100%;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.8);
  font: inherit;
}

.reset-form {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px dashed var(--line);
  display: grid;
  gap: 10px;
}

.reset-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.preset-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.preset-btn {
  padding: 7px 14px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent-dark);
  background: rgba(176, 65, 46, 0.08);
  border: 1px solid rgba(176, 65, 46, 0.25);
}

.preset-btn:hover {
  background: rgba(176, 65, 46, 0.18);
}

.window-form {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
  display: grid;
  gap: 10px;
}

.window-form label {
  display: grid;
  gap: 6px;
}

.window-form input[type="datetime-local"],
.window-form input[type="number"] {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.8);
  font: inherit;
}

.window-form input[type="text"],
.window-form input[type="password"] {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.8);
  font: inherit;
}

.window-form textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.8);
  font: inherit;
  resize: vertical;
}

.inline-check {
  display: flex !important;
  align-items: center;
  gap: 8px;
}

/* ── Admin layout ────────────────────────────────────── */
.admin-shell {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 24px;
  align-items: start;
}

.admin-nav {
  position: sticky;
  top: 24px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
}

.admin-nav-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin: 0 0 8px;
}

.admin-nav a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 12px;
  font-weight: 500;
  font-size: 0.92rem;
  color: var(--text);
  text-decoration: none;
  transition: background 0.15s;
}

.admin-nav a:hover {
  background: rgba(0, 0, 0, 0.05);
}

.admin-nav a.active {
  background: rgba(176, 65, 46, 0.1);
  color: var(--accent-dark);
  font-weight: 700;
}

.admin-main {
  min-width: 0;
}

/* ── Admin stat cards ─────────────────────────────────── */
.admin-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.admin-stat-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
}

.admin-stat-icon {
  font-size: 1.6rem;
  line-height: 1;
}

.admin-stat-value {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 0 0 2px;
}

.admin-stat-label {
  font-size: 0.78rem;
  color: var(--muted);
  margin: 0;
}

/* ── Admin twin layout ────────────────────────────────── */
.admin-twin {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 24px;
}

/* ── Flag type pills ──────────────────────────────────── */
.flag-type {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
}
.flag-user { background: rgba(60, 120, 220, 0.12); color: #1a4899; }
.flag-root { background: rgba(176, 65, 46, 0.12); color: var(--accent-dark); }

/* ── Admin user table ─────────────────────────────────── */
.admin-user-table {
  width: 100%;
  border-collapse: collapse;
}

.admin-user-table th,
.admin-user-table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 0.9rem;
}

.admin-user-table th {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  background: rgba(0,0,0,0.025);
}

.ts-cell {
  font-size: 0.82rem;
  white-space: nowrap;
}

.admin-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  background: rgba(176, 65, 46, 0.15);
  color: var(--accent-dark);
  vertical-align: middle;
}

.role-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
}
.role-admin { background: rgba(176, 65, 46, 0.12); color: var(--accent-dark); }
.role-user  { background: rgba(0,0,0,0.06); color: var(--muted); }
.role-premium { background: rgba(214, 155, 29, 0.2); color: #7a5200; }

.action-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.inline-action {
  display: inline;
  margin: 0;
}

.btn-action {
  padding: 5px 11px;
  border-radius: 10px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
  transition: opacity 0.15s;
}
.btn-action:hover { opacity: 0.8; }

.btn-promote  { background: rgba(60,160,60,0.12); color: #1a6e1a; border-color: rgba(60,160,60,0.2); }
.btn-demote   { background: rgba(176,65,46,0.10); color: var(--accent-dark); border-color: rgba(176,65,46,0.2); }
.btn-warn     { background: rgba(220,150,0,0.12); color: #7a5500; border-color: rgba(220,150,0,0.2); }
.btn-neutral  { background: rgba(0,0,0,0.06); color: var(--muted); border-color: var(--line); }
.btn-danger   { background: rgba(200,30,30,0.1); color: #8b0000; border-color: rgba(200,30,30,0.2); }
.btn-premium  { background: rgba(214,155,29,0.18); color: #7a5200; border-color: rgba(214,155,29,0.35); }

/* ── Admin responsive ─────────────────────────────────── */
@media (max-width: 900px) {
  .admin-shell {
    grid-template-columns: 1fr;
  }

  .admin-nav {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
  }

  .admin-nav-label {
    width: 100%;
  }

  .admin-twin {
    grid-template-columns: 1fr;
  }
}

/* ── Profile ─────────────────────────────────────────── */
/* ── Machine state banner ────────────────────────────── */
.machine-state-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 14px;
  margin: 16px 0;
  font-size: 0.9rem;
  font-weight: 500;
}

.state-online  { background: rgba(40,160,80,0.12); border: 1px solid rgba(40,160,80,0.25); color: #1a6e35; }
.state-starting{ background: rgba(220,160,0,0.12); border: 1px solid rgba(220,160,0,0.25); color: #7a5500; }
.state-offline { background: rgba(0,0,0,0.06); border: 1px solid var(--line); color: var(--muted); }

.state-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot-online  { background: #28a050; box-shadow: 0 0 6px rgba(40,160,80,0.6); }
.dot-starting{ background: #dcb000; animation: pulse 1.2s ease-in-out infinite; }
.dot-offline { background: #aaa; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.state-idle { opacity: 0.7; font-size: 0.82rem; }

.spinup-btn { width: 100%; margin-top: 8px; }

.spinup-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 20px auto;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Lab group badge ─────────────────────────────────── */
.lab-group-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  background: rgba(60, 80, 200, 0.12);
  color: #2a40a0;
  border: 1px solid rgba(60, 80, 200, 0.2);
}

/* ── Profile ─────────────────────────────────────────── */
.profile-hero {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 24px;
  padding: 32px;
}

.profile-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  border-radius: 20px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  color: #fff;
  font-size: 1.5rem;
  font-weight: 700;
  flex-shrink: 0;
}

.profile-identity h1 {
  margin-bottom: 4px;
}

.profile-rank {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

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

/* ── Badge grid ──────────────────────────────────────── */
.badge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

.badge-card {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  align-items: start;
  gap: 12px;
  padding: 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
}

.badge-bronze { background: rgba(185, 122, 62, 0.10); }
.badge-silver { background: rgba(150, 155, 165, 0.12); }
.badge-gold   { background: rgba(214, 155, 29, 0.14); }
.badge-founders {
  background: linear-gradient(135deg, rgba(214, 155, 29, 0.18) 0%, rgba(176, 65, 46, 0.14) 100%);
  border-color: rgba(214, 155, 29, 0.5);
  box-shadow: 0 0 0 1px rgba(214, 155, 29, 0.25);
}

.badge-icon {
  font-size: 1.6rem;
  line-height: 1;
}

.badge-body strong {
  display: block;
  margin-bottom: 4px;
  font-size: 0.95rem;
}

.badge-body p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.badge-tier-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 3px 8px;
  border-radius: 999px;
  align-self: start;
}

.badge-bronze .badge-tier-label { background: rgba(185, 122, 62, 0.22); color: #7a4d18; }
.badge-silver .badge-tier-label { background: rgba(120, 130, 148, 0.22); color: #4a5060; }
.badge-gold   .badge-tier-label { background: rgba(214, 155, 29, 0.28); color: #7a5200; }
.badge-founders .badge-tier-label {
  background: linear-gradient(135deg, #d69b1d, #b0412e);
  color: #fff;
  letter-spacing: 0.12em;
}

/* ── Profile table ───────────────────────────────────── */
.profile-table {
  width: 100%;
  border-collapse: collapse;
}

.premium-shell {
  margin-top: 0;
}

.premium-price {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--accent-dark);
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
}

.premium-status {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.55);
}

.premium-active {
  border-color: rgba(110, 160, 88, 0.4);
  background: rgba(110, 160, 88, 0.12);
}

.premium-benefits {
  margin: 10px 0 0;
  padding-left: 18px;
}

.premium-checkout-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.premium-checkout-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.7);
}

.premium-content {
  margin-top: 24px;
  border-top: 1px dashed var(--line);
  padding-top: 18px;
}

.premium-collapse {
  border: 1px solid var(--line);
  border-radius: 14px;
  margin-top: 12px;
  background: rgba(255, 255, 255, 0.7);
  overflow: hidden;
}

.premium-collapse summary {
  cursor: pointer;
  padding: 12px 14px;
  font-weight: 700;
  list-style: none;
}

.premium-collapse summary::-webkit-details-marker {
  display: none;
}

.premium-collapse summary::after {
  content: "+";
  float: right;
  font-size: 1rem;
}

.premium-collapse[open] summary::after {
  content: "-";
}

.premium-block {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  margin-top: 10px;
  background: rgba(255, 255, 255, 0.65);
}

.premium-collapse .premium-block {
  margin: 0;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
}

.premium-block h4 {
  margin: 0 0 8px;
}

.premium-block p {
  margin: 0;
  color: var(--muted);
}

.premium-markdown h1,
.premium-markdown h2,
.premium-markdown h3,
.premium-markdown h4 {
  margin: 0 0 10px;
}

.premium-markdown p,
.premium-markdown ul,
.premium-markdown ol,
.premium-markdown blockquote {
  margin: 0 0 12px;
  color: var(--muted);
}

.premium-markdown ul,
.premium-markdown ol {
  padding-left: 20px;
}

.premium-markdown pre {
  margin: 0 0 12px;
  padding: 10px;
  border-radius: 10px;
  overflow-x: auto;
  background: rgba(20, 20, 20, 0.92);
  color: #f4f4f4;
}

.premium-markdown code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.premium-markdown table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 12px;
}

.premium-markdown th,
.premium-markdown td {
  border: 1px solid var(--line);
  padding: 8px;
  text-align: left;
}

.profile-table th,
.profile-table td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.muted {
  color: var(--muted);
}

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 900px) {
  .profile-hero {
    grid-template-columns: auto 1fr;
  }

  .profile-stats {
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .profile-hero {
    grid-template-columns: 1fr;
  }

  .profile-avatar {
    width: 56px;
    height: 56px;
    font-size: 1.2rem;
  }

  .profile-stats {
    grid-template-columns: 1fr 1fr;
  }
}

/* ── Table grid ──────────────────────────────────────── */
.table-grid {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.table-card {
  padding: 24px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.challenge-detail-shell {
  display: grid;
  grid-template-columns: 1.4fr 0.85fr;
  gap: 22px;
}

.challenge-detail-card,
.submission-card,
.not-found-shell {
  padding: 28px;
}

.detail-panel-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 24px;
}

@media (max-width: 900px) {
  .hero,
  .challenge-detail-shell {
    grid-template-columns: 1fr;
  }

  .detail-panel-grid {
    grid-template-columns: 1fr;
  }

  .site-header,
  .section-heading {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 640px) {
  .page-shell {
    padding: 16px;
  }

  .hero,
  .section-block,
  .auth-card,
  .challenge-card,
  .challenge-detail-card,
  .submission-card,
  .table-card {
    padding: 20px;
  }
}

/* ── OSCP Learning Path ───────────────────────────────────────────────────── */
.oscp-hero {
  display: grid;
  grid-template-columns: 1.35fr 0.85fr;
  gap: 22px;
  align-items: stretch;
}

.oscp-progress-panel {
  display: grid;
  gap: 12px;
}

.oscp-stat {
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  display: grid;
  gap: 4px;
  color: var(--ink);
}

.oscp-stat strong {
  font-size: 1.2rem;
  font-family: "Source Serif 4", serif;
  color: var(--ink);
}

.oscp-stat .meta-label {
  color: var(--muted);
}

.oscp-stat .meta-value {
  color: var(--muted);
  font-size: 0.88rem;
}

.free-limit {
  border-color: rgba(176, 65, 46, 0.45);
  background: rgba(176, 65, 46, 0.06);
}

.premium-live {
  border-color: rgba(109, 164, 87, 0.5);
  background: rgba(109, 164, 87, 0.08);
}

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

.guide-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 20px;
  display: grid;
  gap: 10px;
  color: var(--ink);
}

.guide-card h3 {
  font-family: "Source Serif 4", serif;
  font-size: 1.08rem;
  color: var(--ink);
  margin: 0;
}

.guide-card p {
  color: var(--muted);
  margin: 0;
  font-size: 0.95rem;
}

.guide-card ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  display: grid;
  gap: 6px;
  font-size: 0.92rem;
}

.guide-card pre {
  background: rgba(20, 20, 20, 0.92);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  overflow-x: auto;
  margin: 0;
}

.guide-card code {
  color: #86efac;
  font-size: 0.84rem;
  font-family: ui-monospace, "Cascadia Code", Menlo, monospace;
}

.module-list {
  display: grid;
  gap: 16px;
}

.module-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 24px;
  display: grid;
  gap: 18px;
  color: var(--ink);
}

.module-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.module-kicker {
  margin: 0 0 6px;
  color: var(--accent-dark);
  font-weight: 600;
  font-size: 0.88rem;
}

.module-head h3 {
  font-family: "Source Serif 4", serif;
  margin-bottom: 8px;
  color: var(--ink);
}

.module-head p {
  color: var(--muted);
  font-size: 0.92rem;
  margin: 0 0 6px;
}

.module-head .meta-value {
  font-size: 0.82rem;
  color: var(--muted);
}

.module-progress {
  text-align: right;
  display: grid;
  gap: 2px;
  flex-shrink: 0;
}

.module-progress span {
  font-size: 0.82rem;
  color: var(--muted);
}

.module-progress strong {
  font-size: 1.4rem;
  font-family: "Source Serif 4", serif;
  color: var(--ink);
}

.module-skills h4,
.module-labs h4 {
  margin: 0 0 8px;
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.module-skills ul {
  margin: 0;
  padding-left: 18px;
  color: var(--ink);
  display: grid;
  gap: 6px;
  font-size: 0.92rem;
}

.module-lab-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.module-lab-chip {
  display: grid;
  gap: 4px;
  text-decoration: none;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  transition: transform 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
  font-weight: 600;
  font-size: 0.92rem;
}

.module-lab-chip:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 4px 16px rgba(176, 65, 46, 0.12);
}

.module-lab-chip small {
  color: var(--muted);
  font-weight: 400;
}

.chip-solved {
  border-color: rgba(109, 164, 87, 0.55);
  background: rgba(109, 164, 87, 0.08);
}

.chip-partial {
  border-color: rgba(176, 65, 46, 0.45);
  background: rgba(176, 65, 46, 0.06);
}

/* ── Tutorial walkthrough sections ─────────────────────────────────────────── */
.lab-tutorials {
  display: grid;
  gap: 12px;
  margin-top: 4px;
}

.lab-tutorial {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.6);
  overflow: hidden;
}

.lab-tutorial summary {
  cursor: pointer;
  padding: 14px 18px;
  font-weight: 700;
  font-size: 0.95rem;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--ink);
  user-select: none;
}

.lab-tutorial summary::-webkit-details-marker { display: none; }

.lab-tutorial summary::after {
  content: "▶ Show Walkthrough";
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent-dark);
  white-space: nowrap;
}

.lab-tutorial[open] summary::after {
  content: "▲ Hide";
}

.tutorial-body {
  padding: 0 18px 18px;
  display: grid;
  gap: 14px;
}

.tutorial-body h5 {
  margin: 0 0 6px;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.tutorial-body p {
  color: var(--muted);
  font-size: 0.93rem;
  margin: 0;
  line-height: 1.6;
}

.tutorial-body ul,
.tutorial-body ol {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.7;
}

.tutorial-body pre {
  background: rgba(18, 18, 20, 0.94);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  overflow-x: auto;
  margin: 0;
}

.tutorial-body code {
  font-family: ui-monospace, "Cascadia Code", Menlo, monospace;
  font-size: 0.83rem;
  color: #86efac;
}

.tutorial-body .step-label {
  display: inline-block;
  padding: 2px 8px;
  background: rgba(176, 65, 46, 0.1);
  color: var(--accent-dark);
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}

.tutorial-step {
  display: grid;
  gap: 6px;
}

.oscp-note {
  padding: 10px 14px;
  background: rgba(214, 155, 29, 0.1);
  border-left: 3px solid rgba(214, 155, 29, 0.7);
  border-radius: 0 8px 8px 0;
  font-size: 0.88rem;
  color: var(--ink);
}

.oscp-note strong {
  color: #7a5200;
}

@media (max-width: 980px) {
  .oscp-hero,
  .guide-grid {
    grid-template-columns: 1fr;
  }

  .module-head {
    flex-direction: column;
  }

  .module-progress {
    text-align: left;
  }
}