#drawing-overlay {
  background: #0a0a0a url('../assets/images/table1.png') repeat !important;
  background-size: 400px auto !important;
  image-rendering: pixelated;
  display: none;
  flex-direction: column;
  align-items: center;
  padding: 40px 20px;
  overflow-x: hidden;
  user-select: none;
  -webkit-user-select: none;
}

/* Remove default overlay blur/color to show our background */
#drawing-overlay::before {
  display: none !important;
}

/* Premium Vignette Effect */
#drawing-overlay::after {
  content: "";
  position: fixed;
  inset: 0;
  background: radial-gradient(circle, transparent 30%, rgba(0, 0, 0, 0.85) 100%);
  pointer-events: none;
  z-index: 5;
}

#drawing-overlay.visible {
  display: flex !important;
}

.drawing-header {
  text-align: center;
  margin-bottom: 25px;
  animation: fadeInDown 0.6s ease;
}

.drawing-title {
  font-family: var(--font-title);
  color: var(--color-gold);
  font-size: 2rem;
  letter-spacing: 3px;
  margin-bottom: 8px;
}

.drawing-subtitle {
  color: rgba(255, 255, 255, 0.6);
  font-size: 1rem;
}

.drawing-container {
  width: 100%;
  max-width: 1200px;
  display: flex;
  flex-direction: column;
  gap: 30px;
  animation: fadeInUp 0.8s ease;
  position: relative;
  align-items: center;
  padding-bottom: 60px;
}

.drawing-toolbar {
  background: linear-gradient(145deg, #1a1612 0%, #0c0a09 100%);
  border: 1px solid rgba(255, 215, 0, 0.35);
  border-radius: 28px;
  padding: 30px;
  display: flex;
  flex-wrap: wrap;
  gap: 30px;
  align-items: center;
  justify-content: center;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 215, 0, 0.05) inset;
  position: relative;
  z-index: 10;
}

.tool-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.tool-group label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--color-gold);
  font-weight: 700;
}

.color-picker-grid {
  display: flex;
  gap: 8px;
}

.color-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
  transition: all 0.2s ease;
}

.color-dot:hover {
  transform: scale(1.2);
}

.color-dot.active {
  border-color: #fff;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
  transform: scale(1.1);
}

#brush-size {
  width: 120px;
  height: 6px;
  appearance: none;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  outline: none;
}

#brush-size::-webkit-slider-thumb {
  appearance: none;
  width: 18px;
  height: 18px;
  background: var(--color-gold);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

/* Custom RGB and Background Picker Styles */
.custom-picker {
  display: flex !important;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  cursor: pointer;
  background: linear-gradient(45deg, #f03379, #ffd700);
  border: 2px solid rgba(255, 255, 255, 0.5) !important;
}

.bg-picker-input {
  width: 40px;
  height: 40px;
  border: 2px solid var(--color-gold);
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
  padding: 0;
  outline: none;
  transition: transform 0.2s ease;
}

.bg-picker-input:hover {
  transform: scale(1.1);
}

.bg-picker-input::-webkit-color-swatch-wrapper {
  padding: 0;
}

.bg-picker-input::-webkit-color-swatch {
  border: none;
  border-radius: 8px;
}

.tool-switcher {
  display: flex;
  gap: 10px;
}

.draw-action-btn.active {
  background: var(--color-gold);
  color: #000;
  border-color: #fff;
  box-shadow: 0 0 15px rgba(255, 215, 0, 0.4);
}

.draw-action-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  padding: 8px 16px;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.draw-action-btn:hover {
  background: rgba(255, 0, 0, 0.2);
  border-color: rgba(255, 0, 0, 0.4);
}

.canvas-wrapper {
  width: min(95vw, 600px);
  margin: 0 auto;
  background: linear-gradient(145deg, #1a1612 0%, #0c0a09 100%);
  border: 1px solid rgba(255, 215, 0, 0.3);
  border-radius: 32px;
  padding: 30px;
  box-shadow: 0 30px 70px rgba(0,0,0,0.7);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  position: relative;
  z-index: 2;
}

.canvas-actions {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  gap: 20px;
  justify-content: center;
  width: 100%;
  margin-top: 15px;
}

.canvas-actions .draw-action-btn {
  flex: 0 1 auto;
  min-width: 100px;
}

.canvas-square-constraint {
  position: relative;
  width: 100%;
  padding-top: 100%; /* Force perfect 1:1 Aspect Ratio */
  border: 4px solid var(--color-gold);
  border-radius: 0 !important; /* Sharp corners as requested */
  overflow: hidden;
  box-shadow: 0 0 30px rgba(0,0,0,0.8), 0 0 10px rgba(255,215,0,0.1);
  background: #111;
}

#pixel-grid {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 5;
  transition: opacity 0.2s ease;
  
  /* Very thin dark gray grid */
  background-image: 
    linear-gradient(to right, rgba(0, 0, 0, 0.1) 0.5px, transparent 0.5px),
    linear-gradient(to bottom, rgba(0, 0, 0, 0.1) 0.5px, transparent 0.5px);
}

.grid-hidden #pixel-grid {
  display: none !important;
}

