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

:root {
  --primary: #FF6900;
  --primary-light: #fff3eb;
  --bg: #f5f5f5;
  --surface: #ffffff;
  --border: #e8e8e8;
  --text-primary: #1a1a1a;
  --text-secondary: #666;
  --text-placeholder: #bbb;
  --radius: 12px;
  --shadow: 0 2px 16px rgba(0,0,0,0.08);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
}

/* Header */
header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 1px 8px rgba(0,0,0,0.06);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

/* Main */
main {
  max-width: 1100px;
  margin: 32px auto;
  padding: 0 16px;
}

/* Translator Card */
.translator-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

/* Scene Bar */
.scene-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 8px 6px 16px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 12px;
}

.scene-label {
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
  flex-shrink: 0;
  padding: 0 4px;
}

.scene-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-wrap: wrap;
}

.scene-tab {
  padding: 6px 16px;
  border: none;
  background: transparent;
  font-size: 14px;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: 6px;
  white-space: nowrap;
  transition: all 0.15s;
  font-family: inherit;
}

.scene-tab:hover {
  background: #f0f0f0;
  color: var(--text-primary);
}

.scene-tab.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}

/* Language Bar */
.lang-bar {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border);
  background: #fafafa;
  padding: 0 8px;
  min-height: 48px;
}

.lang-side {
  flex: 1;
  overflow: hidden;
}

.lang-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px 8px;
  flex-wrap: nowrap;
}

.lang-tab {
  padding: 6px 16px;
  border: none;
  background: transparent;
  font-size: 14px;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: 6px;
  white-space: nowrap;
  transition: all 0.15s;
  font-family: inherit;
}

.lang-tab:hover {
  background: #f0f0f0;
  color: var(--text-primary);
}

.lang-tab.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}

.lang-more {
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  outline: none;
  font-family: inherit;
  margin-left: 4px;
}

.lang-more:focus {
  border-color: var(--primary);
}

/* Swap Button */
.swap-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
  margin: 0 4px;
}

.swap-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

/* Translate Body */
.translate-body {
  display: flex;
  min-height: 320px;
  height: calc(100dvh - 260px);
}

.translate-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
}

.divider {
  width: 1px;
  background: var(--border);
  flex-shrink: 0;
}

/* Source Textarea */
.translate-textarea {
  flex: 1;
  width: 100%;
  border: none;
  outline: none;
  resize: none;
  font-size: 16px;
  line-height: 1.7;
  color: var(--text-primary);
  padding: 20px 20px 8px;
  font-family: inherit;
  background: transparent;
}

.translate-textarea::placeholder {
  color: var(--text-placeholder);
}

/* Result */
.translate-result {
  flex: 1;
  padding: 20px 20px 8px;
  font-size: 16px;
  line-height: 1.7;
  color: var(--text-primary);
  white-space: pre-wrap;
  word-break: break-word;
  background: #fafeff;
  overflow-y: auto;
}

.placeholder-text {
  color: var(--text-placeholder);
  position: relative;
  top: -28px;
  left: -40px;
  font-size: 15px;
}

/* Panel Footer */
.panel-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px 12px;
  min-height: 44px;
}

.char-count {
  font-size: 12px;
  color: var(--text-placeholder);
}

.clear-btn,
.copy-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: 6px;
  font-size: 12px;
  transition: all 0.15s;
  font-family: inherit;
}
.copy-btn:disabled {
  color: #999;
  cursor: not-allowed;
  background: transparent;
  border: none;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 12px;
  transition: all 0.15s;
  font-family: inherit;
}

.clear-btn:hover,
.copy-btn:hover:not(:disabled) {
  background: #f0f0f0;
  color: var(--text-primary);
}

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

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

.copy-btn.copied {
  color: #22c55e;
}

/* Status Area */
.status-area {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Loading Dots */
.loading-dots {
  display: flex;
  align-items: center;
  gap: 4px;
}

.loading-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary);
  animation: bounce 1.2s infinite ease-in-out;
}

.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* Thinking Toggle */
.thinking-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
  margin-right: 4px;
}

.thinking-toggle input {
  display: none;
}

.thinking-track {
  position: relative;
  width: 30px;
  height: 17px;
  background: var(--border);
  border-radius: 999px;
  transition: background 0.2s;
  flex-shrink: 0;
}

.thinking-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.18);
  transition: transform 0.2s;
}

.thinking-toggle input:checked ~ .thinking-track {
  background: var(--primary);
}

.thinking-toggle input:checked ~ .thinking-track .thinking-thumb {
  transform: translateX(13px);
}

.thinking-label {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.thinking-toggle:has(input:checked) .thinking-label {
  color: var(--primary);
}

/* Request time */
.request-time {
  font-size: 11px;
  color: var(--text-placeholder);
  letter-spacing: 0.02em;
}

/* Error */
.error-msg {
  font-size: 13px;
  color: #ef4444;
}

/* Responsive */
@media (max-width: 640px) {
  main {
    margin: 16px auto;
    padding: 0 8px;
  }

  .translate-body {
    flex-direction: column;
    min-height: auto;
  }

  .divider {
    width: 100%;
    height: 1px;
  }

  .translate-panel {
    min-height: 180px;
  }

  .lang-tab {
    padding: 5px 10px;
    font-size: 13px;
  }
}

.bottom-area {
  font-size: 13px;
  color: #999;
  text-align: center;
  margin-bottom: 20px;
}