/* Labs — asosiy uslublar. Inline style yo'q (CSP style-src 'self'). */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--c-bg);
  /* Juda nozik fon setkasi (6-bo'lim: "Qil") */
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.035) 1px, transparent 1px);
  background-size: 48px 48px;
  background-position: -1px -1px;
  color: var(--c-text);
  font-family: var(--f-sans);
  font-size: var(--fs-md);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
p {
  margin: 0;
}

a {
  color: var(--c-signal);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

:focus-visible {
  outline: 2px solid var(--c-signal);
  outline-offset: 3px;
  border-radius: var(--r-sm);
}

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

.mono {
  font-family: var(--f-mono);
  font-feature-settings: 'zero' 1;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: var(--sp-4);
  top: -100px;
  z-index: 100;
  padding: var(--sp-2) var(--sp-4);
  background: var(--c-surface-2);
  border-radius: var(--r-sm);
}

.skip-link:focus {
  top: var(--sp-3);
}

.container {
  width: 100%;
  max-width: var(--w-page);
  margin: 0 auto;
  padding: 0 var(--sp-4);
}

@media (min-width: 720px) {
  .container {
    padding: 0 var(--sp-5);
  }
}

main {
  flex: 1;
}

/* --- Navbar --- */
.nav {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--h-nav);
  background: rgba(2, 6, 23, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--c-border);
}

.nav__inner {
  height: 100%;
  display: flex;
  align-items: center;
  gap: var(--sp-5);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-3);
  color: var(--c-text);
  font-weight: 600;
  letter-spacing: -0.01em;
}

.brand:hover {
  text-decoration: none;
}

.brand img {
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
}

.brand__labs {
  font-family: var(--f-mono);
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--c-signal);
  padding: 2px 8px;
  border: 1px solid rgba(34, 211, 238, 0.3);
  border-radius: var(--r-full);
}

.brand__name {
  white-space: nowrap;
}

@media (max-width: 479px) {
  .brand__name {
    display: none;
  }
}

.nav__links {
  display: none;
  gap: var(--sp-4);
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav__links a {
  color: var(--c-text-2);
  font-size: var(--fs-sm);
}

.nav__links a:hover,
.nav__links a[aria-current='page'] {
  color: var(--c-text);
  text-decoration: none;
}

.nav__actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

@media (min-width: 720px) {
  .nav__links {
    display: flex;
  }
}

/* Kichik ekran menyusi (< 720px). */
.nav__menu {
  position: relative;
}

.nav__burger {
  list-style: none;
  width: 44px;
  padding: 0;
}

.nav__burger::-webkit-details-marker {
  display: none;
}

.nav__menu[open] .nav__burger {
  border-color: var(--c-signal);
  color: var(--c-signal);
}

.nav__panel {
  position: absolute;
  top: calc(100% + var(--sp-2));
  right: 0;
  min-width: 200px;
  padding: var(--sp-2);
  background: var(--c-surface);
  border: 1px solid var(--c-border-strong);
  border-radius: var(--r-md);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
}

.nav__panel ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav__panel a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 var(--sp-3);
  border-radius: var(--r-sm);
  color: var(--c-text-2);
  font-size: var(--fs-sm);
}

.nav__panel a:hover {
  background: var(--c-surface-2);
  color: var(--c-text);
  text-decoration: none;
}

@media (max-width: 479px) {
  .nav__actions .nav__login {
    display: none; /* menyuda bor — anonim header sig'sin */
  }
}

@media (max-width: 719px) {
  .nav__inner {
    gap: var(--sp-2);
  }

  .nav__main {
    display: none;
  }
}

@media (min-width: 720px) {
  .nav__menu {
    display: none;
  }
}

/* --- Tugmalar --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: 44px;
  padding: 0 var(--sp-5);
  border: 1px solid transparent;
  border-radius: var(--r-md);
  font: inherit;
  font-weight: 600;
  font-size: var(--fs-sm);
  white-space: nowrap;
  color: var(--c-text);
  background: none;
  cursor: pointer;
  transition:
    background-color var(--dur-fast) var(--ease-out),
    box-shadow var(--dur-fast) var(--ease-out),
    transform var(--dur-fast) var(--ease-out);
}

.btn:hover {
  text-decoration: none;
}

.btn:active {
  transform: scale(0.98);
}

.btn--primary {
  background: var(--g-brand);
  color: #fff;
  box-shadow: 0 8px 24px -10px rgba(59, 130, 246, 0.7);
}

.btn--primary:hover {
  box-shadow: 0 10px 28px -8px rgba(34, 211, 238, 0.6);
}

.btn--ghost {
  background: rgba(148, 163, 184, 0.06);
  border-color: var(--c-border);
}

.btn--ghost:hover {
  background: rgba(148, 163, 184, 0.12);
}

.btn--sm {
  min-height: 36px;
  padding: 0 var(--sp-4);
}

/* --- Kartalar --- */
.card {
  position: relative;
  display: block;
  padding: var(--sp-5);
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  color: var(--c-text);
  transition:
    border-color var(--dur-med) var(--ease-out),
    box-shadow var(--dur-med) var(--ease-out);
}

a.card:hover {
  text-decoration: none;
  border-color: rgba(45, 212, 191, 0.35);
  box-shadow: 0 0 32px -12px rgba(45, 212, 191, 0.35);
}

.card--muted {
  opacity: 0.6;
}

.card__title {
  font-size: var(--fs-lg);
  font-weight: 600;
  letter-spacing: -0.01em;
}

.card__text {
  margin-top: var(--sp-2);
  color: var(--c-text-2);
  font-size: var(--fs-sm);
}

