﻿:root {
      --grid-gap: 1px;
      --cell-ratio: 1;
    }

    [data-theme="dark"] {
      --grid-bg: #1a1a1a;
      --cell-bg: #262626;
      --text-color: #e2e8f0;
      --secondary-text: #a0aec0;
      --border-color: #374151;
      --accent: #63b3ed;
      --accent-hover: #4299e1;
      --placeholder-bg: #2d3748;
    }

    .upload-area {
      border: 2px dashed var(--border-color, #cbd5e0);
      border-radius: 12px;
      padding: 2.5rem 1.5rem;
      text-align: center;
      transition: all 0.2s ease;
      background: var(--placeholder-bg, #f7fafc);
      cursor: pointer;
    }

    .upload-area:hover,
    .upload-area.drag-over {
      border-color: var(--accent, #4299e1);
      background: rgba(99, 179, 237, 0.05);
    }

    .upload-area.drag-over {
      transform: scale(1.01);
    }

    .upload-area p {
      color: var(--secondary-text, #718096);
      margin-bottom: 0.5rem;
    }

    .upload-area svg {
      color: var(--accent, #4299e1);
      margin-bottom: 0.75rem;
    }

    .file-input {
      display: none;
    }

    .grid-container {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: var(--grid-gap, 1px);
      background: var(--grid-bg, #f0f0f0);
      border: var(--grid-gap, 1px) solid var(--grid-bg, #f0f0f0);
      margin: 1.5rem auto;
      max-width: 500px;
      aspect-ratio: 1;
      border-radius: 4px;
      overflow: hidden;
    }

    .grid-cell {
      position: relative;
      aspect-ratio: 1;
      background: var(--cell-bg, #e2e8f0);
      overflow: hidden;
      cursor: pointer;
      transition: opacity 0.2s;
    }

    .grid-cell:hover {
      opacity: 0.85;
    }

    .grid-cell img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      display: block;
    }

    .grid-cell .placeholder {
      position: absolute;
      inset: 0;
      display: flex;
      align-items: center;
      justify-content: center;
      color: var(--secondary-text, #a0aec0);
      font-size: 3rem;
      flex-direction: column;
    }

    .grid-cell .placeholder span {
      font-size: 0.875rem;
      margin-top: 0.5rem;
      font-weight: 500;
    }

    .empty {
      background: var(--placeholder-bg, #e2e8f0);
    }

    .toolbar {
      display: flex;
      flex-wrap: wrap;
      gap: 1rem;
      align-items: center;
      justify-content: center;
      margin-top: 1rem;
    }

    .toolbar .control {
      min-width: 150px;
    }

    .gap-label {
      font-weight: 500;
      color: var(--text-color, #2d3748);
      white-space: nowrap;
    }

    #gridPreview {
      display: none;
    }

    #gridPreview.active {
      display: block;
    }

    .tool-title {
      font-weight: 700;
      letter-spacing: -0.5px;
    }

    .button-group {
      display: flex;
      gap: 0.5rem;
      flex-wrap: wrap;
      justify-content: center;
    }

    .stats {
      text-align: center;
      color: var(--secondary-text, #718096);
      font-size: 0.875rem;
      margin-top: 0.75rem;
    }

    .placeholder-emoji {
      font-size: 4rem;
      line-height: 1;
    }

    .highlight {
      animation: highlight-pulse 0.3s ease;
    }

    @keyframes highlight-pulse {
      0%, 100% { transform: scale(1); }
      50% { transform: scale(1.02); }
    }

    .notice-box {
      background: linear-gradient(135deg, #edf2f7 0%, #e2e8f0 100%);
      border-left: 4px solid var(--accent, #4299e1);
      border-radius: 8px;
      padding: 1rem 1.25rem;
      margin: 1rem 0;
      color: var(--text-color, #2d3748);
    }

    [data-theme="dark"] .notice-box {
      background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
    }

    @media (max-width: 600px) {
      .grid-container {
        max-width: 100%;
      }
      .grid-cell .placeholder {
        font-size: 2rem;
      }
      .grid-cell .placeholder span {
        font-size: 0.75rem;
      }
    }