body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Inter",
    sans-serif;
  font-size: 14px;
  background: #fafafa;
  color: #171717;
}

/* Hero Section */
.hero-section {
  background: #fff;
  border-bottom: 1px solid #e5e5e5;
  color: #fafafa;
  padding: 15px 20px;
  text-align: center;
  position: relative;
}

.hero-title {
  font-size: 32px;
  font-weight: 600;
  margin: 0 0 8px 0;
  letter-spacing: -0.02em;
  color: #000000;
}

.hero-subtitle {
  font-size: 15px;
  font-weight: 400;
  margin: 0 0 24px 0;
  color: #737373;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
  position: relative;
  z-index: 1;
}

.hero-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
  position: relative;
  z-index: 1;
}

.hero-btn-primary {
  padding: 10px 20px;
  background: #fff;
  color: #171717;
  border: 1px solid #e5e5e5;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.hero-btn-primary:hover {
  border-color: #d4d4d4;
  background: #fafafa;
}

.hero-btn-secondary {
  padding: 10px 20px;
  background: #fff;
  color: #171717;
  border: 1px solid #e5e5e5;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.hero-btn-secondary:hover {
  border-color: #d4d4d4;
  background: #fafafa;
}

.content {
  padding: 2rem;
  text-align: center;
  transition: all 0.3s ease;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.5rem;
  max-width: 1400px;
  margin: 0 auto;
}

.content.scroll-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0;
  scroll-snap-type: y mandatory;
  overflow-y: scroll;
  height: 100vh;
  gap: 0;
}

.content.scroll-view br {
  display: block;
}

.content img {
  width: 100%;
  height: auto;
  object-fit: contain;
  margin-bottom: 0;
  border-radius: 12px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
  transition: all 0.3s ease;
  cursor: pointer;
}

.content.scroll-view img {
  width: 600px;
  height: 100vh;
  max-width: 85vw;
  max-height: 85vh;
  margin: 0;
  padding: 4rem 0;
  display: flex;
  align-items: center;
  justify-content: center;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  object-fit: contain;
  flex-shrink: 0;
}

.content img:hover {
  transform: translateY(-8px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.15);
}

/* Rotation Prompt for Mobile */
.rotation-prompt {
  display: none;
  position: fixed;
  z-index: 3000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.9);
  justify-content: center;
  align-items: center;
}

.rotation-prompt.hidden {
  display: none !important;
}

.rotation-prompt.active {
  display: flex;
}

.rotation-prompt-content {
  background: #fff;
  padding: 40px 30px;
  border-radius: 12px;
  text-align: center;
  max-width: 320px;
  animation: fadeInScale 0.3s ease-out;
}

.rotation-icon {
  font-size: 60px;
  margin-bottom: 20px;
  animation: rotate-pulse 2s ease-in-out infinite;
}

@keyframes rotate-pulse {
  0%,
  100% {
    transform: rotate(0deg) scale(1);
  }
  50% {
    transform: rotate(90deg) scale(1.1);
  }
}

.rotation-prompt-content h3 {
  margin: 0 0 10px 0;
  color: #171717;
  font-size: 20px;
  font-weight: 600;
}

.rotation-prompt-content p {
  margin: 0 0 25px 0;
  color: #737373;
  font-size: 14px;
  line-height: 1.5;
}

.dismiss-rotation-btn {
  padding: 10px 24px;
  background: #171717;
  color: #fff;
  border: 1px solid #171717;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.dismiss-rotation-btn:hover {
  background: #000;
  border-color: #000;
}

/* Modal Styles */
.modal {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.7);
}

/* Welcome Modal */
.welcome-modal {
  max-width: 500px;
  margin: 20% auto;
  padding: 0;
  text-align: center;
  animation: fadeInScale 0.4s ease-out;
  position: relative;
}

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.close-welcome {
  position: absolute;
  top: 15px;
  right: 20px;
  color: #aaa;
  font-size: 32px;
  font-weight: bold;
  cursor: pointer;
  transition: color 0.3s;
  z-index: 1;
}

.close-welcome:hover,
.close-welcome:focus {
  color: #000;
}

.welcome-content {
  padding: 40px 30px;
}

.welcome-content h2 {
  margin: 0 0 10px 0;
  color: #171717;
  font-size: 24px;
  font-weight: 600;
}

