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

:root {
  --warm-bg: #fdf6ee;
  --warm-card: #fff9f3;
  --warm-border: #e8d5c0;
  --warm-accent: #c97941;
  --warm-accent-hover: #a85e2e;
  --warm-accent-light: #f4e3d4;
  --text-dark: #3a2a1e;
  --text-mid: #6b4e37;
  --text-light: #9e7a60;
  --result-bg: #f0f7f0;
  --result-border: #b8d8b8;
  --result-text: #2d4a2d;
  --error-bg: #fdf0f0;
  --error-border: #e8c0c0;
  --error-text: #7a2020;
  --shadow: 0 4px 24px rgba(120, 80, 40, 0.08);
  --radius: 16px;
}

body {
  background-color: var(--warm-bg);
  font-family: 'Georgia', 'Times New Roman', serif;
  color: var(--text-dark);
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px 16px 48px;
}

.container {
  width: 100%;
  max-width: 680px;
}

/* Header */
header {
  text-align: center;
  margin-bottom: 36px;
  padding-top: 12px;
}

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

h1 {
  font-size: 2rem;
  font-weight: normal;
  color: var(--warm-accent);
  letter-spacing: 0.02em;
  margin-bottom: 6px;
}

.subtitle {
  font-size: 0.95rem;
  color: var(--text-light);
  font-style: italic;
}

/* Mode selector */
.mode-selector {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
}

.mode-btn {
  flex: 1;
  padding: 16px 12px;
  border: 2px solid var(--warm-border);
  border-radius: var(--radius);
  background: var(--warm-card);
  cursor: pointer;
  font-family: inherit;
  color: var(--text-mid);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
}

.mode-btn:hover {
  border-color: var(--warm-accent);
  background: var(--warm-accent-light);
}

.mode-btn.active {
  border-color: var(--warm-accent);
  background: var(--warm-accent-light);
  color: var(--warm-accent);
}

.mode-icon {
  font-size: 1.6rem;
  flex-shrink: 0;
}

.mode-label {
  font-size: 0.9rem;
  line-height: 1.4;
  font-weight: bold;
}

.mode-label small {
  font-weight: normal;
  color: var(--text-light);
}

/* Input section */
.input-section {
  background: var(--warm-card);
  border: 1px solid var(--warm-border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.input-label {
  display: block;
  font-size: 0.95rem;
  font-weight: bold;
  color: var(--text-mid);
  margin-bottom: 12px;
}

textarea {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--warm-border);
  border-radius: 10px;
  font-family: inherit;
  font-size: 1rem;
  color: var(--text-dark);
  background: var(--warm-bg);
  resize: vertical;
  transition: border-color 0.2s;
  line-height: 1.6;
}

textarea:focus {
  outline: none;
  border-color: var(--warm-accent);
}

textarea::placeholder {
  color: var(--text-light);
  font-style: italic;
}

.translate-btn {
  margin-top: 16px;
  width: 100%;
  padding: 14px;
  background: var(--warm-accent);
  color: white;
  border: none;
  border-radius: 10px;
  font-family: inherit;
  font-size: 1.05rem;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.translate-btn:hover:not(:disabled) {
  background: var(--warm-accent-hover);
}

.translate-btn:active:not(:disabled) {
  transform: scale(0.98);
}

.translate-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

/* Spinner */
.spinner {
  animation: spin 1s linear infinite;
  display: inline-block;
}

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

/* Result section */
.result-section {
  background: var(--result-bg);
  border: 1px solid var(--result-border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.result-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.result-icon {
  font-size: 1.4rem;
}

.result-title {
  font-size: 0.9rem;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--result-text);
  opacity: 0.7;
}

.result-text {
  font-size: 1.05rem;
  line-height: 1.8;
  color: var(--result-text);
}

.result-text strong {
  color: #1a3a1a;
  display: block;
  margin-top: 14px;
  margin-bottom: 4px;
}

/* Error section */
.error-section {
  background: var(--error-bg);
  border: 1px solid var(--error-border);
  border-radius: var(--radius);
  padding: 16px 20px;
  color: var(--error-text);
  font-size: 0.95rem;
  animation: fadeIn 0.3s ease;
}

/* Hidden */
.hidden {
  display: none !important;
}

/* Footer */
footer {
  text-align: center;
  margin-top: 40px;
  color: var(--text-light);
  font-size: 0.85rem;
  font-style: italic;
}

/* Responsive */
@media (max-width: 500px) {
  .mode-selector {
    flex-direction: column;
  }

  h1 {
    font-size: 1.6rem;
  }

  .input-section {
    padding: 18px;
  }
}