.card__meta {
  margin-top: var(--sp-4);
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

.grid {
  display: grid;
  gap: var(--sp-4);
  grid-template-columns: 1fr;
}

@media (min-width: 640px) {
  .grid--2 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 960px) {
  .grid--4 {
    grid-template-columns: repeat(4, 1fr);
  }
  .grid--2.grid--4 {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* --- Pill / badge --- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 10px;
  border-radius: var(--r-full);
  font-family: var(--f-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid currentColor;
  background: rgba(148, 163, 184, 0.04);
}

.pill--easy { color: var(--c-diff-easy); }
.pill--medium { color: var(--c-diff-medium); }
.pill--hard { color: var(--c-diff-hard); }
.pill--expert { color: var(--c-diff-expert); }
.pill--solved { color: var(--c-solved); }
.pill--progress { color: var(--c-progress); }
.pill--locked { color: var(--c-locked); }
.pill--live { color: var(--c-signal); }
.pill--open { color: var(--c-legit); }
.pill--paid { color: var(--c-warn); }

/* --- Kurs bilan ochiladigan case: sabab va yo'l (D-046) --- */
.gate {
  margin-top: var(--sp-5);
  display: flex;
  gap: var(--sp-4);
  align-items: flex-start;
  border-color: color-mix(in srgb, var(--c-warn) 45%, transparent);
  background: color-mix(in srgb, var(--c-warn) 6%, var(--c-surface));
}

.gate__icon {
  font-size: 1.5rem;
  line-height: 1;
}

.gate__body > .card__text {
  margin-top: var(--sp-2);
}

.gate__actions {
  margin-top: var(--sp-4);
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

/* --- Sahifa qismlari --- */
.hero {
  padding: var(--sp-7) 0 var(--sp-6);
}

@media (min-width: 720px) {
  .hero {
    padding: 88px 0 var(--sp-7);
  }
}

.syslog {
  font-family: var(--f-mono);
  font-size: var(--fs-xs);
  color: var(--c-text-3);
}

.syslog b {
  color: var(--c-solved);
  font-weight: 500;
}

.hero__title {
  margin-top: var(--sp-4);
  font-size: clamp(2rem, 6vw, 3.25rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.03em;
  max-width: 16ch;
}

.hero__lead {
  margin-top: var(--sp-4);
  max-width: 60ch;
  color: var(--c-text-2);
  font-size: var(--fs-lg);
  line-height: 1.5;
}

.hero__actions {
  margin-top: var(--sp-6);
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
}

.section {
  padding: var(--sp-6) 0 var(--sp-7);
}

.section__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-4);
  margin-bottom: var(--sp-5);
}

.section__title {
  font-size: var(--fs-xl);
  font-weight: 600;
  letter-spacing: -0.02em;
}

.section__label {
  font-family: var(--f-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.08em;
  color: var(--c-text-3);
  text-transform: uppercase;
}

/* --- Xabarlar --- */
.messages {
  list-style: none;
  margin: var(--sp-4) 0 0;
  padding: 0;
  display: grid;
  gap: var(--sp-2);
}

.message {
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-md);
  border: 1px solid var(--c-border);
  background: var(--c-surface);
  font-size: var(--fs-sm);
}

.message--success { border-color: rgba(45, 212, 191, 0.35); }
.message--error { border-color: rgba(248, 113, 113, 0.35); }

/* --- Xato sahifalari --- */
.error-page {
  padding: 96px 0;
  text-align: left;
}

.error-page__code {
  font-family: var(--f-mono);
  color: var(--c-text-3);
}

.error-page__title {
  margin-top: var(--sp-3);
  font-size: var(--fs-2xl);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.error-page p {
  margin-top: var(--sp-3);
  color: var(--c-text-2);
}

.error-page .btn {
  margin-top: var(--sp-5);
}

/* --- Footer --- */
.footer {
  margin-top: var(--sp-7);
  border-top: 1px solid var(--c-border);
  padding: var(--sp-5) 0 var(--sp-6);
  color: var(--c-text-3);
  font-size: var(--fs-sm);
}

.footer__inner {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3) var(--sp-5);
  justify-content: space-between;
}

.footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-4);
  margin: 0;
  padding: 0;
  list-style: none;
}

.footer a {
  color: var(--c-text-2);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* --- Navbar: foydalanuvchi --- */
.nav__user {
  color: var(--c-text-2);
  font-size: var(--fs-sm);
  max-width: 14ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav__actions form {
  margin: 0;
}

.banner {
  padding: var(--sp-2) 0;
  background: var(--c-progress-dim);
  border-bottom: 1px solid rgba(251, 191, 36, 0.25);
  font-size: var(--fs-sm);
  color: var(--c-text);
}

.banner a {
  color: var(--c-progress);
  font-weight: 500;
}

/* --- Auth sahifalari --- */
.auth {
  display: flex;
  justify-content: center;
  padding-top: var(--sp-7);
}

.auth__card {
  width: 100%;
  max-width: 440px;
  padding: var(--sp-6) var(--sp-5);
}

.auth__title {
  margin-top: var(--sp-3);
  font-size: var(--fs-xl);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.auth__lead {
  margin-top: var(--sp-3);
  color: var(--c-text-2);
  font-size: var(--fs-sm);
}

.auth__card > .btn {
  margin-top: var(--sp-5);
}

.auth__alt {
  margin-top: var(--sp-4);
  color: var(--c-text-2);
  font-size: var(--fs-sm);
  text-align: center;
}

.auth__or {
  margin-top: var(--sp-5);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  color: var(--c-text-2);
  font-size: var(--fs-sm);
}

.auth__or::before,
.auth__or::after {
  content: "";
  flex: 1;
  border-top: 1px solid var(--c-border);
}

.auth__card > .auth__or + .btn {
  margin-top: var(--sp-4);
}

.auth__hint {
  margin-top: var(--sp-2);
  color: var(--c-text-2);
  font-size: var(--fs-xs, 0.75rem);
  text-align: center;
}

.btn--block {
  width: 100%;
}

/* --- Formalar --- */
.form {
  margin-top: var(--sp-5);
  display: grid;
  gap: var(--sp-4);
}

.form .btn {
  margin-top: var(--sp-2);
}

.field {
  display: grid;
  gap: 6px;
}

.field__label {
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--c-text);
}

.field input:not([type="radio"]):not([type="checkbox"]) {
  width: 100%;
  min-height: 46px;
  padding: 0 var(--sp-4);
  background: var(--c-bg-soft);
  border: 1px solid var(--c-border-strong);
  border-radius: var(--r-md);
  color: var(--c-text);
  font: inherit;
  font-size: var(--fs-md);
  transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}

.field input:not([type="radio"]):not([type="checkbox"]):focus {
  outline: none;
  border-color: var(--c-signal);
  box-shadow: 0 0 0 3px var(--c-signal-dim);
}

.field--error input:not([type="radio"]):not([type="checkbox"]) {
  border-color: rgba(248, 113, 113, 0.6);
}

.field__help {
  font-size: var(--fs-xs);
  color: var(--c-text-3);
}

.field__error,
.form__error {
  font-size: var(--fs-sm);
  color: var(--c-error);
}

.form__error {
  padding: var(--sp-3) var(--sp-4);
  background: var(--c-error-dim);
  border-radius: var(--r-md);
}

/* --- Oddiy sahifa --- */
.page {
  padding-top: var(--sp-6);
}

.page__title {
  margin-top: var(--sp-3);
  font-size: var(--fs-2xl);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.page__grid {
  margin-top: var(--sp-5);
}

.kv {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--sp-2) var(--sp-4);
  margin: var(--sp-4) 0 0;
  font-size: var(--fs-sm);
}

.kv dt {
  color: var(--c-text-3);
}

.kv dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.list {
  list-style: none;
  margin: var(--sp-4) 0 0;
  padding: 0;
  display: grid;
  gap: var(--sp-2);
}

.list__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-2) 0;
  border-bottom: 1px solid var(--c-border);
  font-size: var(--fs-sm);
}

/* --- Case va bosqich sahifalari --- */
.crumbs {
  font-size: var(--fs-sm);
  color: var(--c-text-3);
}

.crumbs a {
  color: var(--c-text-2);
}

.case__layout {
  display: grid;
  gap: var(--sp-5);
  margin-top: var(--sp-4);
}

@media (min-width: 960px) {
  .case__layout {
    grid-template-columns: minmax(0, 1fr) 320px;
    align-items: start;
  }
}

.case__main {
  display: grid;
  gap: var(--sp-4);
  min-width: 0;
}

.case__side {
  display: grid;
  gap: var(--sp-4);
}

@media (min-width: 960px) {
  .case__side {
    position: sticky;
    top: calc(var(--h-nav) + var(--sp-4));
  }
}

.case__steps-title,
.page__sub {
  margin-top: var(--sp-5);
}

.prose {
  margin-top: var(--sp-3);
  color: var(--c-text);
  line-height: 1.7;
}

.prose > * + * {
  margin-top: var(--sp-3);
}

.prose blockquote {
  margin-left: 0;
  padding-left: var(--sp-4);
  border-left: 2px solid var(--c-signal);
  color: var(--c-text-2);
}

.prose code {
  font-family: var(--f-mono);
  font-size: 0.9em;
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--c-surface-2);
}

