:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --text: #18222f;
  --muted: #607083;
  --border: #cfd8e3;
  --accent: #1476d4;
  --accent-hover: #0f63b5;
  --danger: #b42318;
  --focus: rgba(20, 118, 212, 0.24);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

button,
select,
textarea {
  font: inherit;
}

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

.app-header {
  margin-bottom: 18px;
}

.app-header h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  line-height: 1.2;
}

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

.text-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
}

.text-panel {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 8px;
  min-width: 0;
}

.text-panel span,
.language-control span {
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

textarea {
  width: 100%;
  height: 100%;
  min-height: 420px;
  resize: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  padding: 16px;
  line-height: 1.55;
  outline: none;
}

textarea:focus,
select:focus,
button:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--focus);
}

textarea[readonly] {
  background: #fbfcfd;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
}

.language-control {
  display: grid;
  gap: 8px;
  min-width: 180px;
}

select {
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  padding: 0 38px 0 12px;
  outline: none;
}

button {
  min-height: 44px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--accent);
  color: #ffffff;
  padding: 0 22px;
  font-weight: 700;
  cursor: pointer;
}

button:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.status {
  min-height: 22px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

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

.toast {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 10;
  width: min(380px, calc(100vw - 36px));
  border: 1px solid #f2b8b5;
  border-radius: 8px;
  background: #fff8f7;
  color: var(--danger);
  box-shadow: 0 16px 36px rgba(24, 34, 47, 0.14);
  padding: 12px 14px;
  font-size: 14px;
  line-height: 1.45;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px);
  transition:
    opacity 160ms ease,
    transform 160ms ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100vw - 24px, 720px);
    padding: 24px 0;
  }

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

  textarea {
    min-height: 260px;
  }

  .controls {
    align-items: stretch;
  }

  .language-control,
  button {
    width: 100%;
  }
}
