/* Base styles */
body {
  font-family: 'Consolas', 'Courier New', 'Monaco', monospace, 'Arial', sans-serif; /* Monospace font stack */
  margin: 0;
  padding: 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  font-size: 14px; /* Default font size for readability */
  line-height: 1.5; /* Improve readability with monospace */

  /* Tileable isometric grid background (SVG) */
  background: url('../images/dot_grid.svg') repeat;
  background-size: 20px 20px; /* Match the SVG size for perfect tiling */

  /* Add a subtle vignette effect for more CRT authenticity */
  position: relative;
}

/* Scanline effect - more pronounced */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.15) 0px,  /* Much darker lines */
    rgba(0, 0, 0, 0.15) 1px,
    transparent 1px,
    transparent 4px          /* Even wider spacing */
  );
  pointer-events: none;
  z-index: 1000;
  animation: scanlines 1.5s linear infinite;  /* Even faster animation */
  mix-blend-mode: multiply;
  opacity: 0.9;  /* Higher opacity */
}

/* Faster scanline animation */
@keyframes scanlines {
  0% {
    background-position: 0 0;
  }
  100% {
    background-position: 0 40px;  /* Longer distance for more noticeable movement */
  }
}

/* Scanline toggle */
.scanline-toggle {
  position: fixed;
  bottom: 15px;
  left: 15px;
  background: rgba(58, 58, 58, 0.7);
  color: white;
  border: none;
  border-radius: 4px;
  padding: 5px 10px;
  font-family: 'Consolas', 'Courier New', 'Monaco', monospace;
  font-size: 12px;
  cursor: pointer;
  z-index: 1002;
  transition: all 0.2s;
  width: auto !important; /* Override any width: 100% rules */
  display: inline-block !important; /* Override any display: block rules */
}

.scanline-toggle:hover {
  background: rgba(58, 58, 58, 0.9);
}

/* When scanlines are disabled */
body.no-scanlines::before {
  opacity: 0;
}

/* Reusable app container (for all apps) */
.app-container {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  padding: 20px;
  width: 100%;
  max-width: 1200px; /* Adjusted max-width */
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  flex-direction: row; /* Stack vertically by default */
  align-items: flex-start;
  border: 2px solid #666666; /* Gray border */
  position: relative;
  z-index: 1001;
  margin-top: 50px;
}

/* Glitch text effect for headings */
h2 {
  position: relative;
  color: #333;
  font-family: inherit;
  font-size: 24px;
  text-align: center;
  width: 100%;
  line-height: 1.2;
  margin: 0 0 20px;
  animation: glitch-skew 1s infinite linear alternate-reverse;
}

h2::before,
h2::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

h2::before {
  left: 2px;
  text-shadow: -2px 0 #ff00c1;
  clip: rect(44px, 450px, 56px, 0);
  animation: glitch-anim 5s infinite linear alternate-reverse;
}

h2::after {
  left: -2px;
  text-shadow: 2px 0 #00fff9;
  clip: rect(44px, 450px, 56px, 0);
  animation: glitch-anim2 1s infinite linear alternate-reverse;
}

