* {
  box-sizing: border-box;
  font-size: 130%;
}

body {
  font-family: sans-serif;
  background: #fafafa;
  color: #333;
  margin: 0;
  padding: 20px;
}
.page {
  max-width: 800px;
  margin: 0 auto;
}

.canvas-container {
  display: flex;
  gap: 10px;
  width: 100%;
}

canvas {
  display: block;
  width: 100%;
  height: auto;
}

/* Right side: container for canvasOutput and bgImage */
.output-container {
  position: relative;
  width: 100%;
}

/* Canvas on the right */
#canvasOutput {
  display: block;
  width: 100%;
  height: auto;
  position: relative;
  z-index: 1;
}

/* Background image behind canvasOutput */
#bgImage {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
  pointer-events: none;
}

button{
  display: inline-block;
  outline:none;
  border:none;
  max-width: 800px;
  min-width: 310px;
  margin: 0 auto;
  background-color: #0077cc;
  color: white;
  padding: 0.6em 1.2em;
  border-radius: 8px;
  text-align: center;
  text-decoration: none;
  font-weight: 600;
  margin: 1rem 0;
  transition: background-color 0.2s ease, transform 0.1s ease;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

button:hover {
  max-width: 800px;
  min-width: 310px;
  background-color: #005fa3;
  transform: translateY(-1px);
}
p {
  max-width: 800px;
  min-width: 310px;
  margin: 0 auto;
  font-size: 1rem;
  line-height: 1.6;
  margin-bottom: 1.5rem;
  padding: 0rem;
  color: #123;
}
h3 {
  text-align: center;
}
h4 {
  margin-top: 3rem;
  margin-bottom: 0rem;
}
h1 {
  text-align: center;
  margin-top: 0px;
}
h2{
  text-align: center;
}
input[type="file"] {
  display: none;
}

label[for="imageInput"]{
  display: inline-block;
  max-width: 800px;
  min-width: 310px;
  margin: 0 auto;
  background-color: #0077cc;
  color: white;
  padding: 0.6em 1.2em;
  border-radius: 8px;
  text-align: center;
  text-decoration: none;
  font-weight: 600;
  margin: 1rem 0;
  transition: background-color 0.2s ease, transform 0.1s ease;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

label[for="imageInput"]:hover {
  max-width: 800px;
  min-width: 310px;
  background-color: #005fa3;
  transform: translateY(-1px);
}
.input-wrapper {
  text-align: center;
  margin-bottom: 1rem;
}
.download-wrapper {
  text-align: center;
  margin-bottom: 1rem;
}
.a-wrapper{
  min-width:310px;
  max-width:800px;
  margin:0 auto;
}
a{
  min-width:100%;
  display: inline-block;
  background-color: #0077cc;
  color: white;
  padding: 0.6em 1.2em;
  border-radius: 8px;
  text-align: center;
  text-decoration: none;
  font-weight: 600;
  margin: 1rem 0;
  transition: background-color 0.2s ease, transform 0.1s ease;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

a:hover {
  background-color: #005fa3;
  transform: translateY(-1px);
}
#threshold {
  -webkit-appearance: none;
  width: 100%;
  max-width: 800px;
  min-width: 310px;
  height: 16px;
  border-radius: 8px;
  background: #0077cc;
  outline: none;
  margin: 1rem auto;
  display: block;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  transition: background-color 0.2s ease;
}

#threshold:hover {
  background: #005fa3;
}

#threshold::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 28px;
  height: 28px;
  background: white;
  border-radius: 50%;
  border: 2px solid #005fa3;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease;
  margin-top: -6px; /* centers thumb vertically */
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

#threshold::-webkit-slider-thumb:hover {
  background: #eee;
  border-color: #003d66;
}

/* Firefox */
#threshold::-moz-range-thumb {
  width: 28px;
  height: 28px;
  background: white;
  border-radius: 50%;
  border: 2px solid #005fa3;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

#threshold::-moz-range-thumb:hover {
  background: #eee;
  border-color: #003d66;
}
.side-ad {
  position: fixed;
  top: 50%;               /* middle of screen */
  transform: translateY(-50%); /* shift up half its own height */
  width: 180px;           /* skyscraper ad size */
  height: 600px;
  z-index: 1000;
  overflow: hidden;
}

.left-ad {
  left: 15px;
}

.right-ad {
  right: 15px;
}

/* Hide ads on mobile */
@media (max-width: 900px) {
  .side-ad {
    display: none;
  }
}
