/* ---------- Header and navigation ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: #fff;
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: var(--header-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
  flex: none;
}

.brand:hover {
  color: var(--ink);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--primary);
  color: #fff;
}

.brand-mark .icon {
  width: 20px;
  height: 20px;
}

.brand-name {
  font-size: 1.0625rem;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.site-nav {
  margin-left: auto;
}

.nav-list {
  display: flex;
  align-items: center;
  gap: 2px;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: none;
}

.nav-link:hover {
  color: var(--ink);
  background: var(--surface);
}

.nav-link[aria-current="page"] {
  color: var(--primary);
  background: var(--primary-soft);
}

.header-search {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  flex: none;
}

.header-search:hover {
  color: var(--primary);
  background: var(--surface);
}

.nav-toggle {
  display: none;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.9375rem;
  cursor: pointer;
}

@media (max-width: 960px) {
  .header-inner {
    position: relative;
  }

  .nav-toggle {
    display: inline-flex;
    margin-left: auto;
  }

  .site-nav {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    margin-left: 0;
    padding: 12px 0 20px;
    background: #fff;
    border-bottom: 1px solid var(--border);
  }

  .site-nav.is-open {
    display: block;
  }

  .nav-list {
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding-inline: 24px;
  }

  .nav-link {
    min-height: 48px;
    padding: 0 14px;
    font-size: 1rem;
  }

  .header-search {
    margin-left: 0;
  }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.9375rem;
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--speed), border-color var(--speed), color var(--speed);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
  color: #fff;
}

.btn-secondary {
  background: #fff;
  border-color: var(--border);
  color: var(--ink);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--surface);
  border-color: var(--border-strong);
}

.btn.is-active {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary-dark);
}

/* ---------- Breadcrumb ---------- */
.breadcrumb {
  padding-top: var(--space-5);
  font-size: var(--text-sm);
  color: var(--faint);
}

.breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.breadcrumb li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.breadcrumb li + li::before {
  content: "/";
  color: var(--border-strong);
}

.breadcrumb a {
  color: var(--muted);
  text-decoration: none;
}

.breadcrumb a:hover {
  color: var(--primary);
  text-decoration: underline;
}

.breadcrumb [aria-current="page"] {
  color: var(--ink);
  font-weight: 600;
}

/* ---------- Cards ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--space-4);
}

.tool-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  transition: border-color var(--speed);
}

.tool-card:hover {
  border-color: var(--border-strong);
}

.tool-card-link {
  display: flex;
  flex-direction: column;
  gap: 6px;
  height: 100%;
  padding: var(--space-5);
  color: inherit;
  text-decoration: none;
}

.tool-card-name {
  font-weight: 600;
  color: var(--ink);
}

.tool-card-link:hover .tool-card-name {
  color: var(--primary);
}

.tool-card-desc {
  font-size: var(--text-sm);
  line-height: 1.55;
  color: var(--muted);
}

.tool-card-tag {
  margin-top: auto;
  padding-top: var(--space-2);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--primary);
}

/* ---------- Facts, tables ---------- */
.fact-block {
  margin: 0 0 var(--space-6);
}

.fact-block figcaption {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 16px;
  margin-bottom: var(--space-3);
}

.fact-caption {
  font-weight: 600;
}

.fact-meta {
  font-size: var(--text-sm);
  color: var(--faint);
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
}

table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

th,
td {
  padding: 12px 16px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
}

