:root {
  --accent: #0f766e;
  --accent-soft: #dff3f1;
  --line: #e6edf3;
  --line-strong: #d9e2ec;
  --text: #1f2933;
  --muted: #52606d;
  --muted-light: #9aa5b1;
  --surface: #ffffff;
  --button-bg: #f8fafc;
  --button-hover: #f1f8f7;
  --meter-low: #9dcfbe;
  --meter-mid: #5ea998;
  --meter-high: #2f7f73;
  --meter-track: #edf5f4;
  --warning-soft: #fff7e8;
  --warning-line: #f3dfb1;
  --warning-text: #8a6a14;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, sans-serif;
  background: var(--surface);
  color: var(--text);
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 40px 24px 48px;
}

.page-header {
  margin-bottom: 28px;
}

.page-header h1 {
  margin: 0 0 8px;
  font-size: 2rem;
  font-weight: 600;
}

.title-accent {
  color: var(--accent);
}

.page-header p {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.9fr) minmax(280px, 1fr);
  gap: 28px;
  align-items: start;
}

.editor-panel,
.analysis-panel {
  min-width: 0;
}

.card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 12px;
  background: var(--surface);
  position: relative;
}

.analysis-panel .card::before {
  content: "";
  display: block;
  width: 44px;
  height: 3px;
  border-radius: 999px;
  background: var(--accent-soft);
  margin-bottom: 12px;
}

.section-title {
  margin: 0 0 6px;
  font-weight: 600;
  font-size: 0.98rem;
}

.divider {
  height: 1px;
  background: var(--line);
  margin: 0 0 12px;
}

textarea {
  width: 100%;
  min-height: 300px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  font: inherit;
  color: inherit;
  resize: vertical;
  background: var(--surface);
}

textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.card p {
  margin: 0;
  line-height: 1.55;
  color: var(--muted);
}

.scan-label {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 0.86rem;
  font-weight: 600;
}

.card-empty {
  color: var(--muted-light);
}

.scan-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin: 0 0 16px;
}

.scan-modes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.scan-action {
  flex: 0 0 auto;
}

.mode-option {
  position: relative;
  cursor: pointer;
}

.mode-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.mode-option span {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.2;
  min-height: 38px;
  transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease;
  border: 1px solid var(--line);
  background: #fbfcfd;
}

.mode-option input:checked + span {
  background: #f3faf9;
  border-color: #b9d8d4;
  color: var(--accent);
}

.mode-option input:focus-visible + span {
  outline: 2px solid rgba(15, 118, 110, 0.2);
  outline-offset: 1px;
}

.meter-group {
  margin-top: 16px;
}

.meter {
  margin-top: 12px;
}

.meter:first-child {
  margin-top: 0;
}

.meter-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 6px;
  font-size: 0.9rem;
  color: var(--muted);
}

.meter-label span:last-child {
  color: var(--text);
  font-size: 0.84rem;
  white-space: nowrap;
}

.meter-track {
  width: 100%;
  height: 8px;
  background: var(--meter-track);
  border-radius: 999px;
  overflow: hidden;
}

.meter-fill {
  height: 100%;
  border-radius: 999px;
}

.meter-low {
  background: var(--meter-low);
}

.meter-mid {
  background: var(--meter-mid);
}

.meter-high {
  background: var(--meter-high);
}

.card-warning {
  background: var(--warning-soft);
  border-color: var(--warning-line);
}

.card-warning .section-title,
.card-warning p {
  color: var(--warning-text);
}

.card-warning .divider {
  background: rgba(138, 106, 20, 0.14);
}

.card-warning::before {
  background: #f4e2b8;
}

.disclaimer {
  margin-top: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fcfefe;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.actions {
  display: flex;
  justify-content: center;
  margin-top: 28px;
}

button {
  appearance: none;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--button-bg);
  color: var(--text);
  padding: 8px 14px;
  font: inherit;
  font-size: 14px;
  line-height: 1.2;
  cursor: pointer;
  transition: background-color 0.18s ease, border-color 0.18s ease;
  min-height: 38px;
}

.btn-analyse,
.btn-secondary:focus-visible {
  outline: 2px solid rgba(15, 118, 110, 0.22);
  outline-offset: 2px;
}

.btn-analyse {
  background: #e6f4f2;
  border-color: #bfe3de;
  color: var(--accent);
  font-weight: 500;
}

.btn-analyse:hover {
  background: #d7efec;
  border-color: #9fd5cd;
}

.btn-secondary:hover {
  background: var(--button-hover);
  border-color: var(--accent);
}

@media (max-width: 860px) {
  .container {
    padding: 28px 18px 36px;
  }

  .layout {
    grid-template-columns: 1fr;
    gap: 22px;
  }

  .actions {
    margin-top: 24px;
  }
}

@media (max-width: 520px) {
  .scan-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .scan-modes {
    display: flex;
    flex-direction: column;
  }

  .mode-option span {
    display: block;
    width: 100%;
    text-align: center;
  }

  .scan-action,
  .actions {
    display: flex;
    justify-content: stretch;
  }

  .scan-action button,
  .actions button {
    width: 100%;
  }

  .meter-label {
    font-size: 0.86rem;
    gap: 12px;
  }

  .meter-label span:last-child {
    font-size: 0.8rem;
  }
}