.tw-hidden {
  opacity: 0;
}

.tw-in {
  animation: tw-in var(--dur-slow) var(--ease-out);
}

@keyframes tw-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

/* Timeline — bosqichlar yo'l xaritasi: tugunlar chiziq bilan bog'langan.
   done — yechilgan bo'lak (teal, ichida yorug'lik oqadi), active — joriy bosqichga olib boruvchi bo'lak,
   idle — hali ochilmagan (uzuq chiziq). Yangi yechilgan bo'lak labs.js orqali "chiziladi". */
.timeline {
  --tl-gap: var(--sp-3);
  --tl-x: 18px; /* tugun markazi (chapdan) */
  --tl-dot: 22px;
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--tl-gap);
}

.timeline__item {
  position: relative;
  padding-left: calc(var(--tl-x) * 2 + var(--sp-2));
}

.timeline__link {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  background: rgba(15, 23, 42, 0.6);
  color: var(--c-text);
  transition:
    border-color var(--dur-fast) var(--ease-out),
    transform var(--dur-fast) var(--ease-out);
}

a.timeline__link:hover {
  text-decoration: none;
  border-color: rgba(45, 212, 191, 0.35);
  transform: translateX(2px);
}

.timeline__num,
.timeline__pts {
  color: var(--c-text-3);
  font-size: var(--fs-sm);
}

/* Tugun */
.timeline__dot {
  position: absolute;
  z-index: 2;
  left: calc(var(--tl-x) - var(--tl-dot) / 2);
  top: 50%;
  width: var(--tl-dot);
  height: var(--tl-dot);
  margin-top: calc(var(--tl-dot) / -2);
  border: 2px solid var(--c-locked);
  border-radius: 50%;
  background: var(--c-bg);
}

.timeline__item--solved .timeline__dot {
  border-color: var(--c-solved);
  background: var(--c-solved);
  box-shadow: 0 0 10px rgba(45, 212, 191, 0.45);
}

/* Belgi ✓ — CSS bilan (matnsiz, ekran o'quvchi pill'dan o'qiydi) */
.timeline__item--solved .timeline__dot::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 3px;
  width: 6px;
  height: 10px;
  border: solid var(--c-bg);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.timeline__item--open .timeline__dot {
  border-color: var(--c-progress);
  background: var(--c-progress-dim);
  animation: tl-pulse 2s var(--ease-out) infinite;
}

.timeline__item--open .timeline__dot::after {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: var(--c-progress);
}

.timeline__item--locked_paywall .timeline__dot {
  border-style: dashed;
}

.timeline__item--open .timeline__link {
  border-color: rgba(251, 191, 36, 0.35);
  background: linear-gradient(90deg, rgba(251, 191, 36, 0.06), rgba(15, 23, 42, 0.6) 40%);
}

/* Bog'lovchi chiziq: shu tugundan keyingisigacha */
.timeline__line {
  position: absolute;
  z-index: 1;
  left: calc(var(--tl-x) - 1px);
  top: 50%;
  width: 2px;
  height: calc(100% + var(--tl-gap));
  background: repeating-linear-gradient(to bottom, var(--c-border-strong) 0 4px, transparent 4px 9px);
  overflow: hidden;
}

.timeline__line::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, var(--c-solved), rgba(45, 212, 191, 0.75));
  transform: scaleY(0);
  transform-origin: top;
}

.timeline__line--done::after,
.timeline__line--active::after {
  transform: scaleY(1);
}

.timeline__line--active::after {
  background: linear-gradient(to bottom, var(--c-solved), var(--c-progress));
}

/* Yorug'lik chiziq bo'ylab pastga oqadi (faqat yechilgan yo'lda) */
.timeline__line--done::before,
.timeline__line--active::before {
  content: "";
  position: absolute;
  z-index: 1;
  left: 0;
  right: 0;
  height: 40%;
  background: linear-gradient(to bottom, transparent, rgba(255, 255, 255, 0.85), transparent);
  animation: tl-flow 2.4s linear infinite;
}

/* labs.js: yangi yechilgan bo'lak — chiziq chiziladi, keyingi tugun yonadi */
.timeline__line.is-drawing::after {
  animation: tl-draw 0.9s var(--ease-in-out) var(--tl-draw-delay, 0s) both;
}

.timeline__line.is-drawing::before {
  animation-delay: calc(var(--tl-draw-delay, 0s) + 0.9s);
}

.timeline__item.is-arriving .timeline__dot {
  animation:
    tl-arrive 0.6s var(--ease-out) both,
    tl-pulse 2s var(--ease-out) 0.6s infinite;
}

.timeline__item.is-arriving .timeline__link {
  animation: tl-card 0.6s var(--ease-out) both;
}

