:root {
  --bg: #0d0d0d;
  --bg-soft: #17181d;
  --panel: #1a1d24;
  --line: #2b3040;
  --text: #f4f7ff;
  --muted: #a9b2c7;
  --accent: #00d1b2;
  --accent-soft: rgba(0, 209, 178, 0.18);
  --danger: #ff6d8f;
  --radius: 8px;
  --forum-radius: 4px;
  --shadow: 0 16px 34px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 15% -20%, rgba(0, 209, 178, 0.22), transparent 40%),
    radial-gradient(circle at 90% 0%, rgba(68, 88, 255, 0.2), transparent 30%),
    var(--bg);
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
}

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

img {
  max-width: 100%;
  display: block;
}

.container {
  width: min(1160px, 92vw);
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(13, 13, 13, 0.88);
  backdrop-filter: blur(10px);
}

.nav-wrap {
  min-height: 72px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand {
  margin-right: auto;
  font-weight: 700;
}

.primary-nav {
  display: flex;
  gap: 8px;
}

.primary-nav a {
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.92rem;
}

.primary-nav a:hover,
.primary-nav a.active {
  color: var(--text);
  border-color: var(--accent);
  background: var(--accent-soft);
}

.menu-toggle {
  display: none;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
}

.user-menu {
  position: relative;
}

.user-trigger {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  cursor: pointer;
}

.user-trigger img {
  width: 30px;
  height: 30px;
  border-radius: 50%;
}

.user-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 160px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #12141b;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.user-dropdown a,
.user-dropdown button {
  width: 100%;
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: transparent;
  color: var(--text);
  text-align: left;
  padding: 10px 12px;
  cursor: pointer;
}

main {
  padding-bottom: 60px;
}

.hero {
  padding: 72px 0 34px;
}

.hero-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(130deg, rgba(255, 255, 255, 0.05), transparent), rgba(26, 29, 36, 0.92);
  box-shadow: var(--shadow);
  padding: clamp(22px, 3vw, 34px);
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 14px;
}

.eyebrow {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.75rem;
  color: #ccd5eb;
  font-family: "IBM Plex Mono", monospace;
}

h1,
h2,
h3 {
  margin: 0;
}

h1 {
  font-size: clamp(1.9rem, 4.6vw, 3.2rem);
}

h2 {
  font-size: clamp(1.3rem, 3vw, 2rem);
}

.lead {
  margin: 14px 0 0;
  color: #d7dff2;
  max-width: 64ch;
}

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

.btn {
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 600;
  padding: 10px 16px;
  cursor: pointer;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #04211c;
}

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

.section {
  padding: 18px 0;
}

