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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
    color: #1f2937;
}

.concave-lens-container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    color: white;
    padding: 40px;
    text-align: center;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 12px;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.95;
}

main {
    padding: 40px;
}

.visualization-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 30px;
    margin-bottom: 40px;
}

@media (max-width: 1200px) {
    .visualization-layout {
        grid-template-columns: 1fr;
    }
}

.chart-display {
    background: #f9fafb;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
}

.chart-display h3 {
    font-size: 1.3rem;
    margin-bottom: 16px;
    color: #1f2937;
    font-weight: 600;
}

#lensCanvas {
    width: 100%;
    height: 500px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #e5e7eb;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    flex-shrink: 0;
}

.info-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.values-display,
.properties-display {
    background: #f9fafb;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
}

.values-display h3,
.properties-display h3 {
    font-size: 1.1rem;
    margin-bottom: 16px;
    color: #1f2937;
    font-weight: 600;
}

.values-grid,
.properties-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.value-item,
.property-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: white;
    border-radius: 8px;
    border-left: 3px solid #f97316;
}

.value-label,
.property-label {
    font-size: 0.9rem;
    color: #6b7280;
    font-weight: 500;
}

.value-value,
.property-value {
    font-size: 1rem;
    font-weight: 600;
    color: #1f2937;
}

.controls-panel {
    background: #f9fafb;
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 40px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
}

.controls-panel h3 {
    font-size: 1.5rem;
    margin-bottom: 24px;
    color: #1f2937;
    font-weight: 600;
}

.controls-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin-bottom: 30px;
}

.control-group {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.control-group h4 {
    font-size: 1rem;
    margin-bottom: 16px;
    color: #374151;
    font-weight: 600;
}

.control-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.9rem;
    color: #4b5563;
}

.control-group input[type="range"] {
    width: 100%;
    margin-bottom: 16px;
    height: 6px;
    background: #e5e7eb;
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
}

.control-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: #f97316;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.control-group input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: #f97316;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    border: none;
}

.checkbox-input {
    width: auto !important;
    margin-right: 8px;
    margin-bottom: 12px !important;
}

.preset-btn {
    width: 100%;
    padding: 10px 16px;
    margin-bottom: 8px;
    background: white;
    border: 2px solid #f97316;
    border-radius: 8px;
    color: #f97316;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.preset-btn:hover {
    background: #f97316;
    color: white;
    transform: translateY(-1px);
}

.preset-btn:active {
    transform: translateY(0);
}

.formulas-section {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.formulas-section h3 {
    font-size: 1.1rem;
    margin-bottom: 16px;
    color: #1f2937;
    font-weight: 600;
}

.formula-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.formula-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: #fef3c7;
    border-radius: 8px;
    border-left: 3px solid #f59e0b;
}

.formula-label {
    font-size: 0.9rem;
    color: #92400e;
    font-weight: 500;
}

.formula {
    font-size: 0.95rem;
    color: #78350f;
    font-weight: 600;
    font-family: 'Courier New', monospace;
}

.explanation {
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
}

.explanation h2 {
    font-size: 1.8rem;
    margin-bottom: 20px;
    color: #1f2937;
    font-weight: 700;
}

.explanation h3 {
    font-size: 1.4rem;
    margin-top: 30px;
    margin-bottom: 16px;
    color: #374151;
    font-weight: 600;
}

.explanation p {
    font-size: 1rem;
    line-height: 1.8;
    color: #4b5563;
    margin-bottom: 16px;
}

.explanation strong {
    color: #1f2937;
    font-weight: 600;
}

@media (max-width: 768px) {
    header {
        padding: 30px 20px;
    }

    header h1 {
        font-size: 1.8rem;
    }

    main {
        padding: 20px;
    }

    .controls-grid {
        grid-template-columns: 1fr;
    }

    .explanation {
        padding: 24px;
    }
}
