:root {
    --bg-color: #0d1117;
    --text-color: #e6edf3;
    --card-bg: rgba(22, 27, 34, 0.6);
    --card-border: rgba(255, 255, 255, 0.1);
    --primary: #58a6ff;
    --primary-hover: #3182ce;
    --secondary: rgba(255, 255, 255, 0.1);
    --secondary-hover: rgba(255, 255, 255, 0.2);
    --accent: #238636;
    --point-color: #ff7b72;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    position: relative;
}

/* Background Animations */
.background-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
    background: radial-gradient(circle at center, #1b222c 0%, #0d1117 100%);
}

.blob {
    position: absolute;
    filter: blur(80px);
    opacity: 0.5;
    animation: float 10s infinite ease-in-out alternate;
}

.blob-1 {
    width: 400px;
    height: 400px;
    background: #58a6ff;
    top: -100px;
    left: -100px;
    border-radius: 50%;
}

.blob-2 {
    width: 300px;
    height: 300px;
    background: #ff7b72;
    bottom: -50px;
    right: -50px;
    border-radius: 50%;
    animation-delay: -5s;
}

.blob-3 {
    width: 250px;
    height: 250px;
    background: #8957e5;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    animation-duration: 15s;
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(30px, 50px) scale(1.1); }
}

/* Layout */
.container {
    width: 100%;
    max-width: 900px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    z-index: 1;
}

header {
    text-align: center;
}

h1 {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    letter-spacing: -1px;
}

h1 span {
    color: var(--primary);
}

header p {
    color: #8b949e;
    font-size: 1.1rem;
}

/* Glass Panels */
.glass-panel {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 24px;
    padding: 2.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.glass-panel.hidden {
    display: none;
    opacity: 0;
    transform: translateY(20px);
}

.glass-panel.active {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    animation: fadeIn 0.5s ease forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Drop Zone */
.drop-zone {
    border: 2px dashed rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    padding: 4rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.drop-zone:hover, .drop-zone.dragover {
    border-color: var(--primary);
    background: rgba(88, 166, 255, 0.05);
}

.drop-zone svg {
    color: var(--primary);
    margin-bottom: 1rem;
    transition: transform 0.3s ease;
}

.drop-zone:hover svg {
    transform: translateY(-5px);
}

.drop-zone h2 {
    font-weight: 600;
}

.drop-zone p {
    color: #8b949e;
}

/* Editor Section */
.editor-header {
    text-align: center;
}

.canvas-container {
    width: 100%;
    display: flex;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}

canvas {
    max-width: 100%;
    max-height: 60vh;
    cursor: crosshair;
    display: block;
    touch-action: none; /* prevent scrolling when dragging points */
}

/* Slider Control */
.slider-control {
    padding: 0.5rem 0;
}

.slider-control label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.slider-label {
    font-weight: 600;
    font-size: 0.95rem;
}

.slider-value {
    color: var(--primary);
    font-weight: 700;
    font-size: 0.95rem;
    min-width: 3rem;
    text-align: right;
}

.slider-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.slider-tag {
    font-size: 0.75rem;
    color: #8b949e;
    white-space: nowrap;
}

.slider-row input[type="range"] {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.1);
    outline: none;
}

.slider-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 2px 8px rgba(88, 166, 255, 0.4);
    transition: transform 0.15s ease;
}

.slider-row input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.slider-row input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 2px 8px rgba(88, 166, 255, 0.4);
}

/* Result Section */
.result-container {
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(0,0,0,0.3);
    border-radius: 12px;
    padding: 1rem;
}

.result-container img {
    max-width: 100%;
    max-height: 70vh;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

/* Actions */
.actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1rem;
}

.btn {
    padding: 0.8rem 1.5rem;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    text-decoration: none;
    color: white;
    font-family: 'Inter', sans-serif;
}

.btn.primary {
    background: var(--primary);
}

.btn.primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(88, 166, 255, 0.3);
}

.btn.secondary {
    background: var(--secondary);
    border: 1px solid var(--card-border);
}

.btn.secondary:hover {
    background: var(--secondary-hover);
}

/* Loader */
.loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(13, 17, 23, 0.8);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 100;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
}

.loader-overlay.hidden {
    display: none;
}

.loader-overlay p {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary);
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(88, 166, 255, 0.2);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@media (max-width: 600px) {
    h1 {
        font-size: 2.2rem;
    }
    .glass-panel {
        padding: 1.5rem;
    }
    .drop-zone {
        padding: 2rem 1rem;
    }
}