@keyframes glitch-anim {
  0% {
    clip: rect(31px, 9999px, 94px, 0);
    transform: skew(0.85deg);
  }
  5% {
    clip: rect(70px, 9999px, 30px, 0);
    transform: skew(0.85deg);
  }
  10% {
    clip: rect(33px, 9999px, 26px, 0);
    transform: skew(0.2deg);
  }
  15% {
    clip: rect(76px, 9999px, 81px, 0);
    transform: skew(0.49deg);
  }
  20% {
    clip: rect(20px, 9999px, 42px, 0);
    transform: skew(0.05deg);
  }
  25% {
    clip: rect(35px, 9999px, 56px, 0);
    transform: skew(0.72deg);
  }
  30% {
    clip: rect(54px, 9999px, 22px, 0);
    transform: skew(0.94deg);
  }
  35% {
    clip: rect(21px, 9999px, 90px, 0);
    transform: skew(0.13deg);
  }
  40% {
    clip: rect(72px, 9999px, 5px, 0);
    transform: skew(0.01deg);
  }
  45% {
    clip: rect(28px, 9999px, 99px, 0);
    transform: skew(0.14deg);
  }
  50% {
    clip: rect(86px, 9999px, 73px, 0);
    transform: skew(0.68deg);
  }
  55% {
    clip: rect(1px, 9999px, 16px, 0);
    transform: skew(0.68deg);
  }
  60% {
    clip: rect(20px, 9999px, 7px, 0);
    transform: skew(0.01deg);
  }
  65% {
    clip: rect(98px, 9999px, 2px, 0);
    transform: skew(0.3deg);
  }
  70% {
    clip: rect(48px, 9999px, 53px, 0);
    transform: skew(0.82deg);
  }
  75% {
    clip: rect(62px, 9999px, 21px, 0);
    transform: skew(0.34deg);
  }
  80% {
    clip: rect(94px, 9999px, 49px, 0);
    transform: skew(0.63deg);
  }
  85% {
    clip: rect(54px, 9999px, 85px, 0);
    transform: skew(0.41deg);
  }
  90% {
    clip: rect(63px, 9999px, 59px, 0);
    transform: skew(0.31deg);
  }
  95% {
    clip: rect(18px, 9999px, 11px, 0);
    transform: skew(0.43deg);
  }
  100% {
    clip: rect(67px, 9999px, 17px, 0);
    transform: skew(0.4deg);
  }
}

@keyframes glitch-anim2 {
  0% {
    clip: rect(65px, 9999px, 119px, 0);
    transform: skew(0.02deg);
  }
  5% {
    clip: rect(110px, 9999px, 59px, 0);
    transform: skew(0.39deg);
  }
  10% {
    clip: rect(99px, 9999px, 87px, 0);
    transform: skew(0.59deg);
  }
  15% {
    clip: rect(8px, 9999px, 27px, 0);
    transform: skew(0.2deg);
  }
  20% {
    clip: rect(35px, 9999px, 23px, 0);
    transform: skew(0.25deg);
  }
  25% {
    clip: rect(10px, 9999px, 33px, 0);
    transform: skew(0.44deg);
  }
  30% {
    clip: rect(37px, 9999px, 92px, 0);
    transform: skew(0.7deg);
  }
  35% {
    clip: rect(49px, 9999px, 33px, 0);
    transform: skew(0.28deg);
  }
  40% {
    clip: rect(56px, 9999px, 68px, 0);
    transform: skew(0.43deg);
  }
  45% {
    clip: rect(113px, 9999px, 62px, 0);
    transform: skew(0.58deg);
  }
  50% {
    clip: rect(46px, 9999px, 98px, 0);
    transform: skew(0.13deg);
  }
  55% {
    clip: rect(86px, 9999px, 74px, 0);
    transform: skew(0.85deg);
  }
  60% {
    clip: rect(44px, 9999px, 8px, 0);
    transform: skew(0.6deg);
  }
  65% {
    clip: rect(38px, 9999px, 27px, 0);
    transform: skew(0.61deg);
  }
  70% {
    clip: rect(67px, 9999px, 59px, 0);
    transform: skew(0.94deg);
  }
  75% {
    clip: rect(24px, 9999px, 84px, 0);
    transform: skew(0.63deg);
  }
  80% {
    clip: rect(46px, 9999px, 75px, 0);
    transform: skew(0.07deg);
  }
  85% {
    clip: rect(96px, 9999px, 97px, 0);
    transform: skew(0.12deg);
  }
  90% {
    clip: rect(91px, 9999px, 93px, 0);
    transform: skew(0.49deg);
  }
  95% {
    clip: rect(5px, 9999px, 67px, 0);
    transform: skew(0.05deg);
  }
  100% {
    clip: rect(82px, 9999px, 29px, 0);
    transform: skew(0.21deg);
  }
}

