:root {
    --bg: #FFF6EA;
    --card: #FFFFFF;
    --hover: #F3EFE6;
    --border: #E6E1D5;
    --text: #2B2A27;
    --muted: #8A867C;
    --pill: #EFEBE0;
    --green: #2ECC71;
    --gray: #CCCCCC;
}

* { 
	box-sizing: border-box; 
}

main { 
	padding: 0 14px 20px; 
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Segoe UI", sans-serif;
}
header { 
	padding: 20px 18px 14px; 
}
h1 { 
	font-size: 30px; margin: 0; font-weight: 700; 
}

#summary { 
	margin-top: 5px; font-size: 12px; color: var(--muted); 
}

.filters { 
	display: flex; gap: 4px; margin-top: 15px; 
}

.filter {
    padding: 7px 14px; border: 0; border-radius: 3px;
    background: var(--pill); color: var(--muted);
    font-weight: 700; cursor: pointer;
}

.filter.active { 
	background: var(--text); color: white; 
}

#devices {
    display: grid;
    grid-template-columns: repeat(auto-fill, 148px);
    justify-content: center;
    gap: 16px;
}

.device {
    width: 188px; height: 228px; background: var(--card);
    border: 1px solid var(--border); border-radius: 2px;
    display: flex; flex-direction: column; align-items: center;
    cursor: context-menu; transition: background .15s;
}

.device:hover { 
	background: var(--hover); 
}

.device-icon {
    width: 128px; height: 128px; margin-top: 16px; object-fit: contain;
}
.indicator {
    position: relative; width: 12px; height: 12px; margin-top: 14px;
    border-radius: 50%; background: var(--gray); flex-shrink: 0;
}

.indicator.online { 
	background: var(--green); 
}

.indicator.online::before {
    content: ""; position: absolute; inset: -1px; border-radius: 50%;
    background: var(--green); animation: pulse 1.28s ease-out infinite;
}

@keyframes pulse {
    from { transform: scale(1); opacity: .65; }
    to { transform: scale(2.2); opacity: 0; }
}

.device-name {
    max-width: 138px; margin-top: 9px; font-size: 12px;
    font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.device-status { 
	margin-top: 4px; font-size: 12px; color: var(--muted); 
}

.device-status.online {
	color: var(--green); 
}

#connection {
    position: fixed; right: 12px; bottom: 10px;
    color: var(--muted); font-size: 11px;
}

#menu {
    display: none; position: fixed; z-index: 10; min-width: 180px;
    background: white; border: 1px solid var(--border);
    box-shadow: 0 4px 14px #00000014; padding: 4px;
}

#menu button {
    display: block; width: 100%; padding: 9px 12px; border: 0;
    background: white; color: var(--text); text-align: left;
    cursor: pointer; font: inherit; font-size: 13px;
}

#menu button:hover {
	background: var(--hover); 
}

#menu .separator {
	border-top: 1px solid var(--border); 
}

@media (max-width: 400px) {
    h1 { 
		font-size: 25px; 
	}
	
    #devices { 
		grid-template-columns: repeat(2, 148px); 
	}
}