:root {
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --teal: #0d9488;
  --teal-hover: #0f766e;
  --bg-subtle: #f8fafc;
  --border-color: #e2e8f0;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --radius-md: 10px;
  --radius-lg: 14px;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text-main);
  background-color: #f1f5f9;
  line-height: 1.6;
}

.container {
  max-width: 860px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

/* Proxutil Standard Site Header */
.site-header {
  background: #ffffff;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 24px;
}

.masthead {
  max-width: 860px;
  margin: 0 auto;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 11px;
  background: #eef2ff;
  font-size: 1.3rem;
  line-height: 1;
  text-decoration: none;
  transition: transform 0.15s ease;
}

.brand-mark:hover {
  transform: scale(1.06);
}

.brand-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

.brand-copy h1 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.02em;
  color: var(--text-main);
  word-break: keep-all;
}

.brand-copy .subtitle {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.3;
  word-break: keep-all;
}

.home-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  background: #f8fafc;
  color: #334155;
  font-size: 0.84rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.home-button:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: #ffffff;
  transform: translateY(-1px);
}

/* Main Card */
.main-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 20px rgba(15, 23, 42, 0.06);
  border: 1px solid var(--border-color);
  padding: 28px 32px;
}

/* Card Top Status Bar (Top Left Acceleration Badge) */
.card-status-bar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  margin-bottom: 20px;
}

.card-desc {
  color: var(--text-muted);
  font-size: 15px;
  margin: 0 0 20px;
}

/* Mode Selector */
.mode-selector-wrapper {
  margin-bottom: 20px;
}

.mode-selector-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.mode-selector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: #f1f5f9;
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  gap: 4px;
}

.mode-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  border: none;
  background: transparent;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.mode-btn:hover {
  color: var(--text-main);
}

.mode-btn.active {
  background: #ffffff;
  color: var(--primary);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}

.mode-btn .mode-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  background: #e2e8f0;
  color: #475569;
}

.mode-btn.active .mode-badge {
  background: #eef2ff;
  color: var(--primary);
}

/* Dropzone */
.dropzone {
  border: 2px dashed #cbd5e1;
  border-radius: var(--radius-md);
  padding: 44px 24px;
  text-align: center;
  background-color: var(--bg-subtle);
  cursor: pointer;
  transition: all 0.2s ease;
}

.dropzone:hover, .dropzone.is-dragover {
  border-color: var(--primary);
  background-color: #eef2ff;
}

.dropzone-icon {
  font-size: 42px;
  margin-bottom: 10px;
}

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

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

/* File Info */
.file-info-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: var(--bg-subtle);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  margin-bottom: 24px;
}

.file-title {
  font-weight: 600;
  font-size: 15px;
}

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

.btn-secondary {
  background: #ffffff;
  border: 1px solid var(--border-color);
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-secondary:hover {
  background: #f8fafc;
}

/* Options */
.options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 6px;
}

.form-select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 14px;
  background-color: #ffffff;
  outline: none;
}

.form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

/* Action Button */
.btn-primary {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--primary) 0%, #4338ca 100%);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
  transition: opacity 0.15s;
}

.btn-primary:hover {
  opacity: 0.95;
}

/* Progress */
.progress-card {
  padding: 28px;
  text-align: center;
}

.progress-track {
  height: 10px;
  background: #e2e8f0;
  border-radius: 5px;
  overflow: hidden;
  margin: 16px 0;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--teal) 0%, var(--primary) 100%);
  width: 0%;
  transition: width 0.3s ease;
}

/* Tabs & Preview */
.tabs-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.tab-btn {
  padding: 8px 16px;
  border: 1px solid var(--border-color);
  background: #f8fafc;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-muted);
}

.tab-btn.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.preview-textarea {
  width: 100%;
  height: 320px;
  box-sizing: border-box;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
  padding: 14px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background-color: #0f172a;
  color: #f1f5f9;
  line-height: 1.5;
  resize: vertical;
}

.actions-row {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.actions-row .btn-primary {
  flex: 2;
}

.actions-row .btn-secondary {
  flex: 1;
}

.hidden {
  display: none !important;
}

.badge {
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 12px;
  font-weight: 600;
}
.badge-success { background: #dcfce7; color: #166534; }
.badge-neutral { background: #f1f5f9; color: #475569; }
.badge-warning { background: #fef3c7; color: #92400e; }

/* Multi-track Notice Card */
.track-notice-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: #f0fdfa;
  border: 1px solid #ccfbf1;
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-top: 16px;
  font-size: 13px;
  line-height: 1.5;
  color: #134e4a;
}

.track-notice-icon {
  font-size: 18px;
  line-height: 1;
  flex-shrink: 0;
}

.track-notice-content strong {
  display: block;
  font-weight: 700;
  margin-bottom: 2px;
  color: #0f766e;
}

.track-notice-content p {
  margin: 0;
  color: #115e59;
}

/* Responsive Mobile Optimization */
@media (max-width: 640px) {
  .masthead {
    padding: 12px 16px;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
  }

  .brand-lockup {
    gap: 10px;
    align-items: center;
    flex: 1 1 auto;
    min-width: 0;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    font-size: 1.15rem;
    border-radius: 10px;
  }

  .brand-copy h1 {
    font-size: 1.05rem;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0;
  }

  .brand-copy .subtitle {
    display: none !important;
  }

  .home-button {
    padding: 6px 12px;
    font-size: 0.82rem;
    gap: 4px;
    min-height: 32px;
    flex-shrink: 0;
  }

  .container {
    padding: 12px 10px 36px;
  }

  .main-card {
    padding: 20px 14px;
    border-radius: 12px;
  }

  .card-status-bar {
    margin-bottom: 16px;
  }

  .mode-selector {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .mode-btn {
    padding: 10px 12px;
    font-size: 13px;
  }

  .options-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .actions-row {
    flex-direction: column;
    width: 100%;
  }

  .actions-row .btn-primary,
  .actions-row .btn-secondary {
    width: 100%;
  }

  .preview-textarea {
    height: 240px;
    font-size: 12px;
    padding: 10px;
  }

  .track-notice-card {
    padding: 12px;
    font-size: 12px;
  }
}

@media (max-width: 380px) {
  .brand-copy h1 {
    font-size: 0.95rem;
  }

  .home-button {
    padding: 5px 10px;
    font-size: 0.78rem;
  }
}