.welcome-content h3 {
  margin: 0 0 20px 0;
  color: #737373;
  font-size: 16px;
  font-weight: 400;
  font-style: italic;
}

.welcome-content p {
  margin: 0 0 25px 0;
  color: #525252;
  font-size: 16px;
  line-height: 1.6;
}

.highlight-riso {
  font-family: "Courier New", Courier;
  color: #171717;
  font-style: italic;
}

.view-prints-btn {
  padding: 12px 32px;
  background: #171717;
  color: #fff;
  border: 1px solid #171717;
  border-radius: 6px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.view-prints-btn:hover {
  background: #000;
  border-color: #000;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.modal-content {
  background: #fff;
  margin: 2% auto;
  width: 95%;
  max-width: 1400px;
  border-radius: 12px;
  border: 1px solid #e5e5e5;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1),
    0 10px 10px -5px rgba(0, 0, 0, 0.04);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.modal-header {
  padding: 5px 5px;
  border-bottom: 1px solid #e5e5e5;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  margin: 0;
  color: #171717;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.close {
  color: #aaa;
  font-size: 32px;
  font-weight: bold;
  cursor: pointer;
  transition: color 0.3s;
}

.close:hover,
.close:focus {
  color: #000;
}

.modal-body {
  padding: 10px;
  /* Allow the inner columns to scroll instead of clipping when controls expand */
  overflow-y: auto;
  flex: 1;
}

/* Design Controls */
.design-controls {
  display: flex;
  gap: 15px;
  margin-bottom: 30px;
  flex-wrap: wrap;
  align-items: center;
  padding: 20px;
  background-color: #f8f9fa;
  border-radius: 8px;
}

.design-controls button {
  padding: 12px 24px;
  background-color: #6c757d;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.design-controls button:hover {
  background-color: #5a6268;
  transform: translateY(-2px);
}

.design-controls button.active-tool {
  background-color: #007bff;
  box-shadow: 0 4px 8px rgba(0, 123, 255, 0.3);
}

.design-controls #clearCanvas {
  background-color: #dc3545;
}

.design-controls #clearCanvas:hover {
  background-color: #c82333;
}

.design-controls #downloadDesign {
  background-color: #28a745;
}

.design-controls #downloadDesign:hover {
  background-color: #218838;
}

.tolerance-control {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.tolerance-control label {
  font-weight: 600;
  color: #333;
}

.tolerance-control input[type="range"] {
  width: 150px;
}

/* Design Workspace */
.design-workspace {
  position: relative;
  min-height: 500px;
}

.panel {
  display: none;
}

.panel.active-panel {
  display: block;
}

/* Image Selection Panel */
#imageSelectionPanel h3 {
  margin-bottom: 20px;
  color: #333;
  text-align: center;
}

.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 15px;
  max-height: 600px;
  overflow-y: auto;
  padding: 10px;
}

.image-thumb {
  cursor: pointer;
  border: 3px solid transparent;
  border-radius: 8px;
  padding: 8px;
  transition: all 0.3s ease;
  background-color: #f8f9fa;
}

.image-thumb:hover {
  border-color: #007bff;
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0, 123, 255, 0.2);
}

.image-thumb.selected {
  border-color: #28a745;
  background-color: #d4edda;
  box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

.image-thumb img {
  width: 100%;
  height: auto;
  border-radius: 4px;
  margin-bottom: 5px;
}

.image-thumb p {
  margin: 0;
  text-align: center;
  font-size: 14px;
  color: #666;
}

/* Canvas Panel */
.canvas-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

.canvas-section {
  text-align: center;
}

.canvas-section h4 {
  margin-bottom: 15px;
  color: #333;
  font-size: 18px;
}

canvas {
  border: 2px solid #dee2e6;
  border-radius: 8px;
  max-width: 100%;
  height: auto;
  background-color: white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  display: block;
  margin: 0 auto;
}

#sourceCanvas {
  cursor: default;
}

.instructions {
  background: #fafafa;
  border: 1px solid #e5e5e5;
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 11px;
  max-height: 110px;
  overflow-y: auto;
  transition: opacity 0.3s, visibility 0.3s;
  margin-top: auto;
  line-height: 1.5;
  color: #525252;
}

.instructions.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  bottom: 10px;
}

.instructions-toggle {
  width: 100%;
  padding: 8px 12px;
  background: #fff;
  color: #171717;
  border: 1px solid #e5e5e5;
  border-radius: 6px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 500;
  transition: all 0.15s ease;
  box-sizing: border-box;
}

