:root {
  --bg: #0b1020;
  --surface: rgba(20, 27, 45, 0.85);
  --surface-hover: rgba(30, 41, 68, 0.9);
  --border: rgba(148, 163, 184, 0.18);
  --border-active: #60a5fa;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --success: #10b981;
  --success-hover: #059669;
  --error-bg: rgba(239, 68, 68, 0.14);
  --error-text: #fca5a5;
  --info-bg: rgba(59, 130, 246, 0.14);
  --info-text: #93c5fd;
  --ok-bg: rgba(16, 185, 129, 0.14);
  --ok-text: #6ee7b7;
  --radius: 16px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  background-color: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
}

.bg-glow {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 20% 15%, rgba(59, 130, 246, 0.2), transparent 45%),
    radial-gradient(circle at 80% 25%, rgba(16, 185, 129, 0.14), transparent 45%),
    radial-gradient(circle at 50% 85%, rgba(99, 102, 241, 0.14), transparent 50%);
  pointer-events: none;
  z-index: -1;
}

.container {
  max-width: 780px;
  margin: 0 auto;
  padding: 48px 20px 36px;
}

.hero {
  text-align: center;
  margin-bottom: 32px;
}

.badge {
  display: inline-block;
  padding: 5px 14px;
  border-radius: 999px;
  font-size: 13px;
  color: #93c5fd;
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(96, 165, 250, 0.25);
  margin-bottom: 14px;
}

.hero h1 {
  font-size: clamp(28px, 5vw, 40px);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 10px;
}

.subtitle {
  color: var(--text-muted);
  font-size: 16px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 24px;
  backdrop-filter: blur(16px);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

.mode-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

.tab {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.6);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: all 0.18s ease;
}

.tab:hover {
  background: var(--surface-hover);
}

.tab.active {
  border-color: var(--border-active);
  background: rgba(59, 130, 246, 0.14);
  box-shadow: 0 0 0 1px rgba(96, 165, 250, 0.35);
}

.tab-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 18px;
  flex-shrink: 0;
}

.word-icon {
  background: rgba(59, 130, 246, 0.22);
  color: #60a5fa;
}

.pdf-icon {
  background: rgba(239, 68, 68, 0.22);
  color: #f87171;
}

.tab-text {
  display: flex;
  flex-direction: column;
}

.tab-text strong {
  font-size: 15px;
}

.tab-text small {
  font-size: 12px;
  color: var(--text-muted);
}

.dropzone {
  border: 2px dashed rgba(148, 163, 184, 0.32);
  border-radius: var(--radius);
  padding: 44px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  background: rgba(15, 23, 42, 0.45);
}

.dropzone:hover,
.dropzone:focus-visible,
.dropzone.dragover {
  border-color: var(--border-active);
  background: rgba(59, 130, 246, 0.08);
  outline: none;
}

.dropzone-icon {
  color: #60a5fa;
  margin-bottom: 12px;
}

.dropzone-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 6px;
}

.dropzone-hint {
  font-size: 13px;
  color: var(--text-muted);
}

.file-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--border);
}

.file-info {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.file-badge {
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  background: rgba(96, 165, 250, 0.2);
  color: #93c5fd;
  flex-shrink: 0;
}

.file-meta {
  min-width: 0;
}

.file-name {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.icon-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 8px;
  transition: background 0.15s ease, color 0.15s ease;
}

.icon-btn:hover {
  background: rgba(148, 163, 184, 0.15);
  color: var(--text);
}

.status-box {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 14px;
}

.status-box.info {
  background: var(--info-bg);
  color: var(--info-text);
}

.status-box.success {
  background: var(--ok-bg);
  color: var(--ok-text);
}

.status-box.error {
  background: var(--error-bg);
  color: var(--error-text);
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(147, 197, 253, 0.3);
  border-top-color: #93c5fd;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

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

.actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

.btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 20px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.18s ease, transform 0.1s ease, opacity 0.18s ease;
}

.btn:active:not(:disabled) {
  transform: scale(0.99);
}

.btn.primary {
  background: var(--primary);
  color: #fff;
}

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

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

.btn.success {
  background: var(--success);
  color: #fff;
}

.btn.success:hover {
  background: var(--success-hover);
}

.features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 28px;
}

.feature-item {
  background: rgba(20, 27, 45, 0.55);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
}

.feature-item h3 {
  font-size: 15px;
  margin-bottom: 6px;
}

.feature-item p {
  font-size: 13px;
  color: var(--text-muted);
}

.footer {
  text-align: center;
  margin-top: 32px;
  font-size: 13px;
  color: var(--text-muted);
}

.hidden {
  display: none !important;
}

.render-stage {
  position: fixed;
  left: -99999px;
  top: 0;
  width: 794px;
  background: #ffffff;
  color: #111827;
  pointer-events: none;
}

@media (max-width: 640px) {
  .mode-tabs,
  .features,
  .actions {
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .card {
    padding: 18px;
  }
}
