:root {
  --bg-primary: #0a0e14;
  --bg-card: #151b26;
  --bg-surface: #1d2536;
  --text-main: #f0f6fc;
  --text-muted: #8b949e;
  --accent-cyan: #00ffcc;
  --accent-cyan-glow: rgba(0, 255, 204, 0.4);
  --accent-red: #ff3b30;
  --accent-red-glow: rgba(255, 59, 48, 0.5);
  --accent-blue: #0a84ff;
  --accent-green: #30d158;
  --accent-amber: #ff9f0a;
  --border-color: rgba(255, 255, 255, 0.08);
  --btn-gradient: linear-gradient(145deg, #222b3d, #171d2b);
  --btn-shadow: 4px 4px 10px rgba(0,0,0,0.5), -2px -2px 6px rgba(255,255,255,0.04);
  --btn-active: inset 3px 3px 6px rgba(0,0,0,0.6), inset -2px -2px 4px rgba(255,255,255,0.03);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px;
  overflow-x: hidden;
}

/* Header Bar */
.top-nav {
  width: 100%;
  max-width: 480px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  background: var(--bg-card);
  border-radius: 18px;
  border: 1px solid var(--border-color);
  margin-bottom: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-logo {
  font-size: 20px;
}

.brand-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.5px;
  background: linear-gradient(90deg, #fff, var(--accent-cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.server-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--accent-green);
  background: rgba(48, 209, 88, 0.1);
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid rgba(48, 209, 88, 0.3);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green);
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

/* Device Category Selector */
.device-tabs {
  width: 100%;
  max-width: 480px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 14px;
}

.tab-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 4px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 11px;
  font-weight: 600;
}

.tab-btn .tab-icon {
  font-size: 18px;
}

.tab-btn.active {
  background: var(--btn-gradient);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  box-shadow: 0 0 14px var(--accent-cyan-glow);
  transform: translateY(-2px);
}

/* Main Remote Body (Phone Handheld Look) */
.remote-body {
  width: 100%;
  max-width: 420px;
  background: linear-gradient(180deg, #18202e 0%, #121722 100%);
  border-radius: 36px;
  border: 2px solid rgba(255, 255, 255, 0.08);
  padding: 22px 18px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.7), inset 0 1px 1px rgba(255, 255, 255, 0.15);
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: relative;
}

/* IR Emitter Bulb Graphic */
.ir-emitter-top {
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 32px;
  height: 10px;
  background: #3a1515;
  border-radius: 5px;
  border: 1px solid #ff4444;
  box-shadow: 0 0 6px #ff0000;
}
.ir-emitter-top.transmitting {
  background: #ff0044;
  box-shadow: 0 0 20px #ff0055, 0 -6px 15px #ff0055;
}

/* Sub-header Brand Picker */
.brand-selector-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(0, 0, 0, 0.25);
  padding: 6px 12px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
}

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

.brand-select {
  background: #1e2638;
  color: var(--accent-cyan);
  border: 1px solid rgba(0, 255, 204, 0.3);
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  outline: none;
}

/* Button Base Styles */
.r-btn {
  background: var(--btn-gradient);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  font-weight: 600;
  box-shadow: var(--btn-shadow);
  cursor: pointer;
  transition: all 0.08s ease;
  position: relative;
  overflow: hidden;
}

.r-btn:active {
  box-shadow: var(--btn-active);
  transform: scale(0.96);
  border-color: rgba(255, 255, 255, 0.2);
}

/* Power Button */
.btn-power {
  background: linear-gradient(145deg, #d32f2f, #9a0007) !important;
  color: #fff !important;
  width: 52px;
  height: 52px;
  border-radius: 50% !important;
  border: 2px solid #ff7961 !important;
  box-shadow: 0 4px 15px var(--accent-red-glow), var(--btn-shadow) !important;
  font-size: 20px;
}
.btn-power:active {
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.8) !important;
}

/* D-PAD Circle Component */
.dpad-container {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px 0;
}

.dpad-circle {
  width: 190px;
  height: 190px;
  border-radius: 50%;
  background: #171d2b;
  position: relative;
  box-shadow: 8px 8px 18px rgba(0, 0, 0, 0.7), -4px -4px 12px rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
}

.dpad-btn {
  position: absolute;
  background: none;
  border: none;
  color: var(--text-main);
  font-size: 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
}

.dpad-btn:active {
  color: var(--accent-cyan);
}