.timeline__item.is-solving .timeline__dot {
  animation: tl-arrive 0.5s var(--ease-out) both;
}

@keyframes tl-draw {
  from { transform: scaleY(0); }
  to { transform: scaleY(1); }
}

@keyframes tl-flow {
  from { transform: translateY(-100%); }
  to { transform: translateY(260%); }
}

@keyframes tl-pulse {
  0% { box-shadow: 0 0 0 0 rgba(251, 191, 36, 0.45); }
  70% { box-shadow: 0 0 0 9px rgba(251, 191, 36, 0); }
  100% { box-shadow: 0 0 0 0 rgba(251, 191, 36, 0); }
}

@keyframes tl-arrive {
  0% { transform: scale(0.4); opacity: 0.2; }
  60% { transform: scale(1.25); opacity: 1; }
  100% { transform: scale(1); }
}

@keyframes tl-card {
  from { transform: translateX(-6px); box-shadow: 0 0 0 rgba(251, 191, 36, 0); }
  50% { box-shadow: 0 0 22px rgba(251, 191, 36, 0.25); }
  to { transform: none; box-shadow: none; }
}

@media (prefers-reduced-motion: reduce) {
  .timeline__item--open .timeline__dot,
  .timeline__item.is-arriving .timeline__dot,
  .timeline__item.is-arriving .timeline__link,
  .timeline__item.is-solving .timeline__dot,
  .timeline__line.is-drawing::after {
    animation: none;
  }
  .timeline__line--done::before,
  .timeline__line--active::before {
    display: none;
  }
}

.timeline__item--solved .timeline__link {
  border-color: rgba(45, 212, 191, 0.3);
}

.timeline__item--locked_order .timeline__link,
.timeline__item--locked_paywall .timeline__link,
.timeline__item--locked_login .timeline__link {
  color: var(--c-text-3);
}

@media (max-width: 479px) {
  .timeline {
    --tl-x: 13px;
    --tl-dot: 20px;
  }
  .timeline__item--solved .timeline__dot::after {
    left: 5px;
    top: 2px;
  }
  .timeline__link {
    grid-template-columns: auto 1fr auto;
  }
  .timeline__pts {
    display: none;
  }
}

.stat {
  margin-top: var(--sp-3);
  color: var(--c-text-2);
  font-size: var(--fs-sm);
}

.stat__big {
  font-size: var(--fs-xl);
  font-weight: 600;
  color: var(--c-text);
}

.bar {
  width: 100%;
  height: 6px;
  margin-top: var(--sp-2);
  appearance: none;
  border: 0;
  border-radius: var(--r-full);
  background: var(--c-surface-2);
  overflow: hidden;
}

.bar::-webkit-progress-bar {
  background: var(--c-surface-2);
}

.bar::-webkit-progress-value {
  background: var(--c-solved);
  border-radius: var(--r-full);
}

.bar::-moz-progress-bar {
  background: var(--c-solved);
}

.side__btn {
  margin-top: var(--sp-3);
}

/* Bosqich paneli */
.step__sim {
  margin-top: var(--sp-4);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-3);
}

.answer--solved {
  border-color: rgba(45, 212, 191, 0.4);
}

.answer__after {
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-md);
  background: var(--c-solved-dim);
}

.answer__next {
  margin-top: var(--sp-4);
}

.choices {
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
  display: grid;
  gap: 6px;
}

/* legend odatda fieldset chegarasi ustida turadi — float uni oddiy blok qiladi (ajratgich chizig'i uchun). */
.choices > legend.field__label {
  float: left;
  width: 100%;
  padding: 0;
}

.choices > legend + * {
  clear: both;
}

.choices__list {
  display: grid;
  gap: var(--sp-2);
}

.choices--multi .choices__list {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr));
}

.choice {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-height: 46px;
  padding: var(--sp-2) var(--sp-4);
  background: var(--c-bg-soft);
  border: 1px solid var(--c-border-strong);
  border-radius: var(--r-md);
  color: var(--c-text-2);
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out),
    color var(--dur-fast) var(--ease-out);
}

.choice:hover {
  border-color: var(--c-signal);
  color: var(--c-text);
}

/* Haqiqiy input ko'rinmaydi, lekin klaviatura va ekran o'quvchi uchun ishlaydi. */
.choice input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.choice__mark {
  flex: none;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--c-border-strong);
  border-radius: 50%;
  background: var(--c-bg);
  transition: border-color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}

.choice--checkbox .choice__mark {
  border-radius: 5px;
}

.choice__mark::after {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--c-signal);
  transform: scale(0);
  transition: transform var(--dur-fast) var(--ease-out);
}

.choice--checkbox .choice__mark::after {
  width: 9px;
  height: 5px;
  border-radius: 0;
  background: none;
  border: solid var(--c-bg);
  border-width: 0 0 2px 2px;
  transform: translateY(-1px) rotate(-45deg) scale(0);
}

.choice__text {
  line-height: 1.4;
}

.choice:has(input:checked) {
  border-color: var(--c-signal);
  background: var(--c-signal-dim);
  color: var(--c-text);
}

.choice:has(input:checked) .choice__mark {
  border-color: var(--c-signal);
}

.choice:has(input:checked) .choice__mark::after {
  transform: scale(1);
}

.choice--checkbox:has(input:checked) .choice__mark {
  background: var(--c-signal);
}

.choice--checkbox:has(input:checked) .choice__mark::after {
  transform: translateY(-1px) rotate(-45deg) scale(1);
}

.choice:has(input:focus-visible) {
  outline: 2px solid var(--c-signal);
  outline-offset: 2px;
}

.field__num {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  margin-right: var(--sp-2);
  padding: 0 5px;
  border-radius: 6px;
  background: var(--c-signal-dim);
  color: var(--c-signal);
  font-size: 11px;
  vertical-align: 1px;
}

.answer__parts {
  margin: 0;
  padding: var(--sp-2) var(--sp-3);
  border-left: 2px solid var(--c-signal);
  background: var(--c-bg-soft);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  font-size: var(--fs-xs);
  color: var(--c-text-2);
}

.answer__form .field + .field,
.answer__form .field + .choices,
.answer__form .choices + .field,
.answer__form .choices + .choices {
  padding-top: var(--sp-4);
  border-top: 1px dashed var(--c-border);
}

.hints__list {
  list-style: none;
  margin: var(--sp-3) 0 var(--sp-3);
  padding: 0;
  display: grid;
  gap: var(--sp-2);
}

