:root {
  color-scheme: light;
  --text: #24292f;
  --muted: #57606a;
  --line: #d0d7de;
  --soft: #f6f8fa;
  --warm: #fbfaf8;
  --panel: #ffffff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--warm);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

button,
input,
a {
  font: inherit;
}

a {
  color: #0969da;
}

h1,
h2,
h3,
p,
dl {
  margin: 0;
}

.page {
  width: min(940px, calc(100vw - 44px));
  margin: 0 auto;
  padding: 44px 0 60px;
}

h1 {
  margin-bottom: 14px;
  font-size: 38px;
  font-weight: 560;
  line-height: 1.2;
}

.page > p {
  max-width: 700px;
  margin-bottom: 12px;
  color: var(--muted);
}

.upload-area {
  margin-top: 20px;
}

.file-row {
  width: 100%;
}

input[type="file"] {
  display: block;
  width: 100%;
  min-height: 38px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--text);
  background: #fff;
}

input[type="file"]::file-selector-button {
  min-height: 36px;
  margin-right: 12px;
  border: 0;
  border-right: 1px solid var(--line);
  padding: 0 13px;
  background: var(--soft);
  color: var(--text);
  cursor: pointer;
}

.checkbox-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  color: var(--text);
}

.checkbox-row input {
  width: 16px;
  height: 16px;
  margin: 0;
}

.actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

#fileName {
  min-width: min(420px, 100%);
  color: var(--muted);
  overflow-wrap: anywhere;
}

button,
.download-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 5px 12px;
  background: var(--soft);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
}

#cleanButton,
.download-button {
  border-color: #24292f;
  background: #24292f;
  color: #fff;
}

.quiet-button {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.quiet-button:hover {
  background: transparent;
  color: var(--text);
  text-decoration: underline;
}

button:hover,
.download-button:hover {
  background: #eef1f4;
}

#cleanButton:hover,
.download-button:hover {
  background: #3b424a;
}

button:disabled {
  cursor: progress;
  opacity: 0.7;
}

.status-line {
  margin-top: 14px;
  color: var(--muted);
  font-size: 14px;
}

.result-panel,
.preview-panel,
.proof-panel,
.research-panel {
  margin-top: 24px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.score-row {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  margin-bottom: 12px;
  color: var(--muted);
}

.score-row strong {
  color: var(--text);
  font-weight: 600;
}

.verdict {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  max-width: 760px;
}

.verdict p,
.remediation,
.external-note,
.verification-limit {
  color: var(--muted);
}

.verdict-light {
  flex: 0 0 auto;
  width: 9px;
  height: 9px;
  margin-top: 8px;
  border-radius: 50%;
  background: #8c959f;
}

.verdict-light.good {
  background: #1f883d;
}

.verdict-light.bad {
  background: #cf222e;
}

.remediation {
  margin-top: 10px;
}

.preview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.label {
  display: block;
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

h2 {
  font-size: 18px;
  font-weight: 600;
}

.mini-status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 8px;
  color: var(--muted);
  background: var(--soft);
  font-size: 12px;
}

.mini-status.clean {
  color: #1f883d;
}

.mini-status.risk {
  color: #cf222e;
}

.preview-panel img {
  display: block;
  width: 100%;
  max-height: 560px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
}

.facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-top: 10px;
}

.facts div,
.diff-card,
.proof-item,
.verification-summary,
.verification-item {
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 8px;
  background: var(--panel);
}

.facts dt {
  color: var(--muted);
  font-size: 12px;
}

.facts dd {
  margin: 2px 0 0;
  overflow-wrap: anywhere;
  font-size: 14px;
  font-weight: 600;
}

.cleanup-summary,
.metadata-diff,
.verification-panel,
.proof-grid {
  margin-top: 12px;
}

.pass-banner {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 10px;
  background: var(--soft);
}

.pass-banner span,
.diff-card p,
.proof-item p,
.verification-item p,
.verification-summary p {
  color: var(--muted);
  font-size: 14px;
}

.metadata-diff,
.proof-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.verification-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.verification-summary {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.verification-summary strong {
  display: block;
  font-size: 28px;
  line-height: 1.1;
}

.verification-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.verification-head span,
.proof-item span,
.table-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border-radius: 999px;
  padding: 2px 8px;
  background: var(--soft);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.verification-item.pass .verification-head span,
.proof-item.ok span,
.table-badge.clean {
  color: #1f883d;
}

.verification-item.fail .verification-head span,
.proof-item.warn span,
.table-badge.risk {
  color: #cf222e;
}

.external-note {
  margin-top: 12px;
}

.research-table-wrap {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: 5px;
}

.research-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
}

.research-table th,
.research-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

.research-table th {
  color: var(--muted);
  font-size: 12px;
}

.research-table td span,
.research-table td em,
.hash {
  display: block;
  color: var(--muted);
}

.table-link {
  display: block;
}

[hidden] {
  display: none !important;
}

@media (max-width: 820px) {
  .page {
    width: min(100vw - 28px, 940px);
    padding-top: 24px;
  }

  h1 {
    font-size: 30px;
  }

  .preview-grid,
  .metadata-diff,
  .proof-grid,
  .verification-grid {
    grid-template-columns: 1fr;
  }

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

  .actions {
    align-items: stretch;
  }

  #fileName {
    flex-basis: 100%;
  }

  .pass-banner,
  .verification-summary,
  .panel-heading {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 520px) {
  body {
    font-size: 15px;
  }

  .page {
    width: calc(100vw - 24px);
    padding: 22px 0 42px;
  }

  h1 {
    margin-bottom: 10px;
    font-size: 28px;
    line-height: 1.15;
  }

  .page > p {
    margin-bottom: 10px;
  }

  input[type="file"] {
    min-height: 42px;
    font-size: 14px;
  }

  input[type="file"]::file-selector-button {
    min-height: 40px;
    padding: 0 10px;
  }

  .actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  #fileName {
    min-width: 0;
    font-size: 14px;
  }

  button,
  .download-button {
    width: 100%;
    min-height: 42px;
    padding: 8px 12px;
  }

  .quiet-button {
    min-height: 34px;
  }

  .result-panel,
  .preview-panel,
  .proof-panel,
  .research-panel {
    margin-top: 18px;
    padding-top: 14px;
  }

  .score-row {
    display: grid;
    gap: 6px;
  }

  .verdict {
    gap: 8px;
  }

  .preview-panel img {
    max-height: 430px;
  }

  .facts,
  .metadata-diff,
  .proof-grid,
  .verification-grid {
    grid-template-columns: 1fr;
  }

  .verification-head {
    align-items: flex-start;
  }

  .verification-summary strong {
    font-size: 24px;
  }

  .research-table {
    min-width: 760px;
  }
}
