:root {
  --bg: #14161b;
  --bg-2: #1b1e25;
  --panel: #20242c;
  --panel-2: #2b303b;
  --line: rgba(255, 255, 255, 0.08);
  --text: #eef0f4;
  --muted: #a3a9b6;
  --orange: #f29a3f;
  --orange-soft: #ffc27a;
  --on-orange: #1a1206;
  --radius: 16px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: dark;
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--orange-soft); text-underline-offset: 3px; }
a:hover { color: #ffd9a8; }
code, pre { font-family: var(--mono); font-size: 0.88em; }
:focus-visible { outline: 2px solid var(--orange-soft); outline-offset: 3px; border-radius: 6px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip {
  position: absolute; left: 12px; top: -60px; z-index: 50;
  background: var(--orange); color: var(--on-orange); padding: 8px 14px; border-radius: 8px; font-weight: 600;
}
.skip:focus { top: 12px; }

.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .wrap { padding: 0 32px; } }

/* Nav */
.nav {
  position: sticky; top: 0; z-index: 20;
  background: rgba(20, 22, 27, 0.78);
  backdrop-filter: saturate(150%) blur(12px);
  -webkit-backdrop-filter: saturate(150%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; gap: 12px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 700; letter-spacing: -0.01em; }
.nav nav { display: flex; gap: 4px; }
.nav nav a { color: var(--muted); text-decoration: none; font-size: 15px; padding: 6px 10px; border-radius: 8px; }
.nav nav a:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); }
@media (max-width: 560px) {
  .nav nav a:not(.nav-gh) { display: none; }
}

/* Hero */
.hero { position: relative; overflow: hidden; padding: 72px 0 64px; text-align: center; }
.glow {
  position: absolute; inset: -30% -20% auto; height: 640px; pointer-events: none;
  background:
    radial-gradient(closest-side at 50% 40%, rgba(242, 154, 63, 0.22), transparent 70%),
    radial-gradient(closest-side at 30% 70%, rgba(43, 48, 59, 0.9), transparent 80%);
}
.hero-inner { position: relative; }
.hero-icon {
  width: 148px; height: 148px; margin: 0 auto 14px;
  filter: drop-shadow(0 20px 30px rgba(0, 0, 0, 0.5));
  animation: float 6s ease-in-out infinite;
}
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }

.eyebrow {
  margin: 0 0 10px; color: var(--orange); font-size: 13px; font-weight: 700;
  letter-spacing: 0.12em; text-transform: uppercase;
}
h1, h2, h3 { letter-spacing: -0.02em; line-height: 1.15; margin: 0; }
h1 { font-size: clamp(34px, 6.2vw, 60px); max-width: 15em; margin: 0 auto; font-weight: 800; }
h2 { font-size: clamp(28px, 4.4vw, 42px); font-weight: 800; }
h3 { font-size: 19px; }
.lede { color: var(--muted); font-size: clamp(17px, 2.1vw, 20px); max-width: 36em; margin: 20px auto 0; }
.sub { color: var(--muted); max-width: 40em; margin: 14px 0 0; }

.cta { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px; margin-top: 32px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px; padding: 0 26px; border-radius: 14px; font-weight: 700; font-size: 17px;
  text-decoration: none; transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.btn-primary {
  color: var(--on-orange);
  background: linear-gradient(180deg, var(--orange-soft), var(--orange));
  box-shadow: 0 10px 30px rgba(242, 154, 63, 0.3), inset 0 -3px 0 rgba(0, 0, 0, 0.18);
}
.btn-primary:hover { color: var(--on-orange); transform: translateY(-1px); box-shadow: 0 14px 36px rgba(242, 154, 63, 0.4), inset 0 -3px 0 rgba(0, 0, 0, 0.18); }
.btn-primary:active { transform: translateY(1px); box-shadow: 0 6px 18px rgba(242, 154, 63, 0.3), inset 0 -1px 0 rgba(0, 0, 0, 0.18); }
.btn-ghost { color: var(--text); border: 1px solid var(--line); background: rgba(255, 255, 255, 0.04); }
.btn-ghost:hover { color: var(--text); background: rgba(255, 255, 255, 0.08); }
.dl-meta { color: var(--muted); font-size: 14px; margin: 14px 0 0; }

.dl-others {
  list-style: none; padding: 0; margin: 26px auto 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px;
}
.dl-others a {
  display: inline-block; padding: 7px 12px; border-radius: 10px; font-size: 14px; color: var(--text);
  text-decoration: none; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.03);
}
.dl-others a:hover { border-color: rgba(242, 154, 63, 0.5); color: var(--text); }
.dl-others a[aria-current="true"] { border-color: rgba(242, 154, 63, 0.7); }
.dl-others small { color: var(--muted); font-size: 12px; margin-left: 4px; }

/* Sections */
.section { padding: 80px 0; border-top: 1px solid var(--line); }
.section h2 { max-width: 20em; }

