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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    min-height: 100vh;
    padding: 20px;
}

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

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

header h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 10px;
}

header .subtitle {
    font-size: 1rem;
    opacity: 0.9;
}

main {
    padding: 30px;
}

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

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

.wave-panel,
.animation-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.chart-display,
.animation-display {
    background: white;
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.chart-display h3,
.animation-display h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 10px;
}

.chart-display canvas,
.animation-display canvas {
    width: 100%;
    height: 180px;
    background: linear-gradient(to bottom, #f8fafc, #f1f5f9);
    border-radius: 8px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

.chart-legend {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 10px;
    font-size: 0.8rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

.probability-display {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.probability-display h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #92400e;
    margin-bottom: 15px;
    text-align: center;
}

.probability-bars {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.prob-bar {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.prob-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    font-weight: 600;
    color: #374151;
}

.prob-bar-container {
    width: 100%;
    height: 30px;
    background: white;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.prob-bar-fill {
    height: 100%;
    transition: width 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 10px;
    font-size: 0.75rem;
    font-weight: 700;
    color: white;
}

.prob-bar-fill.transmission {
    background: linear-gradient(90deg, #22c55e, #16a34a);
}

.prob-bar-fill.reflection {
    background: linear-gradient(90deg, #ef4444, #dc2626);
}

.animation-info {
    display: flex;
    justify-content: space-around;
    margin-top: 10px;
    font-size: 0.85rem;
    color: #475569;
}

.info-item {
    display: flex;
    gap: 5px;
}

.info-item span:last-child {
    font-weight: 700;
    color: #6366f1;
}

.comparison-display {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.comparison-display h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #0369a1;
    margin-bottom: 12px;
}

.comparison-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.comparison-item {
    background: white;
    padding: 12px;
    border-radius: 8px;
    text-align: center;
}

.comparison-item h4 {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.comparison-item.classical h4 {
    color: #dc2626;
}

.comparison-item.quantum h4 {
    color: #7c3aed;
}

.comparison-item p {
    font-size: 0.8rem;
    color: #475569;
    line-height: 1.4;
}

.controls-panel {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.controls-panel h3 {
    font-size: 1.3rem;
    font-weight: 700;
    color: #0c4a6e;
    margin-bottom: 20px;
}

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

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

.control-group h4 {
    font-size: 0.95rem;
    font-weight: 600;
    color: #6366f1;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #e0e7ff;
}

.control-group label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 500;
    color: #374151;
    margin-bottom: 8px;
    margin-top: 12px;
    font-size: 0.85rem;
}

.control-group label span:last-child {
    color: #6366f1;
    font-weight: 700;
}

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

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

.checkbox-input {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.preset-btn {
    padding: 10px 15px;
    font-size: 0.85rem;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-top: 8px;
    width: 100%;
}

.preset-btn:hover {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
}

.button-group {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.control-button {
    padding: 12px 30px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.control-button.start {
    background: #10b981;
    color: white;
}

.control-button.start:hover {
    background: #059669;
    transform: translateY(-2px);
    box-shadow: 0 6px 8px rgba(0, 0, 0, 0.15);
}

.control-button.pause {
    background: #f59e0b;
    color: white;
}

.control-button.pause:hover {
    background: #d97706;
    transform: translateY(-2px);
    box-shadow: 0 6px 8px rgba(0, 0, 0, 0.15);
}

.control-button.reset {
    background: #6b7280;
    color: white;
}

.control-button.reset:hover {
    background: #4b5563;
    transform: translateY(-2px);
    box-shadow: 0 6px 8px rgba(0, 0, 0, 0.15);
}

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

.formulas-section h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #0c4a6e;
    margin-bottom: 15px;
}

.formula-list {
    display: grid;
    gap: 10px;
}

.formula-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    background: #f8fafc;
    border-radius: 6px;
}

.formula-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #475569;
    min-width: 140px;
}

.formula {
    font-family: 'Times New Roman', serif;
    font-size: 0.9rem;
    color: #1e40af;
    font-style: italic;
}

.explanation {
    padding: 30px;
    background: #fafafa;
    border-top: 1px solid #e5e7eb;
}

.explanation h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #0c4a6e;
    margin-bottom: 15px;
}

.explanation h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #6366f1;
    margin: 20px 0 10px;
}

.explanation p {
    line-height: 1.7;
    color: #374151;
    margin-bottom: 12px;
}

.explanation strong {
    color: #1e40af;
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    header h1 {
        font-size: 1.5rem;
    }

    header .subtitle {
        font-size: 0.9rem;
    }

    main {
        padding: 15px;
    }

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

    .button-group {
        flex-direction: column;
    }

    .control-button {
        width: 100%;
    }

    .formula-label {
        min-width: auto;
    }

    .formula-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .comparison-content {
        grid-template-columns: 1fr;
    }
}
