@font-face {
    font-family: "Neka Laurent";
    src:
      url("fonts/NekaLaurent.woff2") format("woff2"),
      url("fonts/NekaLaurent.woff") format("woff"),
      url("fonts/NekaLaurent.ttf") format("truetype");
    font-weight: normal;
    font-style: normal;
    font-display: swap;
  }
  
/* ===== Reset & Base ===== */
* {
    box-sizing: border-box;
  }
  
  /* Global image reset to prevent overflow */
  img {
    max-width: 100%;
    height: auto;
    display: block;
  }
  
  body {
    margin: 0;
    padding: 24px;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    color: #111;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
  }
  
  /* ===== Layout Wrapper ===== */
  .wrap {
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
  }
  
  /* ===== Header ===== */
  .heading {
    margin-bottom: 48px;
    text-align: center;
  }
  
  .logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 16px;
  }
  
  .heading .logo {
    max-width: 100%;
    height: auto;
    display: block;
    max-height: 160px;
  }
  
  .fonts-image-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0; /* Allow flex item to shrink */
    max-width: 100%;
  }
  
  .view-styles-hint {
    display: none;
    font-size: 16px;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    white-space: pre-line;
    line-height: 1.4;
    text-align: center;
  }
  
  .heading .fonts-image {
    min-width: 0; /* Critical for flex/grid children */
    max-width: 100%;
    width: 100%;
    height: auto;
    display: block;
    max-height: 160px;
    object-fit: contain;
    cursor: pointer;
    transition: transform 0.2s ease;
  }
  
  .heading .fonts-image:hover {
    transform: scale(1.05);
  }
  
  /* Desktop: Show hint on one line, fonts image before logo */
  @media (min-width: 769px) {
    .logo-container {
      flex-direction: row;
    }
    
    .view-styles-hint {
      display: inline-block;
      white-space: normal;
      font-size: 14px;
    }
    
    .fonts-image-wrapper {
      order: -1; /* Move fonts image wrapper before logo */
    }
  }
  
  @media (max-width: 768px) {
    .logo-container {
      flex-direction: column;
    }
    
    .heading .logo {
      max-height: 120px;
      max-width: 100%;
      width: auto;
    }
    
    .fonts-image-wrapper {
      max-width: 100%;
      width: 100%;
      min-width: 0; /* Critical for flex item shrinking */
      justify-content: center;
      flex-direction: row;
      align-items: center;
    }
    
    .heading .fonts-image {
      min-width: 0; /* Critical for flex/grid children */
      max-width: 80%;
      width: auto;
      max-height: 120px;
      height: auto;
      object-fit: contain;
    }
    
    .view-styles-hint {
      display: inline-block;
    }
    
    /* Color fields container - force to own row on smaller screens */
    .color-fields-container {
      flex: 1 1 100% !important;
      order: 3;
    }
    
    /* Hide desktop buttons, show mobile buttons */
    .preview-btn-desktop,
    .remove-btn-desktop {
      display: none !important;
    }
    
    .entry-buttons-mobile {
      display: flex !important;
      justify-content: flex-start;
      gap: 12px;
      align-items: center;
    }
    
    .preview-btn-mobile {
      padding: 6px 12px;
      font-size: 13px;
      font-weight: 600;
      border-radius: 6px;
      cursor: pointer;
      transition: all 0.2s;
      border: 1px solid #48bb78;
      background: rgba(72, 187, 120, 0.1);
      color: #48bb78;
      white-space: nowrap;
    }
    
    .preview-btn-mobile:active {
      background: rgba(72, 187, 120, 0.2);
    }
    
    .remove-btn-mobile {
      padding: 8px 12px;
      font-size: 13px;
      font-weight: 600;
      border-radius: 8px;
      cursor: pointer;
      transition: all 0.2s;
      border: none;
      background: #e63946;
      color: white;
      white-space: nowrap;
      margin-left: auto; /* Push to the right */
    }
    
    .remove-btn-mobile:active {
      background: #c82333;
    }
    
    .remove-btn-mobile:disabled {
      opacity: 0.5;
      cursor: not-allowed;
    }
  }
  
  /* Desktop: Hide mobile buttons, show desktop buttons */
  @media (min-width: 769px) {
    .entry-buttons-mobile {
      display: none !important;
    }
    
    .preview-btn-desktop,
    .remove-btn-desktop {
      display: inline-block !important;
    }
  }

  .subtitle {
    color: rgba(255, 255, 255, 0.9);
    font-size: 16px;
    margin: 0;
    margin-bottom: 32px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    font-weight: 500;
  }
  
  /* ===== Card Base ===== */
  .card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(255, 255, 255, 0.5);
    position: relative;
    overflow: hidden;
    --bs-card-border-width: 0 !important;
    border-width: 0 !important;
  }

  /* ===== Top Controls ===== */
  .topbar {
    display: flex !important;
    flex-direction: row !important;
    gap: 20px;
    margin: 0 auto 32px;
    margin-top: 40px;
    align-items: flex-end;
    justify-content: center;
    width: fit-content;
    flex-wrap: nowrap;
    padding: 20px 28px;
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(12px);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(255, 255, 255, 0.2);
  }

  .topbar.card {
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(12px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(255, 255, 255, 0.2);
    padding: 20px 28px;
  }
  
  @media (max-width: 768px) {
    .topbar {
      gap: 12px;
      flex-wrap: wrap;
    }
  }
  
  /* ===== Form Fields ===== */
  .field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
  }
  
  .topbar .field {
    flex: 0 0 auto;
    width: auto;
    max-width: none;
  }
  
  .field label {
    font-size: 13px;
    font-weight: 700;
    color: #667eea;
    display: flex;
    align-items: center;
    gap: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }

  .topbar .field label {
    margin-bottom: 4px;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.95);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  }

  .label-icon {
    font-size: 16px;
  }

  .topbar .label-icon {
    font-size: 18px;
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.2));
  }
  
  .field input,
  .field select {
    height: 48px;
    padding: 0 16px;
    font-size: 15px;
    border-radius: 12px;
    border: 2px solid #e0e0e0;
    background: #fff;
    transition: all 0.3s ease;
    font-weight: 500;
    cursor: pointer;
    box-sizing: border-box;
    width: 100%;
  }
  
  .topbar .field {
    width: auto;
  }
  
  .topbar .field input {
    width: 250px;
    border: 2px solid rgba(255, 255, 255, 0.5);
    background: #ffffff;
    backdrop-filter: none;
    color: #333;
    font-weight: 600;
    transition: all 0.3s ease;
  }

  .topbar .field input::placeholder {
    color: #999;
    font-style: italic;
  }

  .topbar .field input:hover {
    border-color: rgba(255, 255, 255, 0.8);
    background: #ffffff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  }
  
  .topbar .field select {
    width: 180px;
    border: 2px solid rgba(255, 255, 255, 0.5);
    background: #ffffff;
    backdrop-filter: none;
    color: #333;
    font-weight: 600;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    padding-right: 40px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
  }

  .topbar .field select:hover {
    border-color: rgba(255, 255, 255, 0.8);
    background-color: #ffffff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  }

  .topbar .field input:focus,
  .topbar .field select:focus {
    border-color: rgba(102, 126, 234, 0.8);
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2), 0 4px 16px rgba(102, 126, 234, 0.3);
    outline: none;
    transform: translateY(-1px);
  }

  .topbar .field select:focus {
    transform: none;
    background-color: #ffffff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
  }

  .field select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23667eea' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 12px;
    padding-right: 40px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
  }

  .field input:focus,
  .field select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1), 0 4px 12px rgba(102, 126, 234, 0.3);
    transform: translateY(-2px);
    background-color: #fff;
  }

  .field input::placeholder {
    color: #999;
    font-style: italic;
  }
  
  /* ===== Canvas Preview ===== */
  /* ===== Canvas Preview ===== */
  /* Sticky preview area - stays at top while scrolling */
  .preview-card {
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1), 0 2px 8px rgba(0, 0, 0, 0.15) !important;
    border-bottom: 2px solid rgba(0, 0, 0, 0.1) !important;
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    display: none !important; /* Hidden by default, shown when first name is typed */
  }
  
  .preview-card.show {
    display: block !important; /* Show when first name is typed */
  }

  .preview-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    font-weight: 700;
    color: #667eea;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }

  .preview-icon {
    font-size: 18px;
  }
  
  .canvas-box {
    width: 100%;
    overflow-x: auto;
    border-radius: 0;
    background: transparent;
    padding: 0px;
    border: none !important;
    box-shadow: none !important;
  }
  
  canvas {
    width: 100%;
    max-width: 100%;
    background: #fff;
    border-radius: 0;
    box-shadow: none !important;
    border: none !important;
  }

  /* ===== Generate STL Button ===== */
  .generate-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 14px 28px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
  }

  .generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
    background: linear-gradient(135deg, #764ba2 0%, #f093fb 100%);
  }

  .generate-btn:active {
    transform: translateY(0);
  }

  .btn-icon {
    font-size: 18px;
    color: white;
  }

  /* ===== Add Another Button ===== */
  .add-another-btn {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 14px 28px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
  }

  .add-another-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
    background: linear-gradient(135deg, #45a049 0%, #3d8b40 100%);
  }

  .add-another-btn:active {
    transform: translateY(0);
  }

  /* ===== Mobile Button Sizes ===== */
  @media (max-width: 768px) {
    .generate-btn,
    .add-another-btn {
      padding: 10px 18px;
      font-size: 14px;
      gap: 6px;
    }
    
    .generate-btn .btn-icon,
    .add-another-btn .btn-icon {
      font-size: 16px;
    }
  }

  /* ===== Username Input (next to Send Order button) ===== */
  #shopUsernameInput {
    height: 48px;
    padding: 0 16px;
    font-size: 15px;
    border-radius: 12px;
    border: 2px solid #e0e0e0;
    background: #fff;
    transition: all 0.3s ease;
    font-weight: 500;
    box-sizing: border-box;
    min-width: 250px;
    max-width: 100%;
  }

  #shopUsernameInput:hover {
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.15);
  }

  #shopUsernameInput:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2), 0 4px 12px rgba(102, 126, 234, 0.3);
    transform: translateY(-1px);
  }

  #shopUsernameInput::placeholder {
    color: #999;
    font-style: italic;
  }

  @media (max-width: 768px) {
    #shopUsernameInput {
      min-width: 200px;
      width: 100%;
    }
  }
  
  /* ===== Color Picker ===== */
  .next-pick-indicator {
    font-size: 14px;
    margin-bottom: 12px;
    color: #667eea;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border-radius: 12px;
    border: 2px dashed rgba(102, 126, 234, 0.3);
  }

  .indicator-icon {
    font-size: 18px;
  }
  
  /* ===== Color Grid ===== */
  .grid {
    display: grid;
    grid-template-columns: repeat(13, 1fr);
    gap: 6px;
  }

  @media (max-width: 768px) {
    .grid {
      grid-template-columns: repeat(10, 1fr);
      gap: 4px;
    }
  }
  
  /* ===== Swatches ===== */
  .swatch {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: 10px;
    padding: 8px 4px;
    text-align: center;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    overflow: hidden;
  }

  .swatch::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
  }

  .swatch:hover::before {
    width: 200px;
    height: 200px;
  }
  
  .swatch:hover {
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    border-color: rgba(102, 126, 234, 0.5);
  }

  .swatch:active {
    transform: translateY(-4px) scale(1.02);
  }
  
  .swatch .dot {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    margin: 0 auto 4px;
    border: 2px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15), inset 0 1px 2px rgba(255, 255, 255, 0.3);
    transition: transform 0.3s ease;
    position: relative;
    z-index: 1;
  }

  .swatch:hover .dot {
    transform: scale(1.2) rotate(5deg);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25), inset 0 2px 4px rgba(255, 255, 255, 0.4);
  }
  
  .swatch .name {
    font-size: 9px;
    font-weight: 700;
    line-height: 1.1;
    color: #333;
    position: relative;
    z-index: 1;
    text-transform: uppercase;
    letter-spacing: 0.3px;
  }
  
  /* ===== Active States ===== */
  .swatch.active-inner {
    border-color: #667eea;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2), 0 4px 12px rgba(102, 126, 234, 0.3);
  }

  .swatch.active-border {
    border-color: #764ba2;
    background: linear-gradient(135deg, rgba(118, 75, 162, 0.1) 0%, rgba(240, 147, 251, 0.1) 100%);
    box-shadow: 0 0 0 2px rgba(118, 75, 162, 0.2), 0 4px 12px rgba(118, 75, 162, 0.3);
  }
  
  /* ===== Floating Decorative Shapes ===== */
  .floating-shapes {
    display: none;
  }

  /* ===== Mobile Spacing Tweaks ===== */
  @media (max-width: 480px) {
    body {
      padding: 14px;
    }
  
    .heading h1 {
      font-size: 24px;
    }

    .heading .emoji {
      font-size: 28px;
    }

    .subtitle {
      font-size: 14px;
    }

    .shape {
      font-size: 20px;
    }
  }