/* Browser hardware / display tests */
.btest-app {
  --bt-accent: var(--dica-action, #2f5da8);
  --bt-accent-hover: var(--dica-action-hover, #244a8a);
  --bt-soft: var(--dica-action-soft, rgba(47, 93, 168, 0.12));
  --bt-surface: var(--dica-surface, #fff);
  --bt-surface-soft: var(--dica-surface-soft, #f8fafc);
  --bt-border: var(--dica-border, #e2e8f0);
  --bt-ink: var(--dica-ink, #0f172a);
  --bt-body: var(--dica-body, #334155);
  --bt-muted: var(--dica-muted, #64748b);
  margin: 0 0 1.5rem;
  border-radius: 16px;
  border: 1px solid var(--bt-border);
  background: var(--bt-surface);
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.08);
  overflow: hidden;
}

/* —— Buttons (theme resets button padding/border; do not rely on .itool-app alone) —— */
.btest-app button.itool-btn,
.btest-app .itool-btn,
.btest-pixel-exit.itool-btn {
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--bt-border);
  background: var(--bt-surface);
  color: var(--bt-ink);
  border-radius: 10px;
  padding: 9px 14px;
  font-weight: 650;
  font-size: 0.9rem;
  line-height: 1.25;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, opacity 0.12s ease;
}
.btest-app button.itool-btn:hover:not(:disabled),
.btest-app .itool-btn:hover:not(:disabled),
.btest-pixel-exit.itool-btn:hover:not(:disabled) {
  border-color: var(--bt-accent);
  background: var(--bt-soft);
}
.btest-app button.itool-btn:disabled,
.btest-app .itool-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.btest-app button.itool-btn:focus-visible,
.btest-app .itool-btn:focus-visible,
.btest-pixel-exit.itool-btn:focus-visible {
  outline: 2px solid var(--bt-accent);
  outline-offset: 2px;
}
.btest-app button.itool-btn-primary,
.btest-app .itool-btn-primary,
.btest-pixel-exit.itool-btn-primary {
  background: var(--bt-accent);
  border-color: var(--bt-accent);
  color: #fff;
}
.btest-app button.itool-btn-primary:hover:not(:disabled),
.btest-app .itool-btn-primary:hover:not(:disabled),
.btest-pixel-exit.itool-btn-primary:hover:not(:disabled) {
  background: var(--bt-accent-hover);
  border-color: var(--bt-accent-hover);
  color: #fff;
}

.btest-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--bt-border);
  background: var(--bt-surface-soft);
  /* not sticky: sticky toolbar covered the first keyboard row under site header */
}
.btest-toolbar .itool-toolbar-spacer {
  flex: 1;
  min-width: 8px;
}
.btest-toolbar-meta {
  font-size: 0.86rem;
  font-weight: 650;
  color: var(--bt-muted);
  white-space: nowrap;
}

.btest-body {
  padding: 16px 18px 20px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(200px, 280px);
  gap: 18px;
  align-items: start;
}
@media (max-width: 860px) {
  .btest-body {
    grid-template-columns: 1fr;
  }
}
.btest-main {
  min-width: 0;
}
.btest-side .btest-card {
  border: 1px solid var(--bt-border);
  border-radius: 12px;
  padding: 12px 14px;
  background: var(--bt-surface-soft);
  margin-bottom: 12px;
}
.btest-card {
  border: 1px solid var(--bt-border);
  border-radius: 12px;
  padding: 14px 16px;
  background: var(--bt-surface-soft);
  margin-bottom: 12px;
}
.btest-card:last-child {
  margin-bottom: 0;
}
.btest-card-label {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--bt-muted);
  margin-bottom: 8px;
}
.btest-status {
  font-size: 0.92rem;
  color: var(--bt-body);
  line-height: 1.45;
}
.btest-status.is-ok {
  color: #16a34a;
  font-weight: 650;
}
.btest-status.is-error {
  color: #ef4444;
  font-weight: 650;
}
.btest-status.is-loading {
  color: #eab308;
  font-weight: 650;
}
html[data-theme="dark"] .btest-status.is-ok {
  color: #4ade80;
}
html[data-theme="dark"] .btest-status.is-error {
  color: #f87171;
}
html[data-theme="dark"] .btest-status.is-loading {
  color: #facc15;
}

.btest-video-wrap {
  position: relative;
  background: #0f172a;
  border-radius: 14px;
  overflow: hidden;
  aspect-ratio: 16 / 10;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--bt-border);
}
.btest-video-wrap video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}
.btest-video-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  font-weight: 650;
  text-align: center;
  padding: 20px;
  pointer-events: none;
}
.btest-video-placeholder[hidden] {
  display: none !important;
}

