:root {
  --bg: #f4f7fb;
  --card: #ffffff;
  --border: #e7ecf4;
  --text: #111827;
  --muted: #6b7280;
  --accent: #2563eb;
  --accent-soft: #eff6ff;
  --surface: #f8fafc;
  --shadow: rgba(15, 23, 42, 0.06);
}

body.dark {
  --bg: #020617;
  --card: #0f172a;
  --border: #1e293b;
  --text: #f8fafc;
  --muted: #94a3b8;
  --accent: #60a5fa;
  --accent-soft: #1e3a8a;
  --surface: #111827;
  --shadow: rgba(2, 8, 23, 0.45);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
  background: linear-gradient(135deg, #f8fbff 0%, var(--bg) 100%);
  color: var(--text);
  transition: background 0.25s ease, color 0.25s ease;
}

body.dark {
  background: linear-gradient(135deg, #020617 0%, #0f172a 100%);
}

button,
select,
textarea {
  font: inherit;
}

.translator-app {
  display: flex;
  min-height: 100vh;
}

.translator-main {
  flex: 1;
  padding: 20px;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

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

.brand-icon {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.08);
  overflow: hidden;
}

.brand-icon img {
  width: 28px;
  height: 28px;
  display: block;
}

.subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.app-header h2 {
  margin: 0;
  font-size: 22px;
}

.header-actions {
  display: flex;
  gap: 8px;
}

.ghost-btn,
.primary-btn,
.swap-btn,
.theme-btn,
.icon-btn {
  border: none;
  cursor: pointer;
}

.ghost-btn,
.theme-btn,
.icon-btn {
  padding: 10px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
}

body.dark .ghost-btn,
body.dark .theme-btn,
body.dark .icon-btn {
  background: rgba(96, 165, 250, 0.16);
  color: #dbeafe;
}

.ghost-btn {
  padding: 10px 14px;
}

.translator-shell {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 14px;
  align-items: center;
}

.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 22px;
  overflow: hidden;
  min-height: 360px;
  box-shadow: 0 12px 30px var(--shadow);
}

.panel-top {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: transparent;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.lang-select {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 12px;
  background: var(--card);
  color: var(--text);
  outline: none;
  min-width: 110px;
}

body.dark .lang-select {
  background: var(--surface);
  color: var(--text);
}

textarea {
  width: 100%;
  min-height: 300px;
  border: none;
  padding: 16px 14px;
  resize: none;
  outline: none;
  color: var(--text);
  font-size: 16px;
  line-height: 1.6;
  background: transparent;
}

textarea::placeholder {
  color: var(--muted);
}

body.dark textarea {
  color: #f8fafc;
}

.swap-btn {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  font-size: 18px;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.2);
}

.controls-row {
  display: flex;
  justify-content: center;
  margin-top: 16px;
}

.app-footer {
  text-align: center;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.02em;
}

body.dark .app-footer {
  color: #94a3b8;
}

.primary-btn {
  padding: 12px 22px;
  border-radius: 999px;
  background: var(--accent);
  color: white;
  font-weight: 600;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.22);
}

body.dark .primary-btn {
  box-shadow: 0 8px 20px rgba(96, 165, 250, 0.2);
}

body.dark .translator-main {
  background: transparent;
}

body.dark .app-header h2,
body.dark .subtitle {
  color: var(--text);
}

body.dark ::selection {
  background: rgba(96, 165, 250, 0.35);
  color: white;
}

body.dark * {
  scrollbar-color: #334155 #0f172a;
}

@media (max-width: 960px) {
  .translator-main {
    padding: 14px;
  }

  .translator-shell {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .swap-btn {
    justify-self: center;
    transform: rotate(90deg);
  }

  .panel {
    min-height: 280px;
  }
}

@media (max-width: 640px) {
  .translator-main {
    padding: 12px;
  }

  .app-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 12px;
  }

  .header-actions {
    width: 100%;
    justify-content: space-between;
    gap: 6px;
  }

  .panel-top {
    padding: 10px 12px;
  }

  .lang-select {
    min-width: 92px;
    font-size: 14px;
    padding: 7px 10px;
  }

  .ghost-btn,
  .theme-btn,
  .icon-btn {
    padding: 8px 10px;
  }

  textarea {
    min-height: 220px;
    font-size: 15px;
    padding: 14px 12px;
  }

  .primary-btn {
    width: 100%;
    padding: 12px 16px;
  }

  .swap-btn {
    width: 42px;
    height: 42px;
    margin: 2px 0;
  }
}

@media (max-width: 420px) {
  .app-header h2 {
    font-size: 20px;
  }

  .subtitle {
    font-size: 13px;
  }

  .panel {
    border-radius: 16px;
  }

  textarea {
    min-height: 200px;
  }
}
