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

body {
  font-family: 'Courier New', 'Consolas', monospace;
  background: #0a0a0a;
  color: #ffffff;
  min-height: 100vh;
  padding: 20px;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  background: #000000;
  border: 1px solid #2a2a2a;
  border-radius: 4px;
  overflow: hidden;
}

header {
  background: #1a1a1a;
  color: #ffffff;
  padding: 20px 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
  border-bottom: 1px solid #2a2a2a;
}

h1 {
  font-size: 1.5em;
  font-weight: 400;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.lang-switcher {
  display: flex;
  gap: 5px;
  background: #1a1a1a;
  padding: 4px;
  border: 1px solid #2a2a2a;
  border-radius: 2px;
}

.lang-btn {
  background: transparent;
  color: #7BEF;
  border: none;
  padding: 6px 12px;
  border-radius: 2px;
  font-size: 0.85em;
  font-family: 'Courier New', monospace;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 400;
}

.lang-btn:hover {
  background: #2a2a2a;
  color: #ffffff;
}

.lang-btn.active {
  background: #000000;
  color: #ffffff;
  border: 1px solid #ffffff;
}

.device-selector {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #1a1a1a;
  padding: 8px 16px;
  border: 1px solid #2a2a2a;
  border-radius: 2px;
}

.device-selector label {
  font-weight: 400;
  font-size: 0.85em;
  color: #7BEF;
}

.device-selector select {
  background: #000000;
  color: #ffffff;
  border: 1px solid #2a2a2a;
  padding: 6px 12px;
  border-radius: 2px;
  font-size: 0.85em;
  font-family: 'Courier New', monospace;
  cursor: pointer;
  outline: none;
  min-width: 180px;
}

.device-selector select:hover {
  background: #1a1a1a;
  border-color: #ffffff;
}

.device-selector select:focus {
  border-color: #ffffff;
}

.status {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #1a1a1a;
  padding: 8px 16px;
  border: 1px solid #2a2a2a;
  border-radius: 2px;
}

.status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ff3333;
  animation: pulse 2s infinite;
}

.status.connected .status-indicator {
  background: #ffffff;
}

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

main {
  padding: 30px;
}

.current-state {
  text-align: center;
  margin-bottom: 40px;
  padding: 20px;
  background: #0a0a0a;
  border: 1px solid #2a2a2a;
  border-radius: 2px;
}

.current-state h2 {
  color: #ffffff;
  margin-bottom: 20px;
  font-size: 1.2em;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.device-info {
  font-size: 0.7em;
  color: #7BEF;
  font-weight: 400;
  margin-left: 10px;
}

.state-display {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
  padding: 30px;
  background: #000000;
  border: 1px solid #2a2a2a;
  border-radius: 2px;
}

.state-icon {
  font-size: 1.5em;
  font-weight: 700;
  letter-spacing: 3px;
  width: 180px;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 2px;
  background: #1a1a1a;
  border: 2px solid #2a2a2a;
  transition: all 0.3s ease;
}

.state-display.detected .state-icon {
  background: #000000;
  border-color: #ffffff;
  color: #ffffff;
}

.state-display.not-detected .state-icon {
  background: #0a0a0a;
  border-color: #2a2a2a;
  color: #7BEF;
}

.state-label {
  font-size: 1.2em;
  font-weight: 400;
  color: #ffffff;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.last-update {
  margin-top: 15px;
  color: #7BEF;
  font-size: 0.85em;
}

.history {
  margin-top: 30px;
}

.history h2 {
  color: #ffffff;
  margin-bottom: 20px;
  font-size: 1.2em;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 2px;
}

/* Hide recent events list */
.history:last-of-type {
  display: none;
}

.chart-container {
  background: #000000;
  padding: 20px;
  border: 1px solid #2a2a2a;
  border-radius: 2px;
  margin-bottom: 20px;
  height: 300px;
}

.history-list {
  max-height: 400px;
  overflow-y: auto;
}

.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: #0a0a0a;
  border: 1px solid #1a1a1a;
  border-radius: 2px;
  margin-bottom: 8px;
  transition: all 0.2s ease;
}

.history-item:hover {
  border-color: #2a2a2a;
  background: #1a1a1a;
}

.history-item-state {
  font-weight: 400;
  font-size: 0.9em;
}

.history-item-state.detected {
  color: #ffffff;
}

.history-item-state.not-detected {
  color: #7BEF;
}

.history-item-time {
  color: #7BEF;
  font-size: 0.85em;
}

/* Statistics */
.statistics {
  margin-top: 30px;
  margin-bottom: 40px;
}

.statistics h2 {
  color: #ffffff;
  margin-bottom: 20px;
  font-size: 1.2em;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 2px;
}

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

.stat-card {
  background: #000000;
  padding: 20px;
  border: 1px solid #2a2a2a;
  border-radius: 2px;
  text-align: center;
  color: #ffffff;
  transition: all 0.3s ease;
}

.stat-card:hover {
  border-color: #ffffff;
  background: #0a0a0a;
}

.stat-value {
  font-size: 2.5em;
  font-weight: 400;
  margin-bottom: 10px;
  color: #ffffff;
}

.stat-label {
  font-size: 0.85em;
  color: #7BEF;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* IMU Data */
.imu-data {
  margin: 30px 0;
}

.imu-data h2 {
  color: #ffffff;
  margin-bottom: 20px;
  font-size: 1.2em;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 2px;
}

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

.imu-card {
  background: #000000;
  padding: 20px;
  border: 1px solid #2a2a2a;
  border-radius: 2px;
  color: #ffffff;
}

.imu-label {
  font-size: 0.85em;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 15px;
  color: #7BEF;
}

.imu-values {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.imu-values span {
  font-size: 1em;
  font-family: 'Courier New', monospace;
  background: #0a0a0a;
  padding: 8px 12px;
  border: 1px solid #1a1a1a;
  border-radius: 2px;
  color: #ffffff;
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #0a0a0a;
}

::-webkit-scrollbar-thumb {
  background: #2a2a2a;
  border-radius: 2px;
}

::-webkit-scrollbar-thumb:hover {
  background: #ffffff;
}
