:root {
  --bg: #0f172a;
  --bg-soft: #1e293b;
  --card: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --accent: #c8102e;
  --accent-soft: #fdecea;
  --green: #006847;
  --green-soft: #e8f6f0;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: linear-gradient(160deg, var(--bg) 0%, #1e293b 100%);
  color: var(--ink);
  min-height: 100vh;
}

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

.app {
  max-width: 860px;
  margin: 0 auto;
  padding: 40px 20px 60px;
}

.app-header {
  text-align: center;
  color: #f1f5f9;
  margin-bottom: 32px;
}

.logo {
  font-size: 48px;
  line-height: 1;
  margin-bottom: 8px;
}

.app-header h1 {
  font-size: 28px;
  margin: 8px 0 8px;
}

.subtitle {
  color: #94a3b8;
  margin: 0;
  font-size: 15px;
}

.subtitle em {
  color: #fbbf24;
  font-style: normal;
}

.converter {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}

.lang-badge {
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #334155;
  background: #e2e8f0;
  padding: 4px 10px;
  border-radius: 999px;
}

.lang-badge-mx {
  background: var(--green-soft);
  color: var(--green);
}

.toolbar {
  display: flex;
  gap: 6px;
}

.icon-btn,
.ghost-btn {
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #475569;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 6px 10px;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.icon-btn:hover,
.ghost-btn:hover {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: #f3c1c9;
}

.textarea {
  width: 100%;
  border: none;
  resize: vertical;
  padding: 16px;
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: transparent;
  font-family: inherit;
  min-height: 140px;
}

.textarea:focus {
  outline: none;
}

.output {
  background: var(--green-soft);
  min-height: 140px;
  white-space: pre-wrap;
  word-break: break-word;
}

.output .placeholder {
  color: var(--muted);
  font-style: italic;
}

.output.has-text {
  color: #065f46;
  font-weight: 500;
}

.output.has-text .placeholder {
  display: none;
}

.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-top: 1px solid #e2e8f0;
}

.count {
  font-size: 12px;
  color: var(--muted);
}

.status {
  font-size: 13px;
  color: var(--accent);
  font-weight: 600;
}

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

.status.ok {
  color: var(--green);
}

.primary-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 10px 22px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, transform 0.05s;
  box-shadow: 0 4px 12px rgba(200, 16, 46, 0.35);
}

.primary-btn:hover {
  background: #a30d26;
}

.primary-btn:active {
  transform: translateY(1px);
}

.primary-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.swap-arrow {
  text-align: center;
  color: #fbbf24;
  font-size: 22px;
  line-height: 1;
}

.notes {
  margin-top: 32px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius);
  padding: 18px 22px;
  color: #cbd5e1;
}

.notes h2 {
  margin: 0 0 8px;
  font-size: 16px;
  color: #f1f5f9;
}

.notes p {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
}

.notes strong {
  color: #fbbf24;
}

@media (max-width: 560px) {
  .app { padding: 24px 14px 40px; }
  .app-header h1 { font-size: 22px; }
}
