:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-soft: #f9fbfd;
  --line: #d9e0ea;
  --line-strong: #b8c3d1;
  --text: #162033;
  --muted: #607089;
  --accent: #0d766d;
  --accent-strong: #095c55;
  --danger: #b42318;
  --pending: #7a5b11;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.test-shell {
  width: min(1280px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 40px;
  display: grid;
  gap: 16px;
}

.input-band,
.english-panel,
.result-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 18px;
}

.input-band {
  display: grid;
  gap: 12px;
}

.title-row,
.panel-head,
.action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 26px;
  line-height: 1.25;
}

h2 {
  font-size: 18px;
  line-height: 1.35;
}

p {
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.5;
}

label {
  color: #37465b;
  font-size: 13px;
  font-weight: 700;
}

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

textarea:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(13, 118, 109, 0.14);
}

button {
  height: 42px;
  min-width: 92px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  padding: 0 18px;
}

button:hover {
  background: var(--accent-strong);
}

button:disabled {
  cursor: wait;
  opacity: 0.68;
}

.status {
  min-width: 112px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
  color: var(--muted);
  text-align: center;
  font-size: 14px;
  white-space: nowrap;
}

.status.running {
  border-color: #ead49f;
  color: var(--pending);
}

.status.ok {
  border-color: #9bd8ce;
  color: var(--accent-strong);
}

.status.error {
  border-color: #f3b4ae;
  color: var(--danger);
}

#progressText,
#summaryText {
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
}

.english-panel {
  display: grid;
  gap: 10px;
}

.english-result {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
  padding: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.result-panel {
  display: grid;
  gap: 12px;
}

.result-list {
  max-height: calc(100vh - 392px);
  min-height: 300px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.result-row {
  display: grid;
  grid-template-columns: 178px minmax(0, 1fr) minmax(0, 1fr);
  gap: 0;
  border-bottom: 1px solid var(--line);
}

.result-row:last-child {
  border-bottom: 0;
}

.language-cell,
.translation-cell,
.back-cell {
  min-width: 0;
  padding: 12px;
}

.language-cell {
  border-right: 1px solid var(--line);
  background: var(--surface-soft);
}

.translation-cell {
  border-right: 1px solid var(--line);
}

.language-name {
  display: block;
  font-weight: 800;
  line-height: 1.35;
}

.language-code {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.cell-label {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.cell-text {
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.cell-text.pending {
  color: var(--pending);
}

.cell-text.error {
  color: var(--danger);
}

@media (max-width: 840px) {
  .test-shell {
    width: min(100vw - 20px, 1280px);
    padding-top: 14px;
  }

  .title-row,
  .panel-head,
  .action-row {
    align-items: stretch;
    flex-direction: column;
  }

  .status,
  #progressText,
  #summaryText {
    white-space: normal;
  }

  .result-list {
    max-height: none;
    overflow: visible;
  }

  .result-row {
    grid-template-columns: 1fr;
  }

  .language-cell,
  .translation-cell {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}
