@import url('https://fonts.googleapis.cn/css2?family=Noto+Sans+SC:wght@300;400;500;700&display=swap');

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

body {
  font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #f0f2f5;
  color: #1a1a2e;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
header {
  background: #fff;
  border-bottom: 1px solid #e8eaed;
  padding: 0 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  font-size: 22px;
  font-weight: 700;
  color: #1a1a2e;
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 18px;
  font-weight: 700;
}

.nav-links {
  display: flex;
  gap: 8px;
  align-items: center;
}

.nav-links a {
  text-decoration: none;
  color: #5f6368;
  font-size: 14px;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: 8px;
  transition: all 0.2s;
}

.nav-links a:hover, .nav-links a.active {
  background: #f1f3f4;
  color: #1a1a2e;
}

.nav-badge {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  margin-left: 4px;
}

/* Main */
main {
  flex: 1;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  padding: 32px 40px;
}

/* Hero section */
.hero {
  text-align: center;
  padding: 40px 0 32px;
}

.hero h1 {
  font-size: 36px;
  font-weight: 700;
  color: #1a1a2e;
  margin-bottom: 12px;
  letter-spacing: -0.5px;
}

.hero p {
  font-size: 16px;
  color: #6b7280;
  font-weight: 300;
}

/* Language selector */
.lang-selector {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 24px;
}

.lang-box select {
  padding: 10px 16px;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  font-size: 14px;
  font-family: 'Noto Sans SC', sans-serif;
  background: #fff;
  color: #1a1a2e;
  cursor: pointer;
  outline: none;
  min-width: 140px;
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235f6368' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.lang-box select:focus {
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.lang-swap {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid #e0e0e0;
  background: #fff;
  color: #5f6368;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.lang-swap:hover {
  background: #f1f3f4;
  border-color: #667eea;
  color: #667eea;
  transform: rotate(180deg);
}

@media (max-width: 480px) {
  .lang-selector {
    gap: 10px;
  }
  .lang-box select {
    min-width: 100px;
    font-size: 13px;
  }
}

/* Mobile menu toggle */
.menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 28px;
  height: 20px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.menu-toggle span {
  display: block;
  width: 100%;
  height: 2px;
  background: #5f6368;
  border-radius: 2px;
  transition: all 0.3s;
}

.menu-toggle.active span:nth-child(1) {
  transform: translateY(9px) rotate(45deg);
}
.menu-toggle.active span:nth-child(2) {
  opacity: 0;
}
.menu-toggle.active span:nth-child(3) {
  transform: translateY(-9px) rotate(-45deg);
}

@media (max-width: 1200px) {
  .menu-toggle {
    display: flex;
  }

  header {
    flex-wrap: wrap;
    height: auto;
    min-height: 56px;
    padding: 12px 20px;
  }

  .nav-links {
    display: none !important;
    width: 100%;
    flex-direction: column;
    gap: 4px;
    padding-top: 12px;
    border-top: 1px solid #f1f3f4;
    margin-top: 12px;
  }

  .nav-links.open {
    display: flex !important;
  }

  .nav-links a {
    width: 100%;
    text-align: center;
    padding: 10px 16px;
  }
}

.model-tag {
  display: inline-block;
  background: linear-gradient(135deg, #667eea18, #764ba218);
  border: 1px solid #667eea30;
  color: #667eea;
  font-size: 12px;
  font-weight: 500;
  padding: 4px 12px;
  border-radius: 20px;
  margin-top: 12px;
}

/* Editor container */
.editor-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

@media (max-width: 1200px) {
  .editor-container {
    grid-template-columns: 1fr;
  }
  header { padding: 0 20px; }
  main { padding: 20px; }
}

.panel {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 4px 16px rgba(0,0,0,0.04);
  overflow: hidden;
  border: 1px solid #e8eaed;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid #f1f3f4;
  background: #fafafa;
}

.panel-title {
  font-size: 13px;
  font-weight: 600;
  color: #5f6368;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-title .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #34d399;
}

.panel-title .dot.input { background: #60a5fa; }
.panel-title .dot.output { background: #34d399; }

.panel-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.btn-icon {
  background: none;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  color: #5f6368;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-icon:hover {
  background: #f1f3f4;
  border-color: #d0d0d0;
  color: #1a1a2e;
}

textarea.original-text {
  width: 100%;
  min-height: 400px;
  padding: 20px;
  border: none;
  outline: none;
  font-family: 'Noto Sans SC', 'Fira Code', monospace;
  font-size: 15px;
  line-height: 2;
  resize: none;
  background: #fff;
  color: #2d2d2d;
}

textarea.original-text::placeholder {
  color: #c0c0c0;
}

textarea.original-text:focus {
  background: #fafcff;
}

textarea.original-text::-webkit-scrollbar {
  width: 6px;
}
textarea.original-text::-webkit-scrollbar-track {
  background: transparent;
}
textarea.original-text::-webkit-scrollbar-thumb {
  background: #d0d0d0;
  border-radius: 3px;
}

.output-panel {
  position: relative;
}

.output-content {
  min-height: 400px;
  padding: 20px;
  font-family: 'Noto Sans SC', 'Fira Code', monospace;
  font-size: 15px;
  line-height: 2;
  white-space: pre-wrap;
  word-break: break-word;
  color: #2d2d2d;
}

.output-content.empty {
  color: #c0c0c0;
  font-style: italic;
}

.diff-added {
  background: #d1fae5;
  color: #065f46;
  border-radius: 3px;
  padding: 1px 3px;
}

.diff-removed {
  background: #fee2e2;
  color: #991b1b;
  text-decoration: line-through;
  border-radius: 3px;
  padding: 1px 3px;
}

/* Action bar */
.action-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 32px;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 36px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: 0 4px 14px rgba(102, 126, 234, 0.35);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.45);
}

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

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

.btn-primary .spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.btn-secondary {
  padding: 14px 24px;
  background: #fff;
  color: #5f6368;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary:hover {
  background: #f9fafb;
  border-color: #d0d0d0;
}

/* Stats bar */
.stats-bar {
  display: flex;
  justify-content: center;
  gap: 32px;
  padding: 20px;
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e8eaed;
  margin-bottom: 32px;
}

.stat-item {
  text-align: center;
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: #667eea;
}

.stat-label {
  font-size: 12px;
  color: #9ca3af;
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Toast notification */
.toast {
  position: fixed;
  bottom: 30px;
  right: 30px;
  background: #1a1a2e;
  color: #fff;
  padding: 14px 24px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 8px 30px rgba(0,0,0,0.2);
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 9999;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast.error {
  background: #ef4444;
}

.toast.success {
  background: #10b981;
}

/* Footer */
footer {
  text-align: center;
  padding: 24px 40px;
  color: #9ca3af;
  font-size: 13px;
  border-top: 1px solid #e8eaed;
  background: #fff;
}

footer a {
  color: #667eea;
  text-decoration: none;
}

/* Usage status bar */
.usage-bar {
  background: #fff;
  border-top: 1px solid #e8eaed;
  padding: 10px 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.usage-info {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.usage-label {
  color: #9ca3af;
  font-weight: 500;
}

.usage-value {
  color: #667eea;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.usage-sep {
  color: #d0d0d0;
}

.usage-link {
  color: #9ca3af;
  font-size: 12px;
  text-decoration: none;
  margin-left: 8px;
  transition: color 0.2s;
}

.usage-link:hover {
  color: #667eea;
}

@media (max-width: 480px) {
  .usage-bar {
    padding: 10px 20px;
    justify-content: center;
  }
}

/* Prompt section */
.prompt-section {
  background: #fff;
  border-radius: 16px;
  border: 1px solid #e8eaed;
  padding: 24px;
  margin-bottom: 24px;
}

.prompt-section label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #5f6368;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

.prompt-section textarea {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  font-family: 'Noto Sans SC', sans-serif;
  font-size: 14px;
  line-height: 1.6;
  resize: vertical;
  min-height: 80px;
  outline: none;
  transition: border-color 0.2s;
}

.prompt-section textarea:focus {
  border-color: #667eea;
}

/* Diff view */
.output-content.hidden,
.diff-content.hidden {
  display: none;
}

.diff-content {
  min-height: 400px;
  padding: 20px;
  font-family: 'Noto Sans SC', 'Fira Code', monospace;
  font-size: 15px;
  line-height: 2;
  white-space: pre-wrap;
  word-break: break-word;
  color: #2d2d2d;
  white-space: pre-wrap;
  word-break: break-word;
}

.diff-del {
  background: #fee2e2;
  color: #b91c1c;
  text-decoration: line-through;
  border-radius: 3px;
  padding: 1px 2px;
  margin: 0 1px;
}

.diff-ins {
  background: #dcfce7;
  color: #15803d;
  border-radius: 3px;
  padding: 1px 2px;
  margin: 0 1px;
}

/* Toggle button active state */
.btn-icon.active {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  border-color: #667eea;
}

/* Char counter */
.char-count {
  font-size: 12px;
  color: #9ca3af;
  margin-left: 12px;
  line-height: 1;
  white-space: nowrap;
}
}
