/* Self-contained styles for praznistanovi */
:root {
    --blue: #1e3a8a;
    --gold: #d4af37;
    --off-white: #f7f4f0;
    --dark: #2a2a2a;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background-color: var(--off-white);
    color: var(--dark);
    font-family: Arial, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

a {
    color: #7f0f0f;
}

a:hover {
    color: var(--blue);
}

.soviet-header {
    background: linear-gradient(135deg, #a20000, #8b0000);
    color: #f7f4f0;
    padding: 30px 20px;
    text-align: center;
    border-bottom: 4px solid #d4af37;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.soviet-title {
    font-size: clamp(2.2rem, 8vw, 3em);
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin: 0;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.soviet-subtitle {
    font-size: clamp(1rem, 4vw, 1.2em);
    margin: 15px 0 0 0;
    opacity: 0.9;
}

.hero-stats-bar {
    margin-top: 24px;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(212, 175, 55, 0.5);
    border-radius: 6px;
    padding: 14px 28px;
}

.hero-count {
    font-size: clamp(2.4rem, 10vw, 3.6rem);
    font-weight: bold;
    color: var(--gold);
    letter-spacing: 2px;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.hero-stats-text {
    font-size: clamp(0.85rem, 3vw, 1rem);
    opacity: 0.85;
    letter-spacing: 0.5px;
}

.main-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 20px;
    box-sizing: border-box;
}

.description {
    background: linear-gradient(145deg, #f7f4f0, #e8e5e0);
    border: 3px solid #d4af37;
    border-radius: 8px;
    padding: 30px;
    margin-bottom: 40px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.description h2 {
    color: #a20000;
    font-size: 1.8em;
    margin: 0 0 20px 0;
    text-align: center;
}

.description p {
    font-size: 1.1em;
    line-height: 1.6;
    margin: 0;
    text-align: center;
}

.example-image-section {
    background: linear-gradient(145deg, #f7f4f0, #e8e5e0);
    border: 3px solid #d4af37;
    border-radius: 8px;
    padding: 30px;
    margin: 40px 0;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.example-image-section h3 {
    color: #a20000;
    font-size: 1.6em;
    margin: 0 0 20px 0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.example-image {
    max-width: 100%;
    height: auto;
    border: 3px solid #2a2a2a;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    margin-bottom: 15px;
}

.example-caption {
    font-size: 1em;
    color: #2a2a2a;
    font-style: italic;
    margin: 0;
}

.upload-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    margin: 40px 0;
}

.upload-btn {
    background: linear-gradient(145deg, #d4af37, #b8941f);
    color: #2a2a2a;
    border: 3px solid #2a2a2a;
    padding: 15px 30px;
    font-size: 1.3em;
    font-weight: bold;
    text-transform: uppercase;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    width: min(100%, 360px);
    min-height: 56px;
    touch-action: manipulation;
}

.upload-btn:hover {
    background: linear-gradient(145deg, #b8941f, #d4af37);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

.stats-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
    margin: 40px 0;
}

.main-stat {
    background: linear-gradient(145deg, #a20000, #8b0000);
    color: #f7f4f0;
    padding: 40px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.main-stat-number {
    font-size: 4em;
    font-weight: bold;
    margin: 0;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.main-stat-label {
    font-size: 1.2em;
    margin: 10px 0 0 0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.leaderboards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 20px;
}

.leaderboard {
    background: linear-gradient(145deg, #f7f4f0, #e8e5e0);
    border: 3px solid #d4af37;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.leaderboard h3 {
    color: #a20000;
    font-size: 1.4em;
    margin: 0 0 20px 0;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.leaderboard-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #d4af37;
}

.leaderboard-item:last-child {
    border-bottom: none;
}

.rank {
    background: #a20000;
    color: #f7f4f0;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.9em;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
}

.modal-content {
    background: linear-gradient(145deg, #f7f4f0, #e8e5e0);
    margin: 2% auto;
    padding: 20px;
    border: 4px solid #d4af37;
    border-radius: 12px;
    width: 90%;
    max-width: 800px;
    height: min(90dvh, 900px);
    overflow-y: auto;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    position: relative;
}

.modal-header {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #d4af37;
    position: relative;
}

.modal-title {
    color: #a20000;
    font-size: 1.8em;
    font-weight: bold;
    text-transform: uppercase;
    margin: 0;
}

.close {
    background: transparent;
    border: 0;
    color: #a20000;
    font-size: 2em;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s ease;
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    min-width: 48px;
    min-height: 48px;
}

.close:hover {
    color: #8b0000;
}

.close:focus-visible,
.upload-btn:focus-visible,
.submit-btn:focus-visible,
.city-select:focus-visible {
    outline: 3px solid #d4af37;
    outline-offset: 3px;
}

.modal-instruction {
    background: linear-gradient(145deg, #d4af37, #b8941f);
    color: #2a2a2a;
    padding: 15px 20px;
    margin: 0 0 20px 0;
    border-radius: 8px;
    text-align: center;
    border: 2px solid #2a2a2a;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.modal-instruction p {
    margin: 0;
    font-size: clamp(1rem, 3.6vw, 1.1em);
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.image-container {
    position: relative;
    text-align: center;
    margin: 0;
    width: 100%;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.building-image {
    max-width: 100%;
    max-height: 400px;
    border: 3px solid #2a2a2a;
    border-radius: 8px;
    cursor: crosshair;
}

#imageCanvas {
    width: 100%;
    max-width: 100%;
    height: auto;
    border: none;
    border-radius: 8px;
    cursor: crosshair;
    display: block !important;
    object-fit: contain;
}

.window-marker {
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid #00ff00;
    border-radius: 50%;
    background-color: rgba(0, 255, 0, 0.3);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: #2a2a2a;
    font-size: 12px;
}

.window-marker.checked {
    background-color: rgba(0, 255, 0, 0.7);
}

.controls-section {
    margin: 15px 0;
    text-align: center;
    background: linear-gradient(145deg, #f7f4f0, #e8e5e0);
    padding: 15px;
    border: 2px solid #d4af37;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    display: flex;
    gap: 15px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    box-sizing: border-box;
    position: sticky;
    bottom: 0;
    z-index: 2;
}

.city-select {
    background: #f7f4f0;
    border: 2px solid #d4af37;
    border-radius: 4px;
    padding: 10px;
    font-size: 1.1em;
    color: #2a2a2a;
    min-width: 200px;
    max-width: 100%;
    box-sizing: border-box;
    min-height: 52px;
}

.submit-btn {
    background: linear-gradient(145deg, #a20000, #8b0000);
    color: #f7f4f0;
    border: 3px solid #d4af37;
    padding: 15px 30px;
    font-size: 1.2em;
    font-weight: bold;
    text-transform: uppercase;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    min-height: 56px;
    touch-action: manipulation;
}

.submit-btn:hover {
    background: linear-gradient(145deg, #8b0000, #a20000);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

.submit-btn:disabled {
    background: #666;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.results-summary {
    background: linear-gradient(145deg, #d4af37, #b8941f);
    color: #2a2a2a;
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
    text-align: center;
    font-weight: bold;
    font-size: 1.1em;
}

.uploading-overlay {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(34, 24, 16, 0.76);
    z-index: 5;
    border-radius: 8px;
}

.uploading-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 28px 32px;
    min-width: 220px;
    background: linear-gradient(145deg, #f7f4f0, #e8e5e0);
    border: 3px solid #d4af37;
    border-radius: 12px;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.3);
}

.uploading-panel p {
    margin: 0;
    color: #a20000;
    font-size: 1.1em;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.upload-spinner {
    width: 56px;
    height: 56px;
    border: 6px solid rgba(162, 0, 0, 0.2);
    border-top-color: #a20000;
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}

.site-dialog {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    box-sizing: border-box;
    background: rgba(34, 24, 16, 0.78);
}

.site-dialog-panel {
    width: min(100%, 420px);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    padding: 28px 24px;
    text-align: center;
    background: linear-gradient(145deg, #f7f4f0, #e8e5e0);
    border: 4px solid #d4af37;
    border-radius: 14px;
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.34);
}

.site-dialog-title {
    margin: 0;
    color: #a20000;
    font-size: clamp(1.4rem, 5vw, 1.8rem);
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.site-dialog-message {
    margin: 0;
    font-size: 1.08rem;
    line-height: 1.55;
}

.site-dialog-button {
    background: linear-gradient(145deg, #a20000, #8b0000);
    color: #f7f4f0;
    border: 3px solid #d4af37;
    border-radius: 8px;
    min-width: 180px;
    min-height: 52px;
    padding: 12px 20px;
    font-size: 1rem;
    font-weight: bold;
    text-transform: uppercase;
    cursor: pointer;
    touch-action: manipulation;
}

.site-dialog-button:hover {
    background: linear-gradient(145deg, #8b0000, #a20000);
}

.site-dialog-button:focus-visible {
    outline: 3px solid #d4af37;
    outline-offset: 3px;
}

/* Background drone watermark */
.bg-drone {
    position: fixed;
    right: -80px;
    bottom: -60px;
    width: 480px;
    opacity: 0.055;
    pointer-events: none;
    z-index: 0;
    transform: rotate(-15deg);
}

.bg-drone img {
    width: 100%;
    height: auto;
    display: block;
}

/* Drone button */
.drone-btn {
    position: relative;
    background: linear-gradient(145deg, #1e3a8a, #162d6e);
    color: #f7f4f0;
    border: 3px solid #d4af37;
    padding: 15px 30px;
    font-size: 1.1em;
    font-weight: bold;
    text-transform: uppercase;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    width: min(100%, 360px);
    min-height: 56px;
    touch-action: manipulation;
    letter-spacing: 0.5px;
}

.drone-btn-badge {
    position: absolute;
    top: -11px;
    left: 10px;
    background: #d4af37;
    color: #2a2a2a;
    font-size: 0.62em;
    font-weight: bold;
    padding: 2px 8px;
    border-radius: 4px;
    letter-spacing: 1px;
    border: 2px solid #2a2a2a;
    line-height: 1.5;
    white-space: nowrap;
}

.drone-btn:hover {
    background: linear-gradient(145deg, #162d6e, #1e3a8a);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

.drone-btn:focus-visible {
    outline: 3px solid #d4af37;
    outline-offset: 3px;
}

/* Drone modal sizing — shrinks to content, no fixed height */
.drone-modal-content {
    height: fit-content !important;
    max-height: 92dvh;
    overflow-y: auto;
}

/* Drone image in modal */
.drone-modal-image-wrap {
    text-align: center;
    padding: 10px 0 4px;
}

.drone-modal-img {
    width: 140px;
    height: 140px;
    object-fit: contain;
    display: inline-block;
}

/* Descriptive text */
.drone-modal-text {
    font-size: 1.05em;
    line-height: 1.6;
    margin: 12px 0 0;
    text-align: center;
    color: var(--dark);
}

.drone-modal-subtext {
    font-size: 0.95em;
    line-height: 1.5;
    margin: 10px 0 0;
    text-align: center;
    color: #555;
    font-style: italic;
}

/* Drone form controls */
.drone-controls {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
    align-items: stretch;
}

.drone-city-select {
    width: auto;
    min-width: 0;
    flex: 0 0 auto;
}

.drone-address-input {
    flex: 1;
    min-width: 140px;
    width: auto;
    max-width: none;
    box-sizing: border-box;
    background: #f7f4f0;
    border: 2px solid #d4af37;
    border-radius: 4px;
    padding: 10px 12px;
    font-size: 1.05em;
    color: #2a2a2a;
    min-height: 52px;
    font-family: Arial, sans-serif;
}

.drone-address-input:disabled {
    background: #e8e5e0;
    color: #aaa;
    cursor: not-allowed;
}

.drone-address-input::placeholder {
    color: #999;
}

.drone-address-input:focus {
    outline: 3px solid #d4af37;
    outline-offset: 2px;
}

@media (max-width: 400px) {
    .drone-controls {
        flex-direction: column;
    }

    .drone-city-select {
        width: 100%;
    }
}

/* Thank you panel */
.drone-thankyou {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    padding: 10px 0;
}

.drone-thankyou-text {
    font-size: 1.15em;
    line-height: 1.6;
    text-align: center;
    color: var(--dark);
    margin: 0;
    font-weight: bold;
}

.drone-close-btn {
    min-width: 160px;
}

/* "Not a dark window" tap feedback bubble */
.not-dark-bubble {
    position: fixed;
    transform: translate(-50%, -130%);
    background: rgba(30, 30, 30, 0.82);
    color: #fff;
    font-size: 0.82em;
    font-weight: bold;
    padding: 5px 13px;
    border-radius: 20px;
    pointer-events: none;
    white-space: nowrap;
    z-index: 3000;
    animation: bubbleFloat 1.5s ease-out forwards;
}

@keyframes bubbleFloat {
    0%   { opacity: 1; transform: translate(-50%, -130%); }
    70%  { opacity: 1; }
    100% { opacity: 0; transform: translate(-50%, calc(-130% - 44px)); }
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 768px) {
    body {
        font-size: 16px;
    }

    .soviet-header {
        padding: 24px 16px;
    }

    .main-content {
        padding: 24px 14px 32px;
    }

    .description,
    .example-image-section,
    .leaderboard,
    .main-stat {
        padding: 22px 16px;
    }

    .stats-container {
        grid-template-columns: 1fr;
    }

    .leaderboards {
        grid-template-columns: 1fr;
    }

    .soviet-title {
        font-size: 2em;
    }

    .modal-content {
        width: 100%;
        height: 100dvh;
        margin: 0;
        padding: 12px;
        border-radius: 0;
        border-width: 0;
    }

    .modal-header {
        padding: 10px 0;
    }

    .modal-title {
        font-size: 1.4em;
    }

    .controls-section {
        flex-direction: column;
        gap: 10px;
        padding: 12px;
        margin: 12px 0 calc(env(safe-area-inset-bottom, 0px) + 8px);
    }

    .city-select {
        min-width: 100%;
        width: 100%;
    }

    .submit-btn {
        width: 100%;
        padding: 12px 20px;
    }

    .image-container {
        margin: 10px 0;
        padding-bottom: 8px;
    }

    .uploading-panel,
    .site-dialog-panel {
        width: min(100%, 360px);
        padding: 24px 18px;
    }
}

@media (max-width: 480px) {
    .modal-content {
        padding: 10px 8px calc(env(safe-area-inset-bottom, 0px) + 8px);
    }

    .modal-title {
        font-size: 1.2em;
    }

    .controls-section {
        padding: 8px;
    }

    .city-select {
        font-size: 1em;
        padding: 8px;
    }

    .submit-btn {
        font-size: 1em;
        padding: 10px 15px;
    }

    .site-dialog {
        padding: 16px;
    }

    .site-dialog-message {
        font-size: 1rem;
    }
}
