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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.top-nav {
    background: rgba(255, 255, 255, 0.95);
    padding: 15px 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

.nav-link {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.3s ease;
    display: inline-block;
}

.nav-link:hover {
    color: #764ba2;
    transform: translateX(-5px);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 30px;
    color: white;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

.controls-panel {
    background: white;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    gap: 25px;
    align-items: start;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.input-group label {
    font-weight: 600;
    color: #555;
}

.number-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.number-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.number-item label {
    font-weight: 600;
    min-width: 20px;
    color: #555;
}

.number-item input[type="number"] {
    flex: 1;
    padding: 8px;
    border: 2px solid #e1e5e9;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: border-color 0.3s ease;
}

.number-item input[type="number"]:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

.directions-group h3 {
    margin-bottom: 15px;
    color: #555;
    text-align: center;
}

.direction-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.direction-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.direction-item label {
    font-weight: 600;
    min-width: 50px;
    color: #555;
}

.direction-item input[type="color"] {
    width: 50px;
    height: 40px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.direction-item input[type="color"]:hover {
    transform: scale(1.1);
}

.direction-order-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.direction-order-item {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.direction-order-item label {
    font-weight: 600;
    min-width: 80px;
    color: #555;
}

.direction-select {
    flex: 1;
    padding: 8px;
    border: 2px solid #e1e5e9;
    border-radius: 6px;
    font-size: 0.9rem;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s ease;
    min-width: 100px;
}

.direction-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

.direction-order-item input[type="color"] {
    width: 50px;
    height: 40px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.direction-order-item input[type="color"]:hover {
    transform: scale(1.1);
}

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.btn {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #f8f9fa;
    color: #555;
    border: 2px solid #e1e5e9;
}

.btn-secondary:hover {
    background: #e9ecef;
    transform: translateY(-1px);
}

.canvas-container {
    background: white;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 25px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    text-align: center;
}

.canvas-with-zoom {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

#spirolateral-canvas {
    border: 2px solid #e1e5e9;
    border-radius: 10px;
    max-width: 100%;
    height: auto;
    background: #fafafa;
}

.zoom-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    width: 100%;
    max-width: 600px;
}

.zoom-controls h3 {
    margin: 0;
    color: #555;
    font-size: 1.1rem;
}

.zoom-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.btn-zoom {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #667eea;
    color: white;
}

.btn-zoom:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.zoom-info {
    font-weight: 600;
    color: #555;
    font-size: 1rem;
}

.info-panel {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.info-panel h3 {
    margin-bottom: 15px;
    color: #555;
}

.info-panel p {
    line-height: 1.6;
    color: #666;
}

.pattern-table-container {
    margin-top: 20px;
}

.pattern-table-container h4 {
    margin-bottom: 15px;
    color: #555;
}

.pattern-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.pattern-table th {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 8px;
    text-align: center;
    font-weight: 600;
    font-size: 0.9rem;
}

.pattern-table td {
    padding: 10px 8px;
    text-align: center;
    border-bottom: 1px solid #e1e5e9;
    font-size: 0.85rem;
}

.pattern-table tbody tr:nth-child(even) {
    background-color: #f8f9fa;
}

.pattern-table tbody tr:hover {
    background-color: #e3f2fd;
}

.pattern-table .step-number {
    font-weight: 600;
    color: #667eea;
}

.pattern-table .direction-cell {
    font-weight: 600;
}

.pattern-table .up { color: #ff6b6b; }
.pattern-table .left { color: #96ceb4; }
.pattern-table .down { color: #45b7d1; }
.pattern-table .right { color: #4ecdc4; }

/* College Savings Section */
.college-savings-panel {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 15px;
    padding: 30px;
    margin: 25px 0;
    color: white;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.savings-content {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
    align-items: center;
    margin-bottom: 25px;
}

.savings-text h3 {
    margin-bottom: 15px;
    font-size: 1.5rem;
    color: white;
}

.savings-text p {
    margin-bottom: 15px;
    line-height: 1.6;
    opacity: 0.95;
}

.gift-code-section {
    display: flex;
    justify-content: center;
}

.gift-code-box {
    background: white;
    border-radius: 15px;
    padding: 25px;
    text-align: center;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    min-width: 250px;
}

.gift-code-box h4 {
    margin-bottom: 15px;
    color: #333;
    font-size: 1.2rem;
}

.gift-code {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 2rem;
    font-weight: bold;
    padding: 15px 20px;
    border-radius: 10px;
    margin: 15px 0;
    letter-spacing: 2px;
    font-family: 'Courier New', monospace;
    box-shadow: 0 3px 10px rgba(0,0,0,0.2);
}

.gift-instructions {
    color: #666;
    font-size: 0.9rem;
    margin-top: 15px;
    line-height: 1.4;
}

.gift-instructions a {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
}

.gift-instructions a:hover {
    text-decoration: underline;
}

.savings-benefits {
    background: rgba(255,255,255,0.1);
    border-radius: 10px;
    padding: 20px;
    backdrop-filter: blur(10px);
}

.savings-benefits h4 {
    margin-bottom: 15px;
    color: white;
    font-size: 1.2rem;
}

.savings-benefits ul {
    list-style: none;
    padding: 0;
}

.savings-benefits li {
    margin-bottom: 8px;
    padding-left: 0;
    opacity: 0.95;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .controls-panel {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .number-inputs {
        grid-template-columns: 1fr;
    }
    
    .direction-controls {
        grid-template-columns: 1fr;
    }
    
    .action-buttons {
        flex-direction: row;
        justify-content: space-between;
    }
    
    .btn {
        flex: 1;
        margin: 0 5px;
    }
    
    #spirolateral-canvas {
        width: 100%;
        height: 400px;
    }
    
    .savings-content {
        grid-template-columns: 1fr;
        gap: 20px;
        text-align: center;
    }
    
    .gift-code-box {
        min-width: auto;
        width: 100%;
        max-width: 300px;
        margin: 0 auto;
    }
}

@media (max-width: 480px) {
    .action-buttons {
        flex-direction: column;
    }
    
    .btn {
        margin: 5px 0;
    }
    
    #spirolateral-canvas {
        height: 300px;
    }
}

/* Animation for canvas drawing */
@keyframes drawLine {
    from {
        stroke-dashoffset: 100;
    }
    to {
        stroke-dashoffset: 0;
    }
}

.drawing {
    animation: drawLine 0.1s ease-in-out;
}
