:root {
  --primary: #4a6fa5;
  --secondary: #6b8cae;
  --dark: #2a3d5d;
  --light: #f0f5ff;
  --accent: #ff8c00;
}

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

}

h1 {
  font-family: 'Pixelify Sans', sans-serif;
}

body {
  /* 1. Define the body as a grid container */
  display: grid;

  /* 2. Create three columns: 
     - A flexible left column (1fr)
     - A central content column that won't exceed 1200px
     - A flexible right column (1fr)
  */
  grid-template-columns: 1fr minmax(auto, 1200px) 1fr;

  /* Remove previous padding to allow columns to reach the edge */
  padding: 0;

  /* Keep your background and font color */
  background: #0d042a;
  color: var(--light);
  line-height: 1.6;
  min-height: 100vh;
}

body.mobile {
  grid-template-columns: 1fr;
  /* Only one column */
}

body.mobile .app-container {
  display: block;
  /* Stack panels vertically */
  width: 100%;
  gap: 0;
}

body.mobile #left-ad-column,
body.mobile #right-ad-column {
  display: none;
}

/* Make sure the main content is in the second column */
#main-content {
  grid-column: 2;
  padding: 20px;
  /* Add padding here instead of on the body */
}

/* Basic styling for the ad columns */
.ad-column {
  grid-row: 1;
  /* Ensure they stay on the same row as main-content */
  padding: 20px;
  /* You can add ad-specific styling here */
}

#left-ad-column {
  grid-column: 1;
}

#right-ad-column {
  grid-column: 3;
}


/* --- Responsive Breakpoint for Smaller Screens --- */
/* On screens 1600px or narrower, we'll stack the layout */
@media (max-width: 1600px) {
  body {
    /* Switch to a single-column layout */
    grid-template-columns: 1fr;
  }

  #main-content {
    /* Ensure main content is in the first row */
    grid-column: 1;
    grid-row: 1;
  }

  /* Hide the ad columns on smaller screens, or stack them below */
  .ad-column {
    display: none;
    /* Or, to stack them: */
    /*
    grid-column: 1;
    grid-row: 2;
    */
  }
}


.container {
  max-width: 1200px;
  margin: 0 auto;
}



header {
  text-align: center;
  margin-bottom: 30px;
  padding: 20px;
  border-bottom: 2px solid var(--accent);
}

h1 {
  font-size: 2.5rem;
  margin-bottom: 10px;
  color: var(--accent);
  text-shadow: 0 0 10px rgba(255, 107, 107, 0.3);
}

.subtitle {
  color: #a3b1cc;
  font-size: 1.1rem;
}

.app-container {
  /* max-width: 300px; */
  /* --- MODIFIED LINES --- */
  display: grid;
  grid-template-columns: 1fr 1fr;
  /* Create two equal-fraction columns */

  gap: 30px;
  margin-bottom: 30px;

}

.panel {
  /* font-family: 'Pixelify Sans', sans-serif;

  padding: 20px; */
  background: rgba(30, 40, 60, 0.5);
  border: .2rem solid black;
  padding-top: 15px;

  position: relative;
  box-shadow: inset 0 0 1px var(--accent),
    inset 0 0 15px rgba(255, 204, 0, 0.7);

  padding: 25px;
  font-family: 'Pixelify Sans', sans-serif;
  padding: 25px;
}

.panel h2 {
  margin-top: 0;
  color: #ffcc00;
  font-size: 2rem;
  text-shadow: 2px 2px 0 #cc9900;
}

/* Pixel Corners */
.panel::before,
.panel::after {
  content: '';
  position: absolute;
  width: 8px;
  height: 8px;
  background: #ffcc00;
  z-index: 2;
}

.panel::before {
  top: -4px;
  left: -4px;
  box-shadow:
    0 0 0 2px black,
    2px 0 #4f4005,
    0 2px #0e0b03,
    2px 2px #705a00;
}

.panel::after {
  bottom: -4px;
  right: -4px;
  box-shadow:
    0 0 0 2px black,
    -2px 0 #7b681d,
    0 -2px #705e15,
    -2px -2px #423501;
}

/* Scanlines Effect */
.panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(to bottom,
      transparent 50%,
      #ffcc0017 51%);
  background-size: 100% 4px;
  pointer-events: none;
  z-index: 1;
}

/* Additional corner details */
.panel .corner-detail {
  position: absolute;
  width: 4px;
  height: 4px;
  background: #ffcc00;
}

.panel .corner-top-right {
  top: -2px;
  right: -2px;
  box-shadow:
    0 0 0 2px black,
    -2px 0 #6e5800,
    0 2px #2e2605,
    -2px 8px #615216;
}

.panel .corner-bottom-left {
  bottom: -2px;
  left: -2px;
  box-shadow:
    0 0 0 2px rgb(255, 237, 71),
    2px 0 #ffbc13,
    0 -2px #ffa953,
    2px -2px #ffff75;
}

.panel p {
  margin-bottom: 10px;
  line-height: 1.4;
  font-family: 'Pixelify Sans', sans-serif;
}