.instructions-toggle:hover {
  background: #fafafa;
  border-color: #d4d4d4;
}

.instructions-toggle.hidden {
  display: none;
}

.instructions p {
  margin: 4px 0;
  color: #333;
}

.instructions strong {
  color: #007bff;
}

/* Scrollbar styling for image grid */
.image-grid::-webkit-scrollbar {
  width: 10px;
}

.image-grid::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 5px;
}

.image-grid::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 5px;
}

.image-grid::-webkit-scrollbar-thumb:hover {
  background: #555;
}

/* Responsive Design - Tablets and Touch Devices */
@media (max-width: 768px) {
  .canvas-container {
    grid-template-columns: 1fr;
  }

  .modal-content {
    width: 98%;
    margin: 1% auto;
  }

  .design-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .tolerance-control {
    margin-left: 0;
    justify-content: space-between;
  }

  .image-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  }

  /* Switch to vertical layout on mobile */
  .simple-modal .modal-body {
    flex-direction: column;
  }

  .simple-modal .fun-controls {
    width: 100%;
    min-width: 100%;
    max-width: 100%;
    max-height: 40vh;
  }

  .simple-modal .fun-controls.all-collapsed {
    min-width: 100%;
    max-width: 100%;
    max-height: none;
  }

  .simple-canvas-wrap {
    order: 1;
  }

  .fun-controls {
    order: 2;
  }

  .desktop-only {
    display: none !important;
  }

  .mobile-only {
    display: block !important;
  }

  .rotate-btn {
    padding: 12px 20px;
    font-size: 24px;
    min-width: 70px;
  }
}

/* Responsive Design - Mobile Phones */
@media (max-width: 480px) {
  /* Mobile-specific styling for overlay studio */
  .fun-controls {
    flex-direction: column;
    gap: 10px;
    padding: 10px;
  }

  .simple-modal .fun-controls {
    width: 100%;
    min-width: 100%;
    max-width: 100%;
    overflow-y: auto;
    max-height: 40vh;
  }

  .simple-modal .fun-controls.all-collapsed {
    min-width: 100%;
    max-width: 100%;
  }

  .simple-modal .modal-body {
    flex-direction: row !important;
    height: 100%;
    overflow: hidden;
  }

  .simple-modal .fun-controls {
    order: 1;
    width: 140px !important;
    min-width: 140px !important;
    max-width: 140px !important;
    padding: 8px !important;
    font-size: 10px;
    overflow-y: auto !important;
    max-height: 100%;
  }

  .simple-canvas-wrap {
    order: 2;
    flex: 1;
    min-height: 0;
  }

  .canvas-side-controls {
    order: 3;
  }

  .image-control-group {
    min-width: 100%;
    padding: 0;
  }

  .desktop-only {
    display: none !important;
  }

  .mobile-only {
    display: block !important;
  }

  .simple-canvas-wrap {
    padding: 5px;
  }

  #mainCanvas {
    max-width: 100%;
    height: auto;
  }

  .instructions {
    padding: 10px;
    margin-top: 10px;
    font-size: 14px;
  }

  .simple-modal {
    width: 100vw !important;
    height: 100vh !important;
    margin: 0 !important;
    border-radius: 0;
  }

  .simple-modal .modal-body {
    padding: 5px;
  }

  .simple-modal .modal-header {
    padding: 8px;
  }

  .simple-modal .modal-header h2 {
    font-size: 18px;
  }

  .img-btn,
  .clear-btn,
  .save-btn {
    padding: 8px 14px;
    font-size: 14px;
    width: 100%;
  }

  .opacity-control {
    width: 100%;
  }

  .opacity-control input[type="range"] {
    width: 100%;
  }

  .simple-canvas-wrap {
    display: flex !important;
    background: #f8f8f8;
  }

  #mainCanvas {
    max-height: 100%;
    width: auto !important;
    height: auto !important;
  }

  .fun-effects-section {
    padding: 10px;
  }

  .effects-buttons {
    flex-direction: column;
  }

  .effects-buttons button {
    width: 100%;
  }

  .color-palette {
    flex-wrap: wrap;
  }

  .canvas-side-controls {
    width: 140px;
    max-width: 140px;
    min-width: 140px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 10px;
  }

  /* Make the 5 buttons small and icon-only on mobile */
  .canvas-side-controls .img-btn,
  .canvas-side-controls .canvas-control-group {
    padding: 12px;
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    gap: 4px;
    text-align: center;
    min-height: 70px;
  }

  /* Hide the content inside control groups on mobile */
  .canvas-side-controls .canvas-control-group .control-group-content {
    display: none;
  }

  /* Style the headers as icon buttons */
  .canvas-side-controls .canvas-control-group .control-group-header {
    padding: 0;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 16px;
    pointer-events: none;
  }

  .canvas-side-controls .canvas-control-group .collapse-icon {
    display: none;
  }

  /* Make button icons bigger on mobile */
  .canvas-side-controls .btn-icon {
    font-size: 20px;
  }
}

