/**
 * Global stylesheet for the browser-compat probe.
 *
 * Loaded from app.html rather than scoped inside +page.svelte: this app has
 * exactly one page, so component-scoped styles buy nothing and only make the
 * markup noisier to read.
 */

body {
  margin: 0;
  background: #f7f7f8;
  color: #16181d;
  font:
    14px/1.5 system-ui,
    -apple-system,
    "Segoe UI",
    sans-serif;
}

@media (prefers-color-scheme: dark) {
  body {
    background: #14161a;
    color: #e6e8ec;
  }
}

main {
  max-width: 52rem;
  margin: 0 auto;
  padding: 2rem 1rem 4rem;
}

h1 {
  margin: 0.75rem 0 0.25rem;
  font-size: 1.9rem;
}

h2 {
  margin: 2rem 0 0.5rem;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.6;
}

.mono {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.85em;
  word-break: break-all;
}

/* The user agent is kept for the bug report, not for reading. */
.raw {
  opacity: 0.6;
}

button {
  font: inherit;
  padding: 0.4rem 0.9rem;
  border: 1px solid currentColor;
  border-radius: 0.375rem;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

button:disabled {
  opacity: 0.45;
  cursor: default;
}

/* ------------------------------------------------------------- loading */

.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.5rem;
  margin: 3.5rem 0;
  padding: 2rem 1rem;
}

.spinner {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  border: 0.25rem solid rgba(37, 99, 168, 0.2);
  border-top-color: #2563a8;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading-title {
  margin: 0.75rem 0 0;
  font-size: 1.15rem;
  font-weight: 600;
}

.loading-count {
  margin: 0;
  opacity: 0.6;
  font-variant-numeric: tabular-nums;
}

.bar {
  width: 100%;
  max-width: 20rem;
  margin-top: 0.5rem;
  height: 0.375rem;
  border-radius: 0.25rem;
  background: rgba(127, 127, 127, 0.25);
  overflow: hidden;
}

.bar > span {
  display: block;
  height: 100%;
  background: #2563a8;
  transition: width 0.2s ease-out;
}

.hint {
  margin: 0.5rem 0 0;
  font-size: 0.85em;
  opacity: 0.7;
  max-width: 26rem;
}

@media (prefers-reduced-motion: reduce) {
  .spinner {
    animation: none;
  }

  .bar > span {
    transition: none;
  }
}

/* -------------------------------------------------------------- result */

.result {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.5rem;
  margin: 1.5rem 0;
  padding: 3rem 1.5rem;
  border-radius: 1rem;
}

.result.ok {
  background: rgba(26, 127, 69, 0.12);
  color: #0f5c32;
}

.result.bad {
  background: rgba(217, 119, 6, 0.14);
  color: #9a5b05;
}

@media (prefers-color-scheme: dark) {
  .result.ok {
    background: rgba(46, 194, 125, 0.14);
    color: #8fe6b8;
  }

  .result.bad {
    background: rgba(245, 158, 11, 0.16);
    color: #f5c26b;
  }
}

.shield-icon {
  height: 4.5rem;
  width: auto;
}

.result h1 {
  font-size: 1.9rem;
}

.result-sub {
  margin: 0;
  max-width: 30rem;
  opacity: 0.85;
}

.result-meta {
  margin: 0;
  opacity: 0.8;
  font-variant-numeric: tabular-nums;
}

.sim-banner {
  margin: 0 0 0.5rem;
  padding: 0.4rem 0.75rem;
  border-radius: 0.375rem;
  background: rgba(0, 0, 0, 0.12);
  font-size: 0.85em;
  font-weight: 600;
}

.sim-banner code {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}

.failing-list {
  list-style: none;
  margin: 1.25rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  width: 100%;
  text-align: left;
}

.failing-list li {
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  background: rgba(255, 255, 255, 0.5);
  border-left: 4px solid #b45309;
}

@media (prefers-color-scheme: dark) {
  .failing-list li {
    background: rgba(0, 0, 0, 0.2);
  }
}

.failing-title {
  font-weight: 700;
}

.failing-detail {
  margin: 0.5rem 0 0;
  padding: 0.5rem 0.625rem;
  border-radius: 0.375rem;
  background: rgba(127, 127, 127, 0.14);
  font-size: 0.85em;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-x: auto;
  color: #16181d;
}

@media (prefers-color-scheme: dark) {
  .failing-detail {
    color: #e6e8ec;
  }
}

.failing-impact {
  margin: 0.5rem 0 0;
  font-size: 0.9em;
}

.details-toggle {
  margin-top: 1.5rem;
  border-color: currentColor;
}

/* --------------------------------------------------------------- detail */

.details {
  margin-top: 1.5rem;
  padding: 1.5rem 1.75rem 1.75rem;
  border-radius: 1rem;
  background: rgba(127, 127, 127, 0.1);
}

@media (prefers-color-scheme: dark) {
  .details {
    background: rgba(255, 255, 255, 0.06);
  }
}

.details-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.details-header h2 {
  margin: 0;
}

.details dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.25rem 1rem;
  margin: 1rem 0 0;
}

.details dt {
  opacity: 0.6;
}

.details dd {
  margin: 0;
}

.checks {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.checks li {
  padding: 0.625rem 0.875rem;
  border-radius: 0.5rem;
  border-left: 4px solid transparent;
  background: rgba(127, 127, 127, 0.09);
}

.checks li.pass {
  border-color: #1a7f45;
}

.checks li.fail {
  border-color: #c2321f;
}

.checks li.skip {
  border-color: #9a7b18;
}

.row {
  display: flex;
  align-items: baseline;
  gap: 0.625rem;
}

.badge {
  flex: none;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}

li.pass .badge {
  color: #1a7f45;
}

li.fail .badge {
  color: #c2321f;
}

li.skip .badge {
  color: #9a7b18;
}

.title {
  flex: 1;
}

.duration {
  flex: none;
  opacity: 0.55;
  font-variant-numeric: tabular-nums;
}

.id {
  opacity: 0.5;
}

.detail {
  margin: 0.5rem 0 0;
  padding: 0.5rem 0.625rem;
  border-radius: 0.375rem;
  background: rgba(127, 127, 127, 0.14);
  font-size: 0.85em;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-x: auto;
}

.impact {
  margin: 0.5rem 0 0;
}

.bad {
  color: #c2321f;
}