thead th {
  background: var(--surface);
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.fact-block tbody td a {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.method-block p {
  max-width: 78ch;
  margin-bottom: var(--space-3);
  color: var(--muted);
}

.method-block .limits {
  padding-left: 1.25em;
  list-style: disc;
  color: var(--muted);
}

.method-block .limits li {
  margin-bottom: var(--space-2);
}

/* ---------- Steps ---------- */
.steps {
  counter-reset: step;
  display: grid;
  gap: var(--space-4);
  max-width: 78ch;
}

.steps li {
  counter-increment: step;
  position: relative;
  padding: var(--space-5) var(--space-5) var(--space-5) 64px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: 20px;
  top: 20px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: var(--text-sm);
  font-weight: 700;
}

.steps h3 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.steps p {
  margin: 0;
  color: var(--muted);
}

/* ---------- FAQ ---------- */
.faq-list {
  display: grid;
  gap: var(--space-3);
  max-width: 78ch;
}

.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
}

.faq-item summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  min-height: 48px;
  padding: 16px 20px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: "+";
  color: var(--faint);
  font-size: 1.25rem;
  line-height: 1;
}

.faq-item[open] summary::after {
  content: "−";
}

.faq-item p {
  margin: 0;
  padding: 0 20px 20px;
  color: var(--muted);
}

/* ---------- Tips ---------- */
.tips {
  display: grid;
  gap: var(--space-3);
  max-width: 78ch;
  padding-left: 1.1em;
  list-style: disc;
  color: var(--muted);
}

.tips li {
  padding-left: 4px;
}

/* ---------- Forms ---------- */
.search-form {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-6);
  max-width: 560px;
}

.search-form input[type="search"] {
  flex: 1 1 220px;
  min-height: 48px;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}

.search-form input[type="search"]:focus {
  border-color: var(--primary);
}

.field {
  display: grid;
  gap: 6px;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--ink);
}

input[type="text"],
input[type="search"],
input[type="password"],
input[type="url"],
textarea,
select {
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  font-weight: 400;
}

textarea {
  min-height: 160px;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.55;
  resize: vertical;
}

select {
  cursor: pointer;
}

input[type="range"] {
  width: 100%;
  min-height: 48px;
  accent-color: var(--primary);
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--primary);
}

.checkbox-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}

.checkbox-row label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 48px;
  padding: 0 8px;
  cursor: pointer;
}

.checkbox-row input {
  width: 18px;
  height: 18px;
}

/* ---------- Tool panel ---------- */
.tool-panel {
  margin-top: var(--space-6);
  padding: clamp(16px, 3vw, 28px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: #fff;
}

.panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.panel-title {
  margin: 0;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
}

.panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.tool-status {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: var(--space-5) 0 0;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.9375rem;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #94a3b8;
  flex: none;
}

.tool-status.is-running {
  border-color: #bfdbfe;
  background: var(--primary-soft);
  color: #1e40af;
}

.tool-status.is-running .status-dot {
  background: var(--primary);
  animation: status-pulse 1.2s ease-in-out infinite;
}

.tool-status.is-pass {
  border-color: #a7f3d0;
  background: #ecfdf5;
  color: #065f46;
}

.tool-status.is-pass .status-dot {
  background: var(--pass);
}

.tool-status.is-warn {
  border-color: #fde68a;
  background: #fffbeb;
  color: #92400e;
}

.tool-status.is-warn .status-dot {
  background: var(--warn);
}

.tool-status.is-fail {
  border-color: #fecaca;
  background: #fef2f2;
  color: #991b1b;
}

.tool-status.is-fail .status-dot {
  background: var(--fail);
}

@keyframes status-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}

.privacy-line {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: var(--space-4);
  font-size: var(--text-sm);
  color: var(--faint);
}

.privacy-line .icon {
  width: 18px;
  height: 18px;
  margin-top: 1px;
}

/* ---------- Tool specifics: shared bits ---------- */
.stage-hint {
  color: var(--faint);
  font-size: var(--text-sm);
}

.readout-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-3);
  margin: var(--space-5) 0 0;
}

.readout-grid div {
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

.readout-grid dt {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--faint);
}