/* Landscape mode on phones */
@media (max-width: 896px) and (max-height: 414px) and (orientation: landscape) {
  .simple-modal {
    height: 100vh !important;
  }

  .simple-canvas-wrap {
    padding: 5px;
  }

  #mainCanvas {
    max-height: 50vh;
  }
}

/* ============================================
   SIMPLE IMAGE OVERLAY STYLES
   ============================================ */

.simple-modal {
  width: 98vw !important;
  height: 95vh !important;
  max-width: none !important;
  max-height: none !important;
  margin: 2.5vh auto !important;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.simple-modal .modal-body {
  flex: 1;
  display: flex;
  flex-direction: row;
  overflow: hidden;
  padding: 10px;
  gap: 10px;
  height: 100%;
  min-height: 0;
}

.simple-modal .fun-controls {
  flex-shrink: 0;
  width: 280px;
  min-width: 180px;
  max-width: 180px;
  padding: 16px;
  /* Scroll only when needed so both Image 1 and 2 controls stay reachable */
  overflow-y: auto;
  overflow-x: hidden;
  flex-direction: column;
  transition: min-width 0.3s ease, max-width 0.3s ease;
  max-height: 100%;
  order: 1;
}

.simple-modal .simple-canvas-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  min-width: 0;
  padding: 15px;
  overflow: hidden;
  order: 2;
}

.simple-modal #mainCanvas {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
}

.simple-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 15px;
  background: #f5f5f5;
  border-radius: 8px;
  margin-bottom: 10px;
  align-items: center;
}

.button-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 4px;
}

.img-btn {
  padding: 8px 12px;
  background: #171717;
  color: white;
  border: 1px solid #171717;
  border-radius: 6px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 500;
  width: 100%;
  transition: all 0.15s ease;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.img-btn:hover {
  background: #000;
  border-color: #000;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.img-btn:active {
  transform: translateY(0);
}

.btn-icon {
  font-size: 14px;
  line-height: 1;
}

.control-icon {
  font-size: 12px;
  margin-right: 4px;
  display: inline-block;
}

.color-palette {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-height: 100px;
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.3s ease;
}

.color-palette.collapsed {
  max-height: 0;
  opacity: 0;
}

.color-swatch {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.fun-controls {
  display: flex;
  flex-wrap: nowrap;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  background: #fff;
  border-radius: 8px;
  border: 1px solid #e5e5e5;
  align-items: stretch;
  overflow: hidden;
  max-height: 100%;
  width: 280px;
  min-width: 280px;
  max-width: 280px;
  flex-shrink: 0;
}

/* Canvas Top Actions Bar */
.canvas-top-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  flex-shrink: 0;
}

.clear-btn-small {
  width: 100%;
  padding: 10px 12px;
  background: #fff;
  color: #171717;
  border: 1px solid #e5e5e5;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.15s ease;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.clear-btn-small:hover {
  background: #fafafa;
  border-color: #d4d4d4;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.save-btn-small {
  width: 100%;
  padding: 10px 12px;
  background: #171717;
  color: #fff;
  border: 1px solid #171717;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.15s ease;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.save-btn-small:hover {
  background: #000;
  border-color: #000;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.fun-effects-btn {
  width: 100%;
  padding: 8px 12px;
  background: #fff;
  color: #171717;
  border: 1px solid #e5e5e5;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.15s ease;
  box-sizing: border-box;
}

.fun-effects-btn:hover {
  background: #fafafa;
  border-color: #d4d4d4;
}

.image-control-group,
.canvas-control-group {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  background: #fff;
  border-radius: 8px;
  border: 1px solid #e5e5e5;
  width: 100%;
  box-sizing: border-box;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  overflow: visible;
  margin-bottom: 6px;
  flex-shrink: 0;
  max-height: none;
}

.control-group-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  background: #fafafa;
  border-bottom: 1px solid #e5e5e5;
  cursor: pointer;
  user-select: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  font-weight: 600;
  font-size: 12px;
  color: #171717;
}