.card {
  background: rgba(26, 29, 36, 0.94);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel {
  padding: 14px;
}

.section-head,
.row-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

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

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

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

.tab-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tab {
  border: 1px solid var(--line);
  background: #12141b;
  color: var(--muted);
  border-radius: 8px;
  padding: 8px 12px;
  font: inherit;
  cursor: pointer;
}

.tab.active {
  color: var(--text);
  border-color: var(--accent);
  background: var(--accent-soft);
}

.tab-complete {
  margin-left: 6px;
  color: #88f3e2;
  font-size: 0.78rem;
}

.badge {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 0.75rem;
  color: var(--muted);
}

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

.kpi-list li {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.news-grid {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.news-card {
  padding: 12px;
  display: grid;
  gap: 8px;
}

.news-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.video-grid {
  margin-top: 14px;
}

.learn-module-summary {
  margin: 12px 0 0;
  font-size: 0.9rem;
}

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

.video-module {
  display: grid;
  gap: 10px;
}

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

.video-module-head h3 {
  font-size: 1rem;
}

.video-module-meta {
  margin: 4px 0 0;
  font-size: 0.8rem;
}

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

.tools-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.tool-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.02);
}

.tool-card h3 {
  font-size: 0.96rem;
  margin-bottom: 8px;
}

.tool-list {
  margin: 0;
  padding-left: 16px;
  display: grid;
  gap: 6px;
}

.tool-list a {
  color: #dbe5ff;
}

.tool-list a:hover,
.tool-list a:focus-visible {
  color: var(--accent);
}

.video-card {
  overflow: hidden;
  cursor: pointer;
}

.video-card img {
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.video-card div {
  padding: 10px;
  display: grid;
  gap: 6px;
}

.forum-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.forum-layout {
  display: grid;
  grid-template-columns: minmax(320px, 350px) minmax(0, 1fr);
  align-items: start;
  gap: 16px;
}

.forum-layout .card,
.forum-layout .btn,
.forum-layout .badge,
.forum-layout select,
.forum-layout textarea,
.forum-layout input,
.forum-layout .vote-btn {
  border-radius: var(--forum-radius);
}

.forum-sidebar {
  position: sticky;
  top: 86px;
  padding: 18px;
  background: rgba(18, 20, 27, 0.96);
}

.forum-sidebar-head {
  display: grid;
  gap: 4px;
}

.forum-sidebar-head p {
  margin: 0;
  font-size: 0.85rem;
}

.forum-filters {
  margin-top: 14px;
  display: grid;
  gap: 10px;
}

.forum-filters label {
  display: grid;
  gap: 6px;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.forum-filters select {
  min-width: 150px;
  padding: 9px 10px;
  font-size: 0.9rem;
}

.forum-main {
  min-height: 460px;
  display: grid;
  gap: 14px;
  align-content: start;
}

.forum-list-block {
  margin-top: 14px;
  display: grid;
  gap: 8px;
}

.forum-list-block > div {
  display: grid;
  gap: 10px;
}

.forum-list-block h3 {
  margin: 0;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.forum-pagination {
  margin-top: 16px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.thread-card {
  padding: 12px;
  display: grid;
  gap: 8px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.02);
}

.thread-card:hover {
  border-color: rgba(0, 209, 178, 0.55);
}

.thread-card.active {
  border-color: var(--accent);
  background: rgba(0, 209, 178, 0.08);
}

.thread-card h3 {
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.35;
}

.thread-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

.thread-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  font-size: 0.82rem;
  color: var(--muted);
}

.thread-activity {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.79rem;
}

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

.profile-link {
  color: #dbe5ff;
  text-decoration: none;
}

.profile-link:hover,
.profile-link:focus-visible {
  color: var(--accent);
}

.avatar-inline img {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.16);
}

.form-grid {
  display: grid;
  gap: 10px;
}

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

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #11131a;
  color: var(--text);
  padding: 10px;
  font: inherit;
}

select {
  -webkit-appearance: none;
  appearance: none;
  background-image:
    linear-gradient(to bottom, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.15)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='M5 7.5L10 12.5L15 7.5' stroke='%23c7d0e5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat, no-repeat;
  background-size: 1px 56%, 12px 12px;
  background-position: right 36px center, right 12px center;
  padding-right: 40px;
}

.forum-body {
  margin-top: 10px;
  color: #dfe4f4;
  line-height: 1.62;
  font-size: 0.98rem;
}

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

.reply-card {
  border: 1px solid var(--line);
  border-radius: var(--forum-radius);
  padding: 10px;
  display: grid;
  gap: 8px;
  background: rgba(255, 255, 255, 0.02);
}

.vote-row {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.vote-btn {
  border: 1px solid var(--line);
  border-radius: var(--forum-radius);
  background: transparent;
  color: var(--muted);
  min-width: 36px;
  padding: 6px 10px;
  cursor: pointer;
}

.thread-section {
  padding: 14px;
}

.thread-back {
  display: none;
}

.btn.is-loading {
  opacity: 0.85;
  cursor: wait;
}

.profile-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 14px;
}

.profile-side h2 {
  margin-top: 12px;
}

.avatar-wrap {
  width: 124px;
  height: 124px;
  position: relative;
}

.avatar-wrap img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.2);
}

.avatar-edit {
  position: absolute;
  bottom: 2px;
  right: 2px;
  border: 1px solid var(--line);
  background: #11131a;
  color: var(--text);
  border-radius: 8px;
  padding: 4px 9px;
}

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

.stats-list {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.stats-list li {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.leaderboard-hero {
  position: relative;
  overflow: hidden;
}

.leaderboard-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 32px 32px;
  opacity: 0.25;
  pointer-events: none;
}

.live-pill {
  margin-top: 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(0, 209, 178, 0.4);
  border-radius: 8px;
  padding: 7px 12px;
  color: #9ff7e8;
}

.leaderboard-shell {
  display: grid;
  gap: 14px;
  min-width: 0;
  overflow: hidden;
}

.leaderboard-mode-head {
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.leaderboard-controls {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.leaderboard-controls label {
  display: grid;
  gap: 6px;
  font-size: 0.84rem;
  color: var(--muted);
}

.leaderboard-controls input,
.leaderboard-controls select {
  font-size: 0.88rem;
}

#benchmark-panel {
  min-width: 0;
}

.benchmark-table th,
.benchmark-table td {
  white-space: nowrap;
  font-size: 0.86rem;
  vertical-align: top;
}

.benchmark-table {
  width: max-content;
  min-width: 100%;
}

.benchmark-table td.model-cell {
  min-width: 220px;
  max-width: 320px;
  white-space: normal;
}

.metric-cell {
  font-weight: 600;
  color: #d2fbf3;
}

.benchmark-model-scores {
  margin-top: 12px;
  display: grid;
  gap: 10px;
}

.benchmark-score-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.benchmark-score-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.benchmark-score-item span {
  color: var(--muted);
}

.podium-grid {
  margin: 14px 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.podium {
  padding: 12px;
  text-align: center;
}

.podium.gold {
  border-color: rgba(255, 215, 0, 0.55);
}

.podium.silver {
  border-color: rgba(192, 198, 212, 0.5);
}

.podium.bronze {
  border-color: rgba(210, 145, 86, 0.56);
}

.podium-rank {
  margin: 0 0 8px;
  font-weight: 700;
}

.podium-avatar {
  width: 48px;
  height: 48px;
  margin: 0 auto 8px;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid var(--line);
}

.podium-avatar img,
.rank-table img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.profile-link-text {
  color: #dbe5ff;
  text-decoration: none;
  font-weight: 600;
}

.profile-link-text:hover,
.profile-link-text:focus-visible {
  color: var(--accent);
}

.avatar-fallback {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  font-weight: 700;
}

.table-wrap {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-y: hidden;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.rank-table {
  width: max-content;
  border-collapse: collapse;
  min-width: 100%;
}

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

.rank-table tbody tr:nth-child(odd) {
  background: rgba(255, 255, 255, 0.02);
}

.site-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 18px 0 28px;
}

.site-footer p {
  margin: 0;
  text-align: center;
}

.login-guard {
  padding: 22px;
  text-align: center;
  display: grid;
  gap: 10px;
  justify-items: center;
  max-width: min(760px, 92vw);
  margin: 0 auto;
}

.login-guard p {
  margin: 0;
  max-width: 64ch;
}

.login-guard .btn {
  width: auto;
  min-width: 220px;
}

.skeleton-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.02);
  margin-bottom: 8px;
}

.skeleton-line {
  height: 11px;
  border-radius: 8px;
  margin: 8px 0;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.08));
  background-size: 200% 100%;
  animation: shimmer 1.3s infinite;
}

