* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
    background: #0a0f1c;
    color: #e5e7eb;
    line-height: 1.6;
}

/* ============== HEADER ============== */
header {
    background: linear-gradient(135deg, #0a1f3d, #1e40af);
    padding: 1.25rem 1rem 1.75rem;
    border-bottom: 3px solid #60a5fa;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    position: relative;
}

.header-content {
    max-width: 1380px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: #93c5fd;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    padding: 0.4rem 0.9rem;
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(8px);
    transition: all 0.2s ease;
}

.back-link:hover {
    background: rgba(255, 255, 255, 0.18);
    color: #dbeafe;
    transform: translateY(-1px);
}

.title-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    text-align: center;
}

h1 {
    color: #ffffff;
    font-size: 1.85rem;
    font-weight: 700;
    margin: 0;
    line-height: 1.1;
    letter-spacing: -0.025em;
}

.tagline {
    color: #d4af37;
    font-weight: 600;
    font-size: 1.02rem;
    margin: 0;
    max-width: 42ch;
    line-height: 1.35;
}

/* Tablet + Desktop Header */
@media (min-width: 640px) {
    header {
        padding: 1.5rem 1.25rem 2rem;
    }
    
    .header-content {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
    
    .back-link {
        font-size: 1.05rem;
        padding: 0.45rem 1.1rem;
        order: -1;
    }
    
    h1 {
        font-size: 2.35rem;
    }
    
    .tagline {
        font-size: 1.1rem;
    }
}

/* ============== MAIN LAYOUT ============== */
.container {
    max-width: 1380px;
    margin: 1.5rem auto;
    padding: 0 1rem;
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
}

.canvas-panel {
    position: sticky;
    top: 0;
    z-index: 10;
    background: #0a0f1c;
    padding-bottom: 1rem;
}

.canvas-wrapper {
    background: #111827;
    padding: 12px;
    border-radius: 20px;
    box-shadow: 0 20px 50px -12px rgb(0 0 0 / 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 340px;
    position: relative;
}

canvas {
    max-width: 100%;
    height: auto;
    max-height: 48vh;
    border-radius: 12px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.75);
    background: #000;
    border: 1px solid #475569;
}

.canvas-toolbar {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    margin-top: 1rem;
}

/* Controls */
.controls {
    background: #111827;
    border-radius: 20px;
    padding: 1.5rem;
    box-shadow: 0 20px 50px -12px rgb(0 0 0 / 0.6);
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
}

.control-section {
    border-bottom: 1px solid #334155;
    padding-bottom: 1.5rem;
}

.control-section:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

h3 {
    color: #60a5fa;
    margin: 0 0 0.85rem;
    font-size: 1.25rem;
}

h4 {
    color: #93c5fd;
    margin: 1.1rem 0 0.5rem;
    font-size: 1rem;
}

input[type="url"], input[type="text"] {
    width: 100%;
    padding: 12px 14px;
    background: #1f2937;
    border: 1px solid #475569;
    border-radius: 10px;
    color: white;
    font-size: 1rem;
}

input[type="range"] {
    width: 100%;
    accent-color: #60a5fa;
}

/* Buttons */
.primary-btn {
    background: linear-gradient(90deg, #1e40af, #3b82f6);
    color: white;
    font-weight: 700;
    padding: 16px 20px;
    border-radius: 12px;
    width: 100%;
    cursor: pointer;
    font-size: 1.1rem;
    margin-top: 0.5rem;
}

.secondary-btn {
    background: #334155;
    color: #e2e8f0;
    padding: 12px 20px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 500;
}

.note {
    font-size: 0.9rem;
    color: #9ca3af;
    text-align: center;
    margin: 0.5rem 0 0;
}

/* ============== DESKTOP ============== */
@media (min-width: 960px) {
    .container {
        flex-direction: row;
        gap: 2.5rem;
        margin: 2rem auto;
    }
    
    .canvas-panel {
        flex: 1;
        position: static;
    }
    
    .controls {
        width: 380px;
        flex-shrink: 0;
    }
    
    .canvas-wrapper {
        min-height: 620px;
        padding: 32px;
    }
    
    canvas {
        max-height: none;
    }
}

/* Landscape Mobile Optimization */
@media (max-width: 959px) and (orientation: landscape) {
    .canvas-wrapper {
        min-height: 300px;
    }
    canvas {
        max-height: 58vh;
    }
}