body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.5;
  color: #333;
  max-width: 900px;
  margin: 0 auto;
  padding: 15px;
  background-color: #f9f9f9;
  box-sizing: border-box;
}

*, *:before, *:after {
  box-sizing: inherit;
}

h1 {
  text-align: center;
  font-size: 2rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 480px) {
  h1 {
    font-size: 1.7rem;
    margin-bottom: 1rem;
  }
}

.app {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  background: white;
  border-radius: 8px;
  padding: 1.5rem;
  border: 1px solid #e0e0e0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  width: 100%;
}

@media (max-width: 480px) {
  .app {
    padding: 1rem;
    gap: 1rem;
  }
}

/* Controls section */
.controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  width: 100%;
}

.mode-toggle {
  display: flex;
  margin-bottom: 1rem;
}

.mode-toggle label {
  display: flex;
  align-items: center;
  margin-right: 1rem;
  cursor: pointer;
}

.mode-toggle input[type="radio"] {
  margin-right: 0.5rem;
}

.upload-zone {
  width: 100%;
  max-width: 500px;
  height: 120px;
  border: 2px dashed #ccc;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s;
  background-color: #f9f9f9;
  padding: 10px;
}

@media (max-width: 480px) {
  .upload-zone {
    height: 100px;
  }
}

.upload-zone:hover, 
.upload-zone:active {
  border-color: #666;
  background-color: #f5f5f5;
}

.upload-zone svg {
  width: 36px;
  height: 36px;
  margin-bottom: 8px;
  color: #666;
}

@media (max-width: 480px) {
  .upload-zone svg {
    width: 28px;
    height: 28px;
    margin-bottom: 5px;
  }
}

.upload-zone p {
  margin: 0;
  color: #666;
  text-align: center;
  font-size: 1rem;
}

@media (max-width: 480px) {
  .upload-zone p {
    font-size: 0.9rem;
  }
}

.upload-zone input {
  display: none;
}

.process-btn {
  padding: 12px 24px;
  font-size: 1rem;
  background-color: #4285f4;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.2s;
  width: 100%;
  max-width: 500px;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.process-btn:hover,
.process-btn:active {
  background-color: #3367d6;
}

.process-btn:disabled {
  background-color: #ccc;
  cursor: not-allowed;
}

/* Images section */
.images {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  width: 100%;
}

@media (max-width: 768px) {
  .images {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
}

.image-panel {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.image-container {
  position: relative;
  min-height: 200px;
  border-radius: 8px;
  overflow: hidden;
  background-color: #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #e0e0e0;
}

@media (max-width: 480px) {
  .image-container {
    min-height: 150px;
  }
}

.image-container img {
  max-width: 100%;
  max-height: 350px;
  object-fit: contain;
}

.image-placeholder {
  color: #666;
  font-size: 0.9rem;
  text-align: center;
  padding: 0 10px;
}

.image-label {
  font-weight: 500;
  color: #333;
}

/* Download button */
.download-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  margin-top: 10px;
  background-color: #34a853;
  color: white;
  text-decoration: none;
  border-radius: 8px;
  transition: background-color 0.2s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.download-btn:hover,
.download-btn:active {
  background-color: #2d8d46;
}

.download-btn svg {
  width: 16px;
  height: 16px;
}

/* Loading spinner */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, .3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 1s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Footer */
.footer {
  margin-top: 20px;
  text-align: center;
  font-size: 0.9rem;
  color: #666;
}

.footer a {
  color: #4285f4;
  text-decoration: none;
}

.footer a:hover,
.footer a:active {
  text-decoration: underline;
}

/* Add this for better mobile scrolling */
@media (max-width: 768px) {
  html, body {
    overflow-x: hidden;
    position: relative;
    width: 100%;
    -webkit-overflow-scrolling: touch;
  }
}

/* Add viewport orientation handling */
@media screen and (orientation: portrait) and (max-width: 480px) {
  .app {
    padding: 0.8rem;
  }
}
