* { margin:0; padding:0; box-sizing:border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: #0f0f1a;
  color: #eee;
  line-height: 1.6;
}
.container { max-width: 1100px; margin: 0 auto; padding: 20px; }

header {
  background: #1a1a2e;
  padding: 20px;
  border-radius: 12px;
  margin-bottom: 20px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}
h1 { margin-bottom: 16px; color: #00ddff; }

.connection {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
input {
  padding: 10px 14px;
  background: #16213e;
  border: 1px solid #334;
  border-radius: 8px;
  color: white;
  width: 220px;
}
button {
  padding: 10px 18px;
  background: #00aaff;
  border: none;
  border-radius: 8px;
  color: white;
  cursor: pointer;
  font-weight: 600;
}
button:hover { background: #00ccff; }
.danger { background: #ff3366; }
.danger:hover { background: #ff5577; }

.status {
  margin-top: 12px;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 0.9em;
  display: inline-block;
}
.connected { background: #00aa44; }
.disconnected { background: #aa0000; }

.tabs {
  display: flex;
  background: #16213e;
  border-radius: 8px;
  padding: 4px;
  margin-bottom: 20px;
}
.tab {
  flex: 1;
  padding: 12px;
  background: transparent;
  border: none;
  color: #aaa;
  border-radius: 6px;
  cursor: pointer;
}
.tab.active {
  background: #00aaff;
  color: white;
  font-weight: 600;
}

.panel { display: none; }
.panel.active { display: block; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.lamp-card, .group-card {
  background: #16213e;
  border-radius: 12px;
  padding: 16px;
  transition: all 0.2s;
}
.lamp-card:hover, .group-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 25px rgba(0, 170, 255, 0.15);
}

.lamp-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.lamp-name { font-size: 1.1em; font-weight: 600; }

.switch {
  position: relative;
  display: inline-block;
  width: 52px;
  height: 28px;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #334;
  transition: .3s;
  border-radius: 28px;
}
.slider:before {
  position: absolute;
  content: "";
  height: 22px;
  width: 22px;
  left: 3px;
  bottom: 3px;
  background: white;
  transition: .3s;
  border-radius: 50%;
}
input:checked + .slider { background: #00dd88; }
input:checked + .slider:before { transform: translateX(24px); }

.color-picker {
  width: 100%;
  height: 40px;
  border: none;
  border-radius: 8px;
  margin-top: 10px;
  cursor: pointer;
}

.big-btn {
  width: 100%;
  padding: 16px;
  font-size: 1.2em;
  margin: 15px 0;
}

.sync-status {
  padding: 12px;
  background: #0a1428;
  border-radius: 8px;
  text-align: center;
  margin: 15px 0;
  font-weight: 500;
}

.color-box {
  width: 100%;
  height: 120px;
  border-radius: 12px;
  margin: 12px 0;
  box-shadow: 0 0 0 6px rgba(255,255,255,0.1);
  transition: background 0.2s;
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
  margin-top: 10px;
}

label { display: block; margin: 15px 0 6px; color: #aaa; font-size: 0.95em; }

.preview { margin-top: 20px; }
