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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  overflow: hidden;
  background: #000;
}

/* Video Container - Fullscreen */
#video-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: #000;
}

/* Video Elements */
.video-element {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  transition: opacity 0.5s ease, transform 0.3s ease;
  transform-origin: center center;
}

.video-element.active {
  opacity: 1;
  z-index: 1;
}

/* Rotation classes */
.video-element.rotate-90 {
  position: absolute;
  transform: rotate(90deg);

  transform-origin: bottom left;
  width: 100vh;
  height: 100vw;
  margin-top: -100vw;
}

.video-element.rotate-180 {
  transform: rotate(180deg);
}

.video-element.rotate-270 {
  position: absolute;
  transform: rotate(270deg);
  transform-origin: top right;
  width: 100vh;
  height: 100vw;
  margin-left: -100vh;
}

/* Control Panel - Top of page, collapsible */
.control-panel {
  position: fixed;
  top: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.85);
  color: white;
  border-radius: 8px;
  padding: 0;
  z-index: 1000;
  min-width: 280px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
}

.control-panel.collapsed .panel-content {
  display: none;
}

.control-panel.collapsed {
  min-width: 150px;
}

.control-panel.hidden {
  display: none;
}

/* Show Panel Button */
.show-panel-btn {
  position: fixed;
  top: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.85);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 18px;
  cursor: pointer;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(10px);
  transition: all 0.2s ease;
}

.show-panel-btn:hover {
  background: rgba(0, 0, 0, 0.95);
  border-color: rgba(255, 255, 255, 0.4);
}

/* Panel Header */
.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  cursor: pointer;
  user-select: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.control-panel.collapsed .panel-header {
  border-bottom: none;
}

.panel-title {
  font-weight: 600;
  font-size: 14px;
}

.toggle-btn {
  background: none;
  border: none;
  color: white;
  font-size: 12px;
  cursor: pointer;
  padding: 4px;
  transition: transform 0.3s ease;
}

.control-panel.collapsed .toggle-btn {
  transform: rotate(-90deg);
}

/* Panel Content */
.panel-content {
  padding: 16px;
}

/* Status Info */
.status-info {
  margin-bottom: 16px;
  font-size: 13px;
  line-height: 1.6;
}

.status-info strong {
  color: #888;
}

#state-display {
  color: #4CAF50;
  font-weight: 600;
}

#sensor-display {
  color: #2196F3;
}

#sensor-display.triggered {
  color: #FF9800;
}

/* Controls */
.controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.btn {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 10px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s ease;
}

.btn:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.4);
}

.btn:active {
  transform: scale(0.98);
}

/* Info Section */
.info {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 12px;
}

.info .small {
  font-size: 11px;
  color: #888;
  margin: 4px 0;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

/* Responsive */
@media (max-width: 768px) {
  .control-panel {
    top: 5px;
    right: 5px;
    min-width: 240px;
  }
}
