:root {
  color-scheme: light;
  --ink: #111111;
  --muted: #64645d;
  --paper: #f4f4ef;
  --panel: #ffffff;
  --line: #d7d7cd;
  --lime: #b7ff2a;
  --coral: #ff5a45;
  --amber: #ffbd45;
  --cyan: #33c5ff;
  --shadow: 0 20px 70px rgba(16, 16, 13, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(90deg, rgba(17, 17, 17, 0.035) 1px, transparent 1px),
    linear-gradient(180deg, rgba(17, 17, 17, 0.035) 1px, transparent 1px),
    var(--paper);
  background-size: 30px 30px;
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  letter-spacing: 0;
}

button,
textarea {
  font: inherit;
}

button {
  min-height: 40px;
  border: 1px solid var(--ink);
  border-radius: 6px;
  background: var(--ink);
  color: #fff;
  padding: 0 14px;
  cursor: pointer;
}

button:hover {
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

.ghost-button,
.sample-button {
  background: transparent;
  color: var(--ink);
}

.shell {
  width: min(1560px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 22px 0;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.intro {
  display: grid;
  grid-template-columns: minmax(320px, 0.8fr) minmax(320px, 1.2fr);
  gap: 18px;
  align-items: end;
  margin-bottom: 16px;
  padding: 22px;
}

.intro-copy {
  max-width: 70ch;
  margin: 0;
  color: #33332f;
  font-size: 1rem;
  line-height: 1.55;
}

.intro-side {
  display: grid;
  gap: 12px;
  justify-items: start;
}

.support-link {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  border: 1px solid var(--ink);
  border-radius: 999px;
  padding: 0 13px;
  background: #fff;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 850;
  text-decoration: none;
}

.support-link:hover {
  transform: translateY(-1px);
}

.workbench {
  display: grid;
  grid-template-columns: minmax(390px, 0.72fr) minmax(650px, 1.28fr);
  gap: 16px;
  align-items: start;
}

.editor,
.results {
  padding: 18px;
}

.results {
  position: sticky;
  top: 18px;
}

.toolbar,
.button-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.button-row {
  justify-content: flex-start;
  flex-wrap: wrap;
}

.button-row.full button {
  min-width: 142px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
  letter-spacing: 0;
}

h1 {
  max-width: 14ch;
  margin-bottom: 0;
  font-size: clamp(2.35rem, 5vw, 5.2rem);
  line-height: 0.9;
}

h2 {
  margin-bottom: 0;
  font-size: 1.2rem;
}

h3 {
  margin-bottom: 10px;
  font-size: 0.86rem;
  text-transform: uppercase;
}

.local-badge,
.readiness {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  padding: 0 12px;
  background: var(--lime);
  color: var(--ink);
  font-size: 0.75rem;
  font-weight: 850;
  text-transform: uppercase;
}

.readiness.warn {
  background: var(--amber);
}

.readiness.bad {
  background: var(--coral);
}

.sample-gallery {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 16px 0 12px;
}

.sample-button {
  min-height: 38px;
  padding: 0 9px;
  font-size: 0.82rem;
}

.drop-zone {
  display: grid;
  gap: 4px;
  place-items: center;
  min-height: 92px;
  border: 1px dashed #77776d;
  border-radius: 8px;
  background: #fbfbf7;
  cursor: pointer;
  text-align: center;
}

.drop-zone.active {
  border-color: var(--ink);
  background: #efffcb;
}

.drop-zone input {
  display: none;
}

.drop-zone span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.field {
  display: grid;
  gap: 8px;
  margin: 14px 0 12px;
}

.field span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

textarea {
  width: 100%;
  min-height: 370px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111;
  color: #f8f8f1;
  padding: 14px;
  outline: none;
  resize: vertical;
  line-height: 1.45;
  tab-size: 2;
}

textarea:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(183, 255, 42, 0.55);
}

.export-panel {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfbf7;
  padding: 12px;
}

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

.button-grid button:last-child {
  grid-column: 1 / -1;
}

.hero-score {
  display: grid;
  grid-template-columns: 142px 1fr 190px;
  gap: 12px;
  align-items: stretch;
  margin-top: 18px;
}

.hero-score > div:first-child,
.sparkline,
.confidence-card,
.score-card,
.analysis-grid > section,
.card-preview {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.hero-score > div:first-child,
.confidence-card {
  padding: 14px;
}

.hero-score strong {
  display: block;
  margin-top: 6px;
  font-size: 3.4rem;
  line-height: 0.9;
}

.confidence-card strong {
  font-size: 2.1rem;
}

.confidence-card p {
  margin: 8px 0 0;
  color: #33332f;
  font-size: 0.8rem;
  line-height: 1.35;
}

.sparkline {
  display: flex;
  align-items: end;
  gap: 7px;
  min-height: 118px;
  padding: 12px;
}

.sparkline span {
  flex: 1;
  min-width: 12px;
  border: 1px solid var(--ink);
  border-radius: 5px 5px 0 0;
  background: var(--lime);
}

.sparkline span.warn {
  background: var(--amber);
}

.sparkline span.bad {
  background: var(--coral);
}

.score-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.score-card {
  padding: 11px;
}

.metric-label {
  display: block;
  color: var(--muted);
  font-size: 0.67rem;
  font-weight: 850;
  text-transform: uppercase;
}

.score-card strong {
  display: block;
  margin: 7px 0;
  font-size: 1.25rem;
}

.bar {
  overflow: hidden;
  height: 9px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: #f2f2ed;
}

.bar span {
  display: block;
  height: 100%;
  background: var(--lime);
}

.bar span.warn {
  background: var(--amber);
}

.bar span.bad {
  background: var(--coral);
}

.analysis-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  gap: 10px;
  margin-top: 12px;
}

.analysis-grid > section {
  padding: 13px;
}

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

.evidence-item {
  min-height: 72px;
  border-left: 4px solid var(--lime);
  border-radius: 6px;
  background: #f8f8f4;
  padding: 10px;
}

.evidence-item.warn {
  border-color: var(--amber);
}

.evidence-item.bad {
  border-color: var(--coral);
}

.evidence-item span {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 850;
  text-transform: uppercase;
}

.evidence-item strong {
  display: block;
  margin-top: 5px;
  font-size: 0.82rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.dimension-details {
  display: grid;
  gap: 8px;
  max-height: 420px;
  overflow: auto;
}

.dimension-detail {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

.detail-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.detail-head span {
  color: #1c6b00;
  font-weight: 850;
}

.detail-head span.warn {
  color: #8a5a00;
}

.detail-head span.bad {
  color: #9c1d0f;
}

.dimension-detail p {
  margin: 8px 0;
  color: #33332f;
  font-size: 0.84rem;
  line-height: 1.35;
}

ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

li {
  border-left: 4px solid var(--lime);
  padding-left: 10px;
  line-height: 1.38;
}

li.warn {
  border-color: var(--amber);
}

li.bad {
  border-color: var(--coral);
}

pre {
  overflow: auto;
  min-height: 292px;
  max-height: 460px;
  margin: 0;
  border-radius: 6px;
  background: #111;
  color: #f8f8f1;
  padding: 12px;
  font-size: 0.76rem;
  line-height: 1.45;
  white-space: pre-wrap;
}

.card-preview {
  margin-top: 12px;
  padding: 13px;
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--ink);
  border-radius: 8px;
  background: #111;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(360px, calc(100vw - 36px));
  transform: translateY(14px);
  border: 1px solid var(--ink);
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  padding: 11px 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.visible {
  transform: translateY(0);
  opacity: 1;
}

@media (max-width: 1200px) {
  .shell {
    width: min(100% - 20px, 900px);
    padding: 10px 0;
  }

  .intro,
  .workbench,
  .hero-score,
  .analysis-grid {
    grid-template-columns: 1fr;
  }

  .results {
    position: static;
  }

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

@media (max-width: 720px) {
  .intro,
  .editor,
  .results {
    padding: 13px;
  }

  .toolbar,
  .button-row {
    align-items: stretch;
    flex-direction: column;
  }

  .sample-gallery,
  .button-grid,
  .score-grid,
  .evidence-grid {
    grid-template-columns: 1fr;
  }

  .button-row button,
  .button-grid button,
  button {
    width: 100%;
  }

  h1 {
    font-size: 3rem;
  }

  textarea {
    min-height: 300px;
  }
}