.hint--open {
  padding: var(--sp-2) var(--sp-3);
  border-left: 2px solid var(--c-progress);
  background: var(--c-progress-dim);
  border-radius: var(--r-sm);
}

.hint--open .prose {
  margin-top: 0;
}

.hint__btn {
  width: 100%;
  justify-content: space-between;
}

.hint__locked {
  display: flex;
  justify-content: space-between;
  padding: var(--sp-2) var(--sp-4);
  color: var(--c-text-3);
  font-size: var(--fs-sm);
}

.lessons--hl {
  border-color: rgba(34, 211, 238, 0.45);
  box-shadow: 0 0 28px -12px rgba(34, 211, 238, 0.5);
}

.step__nav {
  display: grid;
  gap: var(--sp-2);
  font-size: var(--fs-sm);
}

/* "Unlock" animatsiyasi: teal glow (6-bo'lim) */
.unlock {
  animation: unlock 1.2s var(--ease-out);
}

@keyframes unlock {
  0% { box-shadow: 0 0 0 0 rgba(45, 212, 191, 0); }
  30% { box-shadow: var(--glow-solved); }
  100% { box-shadow: 0 0 0 0 rgba(45, 212, 191, 0); }
}

.lock {
  border-color: var(--c-border-strong);
}

.lock .btn + .btn {
  margin-top: var(--sp-3);
}

/* Profil, reyting */
.badges {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-top: var(--sp-3);
}

.badge {
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--r-full);
  border: 1px solid rgba(45, 212, 191, 0.4);
  color: var(--c-solved);
  font-size: var(--fs-sm);
}

.badge--fb {
  border-color: rgba(251, 191, 36, 0.45);
  color: var(--c-progress);
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin: var(--sp-4) 0;
}

.tabs a {
  padding: 6px var(--sp-4);
  border: 1px solid var(--c-border);
  border-radius: var(--r-full);
  color: var(--c-text-2);
  font-size: var(--fs-sm);
}

.tabs a[aria-current='page'] {
  color: var(--c-text);
  border-color: var(--c-signal);
}

.table-wrap {
  padding: 0;
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}

.table th,
.table td {
  padding: var(--sp-3) var(--sp-4);
  text-align: left;
  border-bottom: 1px solid var(--c-border);
}

.table th {
  color: var(--c-text-3);
  font-weight: 500;
}

.table__me {
  background: var(--c-signal-dim);
}

.table .num {
  text-align: right;
  white-space: nowrap;
}

/* Telefonda reyting 5 ustuni sig'adi: zich padding, qisqa sarlavhalar, uzun login kesiladi. */
.table__short {
  display: none;
}

@media (max-width: 479px) {
  .table--board th,
  .table--board td {
    padding: var(--sp-3) var(--sp-2);
  }

  .table--board th:first-child,
  .table--board td:first-child {
    padding-left: var(--sp-4);
  }

  .table--board th:last-child,
  .table--board td:last-child {
    padding-right: var(--sp-4);
  }

  .table--board .table__user {
    max-width: 11ch;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .table__long {
    /* ekran o'quvchi uchun to'liq nom qoladi */
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .table__short {
    display: inline;
  }
}

.btn:disabled,
.btn[aria-disabled='true'] {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.field textarea {
  width: 100%;
  min-height: 200px;
  padding: var(--sp-3) var(--sp-4);
  background: var(--c-bg-soft);
  border: 1px solid var(--c-border-strong);
  border-radius: var(--r-md);
  color: var(--c-text);
  font: inherit;
  line-height: 1.6;
  resize: vertical;
}

.field textarea:focus {
  outline: none;
  border-color: var(--c-signal);
  box-shadow: 0 0 0 3px var(--c-signal-dim);
}

.report-text {
  margin-top: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-md);
  background: var(--c-bg-soft);
  color: var(--c-text-2);
  font-size: var(--fs-sm);
  white-space: normal;
  overflow-wrap: anywhere;
}

/* --- Boshqaruv paneli --- */
.dash__nav {
  margin-top: 0;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  align-items: center;
  margin: var(--sp-4) 0;
}

.filters input,
.filters select,
.form select,
.field select {
  min-height: 36px;
  padding: 0 var(--sp-3);
  background: var(--c-bg-soft);
  border: 1px solid var(--c-border-strong);
  border-radius: var(--r-sm);
  color: var(--c-text);
  font: inherit;
  font-size: var(--fs-sm);
}

.check {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  font-size: var(--fs-sm);
  color: var(--c-text-2);
}

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

.cell-wrap {
  max-width: 340px;
  overflow-wrap: anywhere;
}

.card--warn {
  border-color: rgba(251, 146, 60, 0.5);
}

.pager {
  display: flex;
  gap: var(--sp-4);
  align-items: center;
  margin-top: var(--sp-4);
  font-size: var(--fs-sm);
}

.report-card {
  margin-top: var(--sp-4);
}

.funnel .bar {
  display: block;
  max-width: 220px;
}

.funnel__paywall td {
  border-bottom: 2px solid var(--c-progress);
}

/* --- Sim-terminal (Foundation, F4.1). Inline style yo'q (CSP style-src 'self'). --- */
.term {
  padding: 0;
  overflow: hidden;
  background: var(--c-term-bg);
  border-color: rgba(45, 212, 191, 0.25);
}

.term__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3) var(--sp-2) var(--sp-4);
  border-bottom: 1px solid rgba(148, 163, 184, 0.14);
}

.term__title {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin: 0;
  font-family: var(--f-mono);
  font-size: var(--fs-xs);
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--c-text-2);
}

.term__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--c-term-teal);
  box-shadow: 0 0 8px var(--c-term-teal);
}

.term__actions {
  display: flex;
  gap: var(--sp-2);
}

.term__mobile {
  display: none;
  margin: 0;
  padding: var(--sp-2) var(--sp-4);
  font-size: var(--fs-xs);
  color: var(--c-text-3);
  border-bottom: 1px solid rgba(148, 163, 184, 0.14);
}

@media (max-width: 719px) {
  .term__mobile {
    display: block;
  }
}

.term__screen {
  height: 420px;
  overflow-y: auto;
  padding: var(--sp-3) var(--sp-4);
  font-family: var(--f-mono);
  font-size: 13px;
  line-height: 1.5;
  color: var(--c-term-text);
  cursor: text;
}

@media (max-width: 479px) {
  .term__screen {
    height: 360px;
    padding: var(--sp-2) var(--sp-3);
    font-size: 12px;
  }
}

.term__out {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  tab-size: 8;
}