.btest-meter {
  height: 16px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--bt-muted) 22%, transparent);
  overflow: hidden;
  margin-top: 10px;
  border: 1px solid var(--bt-border);
}
.btest-meter-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #22c55e, #16a34a);
  transition: width 0.08s linear;
  border-radius: inherit;
}
.btest-meter-fill.is-hot {
  background: linear-gradient(90deg, #f59e0b, #ef4444);
}

/* —— Keyboard: row layout (not auto-fill chaos) —— */
.btest-kb {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
  user-select: none;
}
.btest-key-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.btest-key {
  min-height: 38px;
  min-width: 34px;
  padding: 4px 6px;
  border-radius: 8px;
  border: 1px solid var(--bt-border);
  background: var(--bt-surface);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--bt-body);
  flex: 0 0 auto;
  box-shadow: 0 1px 0 color-mix(in srgb, var(--bt-ink) 8%, transparent);
}
.btest-key.is-wide {
  min-width: 56px;
  padding-inline: 10px;
}
.btest-key.is-space {
  flex: 1 1 140px;
  min-width: 120px;
}
.btest-key.is-flex {
  flex: 1 1 auto;
}
.btest-key.is-hit {
  background: color-mix(in srgb, #22c55e 28%, var(--bt-surface));
  border-color: #22c55e;
  color: #166534;
}
html[data-theme="dark"] .btest-key.is-hit {
  color: #bbf7d0;
  background: color-mix(in srgb, #22c55e 35%, var(--bt-surface));
}
.btest-key.is-active {
  background: color-mix(in srgb, #f59e0b 35%, var(--bt-surface));
  border-color: #f59e0b;
  color: #92400e;
  transform: translateY(1px);
  box-shadow: none;
}
html[data-theme="dark"] .btest-key.is-active {
  color: #fde68a;
}

.btest-pixel {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: none;
  cursor: crosshair;
}
.btest-pixel.is-on {
  display: block;
}
.btest-pixel-exit {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 100000;
  display: none !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}
.btest-pixel-exit.is-on {
  display: inline-flex !important;
}

.btest-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.btest-swatch {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  border: 2px solid var(--bt-surface);
  box-shadow: 0 0 0 1px var(--bt-border);
  cursor: pointer;
  padding: 0;
  appearance: none;
}
.btest-swatch:focus-visible {
  outline: 2px solid var(--bt-accent);
  outline-offset: 2px;
}

/* —— Info rows (resolution): label | value —— */
.btest-info-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}
.btest-info-row {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 8px 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--bt-border);
  font-size: 0.88rem;
  align-items: baseline;
}
.btest-info-row:last-child {
  border-bottom: 0;
}
.btest-info-row dt,
.btest-info-label {
  color: var(--bt-muted);
  font-weight: 650;
  margin: 0;
}
.btest-info-row dd,
.btest-info-value {
  margin: 0;
  font-weight: 700;
  color: var(--bt-ink);
  word-break: break-word;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.btest-hint {
  font-size: 0.86rem;
  color: var(--bt-muted);
  line-height: 1.45;
  margin-top: 10px;
}
.btest-hint a {
  color: var(--bt-accent);
}

.btest-log {
  margin-top: 10px;
  max-height: 120px;
  overflow: auto;
  font: 600 0.8rem/1.4 ui-monospace, monospace;
  color: var(--bt-body);
  background: var(--bt-surface-soft);
  border: 1px solid var(--bt-border);
  border-radius: 10px;
  padding: 10px;
}

.btest-fields {
  display: grid;
  gap: 14px;
  margin-top: 4px;
}
.btest-field label,
.btest-field .btest-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--bt-body);
  margin-bottom: 6px;
}
.btest-field input[type="range"] {
  width: 100%;
  accent-color: var(--bt-accent);
}

@media (max-width: 520px) {
  .btest-key {
    min-width: 28px;
    min-height: 34px;
    font-size: 0.65rem;
  }
  .btest-info-row {
    grid-template-columns: 1fr;
    gap: 2px;
  }
  .btest-info-row dd,
  .btest-info-value {
    text-align: left;
  }
}
