 :root {
      --primary-color: #de2910;
      --secondary-color: #ffde00;
      --accent-color: #005bb8;
      --light-color: #f8f9fa;
      --dark-color: #212529;
      --success-color: #28a745;
      --border-radius: 8px;
      --box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
      --transition: all 0.3s ease;
    }
    
    * {
      box-sizing: border-box;
      user-select: none;
      margin: 0;
      padding: 0;
    }
    
    body {
      font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
      background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
      color: var(--dark-color);
      line-height: 1.6;
      padding: 20px;
      min-height: 100vh;
    }
    
    .container {
      max-width: 1200px;
      margin: 0 auto;
      background: white;
      border-radius: var(--border-radius);
      box-shadow: var(--box-shadow);
      overflow: hidden;
      position: relative;
    }
    
    .header {
      background: linear-gradient(135deg, var(--primary-color) 0%, #ff6b6b 100%);
      color: white;
      padding: 25px;
      text-align: center;
      position: relative;
      overflow: hidden;
    }
    
    .header::before {
      content: "";
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40' viewBox='0 0 40 40'%3E%3Cpath fill='%23ffde00' fill-opacity='0.2' d='M0 0h40v40H0z'/%3E%3Cpath fill='%23ffde00' fill-opacity='0.12' d='M0 0h20v20H0z'/%3E%3C/svg%3E");
      opacity: 0.3;
    }
    
    .header h1 {
      font-size: 2.2rem;
      margin-bottom: 10px;
      text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.3);
      position: relative;
    }
    
    .header p {
      font-size: 1.1rem;
      opacity: 0.9;
      max-width: 600px;
      margin: 0 auto;
      position: relative;
    }
    
    .national-flag {
      display: inline-block;
      width: 30px;
      height: 20px;
      background: linear-gradient(to right, var(--primary-color) 0%, var(--primary-color) 70%, #ffde00 70%, #ffde00 74%, #005bb8 74%, #005bb8 100%);
      margin: 0 10px;
      border-radius: 2px;
      vertical-align: middle;
    }
    
    .content {
      padding: 25px;
      display: grid;
      grid-template-columns: 1fr;
      gap: 25px;
    }
    
    @media (min-width: 992px) {
      .content {
        grid-template-columns: 1fr 1fr;
      }
    }
    
    .upload-section, .preview-section {
      background: var(--light-color);
      border-radius: var(--border-radius);
      padding: 20px;
      box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    }
    
    .section-title {
      font-size: 1.3rem;
      margin-bottom: 15px;
      color: var(--primary-color);
      display: flex;
      align-items: center;
    }
    
    .section-title i {
      margin-right: 10px;
      font-size: 1.5rem;
    }
    
    .upload-area {
      border: 2px dashed #ccc;
      border-radius: var(--border-radius);
      padding: 30px;
      text-align: center;
      cursor: pointer;
      transition: var(--transition);
      margin-bottom: 20px;
      position: relative;
      min-height: 200px;
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
    }
    
    .upload-area:hover {
      border-color: var(--primary-color);
      background-color: rgba(222, 41, 16, 0.05);
    }
    
    .upload-area i {
      font-size: 3rem;
      color: #6c757d;
      margin-bottom: 15px;
    }
    
    .upload-area p {
      color: #6c757d;
      margin-bottom: 15px;
    }
    
    .upload-area.has-image {
      border-style: solid;
      border-color: var(--success-color);
    }
    
    .upload-area.has-image i, .upload-area.has-image p {
      display: none;
    }
    
    .upload-area img {
      max-width: 100%;
      max-height: 300px;
      border-radius: 4px;
    }
    
    .btn {
      display: inline-block;
      background: var(--primary-color);
      color: white;
      padding: 10px 20px;
      border: none;
      border-radius: var(--border-radius);
      cursor: pointer;
      font-size: 1rem;
      font-weight: 500;
      transition: var(--transition);
      text-align: center;
    }
    
    .btn:hover {
      background: #c8241a;
      transform: translateY(-2px);
      box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    }
    
    .btn-secondary {
      background: var(--secondary-color);
      color: var(--dark-color);
    }
    
    .btn-secondary:hover {
      background: #e6c905;
    }
    
    .btn-sm {
      padding: 6px 12px;
      font-size: 0.9rem;
    }
    
    .category-tabs {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      margin-bottom: 15px;
    }
    
    .category-tab {
      padding: 8px 16px;
      background: #e9ecef;
      border-radius: 20px;
      cursor: pointer;
      transition: var(--transition);
      font-size: 0.9rem;
    }
    
    .category-tab.active {
      background: var(--primary-color);
      color: white;
    }
    
    .category-tab {
      position: relative;
      display: flex;
      align-items: center;
      gap: 6px;
    }
    
    .category-count {
      background: #ff4757;
      color: white;
      border-radius: 10px;
      padding: 2px 6px;
      font-size: 0.75rem;
      font-weight: bold;
      min-width: 18px;
      text-align: center;
      line-height: 1.2;
      box-shadow: 0 2px 4px rgba(255, 71, 87, 0.3);
      animation: pulse 2s infinite;
    }
    
    .category-tab.active .category-count {
      background: rgba(255, 255, 255, 0.2);
      color: white;
      box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    }
    
    @keyframes pulse {
      0% {
        transform: scale(1);
      }
      50% {
        transform: scale(1.05);
      }
      100% {
        transform: scale(1);
      }
    }
    
    .gradients-container {
      margin: 20px 0;
    }
    
    .gradients-scroll {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
      gap: 10px;
      max-height: 300px;
      overflow-y: auto;
      padding: 10px;
      border: 1px solid #eee;
      border-radius: var(--border-radius);
      background: white;
    }
    
    @media (max-width: 767px) {
      .gradients-scroll {
        display: flex;
        flex-wrap: wrap;
        justify-content: space-between;
        gap: 8px;
        max-height: 250px;
        overflow-y: auto;
      }
    }
    
    @media (max-width: 480px) {
      .gradients-scroll {
        display: flex;
        flex-wrap: wrap;
        justify-content: space-between;
        gap: 6px;
        max-height: 220px;
        overflow-y: auto;
      }
    }
    
    @media (max-width: 360px) {
      .gradients-scroll {
        display: flex;
        flex-wrap: wrap;
        justify-content: space-between;
        gap: 4px;
        max-height: 200px;
        overflow-y: auto;
      }
    }
    
    .gradient-item {
      width: 100%;
      aspect-ratio: 1;
      border-radius: 4px;
      overflow: hidden;
      cursor: pointer;
      border: 2px solid transparent;
      transition: var(--transition);
      position: relative;
    }
    
    @media (max-width: 767px) {
      .gradient-item {
        width: calc(33.333% - 6px) !important;
        min-width: 0 !important;
        flex-shrink: 0 !important;
      }
    }
    
    @media (max-width: 480px) {
      .gradient-item {
        width: calc(33.333% - 4px) !important;
        min-width: 0 !important;
        flex-shrink: 0 !important;
      }
    }
    
    @media (max-width: 360px) {
      .gradient-item {
        width: calc(33.333% - 3px) !important;
        min-width: 0 !important;
        flex-shrink: 0 !important;
      }
    }
    
    .gradient-item img {
      width: 100%;
      height: 100%;
      object-fit: cover;
    }
    
    .gradient-item.selected {
      border-color: var(--primary-color);
      box-shadow: 0 0 0 2px white, 0 0 0 4px var(--primary-color);
    }
    
    .gradient-item:hover {
      transform: scale(1.05);
    }
    
    .gradient-loading {
      background: #f0f0f0;
      display: flex;
      justify-content: center;
      align-items: center;
    }
    
    .gradient-loading::after {
      content: "";
      width: 20px;
      height: 20px;
      border: 2px solid #ccc;
      border-top-color: var(--primary-color);
      border-radius: 50%;
      animation: spin 0.8s linear infinite;
    }
    
    @keyframes spin {
      to { transform: rotate(360deg); }
    }
    
    .preview-container {
      position: relative;
      width: 100%;
      margin: 0 auto;
    }
    
    canvas {
      width: 100%;
      height: auto;
      border-radius: var(--border-radius);
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
      background: #f0f0f0;
      display: block;
      max-width: 400px;
      margin: 0 auto;
    }
    
    .watermark-controls {
      background: white;
      border-radius: var(--border-radius);
      padding: 15px;
      margin-top: 20px;
      box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    }
    
    .control-group {
      margin-bottom: 15px;
    }
    
    .control-group label {
      display: block;
      margin-bottom: 5px;
      font-weight: 500;
    }
    
    .control-group input,
    .control-group select {
      width: 100%;
      padding: 10px;
      border: 1px solid #ddd;
      border-radius: 4px;
      font-size: 1rem;
    }
    
    .color-input {
      display: flex;
      align-items: center;
    }
    
    .color-input input {
      flex: 1;
      margin-right: 10px;
    }
    
    .color-preview {
      width: 30px;
      height: 30px;
      border-radius: 4px;
      border: 1px solid #ddd;
    }
    
    .btn-group {
      display: flex;
      gap: 10px;
      margin-top: 20px;
    }
    
    .btn-group .btn {
      flex: 1;
    }
    
    .loading-overlay {
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background: rgba(255, 255, 255, 0.9);
      display: flex;
      justify-content: center;
      align-items: center;
      z-index: 1000;
      opacity: 0;
      visibility: hidden;
      transition: var(--transition);
    }
    
    .loading-overlay.active {
      opacity: 1;
      visibility: visible;
    }
    
    .loading-spinner {
      width: 50px;
      height: 50px;
      border: 5px solid #f3f3f3;
      border-top: 5px solid var(--primary-color);
      border-radius: 50%;
      animation: spin 1s linear infinite;
    }
    
    .toast {
      position: fixed;
      bottom: 20px;
      left: 50%;
      transform: translateX(-50%);
      background: var(--dark-color);
      color: white;
      padding: 12px 20px;
      border-radius: var(--border-radius);
      box-shadow: var(--box-shadow);
      opacity: 0;
      visibility: hidden;
      transition: var(--transition);
      z-index: 1000;
    }
    
    .toast.show {
      opacity: 1;
      visibility: visible;
    }
    
    .toast.success {
      background: var(--success-color);
    }
    
    .toast.error {
      background: var(--primary-color);
    }
    
    .footer {
      text-align: center;
      padding: 20px;
      color: #6c757d;
      font-size: 0.9rem;
      border-top: 1px solid #eee;
      margin-top: 20px;
    }
    
    .national-elements {
      position: absolute;
      top: 10px;
      right: 10px;
      display: flex;
      gap: 5px;
    }
    
    .national-element {
      width: 20px;
      height: 20px;
      background: var(--primary-color);
      border-radius: 50%;
      position: relative;
    }
    
    .national-element::before {
      content: "★";
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      color: var(--secondary-color);
      font-size: 12px;
    }
    
    .filter-controls {
      background: white;
      border-radius: var(--border-radius);
      padding: 15px;
      margin-top: 20px;
      box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    }
    
    .filter-presets {
      display: flex;
      gap: 10px;
      margin-top: 10px;
      flex-wrap: wrap;
    }
    
    .filter-preset {
      padding: 6px 12px;
      background: #e9ecef;
      border-radius: 20px;
      cursor: pointer;
      transition: var(--transition);
      font-size: 0.9rem;
    }
    
    .filter-preset.active {
      background: var(--primary-color);
      color: white;
    }
    
    .tutorial-box {
      background: #e7f5ff;
      border-left: 4px solid var(--accent-color);
      padding: 15px;
      margin: 20px 0;
      border-radius: 4px;
    }
    
    .tutorial-box h4 {
      margin-bottom: 10px;
      color: var(--accent-color);
    }
    
    .tutorial-box ul {
      padding-left: 20px;
    }
    
    .tutorial-box li {
      margin-bottom: 8px;
    }
    
    .comparison-view {
      display: none;
      grid-template-columns: 1fr 1fr;
      gap: 15px;
      margin-top: 20px;
    }
    
    .comparison-view.active {
      display: grid;
    }
    
    .comparison-item {
      text-align: center;
    }
    
    .comparison-item canvas {
      max-width: 100%;
    }

    @media (max-width: 767px) {
      .header h1 {
        font-size: 1.8rem;
      }
      
      .header p {
        font-size: 1rem;
      }
      
      .content {
        padding: 15px;
        gap: 15px;
      }
      
      .upload-area {
        padding: 20px;
        min-height: 150px;
      }
      
      .btn-group {
        flex-direction: column;
      }
      
      .comparison-view {
        grid-template-columns: 1fr;
      }
    }
    
    .mobile-actions {
      position: fixed;
      bottom: 0;
      left: 0;
      right: 0;
      background: white;
      padding: 15px;
      box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
      display: none;
      z-index: 100;
    }
    
    @media (max-width: 767px) {
      .mobile-actions {
        display: flex;
        justify-content: space-around;
      }
      
      body {
        padding-bottom: 80px;
      }
    }
.gradients-scroll::-webkit-scrollbar {
  width: 6px;
}

.gradients-scroll::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 10px;
}