.term__seg--err {
  color: var(--c-term-err);
}

.term__seg--prompt,
.term__prompt {
  color: var(--c-term-teal);
}

.term__seg--cmd {
  color: #f8fafc;
}

.term__line {
  display: flex;
  align-items: baseline;
  margin: 0;
}

.term__prompt {
  flex: none;
  max-width: 60%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: pre;
}

.term__input {
  flex: 1;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: #f8fafc;
  font: inherit;
  caret-color: var(--c-term-teal);
}

.term__input:disabled {
  opacity: 0.5;
}

.term__tips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-1) var(--sp-4);
  margin: 0;
  padding: var(--sp-2) var(--sp-4);
  list-style: none;
  font-size: var(--fs-xs);
  color: var(--c-text-3);
  border-top: 1px solid rgba(148, 163, 184, 0.14);
}

.term__tips code {
  color: var(--c-term-teal);
}

.case__next {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  margin-top: var(--sp-5);
}

/* Tartiblangan ro'yxat va to'plam (checkbox) javoblari — Pentest 1 */
.ordered { display: grid; gap: var(--sp-2); margin: 0; padding: 0; list-style: none; }
.ordered__row { display: flex; align-items: center; gap: var(--sp-3); }
.ordered__pos { flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--c-bg-soft); border: 1px solid var(--c-border-strong); color: var(--c-text-2); font-size: 12px; }
.ordered__row:has(option:checked:not([value=""])) .ordered__pos { border-color: var(--c-signal); color: var(--c-signal); }
.ordered select, .field select { flex: 1; min-height: 40px; padding: 0 var(--sp-3); border: 1px solid var(--c-border-strong); border-radius: var(--r-md); background: var(--c-bg-soft); color: var(--c-text); font: inherit; }
.field ul[id] { display: grid; gap: var(--sp-2); margin: 0; padding: 0; list-style: none; }
.field ul[id] label { display: flex; gap: var(--sp-2); align-items: center; padding: var(--sp-2) var(--sp-3); border: 1px solid var(--c-border); border-radius: var(--r-md); cursor: pointer; }
.field ul[id] label:has(input:checked) { border-color: var(--c-signal); background: var(--c-signal-dim); }

/* --- Tasdiqlash oynasi (labs.js LabsConfirm; brauzer confirm() o'rniga) --- */
.modal {
  width: min(420px, calc(100vw - 32px));
  max-width: none;
  padding: 0;
  border: 1px solid var(--c-border-strong);
  border-radius: var(--r-lg);
  background: var(--c-surface);
  color: var(--c-text);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(34, 211, 238, 0.06);
}

.modal::backdrop {
  background: rgba(2, 6, 23, 0.72);
  backdrop-filter: blur(3px);
}

.modal[open] {
  animation: modal-in var(--dur-fast, 160ms) var(--ease-out, ease-out);
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .modal[open] { animation: none; }
}

.modal__box {
  display: grid;
  justify-items: center;
  gap: var(--sp-3);
  padding: var(--sp-6, 28px) var(--sp-5) var(--sp-5);
  text-align: center;
}

.modal__icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--c-signal-dim);
  color: var(--c-signal);
  font-weight: 700;
  font-size: 20px;
}

.modal--warn .modal__icon { background: rgba(251, 191, 36, 0.14); color: var(--c-warn); }
.modal--danger .modal__icon { background: var(--c-error-dim); color: var(--c-error); }

.modal__title {
  margin: 0;
  font-size: var(--fs-lg, 1.125rem);
  font-weight: 700;
}

.modal__badge {
  margin: 0;
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid rgba(251, 191, 36, 0.4);
  background: rgba(251, 191, 36, 0.1);
  color: var(--c-warn);
  font-size: var(--fs-sm);
  font-weight: 600;
}

.modal__text {
  margin: 0;
  color: var(--c-text-2);
  font-size: var(--fs-sm);
  line-height: 1.55;
}

.modal__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-2);
  width: 100%;
  margin-top: var(--sp-2);
}

.modal--danger .modal__actions .btn--primary {
  background: var(--c-error);
  color: #fff;
  box-shadow: none;
}

/* =====================================================================
 * Navbar va bosh sahifa v2 (D-047): bitta "Case'lar" bo'limi, katalog,
 * terminal-vizual hero, case/yo'nalish kartalari. Hammasi inline style'siz (CSP).
 * ===================================================================== */

/* --- Navbar: joriy bo'lim, avatar --- */
.nav__links {
  gap: var(--sp-1);
}

.nav__links a {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 36px;
  padding: 0 var(--sp-3);
  border-radius: var(--r-full);
  transition: color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}

.nav__links a:hover {
  background: rgba(148, 163, 184, 0.08);
}

.nav__links a[aria-current='page'] {
  color: var(--c-text);
  background: rgba(34, 211, 238, 0.1);
  box-shadow: inset 0 0 0 1px rgba(34, 211, 238, 0.25);
}

.nav__ext {
  font-size: 0.75em;
  color: var(--c-text-3);
}

.nav__user {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 4px 12px 4px 4px;
  border-radius: var(--r-full);
  border: 1px solid var(--c-border);
  color: var(--c-text-2);
  font-size: var(--fs-sm);
  transition: border-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}

.nav__user:hover {
  text-decoration: none;
  color: var(--c-text);
  border-color: var(--c-border-strong);
}

.nav__avatar {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--g-brand);
  color: #020617;
  font-weight: 700;
  font-size: var(--fs-sm);
}

@media (max-width: 479px) {
  .nav__uname,
  .nav__logout {
    display: none;
  }

  .nav__user {
    padding: 4px;
  }
}

.nav__panel a[aria-current='page'] {
  color: var(--c-signal);
}

.nav__panel-btn {
  width: 100%;
  min-height: 44px;
  padding: 0 var(--sp-3);
  border: 0;
  border-radius: var(--r-sm);
  background: none;
  color: var(--c-text-2);
  font: inherit;
  font-size: var(--fs-sm);
  text-align: left;
  cursor: pointer;
}

.nav__panel-btn:hover {
  background: var(--c-surface-2);
  color: var(--c-text);
}

/* --- Umumiy --- */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 4px 12px;
  border-radius: var(--r-full);
  border: 1px solid rgba(34, 211, 238, 0.25);
  background: rgba(34, 211, 238, 0.06);
  color: var(--c-signal);
  font-family: var(--f-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.04em;
}

.eyebrow__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--c-legit);
  box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.6);
  animation: pulse-dot 2s var(--ease-out) infinite;
}

