:root {
  --ink: #1a1f26;
  --ink-soft: #3a4656;
  --muted: #5c6b7c;
  --paper: #e7edf3;
  --paper-2: #f4f7fa;
  --line: rgba(28, 36, 48, 0.12);
  --line-strong: rgba(28, 36, 48, 0.22);
  --steel: #2a6f7a;
  --steel-deep: #1f4f5a;
  --graphite: #4a5563;
  --pencil: #8b7355;
  --ok: #2f6b4f;
  --bad: #8b3a3a;
  --shadow: 0 18px 40px rgba(28, 36, 48, 0.08);
  --display: "Petrona", "Times New Roman", serif;
  --sans: "Work Sans", "Segoe UI", sans-serif;
  --radius: 14px;
  --wrap: min(1120px, calc(100% - 2.4rem));
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(47, 111, 126, 0.14), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, rgba(139, 115, 85, 0.1), transparent 50%),
    linear-gradient(180deg, var(--paper) 0%, var(--paper-2) 45%, #eef2f6 100%);
  min-height: 100vh;
}

a {
  color: var(--steel-deep);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

.wrap {
  width: var(--wrap);
  margin-inline: auto;
}

.hero {
  position: relative;
  min-height: min(92vh, 720px);
  display: grid;
  align-items: end;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
}

.hero-plane {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.paper-wash {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(145deg, rgba(244, 247, 250, 0.92), rgba(231, 237, 243, 0.55) 48%, rgba(47, 111, 126, 0.12)),
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 27px,
      rgba(28, 36, 48, 0.035) 28px
    ),
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 27px,
      rgba(28, 36, 48, 0.03) 28px
    );
}

.grid-drift {
  position: absolute;
  inset: -10% -5%;
  background:
    radial-gradient(circle at 20% 30%, rgba(47, 111, 126, 0.16), transparent 28%),
    radial-gradient(circle at 78% 40%, rgba(28, 36, 48, 0.08), transparent 32%);
  animation: drift 18s ease-in-out infinite alternate;
}

.graphite-dust {
  position: absolute;
  inset: 0;
  opacity: 0.35;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='0.35'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
  animation: dust 12s linear infinite;
}

@keyframes drift {
  from { transform: translate3d(-1.5%, 0, 0) scale(1); }
  to { transform: translate3d(1.5%, 1%, 0) scale(1.04); }
}

@keyframes dust {
  from { transform: translateY(0); }
  to { transform: translateY(-12px); }
}

.hero-stack {
  position: relative;
  z-index: 1;
  padding: 28px 0 56px;
  display: grid;
  gap: 48px;
}

.hero-top {
  display: flex;
  justify-content: flex-end;
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
  font-size: 0.92rem;
  font-weight: 600;
}

.nav-links a {
  color: var(--ink-soft);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.nav-links a:hover {
  color: var(--ink);
  border-color: var(--steel);
}

.brand-kicker {
  margin: 0 0 0.55rem;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--steel);
  font-weight: 700;
}

