html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    background: #fff;
    overflow-x: hidden;
    width: 100vw;
}

:root {
    --vh: 1vh;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

h1 {
    color: #2c3e50;
    font-size: 26px;
    font-weight: 600;
    text-align: center;
    margin-top: 25px;
}

.h2-textarea {
    width: 100%;
    max-width: 750px;
    font-size: 20px;
    text-align: left;
    display: block;
    margin: 0 auto;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-family: inherit;
    box-sizing: border-box;
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: 20px auto;
}

.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
}

.gallery-item {
    background: #fff;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(0,0,0,.15);
    display: flex;
    flex-direction: column;
}

.gallery-item img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-bottom: 1px solid #ddd;
    cursor: pointer;
    display: block;
}

.caption {
    padding: 8px;
    font-size: 14px;
    text-align: center;
    color: #333;
}

.controls {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.controls input[type='text'] {
    padding: 6px;
    margin: 4px 0;
    font-size: 14px;
    width: 90%;
    box-sizing: border-box;
}

.controls button {
    margin: 3px 0;
    width: 90%;
    font-size: 14px;
    text-align: center;
}

button.delete {
    background: #c0392b;
    color: #fff;
    width: 90%;
    margin: 10px 0 20px;
}

button.delete:hover {
    background: #a93226;
}

.upload-box {
    background: #fff;
    padding: 10px 20px 1px;
    border-radius: 6px;
    max-width: 500px;
    margin: 30px auto;
    box-shadow: 0 2px 6px rgba(0,0,0,.15);
}

.upload-box input[type='file'],
.upload-box input[type='text'] {
    display: block;
    margin: 8px 0;
    padding: 8px;
    width: 100%;
    box-sizing: border-box;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 6px;
    font: inherit;
}

.upload-box button {
    width: 100%;
    font-size: 14px;
    margin-top: 10px;
}

#uploading-message {
    text-align: center;
    color: #06c;
    font-weight: bold;
    opacity: 0;
    transition: opacity .5s;
}

#uploading-message #dots {
    display: inline-block;
    width: 3ch;
    text-align: left;
}

/* Lightbox */
.lightbox {
    display: none;
    position: fixed;
    z-index: 9999;
    top: 0;
    left: 0;
    width: 100%;
    height: calc(var(--vh, 1vh) * 100);
    background: #000;
    overflow: hidden;
    justify-content: center;
    align-items: center;
    padding-bottom: calc(var(--safe-bottom) + 8px);
    touch-action: pan-y;
}

.lightbox.active {
    display: flex;
}

.lightbox-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.lightbox-content img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
    margin: auto;
}

.lightbox .caption {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.45);
    padding: 6px 12px;
    border-radius: 6px;
    color: #fff;
    font-size: 16px;
    text-align: center;
    max-width: 90%;
    box-sizing: border-box;
}

.lightbox-controls {
    position: absolute;
    top: 15px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    z-index: 10001;
    background: rgba(0,0,0,0.5);
    color: #fff;
    padding: 0 5px;
}

.lightbox-controls .counter {
    font-size: 20px;
}

.lightbox-controls .close {
    font-size: 40px;
    cursor: pointer;
    line-height: 1;
    margin-top: -5px;
}

.lightbox .arrow {
    position: absolute;
    top: 48%;
    transform: translateY(-48%);
    font-size: 22px;
    color: #fff;
    cursor: pointer;
    z-index: 10000;
    display: none;
    user-select: none;
    padding: 8px 16px;
    border-radius: 50%;
    background: rgba(0,0,0,0.25);
}

.lightbox .arrow.prev {
    left: 18px;
}

.lightbox .arrow.next {
    right: 18px;
}

@media (hover: hover) and (pointer: fine) {
    .lightbox .arrow {
        display: block;
    }
}

.pagination {
    text-align: center;
    margin: 20px 0;
}

.pagination a {
    display: inline-block;
    margin: 0 5px;
    padding: 6px 12px;
    background: #eee;
    border-radius: 4px;
    color: #333;
    text-decoration: none;
}

.pagination a.active {
    background: #06c;
    color: #fff;
}

.max-characters {
    margin: 2px auto 5px;
}

#dots {
    margin-left: 5px;
}

.max-characters-upload {
    text-align: left;
    padding-top: 2px;
}

.header-text {
    font: inherit;
    font-size: 26px;
    text-align: center;
    width: 100%;
    max-width: 750px;
    display: block;
    margin: 0 auto;
    padding: 5px;
    resize: none;
    border: 1px solid #ccc;
    border-radius: 5px;
}

.header-text.top-text {
    color: #2c3e50;
    font-size: 26px;
    font-weight: 600;
    text-align: center;
    margin-top: 25px;
    font-family: inherit;
    border-radius: 5px;
}


.subtitle-text-ctrl {
    font: inherit;
    font-size: 20px;
    text-align: leftr;
    width: 100%;
    max-width: 750px;
    display: block;
    margin: 0 auto;
    padding: 5px;
    resize: none;
    border: 1px solid #ccc;
    border-radius: 5px;
}


.subtitle-text-ctrl.subtitle-text {
    color: #2c3e50;
    font-size: 20px;
    font-weight: 600;
    text-align: left;
    font-family: inherit;
    border-radius: 5px;
}

.container-text-wrapper {
    max-width: 750px;
    margin: 20px auto;
    padding: 10px;
    background: #fff;
    border-radius: 5px;
    box-shadow: 0 2px 6px rgba(0,0,0,.15);
}

.container-text {
    font: inherit;
    width: 100%;
    font-size: 17px;
    text-align: left;
    resize: vertical;
    border: 1px solid #ccc;
    border-radius: 5px;
    padding: 8px;
}

/* Reorder buttons */
.controls .reorder-btn {
    display: flex;
    justify-content: space-between;
    width: 90%;
    margin: 12px 0 5px;
}

.controls .reorder-btn button {
    width: 48%;
    padding: 6px;
    font-size: 14px;
    cursor: pointer;
    border-radius: 5px;
    border: 1px solid #ccc;
    background: #eee;
    color: #333;
    transition: background .3s;
}

.controls .reorder-btn button:hover {
    background: #ddd;
}

.reorder-btn button .arrow {
    margin: 0 4px;
}

/* Spacing */
hr.upload-separator {
    height: 1px;
    color: #ccc;
    background: #ccc;
    margin: 20px auto;
    font-size: 0;
    border: 0;
    width: 100%;
}

hr.pagination-separator {
    height: 1px;
    color: #ccc;
    background: #ccc;
    margin: 40px 0;
    padding: 0;
    font-size: 0;
    border: 0;
    width: 100%;
}

.spacer-5 {
    height: 5px;
}

.spacer-20 {
    height: 20px;
}

#last {
    position: relative;
    top: -20px;
}

.text-center {
    text-align: center;
}

.c555 {
    color: #555;
}

.form-align {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

@media screen and (min-width:608px) {
    .arrows-dt {
        display: none;
    }
}

@media screen and (max-width:607px) {
    .arrows-ct {
        display: none;
    }
}

.open-qtb {
    display: block;
    width: 100%;
    max-width: 300px;
    margin: 0 auto;
    padding: 10px 20px;
    background-color: #ddd;
    color: #333;
    text-decoration: none;
    border-radius: 0 0 5px 5px;
    cursor: pointer;
    font-size: 16px;
    transition: background .3s;
    text-align: center;
}

.open-qtb:hover {
    background: #eee;
    text-decoration: none;
}