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

body {
    background: #1a1a2e;
    color: #e0e0e0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    overflow: hidden;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    background: #16213e;
    border-bottom: 1px solid #0f3460;
    flex-shrink: 0;
}

header h1 {
    font-size: 16px;
    font-weight: 600;
    color: #e94560;
}

#status {
    font-size: 13px;
    color: #888;
}

#status.connected {
    color: #4ecca3;
}

#status.error {
    color: #e94560;
}

/* Grid */
#grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    padding: 6px;
    overflow-y: auto;
    align-content: start;
}

.cell {
    background: #0a0a1a;
    border: 1px solid #1a1a3e;
    border-radius: 4px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    aspect-ratio: 4 / 3;
}

.cell:hover {
    border-color: #e94560;
}

.cell-label {
    position: absolute;
    top: 2px;
    left: 6px;
    font-size: 10px;
    color: #666;
    z-index: 2;
    pointer-events: none;
}

.cell-terminal {
    transform-origin: top left;
    pointer-events: none;
}

.cell.disconnected {
    border-color: #e94560;
    opacity: 0.5;
}

.cell.disconnected .cell-label {
    color: #e94560;
}

.cell.opted-out {
    opacity: 0.4;
}

.cell-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: #666;
    z-index: 1;
    pointer-events: none;
}

/* Zoom overlay */
#zoom-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 100;
    display: flex;
    flex-direction: column;
}

#zoom-overlay.hidden {
    display: none;
}

#zoom-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    background: #16213e;
    border-bottom: 1px solid #0f3460;
}

#zoom-title {
    font-size: 14px;
    font-weight: 600;
}

#zoom-close {
    background: none;
    border: none;
    color: #e94560;
    font-size: 24px;
    cursor: pointer;
    padding: 0 8px;
    line-height: 1;
}

#zoom-close:hover {
    color: #ff6b81;
}

#zoom-terminal {
    flex: 1;
    padding: 8px;
}

/* Responsive */
@media (min-width: 1600px) {
    #grid { grid-template-columns: repeat(6, 1fr); }
}

@media (max-width: 1200px) {
    #grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 800px) {
    #grid { grid-template-columns: repeat(2, 1fr); }
}
