* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', sans-serif;
    background-image: linear-gradient(180deg, rgb(77, 164, 211), rgb(0, 0, 65));
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    background: white;
    padding: 40px;
    border-radius: 35px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    max-width: 700px;
    width: 90%;
    text-align: center;
    margin: auto;
    margin-top: 50px;
}

h1 {
    font-size: 2.5rem;
    color: #2d3748;
    margin-bottom: 10px;
    font-style: italic;
}

.subtitle {
    color: #718096;
    margin-bottom: 30px;
    font-size: 1rem;
}

.upload-box {
    border: 2px dashed #59a9ff;
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 20px;
    background: #e4f4ff;
}

input[type="file"] {
    font-size: 1rem;
    color: #262a32;
}

button {
    background: darkblue;
    color: white;
    border: none;
    padding: 12px 40px;
    border-radius: 8px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.2s;
}

button:hover {
    background: #0d3acf;
    transform: scale(1.1);
}

h2 {
    margin-top: 30px;
    color: #2d3748;
    margin-bottom: 20px;
}

.photos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.photo-card {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.photo-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.download-all-btn {
    display: inline-block;
    background: darkblue;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px 30px;
    font-size: 1rem;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 20px;
}

.download-all-btn:hover {
    background: #0d3acf;
    transform: scale(1.05);
}

.upload-btn {
    display: inline-block;
    background: darkblue;
    color: white;
    padding: 10px 30px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
    margin-bottom: 10px;
}

.upload-btn:hover {
    background: #0d3acf;
    transform: scale(1.1);
}

.file-name {
    color: #59a9ff;
    font-size: 0.9rem;
    margin-top: 8px;
    font-weight: 600;
}

.error-message {
    background: #ffe4e6;
    color: #b42318;
    border: 2px dashed #f8b4b4;
    border-radius: 10px;
    padding: 12px 16px;
    margin-bottom: 20px;
    font-weight: 600;
}

.settings-button {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 900;
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 50%;
    background: darkblue;
    color: white;
    font-size: 1.35rem;
    line-height: 1;
}

.settings-button:hover {
    background: #0d3acf;
    transform: rotate(25deg);
}

.settings-button:focus-visible,
.settings-close:focus-visible,
.settings-done:focus-visible,
.setting-field select:focus-visible {
    outline: 3px solid #59a9ff;
    outline-offset: 3px;
}

.settings-dialog {
    position: fixed;
    top: 50%;
    left: 50%;
    width: min(440px, calc(100% - 32px));
    max-width: none;
    max-height: calc(100vh - 32px);
    margin: 0;
    padding: 28px;
    border: 1px solid #d9e3f1;
    border-radius: 14px;
    color: #2d3748;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    overflow: auto;
    transform: translate(-50%, -50%);
}

.settings-dialog::backdrop {
    background: rgba(9, 14, 54, 0.68);
    backdrop-filter: blur(3px);
}

.settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.settings-header h2 {
    margin: 0;
    color: #2d3748;
    font-size: 1.35rem;
}

.settings-close {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 50%;
    background: #edf4fc;
    color: #26366f;
    font-size: 1.5rem;
}

.settings-close:hover {
    background: #dcecff;
    transform: none;
}

.settings-description {
    margin: 12px 0 22px;
    color: #64748b;
    line-height: 1.5;
}

.settings-fields {
    display: grid;
    gap: 18px;
}

.setting-field {
    display: grid;
    gap: 8px;
    text-align: left;
}

.setting-field label {
    color: #2d3748;
    font-weight: 700;
}

.setting-field select {
    width: 100%;
    min-height: 44px;
    padding: 8px 12px;
    border: 1px solid #aabbd1;
    border-radius: 8px;
    background: white;
    color: #263247;
    font: inherit;
}

.setting-help {
    color: #718096;
    font-size: 0.85rem;
    line-height: 1.4;
}

.settings-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 24px;
}

.settings-done {
    padding: 10px 24px;
    font-size: 1rem;
}

.settings-done:hover {
    transform: none;
}

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(9, 14, 54, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-overlay.hidden {
    display: none;
}

.loading-box {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 30px 40px;
    text-align: center;
    color: #1e2a78;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.loading-box p {
    margin-top: 16px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 6px solid rgba(89, 169, 255, 0.25);
    border-top-color: darkblue;
    border-radius: 50%;
    margin: 0 auto;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

footer {
    background: rgb(1, 1, 84, 0);
    color: white;
    text-align: center;
    padding: 20px;
    width: 100%;
    margin-top: 20px;
}