#brush-preview {
  position: absolute;
  pointer-events: none;
  display: none;
  z-index: 10;
  box-sizing: border-box;
  transition: transform 0.05s linear; /* Very slight smoothing for snap */
}

.canvas-square-constraint.grid-hidden {
  background-image: none !important;
}

#drawing-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100% !important;
  height: 100% !important;
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background: #fff;
}

.tool-eraser {
  display: flex !important;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.size-val {
  font-size: 0.9rem;
  color: var(--color-gold);
  font-weight: 800;
  min-width: 38px;
  text-align: left;
}

.size-control-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Resolution Specifics */
.res-controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.res-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.res-tag {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.res-tag:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.3);
}

.res-tag.active {
  background: var(--color-gold);
  color: #000;
  border-color: #fff;
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.4);
}

.res-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(0, 0, 0, 0.3);
  padding: 8px 15px;
  border-radius: 10px;
  border: 1px solid rgba(255, 215, 0, 0.2);
  width: fit-content;
}

.res-input-wrap input {
  background: transparent;
  border: none;
  color: var(--color-gold);
  width: 60px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 800;
  outline: none;
}

.res-input-wrap span {
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.8rem;
  font-weight: 600;
}

.bg-picker-container {
  display: flex !important;
  align-items: center;
  gap: 15px;
}

.grid-toggle-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.grid-toggle-wrap input {
  accent-color: var(--color-gold);
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.grid-toggle-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
  opacity: 0.8;
}

.drawing-footer {
  display: flex;
  justify-content: center;
  padding-top: 10px;
}

@media (min-width: 1024px) {
  .drawing-container {
    flex-direction: row;
    align-items: flex-start;
    justify-content: center;
    max-width: 1400px;
    padding-top: 20px;
    gap: 60px;
  }

  .drawing-toolbar {
    width: 320px;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    position: sticky;
    top: 40px;
    margin-left: 0;
  }

  .tool-group {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    width: 100%;
  }

  .color-picker-grid {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .canvas-wrapper {
    margin: 0;
    flex-shrink: 0;
  }
}

@media (max-width: 768px) {
  #drawing-canvas {
    height: 400px;
  }
  
  .drawing-toolbar {
    gap: 15px;
    padding: 15px;
  }
}

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.drawing-input-wrap {
  width: 100%;
  max-width: 500px;
  margin: 0 auto 25px;
}

#drawing-title-input {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 2px solid rgba(255, 215, 0, 0.2);
  color: #fff;
  padding: 12px 5px;
  font-family: var(--font-title);
  font-size: 1.2rem;
  letter-spacing: 1px;
  text-align: center;
  outline: none;
  transition: all 0.3s ease;
  user-select: text !important;
  -webkit-user-select: text !important;
}

#drawing-title-input:focus {
  border-bottom-color: var(--color-gold);
  background: rgba(255, 215, 0, 0.05);
}

#drawing-title-input::placeholder {
  color: rgba(255, 255, 255, 0.2);
  font-size: 1rem;
  letter-spacing: 0;
}

/* Customized Confirm Toast Styling */
.toast--has-actions {
  max-width: 320px;
}

.toast__actions {
  display: flex;
  gap: 12px;
  margin-top: 15px;
  justify-content: flex-end;
}

.toast__action-btn {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  transition: all 0.2s ease;
}

.toast__action-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}

.toast__action-btn--danger {
  background: #ff4757;
  border-color: #ff4757;
  color: #fff;
}

.toast__action-btn--danger:hover {
  background: #ff6b81;
  box-shadow: 0 5px 15px rgba(255, 71, 87, 0.3);
}

.toast__action-btn--secondary {
  opacity: 0.8;
}