.control-group-header:hover {
  background: #f0f0f0;
}

.control-group-header:active {
  background: #e8e8e8;
  transform: scale(0.99);
}

.collapse-icon {
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 10px;
  color: #737373;
  display: inline-block;
}

.control-group-header.collapsed {
  border-bottom: none;
}

.control-group-header.collapsed .collapse-icon {
  transform: rotate(-90deg);
}

.control-group-content {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px;
  max-height: none;
  overflow: visible;
}

.control-group-content.collapsed {
  display: none;
}

/* Image Preview Slot */
.image-preview-slot {
  width: 100%;
  height: 80px;
  border-radius: 8px;
  background: #fafafa;
  border: 2px dashed #e5e5e5;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  transition: all 0.15s ease;
  cursor: pointer;
}

.image-preview-slot:hover {
  border-color: #d4d4d4;
  background: #f5f5f5;
}

.image-preview-slot[data-empty="false"] {
  border-style: solid;
  border-color: #d4d4d4;
}

.image-preview-slot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
}

.empty-slot-text {
  color: #737373;
  font-size: 11px;
  font-weight: 500;
  text-align: center;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

/* Empty Canvas State */
.empty-canvas-state {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
  z-index: 1;
}

.empty-canvas-state.hidden {
  display: none;
}

.empty-state-icon {
  font-size: 80px;
  margin: 0;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-20px);
  }
}

.empty-state-text {
  font-size: 20px;
  color: #999;
  margin: 10px 0 0 0;
  font-weight: 500;
}

/* Fun Effects Section */
.fun-effects-section {
  padding: 15px;
  background: #fff3e0;
  border-radius: 8px;
  margin-bottom: 15px;
  border: 2px solid #ff9800;
}

.fun-effects-section.hidden {
  display: none;
}

.fun-effects-section h4 {
  margin: 0 0 15px 0;
  color: #e65100;
}

.effects-buttons {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  flex-direction: column;
}

.fun-effects-section-inline {
  padding: 0;
  background: transparent;
  border: none;
}

.instructions-inline {
  padding: 0;
  background: transparent;
  border: none;
}

.instructions-inline p {
  margin: 6px 0;
  color: #525252;
  font-size: 11px;
  line-height: 1.6;
}

.instructions-inline strong {
  color: #171717;
  font-weight: 600;
}

.instructions-inline p:first-child {
  margin-top: 0;
  color: #171717;
  font-size: 12px;
}

/* Desktop/Mobile specific instructions */
.desktop-only {
  display: block;
}

.mobile-only {
  display: none;
}

.fun-btn {
  padding: 10px 16px;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease;
}

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

.fun-btn:active {
  transform: translateY(0);
}

.fun-btn.dots {
  background: #ff6b6b;
}

.fun-btn.dots:hover {
  background: #ee5a5a;
}

.fun-btn.lines {
  background: #4ecdc4;
}

.fun-btn.lines:hover {
  background: #3dbdb5;
}

.fun-btn.mix {
  background: #ffe66d;
  color: #333;
}

.fun-btn.mix:hover {
  background: #ffd93d;
}

.opacity-control {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.opacity-control label {
  font-weight: 600;
  font-size: 11px;
  color: #333;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
  white-space: nowrap;
  min-width: 80px;
  display: flex;
  align-items: center;
  cursor: help;
}

.opacity-control input[type="range"] {
  flex: 1;
  min-width: 0;
}

#opacitySlider {
  width: 100px;
}

.blend-select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #e5e5e5;
  border-radius: 6px;
  font-size: 11px;
  background: #fff;
  cursor: pointer;
  transition: all 0.15s ease;
  box-sizing: border-box;
  color: #171717;
  font-weight: 500;
}

.blend-select:hover {
  border-color: #d4d4d4;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
}

.clear-btn {
  padding: 8px 16px;
  background: rgba(255, 107, 107, 0.2);
  color: #ff6b6b;
  border: 2px solid #ff6b6b;
  border-radius: 10px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.3s ease;
  width: 100%;
  box-sizing: border-box;
}

