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

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

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

/* Tooltip Styles */
.tooltip-container {
    position: relative;
    display: inline-block;
}

.tooltip-trigger {
    padding: 10px 15px;
    font-size: 1em;
    border: 2px solid #ddd;
    border-radius: 5px;
    background: white;
    cursor: pointer;
    margin-right: 20px;
}

.tooltip-trigger:focus {
    outline: none;
    border-color: #667eea;
}

.tooltip-trigger:hover {
    border-color: #667eea;
}

.tooltip-content {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    color: #333;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
    z-index: 1000;
    width: 300px;
    margin-top: 10px;
    transition: all 0.3s ease;
    pointer-events: none;
}

.tooltip-content::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 8px solid white;
}

.tooltip-container:hover .tooltip-content {
    visibility: visible;
    opacity: 1;
    transform: translateX(-50%) translateY(5px);
}

.tooltip-content h3 {
    font-size: 1.3em;
    margin-bottom: 10px;
    color: #333;
    text-align: center;
}

.tooltip-content p {
    font-size: 1em;
    line-height: 1.4;
    color: #666;
    text-align: center;
    margin: 0;
}

.controls {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.controls-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 20px;
}

.select-section {
    display: flex;
    align-items: center;
    gap: 10px;
}

.controls label {
    font-size: 1.1em;
    font-weight: bold;
    white-space: nowrap;
}

.animation-controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.animation-controls button {
    padding: 10px 20px;
    font-size: 1em;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
}

#animateBtn {
    background: #667eea;
    color: white;
}

#animateBtn:hover {
    background: #5a6fd8;
    transform: translateY(-2px);
}

#resetBtn {
    background: #f39c12;
    color: white;
}

#resetBtn:hover {
    background: #e67e22;
    transform: translateY(-2px);
}

#stepByStepBtn {
    background: #2ecc71;
    color: white;
}

#stepByStepBtn:hover {
    background: #27ae60;
    transform: translateY(-2px);
}

.visualization-area {
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    padding: 20px;
    margin-bottom: 20px;
}

.shape-container {
    display: flex;
    align-items: center;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 20px;
}

.shape-section {
    flex: 1;
    min-width: 300px;
    text-align: center;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 15px;
}

.shape-section h3 {
    margin: 0;
    color: #333;
    font-size: 1.3em;
}

.centre-btn {
    padding: 6px 12px;
    font-size: 0.8em;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
}

.centre-btn:hover {
    background: #5a6fd8;
    transform: translateY(-1px);
}

.centre-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

#shape2d, #shape3d {
    width: 100%;
    max-width: 400px;
    height: 300px;
    margin: 0 auto;
    border: 2px solid #ddd;
    border-radius: 10px;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.arrow {
    font-size: 3em;
    color: #667eea;
    font-weight: bold;
    margin: 0 20px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.shape-info {
    margin-top: 15px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 5px;
    font-size: 0.9em;
    color: #666;
}

.explanation {
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    padding: 20px;
}

.explanation-content h3 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.3em;
}

.explanation-content p {
    line-height: 1.6;
    color: #666;
    margin-bottom: 10px;
}

.explanation-content ul {
    margin-left: 20px;
    color: #666;
}

.explanation-content li {
    margin-bottom: 5px;
    line-height: 1.5;
}

/* 2D Shape Styles */
.circle-2d {
    width: 150px;
    height: 150px;
    border: 3px solid #e74c3c;
    border-radius: 50%;
    background: rgba(231, 76, 60, 0.1);
}

.square-2d {
    width: 150px;
    height: 150px;
    border: 3px solid #3498db;
    background: rgba(52, 152, 219, 0.1);
}

.triangle-2d {
    width: 0;
    height: 0;
    border-left: 75px solid transparent;
    border-right: 75px solid transparent;
    border-bottom: 130px solid #2ecc71;
    background: transparent;
}

.rectangle-2d {
    width: 200px;
    height: 120px;
    border: 3px solid #f39c12;
    background: rgba(243, 156, 18, 0.1);
}

.pentagon-2d {
    width: 150px;
    height: 150px;
    background: rgba(155, 89, 182, 0.1);
    border: 3px solid #9b59b6;
    clip-path: polygon(50% 0%, 100% 38%, 82% 100%, 18% 100%, 0% 38%);
}

.hexagon-2d {
    width: 150px;
    height: 130px;
    background: rgba(52, 73, 94, 0.1);
    border: 3px solid #34495e;
    clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
}

/* Responsive Design */
@media (max-width: 768px) {
    .controls-row {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }
    
    .select-section {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .animation-controls {
        justify-content: center;
    }
    
    .shape-container {
        flex-direction: column;
    }
    
    .arrow {
        transform: rotate(90deg);
        margin: 20px 0;
    }
    
    .shape-section {
        min-width: 100%;
    }
    
    #shape2d, #shape3d {
        width: 100%;
        max-width: 300px;
        height: 250px;
    }
    
    header h1 {
        font-size: 2em;
    }
}

/* Zoom indicator styles */
.zoom-indicator {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 0.8em;
    font-weight: bold;
    z-index: 10;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

#shape2d:hover .zoom-indicator,
#shape3d:hover .zoom-indicator {
    opacity: 1;
}

#shape2d .zoom-indicator,
#shape3d .zoom-indicator {
    opacity: 0.7;
}

/* Add cursor hint for zoom functionality */
#shape2d,
#shape3d {
    cursor: grab;
}

#shape2d:active,
#shape3d:active {
    cursor: grabbing;
}

/* Loading animation */
.loading {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Credits section */
.credits {
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    padding: 20px;
    margin-top: 20px;
    text-align: center;
}

.credits-content p {
    margin: 8px 0;
    color: #666;
    font-size: 0.9em;
    line-height: 1.5;
}

.credits-content p:first-child {
    color: #333;
    font-size: 1em;
}

.credits-content a {
    color: #667eea;
    text-decoration: none;
    transition: color 0.3s ease;
}

.credits-content a:hover {
    color: #5a6fd8;
    text-decoration: underline;
}

/* Mobile zoom controls */
.mobile-zoom-controls {
    position: absolute;
    bottom: 10px;
    left: 10px;
    display: flex;
    gap: 5px;
    z-index: 20;
}

.zoom-btn {
    width: 35px;
    height: 35px;
    border: none;
    border-radius: 50%;
    background: rgba(102, 126, 234, 0.9);
    color: white;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.zoom-btn:hover {
    background: rgba(90, 111, 216, 0.9);
    transform: scale(1.1);
}

.zoom-btn:active {
    transform: scale(0.95);
    background: rgba(82, 103, 208, 0.9);
}

/* Hide mobile zoom controls on desktop */
@media (min-width: 769px) {
    .mobile-zoom-controls {
        display: none;
    }
}

/* Touch-friendly adjustments for mobile */
@media (max-width: 768px) {
    #shape2d, #shape3d {
        touch-action: pan-x pan-y pinch-zoom;
    }
    
    /* Make zoom indicators more visible on mobile */
    .zoom-indicator {
        opacity: 0.9 !important;
        font-size: 0.9em;
        padding: 8px 12px;
    }
    
    /* Ensure mobile zoom controls are always visible */
    .mobile-zoom-controls {
        display: flex !important;
    }
    
    /* Adjust container positioning for mobile controls */
    #shape2d, #shape3d {
        position: relative;
    }
}

/* Responsive adjustments for credits */
@media (max-width: 768px) {
    .credits-content p {
        font-size: 0.8em;
    }
    
    .credits-content a {
        word-break: break-all;
    }
}