.brand {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(2.6rem, 7vw, 4.6rem);
  line-height: 0.98;
  letter-spacing: -0.03em;
  color: var(--ink);
  max-width: 12ch;
  animation: brandIn 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes brandIn {
  from { opacity: 0; transform: translateY(18px); filter: blur(4px); }
  to { opacity: 1; transform: none; filter: none; }
}

.lede {
  margin: 1.1rem 0 0;
  max-width: 34rem;
  font-size: 1.08rem;
  line-height: 1.55;
  color: var(--muted);
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.btn {
  appearance: none;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.55);
  color: var(--ink);
  font: inherit;
  font-weight: 650;
  padding: 0.72rem 1.1rem;
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.btn:hover {
  transform: translateY(-1px);
  border-color: var(--steel);
}

.btn-primary {
  background: var(--ink);
  color: #f5f8fb;
  border-color: var(--ink);
}

.btn-primary:hover {
  background: var(--steel-deep);
  border-color: var(--steel-deep);
}

.btn-ghost {
  background: transparent;
}

section {
  padding: 64px 0 24px;
}

.section-head {
  margin-bottom: 1.5rem;
  max-width: 42rem;
}

.section-head h2 {
  margin: 0 0 0.45rem;
  font-family: var(--display);
  font-size: clamp(1.8rem, 3.5vw, 2.5rem);
  letter-spacing: -0.02em;
}

.section-head p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.path-rail {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 1.25rem;
}

.path-step {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.55);
  border-radius: var(--radius);
  padding: 12px 14px;
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

.path-step:hover,
.path-step[aria-current="true"] {
  border-color: var(--steel);
  background: rgba(47, 111, 126, 0.08);
  transform: translateY(-2px);
}

.path-step .n {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--steel);
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.path-step strong {
  display: block;
  font-size: 0.98rem;
  margin-bottom: 0.2rem;
}

.path-step span {
  display: block;
  font-size: 0.84rem;
  color: var(--muted);
  line-height: 1.35;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.75rem;
}

.chip {
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.5);
  color: var(--ink-soft);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.42rem 0.8rem;
  border-radius: 999px;
  cursor: pointer;
}

.chip[aria-pressed="true"] {
  background: var(--steel);
  border-color: var(--steel);
  color: #f5fafb;
}

.path-hint {
  min-height: 1.3em;
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.92rem;
}

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

.letter-rail {
  display: grid;
  gap: 6px;
  max-height: 640px;
  overflow: auto;
  padding-right: 4px;
}

.rail-btn {
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.55);
  border-radius: 12px;
  padding: 8px 10px;
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 8px;
  align-items: center;
  cursor: pointer;
  text-align: left;
  font: inherit;
  transition: border-color 0.18s ease, transform 0.18s ease;
}

.rail-btn:hover,
.rail-btn[aria-current="true"] {
  border-color: var(--steel);
  transform: translateX(2px);
}

.rail-mini {
  width: 42px;
  height: 42px;
}

.rail-btn small {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
}

.letter-stage {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.62);
  border-radius: calc(var(--radius) + 4px);
  box-shadow: var(--shadow);
  padding: clamp(16px, 3vw, 28px);
  min-height: 420px;
}

.stage-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 18px;
  align-items: start;
}

.stage-head h3 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.8rem;
}

