:root {
  color-scheme: light;
  --ink: #172026;
  --muted: #5b6872;
  --line: #cdd8dd;
  --paper: #ffffff;
  --page: #f4f7f6;
  --soft: #eef6f2;
  --teal: #176b6f;
  --teal-dark: #0f4e52;
  --blue: #255d91;
  --green: #23784d;
  --amber: #9a6419;
  --red: #b33a32;
  --shadow: 0 16px 40px rgba(23, 32, 38, 0.08);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  background: var(--page);
  font-size: 18px;
  line-height: 1.55;
}

body.large-text {
  font-size: 20px;
}

a {
  color: var(--teal-dark);
  font-weight: 700;
  text-underline-offset: 0.18em;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.wrap {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
}

.skip-link {
  position: absolute;
  top: -80px;
  left: 16px;
  background: var(--ink);
  color: #fff;
  padding: 10px 14px;
  z-index: 10;
}

.skip-link:focus {
  top: 16px;
}

.site-header {
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 3;
  backdrop-filter: blur(8px);
}

.header-inner,
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 0;
}

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

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--teal);
  color: #fff;
  font-size: 0.88rem;
  letter-spacing: 0;
}

.main-nav,
.site-footer nav {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.main-nav a,
.site-footer a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.96rem;
}

.main-nav a:hover,
.site-footer a:hover {
  color: var(--teal-dark);
  text-decoration: underline;
}

.text-size-button {
  min-height: 42px;
  border: 1px solid #b9d1d5;
  border-radius: 8px;
  background: #fff;
  color: var(--teal-dark);
  font-weight: 800;
  padding: 0 12px;
}

.text-size-button[aria-pressed="true"] {
  background: var(--teal);
  color: #fff;
}

.tool-band {
  padding: 34px 0 26px;
  background: linear-gradient(180deg, #ffffff, #f4f7f6);
}

.tool-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.75fr);
  gap: 20px;
  align-items: stretch;
}

.scan-panel,
.result-summary,
.history-panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.scan-panel,
.result-summary {
  padding: 26px;
}

.eyebrow,
.small-label {
  margin: 0 0 8px;
  color: var(--teal-dark);
  font-size: 0.84rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  max-width: 820px;
  font-size: 3.6rem;
}

h2 {
  font-size: 1.45rem;
}

h3 {
  font-size: 1.12rem;
}

.lead {
  max-width: 760px;
  color: var(--muted);
  font-size: 1.08rem;
}

.scan-form {
  margin-top: 24px;
}

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

.input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.input-row input {
  min-height: 56px;
  border: 2px solid #9eb2bb;
  border-radius: 8px;
  padding: 0 14px;
  background: #fff;
  color: var(--ink);
}

.input-row input:focus {
  outline: 3px solid rgba(23, 107, 111, 0.25);
  border-color: var(--teal);
}

.primary-button,
.secondary-button {
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 800;
  padding: 0 18px;
}

.primary-button {
  min-height: 56px;
  background: var(--teal);
  color: #fff;
}

.primary-button:hover {
  background: var(--teal-dark);
}

.secondary-button {
  background: #eaf3f5;
  color: var(--teal-dark);
  border: 1px solid #b9d1d5;
}

.secondary-button:hover {
  background: #dcebef;
}

.form-note,
.muted {
  color: var(--muted);
}

.form-note {
  margin: 10px 0 0;
  font-size: 0.92rem;
}

.scan-extra-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.demo-scan-button {
  min-height: 44px;
}

.quick-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}

.quick-checks span {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--soft);
  color: #26413b;
  padding: 6px 10px;
  font-size: 0.9rem;
  font-weight: 700;
}

.result-summary {
  display: grid;
  align-content: center;
  min-height: 100%;
}

.empty-state p,
.score-card p {
  color: var(--muted);
}

.score-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 8px 0;
}

.score-row strong {
  font-size: 4.8rem;
  line-height: 1;
}

.score-row span {
  color: var(--muted);
  font-weight: 800;
}

.summary-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.loading-state {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--muted);
}

.spinner {
  width: 34px;
  height: 34px;
  border: 4px solid #d6e1e5;
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin 900ms linear infinite;
}

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

.ad-slot {
  width: min(970px, calc(100% - 32px));
  min-height: 92px;
  margin: 20px auto;
  border: 1px dashed #9eb2bb;
  border-radius: 8px;
  background: #fff;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 16px;
  color: var(--muted);
}

.ad-slot span {
  display: block;
  color: var(--amber);
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
}

.ad-slot p {
  margin: 4px 0 0;
  font-size: 0.92rem;
}

.video-guide {
  padding: 26px 0;
  background: #fff;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.video-guide-inner {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(320px, 1.15fr);
  gap: 22px;
  align-items: center;
}

.video-copy p {
  color: var(--muted);
}

.video-link {
  width: fit-content;
  margin-top: 14px;
  text-decoration: none;
}

.video-embed {
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0f1c1f;
  box-shadow: var(--shadow);
}

.video-embed iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.results-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 20px;
  align-items: start;
  padding: 20px 0 12px;
}

.results-main {
  min-width: 0;
}