/* Demo */
.demo { background: linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%); }
.demo-card {
  margin-top: 32px; padding: 20px; border-radius: 22px;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
}
@media (min-width: 720px) { .demo-card { padding: 28px; } }
.demo-bar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.switch-pick { display: inline-flex; align-items: center; gap: 10px; color: var(--muted); font-size: 15px; }
.switch-pick select {
  appearance: none; -webkit-appearance: none;
  font: inherit; color: var(--text); background: var(--bg);
  border: 1px solid var(--line); border-radius: 10px; padding: 8px 34px 8px 12px; min-height: 40px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%;
  background-size: 5px 5px; background-repeat: no-repeat;
}
.sound-toggle {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px;
  font: inherit; font-size: 15px; color: var(--text); cursor: pointer;
  background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px;
}
.sound-toggle .dot { width: 9px; height: 9px; border-radius: 50%; background: #5b6170; transition: background 0.2s ease, box-shadow 0.2s ease; }
.sound-toggle[aria-pressed="true"] .dot { background: var(--orange); box-shadow: 0 0 10px var(--orange); }

.type-box {
  display: block; width: 100%; margin-top: 16px; resize: none;
  font: 18px/1.5 var(--mono); color: var(--text);
  background: rgba(0, 0, 0, 0.25); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px;
}
.type-box::placeholder { color: #7d8392; }
.type-box:focus { outline: none; border-color: rgba(242, 154, 63, 0.6); box-shadow: 0 0 0 3px rgba(242, 154, 63, 0.15); }
.demo-status { color: var(--muted); font-size: 14px; margin: 10px 0 18px; min-height: 1.6em; }

/* On screen keyboard */
.kb {
  display: flex; flex-direction: column; gap: 5px; padding: 8px; border-radius: 14px;
  background: #101216; border: 1px solid rgba(0, 0, 0, 0.6);
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.6);
  touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.kb-row { display: flex; gap: 5px; }
.key {
  flex: var(--u, 1) 1 0; min-width: 0; height: 46px; padding: 0 2px;
  display: flex; align-items: flex-start; justify-content: flex-start;
  font: 600 12px/1 var(--font); color: #c9ced8; cursor: pointer;
  border: 0; border-radius: 7px;
  background: linear-gradient(180deg, #353b47, #2a2f39);
  box-shadow: inset 0 -4px 0 #1c2028, inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 1px 2px rgba(0, 0, 0, 0.5);
  padding-top: 8px; padding-left: 8px;
  transition: transform 0.06s ease, box-shadow 0.06s ease, background 0.12s ease, color 0.12s ease;
  overflow: hidden; white-space: nowrap; text-overflow: clip;
}
.key.wide { font-size: 11px; color: #9aa1ae; }
.key.down {
  transform: translateY(2px);
  color: var(--on-orange);
  background: linear-gradient(180deg, var(--orange-soft), var(--orange));
  box-shadow: inset 0 -2px 0 #b86c22, 0 0 18px rgba(242, 154, 63, 0.45);
}
@media (max-width: 720px) {
  .kb { gap: 3px; padding: 5px; }
  .kb-row { gap: 3px; }
  .key { height: 40px; font-size: 11px; border-radius: 5px; padding: 0; align-items: center; justify-content: center; }
  .key.wide { font-size: 9px; }
}
@media (max-width: 420px) {
  .key { height: 38px; font-size: 10px; }
  .key.wide { font-size: 8px; }
}

/* Features */
.grid { display: grid; gap: 14px; margin-top: 36px; grid-template-columns: 1fr; }
@media (min-width: 620px) { .grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 960px) { .grid { grid-template-columns: 1fr 1fr 1fr; } }
.card {
  padding: 22px; border-radius: var(--radius); background: var(--bg-2); border: 1px solid var(--line);
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.card:hover { border-color: rgba(242, 154, 63, 0.35); transform: translateY(-2px); }
.card h3::before {
  content: ""; display: block; width: 26px; height: 6px; border-radius: 3px; margin-bottom: 14px;
  background: linear-gradient(90deg, var(--orange), var(--orange-soft));
}
.card p { color: var(--muted); margin: 8px 0 0; font-size: 16px; }

.switches { margin-top: 40px; padding: 24px; border-radius: var(--radius); border: 1px solid var(--line); background: rgba(255, 255, 255, 0.02); }
.switches p { color: var(--muted); margin: 10px 0 0; }
.switches strong { color: var(--text); }
.pill {
  display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 999px; margin-right: 6px;
  color: var(--orange-soft); border: 1px solid rgba(242, 154, 63, 0.45); background: rgba(242, 154, 63, 0.08);
}

/* Install */
.tabs { display: flex; gap: 6px; margin-top: 30px; padding: 5px; border-radius: 14px; background: var(--bg-2); border: 1px solid var(--line); width: fit-content; max-width: 100%; }
.tabs button {
  font: inherit; font-size: 15px; font-weight: 600; color: var(--muted); cursor: pointer;
  background: transparent; border: 0; border-radius: 10px; padding: 8px 16px; min-height: 40px;
}
.tabs button[aria-selected="true"] { color: var(--on-orange); background: linear-gradient(180deg, var(--orange-soft), var(--orange)); }
.panel { margin-top: 18px; padding: 24px; border-radius: var(--radius); background: var(--bg-2); border: 1px solid var(--line); }
.panel .req { margin: 0; color: var(--orange-soft); font-size: 15px; font-weight: 600; }
.panel ol { margin: 16px 0 0; padding-left: 22px; }
.panel li { margin: 0 0 14px; }
.panel li::marker { color: var(--orange); font-weight: 700; }
.panel .note { color: var(--muted); font-size: 15px; margin: 6px 0 0; }
.panel code { background: rgba(0, 0, 0, 0.3); padding: 2px 6px; border-radius: 6px; overflow-wrap: anywhere; }
.panel pre {
  margin: 10px 0 0; padding: 12px 14px; border-radius: 10px; overflow-x: auto;
  background: #0e1014; border: 1px solid var(--line);
}
.panel pre code { background: none; padding: 0; overflow-wrap: normal; }

/* Footer */
.footer { border-top: 1px solid var(--line); padding: 40px 0 56px; color: var(--muted); font-size: 15px; }
.footer-inner { display: grid; gap: 20px; }
@media (min-width: 760px) { .footer-inner { grid-template-columns: 1fr 1fr; } }
.footer p { margin: 10px 0 0; }

/* Reveal on scroll (only when JS adds the class and motion is allowed) */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}