@keyframes pulse-dot {
  0% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.55); }
  70% { box-shadow: 0 0 0 8px rgba(74, 222, 128, 0); }
  100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0); }
}

.grad {
  background: var(--g-brand);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.btn--lg {
  height: 48px;
  padding: 0 var(--sp-5);
  font-size: var(--fs-md);
}

.section--tight {
  padding-top: 0;
  padding-bottom: var(--sp-5);
}

.section__more {
  color: var(--c-text-2);
  font-size: var(--fs-sm);
  white-space: nowrap;
}

.section__more:hover {
  color: var(--c-signal);
  text-decoration: none;
}

.grid--auto {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
}

.ticon {
  width: 18px;
  height: 18px;
  flex: none;
}

/* --- Hero --- */
.hero2 {
  position: relative;
  padding: var(--sp-7) 0 var(--sp-6);
  overflow: hidden;
}

.hero2::before {
  content: "";
  position: absolute;
  inset: -40% -10% auto auto;
  width: 720px;
  height: 720px;
  background: radial-gradient(closest-side, rgba(59, 130, 246, 0.18), rgba(34, 211, 238, 0.06) 55%, transparent 75%);
  pointer-events: none;
}

.hero2__grid {
  position: relative;
  display: grid;
  gap: var(--sp-6);
  align-items: center;
}

@media (min-width: 960px) {
  .hero2 {
    padding: 88px 0 var(--sp-7);
  }

  .hero2__grid {
    grid-template-columns: 1.1fr 0.9fr;
    gap: var(--sp-7);
  }
}

.hero2__title {
  margin-top: var(--sp-4);
  font-size: clamp(2.1rem, 5.4vw, 3.5rem);
  font-weight: 750;
  line-height: 1.06;
  letter-spacing: -0.035em;
}

.hero2__lead {
  margin-top: var(--sp-4);
  max-width: 56ch;
  color: var(--c-text-2);
  font-size: 1.125rem;
  line-height: 1.6;
}

.hero2__actions {
  margin-top: var(--sp-6);
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
}

.stats {
  margin: var(--sp-6) 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2) var(--sp-6);
}

.stats__item {
  display: flex;
  flex-direction: column-reverse;
}

.stats dt {
  color: var(--c-text-3);
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.stats dd {
  margin: 0;
  font-size: var(--fs-2xl);
  font-weight: 600;
  color: var(--c-text);
}

/* --- Terminal vizual --- */
.hterm {
  border-radius: var(--r-lg);
  border: 1px solid var(--c-border-strong);
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.92), rgba(10, 14, 23, 0.96));
  box-shadow: 0 30px 80px -30px rgba(34, 211, 238, 0.35), 0 0 0 1px rgba(34, 211, 238, 0.06);
  overflow: hidden;
}

.hterm__bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--c-border);
  background: rgba(30, 41, 59, 0.5);
}

.hterm__bar span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #334155;
}