.clear-btn:hover {
  background: rgba(255, 107, 107, 0.3);
  transform: translateY(-2px);
}

.save-btn {
  padding: 10px 20px;
  background: #171717;
  color: white;
  border: 1px solid #171717;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s ease;
  width: 100%;
  box-sizing: border-box;
}

.save-btn:hover {
  background: #000;
  border-color: #000;
}

.surprise-btn {
  padding: 10px 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.15s ease;
  width: 100%;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.surprise-btn:hover {
  background: linear-gradient(135deg, #5568d3 0%, #653a8f 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* Risograph-specific controls */
.riso-settings {
  background: #fafafa;
  border: 1px solid #e5e5e5;
  padding: 12px;
  border-radius: 8px;
}

.riso-color-select {
  width: 100%;
  padding: 8px;
  border-radius: 6px;
  border: 1px solid #e5e5e5;
  background: #fff;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  box-sizing: border-box;
  margin-top: 4px;
  color: #171717;
}

.riso-color-select:focus {
  outline: none;
  border-color: #d4d4d4;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
}

.misreg-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
  margin-bottom: 8px;
}

.misreg-btn {
  flex: 1;
  min-width: 45px;
  padding: 6px 4px;
  background: #fff;
  border: 1px solid #e5e5e5;
  border-radius: 6px;
  font-size: 9px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  color: #171717;
  box-sizing: border-box;
}

.misreg-btn:hover {
  background: #fafafa;
  border-color: #d4d4d4;
}

.misreg-btn:active {
  transform: translateY(0);
}

.separation-btn {
  width: 100%;
  padding: 10px;
  background: #fff;
  color: #171717;
  border: 1px solid #e5e5e5;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  margin-bottom: 8px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.separation-btn:hover {
  background: #fafafa;
  border-color: #d4d4d4;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.simple-canvas-wrap {
  display: flex;
  flex-direction: row;
  gap: 10px;
  padding: 15px;
  padding-right: 5px;
  background: #f8f8f8;
  border-radius: 12px;
  flex: 1;
  min-height: 0;
  height: 100%;
}

.canvas-container {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  min-height: 0;
  min-width: 0;
  height: 100%;
}

#mainCanvas {
  border: 2px solid #333;
  border-radius: 4px;
  max-width: 100%;
  max-height: 100%;
  background: white;
}

.canvas-side-controls {
  flex-shrink: 0;
  width: 220px;
  max-width: 180px;
  min-width: 180px;
  order: 3;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  background: #fff;
  border-radius: 8px;
  border: 1px solid #e5e5e5;
  overflow: hidden;
}

/* Image Picker */
.image-picker-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 3000;
}

.image-picker-overlay.hidden {
  display: none;
}

.image-picker-content {
  background: white;
  border-radius: 8px;
  width: 90%;
  max-width: 700px;
  max-height: 80vh;
  overflow: hidden;
}

.image-picker-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px;
  background: #fff;
  color: #171717;
  border-bottom: 1px solid #e5e5e5;
}

.image-picker-header h3 {
  margin: 0;
}

.close-picker {
  background: none;
  border: none;
  color: #737373;
  font-size: 24px;
  cursor: pointer;
  transition: color 0.15s ease;
}

.close-picker:hover {
  color: #171717;
}

.image-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 10px;
  padding: 15px;
  overflow-y: auto;
  max-height: calc(80vh - 60px);
}

.image-picker-grid img {
  width: 100%;
  height: 80px;
  object-fit: cover;
  border-radius: 4px;
  cursor: pointer;
  border: 2px solid transparent;
}

.image-picker-grid img:hover {
  border-color: #d4d4d4;
}

/* Range slider */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 10px;
  background: #e5e5e5;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #171717;
  cursor: pointer;
  transition: all 0.15s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.1);
  background: #000;
}

input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #171717;
  cursor: pointer;
  border: none;
}

@media (max-width: 768px) {
  .simple-controls {
    flex-direction: column;
  }

  .opacity-control {
    width: 100%;
  }

  /* Grid adjustments for tablets */
  .content {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    padding: 1.5rem;
  }

  .content img {
    height: 200px;
  }
}

@media (max-width: 480px) {
  /* Grid adjustments for mobile/iPhone */
  .content {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.75rem;
    padding: 1rem;
  }

  .content img {
    height: 150px;
    border-radius: 8px;
  }
}
