* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Courier New', monospace;
    background: 
        linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)),
        url('dungeon-bg.png') center center / cover no-repeat fixed;
    color: #c4c4a4;
    min-height: 100vh;
    padding: 10px;
    position: relative;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 50% 40%, transparent 20%, rgba(0, 0, 0, 0.6) 100%);
    pointer-events: none;
    z-index: 0;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
    padding-bottom: 60px; /* Space for fixed footer */
}

/* Header */
header {
    text-align: center;
    margin-bottom: 10px;
    padding: 10px 15px;
    border: 2px solid rgba(180, 150, 80, 0.6);
    background: rgba(20, 30, 15, 0.9);
    backdrop-filter: blur(10px);
    border-radius: 8px;
    box-shadow: 
        0 4px 6px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

h1 {
    font-size: 1.4rem;
    text-shadow: 
        0 2px 4px rgba(0, 0, 0, 0.8),
        0 0 20px rgba(212, 175, 55, 0.3);
    margin-bottom: 3px;
    color: #d4af37;
    font-weight: bold;
    letter-spacing: 2px;
    text-transform: uppercase;
}


/* Upload Section */
.upload-section {
    text-align: center;
    margin-bottom: 8px;
}

.upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: rgba(20, 30, 15, 0.9);
    border: 2px solid rgba(180, 150, 80, 0.6);
    color: #d4af37;
    font-size: 0.85rem;
    font-family: inherit;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.upload-btn:hover {
    background: rgba(212, 175, 55, 0.2);
    border-color: #d4af37;
    color: #f4d67a;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
    transform: translateY(-1px);
}

.upload-icon-img {
    width: 24px;
    height: auto;
}

/* Controls */
.controls {
    background: rgba(20, 30, 15, 0.9);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(180, 150, 80, 0.6);
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 8px;
    box-shadow: 
        0 4px 6px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.control-group {
    margin-bottom: 8px;
}

.control-group label {
    display: block;
    margin-bottom: 5px;
    font-size: 0.85rem;
    color: #c4c4a4;
}

#thresholdValue {
    color: #d4af37;
    font-weight: bold;
}

input[type="range"] {
    width: 100%;
    height: 6px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(180, 150, 80, 0.4);
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: #d4af37;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
    border: 2px solid #f4d67a;
}

input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #d4af37;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
    border: 2px solid #f4d67a;
}

/* Presets */
.presets {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.preset-btn {
    flex: 1;
    min-width: 90px;
    padding: 6px 8px;
    background: rgba(20, 30, 15, 0.8);
    border: 1px solid rgba(180, 150, 80, 0.5);
    color: #c4c4a4;
    font-family: inherit;
    font-size: 0.7rem;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.preset-btn:hover {
    background: rgba(212, 175, 55, 0.15);
    border-color: #d4af37;
    color: #d4af37;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.preset-btn:active {
    transform: scale(0.95);
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.download-btn,
.share-btn,
.reset-btn {
    flex: 1;
    min-width: 120px;
    padding: 8px 12px;
    font-family: inherit;
    font-size: 0.8rem;
    cursor: pointer;
    border-radius: 5px;
    border: 2px solid;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.download-btn {
    background: rgba(20, 30, 15, 0.8);
    color: #c4c4a4;
    border-color: rgba(180, 150, 80, 0.5);
    font-weight: bold;
}

.download-btn:hover {
    background: rgba(212, 175, 55, 0.15);
    border-color: #d4af37;
    color: #d4af37;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.share-btn {
    background: rgba(20, 30, 15, 0.8);
    color: #c4c4a4;
    border-color: rgba(180, 150, 80, 0.5);
    font-weight: bold;
}

.share-btn:hover {
    background: rgba(212, 175, 55, 0.15);
    border-color: #d4af37;
    color: #d4af37;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.reset-btn {
    background: rgba(20, 30, 15, 0.8);
    color: #c4c4a4;
    border-color: rgba(180, 150, 80, 0.5);
}

.reset-btn:hover {
    background: rgba(212, 175, 55, 0.15);
    border-color: #d4af37;
    color: #d4af37;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Canvas Section */
.canvas-section {
    margin-bottom: 8px;
    text-align: center;
}

.canvas-wrapper {
    border: 2px solid rgba(180, 150, 80, 0.6);
    border-radius: 8px;
    padding: 8px;
    background: rgba(20, 30, 15, 0.9);
    backdrop-filter: blur(5px);
    box-shadow: 
        0 4px 6px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    display: inline-block;
    max-width: 100%;
}

#canvas {
    display: block;
    max-width: 100%;
    max-height: 280px;
    height: auto;
    border-radius: 4px;
}

/* Placeholder */
.placeholder {
    text-align: center;
    padding: 40px 20px;
    border: 2px dashed rgba(180, 150, 80, 0.5);
    border-radius: 8px;
    background: rgba(20, 30, 15, 0.7);
    backdrop-filter: blur(10px);
    box-shadow: 
        0 4px 6px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.placeholder-content {
    opacity: 0.8;
}

.placeholder-icon {
    display: block;
    width: 60px;
    height: auto;
    margin: 0 auto 10px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

.placeholder p {
    font-size: 0.9rem;
    color: #c4c4a4;
}

/* Footer */
footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    text-align: center;
    padding: 10px 20px;
    border-top: 1px solid rgba(180, 150, 80, 0.4);
    background: rgba(20, 30, 15, 0.95);
    backdrop-filter: blur(10px);
    z-index: 100;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3);
}

.footer-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.footer-link {
    font-size: 0.9rem;
    color: #d4af37;
    text-decoration: none;
    font-weight: bold;
    transition: all 0.3s ease;
    font-family: inherit;
}

.footer-link:hover {
    color: #f4d67a;
    text-decoration: underline;
}

.footer-separator {
    width: 20px;
    height: auto;
    opacity: 0.8;
}

.footer-note {
    font-size: 0.75rem;
    color: #c4c4a4;
    margin: 0;
    white-space: nowrap;
}

.footer-note a {
    color: #d4af37;
    text-decoration: none;
    font-weight: bold;
    transition: all 0.3s ease;
}

.footer-note a:hover {
    color: #f4d67a;
    text-decoration: underline;
}

/* Responsive Footer */
@media (max-width: 1024px) {
    .footer-links {
        gap: 12px;
    }
    
    .footer-link {
        font-size: 0.75rem;
    }
    
    .footer-separator {
        width: 16px;
    }
}

@media (max-width: 768px) {
    .footer-links {
        flex-direction: column;
        gap: 8px;
    }
    
    .footer-separator {
        display: none;
    }
    
    .footer-link {
        font-size: 0.75rem;
    }
}

/* Responsive */
@media (max-width: 768px) {
    h1 {
        font-size: 1.8rem;
    }

    .presets {
        flex-direction: column;
    }

    .preset-btn {
        width: 100%;
    }

    .action-buttons {
        flex-direction: column;
    }
}