.section-heading {
  margin: 20px 0 12px;
}

.metrics-list,
.repairs-list,
.history-list,
.learning-list {
  display: grid;
  gap: 12px;
}

.metric-card,
.repair-card,
.history-item,
.learning-item,
.support-grid article,
.content-page .content-block {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.metric-card,
.repair-card,
.history-item,
.learning-item,
.support-grid article {
  padding: 18px;
}

.metric-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.86rem;
  font-weight: 800;
}

.badge.pass {
  background: #ddf1e5;
  color: #0c5933;
}

.badge.warn {
  background: #fff2d8;
  color: #7b4b0c;
}

.badge.fail {
  background: #ffe1df;
  color: #8c1f18;
}

.meter {
  height: 12px;
  background: #e1e8eb;
  border-radius: 999px;
  overflow: hidden;
  margin: 14px 0;
}

.meter span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--teal), var(--green));
}

.repair-card pre {
  white-space: pre-wrap;
  word-break: break-word;
  background: #152126;
  color: #e9f5ef;
  border-radius: 8px;
  padding: 14px;
  font-size: 0.9rem;
  overflow: auto;
}

.patch-block {
  position: relative;
  margin-top: 10px;
}

.patch-copy {
  position: absolute;
  top: 8px;
  right: 8px;
  min-height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 0.84rem;
  font-weight: 800;
  padding: 0 10px;
}

.patch-copy:hover {
  background: rgba(255, 255, 255, 0.2);
}

.patch-block pre {
  padding-top: 50px;
}

.repair-safety-note {
  border: 1px solid #e2c17c;
  border-radius: 8px;
  background: #fff8e8;
  color: #5a3a0d;
  margin-top: 14px;
  padding: 12px 14px;
}

.repair-safety-note strong {
  display: block;
}

.repair-safety-note p {
  margin: 6px 0 0;
}

.repair-helper-box {
  display: grid;
  gap: 10px;
  border: 1px solid #b9d1d5;
  border-radius: 8px;
  background: #f8fbfa;
  margin-top: 14px;
  padding: 14px;
}

.repair-helper-box label {
  font-weight: 800;
}

.repair-platform-select {
  min-height: 50px;
  width: min(100%, 360px);
  border: 2px solid #9eb2bb;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 12px;
}

.repair-platform-select:focus {
  outline: 3px solid rgba(23, 107, 111, 0.25);
  border-color: var(--teal);
}

.repair-helper-note {
  margin: 0;
  color: var(--muted);
}

.repair-helper-link {
  width: fit-content;
  text-decoration: none;
}

.history-panel {
  padding: 18px;
  position: sticky;
  top: 82px;
}

.learning-panel {
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
  padding-bottom: 18px;
}

.learning-item {
  background: #f8fbfa;
}

.learning-item strong {
  display: block;
}

.learning-item p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.94rem;
}

.memory-form {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.memory-form label {
  font-weight: 800;
}

.memory-form textarea {
  width: 100%;
  min-height: 92px;
  border: 2px solid #9eb2bb;
  border-radius: 8px;
  padding: 10px 12px;
  resize: vertical;
  color: var(--ink);
}

.memory-form textarea:focus {
  outline: 3px solid rgba(23, 107, 111, 0.25);
  border-color: var(--teal);
}

.history-item button {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  color: var(--ink);
  font-weight: 800;
  padding: 0;
}

.history-item small {
  display: block;
  color: var(--muted);
  margin-top: 4px;
}

.support-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  padding: 26px 0 44px;
}

.support-grid p {
  color: var(--muted);
}

.site-footer {
  border-top: 1px solid var(--line);
  background: #fff;
}

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

.content-page {
  padding: 32px 0 46px;
}

.content-hero {
  max-width: 880px;
  margin-bottom: 20px;
}

.content-hero h1 {
  font-size: 3rem;
}

.content-block {
  padding: 22px;
  margin: 16px 0;
}

.content-block p,
.content-block li {
  color: var(--muted);
}

.content-block li + li {
  margin-top: 8px;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

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

th {
  color: var(--teal-dark);
}

@media (max-width: 860px) {
  .header-inner,
  .footer-inner,
  .tool-grid,
  .results-layout,
  .video-guide-inner,
  .support-grid {
    grid-template-columns: 1fr;
  }

  .header-inner,
  .footer-inner {
    display: grid;
    align-items: start;
  }

  .header-actions {
    justify-content: start;
  }

  .main-nav {
    gap: 10px;
  }

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

  .history-panel {
    position: static;
  }

  .score-row strong {
    font-size: 4rem;
  }

  h1 {
    font-size: 2.6rem;
  }

  .content-hero h1 {
    font-size: 2.4rem;
  }
}

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

  .wrap,
  .ad-slot {
    width: min(100% - 20px, 1120px);
  }

  .video-guide {
    padding: 20px 0;
  }

  .scan-panel,
  .result-summary,
  .metric-card,
  .repair-card,
  .history-panel,
  .support-grid article,
  .content-block {
    padding: 16px;
  }

  .brand span:last-child {
    max-width: 210px;
  }

  h1,
  .content-hero h1 {
    font-size: 2rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
}