@keyframes glitch-skew {
  0% { transform: skew(0deg); }
  10% { transform: skew(0deg); }
  11% { transform: skew(-0.5deg); }
  12% { transform: skew(0deg); }
  20% { transform: skew(0deg); }
  21% { transform: skew(2deg); }
  22% { transform: skew(0deg); }
  30% { transform: skew(0deg); }
  31% { transform: skew(-1deg); }
  32% { transform: skew(0deg); }
  40% { transform: skew(0deg); }
  41% { transform: skew(-0.5deg); }
  42% { transform: skew(0deg); }
  50% { transform: skew(0deg); }
  51% { transform: skew(1deg); }
  52% { transform: skew(0deg); }
  60% { transform: skew(0deg); }
  61% { transform: skew(-1deg); }
  62% { transform: skew(0deg); }
  70% { transform: skew(0deg); }
  71% { transform: skew(2deg); }
  72% { transform: skew(0deg); }
  80% { transform: skew(0deg); }
  81% { transform: skew(-0.5deg); }
  82% { transform: skew(0deg); }
  90% { transform: skew(0deg); }
  91% { transform: skew(-1deg); }
  92% { transform: skew(0deg); }
  100% { transform: skew(0deg); }
}

/* Controls */
.controls {
  display: flex;
  flex-direction: column;
  gap: 15px; /* Consistent spacing */
  flex: 1;
  min-width: 0; /* Prevent overflow */
  max-width: 50%; /* Limit to half width on desktop */
  padding: 0;
  margin: 0;
}

/* Control groups (for sliders, radios, etc.) */
.control-group {
  display: flex;
  flex-direction: column;
  gap: 5px; /* Tighter spacing within groups */
  padding: 0;
  margin: 0;
  width: 100%; /* Ensure full width for children */
  background-color: rgba(255, 255, 255, 0.9);
  border: 1px solid #666;
  border-radius: 6px;
  padding: 15px;
  margin-bottom: 15px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Section headers for control groups */
.control-group-header {
  font-weight: bold;
  margin-bottom: 12px;
  color: #333;
  border-bottom: 1px solid #ccc;
  padding-bottom: 8px;
}

/* Parameter value styling */
.param-value {
  color: #444;
  font-weight: bold;
}

/* Export section styling */
.export-section {
  margin-top: 20px;
  border-top: 1px solid #666;
  padding-top: 15px;
}

.export-section h3 {
  color: #333;
  font-size: 16px;
  margin: 0 0 15px 0;
  font-weight: bold;
}

/* Download button styling */
button[download],
button.download,
button.download-button,
button[class*="download"],
.download-button,
button:nth-child(1):nth-last-child(1) {
  background-color: #444;
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 10px 15px;
  font-family: 'Consolas', 'Courier New', monospace;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

/* Ensure download buttons are full width on mobile */
@media (max-width: 768px) {
  button[download],
  button.download,
  button.download-button,
  button[class*="download"],
  .download-button,
  button:nth-child(1):nth-last-child(1) {
    width: 100% !important;
    box-sizing: border-box !important;
    display: block !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }
  
  /* Exception for scanline toggle */
  .scanline-toggle {
    width: auto !important;
    display: inline-block !important;
  }
}

/* Labels and inputs */
label {
  font-family: inherit; /* Inherit body's monospace font */
  color: #555;
  font-size: 14px;
  font-weight: 600;
}

input[type="file"],
input[type="range"],
select,
input[type="checkbox"] {
  font-family: inherit; /* Inherit body's monospace font */
  width: 100%; /* Ensure full width */
  padding: 8px;
  border-radius: 6px;
  border: 1px solid #ddd; /* Light gray border */
  background: #fafafa; /* Light gray background */
  transition: all 0.2s; /* Smooth transitions */
  font-size: inherit; /* Inherit body's font size */
  line-height: inherit; /* Inherit body's line height */
  box-sizing: border-box; /* Include padding in width */
}

/* Sliders */
input[type="range"] {
  cursor: pointer;
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  margin: 0;
}

/* Slider track */
input[type="range"]::-webkit-slider-runnable-track {
  height: 8px;
  background: #ddd;
  border-radius: 4px;
}

input[type="range"]::-moz-range-track {
  height: 8px;
  background: #ddd;
  border-radius: 4px;
}

/* Slider thumb (consistent dark gray) */
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  background: #3a3a3a; /* Dark gray thumb */
  border-radius: 50%;
  cursor: pointer;
  margin-top: -4px;
}

input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  background: #3a3a3a; /* Dark gray thumb */
  border-radius: 50%;
  cursor: pointer;
}