.hterm__bar span:nth-child(1) { background: #f87171; }
.hterm__bar span:nth-child(2) { background: #fbbf24; }
.hterm__bar span:nth-child(3) { background: #4ade80; }

.hterm__bar b {
  margin-left: auto;
  color: var(--c-text-3);
  font-weight: 400;
  font-size: var(--fs-xs);
}

.hterm__body {
  padding: var(--sp-5);
  font-size: 0.8125rem;
  line-height: 1.9;
  color: var(--c-term-text);
  min-height: 248px;
}

.hterm__body i {
  font-style: normal;
  color: var(--c-signal);
  margin-right: 6px;
}

.hterm__ok { color: var(--c-term-teal); }
.hterm__warn { color: var(--c-warn); }

.hterm__l {
  opacity: 0;
  transform: translateY(4px);
  animation: hterm-in var(--dur-med) var(--ease-out) forwards;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hterm__l--1 { animation-delay: 0.2s; }
.hterm__l--2 { animation-delay: 0.8s; }
.hterm__l--3 { animation-delay: 1.4s; }
.hterm__l--4 { animation-delay: 2s; }
.hterm__l--5 { animation-delay: 2.6s; }
.hterm__l--6 { animation-delay: 3.2s; }
.hterm__l--7 { animation-delay: 3.8s; }

@keyframes hterm-in {
  to { opacity: 1; transform: none; }
}

.hterm__cursor {
  display: inline-block;
  width: 8px;
  height: 1em;
  margin-left: 4px;
  vertical-align: -2px;
  background: var(--c-signal);
  animation: blink 1s steps(1) infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

@media (max-width: 959px) {
  .hterm {
    display: none; /* kichik ekranda matn va tugmalar birinchi */
  }
}

/* --- Yo'nalish kartasi --- */
.tcard {
  --tc: var(--c-signal);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  padding: var(--sp-5);
  border-radius: var(--r-lg);
  border: 1px solid var(--c-border);
  background:
    radial-gradient(120% 80% at 100% 0%, color-mix(in srgb, var(--tc) 10%, transparent), transparent 60%),
    rgba(15, 23, 42, 0.72);
  color: var(--c-text);
  transition: transform var(--dur-med) var(--ease-out), border-color var(--dur-med) var(--ease-out),
    box-shadow var(--dur-med) var(--ease-out);
}

.tcard--foundation { --tc: #4ade80; }
.tcard--osint { --tc: #22d3ee; }
.tcard--pentest { --tc: #f87171; }

.tcard:hover {
  text-decoration: none;
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--tc) 45%, transparent);
  box-shadow: 0 18px 40px -22px color-mix(in srgb, var(--tc) 70%, transparent);
}

.tcard__icon {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: var(--r-md);
  color: var(--tc);
  background: color-mix(in srgb, var(--tc) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--tc) 30%, transparent);
}

.tcard__icon .ticon {
  width: 22px;
  height: 22px;
}

.tcard__title {
  margin-top: var(--sp-2);
  font-size: var(--fs-lg);
  font-weight: 650;
  letter-spacing: -0.01em;
}

.tcard__text {
  color: var(--c-text-2);
  font-size: var(--fs-sm);
  line-height: 1.55;
  flex: 1;
}

.tcard__count {
  margin-top: var(--sp-2);
  color: var(--tc);
  font-size: var(--fs-xs);
  letter-spacing: 0.04em;
}

/* --- Case kartasi --- */
.ccard {
  --cc: var(--c-border-strong);
  position: relative;
  display: flex;
  flex-direction: column;
  padding: var(--sp-5);
  border-radius: var(--r-lg);
  border: 1px solid var(--c-border);
  background: rgba(15, 23, 42, 0.72);
  color: var(--c-text);
  overflow: hidden;
  transition: transform var(--dur-med) var(--ease-out), border-color var(--dur-med) var(--ease-out),
    box-shadow var(--dur-med) var(--ease-out);
}

.ccard::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  background: var(--cc);
  opacity: 0.9;
}

.ccard--open { --cc: linear-gradient(90deg, var(--c-legit), var(--c-signal)); }
.ccard--paid { --cc: linear-gradient(90deg, var(--c-warn), #fb923c); }
.ccard--done { --cc: var(--c-solved); }

.ccard:hover {
  text-decoration: none;
  transform: translateY(-3px);
  border-color: var(--c-border-strong);
  box-shadow: 0 22px 48px -28px rgba(34, 211, 238, 0.45);
}

.ccard__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
}

.ccard__track {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--c-text-3);
  font-family: var(--f-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.ccard__title {
  margin-top: var(--sp-4);
  font-size: var(--fs-lg);
  font-weight: 650;
  letter-spacing: -0.015em;
}

.ccard__text {
  margin-top: var(--sp-2);
  color: var(--c-text-2);
  font-size: var(--fs-sm);
  line-height: 1.55;
}

.ccard__meta {
  margin-top: var(--sp-4);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2) var(--sp-3);
}

.ccard__fact {
  color: var(--c-text-3);
  font-size: var(--fs-xs);
}

.ccard__fact::before {
  content: "·";
  margin-right: var(--sp-3);
  color: var(--c-surface-3);
}

.ccard__progress {
  margin-top: var(--sp-4);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  font-size: var(--fs-xs);
  color: var(--c-text-2);
}

.ccard__progress .bar {
  flex: 1;
  margin: 0;
}

.ccard__hint {
  margin-top: var(--sp-3);
  color: var(--c-text-3);
  font-size: var(--fs-xs);
}

.ccard__go {
  margin-top: auto;
  padding-top: var(--sp-4);
  color: var(--c-signal);
  font-size: var(--fs-sm);
  font-weight: 500;
  transition: transform var(--dur-fast) var(--ease-out);
}

.ccard:hover .ccard__go {
  transform: translateX(4px);
}

/* --- Filtr chiplari --- */
.chips {
  margin-top: var(--sp-5);
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border-radius: var(--r-full);
  border: 1px solid var(--c-border);
  background: rgba(15, 23, 42, 0.6);
  color: var(--c-text-2);
  font-size: var(--fs-sm);
  transition: all var(--dur-fast) var(--ease-out);
}

.chip:hover {
  text-decoration: none;
  color: var(--c-text);
  border-color: var(--c-border-strong);
}

.chip[aria-current='page'] {
  color: #020617;
  background: var(--g-brand);
  border-color: transparent;
  font-weight: 600;
}

.chip__n {
  font-size: var(--fs-xs);
  opacity: 0.7;
}

/* --- Qanday ishlaydi --- */
.steps {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: var(--sp-4);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
}

.steps__item {
  padding: var(--sp-5);
  border-radius: var(--r-lg);
  border: 1px dashed var(--c-border-strong);
  background: rgba(15, 23, 42, 0.4);
}

.steps__n {
  color: var(--c-signal);
  font-size: var(--fs-sm);
}

.steps__item h3 {
  margin-top: var(--sp-3);
  font-size: var(--fs-md);
  font-weight: 600;
}

.steps__item p {
  margin-top: var(--sp-2);
  color: var(--c-text-2);
  font-size: var(--fs-sm);
  line-height: 1.55;
}

@media (prefers-reduced-motion: reduce) {
  .hterm__l {
    opacity: 1;
    transform: none;
    animation: none;
  }

  .hterm__cursor,
  .eyebrow__dot {
    animation: none;
  }

  .tcard:hover,
  .ccard:hover {
    transform: none;
  }
}

/* =====================================================================
 * Telefon va logo tuzatishlari: markazlangan logo, uzun tugma matni
 * o'raladi, kurs bloki va ro'yxatlar tor ekranda sig'adi.
 * ===================================================================== */
.brand {
  flex-shrink: 0;
  gap: var(--sp-2);
}

.brand img.brand__mark {
  width: 36px;
  height: 36px;
  border-radius: 0;
  object-fit: contain;
  filter: drop-shadow(0 0 8px rgba(59, 130, 246, 0.45));
}

.btn {
  max-width: 100%;
}

.nav .btn {
  white-space: nowrap;
}

.list__main {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.list__title {
  color: var(--c-text);
  overflow-wrap: anywhere;
}

.list__row > .pill {
  flex-shrink: 0;
}

@media (max-width: 599px) {
  /* Uzun matnli tugma (masalan «Kurs nomi» kursiga o'tish) ekrandan chiqmasin. */
  .btn {
    white-space: normal;
    text-align: center;
    line-height: 1.3;
    padding-block: var(--sp-2);
  }

  .gate {
    flex-direction: column;
    gap: var(--sp-2);
  }

  .gate__actions .btn {
    width: 100%;
  }

  .page__title {
    overflow-wrap: anywhere;
  }
}

/* Profil statistikasi telefonda 2×2 (4 ta to'liq kenglikdagi karta o'rniga). */
@media (max-width: 599px) {
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--sp-3);
  }

  .stats-grid > .card {
    padding: var(--sp-4);
  }
}

/* iOS Safari 16px dan kichik inputga fokusda sahifani kattalashtiradi. */
@media (max-width: 719px) {
  .term__input {
    font-size: 16px;
  }
}

/* Case kartasi: tor ekranda "·" yangi qator boshida yolg'iz qolmasin. */
.ccard__fact {
  white-space: nowrap;
}

@media (max-width: 479px) {
  .ccard__meta {
    gap: var(--sp-2) var(--sp-4);
  }

  .ccard__fact::before {
    content: none;
  }
}

/* Kirish: SSO asosiy, parol — yig'ma bo'lim (D-049). */
.auth__sso {
  margin-top: var(--sp-5);
}

.auth__pw {
  margin-top: var(--sp-5);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--c-border);
}

.auth__pw > summary {
  cursor: pointer;
  color: var(--c-text-3);
  font-size: var(--fs-sm);
  list-style: none;
  text-align: center;
}

.auth__pw > summary::-webkit-details-marker {
  display: none;
}

.auth__pw > summary::after {
  content: " ▾";
}

.auth__pw[open] > summary {
  margin-bottom: var(--sp-4);
  color: var(--c-text-2);
}

.auth__pw[open] > summary::after {
  content: " ▴";
}
