:root {
  color-scheme: light;
  --bg: #f6f7f4;
  --ink: #17211b;
  --muted: #647068;
  --line: #dce2dc;
  --pass: #19764a;
  --pass-bg: #e7f5ed;
  --warn: #946200;
  --warn-bg: #fff4d7;
  --fail: #b42318;
  --fail-bg: #ffebe8;
  --accent: #0f5f73;
  --accent-dark: #0a4050;
  --shadow: 0 24px 80px rgba(23, 33, 27, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    linear-gradient(135deg, rgba(15, 95, 115, 0.12), transparent 34%),
    linear-gradient(315deg, rgba(245, 179, 44, 0.14), transparent 30%),
    var(--bg);
  color: var(--ink);
}

button,
input {
  font: inherit;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0;
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(360px, 1.1fr);
  gap: 20px;
}

.audit-panel,
.preview-panel,
.report-panel {
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.audit-panel {
  padding: 28px;
}

.intro {
  max-width: 620px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 1;
  letter-spacing: 0;
}

h1 {
  font-size: 4rem;
}

h2 {
  font-size: 1.45rem;
}

.lede {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.55;
}

.url-form {
  margin-top: 28px;
}

.url-form label {
  display: block;
  margin-bottom: 8px;
  font-weight: 800;
}

.input-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.input-row input {
  width: 100%;
  min-width: 0;
  border: 1px solid #bfc9c2;
  border-radius: 6px;
  padding: 14px 14px;
  color: var(--ink);
  background: #fbfcfa;
  outline: none;
}

.input-row input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(15, 95, 115, 0.16);
}

.input-row button {
  min-width: 132px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 800;
}

.input-row button:disabled {
  cursor: progress;
  opacity: 0.68;
}

.button-icon {
  font-size: 1.1rem;
  line-height: 1;
}

.form-message {
  min-height: 22px;
  margin: 10px 0 0;
  color: var(--muted);
}

.form-message.error {
  color: var(--fail);
  font-weight: 700;
}

.summary-grid {
  margin-top: 24px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.summary-tile {
  min-height: 94px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.summary-tile.pass {
  background: var(--pass-bg);
  color: var(--pass);
}

.summary-tile.warn {
  background: var(--warn-bg);
  color: var(--warn);
}

.summary-tile.fail {
  background: var(--fail-bg);
  color: var(--fail);
}

.summary-value {
  font-size: 2rem;
  font-weight: 900;
  line-height: 1;
}

.summary-label {
  color: var(--ink);
  font-weight: 800;
}

.preview-panel {
  overflow: hidden;
  min-height: 440px;
  display: flex;
  flex-direction: column;
}

.browser-bar {
  min-height: 46px;
  padding: 0 14px;
  display: grid;
  grid-template-columns: 10px 10px 10px 1fr;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  background: #edf1ee;
}

.browser-bar span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #97a39c;
}

.browser-bar span:first-child {
  background: #d75f4d;
}

.browser-bar span:nth-child(2) {
  background: #e3a83b;
}

.browser-bar span:nth-child(3) {
  background: #42a66a;
}

#preview-url {
  min-width: 0;
  margin-left: 8px;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.9rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-frame {
  position: relative;
  flex: 1;
  min-height: 390px;
  background: #eef2f0;
}

.preview-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: #ffffff;
}

.preview-empty {
  position: absolute;
  inset: 0;
  padding: 28px;
  display: grid;
  place-content: center;
  gap: 8px;
  text-align: center;
  color: var(--muted);
}

.preview-empty strong {
  color: var(--ink);
  font-size: 1.2rem;
}

.preview-frame.has-preview .preview-empty {
  display: none;
}

.report-panel {
  grid-column: 1 / -1;
  padding: 24px;
}

.report-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.report-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.report-actions time {
  color: var(--muted);
  font-size: 0.9rem;
  white-space: nowrap;
}

.export-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
}

.export-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.print-meta {
  display: none;
}

.empty-report {
  border: 1px dashed #bfc9c2;
  border-radius: 8px;
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

.results-list {
  display: none;
  gap: 12px;
}

.results-list.visible {
  display: grid;
}

.result-group {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.result-group-header {
  min-height: 58px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  cursor: pointer;
  list-style: none;
}

.result-group-header::-webkit-details-marker {
  display: none;
}

.result-group-header::after {
  content: "+";
  width: 26px;
  height: 26px;
  border: 1px solid var(--line);
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 900;
  flex: 0 0 auto;
}

.result-group[open] .result-group-header::after {
  content: "-";
}

.result-group.fail .result-group-header {
  background: var(--fail-bg);
}

.result-group.warn .result-group-header {
  background: var(--warn-bg);
}

.result-group.pass .result-group-header {
  background: var(--pass-bg);
}

.result-group-title {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 900;
}

.result-group-count {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
  white-space: nowrap;
}

.result-items {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
  padding: 12px;
  list-style: none;
  border-top: 1px solid var(--line);
}

.result-item {
  min-height: 76px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 12px;
  background: #ffffff;
}

.result-group-empty {
  grid-column: 1 / -1;
  padding: 12px 2px;
  color: var(--muted);
  font-weight: 700;
}

.status-badge {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #ffffff;
  font-weight: 900;
}

.status-badge.pass {
  background: var(--pass);
}

.status-badge.warn {
  background: var(--warn);
}

.status-badge.fail {
  background: var(--fail);
}

.result-status {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.result-message {
  margin: 0;
  line-height: 1.45;
}

.result-tip {
  margin: 10px 0 0;
  padding: 10px 12px;
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  background: #f3f7f5;
  color: #34413a;
  font-size: 0.92rem;
  line-height: 1.45;
}

@media (max-width: 860px) {
  .shell {
    grid-template-columns: 1fr;
    width: min(100% - 20px, 680px);
    padding: 10px 0;
  }

  .audit-panel,
  .report-panel {
    padding: 20px;
  }

  .input-row,
  .result-items {
    grid-template-columns: 1fr;
  }

  .input-row button {
    min-height: 48px;
  }

  .preview-panel {
    min-height: 360px;
  }

  .preview-frame {
    min-height: 310px;
  }

  .report-heading {
    display: block;
  }

  .report-actions {
    align-items: stretch;
    flex-direction: column;
    margin-top: 8px;
  }

  h1 {
    font-size: 2.7rem;
  }
}

@media print {
  body {
    min-height: auto;
    background: #ffffff;
    color: #111111;
  }

  .shell {
    width: 100%;
    padding: 0;
    display: block;
  }

  .audit-panel,
  .preview-panel,
  .export-button,
  .form-message,
  .empty-report {
    display: none;
  }

  .report-panel {
    display: block;
    padding: 0;
    border: 0;
    box-shadow: none;
  }

  .report-heading {
    padding-bottom: 14px;
    border-bottom: 2px solid #111111;
  }

  .report-actions {
    display: block;
  }

  .report-actions time {
    color: #333333;
  }

  .print-meta {
    display: block;
    margin: 14px 0;
    color: #333333;
    font-size: 0.95rem;
  }

  .print-meta p {
    margin: 0 0 4px;
  }

  .results-list,
  .results-list.visible {
    display: block;
  }

  .result-group {
    break-inside: avoid;
    margin-bottom: 12px;
    border-color: #cccccc;
  }

  .result-group-header::after {
    display: none;
  }

  .result-items {
    display: block;
  }

  .result-item {
    break-inside: avoid;
    margin-bottom: 8px;
  }

  .result-tip {
    border-left-color: #777777;
    background: #f6f6f6;
    color: #222222;
  }
}
