html, body {
    height: 100%;
    margin: 0;
    background: #000; /* black background */
    color: #fff;      /* white text */
    /* use Space Mono from Google Fonts */
    font-family: 'Space Mono', system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
}

header {
    color: gold;
    padding: 1rem;
    text-align: center;
    background: transparent;
}

h3 {
    margin: 0;
    padding: 0.25rem 1rem;
    text-align: center;
    color: #ccc;
    font-weight: normal;
    font-size: 1.1rem;
}

main {
    /* removed full-page min-height to avoid large gap */
    padding: 1.5rem 0;
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

/* tighten spacing between image row and key section */
.image-row {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    align-items: center;
    padding: 0.5rem 1rem;
    max-width: 900px;   /* center row within page */
    margin: 0 auto 0.5rem auto;     /* smaller bottom margin to close gap */
}

h1 {
    margin: 0;
}

.key-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
}

/* square with transparent background and 1px grey border */
.drop-square {
    width: 200px;
    height: 200px;
    border: 1px solid #888;
    display: flex;
    align-items: center;
    justify-content: center;
    outline: none;
    cursor: pointer;
    user-select: none;
    background: transparent;
    transition: border-color 120ms ease, background-color 120ms ease;
}

/* centering text inside the square */
.drop-text {
    color: #bbb;
    font-size: 1rem;
    text-align: center;
}

/* visual change when dragging over */
.drop-square.dragover {
    border-color: #fff;
    background-color: rgba(255,255,255,0.02);
}

/* status messages under the square */
.key-status {
    margin: 0;
    color: #ccc;
    font-size: 0.95rem;
}

/* error/warning/success states */
.key-status.error { color: #ff6b6b; }
.key-status.warn  { color: #ffd166; }
.key-status.ok    { color: #7af27a; }

/* make layout responsive on narrow screens */
@media (max-width: 420px) {
    .drop-square { width: 160px; height: 160px; }
}

/* ...existing code... */

.drop-square.filled {
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    border: none; /* optional: remove border when filled */
}

.image-row {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    align-items: center;
    padding: 0.5rem 1rem;
    max-width: 900px;   /* center row within page */
    margin: 0 auto 0.5rem auto;     /* smaller bottom margin to close gap */
}

/* make the anchor wrap the image and be clickable */
.image-row a { display: inline-block; }

/* size the thumbnails; adjust as needed */
.image-row img {
    width: 80px;
    height: 80px;
    object-fit: contain;
    image-rendering: -webkit-optimize-contrast;
    border-radius: 4px;
    display: block;      /* remove inline gap, anchor click area covers image */
    cursor: pointer;     /* indicate clickable */
    transition: transform 120ms ease, box-shadow 120ms ease;
}

/* simple hover affordance */
.image-row a:hover img {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 6px 18px rgba(0,0,0,0.6);
}

/* responsive: smaller on narrow screens */
@media (max-width: 420px) {
    .image-row img { width: 60px; height: 60px; }
}

/* download row (centered input + button) */
.download-row {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    align-items: center;
    max-width: 560px;
    margin: 0 auto 0.5rem auto; /* small bottom margin to sit near the drop square */
    padding: 0 1rem;
    width: 100%;
    box-sizing: border-box;
}

.download-row input[type="text"] {
    flex: 1 1 320px;
    max-width: 420px;
    padding: 0.5rem 0.75rem;
    background: transparent;
    border: 1px solid #888;
    color: #fff;
    border-radius: 0;
    outline: none;
    font-size: 1rem;
    font-family: inherit; /* ensure placeholder uses same font */
    transition: border-color 120ms ease, color 120ms ease, box-shadow 120ms ease;
}

/* placeholder should also use inherited font */
.download-row input[type="text"]::placeholder {
    font-family: inherit;
}

.download-row input[type="text"]::placeholder {
    color: #aaa;
}

.download-row button {
    padding: 0.55rem 0.9rem;
    background: #333;
    border: 1px solid #777;
    color: #fff;
    border-radius: 0;
    cursor: pointer;
    font-size: 0.95rem;
    font-family: inherit; /* use same Space Mono font */
    transition: transform 120ms ease, background 120ms ease;
}

.download-row button:hover {
    transform: translateY(-2px);
    background: #3a3a3a;
}

/* when input text is marked invalid we only change the text color in JS */