:root {
    --primary-color: #7a5af5;
    --secondary-color: #4db6e5;
    --accent-color: #e05f9d;
    --dark-bg: #0f0f18;
    --light-text: #f0f0f5;
    --dark-text: #212121;
    --card-bg: rgba(25, 25, 35, 0.85);
    --shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    --panel-width: 320px;
}

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

body {
    font-family: 'Noto Sans SC', sans-serif;
    background: var(--dark-bg);
    color: var(--light-text);
    min-height: 100vh;
    overflow-x: hidden;
    touch-action: manipulation;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 15px;
    position: relative;
}

header {
    text-align: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    color: var(--primary-color);
    display: inline-block;
}

.subtitle {
    font-size: 1.5rem;
    font-weight: 400;
    opacity: 0.8;
}

.description {
    font-size: 1.1rem;
    opacity: 0.8;
    margin-bottom: 20px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.canvas-container {
    position: relative;
    width: 100%;
    height: 70vh;
    min-height: 350px;
    background-color: rgba(10, 10, 20, 0.6);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    transition: all 0.3s ease;
}

.canvas-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    z-index: 3;
}

canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    touch-action: none;
}

#drawingCanvas {
    z-index: 1;
}

#effectCanvas {
    z-index: 2;
    pointer-events: none;
}

.controls-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    z-index: 100;
    border: none;
    font-size: 20px;
}

.controls-toggle:active {
    opacity: 0.9;
}

.controls-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: var(--panel-width);
    height: 100vh;
    background: var(--card-bg);
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.2);
    z-index: 99;
    transition: transform 0.3s ease;
    transform: translateX(100%);
    overflow-y: auto;
    padding: 15px;
}

.controls-panel.active {
    transform: translateX(0);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.panel-title {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--light-text);
}

.panel-close {
    background: none;
    border: none;
    color: var(--light-text);
    font-size: 1.5rem;
    cursor: pointer;
    opacity: 0.7;
}

.control-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 15px;
}

label {
    margin-bottom: 8px;
    font-size: 0.9rem;
    opacity: 0.9;
}

select, input[type="range"] {
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: var(--light-text);
    font-family: inherit;
}

select:focus, input[type="range"]:focus {
    outline: none;
}

select {
    appearance: none;
    padding-right: 30px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%234db6e5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px;
}

input[type="range"] {
    -webkit-appearance: none;
    height: 6px;
    background: rgba(255, 255, 255, 0.07);
    border-radius: 6px;
    outline: none;
    margin: 10px 0;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: var(--secondary-color);
    border-radius: 50%;
    cursor: pointer;
}

.button-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 15px;
}

.btn {
    padding: 10px;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: var(--light-text);
    font-family: inherit;
    cursor: pointer;
    text-align: center;
    font-size: 0.9rem;
}

.btn:active {
    opacity: 0.8;
}

.btn.primary {
    background: var(--primary-color);
    border-color: var(--primary-color);
    grid-column: span 2;
}

.floating-tools {
    position: fixed;
    bottom: 80px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 90;
}

.tool-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--card-bg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--light-text);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.tool-btn:active {
    opacity: 0.8;
}

.tips {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 30px;
}

.tips h3 {
    margin-bottom: 15px;
    font-size: 1.2rem;
    color: var(--secondary-color);
}

.tips ul {
    padding-left: 20px;
}

.tips li {
    margin-bottom: 10px;
    opacity: 0.9;
    font-size: 0.95rem;
    line-height: 1.5;
}

footer {
    text-align: center;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.9rem;
    opacity: 0.7;
}

footer a {
    color: var(--secondary-color);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* 移动端优化 */
@media (max-width: 768px) {
    .container {
        padding: 12px;
    }

    h1 {
        font-size: 1.8rem;
    }

    .subtitle {
        font-size: 1.2rem;
    }

    .canvas-container {
        height: 60vh;
    }

    .controls-panel {
        width: 85%;
    }

    .button-group {
        grid-template-columns: 1fr;
    }

    .btn.primary {
        grid-column: span 1;
    }

    .tips {
        padding: 20px;
    }

    .tips h3 {
        font-size: 1.2rem;
    }

    .tips li {
        font-size: 0.9rem;
    }
}
