.cell-grid-panel {
    padding: 10px;
    border-radius: 6px;
    background: rgba(20, 28, 52, 0.9);
    border: 1px solid #0f3460;
    color: #e2e8f0;
    font-family: sans-serif;
}

.cell-grid-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.cell-grid-title {
    font-size: 12px;
    font-weight: 600;
    color: #e2e8f0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.cell-grid {
    display: grid;
    gap: 4px;
}

.cell-cell {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 6px 4px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
    border: 1px solid transparent;
    min-height: 40px;
}

.cell-player-dot {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #ef4444;
    box-shadow: 0 0 4px rgba(239, 68, 68, 0.9);
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.cell-cell:hover {
    border-color: #4cc9f0;
}

.cell-cell.readonly {
    cursor: default;
}

.cell-cell.readonly:hover {
    border-color: transparent;
}

.cell-coord {
    font-size: 10px;
    color: #94a3b8;
    font-family: monospace;
}

.cell-status {
    font-size: 10px;
    font-weight: 600;
}

.cell-running {
    background: rgba(34, 197, 94, 0.15);
    border-color: rgba(34, 197, 94, 0.3);
}

.cell-running .cell-status { color: #22c55e; }

.cell-starting {
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.3);
}

.cell-starting .cell-status { color: #3b82f6; }

.cell-idle {
    background: rgba(234, 179, 8, 0.15);
    border-color: rgba(234, 179, 8, 0.3);
}

.cell-idle .cell-status { color: #eab308; }

.cell-saving {
    background: rgba(168, 85, 247, 0.15);
    border-color: rgba(168, 85, 247, 0.3);
}

.cell-saving .cell-status { color: #a855f7; }

.cell-stopping {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
}

.cell-stopping .cell-status { color: #ef4444; }

.cell-dormant {
    background: rgba(100, 116, 139, 0.1);
    border-color: rgba(100, 116, 139, 0.2);
}

.cell-dormant .cell-status { color: #64748b; }

.cell-grid-empty {
    font-size: 12px;
    color: #64748b;
    text-align: center;
    padding: 8px;
}

.spinner-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4cc9f0;
    animation: spin-pulse 1s ease-in-out infinite;
}

@keyframes spin-pulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

.error-message {
    margin-top: 6px;
    padding: 4px 6px;
    font-size: 11px;
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
    border-radius: 3px;
}

/* Client-local highlights, layered on top of server-status background. */
.cell-cell.cell-connected {
    box-shadow: inset 0 0 0 1px rgba(76, 201, 240, 0.9);
}

.cell-cell.cell-player {
    box-shadow: inset 0 0 0 2px #f1f5f9, 0 0 6px rgba(255, 255, 255, 0.4);
}

.cell-cell.cell-connected.cell-player {
    box-shadow: inset 0 0 0 2px #f1f5f9, 0 0 6px rgba(76, 201, 240, 0.6);
}

/* Hover tooltip — richer than native title, shows instantly with coord + status. */
.cell-tooltip {
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    display: none;
    flex-direction: column;
    gap: 2px;
    padding: 6px 8px;
    background: rgba(15, 23, 42, 0.96);
    border: 1px solid #334155;
    border-radius: 4px;
    color: #e2e8f0;
    font-family: sans-serif;
    font-size: 11px;
    line-height: 1.35;
    white-space: nowrap;
    pointer-events: none;
    z-index: 100;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}

.cell-tooltip strong {
    font-size: 12px;
    color: #f1f5f9;
    font-family: monospace;
}

.cell-tooltip .tooltip-row {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #cbd5e1;
}

.cell-tooltip .tooltip-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.25);
}

.cell-tooltip .tooltip-connected { color: #4cc9f0; }
.cell-tooltip .tooltip-player    { color: #f1f5f9; }

.cell-cell:hover .cell-tooltip {
    display: flex;
}

/* Compact cells are tiny; center-aligned tooltip overflows when panel is at
   screen edge. Left-align so tooltip extends into the grid, not off-screen. */
.cell-grid-panel.compact .cell-tooltip {
    left: 0;
    transform: none;
}

/* Compact mode — color-only grid cells, no header/labels. */
.cell-grid-panel.compact {
    padding: 4px;
}

.cell-grid-panel.compact .cell-grid {
    gap: 2px;
}

.cell-grid-panel.compact .cell-cell {
    padding: 0;
    min-height: 12px;
    min-width: 12px;
    border-radius: 2px;
}
