:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --ink: #18212f;
  --muted: #5f6b7a;
  --line: #d9e0e8;
  --blue: #1a0dab;
  --green: #18864b;
  --green-bg: #e8f6ef;
  --yellow: #a96f00;
  --yellow-bg: #fff4d8;
  --red: #c92f2f;
  --red-bg: #fde8e8;
  --shadow: 0 18px 50px rgba(24, 33, 47, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, sans-serif;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0;
}

.serp-panel,
.analysis-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.serp-panel {
  padding: 24px;
  margin-bottom: 20px;
}

.section-header,
.panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 1.15;
}

h1 {
  font-size: 26px;
}

h2 {
  font-size: 22px;
}

.serp-card {
  width: min(680px, 100%);
  margin-top: 24px;
  padding: 18px 0 4px;
}

.serp-url {
  color: #202124;
  font-size: 14px;
  line-height: 1.4;
  margin-bottom: 5px;
}

.serp-link {
  display: block;
  color: var(--blue);
  font-size: 20px;
  font-weight: 400;
  line-height: 1.3;
  text-decoration: none;
}

.serp-link:hover {
  text-decoration: underline;
}

.serp-description {
  color: #4d5156;
  font-size: 14px;
  line-height: 1.58;
  margin: 4px 0 0;
  max-width: 920px;
}

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

.analysis-panel {
  padding: 22px;
}

.status-badge {
  flex: 0 0 auto;
  border-radius: 999px;
  border: 1px solid currentColor;
  font-size: 13px;
  font-weight: 700;
  padding: 7px 10px;
}

.status-good {
  background: var(--green-bg);
  color: var(--green);
}

.status-warning {
  background: var(--yellow-bg);
  color: var(--yellow);
}

.status-critical {
  background: var(--red-bg);
  color: var(--red);
}

.field-label {
  display: block;
  margin-top: 22px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.text-field {
  width: 100%;
  border: 1px solid #c8d1dc;
  border-radius: 6px;
  color: var(--ink);
  font: 16px/1.4 Arial, sans-serif;
  padding: 11px 12px;
  outline: none;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.text-field:focus {
  border-color: #3367d6;
  box-shadow: 0 0 0 3px rgba(51, 103, 214, 0.16);
}

.textarea-field {
  min-height: 94px;
  resize: vertical;
}

.metrics-row {
  display: flex;
  gap: 18px;
  margin: 12px 0 18px;
  color: var(--muted);
  font-size: 14px;
}

.metrics-row strong {
  color: var(--ink);
}

.device-stack {
  display: grid;
  gap: 14px;
}

.device-meter {
  color: var(--green);
}

.device-meter.is-warning {
  color: var(--yellow);
}

.device-meter.is-critical {
  color: var(--red);
}

.meter-topline {
  display: grid;
  grid-template-columns: 76px 1fr auto;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.meter-topline span:first-child {
  color: var(--ink);
  font-weight: 700;
}

.meter-topline strong {
  color: currentColor;
  font-weight: 700;
  text-align: right;
}

.meter-topline em {
  color: currentColor;
  font-style: normal;
  font-weight: 700;
  min-width: 92px;
  text-align: right;
}

.progress-track {
  height: 9px;
  margin-top: 7px;
  overflow: hidden;
  background: #e6ebf1;
  border-radius: 999px;
}

.progress-fill {
  width: 0%;
  height: 100%;
  background: var(--green);
  border-radius: inherit;
  transition: width 120ms ease, background-color 120ms ease;
}

.device-meter.is-warning .progress-fill {
  background: var(--yellow);
}

.device-meter.is-critical .progress-fill {
  background: var(--red);
}

.hint-box {
  margin-top: 18px;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
  color: #334155;
  font-size: 14px;
  line-height: 1.45;
  padding: 12px;
}

@media (max-width: 860px) {
  .app-shell {
    width: min(100% - 20px, 680px);
    padding: 16px 0;
  }

  .editor-grid {
    grid-template-columns: 1fr;
  }

  .section-header,
  .panel-heading {
    align-items: flex-start;
  }
}

@media (max-width: 520px) {
  .serp-panel,
  .analysis-panel {
    padding: 16px;
  }

  h1 {
    font-size: 22px;
  }

  h2 {
    font-size: 20px;
  }

  .panel-heading {
    flex-direction: column;
  }

  .meter-topline {
    grid-template-columns: 1fr auto;
  }

  .meter-topline em {
    grid-column: 1 / -1;
    min-width: 0;
    text-align: left;
  }
}