.panel-title {
  font-size: 1.4rem;
  margin-bottom: 20px;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 10px;
}

.panel-title i {
  font-size: 1.6rem;
}

.control-group {
  font-family: 'Pixelify Sans', sans-serif;
  margin-bottom: 15px;
  padding: 20px;

  /* background: rgba(30, 40, 60, 1);
  border: .2rem solid black; */
  padding-top: 15px;
  padding-left: 5px;
  padding-right: 5px;
  z-index: 5;
}

#border-animation-canvas {
  /* Position it to fill the entire screen */
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;

  /* Place it behind all other content */
  z-index: -1;

  /* Make it unclickable so it doesn't block page content */
  pointer-events: none;
}

label {
  display: block;
  font-weight: 600;
  color: #ffcc00;
  font-size: small;
}

.title-label {
  margin-bottom: 8px;
  font-weight: 600;
  font-size: 1.5rem;
  color: white;
  text-shadow: 0px 0 0 #ffffff;
}

h2 {
  font-family: 'Pixelify Sans', sans-serif;
}

input[type="range"] {
  width: 100%;
  margin: 10px 0;
  background: linear-gradient(to right, var(--primary), var(--accent));
  height: 8px;
  border-radius: 4px;
  outline: none;
}

/* Responsive radio group */
.radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  margin-top: 10px;
  width: 100%;
  justify-content: flex-start;
}

.radio-option {
  /* flex: .8 .8 80px; */
  /* Grow, shrink, min width */
  min-width: 80px;
  max-width: 220px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #0d042a;
  border: 3px solid var(--primary);
  border-radius: 0;
  padding: 10px 18px;
  box-shadow: 0 0 0 4px #092253, 0 6px 0 0 var(--dark);
  font-family: 'Pixelify Sans', monospace;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  transition: border-color 0.2s, box-shadow 0.2s;
  cursor: pointer;
  user-select: none;
  z-index: 10;
  position: relative;
  isolation: isolate;
}

.radio-option input[type="radio"] {
  appearance: none;
  width: 12px;
  height: 12px;
  background: #181e2c;
  border: 3px solid var(--secondary);
  border-radius: 0;
  margin-right: 8px;
  position: relative;
  outline: none;
  box-shadow: 0 0 0 2px #2a3d5d;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.radio-option input[type="radio"]:checked {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: 0 0 0 2px #ffcc00;
}

.radio-option input[type="radio"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px #ffcc00;
}

.radio-option:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px #ffcc00, 0 8px 0 0 var(--accent);
}

/* Responsive adjustments for smaller screens */
@media (max-width: 600px) {
  .radio-group {
    gap: 8px;
  }

  .radio-option {
    flex: 1 1 80px;
    min-width: 80px;
    font-size: 0.9rem;
    padding: 8px 10px;
  }
}

button {
  /* background: linear-gradient(to right, var(--primary), var(--secondary));
  color: white;
  border: none;
  padding: 12px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 1rem;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 15px rgba(74, 111, 165, 0.3); */
}

button:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(74, 111, 165, 0.5);
}

button:active {
  transform: translateY(1px);
}

.btn-primary {
  background: linear-gradient(to right, var(--accent), #ff8e8e);
  padding: 14px 24px;
  font-size: 1.1rem;
}

.btn-animation {
  font-family: 'Doto';
  border-radius: 0;
  padding-top: 10px;
  padding-bottom: 10px;
  background-color: #2a3d5d;
  color: white;
  margin-top: 2px;
  border: 0;
}

.btn-group {
  display: flex;
  flex-wrap: wrap;
  margin-top: 20px;
}

#drop-area {
  border: 3px dashed var(--secondary);
  border-radius: 10px;
  padding: 40px;
  text-align: center;
  transition: all 0.3s;
  cursor: pointer;
  background: rgba(30, 40, 70, 0.4);
}

#drop-area.highlight {
  border-color: var(--accent);
  background: rgba(255, 107, 107, 0.1);
}

#drop-area p {
  margin-bottom: 15px;
  font-size: 1.1rem;
}

#file-input {
  display: none;
}

.preview-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.sliders {
  appearance: none;
  width: 100%;
  height: 14px;
  background: #181e2c;
  border: 3px solid var(--secondary);
  border-radius: 0;
  box-shadow: 0 0 0 2px #2a3d5d;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
  margin: 10px 0;
  cursor: pointer;
}

/* 
.sliders:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px #ffcc00;
}

.sliders:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px #ffcc00, 0 8px 0 0 var(--accent);
} */

/* Webkit (Chrome, Safari) */
.sliders::-webkit-slider-thumb {
  appearance: none;
  width: 24px;
  height: 24px;
  background: var(--accent);
  border: 3px solid #ffcc00;
  box-shadow: 0 0 0 2px #ffcc00;
  border-radius: 0;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
}

/* .sliders:focus::-webkit-slider-thumb {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px #ffcc00;
}

.sliders:hover::-webkit-slider-thumb {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px #ffcc00, 0 8px 0 0 var(--accent);
} */

