* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: #f5f5f5;
  padding: 20px;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
}

h1 {
  font-size: 2rem;
  margin-bottom: 20px;
  color: #333;
}

.author-section {
  margin-bottom: 30px;
}

.author-header {
  background: white;
  padding: 15px;
  border-radius: 8px;
  margin-bottom: 15px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.author-header h2 {
  color: #333;
  font-size: 1.5rem;
}

.author-meta {
  color: #666;
  font-size: 0.9rem;
  margin-top: 5px;
}

.groups-grid {
  display: grid;
  gap: 20px;
}

.groups-grid.cols-1 {
  grid-template-columns: 1fr;
}

.groups-grid.cols-2 {
  grid-template-columns: repeat(auto-fill, minmax(450px, 1fr));
}

.groups-grid.cols-3 {
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.group-card {
  background: white;
  border-radius: 8px;
  padding: 15px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  transition: transform 0.2s;
}

.group-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.group-title {
  font-size: 1.1rem;
  margin-bottom: 10px;
  color: #333;
}

.group-type {
  display: inline-block;
  padding: 2px 8px;
  background: #e0e0e0;
  border-radius: 3px;
  font-size: 0.8rem;
  margin-bottom: 10px;
}

.group-type.emoji {
  background: #ffeb3b;
}

.group-type.sticker {
  background: #00B900;
  color: white;
}

.images-grid {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.cols-1 .images-grid {
  grid-template-columns: repeat(4, 1fr);
}

.cols-2 .images-grid {
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
}

.cols-3 .images-grid {
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
}

.stamp-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #f9f9f9;
  border-radius: 4px;
  padding: 5px;
  cursor: pointer;
  transition: transform 0.2s;
  aspect-ratio: 1 / 1;
}

.stamp-image:hover {
  transform: scale(1.05);
}

.loading {
  text-align: center;
  padding: 40px;
  font-size: 1.2rem;
  color: #666;
}

.error {
  background: #ffebee;
  color: #c62828;
  padding: 20px;
  border-radius: 8px;
  margin: 20px 0;
}

.search-box {
  width: 100%;
  padding: 12px;
  font-size: 1rem;
  border: 2px solid #ddd;
  border-radius: 8px;
  margin-bottom: 20px;
}

.search-box:focus {
  outline: none;
  border-color: #00B900;
}

.controls-panel {
  background: white;
  padding: 15px;
  border-radius: 8px;
  margin-bottom: 20px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.controls-row {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
  align-items: center;
}

.control-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.control-group label {
  font-weight: 500;
  color: #333;
  font-size: 0.9rem;
  white-space: nowrap;
}

.search-input {
  flex: 1;
  min-width: 200px;
  padding: 8px 12px;
  font-size: 0.9rem;
  border: 2px solid #ddd;
  border-radius: 4px;
}

.search-input:focus {
  outline: none;
  border-color: #00B900;
}

.author-select {
  padding: 8px 12px;
  font-size: 0.9rem;
  border: 2px solid #ddd;
  border-radius: 4px;
  background: white;
  cursor: pointer;
}

.author-select:focus {
  outline: none;
  border-color: #00B900;
}

.column-btns {
  display: flex;
  gap: 5px;
}

.column-btn {
  padding: 6px 12px;
  background: #e0e0e0;
  color: #333;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.85rem;
}

.column-btn:hover {
  background: #d0d0d0;
}

.column-btn.active {
  background: #00B900;
  color: white;
}

/* モーダル */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(240, 240, 240, 0.98);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.modal-content {
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  width: 100%;
  height: 100%;
}

.modal-image {
  width: 90vw;
  height: 90vh;
  object-fit: contain;
  pointer-events: auto;
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
}

[x-cloak] {
  display: none !important;
}

/* モバイル対応 */
@media (max-width: 768px) {
  /* グループは常に1列 */
  .groups-grid.cols-1,
  .groups-grid.cols-2,
  .groups-grid.cols-3 {
    grid-template-columns: 1fr !important;
  }
  
  /* 画像のみ列数を制御 */
  .cols-1 .images-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  }
  
  .cols-2 .images-grid {
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  }
  
  .cols-3 .images-grid {
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
  }
  
  .cols-1 .stamp-image {
    height: 120px;
  }
  
  .cols-2 .stamp-image {
    height: 90px;
  }
  
  .cols-3 .stamp-image {
    height: 60px;
  }
  
  .control-group label {
    display: none;
  }
  
  .controls-row {
    gap: 10px;
  }
}