/* Hover states for inputs */
input[type="file"]:hover,
input[type="range"]:hover,
select:hover,
input[type="checkbox"]:hover {
  border-color: #888; /* Darker gray on hover */
  background: #f0f0f0; /* Lighter gray on hover */
}

/* Focus states for accessibility */
input[type="file"]:focus,
input[type="range"]:focus,
select:focus,
input[type="checkbox"]:focus {
  outline: 2px solid #3a3a3a; /* Dark gray outline */
  outline-offset: 2px;
}

/* File input button styling (modern browsers) */
input[type="file"].button-group {
  width: 100%; /* Ensure full width */
  padding: 8px 16px; /* Match button padding */
  border: 1px solid #ddd;
  background: #3a3a3a; /* Dark gray button */
  color: #fff;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  margin-right: 0; /* Remove margin for full width */
  box-sizing: border-box; /* Include padding in width */
  display: block; /* Ensure full width */
}

input[type="file"].button-group::file-selector-button {
  font-family: inherit; /* Inherit body's monospace font */
  padding: 8px 16px;
  border: 1px solid #ddd;
  background: #3a3a3a; /* Dark gray button */
  color: #fff;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  margin-right: 8px;
}

input[type="file"].button-group::file-selector-button:hover {
  background: #2d2d2d; /* Slightly darker gray on hover */
  border-color: #888;
}