.skeleton-line.short {
  width: 45%;
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
  z-index: 90;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  position: fixed;
  left: 50%;
  top: 50%;
  width: min(760px, 94vw);
  max-height: 92vh;
  overflow: auto;
  transform: translate(-50%, -42%);
  opacity: 0;
  pointer-events: none;
  background: #12141b;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  z-index: 91;
  transition: opacity 180ms ease, transform 180ms ease;
}

.modal.open {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%);
}

.toast {
  position: fixed;
  right: 14px;
  bottom: 14px;
  border: 1px solid rgba(0, 209, 178, 0.45);
  border-radius: 8px;
  background: rgba(7, 76, 65, 0.95);
  color: #d9fff7;
  padding: 10px 12px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 150ms ease, transform 150ms ease;
  z-index: 95;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.ql-toolbar.ql-snow,
.ql-container.ql-snow {
  border-color: var(--line) !important;
  background: #11131a;
}

.ql-editor {
  min-height: 170px;
}

.video-modal-grid {
  margin-top: 12px;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.75fr);
}

.video-player-wrap {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.01));
  padding: 8px;
}

.video-player-wrap iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
  min-height: 230px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #07090f;
}

.video-note-hint {
  margin: 10px 2px 2px;
  font-size: 0.82rem;
}

.video-notes {
  display: grid;
  gap: 8px;
  align-content: start;
  background: rgba(255, 255, 255, 0.02);
}

.video-notes textarea {
  min-height: 320px;
  resize: vertical;
}

.video-notes h3 {
  font-size: 1rem;
}

.video-notes p {
  margin: 0;
  font-size: 0.82rem;
}

#video-modal {
  width: min(1080px, 94vw);
}

#video-modal .section-head {
  align-items: flex-start;
}

@media (max-width: 980px) {
  .hero-grid,
  .news-grid,
  .video-subgrid,
  .tools-grid,
  .podium-grid,
  .profile-layout {
    grid-template-columns: 1fr;
  }

  .video-module-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .forum-layout {
    grid-template-columns: 1fr;
  }

  .forum-sidebar {
    position: static;
  }

  .forum-layout.thread-open .forum-sidebar {
    display: none;
  }

  .thread-back {
    display: inline-flex;
  }

  .video-modal-grid {
    grid-template-columns: 1fr;
  }

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

  .video-notes textarea {
    min-height: 180px;
  }
}

@media (max-width: 860px) {
  .menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .primary-nav {
    position: absolute;
    left: 0;
    right: 0;
    top: 72px;
    background: rgba(13, 13, 13, 0.98);
    border-bottom: 1px solid var(--line);
    padding: 10px 4vw 14px;
    display: grid;
    gap: 8px;
    transform: translateY(-120%);
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease, transform 180ms ease;
  }

  .primary-nav.open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }
}

@media (max-width: 620px) {
  .hero {
    padding-top: 54px;
  }

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

  .forum-hero {
    align-items: flex-start;
  }

  .leaderboard-controls {
    grid-template-columns: 1fr;
  }

  #video-modal {
    width: 100vw;
    max-height: 100vh;
    height: 100vh;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    left: 0;
    top: 0;
    transform: translate(0, 8%);
    padding: 12px;
  }

  #video-modal.open {
    transform: translate(0, 0);
  }

  #video-modal .section-head {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #12141b;
    padding-bottom: 8px;
  }

  #video-modal .row-inline {
    width: 100%;
    justify-content: flex-end;
  }

  .video-player-wrap {
    padding: 6px;
  }

  .video-player-wrap iframe {
    min-height: 200px;
  }

  .video-note-hint {
    font-size: 0.78rem;
  }
}
