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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
        Helvetica, Arial, sans-serif;
    font-size: 14px;
    color: #333;
    background: #fafafa;
    padding: 24px;
}

h1 {
    font-size: 20px;
    margin-bottom: 4px;
}

.subtitle {
    color: #666;
    font-size: 12px;
    margin-bottom: 20px;
}

.page-layout {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}

.left-panel {
    flex: 0 0 340px;
}

.right-panel {
    flex: 1;
    min-width: 0;
}

.config-block {
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 10px 14px;
    border-radius: 6px;
    font-family: 'SF Mono', Monaco, Consolas, monospace;
    font-size: 11px;
    line-height: 1.5;
    margin-bottom: 16px;
    white-space: pre-wrap;
    word-break: break-word;
}

.config-block .mode {
    color: #4EC9B0;
    font-weight: 700;
    font-size: 12px;
}

.ad-slot-container {
    border: 2px dashed #ccc;
    border-radius: 6px;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 260px;
    background: #fff;
    margin-bottom: 16px;
}

.ad-slot-container .ad-slot {
    min-width: 300px;
    min-height: 250px;
}

/* Event log */
.event-log-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.event-log-header h2 {
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #444;
}

.event-log-header button {
    background: #e0e0e0;
    border: none;
    border-radius: 4px;
    padding: 4px 10px;
    font-size: 11px;
    cursor: pointer;
    color: #555;
}

.event-log-header button:hover {
    background: #d0d0d0;
}

#hbmp-event-log {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    max-height: 600px;
    overflow-y: auto;
    font-family: 'SF Mono', Monaco, Consolas, monospace;
    font-size: 11px;
}

.event-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 5px 10px;
    border-bottom: 1px solid #f0f0f0;
    line-height: 1.4;
}

.event-row:last-child {
    border-bottom: none;
}

.event-row .time {
    flex: 0 0 60px;
    color: #888;
    text-align: right;
}

.event-row .delta {
    flex: 0 0 50px;
    color: #aaa;
    text-align: right;
    font-size: 10px;
}

.event-row .badge {
    flex: 0 0 auto;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: #fff;
}

.badge-hb       { background: #2ecc71; }
.badge-gam      { background: #3498db; }
.badge-empty    { background: #95a5a6; }
.badge-hbmp     { background: #9b59b6; }
.badge-summary  { background: #34495e; }

.event-row .name {
    flex: 0 0 160px;
    font-weight: 600;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.event-row .payload {
    flex: 1;
    color: #666;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.event-row .element-tag {
    flex: 0 0 auto;
    background: #f0f0f0;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 10px;
    color: #555;
}

/* Collapsible event details */
.event-details {
    width: 100%;
}

.event-details summary {
    display: flex;
    align-items: baseline;
    gap: 8px;
    cursor: pointer;
    list-style: none;
}

.event-details summary::before {
    content: '\25b6';
    font-size: 8px;
    color: #aaa;
    flex: 0 0 10px;
    transition: transform 0.15s;
}

.event-details[open] summary::before {
    transform: rotate(90deg);
}

.event-dump {
    margin: 4px 0 2px 18px;
    padding: 6px 10px;
    background: #f5f5f5;
    border-left: 3px solid #ddd;
    font-size: 11px;
    line-height: 1.6;
    color: #444;
    white-space: pre-wrap;
    word-break: break-all;
}

.dump-key {
    color: #8e44ad;
    font-weight: 600;
}

/* Summary row */
.event-row.summary-row {
    background: #f8f9fa;
    border-bottom: 2px solid #e0e0e0;
    padding: 6px 10px;
}

.summary-row .stages {
    display: flex;
    gap: 12px;
    flex: 1;
}

.summary-row .stage {
    font-size: 10px;
}

.summary-row .stage-label {
    color: #888;
}

.summary-row .stage-value {
    font-weight: 700;
    color: #e67e22;
}

@media (max-width: 768px) {
    .page-layout {
        flex-direction: column;
    }
    .left-panel {
        flex: none;
        width: 100%;
    }
}