/* Fallback for older browsers */
input[type="file"].button-group::-webkit-file-upload-button {
  font-family: inherit; /* Inherit body's monospace font */
  padding: 8px 16px;
  border: 1px solid #ddd;
  background: #3a3a3a;
  color: #fff;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

input[type="file"].button-group::-webkit-file-upload-button:hover {
  background: #2d2d2d;
  border-color: #888;
}

/* Ensure file input text ("No file chosen") extends fully */
input[type="file"].button-group::-webkit-file-upload-button + span {
  display: none; /* Hide default text if needed, but we want it to show naturally */
}

/* Radio group styling (for toggle tags like Noise/Custom) */
.radio-group {
  display: flex;
  gap: 8px; /* Tighter spacing for smaller tags */
  flex-wrap: wrap;
  justify-content: flex-start; /* Left-align tags */
  align-items: center; /* Align vertically */
  margin-top: 5px; /* Space from label */
}

/* Hide native radio buttons but keep them functional for Vue */
.radio-group input[type="radio"] {
  display: none; /* Hide the native radio input */
}

/* Style radio button labels as smaller rectangular tags (restored and refined) */
.radio-group label {
  font-family: inherit; /* Inherit body's monospace font */
  padding: 6px 12px; /* Smaller padding for compact tags */
  border-radius: 4px; /* Slightly smaller rounded corners */
  background: #3a3a3a; /* Dark gray background */
  color: #fff; /* White text for contrast */
  cursor: pointer; /* Indicate clickable */
  transition: all 0.2s; /* Smooth transitions */
  font-weight: normal; /* Match other labels */
  font-size: 12px; /* Smaller font for compactness */
  border: 1px solid #3a3a3a; /* Match background for solid look */
  margin: 0; /* Remove default margins */
  display: inline-flex; /* Ensure proper inline alignment */
  align-items: center; /* Center text vertically within tag */
  min-width: 60px; /* Minimum width for readability */
  text-align: center; /* Ensure text centers within tag */
}

/* Hover state for tags */
.radio-group label:hover {
  background: #2d2d2d; /* Slightly darker gray on hover */
  border-color: #2d2d2d; /* Match background */
}

/* Active/selected state for tags (when radio is checked) */
.radio-group input[type="radio"]:checked + label {
  background: #007bff; /* Blue for selected state (matches theme) */
  border-color: #007bff; /* Match background */
  font-weight: 600; /* Slightly bolder for emphasis */
}

/* Add "Selected" text to the selected tag */
.radio-group input[type="radio"]:checked + label::after {
  content: " Selected"; /* Append " Selected" to the label text */
  font-weight: normal; /* Normal weight for "Selected" */
  margin-left: 4px; /* Space between label text and "Selected" */
  opacity: 0.8; /* Slightly transparent for distinction */
  font-size: 10px; /* Slightly smaller for "Selected" text */
}

/* Focus state for accessibility */
.radio-group input[type="radio"]:focus + label {
  outline: 2px solid #3a3a3a; /* Dark gray outline */
  outline-offset: 2px;
}

/* Disabled state for tags (if needed) */
.radio-group input[type="radio"]:disabled + label {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Canvas styling */
canvas {
  display: block;
  border-radius: 8px;
  border: 1px solid #ddd;
  background: #000;
  flex: 1;
  min-width: 0;
  max-width: 50%; /* Limit to half width on desktop */
  height: auto;
  width: 100%; /* Full width within flex container */
  margin-top: 10px;
}

/* Button styling (excluding file inputs for now) */
.button-group {
  display: flex;
  gap: 10px;
  margin-top: 10px;
  width: 100%;
  justify-content: center; /* Default for buttons, but not for file inputs */
  padding: 0;
  margin: 0;
}

button.button-group {
  font-family: inherit; /* Inherit body's monospace font */
  padding: 8px 16px;
  margin: 10px;
  cursor: pointer;
  background: #3a3a3a; /* Dark gray button */
  color: #fff;
  border: none;
  border-radius: 6px;
  transition: all 0.2s;
}

button.button-group:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

button.button-group:hover:not(:disabled) {
  background: #2d2d2d; /* Slightly darker gray on hover */
}

/* Noise Generator-specific color ramp styling */
.color-ramp-container {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0;
  padding: 0;
  margin: 0;
  transition: opacity 0.3s ease;
  width: 100%;
  flex: 0 0 auto;
}

.color-ramp-container p {
  font-family: inherit; /* Inherit body's monospace font */
  margin: 0;
  font-size: 12px;
  line-height: 1; /* Tight for small text */
  padding: 0;
}

.color-ramp-container div {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0;
  margin: 0;
}

.color-ramp-container .button-group {
  margin: 0;
  padding: 0;
  width: auto;
}

.color-ramp-container .button-group button {
  font-family: inherit; /* Inherit body's monospace font */
  padding: 4px 8px;
  font-size: 12px;
  margin: 0;
}

.color-ramp-container div[v-show="false"] {
  opacity: 0;
  visibility: hidden;
}

#colorRampCanvas {
  width: 100%;
  max-width: 300px;
  height: 50px !important;
  object-fit: contain;
  background: transparent;
  border: 1px solid #ddd;
}

/* Texture Distortion App-specific button alignment (can be generalized) */
.app-container .button-group {
  width: 50%; /* Matches controls width for Download button on left */
  margin-left: 0; /* Aligns button to left below controls */
  justify-content: flex-start; /* Left-aligns the button */
  padding: 5px 10px; /* Reduce padding */
  font-size: 14px; /* Smaller font */
}

/* Responsive design for larger screens (≥769px) */
@media (min-width: 769px) {
  .app-container {
    flex-direction: row; /* Side-by-side on desktop */
  }
  .controls {
    max-width: 50%; /* Limit controls to half width */
  }
  canvas {
    max-width: 50%; /* Limit canvas to half width */
  }
  .app-container .button-group {
    width: 50%; /* Limit button width to match */
    margin-left: 0;
    justify-content: center; /* Center buttons below canvases */
  }
  #colorRampCanvas {
    width: 100%;
    max-width: 300px;
  }
}

/* Responsive design for smaller screens (≤768px) */
@media (max-width: 768px) {
  .app-container {
    flex-direction: column;
    padding: 10px;
    width: auto;
    max-width: 100%;
  }
  
  .controls {
    width: 100%;
    margin-right: 0;
    padding: 0;
  }
  
  .pattern-generator-canvas {
    max-width: 100%;
    margin-top: 20px;
  }
  
  /* Improve control groups on small screens */
  .control-group {
    padding: 8px;
    margin-bottom: 10px;
    width: auto;
    box-sizing: border-box;
  }
  
  /* Make sliders more compact on small screens */
  .control-group input[type="range"] {
    margin: 5px 0 10px 0;
    width: 100%;
  }
  
  /* Adjust input fields and selects */
  .control-group input[type="text"],
  .control-group input[type="number"],
  .control-group input[type="file"],
  .control-group select {
    width: 100%;
    box-sizing: border-box;
  }
  
  /* Ensure buttons are full width on mobile EXCEPT scanline toggle */
  button:not(.scanline-toggle) {
    width: 100%;
    box-sizing: border-box;
    display: block;
    text-align: center;
    margin-left: 0;
    margin-right: 0;
  }
}