.stage-head .meta {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.stroke-board {
  margin-top: 1rem;
  background:
    linear-gradient(180deg, #f8fafc, #eef3f7),
    repeating-linear-gradient(0deg, transparent, transparent 23px, rgba(47, 111, 126, 0.08) 24px);
  border: 1px dashed rgba(47, 111, 126, 0.28);
  border-radius: var(--radius);
  aspect-ratio: 1;
  max-width: 360px;
  position: relative;
  overflow: hidden;
}

.stroke-board .ms-ghost {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: "Noto Serif Old Uyghur", "Noto Serif", serif;
  font-size: clamp(4.5rem, 18vw, 6.5rem);
  color: rgba(28, 36, 48, 0.1);
  pointer-events: none;
  z-index: 0;
  writing-mode: horizontal-tb;
  direction: rtl;
  unicode-bidi: isolate;
  line-height: 1;
}

.stroke-board svg {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: block;
}

.stroke-board path.guide {
  fill: none;
  stroke: rgba(28, 36, 48, 0.12);
  stroke-width: 3.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.stroke-board path.live {
  fill: none;
  stroke: var(--ink);
  stroke-width: 3.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: drawStroke 1.1s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes drawStroke {
  to { stroke-dashoffset: 0; }
}

.stroke-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.9rem;
}

.compare {
  border-left: 1px solid var(--line);
  padding-left: 16px;
}

.compare h4 {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--steel);
}

.compare img {
  width: 120px;
  height: 120px;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px;
}

.compare p,
.simplify {
  margin: 0.75rem 0 0;
  font-size: 0.92rem;
  color: var(--muted);
  line-height: 1.45;
}

.stroke-list {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.stroke-list li {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 0.92rem;
}

.stroke-list .dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(47, 111, 126, 0.12);
  color: var(--steel-deep);
  display: grid;
  place-items: center;
  font-size: 0.75rem;
  font-weight: 700;
}

.progress-banner {
  margin-top: 18px;
}

.progress-banner-inner {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
  border-radius: var(--radius);
  padding: 12px 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  align-items: center;
  justify-content: space-between;
}

.trace-dock,
.free-dock {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.field {
  display: grid;
  gap: 0.35rem;
  font-size: 0.88rem;
  font-weight: 650;
  color: var(--ink-soft);
}

.field select {
  font: inherit;
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.8);
  color: var(--ink);
}

.trace-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.9rem;
}

.trace-status {
  margin: 0.9rem 0 0;
  min-height: 1.4em;
  color: var(--muted);
  font-size: 0.95rem;
}

.trace-status.ok { color: var(--ok); font-weight: 650; }
.trace-status.bad { color: var(--bad); font-weight: 650; }

.canvas-shell {
  position: relative;
  border: 1px solid var(--line-strong);
  border-radius: calc(var(--radius) + 2px);
  background:
    linear-gradient(180deg, #fbfcfd, #eef3f7),
    repeating-linear-gradient(0deg, transparent, transparent 23px, rgba(47, 111, 126, 0.07) 24px);
  box-shadow: var(--shadow);
  aspect-ratio: 1;
  max-width: 520px;
  touch-action: none;
  overflow: hidden;
}

.canvas-shell canvas,
.trace-guide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.trace-guide path {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.trace-guide path.done {
  stroke: rgba(47, 111, 126, 0.28);
  stroke-width: 3.2;
}

.trace-guide path.active {
  stroke: rgba(28, 36, 48, 0.22);
  stroke-width: 3.6;
  stroke-dasharray: 4 3;
  animation: dashMove 1.2s linear infinite;
}

@keyframes dashMove {
  to { stroke-dashoffset: -14; }
}

.free-shell {
  background:
    linear-gradient(180deg, #f7fafc, #e8eef4);
}

.free-target {
  margin-top: 1rem;
  width: 120px;
  height: 120px;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.65);
}

.free-target svg {
  width: 100%;
  height: 100%;
}

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

.aside-strip > div {
  border-top: 2px solid var(--steel);
  padding-top: 12px;
}

.aside-strip h3 {
  margin: 0 0 0.4rem;
  font-family: var(--display);
  font-size: 1.25rem;
}

.aside-strip p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
  font-size: 0.95rem;
}

footer {
  padding: 36px 0 48px;
  color: var(--muted);
  font-size: 0.9rem;
  border-top: 1px solid var(--line);
  margin-top: 40px;
}

footer p { margin: 0; }

@media (max-width: 900px) {
  .path-rail { grid-template-columns: 1fr 1fr; }
  .learn-layout { grid-template-columns: 1fr; }
  .letter-rail {
    grid-auto-flow: column;
    grid-auto-columns: minmax(140px, 160px);
    grid-template-columns: none;
    overflow-x: auto;
    max-height: none;
  }
  .stage-grid { grid-template-columns: 1fr; }
  .compare { border-left: 0; padding-left: 0; border-top: 1px solid var(--line); padding-top: 14px; }
  .trace-dock,
  .free-dock,
  .aside-strip { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .path-rail { grid-template-columns: 1fr; }
  .brand { max-width: none; }
  .hero { min-height: auto; }
  .hero-stack { padding-top: 18px; gap: 28px; }
}


@font-face {
  font-family: "Noto Serif Old Uyghur";
  src: url("../fonts/NotoSerifOldUyghur-Regular.ttf") format("truetype");
  font-display: swap;
}

.unicode-ref {
  font-family: "Noto Serif Old Uyghur", serif;
  font-size: 4.5rem;
  line-height: 1;
  writing-mode: horizontal-tb;
  direction: rtl;
  unicode-bidi: isolate;
  text-orientation: mixed;
  min-height: 0;
  color: #1a1f26;
  margin: 0.5rem 0;
}
