:root {
  --bg: #eef4ff;
  --bg-accent: #fff4e8;
  --card: rgba(255, 255, 255, 0.88);
  --text: #0f172a;
  --muted: #475569;
  --danger-bg: #fff1f2;
  --danger-line: #fecdd3;
  --danger-text: #be123c;
  --shadow: 0 24px 80px rgba(15, 23, 42, 0.1);
  --radius-xl: 28px;
  --radius-lg: 22px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font: 16px/1.5 "Georgia", "Times New Roman", serif;
  background:
    radial-gradient(circle at top, #fff4e8, transparent 34%),
    linear-gradient(180deg, #f8fbff 0%, var(--bg) 100%);
}

button,
textarea,
select {
  font: inherit;
}

.page {
  max-width: 1520px;
  margin: 0 auto;
  padding: 24px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.95fr) minmax(290px, 0.8fr);
  gap: 24px;
}

.card {
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: var(--radius-xl);
  background: var(--card);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 28px;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 10px;
  color: #0284c7;
  font: 700 12px/1.4 Arial, Helvetica, sans-serif;
  letter-spacing: 0.26em;
  text-transform: uppercase;
}

h1,
h2,
.stat-value {
  font-family: "Georgia", "Times New Roman", serif;
}

h1 {
  margin: 0;
  font-size: clamp(34px, 5vw, 52px);
  line-height: 1.04;
}

h2 {
  margin: 0 0 10px;
  font-size: 26px;
}

.hero-text,
.section-text,
.detector-list,
.feature-list,
textarea,
.preset-select,
.button,
.stat-label {
  font-family: Arial, Helvetica, sans-serif;
}

.hero-text,
.section-text {
  max-width: 760px;
  margin: 14px 0 0;
  color: var(--muted);
}

.hero-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-self: start;
  min-width: min(100%, 340px);
}

.button {
  border: 0;
  border-radius: 16px;
  padding: 13px 16px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 120ms ease, opacity 120ms ease, background 120ms ease;
}

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

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

.button-primary {
  color: white;
  background: #0284c7;
}

.button-secondary {
  color: var(--text);
  background: #ffffff;
  border: 1px solid #cbd5e1;
}

.button-ghost {
  color: #334155;
  background: transparent;
  border: 1px dashed #cbd5e1;
}

.score-panel {
  padding: 20px 22px;
}

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

.score {
  width: 100%;
  min-width: 1040px;
  display: block;
}

.page-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
}

.page-indicator {
  margin: 0;
  color: var(--muted);
  font: 600 14px/1.4 Arial, Helvetica, sans-serif;
  text-align: center;
}

.stats {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.stat {
  padding: 16px;
  border-radius: var(--radius-lg);
  background: #f8fafc;
}

.stat-label {
  margin: 0 0 8px;
  font-size: 11px;
  color: #64748b;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.stat-value {
  margin: 0;
  font-size: clamp(26px, 4vw, 36px);
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.stat-value-compact {
  font-size: clamp(18px, 2.5vw, 24px);
  line-height: 1.2;
}

#target-note,
#detected-note {
  font-size: clamp(20px, 2.3vw, 28px);
}

.sidebar {
  display: grid;
  gap: 24px;
}

.sidebar .card {
  padding: 22px;
}

textarea,
.preset-select {
  width: 100%;
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: var(--radius-lg);
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: var(--text);
  transition: border-color 120ms ease, background 120ms ease, outline-color 120ms ease;
}

textarea {
  min-height: 160px;
  resize: vertical;
}

textarea:focus,
.preset-select:focus {
  outline: 2px solid rgba(14, 165, 233, 0.25);
  border-color: #38bdf8;
  background: white;
}

.field-label {
  display: block;
  margin-top: 18px;
  color: #475569;
  font: 700 12px/1.4 Arial, Helvetica, sans-serif;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

body.sheet-only .layout {
  grid-template-columns: minmax(0, 1fr);
}

body.sheet-only .sidebar {
  display: none;
}

body.sheet-only .stats {
  display: none;
}

body.sheet-only .hero-copy {
  display: none;
}

body.sheet-only .hero {
  justify-content: flex-end;
  padding: 18px 24px;
}

body.sheet-only .score-panel {
  padding: 12px 14px 18px;
}

body.sheet-only .score {
  min-width: 1120px;
}

.detector-list p,
.feature-list {
  margin: 0;
}

.detector-list {
  display: grid;
  gap: 8px;
  color: #334155;
}

.error {
  margin: 16px 0 0;
  padding: 12px 14px;
  border: 1px solid var(--danger-line);
  border-radius: 16px;
  background: var(--danger-bg);
  color: var(--danger-text);
  font: 14px/1.5 Arial, Helvetica, sans-serif;
}

.card-dark {
  color: white;
  background: #0f172a;
  border-color: #0f172a;
}

.card-dark .feature-list {
  color: #cbd5e1;
}

.feature-list {
  padding-left: 20px;
}

.feature-list li + li {
  margin-top: 8px;
}

code {
  padding: 2px 6px;
  border-radius: 8px;
  background: #e2e8f0;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.92em;
}

@media (max-width: 1024px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .hero {
    flex-direction: column;
  }

  .hero-actions {
    width: 100%;
  }

  body.sheet-only .hero-copy {
    display: none;
  }
}

@media (max-width: 640px) {
  .page {
    padding: 16px;
  }

  .hero,
  .score-panel,
  .sidebar .card {
    padding: 18px;
  }

  .hero-actions,
  .stats {
    grid-template-columns: 1fr;
  }
}