/* Additional fixes for very small screens */
@media (max-width: 480px) {
  body {
    padding: 10px;
  }
  
  .app-container {
    padding: 8px;
    margin-top: 40px;
    border-radius: 8px;
  }
  
  h2 {
    font-size: 18px;
    margin-bottom: 12px;
  }
  
  .control-group-header {
    font-size: 14px;
    padding-bottom: 5px;
    margin-bottom: 8px;
  }
  
  /* Further reduce padding */
  .control-group {
    padding: 6px;
    margin-bottom: 8px;
  }
  
  /* Adjust button sizes */
  button {
    padding: 6px 10px;
    font-size: 13px;
    width: 100%;
    box-sizing: border-box;
  }
}

/* Custom color picker styling - enhanced version */
.custom-color-picker {
  position: absolute;
  z-index: 1000;
  background: #2a2a2a;
  border: 1px solid #444;
  border-radius: 8px;
  padding: 15px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
  font-family: 'Consolas', 'Courier New', 'Monaco', monospace;
  min-width: 200px;
  color: #eee;
}

.custom-color-picker .picker-header {
  background: #333;
  padding: 8px 10px;
  margin: -15px -15px 15px -15px;
  border-radius: 8px 8px 0 0;
  cursor: move;
  user-select: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #444;
  font-size: 14px;
  font-weight: bold;
}

.custom-color-picker .picker-header::after {
  content: "⋮⋮⋮";
  font-size: 12px;
  color: #777;
  transform: rotate(90deg);
  display: inline-block;
  letter-spacing: -1px;
}

.custom-color-picker input[type="color"] {
  width: 100%;
  height: 50px;
  border: 2px solid #444;
  outline: none;
  cursor: pointer;
  border-radius: 4px;
  background: transparent;
  margin-bottom: 12px;
}

.custom-color-picker .picker-buttons {
  display: flex;
  justify-content: space-between;
  margin-top: 12px;
}

.custom-color-picker button {
  background: #444;
  color: white;
  border: none;
  padding: 8px 15px;
  border-radius: 4px;
  cursor: pointer;
  font-family: 'Consolas', 'Courier New', 'Monaco', monospace;
  font-size: 13px;
  transition: all 0.2s;
  flex: 1;
  margin: 0 5px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.custom-color-picker button:first-child {
  margin-left: 0;
}

.custom-color-picker button:last-child {
  margin-right: 0;
}

.custom-color-picker button:hover {
  background: #555;
}

.custom-color-picker button:active {
  transform: translateY(1px);
}

/* Apply button with emphasis */
.custom-color-picker button:first-child {
  background: #3a6ea5;
}

.custom-color-picker button:first-child:hover {
  background: #4a7eb5;
}

/* Color value display */
.custom-color-picker .color-value {
  font-family: 'Consolas', 'Courier New', 'Monaco', monospace;
  background: #222;
  padding: 6px 8px;
  border-radius: 4px;
  font-size: 12px;
  text-align: center;
  margin-bottom: 12px;
  border: 1px solid #444;
  letter-spacing: 1px;
}

/* More pronounced CRT flicker effect */
body::after {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(18, 16, 16, 0);
  pointer-events: none;
  z-index: 999;
  animation: flicker 0.08s infinite alternate;  /* Faster flicker */
  mix-blend-mode: overlay;
}

/* More noticeable flicker animation */
@keyframes flicker {
  0% {
    opacity: 0.0;
  }
  100% {
    opacity: 0.08;  /* More visible flicker */
  }
}

/* Option to disable flicker separately */
body.no-flicker::after {
  animation: none;
  opacity: 0;
}

/* Add a subtle vignette effect for more CRT authenticity */
body::after {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(
    circle at center,
    transparent 60%,
    rgba(0, 0, 0, 0.2) 100%
  );
  pointer-events: none;
  z-index: 998;
  mix-blend-mode: multiply;
}

/* Remove holographic effect */
.holo-container {
  position: relative;
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1001;
}

/* Remove all animations and effects */
.holo-container::before,
.holo-container::after {
  display: none;
}

/* Reset any animations */
.holo-container {
  animation: none;
  border: none;
  box-shadow: none;
  transition: none;
}

/* Make sure canvas displays properly */
.holo-container canvas {
  border-radius: 0;
}

/* Pattern Generator styles - only the essentials */
.pattern-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  flex: 1;
}

