:root {
  --bg: #f0f4f8;
  --surface: #ffffff;
  --border: #d8e0ea;
  --border-strong: #b8c5d6;
  --text: #0c1b2a;
  --text-muted: #5a6b7d;
  --accent: #0f6cbd;
  --accent-hover: #0a5aa3;
  --topbar: #042a4d;
  --topbar-text: #e8f1fa;
  --shadow: 0 12px 40px rgba(4, 42, 77, 0.08);
  --radius: 14px;
  --font: "DM Sans", system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  background-image: radial-gradient(
      ellipse 120% 80% at 50% -20%,
      rgba(15, 108, 189, 0.12),
      transparent 55%
    ),
    linear-gradient(180deg, #e8eef5 0%, var(--bg) 40%);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.topbar {
  background: var(--topbar);
  color: var(--topbar-text);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
}

.topbar-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: inherit;
}

.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, #3d9eef 0%, #0f6cbd 50%, #042a4d 100%);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.brand-text {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-sub {
  margin: 0;
  font-size: 0.8rem;
  opacity: 0.85;
}

.brand-sub.ok {
  opacity: 0.9;
}

.brand-sub.error {
  color: #ffb4b4;
}

.workspace {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
}

.translator-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.lang-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #fafcfe 0%, #f5f8fb 100%);
}

.lang-select-wrap {
  flex: 1;
  min-width: 0;
}

.lang-select {
  width: 100%;
  padding: 0.55rem 0.75rem;
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%235a6b7d' d='M3 4.5L6 8l3-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  padding-right: 1.75rem;
}

.lang-select:hover,
.lang-select:focus {
  background-color: rgba(15, 108, 189, 0.06);
  border-color: var(--border);
  outline: none;
}

.swap-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--accent);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}

.swap-btn:hover {
  background: rgba(15, 108, 189, 0.08);
  border-color: var(--border-strong);
  transform: rotate(180deg);
}

.panes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 320px;
}

@media (max-width: 768px) {
  .panes {
    grid-template-columns: 1fr;
  }

  .pane-source {
    border-bottom: 1px solid var(--border);
  }
}

.pane {
  display: flex;
  flex-direction: column;
  min-height: 280px;
}

.pane-source {
  border-right: 1px solid var(--border);
}

.pane-input,
.pane-output {
  flex: 1;
  width: 100%;
  padding: 1.25rem 1.35rem;
  font: inherit;
  font-size: 1.05rem;
  line-height: 1.65;
  border: none;
  resize: none;
  background: transparent;
}

.pane-input:focus {
  outline: none;
  box-shadow: inset 0 0 0 2px rgba(15, 108, 189, 0.25);
}

.pane-output {
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
}

.pane-output.empty {
  color: var(--text-muted);
}

.pane-output.loading {
  color: var(--text-muted);
  font-style: italic;
}

.pane-output.error {
  color: #b42318;
  font-style: normal;
}

.pane-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1rem 0.85rem;
  border-top: 1px solid var(--border);
  background: #fafcfe;
}

.muted {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.text-btn {
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
}

.text-btn:hover:not(:disabled) {
  background: rgba(15, 108, 189, 0.1);
}

.text-btn:disabled {
  color: var(--text-muted);
  cursor: not-allowed;
}

.footnote {
  margin: 1rem 0 0;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
}
