/* ===== RESET Y BASE ===== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
  }
  body {
    font-family: 'Segoe UI', system-ui, sans-serif;
    background: #1a1a2e;
    color: #eee;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding: 20px;
  }
  .app {
    max-width: 1300px;
    width: 100%;
    background: #16213e;
    border-radius: 24px;
    padding: 24px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  }
  
  /* ===== HEADER ===== */
  header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 24px;
  }
  h1 {
    font-weight: 300;
    letter-spacing: 2px;
    color: #f5c842;
    font-size: 1.8rem;
  }
  .user-search {
    display: flex;
    gap: 8px;
    align-items: center;
    background: #0f1a2b;
    padding: 6px 12px;
    border-radius: 40px;
  }
  .user-search input {
    background: transparent;
    border: none;
    color: #eee;
    padding: 8px 12px;
    outline: none;
    width: 180px;
  }
  .user-search button {
    background: #f5c842;
    border: none;
    padding: 6px 18px;
    border-radius: 30px;
    font-weight: 600;
    color: #16213e;
    cursor: pointer;
  }
  .user-search #userStatus {
    font-size: 0.8rem;
    color: #8a9bb0;
    margin-left: 8px;
  }
  
  /* ===== MAIN LAYOUT ===== */
  main {
    display: grid;
    grid-template-columns: 220px 1fr 240px;
    gap: 24px;
  }
  @media (max-width: 1024px) {
    main {
      grid-template-columns: 1fr;
    }
  }
  
  /* ===== PREVIEW ===== */
  .preview-container {
    background: #0f0f1f;
    border-radius: 16px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 2px solid #2a3a5e;
  }
  #avatarPreview {
    max-width: 180px;
    image-rendering: pixelated;
    background: #0a0a15;
    border-radius: 12px;
  }
  .avatar-controls {
    display: flex;
    gap: 12px;
    margin-top: 12px;
  }
  .avatar-controls button {
    background: #1f2a44;
    border: none;
    color: #ccd;
    padding: 6px 14px;
    border-radius: 30px;
    cursor: pointer;
    font-size: 1.2rem;
  }
  
  /* ===== CLOSET ===== */
  .closet {
    background: #0f1a2b;
    border-radius: 16px;
    padding: 16px;
    border: 1px solid #2a3a5e;
  }
  .categories {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 16px;
  }
  .categories button {
    background: #1f2a44;
    border: none;
    color: #aab;
    padding: 6px 14px;
    border-radius: 30px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    transition: 0.2s;
  }
  .categories button.active {
    background: #f5c842;
    color: #16213e;
  }
  .categories button:hover {
    background: #2a3a5e;
    color: #fff;
  }
  
  .items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 10px;
    max-height: 460px;
    overflow-y: auto;
    padding: 6px 2px;
  }
  .items-grid .item-card {
    background: #1a2a44;
    border-radius: 12px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    border: 2px solid transparent;
    transition: 0.2s;
    aspect-ratio: 1 / 1;
    justify-content: center;
  }
  .items-grid .item-card:hover {
    background: #2a3a5e;
    transform: scale(1.03);
  }
  .items-grid .item-card.selected {
    border-color: #f5c842;
    background: #2a3a5e;
  }
  .items-grid .item-card img {
    max-width: 100%;
    max-height: 70%;
    image-rendering: pixelated;
  }
  .items-grid .item-card .item-id {
    font-size: 0.5rem;
    color: #8899aa;
    margin-top: 4px;
  }
  .items-grid .empty {
    grid-column: 1 / -1;
    text-align: center;
    color: #667;
    padding: 30px 0;
  }
  
  /* ===== COLOR PALETTE ===== */
  .color-palette {
    background: #0f1a2b;
    border-radius: 16px;
    padding: 16px;
    border: 1px solid #2a3a5e;
  }
  .color-palette h3 {
    font-weight: 300;
    font-size: 0.9rem;
    color: #aab;
    margin-bottom: 12px;
  }
  .palette-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(28px, 1fr));
    gap: 4px;
    margin-bottom: 16px;
  }
  .palette-grid span {
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: 0.15s;
  }
  .palette-grid span:hover {
    transform: scale(1.15);
  }
  .palette-grid span.active {
    border-color: #f5c842;
    box-shadow: 0 0 10px #f5c84288;
  }
  .custom-color {
    display: flex;
    align-items: center;
    gap: 12px;
  }
  .custom-color input[type="color"] {
    width: 40px;
    height: 40px;
    border: 2px solid #3a4a6e;
    border-radius: 50%;
    padding: 2px;
    background: transparent;
    cursor: pointer;
  }
  .custom-color input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
  }
  .custom-color input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 50%;
  }
  
  /* ===== FOOTER URL ===== */
  footer {
    margin-top: 24px;
  }
  .url-box {
    background: #0f1a2b;
    padding: 10px 16px;
    border-radius: 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid #2a3a5e;
    flex-wrap: wrap;
    gap: 12px;
  }
  .url-box code {
    font-size: 0.7rem;
    color: #8a9bb0;
    word-break: break-all;
    flex: 1;
  }
  .url-box button {
    background: #1f2a44;
    border: none;
    color: #ccd;
    padding: 6px 16px;
    border-radius: 30px;
    cursor: pointer;
    font-size: 0.8rem;
  }
  .url-box button:hover {
    background: #2a3a5e;
    color: #fff;
  }
  
  /* ===== SCROLL ===== */
  .items-grid::-webkit-scrollbar {
    width: 6px;
  }
  .items-grid::-webkit-scrollbar-track {
    background: #0f1a2b;
  }
  .items-grid::-webkit-scrollbar-thumb {
    background: #3a4a6e;
    border-radius: 10px;
  }