:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --line: #d8dee8;
  --text: #17202f;
  --muted: #617086;
  --accent: #0f766e;
  --accent-strong: #0b5f59;
  --danger: #b42318;
}

* {
  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;
}

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

.workspace {
  display: grid;
  gap: 20px;
}

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

h1,
h2,
p {
  margin: 0;
}

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

h2 {
  font-size: 20px;
}

.topbar p,
.section-head p {
  margin-top: 7px;
  color: var(--muted);
  line-height: 1.5;
}

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

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

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

.translator,
.languages {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.translator {
  display: grid;
  gap: 16px;
}

.field {
  display: grid;
  gap: 7px;
}

label,
.caption {
  color: #38465a;
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

input,
select {
  height: 42px;
  padding: 0 11px;
}

textarea {
  min-height: 168px;
  resize: vertical;
  padding: 12px;
  line-height: 1.55;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(15, 118, 110, 0.14);
}

.language-row {
  display: grid;
  grid-template-columns: 1fr 42px 1fr;
  gap: 12px;
  align-items: end;
}

.swap {
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f9fafb;
  color: var(--muted);
  font-size: 20px;
  cursor: pointer;
}

.text-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

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

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

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

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

button.secondary:hover {
  background: #f3f5f8;
}

.result-panel {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.result-panel > div {
  min-height: 136px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  padding: 13px;
}

.result-panel p {
  margin-top: 8px;
  color: #263247;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.languages {
  display: grid;
  gap: 16px;
}

.language-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(178px, 1fr));
  gap: 8px;
}

.language-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 40px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfe;
}

.language-item strong {
  font-size: 14px;
}

.language-item span {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

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

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

  .language-row,
  .text-grid,
  .result-panel {
    grid-template-columns: 1fr;
  }

  .swap {
    width: 42px;
    justify-self: center;
  }
}