.preview-container {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #333;
  min-height: 300px;
}

.preview-container canvas {
  max-width: 100%;
  max-height: 100%;
  display: block;
  margin: 0 auto;
}

/* Export info styling */
.export-info {
  margin-top: 5px;
  font-size: 0.9em;
  color: var(--text-secondary, #aaa);
}

/* File name display */
.file-name {
  margin-top: 5px;
  font-size: 0.9em;
  color: var(--text-secondary, #aaa);
  word-break: break-all;
}

/* Additional Pattern Generator canvas fixes */
.pattern-controls {
  display: flex;
  flex-direction: column;
  gap: 15px;
  flex: 1;
  min-width: 300px;
}

/* Ensure the preview container has a minimum height */
.preview-container {
  min-height: 300px;
  background: #333; /* Darker background to match your other apps */
}

/* Make sure the canvas is centered and properly sized */
.preview-container canvas {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
  margin: 0 auto;
}

/* Ensure the app container layout works well */
@media (min-width: 768px) {
  .app-container {
    flex-direction: row;
  }
  
  .pattern-controls {
    max-width: 350px;
  }
  
  .pattern-preview {
    flex: 1;
  }
}

@media (max-width: 767px) {
  .app-container {
    flex-direction: column;
  }
  
  .pattern-controls, 
  .pattern-preview {
    width: 100%;
  }
}


.app-container canvas {
  max-width: 100%;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  background: #333;
}


.pattern-generator-canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1/1; /* Force square aspect ratio */
  max-width: 512px;
  max-height: 512px;
  background-color: #000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  border-radius: 4px;
}


.progress-bar {
  width: 100%;
  height: 20px;
  background: #222;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid #444;
  margin: 10px 0;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(to right, #0f0, #00ff9d);
  transition: width 0.3s;
  box-shadow: 0 0 8px rgba(0, 255, 0, 0.5);
}

.progress-text {
  text-align: center;
  margin-top: 5px;
  font-family: 'Consolas', 'Courier New', 'Monaco', monospace;
  color: #2d2d2d;
}


.dashboard-button {
  position: fixed;
  top: 15px;
  right: 15px;
  background: #222;
  color: #00ff00;
  border: 1px solid #00ff00;
  border-radius: 4px;
  padding: 8px 12px;
  font-family: 'Courier New', monospace;
  font-size: 14px;
  cursor: pointer;
  z-index: 1000;
  transition: all 0.2s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.dashboard-button:hover {
  background: #333;
  box-shadow: 0 0 8px rgba(0, 255, 0, 0.5);
}

.dashboard-button svg {
  width: 16px;
  height: 16px;
}

/* Navigation bar styles */
.nav-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: #222;
  border-bottom: 1px solid #00ff00;
  padding: 8px 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 1000;
}

.nav-bar .logo {
  color: #00ff00;
  font-weight: bold;
  font-size: 16px;
  text-decoration: none;
}

.nav-bar .nav-links {
  display: flex;
  gap: 15px;
}

.nav-bar .nav-link {
  color: #00ff00;
  text-decoration: none;
  font-size: 14px;
  opacity: 0.8;
  transition: opacity 0.2s;
}

.nav-bar .nav-link:hover {
  opacity: 1;
}

/* Add these styles to fix the layout issues */
/* Fix layout issues with canvas overflow */
.app-container {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}

.controls {
  width: 300px;
  flex-shrink: 0;
  margin-right: 20px;
}

.pattern-generator-canvas {
  flex: 1;
  min-width: 300px;
  max-width: calc(100% - 340px);
  height: auto;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .app-container {
    flex-direction: column;
  }
  
  .controls {
    width: 100%;
    margin-right: 0;
  }
  
  .pattern-generator-canvas {
    max-width: 100%;
    margin-top: 20px;
  }
}