:root {
  --bg-dark: #0a0e17;
  --card-bg: rgba(22, 28, 45, 0.85);
  --card-border: rgba(255, 255, 255, 0.08);
  --accent-blue: #007aff;
  --accent-gold: #ffb800;
  --text-main: #ffffff;
  --text-muted: #8e9bb0;
  --bulb-glow-color: rgba(255, 255, 255, 0.1);
  --bulb-fill-color: #2a3346;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
}

.app-container {
  width: 100%;
  max-width: 440px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 24px 20px;
  position: relative;
  backdrop-filter: blur(20px);
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #34c759;
  box-shadow: 0 0 10px #34c759;
  transition: all 0.3s ease;
}

.status-indicator.offline {
  background: #ff3b30;
  box-shadow: 0 0 10px #ff3b30;
}

.room-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.device-sub {
  font-size: 12px;
  color: var(--text-muted);
}

.header-actions {
  display: flex;
  gap: 8px;
}

.icon-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--card-border);
  color: var(--text-main);
  font-size: 16px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, background 0.2s;
}

.icon-btn:active {
  transform: scale(0.92);
  background: rgba(255, 255, 255, 0.15);
}

/* Bulb Stage */
.bulb-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px 0 24px 0;
  position: relative;
}

.bulb-wrapper {
  position: relative;
  width: 140px;
  height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.bulb-glow {
  position: absolute;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--bulb-glow-color) 0%, rgba(0, 0, 0, 0) 70%);
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 0.5s ease, transform 0.5s ease, background 0.3s ease;
  pointer-events: none;
}

.bulb-wrapper.is-on .bulb-glow {
  opacity: 1;
  transform: scale(1.3);
}

.bulb-svg {
  width: 100px;
  height: 130px;
  filter: drop-shadow(0 8px 24px rgba(0,0,0,0.5));
  transition: transform 0.2s ease;
}

.bulb-wrapper:active .bulb-svg {
  transform: scale(0.95);
}

#glassDome {
  fill: var(--bulb-fill-color);
  transition: fill 0.3s ease;
}

#filamentCore {
  transition: fill 0.3s ease, opacity 0.3s ease;
}

.power-toggle-btn {
  margin-top: 16px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--card-border);
  color: var(--text-main);
  padding: 10px 24px;
  border-radius: 30px;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.25s ease;
}

.power-toggle-btn.active {
  background: #34c759;
  color: #000000;
  box-shadow: 0 4px 16px rgba(52, 199, 89, 0.4);
}

.power-toggle-btn:active {
  transform: scale(0.96);
}

/* Controls Card */
.controls-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 28px;
  padding: 24px 20px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.4);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Mode Tabs */
.tab-pill {
  display: flex;
  background: rgba(0, 0, 0, 0.3);
  padding: 4px;
  border-radius: 14px;
  gap: 4px;
}

.tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 10px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-btn.active {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-main);
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* Sliders */
.slider-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.slider-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  font-weight: 600;
}

.slider-val {
  font-size: 13px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.slider-track-wrap {
  width: 100%;
}

.styled-slider {
  -webkit-appearance: none;
  width: 100%;
  height: 38px;
  border-radius: 19px;
  outline: none;
  transition: background 0.3s;
  cursor: pointer;
}

.brightness-slider {
  background: linear-gradient(to right, #1a2234, #fffae6);
}

.temp-slider {
  background: linear-gradient(to right, #ff9500 0%, #fffae6 50%, #80c5ff 100%);
}

.styled-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  cursor: pointer;
  transition: transform 0.15s ease;
}

.styled-slider::-webkit-slider-thumb:active {
  transform: scale(1.15);
}

.temp-marks {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  padding: 0 4px;
}

/* Quick Chips */
.quick-chips {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 10px;
}

.chip {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--card-border);
  color: var(--text-main);
  padding: 12px;
  border-radius: 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
}

.chip:active {
  background: rgba(255, 255, 255, 0.12);
  transform: scale(0.97);
}

/* Palette Grid */
.palette-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-top: 6px;
}

.color-btn {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--c);
  border: 3px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.2s;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.color-btn:active {
  transform: scale(1.15);
}

.color-picker-input {
  background: transparent;
  border: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
}

.hidden {
  display: none !important;
}

/* PIN Overlay */
.pin-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 14, 23, 0.95);
  backdrop-filter: blur(25px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.pin-card {
  width: 100%;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.pin-icon {
  font-size: 36px;
  margin-bottom: 12px;
}

.pin-card h2 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 6px;
}

.pin-card p {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.pin-display {
  display: flex;
  gap: 16px;
  margin-bottom: 30px;
}

.pin-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--text-muted);
  transition: all 0.2s;
}

.pin-dot.filled {
  background: #ffffff;
  border-color: #ffffff;
  box-shadow: 0 0 10px #ffffff;
}

.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  width: 100%;
}

.key-btn {
  aspect-ratio: 1;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--card-border);
  border-radius: 50%;
  font-size: 24px;
  font-weight: 600;
  color: #ffffff;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.key-btn:active {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(0.9);
}

.key-btn.alt-btn {
  font-size: 18px;
  color: var(--text-muted);
}

.pin-error {
  color: #ff3b30;
  font-size: 13px;
  margin-top: 16px;
  min-height: 18px;
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(10px);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-card {
  background: #182030;
  border: 1px solid var(--card-border);
  border-radius: 24px;
  padding: 24px;
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
}

.modal-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.4;
}

.shortcut-item {
  background: rgba(0, 0, 0, 0.3);
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.shortcut-item code {
  color: #409cff;
  font-family: monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 240px;
}

.copy-mini-btn {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #ffffff;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 11px;
}

.action-btn {
  background: var(--accent-blue);
  border: none;
  color: #ffffff;
  padding: 12px;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
}
