:root {
  --canvas: #efeeeb;
  --ink: #0a0a0a;
  --muted: #6b6862;
  --line: rgba(10, 10, 10, .14);
  --accent: #d12424;
  --raw: #3f6fd8;
  --font-display: "Funnel Display", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  --pad: clamp(16px, 3vw, 48px);
  --ease: cubic-bezier(.22, 1, .36, 1);
  --type-size: clamp(1.6rem, 3.2vw, 2.9rem);
  --line-h: 1.3;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; }
body {
  margin: 0;
  background: var(--canvas); color: var(--ink);
  font-family: var(--font-display);
  font-size: clamp(.9375rem, 1.111vw, 1rem); line-height: 1.55; letter-spacing: -.01em;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }

/* ---------- icons (../Images/icons/sprite.svg) ---------- */
:root { --sw-accent: var(--accent); }
.icon {
  width: 1.15em; height: 1.15em; flex: none; vertical-align: -0.2em;
  fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round;
  transition: transform .4s var(--ease);
}
.wave { display: inline-flex; align-items: center; gap: .5em; }
.btn:hover .icon, .footer-big:hover .icon { transform: translate(3px, 0); }
.footer-big { gap: .25em; }
.footer-big .icon { width: .7em; height: .7em; stroke-width: 2.2; }