.readout-grid dd {
  margin: 4px 0 0;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.stat-line {
  font-size: var(--text-sm);
  color: var(--muted);
}

.stat-line strong {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

/* keyboard */
.keyboard-readout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: var(--space-5);
  align-items: start;
}

.key-card {
  padding: var(--space-6);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.key-label {
  display: block;
  min-height: 1.2em;
  font-family: var(--font-mono);
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.key-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: var(--space-3);
  margin: var(--space-5) 0 0;
}

.key-meta dt {
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--faint);
}

.key-meta dd {
  margin: 2px 0 0;
  font-family: var(--font-mono);
  font-size: 0.9375rem;
  overflow-wrap: anywhere;
}

.keyboard-map {
  overflow-x: auto;
  margin-top: var(--space-5);
  padding-bottom: 6px;
}

.key-row {
  display: flex;
  gap: 6px;
  min-width: 660px;
  margin-bottom: 6px;
}

.key {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1 1 0;
  min-width: 36px;
  height: 42px;
  padding: 0 4px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  white-space: nowrap;
  overflow: hidden;
}

.key.is-active {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

/* mouse */
.mouse-stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 260px;
  padding: var(--space-5);
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  text-align: center;
  touch-action: none;
  overflow: hidden;
}

.mouse-dot {
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--primary);
  transform: translate(-50%, -50%);
  pointer-events: none;
  opacity: 0;
}

.mouse-readout {
  display: grid;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

.lamp-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-5);
  margin: 0 0 var(--space-2);
  font-size: var(--text-sm);
  font-weight: 600;
}

.lamp {
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-left: 8px;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: #fff;
  vertical-align: -2px;
}

.lamp.is-hit {
  border-color: var(--pass);
  background: var(--pass);
}

/* screen test */
.screen-controls {
  display: grid;
  gap: var(--space-4);
}

.swatch-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.swatch {
  width: 48px;
  height: 48px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--sw);
  cursor: pointer;
}

.screen-stage {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  background: #000;
  cursor: pointer;
}

.screen-hint {
  padding: 12px 20px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: var(--text-sm);
  opacity: 0.9;
}

/* camera and microphone */
.camera-stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 220px;
  margin-top: var(--space-4);
  border-radius: var(--radius);
  background: #0b1220;
  overflow: hidden;
}

.camera-stage video {
  display: block;
  width: 100%;
  max-height: 420px;
  object-fit: contain;
  background: #000;
}

.camera-stage .stage-hint {
  position: absolute;
  color: #cbd5e1;
  padding: 0 20px;
}

.wave-canvas {
  display: block;
  width: 100%;
  height: auto;
  margin-top: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #0b1220;
}

.meter {
  height: 16px;
  margin-top: var(--space-4);
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}

.meter-fill {
  width: 0;
  height: 100%;
  border-radius: 999px;
  background: var(--pass);
  transition: width 80ms linear;
}

.meter-fill.is-warn {
  background: var(--warn);
}

.meter-fill.is-fail {
  background: var(--fail);
}

.control-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--space-4);
}

.control-row .field {
  min-width: 200px;
}

/* device info */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--muted);
}

.badge-high {
  background: #ecfdf5;
  color: #065f46;
}

.badge-medium {
  background: #fffbeb;
  color: #92400e;
}

.badge-low {
  background: #fef2f2;
  color: #991b1b;
}

/* editors */
.editor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-4);
}

/* regex */
.regex-input-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: var(--font-mono);
}

.regex-input-row input[type="text"] {
  flex: 1 1 220px;
  min-height: 40px;
  padding: 4px 8px;
  border: 0;
}

.regex-input-row input[type="text"]:focus {
  outline: 2px solid var(--primary);
  outline-offset: 0;
}

