/* 1. Base Reset & Layout */
html, body {
    height: 100%;
    margin: 0;
    overflow-x: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #ffffff;
    color: #000000;
    text-align: center;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    -webkit-text-size-adjust: 100%;
}

/* 2. Page Content Wrapper */
.page-content {
    /* Responsive padding: 40px on desktop, 20px on mobile */
    padding: clamp(20px, 5vh, 40px) 15px; 
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 1200px; /* Prevents stretching too wide on huge monitors */
    box-sizing: border-box;
}

/* 3. Typography & Header */
h1.thumbnail-link2 {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
    margin-bottom: 20px;
    border: 1px solid #000;
    box-shadow: 4px 4px 0 #000, 8px 8px 0 #FF10F0;
    padding: 10px 20px;
    font-size: clamp(1.5rem, 5vw, 2.5rem); /* Fluid font size */
    max-width: 95%;
    box-sizing: border-box;
}

.gradient-text {
    font-weight: 700;
    margin: 0;
}

/* 4. Upload & Preview Elements (Optimized for all screens) */
#imageInput { display: none; }

.upload-box {
    border: 2px dashed #000;
    border-radius: 15px;
    padding: clamp(20px, 5vw, 40px); /* Padding scales with screen size */
    width: 100%;
    max-width: 500px;
    cursor: pointer;
    box-sizing: border-box;
    transition: background 0.2s;
}

#previewBox {
    margin: 25px 0;
    width: 100%; /* Full width on mobile */
    max-width: 600px; /* Max width on desktop */
    border: 2px solid #000;
    border-radius: 15px;
    padding: 15px;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    background: #fafafa;
}

/* IMPORTANT: Ensure uploaded images don't overflow the preview box */
#previewBox img {
    max-width: 100%;
    max-height: 500px; /* Prevents giant images from making page too long */
    height: auto;
    border-radius: 8px;
    display: block;
}

/* 5. Buttons & Notes */
#downloadBtn {
    padding: 14px 30px; /* Larger tap area */
    background: #000;
    color: #fff;
    border: 2px solid #000;
    border-radius: 8px;
    cursor: pointer;
    display: none;
    font-size: 1rem;
    font-weight: bold;
    min-width: 200px;
}

.note {
    font-size: 0.95rem;
    margin: 15px 0;
    width: 100%;
    max-width: 600px;
    border: 1px solid #000;
    padding: 12px 15px;
    border-radius: 12px;
    line-height: 1.5;
    box-sizing: border-box;
}

/* --- RESPONSIVE BREAKPOINTS --- */

/* Tablet and below */
@media (max-width: 768px) {
    .upload-box, #previewBox {
        width: 95%; /* More breathing room for tablet */
    }
}

/* Mobile (Phones) */
@media (max-width: 600px) {
    h1.thumbnail-link2 {
        flex-direction: column;
        font-size: 1.6rem;
        padding: 15px;
    }

    .upload-box {
        padding: 30px 15px;
    }
    
    #downloadBtn {
        width: 100%; /* Full width button on mobile */
    }
}

/* Very Small Phones */
@media (max-width: 360px) {
    h1.thumbnail-link2 {
        font-size: 1.3rem;
    }
}
main {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 800px;
  width: 100%;
  padding: 20px;
}

/* Sections */
section {
  margin-bottom: 24px;
  width: 100%;
}

/* Lists */
ul {
  list-style-position: inside;
  padding: 0;
}

/* Links */
a {
  text-decoration: none;
  color: #0077ff;
}

a:hover {
  text-decoration: underline;
}