.dpad-up { top: 6px; left: 50%; transform: translateX(-50%); width: 60px; height: 42px; }
.dpad-down { bottom: 6px; left: 50%; transform: translateX(-50%); width: 60px; height: 42px; }
.dpad-left { left: 6px; top: 50%; transform: translateY(-50%); width: 42px; height: 60px; }
.dpad-right { right: 6px; top: 50%; transform: translateY(-50%); width: 42px; height: 60px; }

.dpad-ok {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(145deg, #242f44, #18202e);
  border: 2px solid rgba(0, 255, 204, 0.3);
  color: var(--accent-cyan);
  font-weight: 700;
  font-size: 16px;
  box-shadow: var(--btn-shadow);
  cursor: pointer;
}
.dpad-ok:active {
  box-shadow: var(--btn-active);
  transform: translate(-50%, -50%) scale(0.94);
}

/* Two-column Rocker (Volume & Channel) */
.rockers-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.rocker-pill {
  background: #171d2a;
  border-radius: 28px;
  border: 1px solid var(--border-color);
  padding: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: inset 2px 2px 6px rgba(0,0,0,0.5);
}

.rocker-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 700;
  margin: 6px 0;
  letter-spacing: 1px;
}

.rocker-btn {
  width: 100%;
  height: 52px;
  border-radius: 22px;
  border: none;
  background: var(--btn-gradient);
  color: var(--text-main);
  font-size: 20px;
  cursor: pointer;
  box-shadow: var(--btn-shadow);
}
.rocker-btn:active {
  box-shadow: var(--btn-active);
  transform: scale(0.96);
}

/* Numpad Grid */
.numpad-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.numpad-btn {
  height: 44px;
  font-size: 16px;
  font-weight: 700;
}

/* Quick Streaming Buttons */
.streaming-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.stream-btn {
  height: 40px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.btn-netflix { background: linear-gradient(145deg, #e50914, #99050d) !important; color: white !important; }
.btn-youtube { background: linear-gradient(145deg, #ff0000, #aa0000) !important; color: white !important; }

/* ---------------- AC REMOTE STYLES ---------------- */
.ac-screen {
  background: #0f1c1f;
  border-radius: 20px;
  border: 2px solid #00ffcc44;
  box-shadow: inset 0 0 20px rgba(0, 255, 204, 0.15), 0 4px 15px rgba(0, 0, 0, 0.5);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  color: #00ffcc;
  font-family: 'Courier New', Courier, monospace;
}

.ac-screen-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 700;
  border-bottom: 1px dashed rgba(0, 255, 204, 0.2);
  padding-bottom: 6px;
}

.ac-temp-display {
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: 4px;
  padding: 10px 0;
}

.ac-temp-val {
  font-size: 58px;
  font-weight: 800;
  line-height: 1;
  text-shadow: 0 0 15px rgba(0, 255, 204, 0.6);
}

.ac-temp-unit {
  font-size: 24px;
  font-weight: 600;
}

.ac-screen-status {
  display: flex;
  justify-content: space-around;
  font-size: 11px;
  font-weight: 700;
}

.ac-mode-badge, .ac-fan-badge {
  background: rgba(0, 255, 204, 0.1);
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid rgba(0, 255, 204, 0.3);
}

.ac-temp-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.ac-temp-btn {
  height: 54px;
  font-size: 26px;
  font-weight: 800;
  color: var(--accent-cyan);
}

/* Oscilloscope Signal Monitor */
.signal-monitor-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border-radius: 20px;
  border: 1px solid var(--border-color);
  padding: 14px;
  margin-top: 14px;
}

.monitor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.waveform-canvas {
  width: 100%;
  height: 70px;
  background: #090d13;
  border-radius: 10px;
  border: 1px solid rgba(0, 255, 204, 0.2);
}

.signal-code-display {
  margin-top: 8px;
  font-family: monospace;
  font-size: 12px;
  color: var(--accent-cyan);
  background: rgba(0, 0, 0, 0.4);
  padding: 6px 10px;
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
}

/* Hardware Guide & Firmware Modal */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  padding: 16px;
}
.modal-overlay.active { display: flex; }

.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--accent-cyan);
  border-radius: 24px;
  width: 100%;
  max-width: 600px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 24px;
  color: var(--text-main);
  box-shadow: 0 20px 60px rgba(0, 255, 204, 0.2);
}

.code-pre {
  background: #090d13;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 14px;
  font-family: monospace;
  font-size: 12px;
  color: #38ef7d;
  overflow-x: auto;
  margin: 12px 0;
  max-height: 250px;
}

.btn-primary {
  background: linear-gradient(135deg, #00ffcc, #0099ff);
  color: #000;
  font-weight: 700;
  padding: 10px 18px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0, 255, 204, 0.4);
}