.match-preview {
  min-height: 120px;
  margin-top: var(--space-4);
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.regex-hit {
  padding: 1px 2px;
  border-radius: 3px;
  background: #fde68a;
  color: #78350f;
}

.match-preview mark {
  padding: 1px 2px;
  border-radius: 3px;
  background: #fde68a;
  color: #78350f;
}

/* cron */
.cron-summary {
  margin: var(--space-4) 0;
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  font-weight: 600;
}

.cron-runs {
  display: grid;
  gap: 8px;
  padding-left: 1.2em;
  list-style: decimal;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.cron-runs li {
  padding-left: 4px;
}

/* cps and reaction */
.play-stage {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 280px;
  padding: var(--space-6);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  text-align: center;
  cursor: pointer;
  user-select: none;
  touch-action: manipulation;
}

.play-count {
  font-size: clamp(3rem, 10vw, 5rem);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.play-hint {
  margin-top: var(--space-3);
  color: var(--muted);
}

.play-stage.is-active {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.reaction-stage {
  min-height: 280px;
  border: 0;
  color: #fff;
  font-size: var(--text-xl);
  font-weight: 600;
}

.reaction-stage[data-state="idle"] {
  background: var(--surface);
  color: var(--muted);
  border: 1px solid var(--border);
}

.reaction-stage[data-state="waiting"] {
  background: #b91c1c;
}

.reaction-stage[data-state="go"] {
  background: #059669;
}

.reaction-stage[data-state="early"] {
  background: #92400e;
}

.reaction-stage[data-state="done"] {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border);
}

/* refresh rate */
.rrt-stage {
  position: relative;
  height: 140px;
  margin-top: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.rrt-box {
  position: absolute;
  top: 50%;
  left: 0;
  width: 64px;
  height: 64px;
  margin-top: -32px;
  border-radius: 14px;
  background: var(--primary);
  will-change: transform;
}

/* password strength */
.strength-meter {
  height: 12px;
  margin-top: var(--space-4);
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}

.strength-fill {
  width: 0;
  height: 100%;
  border-radius: 999px;
  background: var(--border-strong);
  transition: width var(--speed) linear, background-color var(--speed);
}

.strength-fill.is-pass {
  background: var(--pass);
}

.strength-fill.is-warn {
  background: var(--warn);
}

.strength-fill.is-fail {
  background: var(--fail);
}

.score-line {
  margin-top: var(--space-3);
  font-weight: 600;
}

.issue-list {
  display: grid;
  gap: 6px;
  margin: var(--space-4) 0 0;
  padding-left: 1.1em;
  list-style: disc;
  color: var(--muted);
  font-size: var(--text-sm);
}

/* ---------- Footer ---------- */
.site-footer {
  margin-top: var(--space-8);
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.footer-grid {
  display: grid;
  grid-template-columns: minmax(220px, 2fr) repeat(4, minmax(140px, 1fr));
  gap: var(--space-6);
  padding-block: var(--space-8) var(--space-6);
}

.footer-brand .brand {
  margin-bottom: var(--space-4);
}

.footer-blurb {
  max-width: 34ch;
  color: var(--muted);
  font-size: var(--text-sm);
}

.footer-note {
  margin-top: var(--space-3);
  color: var(--faint);
  font-size: 0.8125rem;
}

.footer-heading {
  margin-bottom: var(--space-3);
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
}

.footer-col ul {
  display: grid;
  gap: 2px;
}

.footer-col a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  color: var(--muted);
  font-size: var(--text-sm);
  text-decoration: none;
}

.footer-col a:hover {
  color: var(--primary);
}

.footer-bottom {
  padding-block: var(--space-5);
  border-top: 1px solid var(--border);
  color: var(--faint);
  font-size: var(--text-sm);
}

@media (max-width: 960px) {
  .footer-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-5);
  }

  .footer-brand {
    grid-column: 1 / -1;
  }
}
/* ---------- S7 tool specifics ---------- */
/* touchscreen */
.touch-stage {
  position: relative;
  min-height: 300px;
  margin-top: var(--space-4);
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  touch-action: none;
  cursor: crosshair;
}

.touch-stage .stage-hint {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  text-align: center;
  pointer-events: none;
}

.touch-layer {
  position: absolute;
  inset: 0;
}

.touch-dot {
  position: absolute;
  border: 2px solid var(--primary);
  border-radius: 50%;
  background: rgba(37, 99, 235, 0.28);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.touch-dot[data-type="touch"] {
  border-color: var(--accent);
  background: rgba(16, 185, 129, 0.28);
}

.touch-dot[data-type="pen"] {
  border-color: var(--warn);
  background: rgba(217, 119, 6, 0.28);
}

/* gamepad */
.pad-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 8px;
  margin-top: var(--space-4);
}

.pad-btn {
  display: grid;
  place-items: center;
  min-height: 44px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
}

.pad-btn.is-active {
  border-color: var(--pass);
  background: var(--pass);
  color: #fff;
}

.pad-triggers {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  margin-top: var(--space-4);
}

.pad-trigger-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--faint);
}