/* Firefox */
.sliders::-moz-range-thumb {
  width: 24px;
  height: 24px;
  background: var(--accent);
  border: 3px solid #ffcc00;
  box-shadow: 0 0 0 2px #ffcc00;
  border-radius: 0;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
}


/* Remove default track styles for Firefox */
.sliders::-moz-range-track {
  background: #181e2c;
  height: 14px;
  border-radius: 0;
}

/* IE */
.sliders::-ms-thumb {
  width: 24px;
  height: 24px;
  background: var(--accent);
  border: 3px solid #ffcc00;
  box-shadow: 0 0 0 2px #ffcc00;
  border-radius: 0;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
}


.sliders::-ms-fill-lower,
.sliders::-ms-fill-upper {
  background: #181e2c;
  border-radius: 0;
}

/* Remove outline for all browsers */
.sliders:focus {
  outline: none;
}

/* Hide the outline for Firefox */
.sliders::-moz-focus-outer {
  border: 0;
}

#output-canvas {
  background: #2d2d2d;
  border-radius: 8px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
  width: 200px;
  height: 200px;
  /* Add this line to prevent blurring when scaled */
  image-rendering: pixelated;
}

/* Add these new styles */
#animation-container {
  margin-top: 20px;
  padding: 15px;

  background: #f8f8f8;
  border-radius: 8px;
  border: 1px solid #ddd;
}

#animation-container h3 {
  margin-top: 0;
  color: #333;
}

.animation-preview {
  display: flex;
  gap: 15px;
  overflow-x: auto;
  padding: 10px 0;
  max-width: 300px;
  min-height: 120px;
}

.animation-frame {
  position: relative;
  border: 1px solid #ddd;
  border-radius: 4px;
  background: white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  flex-shrink: 0;
}

.animation-frame canvas {
  display: block;
  width: 100px;
  height: 100px;
  image-rendering: pixelated;
}

.animation-frame.active {
  border: 2px solid #4CAF50;
  box-shadow: 0 0 8px rgba(76, 175, 80, 0.5);
}

.frame-label {
  position: absolute;
  bottom: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 2px 6px;
  font-size: 12px;
  border-top-left-radius: 4px;
}

#add-flicker-btn {
  background-color: red !important;
  border: 3px solid yellow !important;
  position: relative;
  z-index: 1000;
}

#add-flicker-btn::after {
  content: "CLICKABLE";
  position: absolute;
  top: -20px;
  left: 0;
  color: red;
  font-weight: bold;
}

.hidden {
  display: none;
}

.status {
  margin-top: 15px;
  padding: 10px;
  border-radius: 6px;
  background: rgba(30, 40, 60, 0.5);
  font-family: monospace;
  font-size: 0.9rem;
  min-height: 100px;
  overflow-y: auto;
  max-height: 200px;
}

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

  .panel {
    min-width: 100%;
  }
}

/* Add to texture buttons */
.texture-btn {
  padding: 8px 15px;
  font-size: 0.9rem;
}

.texture-btn.active {
  box-shadow: 0 0 0 2px var(--accent);
}

/* Texture preview examples */
.texture-examples {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.texture-example {
  width: 50px;
  height: 50px;
  border-radius: 4px;
  border: 1px solid #444;
  cursor: pointer;
}

/* Additional styles for orientation-specific controls */
.orthogonal-only,
.isometric-only {
  transition: all 0.3s ease;
}

/* New styles for image preview */
#image-preview-container {
  margin-top: 20px;
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.preview-header h3 {
  color: var(--accent);
  margin: 0;
}

#change-image-btn {
  padding: 8px 15px;
  font-size: 0.9rem;
}

.image-preview {
  width: 200px;
  height: 200px;
  border-radius: 8px;
  overflow: hidden;
  background: #2d2d2d;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

#preview-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

#post-process-controls {
  margin-top: 20px;
  padding: 15px;
  background: rgba(30, 40, 60, 0.5);
  border-radius: 8px;
}

.panel-subtitle {
  font-size: 1.2rem;
  color: #c0c8e0;
  margin-bottom: 15px;
  border-bottom: 1px solid var(--secondary);
  padding-bottom: 10px;
}

/* 
.preview-aligned {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 24px;
} */

.process {
  font-family: 'Doto';
  border-radius: 0;
  border-color: black;
  border-width: 0px;
  color: white;
}

.small {
  font-size: small;
  letter-spacing: -.4rem;
  padding-right: 28px;
  padding-left: 22px;
  text-align: left;
  background-color: #2a3d5d;

  color: white;
  margin-top: 2px;
  border: 0;
}

.big {
  font-size: x-large;
}

.downloads {
  background-color: #2a3d5d;
  border-width: 0px;
  color: white;
  font-family: 'Doto';
  margin-top: 2px;
  border: 0;
  padding: 4px;
  padding-top: 10px;
  padding-bottom: 10px;
  gap: 4px;
  margin: 2px;
  margin-bottom: 10px;
}