/* ...existing styles... */
body {
    /* Use a clean readable font and neutral background suitable for WebView / PWA */
    font-family: 'Noto Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: #000; /* changed to pure black */
    color: #fff; /* ensure readable text on black */
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    -webkit-user-select: none; /* Prevent text selection globally */
    user-select: none;
    -webkit-touch-callout: none; /* Disable long-press callout */
}

header h1 {
    /* ...existing styles... */
    display: none;
}

/* Hide header to free vertical space */
.app-header {
    display: none;
}

/* New header with icon */
.app-icon {
    width: 72px;
    height: 72px;
    object-fit: contain;
    image-rendering: pixelated; /* keep pixel-art crisp */
    -webkit-user-select: none;
    user-select: none;
}

.cartoon-container {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    justify-content: center;
    width: 100%;
    max-width: 1000px;
    padding: 20px;
    background-color: #0f1720; /* darker slate background (changed from light pink) */
    border: 10px solid #ffdb58; /* Mustard yellow border */
    border-radius: 25px; /* Rounded corners */
    box-shadow: 10px 10px 0px 0px rgba(0,0,0,0.7); /* Big offset shadow */
}

h2 {
    color: #4682b4; /* Steel blue */
    border-bottom: 3px dashed #4682b4;
    padding-bottom: 5px;
    text-align: center;
}

canvas {
    border: 5px solid #3cb371; /* Medium sea green border */
    border-radius: 10px;
    background-color: #2f2f2f; /* dark grey background (changed from white) */
    box-shadow: 4px 4px 0px 0px rgba(0,0,0,0.5);
    margin-bottom: 15px;
}

/* Button styles - exaggerated and cartoony */
button, .big-button, .file-label {
    padding: 10px 20px;
    margin: 5px;
    font-size: 1.2em;
    font-weight: bold;
    color: white;
    background-color: #ff4500; /* Orange Red */
    border: 4px solid #8b0000; /* Darker border */
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.1s;
    text-transform: uppercase;
    box-shadow: 5px 5px 0px 0px rgba(0,0,0,0.7);
    transform: translate(0, 0);
    text-align: center;
    display: inline-block;
    -webkit-user-select: none;
    user-select: none;
}

button:active, .big-button:active, .file-label:active {
    box-shadow: 1px 1px 0px 0px rgba(0,0,0,0.7);
    transform: translate(4px, 4px);
}

.action-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    min-width: 200px;
}

.controls {
    margin-bottom: 10px;
    display: flex;
    gap: 10px;
    align-items: center;
}

input[type="range"] {
    width: 100%;
}

.hidden {
    display: none;
}

.input-section, .output-section {
    display: flex;
    flex-direction: column;
    align-items: center;
}

#downloadLink {
    text-decoration: none;
    background-color: #4CAF50; /* Green for download */
    border-color: #388E3C;
    margin-top: 15px;
}

.file-label {
    /* Style the label to look like a button */
    background-color: #1e90ff; /* Dodger Blue */
    border-color: #0000cd; /* Medium Blue */
}

.hidden-file-input {
    /* Hide the actual file input */
    width: 0.1px;
    height: 0.1px;
    opacity: 0;
    overflow: hidden;
    position: absolute;
    z-index: -1;
}

/* Modal Styles for Cropping */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    box-sizing: border-box;
    -webkit-overflow-scrolling: touch;
}

.modal-content {
    background-color: #fff0f5;
    padding: 20px;
    border: 8px solid #ffdb58;
    border-radius: 20px;
    box-shadow: 10px 10px 0px 0px rgba(0,0,0,0.9);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.img-container {
    width: 100%;
    max-height: 50vh;
    margin-bottom: 20px;
}

.img-container img {
    display: block;
    max-width: 100%;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    width: 100%;
    flex-wrap: wrap;
}

.secondary {
    background-color: #b0c4de;
    border-color: #6a5acd;
}

/* Mobile Responsiveness */
@media (max-width: 650px) {
    body { padding: 8px; }
    header h1 { font-size: 2rem; margin-bottom: 12px; }
    .cartoon-container { gap: 12px; padding: 10px; border-width: 4px; border-radius: 12px; }
    canvas { width: min(100%, 260px); height: auto; border-width: 4px; border-radius: 8px; margin-bottom: 8px; }
    button, .big-button, .file-label { width: 95%; padding: 8px 12px; font-size: 1em; margin: 8px auto; border-radius: 10px; box-shadow: 3px 3px 0 rgba(0,0,0,0.6); }
    .action-section { padding: 8px 0; gap: 8px; min-width: auto; }
    .modal-content { padding: 12px; border-width: 4px; max-width: 92%; }
}

.app-footer {
    margin-top: 18px;
    color: #666;
    font-size: 0.95rem;
}

/* Footer link color override (use a contrasting orange instead of default blue) */
.app-footer a {
    color: #ff8c00; /* dark orange */
    text-decoration: none;
}
.app-footer a:hover,
.app-footer a:focus {
    text-decoration: underline;
}

/* Make the specific "Target Resolution" label use black text for readability */
label[for="pixelSize"] {
    color: #fff; /* changed to white per request */
}

/* Center the number inside the resolution input and ensure it's visible on dark background */
#pixelSize {
    text-align: center;
    color: #fff;
    background-color: #1a1a1a; /* dark inner background to contrast the white text */
    border: 1px solid rgba(255,255,255,0.08);
    padding: 6px 8px;
    border-radius: 6px;
    width: 120px;
    box-sizing: border-box;
}