:root {
  color-scheme: light;
  --ink: #17212b;
  --muted: #64717f;
  --line: #d9e1e8;
  --surface: #f7f9fb;
  --panel: #ffffff;
  --navy: #213448;
  --teal: #0f766e;
  --amber: #b45309;
  --red: #b42318;
  --green: #15803d;
  --violet: #6d28d9;
  --shadow: 0 18px 45px rgba(35, 52, 70, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(15, 118, 110, 0.08), transparent 34%),
    linear-gradient(180deg, #eef4f7 0%, #f8fafc 44%, #edf2f7 100%);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
select,
textarea,
input {
  font: inherit;
}

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

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding: 4px 2px 18px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--teal);
  font-size: 0.78rem;
  font-weight: 760;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  color: var(--navy);
  font-size: clamp(2rem, 4vw, 4rem);
  line-height: 1;
  letter-spacing: 0;
}

.status-strip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 136px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.75);
  color: var(--muted);
  font-weight: 650;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--muted);
}

.dot.good {
  background: var(--green);
}

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

.dot.bad {
  background: var(--red);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(360px, 0.75fr);
  gap: 18px;
  align-items: stretch;
  min-height: calc(100vh - 148px);
}

.editor-panel,
.results-panel {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.editor-panel {
  display: grid;
  grid-template-rows: auto 1fr;
}

.panel-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfe;
}

.generator-bar {
  display: grid;
  grid-template-columns: minmax(120px, 0.65fr) minmax(220px, 1fr) minmax(230px, 0.9fr) auto;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: #f4f7fa;
}

.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.mode,
.toolbar-actions button,
.result-actions button,
.generator-bar button,
input,
select {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  font-weight: 700;
}

.mode {
  padding: 0 12px;
}

.mode.active {
  border-color: #94a3b8;
  background: var(--navy);
  color: #fff;
}

.toolbar-actions,
.result-actions {
  display: flex;
  gap: 8px;
}

.toolbar-actions button,
.result-actions button,
.generator-bar button,
input,
select {
  padding: 0 12px;
}

input {
  min-width: 0;
  width: 100%;
  background: #fff;
}

.editor-wrap {
  position: relative;
  min-height: 520px;
  height: 100%;
  overflow: hidden;
  background: #0d1722;
}

textarea,
.line-highlights {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.93rem;
  line-height: 1.55;
  tab-size: 2;
}

.line-highlights {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  padding: 18px 0;
  pointer-events: none;
}

.line-mark {
  height: 1.4415rem;
  border-left: 4px solid transparent;
}

.line-mark.error {
  border-left-color: var(--red);
  background: rgba(180, 35, 24, 0.26);
}

.line-mark.warning {
  border-left-color: var(--amber);
  background: rgba(180, 83, 9, 0.24);
}

.line-mark.info {
  border-left-color: var(--violet);
  background: rgba(109, 40, 217, 0.18);
}

textarea {
  position: relative;
  z-index: 1;
  width: 100%;
  min-height: 520px;
  height: 100%;
  resize: none;
  border: 0;
  outline: none;
  padding: 18px;
  color: #12202f;
  background: transparent;
  color: #e6edf3;
}

.results-panel {
  display: flex;
  flex-direction: column;
  padding: 16px;
}

.score-band {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px;
  align-items: center;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.score-label {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 750;
}

#scoreValue {
  display: block;
  margin-top: 2px;
  color: var(--navy);
  font-size: 2.4rem;
  line-height: 1;
}

.meter {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e2e8f0;
}

.meter span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--red), var(--amber), var(--teal));
  transition: width 180ms ease;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 14px 0;
}

.summary-grid div {
  min-height: 70px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.summary-grid strong {
  display: block;
  font-size: 1.45rem;
  line-height: 1.1;
}

.summary-grid span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
}

.result-actions {
  padding-bottom: 12px;
}

.result-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: auto;
  min-height: 0;
  margin: 0;
  padding: 0 4px 2px 0;
  list-style: none;
}

.result {
  border: 1px solid var(--line);
  border-left-width: 5px;
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.result.error {
  border-left-color: var(--red);
}

.result.warning {
  border-left-color: var(--amber);
}

.result.info {
  border-left-color: var(--violet);
}

.result.ok {
  border-left-color: var(--green);
}

.result[data-line] {
  cursor: pointer;
}

.result[data-line]:hover {
  border-color: #94a3b8;
  background: #f8fafc;
}

.line-badge {
  display: inline-block;
  margin-left: 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
}

.result strong {
  display: block;
  margin-bottom: 4px;
  font-size: 0.96rem;
}

.result p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

@media (max-width: 980px) {
  .app-shell {
    width: min(100vw - 20px, 760px);
    padding-top: 14px;
  }

  .topbar,
  .panel-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .generator-bar {
    grid-template-columns: 1fr;
  }

  .workspace {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  textarea {
    min-height: 440px;
  }

  .editor-wrap {
    min-height: 440px;
  }
}
