body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  margin: 0;
  padding: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}

.nav-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: white;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  z-index: 1000;
  -webkit-overflow-scrolling: touch;
}

.nav-links {
  display: flex;
  gap: 1rem;
  margin: 0 auto;
  flex-wrap: wrap;
  padding: 0.75rem 1.5rem;
}

.nav-link {
  color: #495057;
  text-decoration: none;
  padding: 0.625rem 1rem;
  border-radius: 8px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
}

.nav-link:hover {
  background: #f1f5f9;
  color: #0d6efd;
  transform: translateY(-1px);
}

.nav-link.active {
  background: #e8f0fe;
  color: #0d6efd;
  font-weight: 600;
}

.nav-link svg {
  width: 16px;
  height: 16px;
  transition: transform 0.2s ease;
  opacity: 0.85;
}

.nav-link:hover svg {
  transform: scale(1.05);
  opacity: 1;
}

.container {
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(5px);
  border-radius: 12px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  padding: 1.5rem;
  max-width: 1200px;
  width: calc(100% - 2rem);
  margin: 5rem auto 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-sizing: border-box;
}

.panels-container {
  width: 100%;
  margin-top: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.main-panel {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* 背景色工具特定样式 */
.background-tool .main-content {
  width: 100%;
  display: flex;
  flex-direction: row;
  gap: 1rem;
  align-items: stretch;
}

.background-tool .file-inputs-container {
  width: 50%;
}

.background-tool .preview-container {
  width: 50%;
}

h1 {
  color: #1a1a1a;
  margin: 0 0 0.75rem 0;
  font-weight: 600;
  text-align: center;
  width: 100%;
}

.file-inputs-container {
  display: flex;
  gap: 1rem;
  width: 100%;
  margin: 0;
}

.file-input {
  flex: 1;
  margin: 0;
  padding: 1rem;
  background: #f8f9fa;
  border-radius: 8px;
  border: 2px dashed #0d6efd;
  transition: all 0.2s;
  position: relative;
  box-shadow: 0 2px 4px rgba(13, 110, 253, 0.05);
  height: 160px;
  box-sizing: border-box;
}

.file-input:hover {
  border-color: #0b5ed7;
  background: #f8f9fa;
  box-shadow: 0 4px 6px rgba(13, 110, 253, 0.1);
}

.file-input.dragover {
  border-color: #0d6efd;
  background: #e8f0fe;
  transform: scale(1.01);
}

.file-input .drop-zone {
  padding: 0;
  text-align: center;
  color: #6c757d;
  cursor: pointer;
  position: relative;
  background: white;
  border-radius: 6px;
  margin: 0;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  height: 100%;
  justify-content: center;
}

.file-input.loading .drop-zone {
  pointer-events: none;
  opacity: 0.7;
}

.file-input .drop-zone span {
  display: block;
  line-height: 1.4;
  font-size: 0.9rem;
  color: #495057;
}

.file-input .selected-file {
  margin-top: 0.5rem;
  padding: 0.5rem;
  background: white;
  border-radius: 4px;
  font-size: 0.85rem;
  color: #495057;
  word-break: break-all;
  display: none;
  border: 1px solid #e9ecef;
}

.file-input.has-file .selected-file {
  display: block;
}

.file-input input[type="file"] {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  opacity: 0;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  border: none;
  outline: none;
  background: transparent;
}

.options {
  margin: 0.25rem 0;
  padding: 0.75rem;
  background: #f8f9fa;
  border-radius: 8px;
  border: 1px solid #e9ecef;
}

.option-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  position: relative;
}

.preview-container {
  width: 100%;
  height: 160px;
  margin: 0;
  padding: 0.75rem;
  background: #f8f9fa;
  border-radius: 8px;
  border: 2px dashed #0d6efd;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(13, 110, 253, 0.05);
  box-sizing: border-box;
}

#previewCanvas {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 4px;
}

.option-group input[type="color"] {
  width: 50px;
  height: 30px;
  padding: 0;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.option-group #colorValue {
  font-family: monospace;
  font-size: 0.9rem;
  color: #495057;
  padding: 0.25rem 0.5rem;
  background: white;
  border-radius: 4px;
  border: 1px solid #e9ecef;
}

button {
  width: 100%;
  padding: 0.75rem;
  background: #0d6efd;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 0.75rem;
  box-shadow: 0 2px 4px rgba(13, 110, 253, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

button:hover {
  background: #0b5ed7;
  transform: translateY(-1px);
  box-shadow: 0 4px 6px rgba(13, 110, 253, 0.25);
}

button:disabled {
  background: #6c757d;
  cursor: not-allowed;
  box-shadow: none;
  opacity: 0.8;
}

.progress {
  display: none;
  margin-top: 1rem;
  padding: 1rem;
  background: #f8f9fa;
  border-radius: 8px;
  border: 1px solid #e9ecef;
}

.progress-bar {
  height: 6px;
  background: #e9ecef;
  border-radius: 3px;
  overflow: hidden;
  margin: 0.5rem 0;
}

.progress-bar-fill {
  height: 100%;
  background: #0d6efd;
  width: 0;
  transition: width 0.3s ease;
}

.progress-text {
  font-size: 0.9rem;
  color: #6c757d;
  text-align: center;
}

.alert {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 1rem 1.5rem;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  animation: slideIn 0.3s ease-out;
  z-index: 1000;
  max-width: 400px;
}

.alert.success {
  background: #d1e7dd;
  border: 1px solid #badbcc;
  color: #0f5132;
}

.alert.error {
  background: #f8d7da;
  border: 1px solid #f5c2c7;
  color: #842029;
}

.alert .icon {
  font-size: 1.2rem;
  flex-shrink: 0;
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@media (max-width: 768px) {
  .nav-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .nav-content {
    padding: 0.75rem 1rem;
    margin: 0 auto;
  }

  .nav-link {
    padding: 0.5rem 0.875rem;
    font-size: 0.95rem;
  }

  .nav-links {
    gap: 0.75rem;
  }

  .nav-link svg {
    width: 16px;
    height: 16px;
  }

  .background-tool .main-content {
    flex-direction: column;
  }

  .background-tool .file-inputs-container,
  .background-tool .preview-container {
    width: 100%;
  }

  .tooltip {
    display: none !important;
  }
}

@media (max-width: 600px) {
  .container {
    padding: 1rem;
    margin-top: 3.5rem;
  }
  
  h1 {
    font-size: 1.5rem;
  }
}