h1, p { margin: 0; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
[hidden] { display: none !important; }
.accent { color: var(--accent); }

.eyebrow {
  display: block;
  font-family: var(--font-mono); font-size: .75rem; font-weight: 500; letter-spacing: .06em;
  color: var(--muted); text-transform: uppercase;
}

/* UI steps back while typing */
.fade { transition: opacity .4s var(--ease); }
body.typing .fade, body.typing .intro { opacity: .12; pointer-events: none; }
.intro { transition: opacity .4s var(--ease); }

/* ---------- letter wave on hover (same as the main site) ---------- */
.wave-inner { display: inline-flex; overflow: hidden; line-height: 1.25; }
.wave .ch {
  display: inline-block; white-space: pre;
  transition: transform .45s var(--ease);
  transition-delay: calc(var(--i) * 18ms);
  text-shadow: 0 1.25em 0 currentColor;
}
.wave:hover .ch, .wave:focus-visible .ch { transform: translateY(-1.25em); }

/* ---------- nav (same as the main site) ---------- */
.nav {
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 18px var(--pad);
  font-family: var(--font-mono); font-size: .8rem; font-weight: 500; letter-spacing: .04em;
}
.logo { font-family: var(--font-display); font-weight: 800; font-size: 1.1rem; letter-spacing: .12em; }
.nav-links { display: flex; gap: 28px; }
.nav-links a { text-transform: uppercase; }

main { padding: 0 var(--pad); }

/* ---------- intro ---------- */
.intro {
  display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; flex-wrap: wrap;
  padding: clamp(28px, 6vh, 72px) 0 28px;
}
.title {
  font-size: clamp(3.4rem, 11vw, 10.5rem); font-weight: 800;
  letter-spacing: -.055em; line-height: .85; margin-top: 10px;
  animation: rise 1.1s var(--ease) both;
}
@keyframes rise { from { transform: translateY(30%); opacity: 0; } }
.intro-side { display: flex; align-items: flex-end; gap: 18px; max-width: 30rem; }
.tiger { width: clamp(64px, 8vw, 110px); flex: none; transition: transform .8s var(--ease); }
.intro:hover .tiger { transform: rotate(-6deg) translateX(-6px); }
.lead { font-size: clamp(1.05rem, 1.6vw, 1.4rem); line-height: 1.25; }

/* ---------- config ---------- */
.config {
  display: flex; flex-wrap: wrap; gap: 18px clamp(24px, 4vw, 56px);
  padding: 20px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.cfg { display: flex; flex-direction: column; gap: 8px; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill {
  font-family: var(--font-mono); font-size: .75rem; font-weight: 500; text-transform: uppercase; letter-spacing: .05em;
  border: 1px solid var(--ink); border-radius: 999px; padding: 6px 14px;
  transition: background .3s, color .3s, border-color .3s;
}
.pill:hover { background: var(--ink); color: var(--canvas); }
.pill.active, .pill[aria-pressed="true"] { background: var(--ink); color: var(--canvas); }
.pill[data-toggle][aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.pill .nocase { text-transform: none; }
.pill:focus-visible, .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ---------- test ---------- */
.test { padding: clamp(28px, 5vh, 56px) 0 clamp(40px, 8vh, 96px); }
.test-head { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 18px; }
.live {
  font-size: clamp(3rem, 7vw, 6rem); font-weight: 800; letter-spacing: -.05em; line-height: .85;
  color: var(--accent); min-height: .85em;
  transition: color .3s;
}
.live.idle { color: rgba(10, 10, 10, .15); }

.words-wrap {
  position: relative;
  height: calc(var(--type-size) * var(--line-h) * 3 + 12px);
  overflow: hidden;
  font-family: var(--font-display); font-size: var(--type-size); font-weight: 500;
  line-height: var(--line-h); letter-spacing: -.02em;
  cursor: text;
}
.words { display: flex; flex-wrap: wrap; align-content: flex-start; }
.word { margin: 0 .3em 0 0; border-bottom: 3px solid transparent; }
.word.error { border-bottom-color: var(--accent); }
.letter { color: rgba(10, 10, 10, .18); transition: color .1s; }
.letter.correct { color: var(--ink); }
.letter.incorrect { color: var(--accent); }
.letter.extra { color: var(--accent); opacity: .55; }

.caret {
  position: absolute; left: 0; top: 0;
  width: 3px; height: calc(var(--type-size) * 1.05);
  border-radius: 2px; background: var(--accent);
  transition: left .09s linear, top .09s linear;
  animation: blink 1s step-end infinite;
}
body.typing .caret { animation: none; }
@keyframes blink { 50% { opacity: 0; } }

.hidden-input { position: absolute; opacity: 0; left: 0; top: 0; width: 1px; height: 1px; pointer-events: none; }
.blur {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: .8rem; font-weight: 500; letter-spacing: .06em; text-transform: uppercase;
  background: rgba(239, 238, 235, .7);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  opacity: 0; pointer-events: none; transition: opacity .25s;
}
.words-wrap.unfocused .blur { opacity: 1; pointer-events: auto; }
.words-wrap.unfocused .caret { visibility: hidden; }

.test-foot { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; margin-top: 28px; }
.hint { font-family: var(--font-mono); font-size: .75rem; color: var(--muted); }
kbd {
  font-family: var(--font-mono); font-size: .72rem; font-weight: 500;
  padding: 2px 8px; border-radius: 999px; border: 1px solid var(--ink); color: var(--ink);
}

/* ---------- code: looks like an IDE ---------- */
.ide-bar, .ide-status { display: none; }
.test.code .editor {
  --c-bg: #141414; --c-text: #ece9e2; --c-muted: #5d5a55;
  --c-kw: #ff6b6b; --c-str: #f2c46d; --c-num: #8fc7ff; --c-fn: #7fd6a4;
  --c-type: #c9a7ff; --c-com: #7d7a74; --c-tag: #ff8f70; --c-attr: #f2c46d; --c-sel: #7fd6a4; --c-prop: #8fc7ff; --c-p: #a9a59d;
  background: var(--c-bg); border-radius: 16px; overflow: hidden;
  box-shadow: 0 30px 60px -30px rgba(0, 0, 0, .45);
}
.test.code .ide-bar {
  display: flex; align-items: flex-end; gap: 18px;
  padding: 10px 14px 0; background: #0b0b0b;
  font-family: var(--font-mono); font-size: .78rem; color: #bfbab2;
}
.ide-dots { display: flex; gap: 6px; padding-bottom: 12px; }
.ide-dots i { width: 11px; height: 11px; border-radius: 50%; background: #2c2a28; }
.ide-dots i:first-child { background: var(--accent); }
.ide-tab {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px 10px; border-radius: 10px 10px 0 0;
  background: var(--c-bg); color: var(--c-text); box-shadow: inset 0 2px 0 var(--accent);
}
.ide-tab-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--c-str); }
.test.code .ide-status {
  display: flex; gap: 22px; padding: 6px 14px;
  background: var(--accent); color: #fff;
  font-family: var(--font-mono); font-size: .72rem; font-weight: 500; letter-spacing: .03em;
}
.ide-right { margin-left: auto; }

.test.code .words-wrap {
  font-family: "JetBrains Mono", ui-monospace, Menlo, monospace;
  font-size: clamp(.9rem, 1.3vw, 1.1rem); font-weight: 400; letter-spacing: 0; line-height: 1.75;
  font-variant-ligatures: none; font-feature-settings: "liga" 0, "calt" 0;
  height: calc(1.75em * 11 + 24px);
}
.test.code .words { display: block; padding: 12px 0; }
.ln { display: flex; }
.ln.active { background: rgba(255, 255, 255, .045); }
.ln .num {
  flex: none; width: 4em; padding-right: 1.4em; text-align: right;
  color: var(--c-muted); user-select: none;
}
.ln.active .num { color: var(--c-text); }
.ln .code { flex: 1; min-width: 0; }
.test.code .word { display: inline-block; max-width: 100%; overflow-wrap: anywhere; margin: 0 1ch 0 0; border-bottom-width: 2px; }
.test.code .letter { color: var(--c-text); opacity: .3; }
.test.code .letter.correct { opacity: 1; }
.test.code .letter.s-kw { color: var(--c-kw); }
.test.code .letter.s-str { color: var(--c-str); }
.test.code .letter.s-num { color: var(--c-num); }
.test.code .letter.s-fn { color: var(--c-fn); }
.test.code .letter.s-type { color: var(--c-type); }
.test.code .letter.s-com { color: var(--c-com); font-style: italic; }
.test.code .letter.s-tag { color: var(--c-tag); }
.test.code .letter.s-attr { color: var(--c-attr); }
.test.code .letter.s-sel { color: var(--c-sel); }
.test.code .letter.s-prop { color: var(--c-prop); }
.test.code .letter.s-p { color: var(--c-p); }
.test.code .letter.incorrect, .test.code .letter.extra { color: #fff; background: var(--accent); opacity: 1; border-radius: 2px; }
.test.code .caret { width: 2px; height: 1.35em; }
.test.code .blur { background: rgba(20, 20, 20, .75); color: var(--c-text); }

/* ---------- SQL: looks like a database client ---------- */
.sql-toolbar, .sql-side, .sql-results { display: none; }
.test.sql .sql-toolbar {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px; background: #1b1b1b; border-bottom: 1px solid #262626;
  font-family: var(--font-mono); font-size: .72rem; color: #bfbab2;
}
.sql-run { background: var(--c-fn); color: #0a0a0a; font-weight: 700; padding: 4px 12px; border-radius: 6px; }
.sql-run.flash { animation: run .6s ease-out; }
@keyframes run { 0% { box-shadow: 0 0 0 0 rgba(127, 214, 164, .7); } 100% { box-shadow: 0 0 0 10px rgba(127, 214, 164, 0); } }
.sql-chip { border: 1px solid #333; border-radius: 6px; padding: 3px 10px; }
.sql-auto { margin-left: auto; color: var(--c-muted); }

.test.sql .editor-body { display: grid; grid-template-columns: 190px minmax(0, 1fr); }
.test.sql .sql-side {
  display: block; padding: 14px 12px; background: #101010; border-right: 1px solid #262626;
  font-family: var(--font-mono); font-size: .75rem; color: #bfbab2;
}
.sql-side-title { display: block; font-size: .65rem; letter-spacing: .08em; color: var(--c-muted); margin-bottom: 10px; }
.sql-tree div { padding: 3px 0; white-space: nowrap; }
.sql-folder { padding-left: 14px !important; }
.sql-table { padding-left: 30px !important; border-radius: 4px; transition: background .2s, color .2s; }
.sql-table.active { background: rgba(209, 36, 36, .25); color: #fff; }
.test.sql .words-wrap { height: calc(1.75em * 8 + 24px); }

.test.sql .sql-results { display: flex; flex-direction: column; border-top: 1px solid #262626; background: #0f0f0f; }
.sql-results-tabs { display: flex; gap: 2px; padding: 0 10px; background: #0b0b0b; font-family: var(--font-mono); font-size: .72rem; color: var(--c-muted); }
.sql-results-tabs span { padding: 7px 12px; }
.sql-results-tabs .on { color: var(--c-text); box-shadow: inset 0 -2px 0 var(--accent); }
.sql-results-body { height: 128px; overflow: auto; font-family: "JetBrains Mono", ui-monospace, monospace; font-size: .8rem; color: var(--c-text); }
.sql-results-body table { border-collapse: collapse; min-width: 60%; }
.sql-results-body th, .sql-results-body td { padding: 5px 14px; border-bottom: 1px solid #222; border-right: 1px solid #222; text-align: left; }
.sql-results-body th { position: sticky; top: 0; background: #181818; color: #bfbab2; font-weight: 500; }
.sql-results-body td.rn, .sql-results-body th.rn { color: var(--c-muted); text-align: right; width: 2.5em; }
.sql-results-body td.n { color: var(--c-num); text-align: right; }
.sql-results-body .msg { padding: 14px; color: var(--c-fn); }
.sql-results-body .empty { padding: 14px; color: var(--c-muted); font-style: italic; }
.sql-results-foot { padding: 5px 14px; border-top: 1px solid #222; font-family: var(--font-mono); font-size: .7rem; color: var(--c-muted); min-height: 1.6em; }
.sql-results-body.fresh { animation: fresh .5s var(--ease); }
@keyframes fresh { from { opacity: 0; transform: translateY(4px); } }

/* ---------- buttons (same as the main site) ---------- */
.btn {
  font-family: var(--font-mono); font-size: .8rem; font-weight: 500; text-transform: uppercase; letter-spacing: .04em;
  padding: 12px 22px; border-radius: 999px;
  background: var(--ink); color: var(--canvas); border: 1px solid var(--ink);
  transition: background .3s, color .3s;
}
.btn:hover { background: transparent; color: var(--ink); }
.btn-ghost { background: transparent; color: var(--ink); }
.btn-ghost:hover { background: var(--ink); color: var(--canvas); }

/* ---------- result ---------- */
.result { padding: clamp(28px, 5vh, 56px) 0 clamp(40px, 8vh, 96px); display: flex; flex-direction: column; gap: 32px; }
.result > * { animation: rise .8s var(--ease) both; }
.result > :nth-child(2) { animation-delay: .06s; }
.result > :nth-child(3) { animation-delay: .12s; }
.result-hero { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 16px clamp(32px, 6vw, 96px); }
.r-big { display: flex; flex-direction: column; }
.value { font-size: clamp(4.5rem, 14vw, 12rem); font-weight: 800; letter-spacing: -.06em; line-height: .82; }
.unit { font-family: var(--font-mono); font-size: .75rem; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-top: 10px; }
.pb {
  align-self: center;
  font-family: var(--font-mono); font-size: .75rem; font-weight: 500; letter-spacing: .05em; text-transform: uppercase;
  border: 1px solid var(--ink); border-radius: 999px; padding: 6px 14px;
}
.pb.new { background: var(--accent); border-color: var(--accent); color: #fff; }

.chart { margin: 0; padding-top: 24px; border-top: 1px solid var(--line); }
.legend { display: flex; gap: 20px; font-family: var(--font-mono); font-size: .7rem; font-weight: 500; letter-spacing: .06em; color: var(--muted); margin-bottom: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.key { display: inline-block; width: 16px; height: 2px; border-radius: 1px; }
.key-wpm { background: var(--accent); }
.key-raw { background: var(--raw); }
.key-err { width: auto; height: auto; font-style: normal; font-weight: 700; color: var(--ink); background: none; }
.chart-box { position: relative; }
#chart { display: block; width: 100%; height: auto; overflow: visible; }
.grid { stroke: var(--line); stroke-width: 1; }
.axis-text { font-family: var(--font-mono); font-size: 11px; fill: var(--muted); }
.axis-title { font-family: var(--font-mono); font-size: 10px; fill: var(--muted); letter-spacing: .06em; }
.series { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.series-wpm { stroke: var(--accent); }
.series-raw { stroke: var(--raw); }
.dot { stroke: var(--canvas); stroke-width: 2; }
.err { stroke: var(--ink); stroke-width: 2; stroke-linecap: round; }
.crosshair { stroke: var(--ink); stroke-width: 1; stroke-dasharray: 3 3; opacity: .5; }
.tooltip {
  position: absolute; top: 0; pointer-events: none;
  min-width: 128px; padding: 10px 12px; border-radius: 12px;
  background: var(--ink); color: var(--canvas);
  font-family: var(--font-mono); font-size: .8rem; line-height: 1.5;
}
.tooltip .t-head { color: #bfbab2; margin-bottom: 2px; }
.tooltip .t-row { display: flex; align-items: center; gap: 8px; }
.tooltip .t-row b { min-width: 2.2em; text-align: right; }
.tooltip .t-row span { color: #bfbab2; }

.stats {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px 24px;
  margin: 0; padding: 24px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.stats dt { font-family: var(--font-mono); font-size: .7rem; letter-spacing: .08em; color: var(--muted); }
.stats dd { margin: 4px 0 0; font-size: clamp(1.2rem, 2vw, 1.7rem); font-weight: 700; letter-spacing: -.03em; }

.table-view summary { cursor: pointer; font-family: var(--font-mono); font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.table-view summary:hover { color: var(--ink); }
.table-view table { margin-top: 12px; border-collapse: collapse; font-family: var(--font-mono); font-size: .85rem; }
.table-view th, .table-view td { padding: 4px 16px 4px 0; text-align: right; }
.table-view th { color: var(--muted); font-weight: 500; }

.result-actions { display: flex; align-items: center; gap: 12px 16px; flex-wrap: wrap; }

/* ---------- footer (same as the main site) ---------- */
.footer { background: var(--ink); color: var(--canvas); padding: clamp(60px, 8vw, 120px) var(--pad) 28px; }
.footer-line { font-size: clamp(1.4rem, 3vw, 2.6rem); letter-spacing: -.03em; color: #bfbab2; }
.footer-big {
  display: inline-flex; max-width: 100%; margin: 32px 0 80px;
  font-size: clamp(1.6rem, 6.4vw, 7rem); font-weight: 800; letter-spacing: -.05em; line-height: 1.05;
}
.footer-big:hover { color: var(--accent); }
.footer-bottom {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px;
  font-family: var(--font-mono); font-size: .75rem; color: #918e89;
  border-top: 1px solid rgba(239, 238, 235, .15); padding-top: 20px;
}
.footer-bottom a:hover { color: var(--canvas); }

/* ---------- responsive ---------- */
@media (max-width: 800px) {
  .nav-mail { display: none; }
  .nav-links { gap: 18px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ln .num { width: 2.6em; padding-right: .8em; }
  .ide-right { display: none; }
  .test.sql .editor-body { grid-template-columns: minmax(0, 1fr); }
  .test.sql .sql-side, .sql-chip:nth-of-type(3), .sql-auto { display: none; }
  .config { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 16px; }
  .intro-side { max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
