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

:root {
  --primary-color: #6366f1;
  --primary-hover: #4f46e5;
  --bg-color: #f8fafc;
  --card-bg: #ffffff;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --border-color: #e2e8f0;
  --pm-color: #ec4899;
  --dev-color: #3b82f6;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg-color);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

header {
  text-align: center;
  margin-bottom: 2rem;
}

header h1 {
  font-size: 2rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--pm-color), var(--dev-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  color: var(--text-secondary);
  margin-top: 0.5rem;
}

.direction-toggle {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 2rem;
}

.toggle-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border: 2px solid var(--border-color);
  border-radius: 9999px;
  background: var(--card-bg);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.95rem;
}

.toggle-btn:hover {
  border-color: var(--primary-color);
}

.toggle-btn.active {
  border-color: var(--primary-color);
  background: var(--primary-color);
  color: white;
}

.toggle-btn .role {
  font-weight: 600;
}

.toggle-btn .arrow {
  opacity: 0.7;
}

.content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  flex: 1;
  min-height: 0;
}

.panel {
  background: var(--card-bg);
  border-radius: 1rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
}

.panel-header h2 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.input-panel textarea {
  flex: 1;
  padding: 1.25rem;
  border: none;
  resize: none;
  font-size: 1rem;
  font-family: inherit;
  line-height: 1.6;
}

.input-panel textarea:focus {
  outline: none;
}

.input-panel textarea::placeholder {
  color: var(--text-secondary);
}

.translate-btn {
  margin: 1rem;
  padding: 0.875rem 1.5rem;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease;
}

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

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

.output-content {
  flex: 1;
  padding: 1.25rem;
  overflow-y: auto;
  font-size: 0.95rem;
  min-height: 0;
}

.output-content pre {
  background: #f1f5f9;
  padding: 1rem;
  border-radius: 0.5rem;
  overflow-x: auto;
  margin-bottom: 0.75rem;
}

.output-content code {
  background: #f1f5f9;
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  font-size: 0.9em;
}

.output-content pre code {
  background: none;
  padding: 0;
}

.output-content .placeholder {
  color: var(--text-secondary);
}

.output-content h2 {
  font-size: 1.1rem;
  margin: 1.5rem 0 0.75rem 0;
  color: var(--text-primary);
}

.output-content h2:first-child {
  margin-top: 0;
}

.output-content ul {
  margin-left: 1.25rem;
  margin-bottom: 0.75rem;
}

.output-content li {
  margin-bottom: 0.35rem;
}

.output-content p {
  margin-bottom: 0.75rem;
}

.copy-btn {
  padding: 0.4rem 0.75rem;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: 0.375rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.copy-btn:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.copy-btn.copied {
  border-color: #10b981;
  color: #10b981;
}

footer {
  text-align: center;
  margin-top: 2rem;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

@media (max-width: 768px) {
  .container {
    padding: 1rem;
  }

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

  .panel {
    min-height: 300px;
  }

  .direction-toggle {
    flex-direction: column;
    align-items: center;
  }
}
