.delegate-demo {
    background: #f8f9fa;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    min-height: 200px;
}
.demo-item {
    padding: 12px;
    margin: 8px 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
}
.demo-item:hover {
    background: #f1f8ff;
    border-color: #3498db;
}
.demo-item.active {
    background: #d1ecf1;
    border-color: #17a2b8;
}
.demo-item.clicked {
    background: #d4edda;
    border-color: #28a745;
}
.event-flow {
    position: relative;
    height: 300px;
    margin: 30px 0;
    background: linear-gradient(to right, #f8f9fa, #e9ecef);
    border-radius: 8px;
    overflow: hidden;
}
.flow-step {
    position: absolute;
    width: 100px;
    height: 60px;
    background: white;
    border: 2px solid;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-weight: bold;
    box-shadow: 0 3px 6px rgba(0,0,0,0.1);
    transition: all 0.5s;
}
.flow-arrow {
    position: absolute;
    font-size: 24px;
    color: #6c757d;
}
.flow-step.target {
    border-color: #28a745;
    background: #d4edda;
}
.flow-step.parent {
    border-color: #17a2b8;
    background: #d1ecf1;
}
.flow-step.document {
    border-color: #6f42c1;
    background: #e9d8fd;
}
.comparison-table {
    width: 100%;
    border-collapse: collapse;
    margin: 25px 0;
}
.comparison-table th,
.comparison-table td {
    border: 1px solid #dee2e6;
    padding: 15px;
    text-align: left;
}
.comparison-table th {
    background-color: #343a40;
    color: white;
    font-weight: bold;
}
.comparison-table tr:nth-child(even) {
    background-color: #f8f9fa;
}
.comparison-table .better {
    background-color: rgba(40, 167, 69, 0.1);
}
.comparison-table .worse {
    background-color: rgba(220, 53, 69, 0.1);
}
.code-example {
    background: #f1f3f4;
    border-left: 4px solid #3498db;
    padding: 20px;
    margin: 20px 0;
    border-radius: 0 5px 5px 0;
}
.scenario-card {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
    margin: 15px 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.scenario-card h5 {
    color: #2c3e50;
    border-bottom: 2px solid #3498db;
    padding-bottom: 10px;
    margin-bottom: 15px;
}
.bubble-visual {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 20px;
    margin: 30px 0;
}
.bubble-level {
    display: flex;
    flex-direction: column;
    align-items: center;
}
.bubble-node {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    margin: 10px;
    position: relative;
    cursor: pointer;
    transition: transform 0.3s;
}
.bubble-node:hover {
    transform: scale(1.1);
}
.bubble-node.target {
    background: #e74c3c;
}
.bubble-node.parent {
    background: #3498db;
}
.bubble-node.grandparent {
    background: #2ecc71;
}
.bubble-node.document {
    background: #9b59b6;
}
.bubble-line {
    width: 2px;
    height: 30px;
    background: #95a5a6;
    margin: 5px 0;
}
.event-log {
    height: 200px;
    overflow-y: auto;
    background: #2c3e50;
    color: #ecf0f1;
    padding: 15px;
    border-radius: 5px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
}
.log-entry {
    padding: 5px 0;
    border-bottom: 1px solid #34495e;
}
.log-entry.target {
    color: #e74c3c;
}
.log-entry.parent {
    color: #3498db;
}
.log-entry.stop {
    color: #f39c12;
    font-weight: bold;
}
.performance-chart {
    width: 100%;
    height: 200px;
    background: #f8f9fa;
    border-radius: 5px;
    position: relative;
    margin: 20px 0;
    overflow: hidden;
}
.chart-bar {
    position: absolute;
    bottom: 0;
    width: 40px;
    background: linear-gradient(to top, #3498db, #2980b9);
    border-radius: 3px 3px 0 0;
    transition: height 1s;
}
.chart-bar.direct {
    background: linear-gradient(to top, #e74c3c, #c0392b);
}
.chart-label {
    position: absolute;
    bottom: -25px;
    width: 100%;
    text-align: center;
    font-size: 12px;
    color: #6c757d;
}
