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

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: #f2f3fa;
  min-height: 100vh;
  padding: 20px;
}

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 40px;
}

h1 {
  color: #333;
  text-align: center;
  margin-bottom: 10px;
  font-size: 2.5em;
}

p {
  text-align: center;
  color: #666;
  margin-bottom: 30px;
}

.upload-section {
  display: flex;
  gap: 15px;
  justify-content: center;
  align-items: center;
  margin-bottom: 30px;
}

.drop-zone {
  width: 100%;
  max-width: 600px;
  padding: 60px 40px;
  border: 3px dashed #667eea;
  border-radius: 15px;
  background: #f8f9ff;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
}

.drop-zone:hover {
  background: #f0f2ff;
  border-color: #764ba2;
  transform: translateY(-2px);
  box-shadow: 0 5px 20px rgba(102, 126, 234, 0.2);
}

.drop-zone.drag-over {
  background: #e8ebff;
  border-color: #764ba2;
  border-style: solid;
}

.drop-zone.file-selected {
  border-color: #4caf50;
  background: #f1f8f4;
}

.drop-zone-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
}

.upload-icon {
  color: #667eea;
  margin-bottom: 10px;
}

.drop-zone-text {
  font-size: 1.3em;
  color: #333;
  font-weight: 600;
  margin: 0;
}

.drop-zone-hint {
  font-size: 0.9em;
  color: #999;
  margin: 0;
}

.button-section {
  display: flex;
  justify-content: center;
  margin-bottom: 30px;
}

#image-file {
  padding: 10px;
  border: 2px solid #ddd;
  border-radius: 8px;
  font-size: 1em;
}

button {
  padding: 12px 30px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1em;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
}

button:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

button:active {
  transform: translateY(0);
}

.loading {
  text-align: center;
  padding: 40px;
}

.spinner {
  border: 5px solid #f3f3f3;
  border-top: 5px solid #667eea;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.loading p {
  color: #333;
  font-size: 1.2em;
}

.result-section {
  margin-top: 30px;
  text-align: center;
}

.result-section h3 {
  color: #333;
  margin-bottom: 20px;
}

.image-container {
  position: relative;
  border: 2px solid #ddd;
  border-radius: 10px;
  display: inline-block;
  margin-bottom: 20px;
  background-image: linear-gradient(45deg, #ccc 25%, transparent 25%),
    linear-gradient(-45deg, #ccc 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #ccc 75%),
    linear-gradient(-45deg, transparent 75%, #ccc 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}

.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 100;
  border-radius: 8px;
}

.loading-overlay .spinner {
  border: 5px solid #f3f3f3;
  border-top: 5px solid #667eea;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  animation: spin 1s linear infinite;
  margin-bottom: 15px;
}

.loading-overlay p {
  color: #333;
  font-size: 1.1em;
  margin: 0;
}

.close-button {
  position: absolute;
  top: -13px;
  left: -13px;
  width: 32px;
  height: 32px;
  background: rgba(255, 255, 255, 0.95);
  border: 2px solid #e74c3c;
  border-radius: 50%;
  color: #e74c3c;
  font-size: 20px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  z-index: 10;
  padding: 0;
  line-height: 1;
}

.close-button:hover {
  background: #e74c3c;
  color: white;
  transform: scale(1.1);
  box-shadow: 0 3px 10px rgba(231, 76, 60, 0.4);
}

.close-button:active {
  transform: scale(0.95);
}

#result-image {
  display: block;
  max-width: 100%;
  max-height: 500px;
  width: auto;
  height: auto;
}

#download-link {
  display: inline-block;
  padding: 15px 40px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  text-decoration: none;
  border-radius: 8px;
  font-weight: bold;
  font-size: 1.1em;
  transition: all 0.3s ease;
}

#download-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

/* スポイトボタン */
.button-group {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-bottom: 20px;
}

.eyedropper-button {
  padding: 12px 30px;
  background: linear-gradient(135deg, #42a5f5 0%, #478ed1 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1em;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
}

.eyedropper-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(66, 165, 245, 0.4);
}

.eyedropper-button.active {
  background: linear-gradient(135deg, #ff7043 0%, #f4511e 100%);
  box-shadow: 0 3px 10px rgba(255, 112, 67, 0.5);
}

.eyedropper-button:active {
  transform: translateY(0);
}

/* スポイトモード時のカーソル */
.image-container.eyedropper-active {
  cursor: crosshair;
}

.image-container.eyedropper-active #result-image {
  cursor: crosshair;
}

/* 拡大鏡 */
.magnifier {
  position: absolute;
  width: 120px;
  height: 120px;
  border: 3px solid #ff7043;
  border-radius: 50%;
  pointer-events: none;
  z-index: 1000;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  background: white;
}

.magnifier canvas {
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
}

@media (max-width: 768px) {
  .container {
    padding: 20px;
  }

  h1 {
    font-size: 1.8em;
  }

  .upload-section {
    flex-direction: column;
  }

  .drop-zone {
    padding: 40px 20px;
  }

  .drop-zone-text {
    font-size: 1.1em;
  }

  #image-file {
    width: 100%;
  }
}