.pad-triggers .meter {
  margin-top: 0;
}

/* api */
.api-url {
  flex: 1 1 360px;
}

.api-url input {
  width: 100%;
}

.api-output {
  max-height: 260px;
  margin: var(--space-4) 0 0;
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  overflow: auto;
}

/* typing */
.typing-text {
  margin: 0;
  padding: var(--space-5);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: 1.125rem;
  line-height: 1.9;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  user-select: none;
}

.type-char {
  border-radius: 3px;
}

.type-char.is-current {
  background: var(--primary-soft);
  box-shadow: inset 0 -2px 0 var(--primary);
}

.type-char.is-hit {
  color: var(--pass);
}

.type-char.is-miss {
  background: #fef2f2;
  color: var(--fail);
  text-decoration: underline wavy var(--fail);
}

/* polling */
.poll-stage.is-sampling {
  border-color: var(--primary);
  background: var(--primary-soft);
  cursor: crosshair;
}

/* input lag */
.lag-stage {
  display: grid;
  place-items: center;
  min-height: 240px;
  margin-top: var(--space-4);
  padding: var(--space-5);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  text-align: center;
  cursor: pointer;
  user-select: none;
  transition: background 120ms ease, border-color 120ms ease;
}

.lag-stage .lag-hint {
  margin: 0;
  font-weight: 600;
  color: var(--muted);
}

.lag-stage.is-live {
  border-color: var(--pass);
  background: #ecfdf5;
}

.lag-stage.is-live .lag-hint {
  color: #065f46;
}

.lag-stage.is-hit {
  border-color: var(--primary);
  background: var(--primary-soft);
}

/* media info */
.media-preview {
  display: grid;
  gap: var(--space-3);
  justify-items: center;
  margin-top: var(--space-4);
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.media-preview img,
.media-preview video {
  max-width: 100%;
  max-height: 360px;
  border-radius: 8px;
}

.media-preview audio {
  width: min(100%, 480px);
}

/* memory */
.memory-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  max-width: 360px;
}

.memory-cell {
  aspect-ratio: 1;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease;
}

.memory-cell.is-active {
  border-color: var(--primary);
  background: var(--primary);
}

.memory-cell.is-hit {
  border-color: var(--pass);
  background: var(--pass);
}

.memory-cell.is-miss {
  border-color: var(--fail);
  background: #fef2f2;
}

/* colour plates */
.plate-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-4);
  margin-top: var(--space-4);
}

.plate {
  display: grid;
  gap: 8px;
  justify-items: center;
  margin: 0;
}

.plate canvas {
  width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: #f8fafc;
}

.plate-caption {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--text-sm);
  color: var(--muted);
}

.plate-caption input {
  width: 52px;
  padding: 6px 8px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  font: inherit;
  text-align: center;
}

@media (max-width: 720px) {
  .pad-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

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

@media (max-width: 520px) {
  .touch-stage,
  .lag-stage {
    min-height: 220px;
  }

  .pad-triggers {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .memory-grid {
    max-width: none;
  }
}
